Plugin Directory

Changeset 3360322


Ignore:
Timestamp:
09/12/2025 08:03:06 AM (6 months ago)
Author:
squarewoosync
Message:

Update gateway

Location:
squarewoosync
Files:
115 added
13 edited

Legend:

Unmodified
Added
Removed
  • squarewoosync/trunk/build/blocks/gateway.asset.php

    r3315018 r3360322  
    1 <?php return array('dependencies' => array('wp-data', 'wp-element'), 'version' => 'ccb35e7c1aed9e0ff2f0');
     1<?php return array('dependencies' => array('wp-data', 'wp-element'), 'version' => 'fd90a8a6caa03a754e4e');
  • squarewoosync/trunk/build/blocks/gateway.js

    r3315018 r3360322  
    1 (()=>{"use strict";const e=window.wp.element;var t=window.wc.wcSettings.getSetting,n=function(){var e=t("squaresync_credit_data",null);if(!e)throw new Error("Square initialization data is not available");return{title:e.title||"",applicationId:e.applicationId||"",locationId:e.locationId||"",isSandbox:e.is_sandbox||!1,availableCardTypes:e.accepted_credit_cards||{},loggingEnabled:e.logging_enabled||!1,generalError:e.general_error||"",showSavedCards:e.show_saved_cards||!1,showSaveOption:e.show_save_option||!1,supports:e.supports||{},isTokenizationForced:e.is_tokenization_forced||!1,paymentTokenNonce:e.payment_token_nonce||"",isDigitalWalletsEnabled:"yes"===e.enable_apple_pay||"yes"===e.enable_google_pay||"yes"===e.enable_after_pay||!1,googlePay:e.enable_google_pay||"no",applePay:e.enable_apple_pay||"no",afterPay:e.enable_after_pay||"no",isPayForOrderPage:e.is_pay_for_order_page||!1,recalculateTotalNonce:e.recalculate_totals_nonce||!1,context:e.context||"",ajaxUrl:e.ajax_url||"",paymentRequestNonce:e.payment_request_nonce||"",googlePayColor:e.google_pay_color||"black",applePayColor:e.apple_pay_color||"black",applePayType:e.apple_pay_type||"buy",hideButtonOptions:e.hide_button_options||[],hasSubscription:e.hasSubscription||!1}};function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function o(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function c(n,r,o,a){var c=r&&r.prototype instanceof l?r:l,s=Object.create(c.prototype);return i(s,"_invoke",function(n,r,o){var i,a,c,l=0,s=o||[],f=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return i=t,a=0,c=e,p.n=n,u}};function d(n,r){for(a=n,c=r,t=0;!f&&l&&!o&&t<s.length;t++){var o,i=s[t],d=p.p,y=i[2];n>3?(o=y===r)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=n<2&&d<i[1])?(a=0,p.v=r,p.n=i[1]):d<y&&(o=n<3||i[0]>r||r>y)&&(i[4]=n,i[5]=r,p.n=y,a=0))}if(o||n>1)return u;throw f=!0,r}return function(o,s,y){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&d(s,y),a=s,c=y;(t=a<2?e:c)||!f;){i||(a?a<3?(a>1&&(p.n=-1),d(a,c)):p.n=c:p.v=c);try{if(l=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=p.n<0)?c:n.call(r,p))!==u)break}catch(t){i=e,a=1,c=t}finally{l=1}}return{value:t,done:f}}}(n,o,a),!0),s}var u={};function l(){}function s(){}function f(){}t=Object.getPrototypeOf;var p=[][r]?t(t([][r]())):(i(t={},r,function(){return this}),t),d=f.prototype=l.prototype=Object.create(p);function y(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,i(e,a,"GeneratorFunction")),e.prototype=Object.create(d),e}return s.prototype=f,i(d,"constructor",f),i(f,"constructor",s),s.displayName="GeneratorFunction",i(f,a,"GeneratorFunction"),i(d),i(d,a,"Generator"),i(d,r,function(){return this}),i(d,"toString",function(){return"[object Generator]"}),(o=function(){return{w:c,m:y}})()}function i(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}i=function(e,t,n,r){if(t)o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{var a=function(t,n){i(e,t,function(e){return this._invoke(t,n,e)})};a("next",0),a("throw",1),a("return",2)}},i(e,t,n,r)}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach(function(t){u(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function u(e,t,n){return(t=function(e){var t=function(e){if("object"!=r(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==r(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}var s=(0,e.createContext)(!1),f=function(t){var r=t.checkoutFormHandler,i=t.eventRegistration,a=t.emitResponse,u=(0,e.useContext)(s),f=i.onPaymentSetup,p=i.onCheckoutAfterProcessingWithError,d=i.onCheckoutAfterProcessingWithSuccess;return function(t,r,i,a,u,s){var f=(0,e.useRef)(i);(0,e.useEffect)(function(){f.current=i},[i]),(0,e.useEffect)(function(){var e=function(){var e,t=(e=o().m(function e(){var t,i,l,p,d,y,v,m,b,h,g,w,C,S,_,O;return o().w(function(e){for(;;)switch(e.n){case 0:if(i={type:r.responseTypes.SUCCESS},l={nonce:"",notices:[],logs:[]},null===(t=f.current)||void 0===t||!t.token){e.n=6;break}return e.p=1,p=n(),d=p.paymentTokenNonce,e.n=2,fetch("".concat(wc.wcSettings.ADMIN_URL,"admin-ajax.php?action=squaresync_credit_card_get_token_by_id&token_id=").concat(f.current.token,"&nonce=").concat(d));case 2:return y=e.v,e.n=3,y.json();case 3:v=e.v,m=v.success,b=v.data,l.token=m?b:"",e.n=5;break;case 4:e.p=4,e.v;case 5:e.n=9;break;case 6:return e.p=6,e.n=7,u(f.current.card);case 7:w=e.v,l.nonce=w.token,null!=w&&null!==(h=w.details)&&void 0!==h&&h.card&&null!=w&&null!==(g=w.details)&&void 0!==g&&g.billing&&(l.cardData=c(c({},w.details.card),w.details.billing)),e.n=9;break;case 8:e.p=8,_=e.v,console.error("Error creating nonce:",_);case 9:if(!(C=l.token||l.nonce)){e.n=13;break}return e.p=10,e.n=11,s(f.current.payments,C);case 11:S=e.v,l.verificationToken=S.verificationToken||"",l.logs=l.logs.concat(S.log||[]),l.errors=l.notices.concat(S.errors||[]),e.n=13;break;case 12:e.p=12,O=e.v,console.error("Error during buyer verification:",O);case 13:return C||l.logs.length>0?i.meta={paymentMethodData:a(l)}:l.notices.length>0&&(console.log("Errors or notices found:",l.notices),i.type=r.responseTypes.ERROR,i.message=l.notices),e.a(2,i)}},e,null,[[10,12],[6,8],[1,4]])}),function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){l(i,r,o,a,c,"next",e)}function c(e){l(i,r,o,a,c,"throw",e)}a(void 0)})});return function(){return t.apply(this,arguments)}}();return t(e)},[t,r.responseTypes.SUCCESS,r.responseTypes.ERROR,u,s,a])}(f,a,u,r.getPaymentMethodData,r.createNonce,r.verifyBuyer),function(t,n,r){(0,e.useEffect)(function(){var e=function(e){var t={type:r.responseTypes.SUCCESS},n=e.processingResponse,o=n.paymentStatus,i=n.paymentDetails;return o===r.responseTypes.ERROR&&i.checkoutNotices&&(t={type:r.responseTypes.ERROR,message:JSON.parse(i.checkoutNotices),messageContext:r.noticeContexts.PAYMENTS,retry:!0}),t},o=t(e),i=n(e);return function(){o(),i()}},[t,n,r.noticeContexts.PAYMENTS,r.responseTypes.ERROR,r.responseTypes.SUCCESS])}(p,d,a),null};function p(e){return p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},p(e)}function d(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var u=r&&r.prototype instanceof c?r:c,l=Object.create(u.prototype);return y(l,"_invoke",function(n,r,o){var i,c,u,l=0,s=o||[],f=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return i=t,c=0,u=e,p.n=n,a}};function d(n,r){for(c=n,u=r,t=0;!f&&l&&!o&&t<s.length;t++){var o,i=s[t],d=p.p,y=i[2];n>3?(o=y===r)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=n<2&&d<i[1])?(c=0,p.v=r,p.n=i[1]):d<y&&(o=n<3||i[0]>r||r>y)&&(i[4]=n,i[5]=r,p.n=y,c=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,y){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&d(s,y),c=s,u=y;(t=c<2?e:u)||!f;){i||(c?c<3?(c>1&&(p.n=-1),d(c,u)):p.n=u:p.v=u);try{if(l=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0)}else 1===c&&(t=i.return)&&t.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e}else if((t=(f=p.n<0)?u:n.call(r,p))!==a)break}catch(t){i=e,c=1,u=t}finally{l=1}}return{value:t,done:f}}}(n,o,i),!0),l}var a={};function c(){}function u(){}function l(){}t=Object.getPrototypeOf;var s=[][r]?t(t([][r]())):(y(t={},r,function(){return this}),t),f=l.prototype=c.prototype=Object.create(s);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,y(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=l,y(f,"constructor",l),y(l,"constructor",u),u.displayName="GeneratorFunction",y(l,o,"GeneratorFunction"),y(f),y(f,o,"Generator"),y(f,r,function(){return this}),y(f,"toString",function(){return"[object Generator]"}),(d=function(){return{w:i,m:p}})()}function y(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}y=function(e,t,n,r){if(t)o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{var i=function(t,n){y(e,t,function(e){return this._invoke(t,n,e)})};i("next",0),i("throw",1),i("return",2)}},y(e,t,n,r)}function v(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}function m(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){v(i,r,o,a,c,"next",e)}function c(e){v(i,r,o,a,c,"throw",e)}a(void 0)})}}function b(e,t,n){return(t=function(e){var t=function(e){if("object"!=p(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=p(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==p(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function h(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,c=[],u=!0,l=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(c.push(r.value),c.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return g(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?g(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function w(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var u=r&&r.prototype instanceof c?r:c,l=Object.create(u.prototype);return C(l,"_invoke",function(n,r,o){var i,c,u,l=0,s=o||[],f=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return i=t,c=0,u=e,p.n=n,a}};function d(n,r){for(c=n,u=r,t=0;!f&&l&&!o&&t<s.length;t++){var o,i=s[t],d=p.p,y=i[2];n>3?(o=y===r)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=n<2&&d<i[1])?(c=0,p.v=r,p.n=i[1]):d<y&&(o=n<3||i[0]>r||r>y)&&(i[4]=n,i[5]=r,p.n=y,c=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,y){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&d(s,y),c=s,u=y;(t=c<2?e:u)||!f;){i||(c?c<3?(c>1&&(p.n=-1),d(c,u)):p.n=u:p.v=u);try{if(l=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0)}else 1===c&&(t=i.return)&&t.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e}else if((t=(f=p.n<0)?u:n.call(r,p))!==a)break}catch(t){i=e,c=1,u=t}finally{l=1}}return{value:t,done:f}}}(n,o,i),!0),l}var a={};function c(){}function u(){}function l(){}t=Object.getPrototypeOf;var s=[][r]?t(t([][r]())):(C(t={},r,function(){return this}),t),f=l.prototype=c.prototype=Object.create(s);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,C(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=l,C(f,"constructor",l),C(l,"constructor",u),u.displayName="GeneratorFunction",C(l,o,"GeneratorFunction"),C(f),C(f,o,"Generator"),C(f,r,function(){return this}),C(f,"toString",function(){return"[object Generator]"}),(w=function(){return{w:i,m:p}})()}function C(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}C=function(e,t,n,r){if(t)o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{var i=function(t,n){C(e,t,function(e){return this._invoke(t,n,e)})};i("next",0),i("throw",1),i("return",2)}},C(e,t,n,r)}function S(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}function _(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,c=[],u=!0,l=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(c.push(r.value),c.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return O(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?O(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function O(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var E=function(t){var r=t.children,o=t.token,i=void 0===o?null:o,a=t.defaults.postalCode,c=void 0===a?"":a,u=_((0,e.useState)(!1),2),l=u[0],f=u[1],p=_((0,e.useState)(!1),2),d=p[0],y=p[1],v=n(),m=v.applicationId,b=v.locationId;return(0,e.useEffect)(function(){!l&&window.Square&&f(Square.payments(m,b))},[m,b,l]),(0,e.useEffect)(function(){if(l&&!d&&!i){var e=function(){var e,t=(e=w().m(function e(){var t;return w().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,l.card({postalCode:c});case 1:t=e.v,y(t);case 2:return e.a(2)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){S(i,r,o,a,c,"next",e)}function c(e){S(i,r,o,a,c,"throw",e)}a(void 0)})});return function(){return t.apply(this,arguments)}}();e()}},[l,d,i,c]),l?wp.element.createElement(s.Provider,{value:{payments:l,card:d,token:i}},r):null};function j(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var u=r&&r.prototype instanceof c?r:c,l=Object.create(u.prototype);return k(l,"_invoke",function(n,r,o){var i,c,u,l=0,s=o||[],f=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return i=t,c=0,u=e,p.n=n,a}};function d(n,r){for(c=n,u=r,t=0;!f&&l&&!o&&t<s.length;t++){var o,i=s[t],d=p.p,y=i[2];n>3?(o=y===r)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=n<2&&d<i[1])?(c=0,p.v=r,p.n=i[1]):d<y&&(o=n<3||i[0]>r||r>y)&&(i[4]=n,i[5]=r,p.n=y,c=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,y){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&d(s,y),c=s,u=y;(t=c<2?e:u)||!f;){i||(c?c<3?(c>1&&(p.n=-1),d(c,u)):p.n=u:p.v=u);try{if(l=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0)}else 1===c&&(t=i.return)&&t.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e}else if((t=(f=p.n<0)?u:n.call(r,p))!==a)break}catch(t){i=e,c=1,u=t}finally{l=1}}return{value:t,done:f}}}(n,o,i),!0),l}var a={};function c(){}function u(){}function l(){}t=Object.getPrototypeOf;var s=[][r]?t(t([][r]())):(k(t={},r,function(){return this}),t),f=l.prototype=c.prototype=Object.create(s);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,k(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=l,k(f,"constructor",l),k(l,"constructor",u),u.displayName="GeneratorFunction",k(l,o,"GeneratorFunction"),k(f),k(f,o,"Generator"),k(f,r,function(){return this}),k(f,"toString",function(){return"[object Generator]"}),(j=function(){return{w:i,m:p}})()}function k(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}k=function(e,t,n,r){if(t)o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{var i=function(t,n){k(e,t,function(e){return this._invoke(t,n,e)})};i("next",0),i("throw",1),i("return",2)}},k(e,t,n,r)}function P(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}var T=function(){var t=(0,e.useContext)(s).card;console.log("test");var n=(0,e.useRef)(!1);return(0,e.useEffect)(function(){if(t){var e=function(){var e,r=(e=j().m(function e(){return j().w(function(e){for(;;)switch(e.n){case 0:t.attach(n.current);case 1:return e.a(2)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){P(i,r,o,a,c,"next",e)}function c(e){P(i,r,o,a,c,"throw",e)}a(void 0)})});return function(){return r.apply(this,arguments)}}();e()}},[t]),wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{ref:n}))},x=function(t){var r=t.billing,o=t.eventRegistration,i=t.emitResponse,a=(t.shouldSavePayment,function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=h((0,e.useState)(!1),2),a=i[0],c=i[1],u=h((0,e.useState)(""),2),l=u[0],s=u[1],f=(0,e.useMemo)(function(){var e=r&&!o?"STORE":"CHARGE",n={billingContact:{familyName:t.billingData.last_name||"",givenName:t.billingData.first_name||"",email:t.billingData.email||"",country:t.billingData.country||"",region:t.billingData.state||"",city:t.billingData.city||"",postalCode:t.billingData.postcode||"",phone:t.billingData.phone||"",addressLines:[t.billingData.address_1||"",t.billingData.address_2||""]},intent:e};return"CHARGE"===e&&(n.amount=(t.cartTotal.value/100).toString(),n.currencyCode=t.currency.code),n},[t.billingData,t.cartTotal.value,t.currency.code,r,o]),p=(0,e.useCallback)(function(e){var t,n,i,a=e.cardData,c=void 0===a?{}:a,u=e.nonce,l=e.verificationToken,s=e.notices,f=(e.logs,b(b(b(b(b(b(b(b(b(b(i={},"wc-squaresync_credit-card-type",(null==c?void 0:c.brand)||""),"wc-squaresync_credit-last-four",(null==c?void 0:c.last4)||""),"wc-squaresync_credit-exp-month",(null==c||null===(t=c.expMonth)||void 0===t?void 0:t.toString())||""),"wc-squaresync_credit-exp-year",(null==c||null===(n=c.expYear)||void 0===n?void 0:n.toString())||""),"wc-squaresync_credit-payment-postcode",(null==c?void 0:c.postalCode)||""),"wc-squaresync_credit-payment-nonce",u||""),"wc-squaresync_credit-payment-token",o||""),"wc-squaresync_credit-buyer-verification-token",l||""),"wc-squaresync_credit-tokenize-payment-method",r||!1),"log-data",""),b(i,"checkout-notices",s.length>0?JSON.stringify(s):""));return o&&(f.token=o),f},[l,r,o]),y=(0,e.useCallback)(function(){var e=m(d().m(function e(t){return d().w(function(e){for(;;)switch(e.n){case 0:if(o){e.n=2;break}return e.n=1,t.tokenize();case 1:return e.a(2,e.v);case 2:return e.a(2,o)}},e)}));return function(_x){return e.apply(this,arguments)}}(),[o]),v=(0,e.useCallback)(function(e){var t={notices:[],logs:[]};return e&&e.token?t.verificationToken=e.token:console.log("Verification token is missing from the Square response",t),t},[]),g=(0,e.useCallback)(function(){var e=m(d().m(function e(t,n){var r,o;return d().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,e.n=1,t.verifyBuyer(n,f);case 1:return r=e.v,e.a(2,v(r));case 2:return e.p=2,o=e.v,console.error("Error in verifyBuyer:",o),e.a(2,!1)}},e,null,[[0,2]])}));return function(t,n){return e.apply(this,arguments)}}(),[f,v]);return{handleInputReceived:(0,e.useCallback)(function(e){if("cardBrandChanged"===e.eventType){var t=e.cardBrand,r="plain";null!==t&&"unknown"!==t||(r=""),null!==n().availableCardTypes[t]&&(r=n().availableCardTypes[t]),s(r)}},[]),isLoaded:a,setLoaded:c,getPostalCode:(0,e.useCallback)(function(){return t.billingData.postcode||""},[t.billingData.postcode]),cardType:l,createNonce:y,verifyBuyer:g,getPaymentMethodData:p}}(r,!1));return wp.element.createElement(E,{defaults:{postalCode:a.getPostalCode()}},wp.element.createElement(T,null),wp.element.createElement(f,{checkoutFormHandler:a,eventRegistration:o,emitResponse:i}))},A=["RenderedComponent"],L=window.wc.wcBlocksRegistry,R=(L.registerPaymentMethod,L.registerExpressPaymentMethod,function(e){var t=e.RenderedComponent,n=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,A);return wp.element.createElement(t,n)});const H={name:"squaresync_credit",paymentMethodId:"squaresync_credit",label:wp.element.createElement(function(e){var t=e.components.PaymentMethodLabel,n=e.labelText;return wp.element.createElement(t,{text:n})},{labelText:"Credit Card"}),content:wp.element.createElement(R,{RenderedComponent:x}),edit:wp.element.createElement(R,{RenderedComponent:x}),ariaLabel:"Square",canMakePayment:function(){return!(!n().applicationId||!n().locationId)},supports:{features:n().supports,showSaveOption:!n().hasSubscription}},I=window.wp.data;function G(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var u=r&&r.prototype instanceof c?r:c,l=Object.create(u.prototype);return D(l,"_invoke",function(n,r,o){var i,c,u,l=0,s=o||[],f=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return i=t,c=0,u=e,p.n=n,a}};function d(n,r){for(c=n,u=r,t=0;!f&&l&&!o&&t<s.length;t++){var o,i=s[t],d=p.p,y=i[2];n>3?(o=y===r)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=n<2&&d<i[1])?(c=0,p.v=r,p.n=i[1]):d<y&&(o=n<3||i[0]>r||r>y)&&(i[4]=n,i[5]=r,p.n=y,c=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,y){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&d(s,y),c=s,u=y;(t=c<2?e:u)||!f;){i||(c?c<3?(c>1&&(p.n=-1),d(c,u)):p.n=u:p.v=u);try{if(l=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0)}else 1===c&&(t=i.return)&&t.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e}else if((t=(f=p.n<0)?u:n.call(r,p))!==a)break}catch(t){i=e,c=1,u=t}finally{l=1}}return{value:t,done:f}}}(n,o,i),!0),l}var a={};function c(){}function u(){}function l(){}t=Object.getPrototypeOf;var s=[][r]?t(t([][r]())):(D(t={},r,function(){return this}),t),f=l.prototype=c.prototype=Object.create(s);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,D(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=l,D(f,"constructor",l),D(l,"constructor",u),u.displayName="GeneratorFunction",D(l,o,"GeneratorFunction"),D(f),D(f,o,"Generator"),D(f,r,function(){return this}),D(f,"toString",function(){return"[object Generator]"}),(G=function(){return{w:i,m:p}})()}function D(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}D=function(e,t,n,r){if(t)o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{var i=function(t,n){D(e,t,function(e){return this._invoke(t,n,e)})};i("next",0),i("throw",1),i("return",2)}},D(e,t,n,r)}function N(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}function M(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){N(i,r,o,a,c,"next",e)}function c(e){N(i,r,o,a,c,"throw",e)}a(void 0)})}}var F=function(e){return n().ajaxUrl.replace("%%endpoint%%","square_digital_wallet_".concat(e))},q=function(){return new Promise(function(e,t){var r={context:n().context,security:n().paymentRequestNonce,is_pay_for_order_page:!1};jQuery.post(F("get_payment_request"),r,function(n){return n.success?e(n.data):t(n.data)})})},V=function(){var e=M(G().m(function e(t){return G().w(function(e){for(;;)if(0===e.n)return e.a(2,new Promise(function(e,n){return jQuery.post(F("recalculate_totals"),t,function(t){return t.success?e(t.data):n(t.data)})}))},e)}));return function(_x){return e.apply(this,arguments)}}(),Z=function(){var e=M(G().m(function e(t){var r,o;return G().w(function(e){for(;;)switch(e.n){case 0:return r={context:n().context,shipping_option:t.id,security:n().recalculateTotalNonce,is_pay_for_order_page:n().isPayForOrderPage},e.n=1,V(r);case 1:return o=e.v,e.a(2,o)}},e)}));return function(t){return e.apply(this,arguments)}}(),U=function(){var e=M(G().m(function e(t){var r,o;return G().w(function(e){for(;;)switch(e.n){case 0:return r={context:n().context,shipping_contact:t,security:n().recalculateTotalNonce,is_pay_for_order_page:n().isPayForOrderPage},e.n=1,V(r);case 1:return o=e.v,e.a(2,o)}},e)}));return function(t){return e.apply(this,arguments)}}(),B=function(){var e=M(G().m(function e(t,n,r){var o,i;return G().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,e.n=1,t.verifyBuyer(n,r);case 1:return o=e.v,e.a(2,o);case 2:throw e.p=2,i=e.v,console.error("Error during buyer verification:",i),i;case 3:return e.a(2)}},e,null,[[0,2]])}));return function(t,n,r){return e.apply(this,arguments)}}(),z=function(){var e=M(G().m(function e(t){var n;return G().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,e.n=1,t.tokenize();case 1:if("OK"!==(n=e.v).status){e.n=2;break}return e.a(2,n);case 2:e.n=4;break;case 3:return e.p=3,e.v,e.a(2,!1);case 4:return e.a(2,!1)}},e,null,[[0,3]])}));return function(t){return e.apply(this,arguments)}}();function $(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function W(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$(Object(n),!0).forEach(function(t){Y(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Y(e,t,n){return(t=function(e){var t=function(e){if("object"!=J(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=J(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==J(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function J(e){return J="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},J(e)}function K(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var u=r&&r.prototype instanceof c?r:c,l=Object.create(u.prototype);return Q(l,"_invoke",function(n,r,o){var i,c,u,l=0,s=o||[],f=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return i=t,c=0,u=e,p.n=n,a}};function d(n,r){for(c=n,u=r,t=0;!f&&l&&!o&&t<s.length;t++){var o,i=s[t],d=p.p,y=i[2];n>3?(o=y===r)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=n<2&&d<i[1])?(c=0,p.v=r,p.n=i[1]):d<y&&(o=n<3||i[0]>r||r>y)&&(i[4]=n,i[5]=r,p.n=y,c=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,y){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&d(s,y),c=s,u=y;(t=c<2?e:u)||!f;){i||(c?c<3?(c>1&&(p.n=-1),d(c,u)):p.n=u:p.v=u);try{if(l=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0)}else 1===c&&(t=i.return)&&t.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e}else if((t=(f=p.n<0)?u:n.call(r,p))!==a)break}catch(t){i=e,c=1,u=t}finally{l=1}}return{value:t,done:f}}}(n,o,i),!0),l}var a={};function c(){}function u(){}function l(){}t=Object.getPrototypeOf;var s=[][r]?t(t([][r]())):(Q(t={},r,function(){return this}),t),f=l.prototype=c.prototype=Object.create(s);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,Q(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=l,Q(f,"constructor",l),Q(l,"constructor",u),u.displayName="GeneratorFunction",Q(l,o,"GeneratorFunction"),Q(f),Q(f,o,"Generator"),Q(f,r,function(){return this}),Q(f,"toString",function(){return"[object Generator]"}),(K=function(){return{w:i,m:p}})()}function Q(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Q=function(e,t,n,r){if(t)o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{var i=function(t,n){Q(e,t,function(e){return this._invoke(t,n,e)})};i("next",0),i("throw",1),i("return",2)}},Q(e,t,n,r)}function X(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,c=[],u=!0,l=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(c.push(r.value),c.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ee(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ee(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ee(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function te(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}function ne(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){te(i,r,o,a,c,"next",e)}function c(e){te(i,r,o,a,c,"throw",e)}a(void 0)})}}function re(e){var t=e.givenName,n=e.familyName,r=e.addressLines,o=void 0===r?[]:r,i=e.city,a=e.state,c=e.email,u=e.countryCode,l=e.postalCode;return!!(t&&n&&o[0]&&i&&a&&u&&l&&c)}function oe(e,t){var n,r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};e&&"object"===J(e)||(e={});var i=e,a=i.familyName,c=i.givenName,u=i.region,l=i.state,s=i.country,f=i.countryCode,p=i.city,d=i.addressLines,y=i.postalCode,v=i.phone,m=i.email,b=o.first_name,h=void 0===b?"":b,g=o.last_name,w=void 0===g?"":g,C=o.address_1,S=void 0===C?"":C,_=o.address_2,O=void 0===_?"":_,E=o.city,j=void 0===E?"":E,k=o.state,P=void 0===k?"":k,T=o.country,x=void 0===T?"":T,A=o.postcode,L=void 0===A?"":A,R=o.phone,H=void 0===R?"":R,I=o.email,G=null!=y?y:L,D=null!=m?m:void 0===I?"":I,N=null!=v?v:H;return{givenName:null!=c?c:h,familyName:null!=a?a:w,state:t?null!=u?u:P:null!==(n=null!=l?l:u)&&void 0!==n?n:P,countryCode:t?null!=s?s:x:null!==(r=null!=f?f:s)&&void 0!==r?r:x,city:null!=p?p:j,addressLines:Array.isArray(d)&&d.length>0?d:[S,O].filter(Boolean),postalCode:G,phone:N,email:D}}function ie(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var u=r&&r.prototype instanceof c?r:c,l=Object.create(u.prototype);return ae(l,"_invoke",function(n,r,o){var i,c,u,l=0,s=o||[],f=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return i=t,c=0,u=e,p.n=n,a}};function d(n,r){for(c=n,u=r,t=0;!f&&l&&!o&&t<s.length;t++){var o,i=s[t],d=p.p,y=i[2];n>3?(o=y===r)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=n<2&&d<i[1])?(c=0,p.v=r,p.n=i[1]):d<y&&(o=n<3||i[0]>r||r>y)&&(i[4]=n,i[5]=r,p.n=y,c=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,y){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&d(s,y),c=s,u=y;(t=c<2?e:u)||!f;){i||(c?c<3?(c>1&&(p.n=-1),d(c,u)):p.n=u:p.v=u);try{if(l=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0)}else 1===c&&(t=i.return)&&t.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e}else if((t=(f=p.n<0)?u:n.call(r,p))!==a)break}catch(t){i=e,c=1,u=t}finally{l=1}}return{value:t,done:f}}}(n,o,i),!0),l}var a={};function c(){}function u(){}function l(){}t=Object.getPrototypeOf;var s=[][r]?t(t([][r]())):(ae(t={},r,function(){return this}),t),f=l.prototype=c.prototype=Object.create(s);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,ae(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=l,ae(f,"constructor",l),ae(l,"constructor",u),u.displayName="GeneratorFunction",ae(l,o,"GeneratorFunction"),ae(f),ae(f,o,"Generator"),ae(f,r,function(){return this}),ae(f,"toString",function(){return"[object Generator]"}),(ie=function(){return{w:i,m:p}})()}function ae(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}ae=function(e,t,n,r){if(t)o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{var i=function(t,n){ae(e,t,function(e){return this._invoke(t,n,e)})};i("next",0),i("throw",1),i("return",2)}},ae(e,t,n,r)}function ce(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}function ue(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,c=[],u=!0,l=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(c.push(r.value),c.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return le(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?le(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function le(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var se=function(){return wp.element.createElement("svg",{width:"343",height:"50",viewBox:"0 0 343 50",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{width:"343",height:"50",rx:"4",fill:"black"}),wp.element.createElement("path",{d:"M97.6482 17.68H103.048C103.622 17.68 104.162 17.78 104.668 17.98C105.188 18.1667 105.642 18.4333 106.028 18.78C106.428 19.1133 106.742 19.5133 106.968 19.98C107.195 20.4467 107.308 20.9533 107.308 21.5C107.308 22.2333 107.122 22.86 106.748 23.38C106.388 23.8867 105.928 24.2667 105.368 24.52V24.64C106.088 24.8933 106.668 25.3067 107.108 25.88C107.562 26.4533 107.788 27.1467 107.788 27.96C107.788 28.5733 107.668 29.1267 107.428 29.62C107.188 30.1133 106.862 30.54 106.448 30.9C106.035 31.2467 105.555 31.52 105.008 31.72C104.475 31.9067 103.902 32 103.288 32H97.6482V17.68ZM102.968 23.66C103.302 23.66 103.602 23.6067 103.868 23.5C104.135 23.38 104.355 23.2333 104.528 23.06C104.715 22.8733 104.855 22.6667 104.948 22.44C105.042 22.2 105.088 21.96 105.088 21.72C105.088 21.48 105.042 21.2467 104.948 21.02C104.855 20.78 104.722 20.5733 104.548 20.4C104.375 20.2133 104.162 20.0667 103.908 19.96C103.655 19.84 103.368 19.78 103.048 19.78H99.9082V23.66H102.968ZM103.288 29.9C103.648 29.9 103.968 29.84 104.248 29.72C104.528 29.6 104.762 29.44 104.948 29.24C105.135 29.04 105.275 28.8133 105.368 28.56C105.475 28.3067 105.528 28.0467 105.528 27.78C105.528 27.5133 105.475 27.26 105.368 27.02C105.275 26.7667 105.128 26.5467 104.928 26.36C104.728 26.16 104.482 26 104.188 25.88C103.908 25.76 103.582 25.7 103.208 25.7H99.9082V29.9H103.288ZM116.875 30.68H116.755C116.461 31.1467 116.041 31.54 115.495 31.86C114.961 32.1667 114.355 32.32 113.675 32.32C112.435 32.32 111.508 31.9533 110.895 31.22C110.281 30.4733 109.975 29.4867 109.975 28.26V22.2H112.195V27.96C112.195 28.8133 112.388 29.4133 112.775 29.76C113.175 30.0933 113.695 30.26 114.335 30.26C114.708 30.26 115.041 30.18 115.335 30.02C115.641 29.86 115.901 29.6467 116.115 29.38C116.328 29.1 116.488 28.7867 116.595 28.44C116.701 28.08 116.755 27.7067 116.755 27.32V22.2H118.975V32H116.875V30.68ZM124.747 31.44L120.667 22.2H123.147L125.847 28.7H125.947L128.567 22.2H131.027L124.887 36.32H122.527L124.747 31.44ZM136.589 22.2H139.009L140.909 28.98H140.989L143.189 22.2H145.489L147.669 28.98H147.749L149.629 22.2H152.009L148.869 32H146.529L144.309 25.14H144.229L142.069 32H139.729L136.589 22.2ZM154.995 20.46C154.568 20.46 154.208 20.3133 153.915 20.02C153.635 19.7267 153.495 19.3733 153.495 18.96C153.495 18.5467 153.635 18.1933 153.915 17.9C154.208 17.6067 154.568 17.46 154.995 17.46C155.408 17.46 155.755 17.6067 156.035 17.9C156.328 18.1933 156.475 18.5467 156.475 18.96C156.475 19.3733 156.328 19.7267 156.035 20.02C155.755 20.3133 155.408 20.46 154.995 20.46ZM153.875 32V22.2H156.095V32H153.875ZM159.982 24.16H158.262V22.2H159.982V19.2H162.202V22.2H164.622V24.16H162.202V28.52C162.202 28.76 162.229 28.98 162.282 29.18C162.336 29.38 162.416 29.5467 162.522 29.68C162.749 29.9333 163.036 30.06 163.382 30.06C163.596 30.06 163.762 30.0467 163.882 30.02C164.002 29.98 164.129 29.9267 164.262 29.86L164.942 31.82C164.662 31.9267 164.369 32.0067 164.062 32.06C163.756 32.1267 163.409 32.16 163.022 32.16C162.556 32.16 162.142 32.0867 161.782 31.94C161.422 31.7933 161.109 31.5933 160.842 31.34C160.269 30.7667 159.982 29.9867 159.982 29V24.16ZM167.059 17.68H169.279V21.94L169.159 23.52H169.279C169.559 23.0533 169.972 22.6667 170.519 22.36C171.065 22.04 171.672 21.88 172.339 21.88C172.979 21.88 173.532 21.98 173.999 22.18C174.465 22.3667 174.852 22.64 175.159 23C175.465 23.36 175.692 23.7933 175.839 24.3C175.985 24.7933 176.059 25.34 176.059 25.94V32H173.839V26.24C173.839 25.4267 173.639 24.84 173.239 24.48C172.852 24.12 172.359 23.94 171.759 23.94C171.372 23.94 171.025 24.0267 170.719 24.2C170.425 24.36 170.165 24.58 169.939 24.86C169.725 25.14 169.559 25.46 169.439 25.82C169.332 26.18 169.279 26.5533 169.279 26.94V32H167.059V17.68Z",fill:"white"}),wp.element.createElement("path",{d:"M213.951 24.6725V31.7485H211.69V14.2748H217.684C219.203 14.2748 220.498 14.7778 221.558 15.7836C222.641 16.7895 223.183 18.0175 223.183 19.4678C223.183 20.9532 222.641 22.1813 221.558 23.1754C220.51 24.1696 219.215 24.6608 217.684 24.6608H213.951V24.6725ZM213.951 16.4269V22.5204H217.731C218.626 22.5204 219.379 22.2164 219.968 21.6199C220.569 21.0234 220.875 20.2982 220.875 19.4795C220.875 18.6725 220.569 17.9591 219.968 17.3626C219.379 16.7427 218.638 16.4386 217.731 16.4386H213.951V16.4269Z",fill:"white"}),wp.element.createElement("path",{d:"M229.094 19.3976C230.766 19.3976 232.085 19.8421 233.05 20.731C234.016 21.6199 234.499 22.8362 234.499 24.3801V31.7485H232.344V30.0877H232.25C231.319 31.4561 230.071 32.1345 228.517 32.1345C227.186 32.1345 226.079 31.7485 225.185 30.9649C224.29 30.1813 223.842 29.2105 223.842 28.0409C223.842 26.8011 224.313 25.8187 225.255 25.0935C226.197 24.3567 227.457 23.9941 229.023 23.9941C230.366 23.9941 231.472 24.2397 232.332 24.731V24.2164C232.332 23.4327 232.026 22.7778 231.402 22.228C230.778 21.6783 230.048 21.4093 229.212 21.4093C227.952 21.4093 226.951 21.9357 226.221 23L224.231 21.7602C225.326 20.1813 226.951 19.3976 229.094 19.3976ZM226.174 28.076C226.174 28.6608 226.421 29.152 226.927 29.538C227.422 29.9239 228.011 30.1228 228.682 30.1228C229.636 30.1228 230.483 29.7719 231.225 29.0701C231.967 28.3684 232.344 27.5497 232.344 26.6023C231.637 26.0526 230.66 25.7719 229.4 25.7719C228.482 25.7719 227.716 25.9941 227.104 26.4269C226.48 26.883 226.174 27.4327 226.174 28.076Z",fill:"white"}),wp.element.createElement("path",{d:"M246.792 19.7836L239.256 37H236.924L239.727 30.9766L234.758 19.7836H237.219L240.798 28.3684H240.845L244.331 19.7836H246.792Z",fill:"white"}),wp.element.createElement("path",{d:"M204.959 23.2456C204.959 22.5134 204.893 21.8128 204.77 21.1392H195.294V24.9988L200.751 25C200.53 26.2842 199.818 27.3789 198.726 28.1087V30.6128H201.975C203.872 28.869 204.959 26.2912 204.959 23.2456Z",fill:"#4285F4"}),wp.element.createElement("path",{d:"M198.727 28.1088C197.823 28.7146 196.658 29.069 195.296 29.069C192.664 29.069 190.432 27.3076 189.632 24.9333H186.281V27.5158C187.941 30.7883 191.354 33.0339 195.296 33.0339C198.021 33.0339 200.31 32.1439 201.976 30.6117L198.727 28.1088Z",fill:"#34A853"}),wp.element.createElement("path",{d:"M189.317 23.0175C189.317 22.3509 189.428 21.7064 189.632 21.1006V18.5181H186.281C185.594 19.8713 185.208 21.3988 185.208 23.0175C185.208 24.6362 185.596 26.1637 186.281 27.5169L189.632 24.9345C189.428 24.3286 189.317 23.6842 189.317 23.0175Z",fill:"#FABB05"}),wp.element.createElement("path",{d:"M195.296 16.9649C196.783 16.9649 198.115 17.4737 199.166 18.4678L202.045 15.6105C200.297 13.993 198.017 13 195.296 13C191.355 13 187.941 15.2456 186.281 18.5181L189.632 21.1006C190.432 18.7263 192.664 16.9649 195.296 16.9649Z",fill:"#E94235"}))},fe=function(){return wp.element.createElement("svg",{width:"343",height:"50",viewBox:"0 0 343 50",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{width:"343",height:"50",rx:"8",fill:"black"}),wp.element.createElement("path",{d:"M155.748 19.8275C154.411 19.8275 153.333 20.636 152.637 20.636C151.907 20.636 150.93 19.8724 149.773 19.8724C147.572 19.8724 145.337 21.7029 145.337 25.1282C145.337 27.2733 146.168 29.5306 147.19 31.0018C148.055 32.2259 148.83 33.2366 149.93 33.2366C151.02 33.2366 151.503 32.5179 152.862 32.5179C154.232 32.5179 154.546 33.2142 155.748 33.2142C156.95 33.2142 157.747 32.1248 158.499 31.0467C159.33 29.8001 159.69 28.5872 159.701 28.5311C159.634 28.5086 157.343 27.5765 157.343 24.9485C157.343 22.68 159.139 21.6693 159.241 21.5906C158.061 19.8724 156.253 19.8275 155.748 19.8275ZM155.13 18.3787C155.669 17.7161 156.051 16.8177 156.051 15.908C156.051 15.7845 156.04 15.6609 156.017 15.5599C155.141 15.5936 154.063 16.1439 153.423 16.8963C152.929 17.4691 152.457 18.3787 152.457 19.2884C152.457 19.4232 152.48 19.5692 152.491 19.6141C152.547 19.6253 152.637 19.6365 152.727 19.6365C153.524 19.6365 154.535 19.0975 155.13 18.3787ZM164.115 16.8289V33.0345H167.013V27.7225H170.528C173.807 27.7225 176.098 25.5213 176.098 22.3094C176.098 19.0413 173.886 16.8289 170.652 16.8289H164.115ZM167.013 19.2547H169.888C171.977 19.2547 173.156 20.3216 173.156 22.3094C173.156 24.241 171.943 25.3192 169.877 25.3192H167.013V19.2547ZM181.535 31.0467C180.3 31.0467 179.412 30.429 179.412 29.3958C179.412 28.3963 180.142 27.8348 181.703 27.7337L184.477 27.554V28.5311C184.477 29.9573 183.219 31.0467 181.535 31.0467ZM180.715 33.2366C182.321 33.2366 183.669 32.5403 184.354 31.3499H184.545V33.0345H187.229V24.6453C187.229 22.0399 185.454 20.5013 182.299 20.5013C179.379 20.5013 177.346 21.8826 177.121 24.0501H179.749C180.008 23.2191 180.884 22.7698 182.164 22.7698C183.669 22.7698 184.477 23.4437 184.477 24.6453V25.6785L181.31 25.8694C178.323 26.0491 176.65 27.3294 176.65 29.553C176.65 31.7991 178.345 33.2366 180.715 33.2366ZM190.329 37.493C193.081 37.493 194.395 36.4822 195.439 33.4276L199.875 20.7484H196.933L194.069 30.3392H193.878L191.003 20.7484H187.948L192.34 33.0906L192.194 33.6297C191.834 34.764 191.172 35.2132 189.992 35.2132C189.801 35.2132 189.386 35.202 189.229 35.1683V37.4481C189.408 37.4818 190.161 37.493 190.329 37.493Z",fill:"white"}),wp.element.createElement("rect",{width:"343",height:"50",rx:"8",stroke:"black"}))};const pe={name:"squaresync_credit_wallet",paymentMethodId:"squaresync_credit",content:wp.element.createElement(function(t){var r=t.billing,o=t.shippingData,i=t.onClick,a=t.onClose,c=t.onSubmit,u=t.setExpressPaymentError,l=t.emitResponse,s=t.eventRegistration,f=s.onPaymentSetup,p=s.onCheckoutFail,d=ue((0,e.useState)(!1),2),y=d[0],v=d[1],m=o.needsShipping;(0,e.useEffect)(function(){var e=(0,I.subscribe)(function(){wp.data.select("wc/store/cart").isApplyingCoupon()||v(function(e){return!e})});return function(){e()}},[]);var b=function(){var t=X((0,e.useState)(null),2),r=t[0],o=t[1];return(0,e.useEffect)(function(){var e=n().applicationId,t=n().locationId;if(window.Square)try{var r=Square.payments(e,t);o(r)}catch(e){console.error(e)}},[]),r}(),h=function(t,n,r){var o=(0,e.useRef)(null),i=X((0,e.useState)(null),2),a=i[0],c=i[1];return(0,e.useEffect)(function(){if(t){var e=function(){var e=ne(K().m(function e(){var r,i,a,u,l,s;return K().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,e.n=1,q();case 1:r=e.v,(i=JSON.parse(r))&&(Array.isArray(i.lineItems)&&(-1!==(a=i.lineItems.findIndex(function(e){var t;return null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes("shipping")}))&&i.lineItems.splice(a,1),-1!==(u=i.lineItems.findIndex(function(e){var t;return null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes("discount")}))&&i.lineItems.splice(u,1)),n&&(i.requestShippingAddress=!0)),o.current?o.current.update(i):(l=t.paymentRequest(i),o.current=l,c(l)),e.n=3;break;case 2:e.p=2,s=e.v,console.error("Failed to create or update payment request:",s);case 3:return e.a(2)}},e,null,[[0,2]])}));return function(){return e.apply(this,arguments)}}();e()}},[t,n,r]),a}(b,m,y),g=function(t,r){var o=X((0,e.useState)(null),2),i=o[0],a=o[1],c=(0,e.useRef)(null);return(0,e.useEffect)(function(){t&&r&&ne(K().m(function e(){var o;return K().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,e.n=1,t.googlePay(r);case 1:return o=e.v,e.n=2,o.attach(c.current,{buttonColor:n().googlePayColor,buttonSizeMode:"fill",buttonType:"long"});case 2:a(o),e.n=4;break;case 3:e.p=3,e.v;case 4:return e.a(2)}},e,null,[[0,3]])}))()},[t,r]),[i,c]}(b,h),w=ue(g,2),C=w[0],S=w[1],_=function(t,r){var o=X((0,e.useState)(null),2),i=o[0],a=o[1],c=(0,e.useRef)(null);return(0,e.useEffect)(function(){t&&r&&ne(K().m(function e(){var n,o;return K().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,e.n=1,t.applePay(r);case 1:n=e.v,a(n),e.n=3;break;case 2:e.p=2,o=e.v,console.log(o);case 3:return e.a(2)}},e,null,[[0,2]])}))()},[t,r]),(0,e.useEffect)(function(){if(null!=c&&c.current&&i){var e=n().applePayColor,t=n().applePayType;"plain"!==t&&(c.current.querySelector(".text").innerText="".concat(t.charAt(0).toUpperCase()).concat(t.slice(1)," with"),c.current.classList.add("wc-square-wallet-button-with-text")),c.current.style.cssText+="-apple-pay-button-type: ".concat(t,";"),c.current.style.cssText+="-apple-pay-button-style: ".concat(e,";"),c.current.style.display="block",c.current.classList.add("wc-square-wallet-button-".concat(e))}},[i,c]),[i,c]}(b,h),O=ue(_,2),E=O[0],j=O[1],k=function(t,n){var r=X((0,e.useState)(null),2),o=r[0],i=r[1],a=(0,e.useRef)(null);return(0,e.useEffect)(function(){t&&n&&ne(K().m(function e(){var r;return K().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,e.n=1,t.afterpayClearpay(n);case 1:return r=e.v,e.n=2,r.attach(a.current,{buttonColor:"black",buttonSizeMode:"fill"});case 2:i(r),e.n=4;break;case 3:e.p=3,e.v;case 4:return e.a(2)}},e,null,[[0,3]])}))()},[t,n]),[o,a]}(b,h),P=ue(k,2),T=P[0],x=P[1],A=ue((0,e.useState)(!1),2),L=A[0],R=A[1];!function(t){(0,e.useEffect)(function(){null==t||t.addEventListener("shippingcontactchanged",function(e){return U(e)}),null==t||t.addEventListener("afterpay_shippingaddresschanged",function(e){return U(e)})},[t])}(h),function(t){(0,e.useEffect)(function(){null==t||t.addEventListener("shippingoptionchanged",function(e){return Z(e)}),null==t||t.addEventListener("afterpay_shippingoptionchanged",function(e){return Z(e)})},[t])}(h),function(t,n,r,o,i){var a=function(e){var t={familyName:e.billingData.last_name||"",givenName:e.billingData.first_name||"",email:e.billingData.email||"",country:e.billingData.country||"",region:e.billingData.state||"",city:e.billingData.city||"",postalCode:e.billingData.postcode||""};e.billingData.phone&&(t.phone=e.billingData.phone);var n=[e.billingData.address_1,e.billingData.address_2].filter(Boolean);return n.length&&(t.addressLines=n),{intent:"CHARGE",amount:(e.cartTotal.value/100).toString(),currencyCode:e.currency.code,billingContact:t}}(n);(0,e.useEffect)(function(){return i(function(){function e(){return(e=ne(K().m(function e(){var n,i,c,u,l,s,f,p,d,y,v,m,b,h,g,w,C,S,_,O,E,j,k,P,T,x,A,L,R,H,G,D,N,M,F,q,V,Z,U,z,$,J,Q,X,ee,te;return K().w(function(e){for(;;)switch(e.n){case 0:if(g={type:o.responseTypes.SUCCESS},r){e.n=1;break}return g={type:o.responseTypes.FAILURE},e.a(2,g);case 1:return C=(w=null!=r?r:{}).details,S=w.token,O=(_=null!=C?C:{}).method,E=void 0===O?"":O,j=_.card,k=void 0===j?{}:j,P=_.shipping,T=void 0===P?{}:P,_.billing,(x=null!=T?T:{}).contact,A=x.option,L=void 0===A?{}:A,R="AfterpayClearpay"===E,H=(0,I.select)("wc/store/cart").getCustomerData().shippingAddress,G=(0,I.select)("wc/store/cart").getCustomerData().billingAddress,D=oe(null==r||null===(n=r.details)||void 0===n||null===(n=n.shipping)||void 0===n?void 0:n.contact,R,H),re(N=oe(null==r||null===(i=r.details)||void 0===i?void 0:i.billing,R,G))||(q=oe(null==r||null===(M=r.details)||void 0===M||null===(M=M.shipping)||void 0===M?void 0:M.contact,R,H),N=W(W({},q),{},{email:N.email||q.email||(null==r||null===(F=r.details)||void 0===F||null===(F=F.shipping)||void 0===F?void 0:F.contact.email)})),V={token:""},e.p=2,e.n=3,B(t,S,a);case 3:V=e.v,e.n=5;break;case 4:e.p=4,ee=e.v,console.error("verifyBuyer error:",ee);case 5:if(Z=V.token,U=R?"AfterpayClearpay":null!==(c=null==k?void 0:k.cardType)&&void 0!==c?c:E,z=R?"":null!==(u=null==k?void 0:k.last4)&&void 0!==u?u:"",$=R?"":null!==(l=null==k||null===(s=k.expMonth)||void 0===s?void 0:s.toString())&&void 0!==l?l:"",J=R?"":null!==(f=null==k||null===(p=k.expYear)||void 0===p?void 0:p.toString())&&void 0!==f?f:"",Q=R?"":null!==(d=null==k?void 0:k.postalCode)&&void 0!==d?d:"",X="wc-squaresync_credit",g.meta={paymentMethodData:Y(Y(Y(Y(Y(Y(Y(Y({},"".concat(X,"-card-type"),U),"".concat(X,"-last-four"),z),"".concat(X,"-exp-month"),$),"".concat(X,"-exp-year"),J),"".concat(X,"-payment-postcode"),Q),"".concat(X,"-payment-nonce"),S),"".concat(X,"-buyer-verification-token"),Z||""),"shipping_method",null!==(y=null==L?void 0:L.id)&&void 0!==y&&y),billingAddress:{email:N.email,first_name:N.givenName,last_name:N.familyName,company:"",address_1:null!==(v=N.addressLines[0])&&void 0!==v?v:"",address_2:null!==(m=N.addressLines[1])&&void 0!==m?m:"",city:N.city,state:N.state,postcode:N.postalCode,country:N.countryCode,phone:N.phone},shippingAddress:{first_name:D.givenName,last_name:D.familyName,company:"",address_1:null!==(b=D.addressLines[0])&&void 0!==b?b:"",address_2:null!==(h=D.addressLines[1])&&void 0!==h?h:"",city:D.city,state:D.state,postcode:D.postalCode,country:D.countryCode,phone:D.phone}},e.p=6,wp.data.dispatch("wc/store/cart").setBillingAddress(g.meta.billingAddress),!wp.data.select("wc/store/cart").getNeedsShipping()){e.n=7;break}if(wp.data.dispatch("wc/store/cart").setShippingAddress(g.meta.shippingAddress),wp.data.select("wc/store/cart").getShippingRates().some(function(e){return e.shipping_rates.length})){e.n=7;break}return g.type=o.responseTypes.FAILURE,e.a(2,g);case 7:e.n=9;break;case 8:return e.p=8,te=e.v,console.error("WooCommerce address dispatch error:",te),g.type=o.responseTypes.FAILURE,e.a(2,g);case 9:return e.a(2,g)}},e,null,[[6,8],[2,4]])}))).apply(this,arguments)}return function(){return e.apply(this,arguments)}()})},[i,n.billingData,r])}(b,r,L,l,f),(0,e.useEffect)(function(){return p(function(){return a(),!0})},[p]);var H=n().googlePay.includes("no"),G=n().applePay.includes("no"),D=n().afterPay.includes("no");function N(e){var t;e?(u(""),i(),(t=ie().m(function t(){var n;return ie().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,z(e);case 1:(n=t.v)?(R(n),c()):(console.error("Tokenization failed in onClickHandler"),a());case 2:return t.a(2)}},t)}),function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function a(e){ce(i,r,o,a,c,"next",e)}function c(e){ce(i,r,o,a,c,"throw",e)}a(void 0)})})()):console.error("Button instance is null or undefined")}var M=!H&&wp.element.createElement("div",{tabIndex:0,role:"button",ref:S,onClick:function(){return N(C)}}),F=!D&&wp.element.createElement("div",{tabIndex:0,role:"button",ref:x,onClick:function(){return N(T)}}),V=!G&&wp.element.createElement("div",{tabIndex:0,role:"button",ref:j,onClick:function(){return N(E)},className:"apple-pay-button wc-square-wallet-buttons"},wp.element.createElement("span",{className:"text"}),wp.element.createElement("span",{className:"logo"}));return wp.element.createElement(React.Fragment,null,V,M,F)},null),edit:wp.element.createElement(function(){return wp.element.createElement(React.Fragment,null,wp.element.createElement(se,null),wp.element.createElement(fe,null))},null),canMakePayment:function(){var e=!(!n().applicationId||!n().locationId),t=n().isDigitalWalletsEnabled;return e&&t},supports:{features:n().supports}};function de(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var u=r&&r.prototype instanceof c?r:c,l=Object.create(u.prototype);return ye(l,"_invoke",function(n,r,o){var i,c,u,l=0,s=o||[],f=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return i=t,c=0,u=e,p.n=n,a}};function d(n,r){for(c=n,u=r,t=0;!f&&l&&!o&&t<s.length;t++){var o,i=s[t],d=p.p,y=i[2];n>3?(o=y===r)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=n<2&&d<i[1])?(c=0,p.v=r,p.n=i[1]):d<y&&(o=n<3||i[0]>r||r>y)&&(i[4]=n,i[5]=r,p.n=y,c=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,y){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&d(s,y),c=s,u=y;(t=c<2?e:u)||!f;){i||(c?c<3?(c>1&&(p.n=-1),d(c,u)):p.n=u:p.v=u);try{if(l=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0)}else 1===c&&(t=i.return)&&t.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e}else if((t=(f=p.n<0)?u:n.call(r,p))!==a)break}catch(t){i=e,c=1,u=t}finally{l=1}}return{value:t,done:f}}}(n,o,i),!0),l}var a={};function c(){}function u(){}function l(){}t=Object.getPrototypeOf;var s=[][r]?t(t([][r]())):(ye(t={},r,function(){return this}),t),f=l.prototype=c.prototype=Object.create(s);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,ye(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=l,ye(f,"constructor",l),ye(l,"constructor",u),u.displayName="GeneratorFunction",ye(l,o,"GeneratorFunction"),ye(f),ye(f,o,"Generator"),ye(f,r,function(){return this}),ye(f,"toString",function(){return"[object Generator]"}),(de=function(){return{w:i,m:p}})()}function ye(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}ye=function(e,t,n,r){if(t)o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{var i=function(t,n){ye(e,t,function(e){return this._invoke(t,n,e)})};i("next",0),i("throw",1),i("return",2)}},ye(e,t,n,r)}function ve(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}function me(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){ve(i,r,o,a,c,"next",e)}function c(e){ve(i,r,o,a,c,"throw",e)}a(void 0)})}}var be=function(){return new Promise(function(e,t){var r,o={context:n().context,security:n().paymentRequestNonce,is_pay_for_order_page:!1};jQuery.post((r="get_payment_request",n().ajaxUrl.replace("%%endpoint%%","square_digital_wallet_".concat(r))),o,function(n){n.success?e(n.data):t(n.data)})})},he=function(){var e=me(de().m(function e(t,n,r){var o,i;return de().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,e.n=1,t.verifyBuyer(n,r);case 1:return o=e.v,e.a(2,o);case 2:throw e.p=2,i=e.v,console.error("Error during buyer verification:",i),i;case 3:return e.a(2)}},e,null,[[0,2]])}));return function(t,n,r){return e.apply(this,arguments)}}(),ge=function(){var e=me(de().m(function e(t){var n,r;return de().w(function(e){for(;;)switch(e.n){case 0:return console.log("[utils.js] tokenize() called with button:",t),e.p=1,e.n=2,t.tokenize();case 2:if(n=e.v,console.log("[utils.js] tokenize() => tokenResult:",n),"OK"!==n.status){e.n=3;break}return console.log("[utils.js] tokenize() => status=OK => returning tokenResult"),e.a(2,n);case 3:n.errors&&n.errors.length&&n.errors.forEach(function(e){console.error("Afterpay tokenization error:",e)}),e.n=5;break;case 4:e.p=4,r=e.v,console.error("[utils.js] Exception during Afterpay tokenization:",r);case 5:return console.error("[utils.js] tokenize() => returning false (tokenization failed)"),e.a(2,!1)}},e,null,[[1,4]])}));return function(t){return e.apply(this,arguments)}}();function we(e){return we="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},we(e)}function Ce(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=Pe(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=e.length?{done:!0}:{done:!1,value:e[_n++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){a=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}function Se(e,t,n){return(t=function(e){var t=function(e){if("object"!=we(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=we(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==we(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _e(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var u=r&&r.prototype instanceof c?r:c,l=Object.create(u.prototype);return Oe(l,"_invoke",function(n,r,o){var i,c,u,l=0,s=o||[],f=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return i=t,c=0,u=e,p.n=n,a}};function d(n,r){for(c=n,u=r,t=0;!f&&l&&!o&&t<s.length;t++){var o,i=s[t],d=p.p,y=i[2];n>3?(o=y===r)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=n<2&&d<i[1])?(c=0,p.v=r,p.n=i[1]):d<y&&(o=n<3||i[0]>r||r>y)&&(i[4]=n,i[5]=r,p.n=y,c=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,y){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&d(s,y),c=s,u=y;(t=c<2?e:u)||!f;){i||(c?c<3?(c>1&&(p.n=-1),d(c,u)):p.n=u:p.v=u);try{if(l=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0)}else 1===c&&(t=i.return)&&t.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e}else if((t=(f=p.n<0)?u:n.call(r,p))!==a)break}catch(t){i=e,c=1,u=t}finally{l=1}}return{value:t,done:f}}}(n,o,i),!0),l}var a={};function c(){}function u(){}function l(){}t=Object.getPrototypeOf;var s=[][r]?t(t([][r]())):(Oe(t={},r,function(){return this}),t),f=l.prototype=c.prototype=Object.create(s);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,Oe(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=l,Oe(f,"constructor",l),Oe(l,"constructor",u),u.displayName="GeneratorFunction",Oe(l,o,"GeneratorFunction"),Oe(f),Oe(f,o,"Generator"),Oe(f,r,function(){return this}),Oe(f,"toString",function(){return"[object Generator]"}),(_e=function(){return{w:i,m:p}})()}function Oe(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Oe=function(e,t,n,r){if(t)o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{var i=function(t,n){Oe(e,t,function(e){return this._invoke(t,n,e)})};i("next",0),i("throw",1),i("return",2)}},Oe(e,t,n,r)}function Ee(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}function je(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){Ee(i,r,o,a,c,"next",e)}function c(e){Ee(i,r,o,a,c,"throw",e)}a(void 0)})}}function ke(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,c=[],u=!0,l=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(c.push(r.value),c.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw o}}return c}}(e,t)||Pe(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Pe(e,t){if(e){if("string"==typeof e)return Te(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Te(e,t):void 0}}function Te(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function xe(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return((parseInt(e,10)||0)/Math.pow(10,t)).toFixed(t)}function Ae(){return Le.apply(this,arguments)}function Le(){return(Le=je(_e().m(function e(){var t,n,r,o,i,a,c,u,l,s,f,p,d,y,v,m,b,h,g,w;return _e().w(function(e){for(;;)switch(e.n){case 0:if((r=(0,I.select)("wc/store/cart").getShippingRates()||[]).length){e.n=1;break}return e.a(2,[]);case 1:if(o=r[0],null!==(t=o.shipping_rates)&&void 0!==t&&t.length){e.n=2;break}return e.a(2,[]);case 2:i=(0,I.select)("wc/store/cart").getCartTotals()||{},a=parseInt(i.currency_minor_unit,10)||2,c=null===(n=o.shipping_rates.find(function(e){return e.is_chosen}))||void 0===n?void 0:n.rate_id,u=[],l=Ce(o.shipping_rates),e.p=3,l.s();case 4:if((s=l.n()).done){e.n=7;break}return v=s.value,(0,I.dispatch)("wc/store/cart").selectShippingRate(v.rate_id,0),e.n=5,new Promise(function(e){return setTimeout(e,300)});case 5:m=(0,I.select)("wc/store/cart").getCartTotals()||{},b=xe(null!==(f=m.total_price)&&void 0!==f?f:"0",a),h=xe(null!==(p=m.total_tax)&&void 0!==p?p:"0",a),g=xe(null!==(d=v.price)&&void 0!==d?d:"0",a),u.push({id:v.rate_id,label:v.name,amount:g,taxLineItems:[{id:"taxItem1",label:"Taxes",amount:h}],total:{label:null!==(y=m.total_label)&&void 0!==y?y:"Total",amount:b}});case 6:e.n=4;break;case 7:e.n=9;break;case 8:e.p=8,w=e.v,l.e(w);case 9:return e.p=9,l.f(),e.f(9);case 10:if(!c){e.n=11;break}return(0,I.dispatch)("wc/store/cart").selectShippingRate(c,0),e.n=11,new Promise(function(e){return setTimeout(e,300)});case 11:return e.a(2,u)}},e,null,[[3,8,9,10]])}))).apply(this,arguments)}function Re(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var u=r&&r.prototype instanceof c?r:c,l=Object.create(u.prototype);return He(l,"_invoke",function(n,r,o){var i,c,u,l=0,s=o||[],f=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return i=t,c=0,u=e,p.n=n,a}};function d(n,r){for(c=n,u=r,t=0;!f&&l&&!o&&t<s.length;t++){var o,i=s[t],d=p.p,y=i[2];n>3?(o=y===r)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=n<2&&d<i[1])?(c=0,p.v=r,p.n=i[1]):d<y&&(o=n<3||i[0]>r||r>y)&&(i[4]=n,i[5]=r,p.n=y,c=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,y){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&d(s,y),c=s,u=y;(t=c<2?e:u)||!f;){i||(c?c<3?(c>1&&(p.n=-1),d(c,u)):p.n=u:p.v=u);try{if(l=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0)}else 1===c&&(t=i.return)&&t.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e}else if((t=(f=p.n<0)?u:n.call(r,p))!==a)break}catch(t){i=e,c=1,u=t}finally{l=1}}return{value:t,done:f}}}(n,o,i),!0),l}var a={};function c(){}function u(){}function l(){}t=Object.getPrototypeOf;var s=[][r]?t(t([][r]())):(He(t={},r,function(){return this}),t),f=l.prototype=c.prototype=Object.create(s);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,He(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=l,He(f,"constructor",l),He(l,"constructor",u),u.displayName="GeneratorFunction",He(l,o,"GeneratorFunction"),He(f),He(f,o,"Generator"),He(f,r,function(){return this}),He(f,"toString",function(){return"[object Generator]"}),(Re=function(){return{w:i,m:p}})()}function He(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}He=function(e,t,n,r){if(t)o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{var i=function(t,n){He(e,t,function(e){return this._invoke(t,n,e)})};i("next",0),i("throw",1),i("return",2)}},He(e,t,n,r)}function Ie(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}function Ge(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,c=[],u=!0,l=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(c.push(r.value),c.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return De(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?De(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function De(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}wp.element.createElement(function(t){var r,o=t.billing,i=t.shippingData,a=t.onClick,c=t.onClose,u=(t.onSubmit,t.setExpressPaymentError),l=t.emitResponse,s=t.eventRegistration,f=s.onPaymentSetup,p=s.onCheckoutFail,d=Ge((0,e.useState)(!1),2),y=d[0],v=d[1],m=i.needsShipping;(0,e.useEffect)(function(){var e=(0,I.subscribe)(function(){wp.data.select("wc/store/cart").isApplyingCoupon()||v(function(e){return!e})});return function(){e()}},[]);var b,h=function(){var t=ke((0,e.useState)(null),2),r=t[0],o=t[1];return(0,e.useEffect)(function(){var e=n(),t=e.applicationId,r=e.locationId;if(window.Square)try{var i=Square.payments(t,r);o(i)}catch(e){console.error("[useSquare] Error creating payments:",e)}else console.error("[useSquare] window.Square is not available!")},[]),r}(),g=function(t,n,r){var o=(0,e.useRef)(null),i=ke((0,e.useState)(null),2),a=i[0],c=i[1];return(0,e.useEffect)(function(){function e(){return(e=je(_e().m(function e(){var r,i,a,u,l,s;return _e().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,e.n=1,be();case 1:r=e.v,i=JSON.parse(r),Array.isArray(i.lineItems)&&(-1!==(a=i.lineItems.findIndex(function(e){var t;return null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes("shipping")}))&&i.lineItems.splice(a,1),-1!==(u=i.lineItems.findIndex(function(e){var t;return null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes("discount")}))&&i.lineItems.splice(u,1)),n&&(i.requestShippingAddress=!0),o.current?o.current.update(i):(l=t.paymentRequest(i),o.current=l,c(l)),e.n=3;break;case 2:e.p=2,s=e.v,console.error("Failed to create/update PaymentRequest:",s);case 3:return e.a(2)}},e,null,[[0,2]])}))).apply(this,arguments)}t&&function(){e.apply(this,arguments)}()},[t,n,r]),[a]}(h,m,y),w=Ge(g,1)[0],C=function(t,n){var r=ke((0,e.useState)(null),2),o=r[0],i=r[1],a=(0,e.useRef)(null);return(0,e.useEffect)(function(){t&&n?je(_e().m(function e(){var r;return _e().w(function(e){for(;;)switch(e.n){case 0:return console.log(n),e.p=1,e.n=2,t.afterpayClearpay(n);case 2:return r=e.v,console.log(r),e.n=3,r.attach(a.current,{buttonColor:"black",buttonSizeMode:"fill"});case 3:i(r),e.n=5;break;case 4:e.p=4,e.v;case 5:return e.a(2)}},e,null,[[1,4]])}))():console.log("no payment")},[t,n]),[o,a]}(h,w),S=Ge(C,2),_=S[0],O=S[1],E=Ge((0,e.useState)(!1),2),j=E[0],k=E[1];return b=w,(0,e.useRef)(!1),(0,e.useEffect)(function(){if(b&&"function"==typeof b.addEventListener){var e=function(){var e=je(_e().m(function e(t){var n,r,o,i;return _e().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,t.givenName,t.familyName,null===(n=t.addressLines)||void 0===n||n[0],null===(r=t.addressLines)||void 0===r||r[1],t.city,t.state,t.postalCode,t.countryCode,t.phone,e.n=1,new Promise(function(e){return setTimeout(e,300)});case 1:return e.n=2,Ae();case 2:if((o=e.v).length){e.n=3;break}return e.a(2);case 3:return e.a(2,{shippingOptions:o});case 4:e.p=4,i=e.v,console.error("Error in onAfterpayShippingAddressChanged:",i);case 5:return e.a(2)}},e,null,[[0,4]])}));return function(_x){return e.apply(this,arguments)}}();return b.addEventListener("afterpay_shippingaddresschanged",e),function(){"function"==typeof b.removeEventListener&&b.removeEventListener("afterpay_shippingaddresschanged",e)}}},[b]),function(t,n,r,o,i){console.log(r);var a=function(e){var t={familyName:e.billingData.last_name||"",givenName:e.billingData.first_name||"",email:e.billingData.email||"",country:e.billingData.country||"",region:e.billingData.state||"",city:e.billingData.city||"",postalCode:e.billingData.postcode||""};e.billingData.phone&&(t.phone=e.billingData.phone);var n=[e.billingData.address_1,e.billingData.address_2].filter(Boolean);return n.length&&(t.addressLines=n),{intent:"CHARGE",amount:(e.cartTotal.value/100).toString(),currencyCode:e.currency.code,billingContact:t}}(n);(0,e.useEffect)(function(){if(r)return i(function(){function e(){return(e=je(_e().m(function e(){var n,i,c,u,l,s,f,p,d,y,v,m,b,h,g,w,C,S,_,O,E,j,k,P,T,x,A,L,R,H,I,G,D,N,M,F,q,V,Z,U;return _e().w(function(e){for(;;)switch(e.n){case 0:if(console.log(r.token),P={type:o.responseTypes.SUCCESS},r){e.n=1;break}return console.error("[usePaymentProcessing] tokenResult is null/undefined!"),P={type:o.responseTypes.FAILURE},e.a(2,P);case 1:return T=r.details,x=T.card,A=T.method,L=r.token,e.n=2,he(t,L,a);case 2:if(R=e.v,console.log(R),H=R.token,I="wc-squaresync_credit",G=(null==r||null===(n=r.details)||void 0===n?void 0:n.billing)||{},D=(null==r||null===(i=r.details)||void 0===i?void 0:i.shipping)||{},N=D.contact,M=void 0===N?{}:N,F=D.option,q=void 0===F?{}:F,V=null!==(c=null!==(u=null==G?void 0:G.email)&&void 0!==u?u:null==M?void 0:M.email)&&void 0!==c?c:"",Z=null!==(l=null!==(s=null==G?void 0:G.phone)&&void 0!==s?s:null==M?void 0:M.phone)&&void 0!==l?l:"",U=null!==(f=null!==(p=null==M?void 0:M.phone)&&void 0!==p?p:null==G?void 0:G.phone)&&void 0!==f?f:"",P.meta={paymentMethodData:Se(Se(Se(Se(Se(Se(Se(Se({},"".concat(I,"-card-type"),A||""),"".concat(I,"-last-four"),(null==x?void 0:x.last4)||""),"".concat(I,"-exp-month"),(null==x||null===(d=x.expMonth)||void 0===d?void 0:d.toString())||""),"".concat(I,"-exp-year"),(null==x||null===(y=x.expYear)||void 0===y?void 0:y.toString())||""),"".concat(I,"-payment-postcode"),(null==x?void 0:x.postalCode)||""),"".concat(I,"-payment-nonce"),L||""),"".concat(I,"-buyer-verification-token"),H||""),"shipping_method",null!==(v=q.id)&&void 0!==v&&v),billingAddress:{email:V,first_name:null!==(m=G.givenName)&&void 0!==m?m:"",last_name:null!==(b=G.familyName)&&void 0!==b?b:"",company:"",address_1:G.addressLines?G.addressLines[0]:"",address_2:G.addressLines?G.addressLines[1]:"",city:null!==(h=G.city)&&void 0!==h?h:"",state:null!==(g=G.state)&&void 0!==g?g:"",postcode:null!==(w=G.postalCode)&&void 0!==w?w:"",country:null!==(C=G.countryCode)&&void 0!==C?C:"",phone:Z},shippingAddress:{first_name:null!==(S=M.givenName)&&void 0!==S?S:"",last_name:null!==(_=M.familyName)&&void 0!==_?_:"",company:"",address_1:M.addressLines?M.addressLines[0]:"",address_2:M.addressLines?M.addressLines[1]:"",city:null!==(O=M.city)&&void 0!==O?O:"",state:null!==(E=M.state)&&void 0!==E?E:"",postcode:null!==(j=M.postalCode)&&void 0!==j?j:"",country:null!==(k=M.countryCode)&&void 0!==k?k:"",phone:U}},!wp.data.select("wc/store/cart").getNeedsShipping()){e.n=3;break}if(wp.data.select("wc/store/cart").getShippingRates().some(function(e){return e.shipping_rates.length})){e.n=3;break}return console.error("[usePaymentProcessing] No shipping rates available => FAILURE"),P.type=o.responseTypes.FAILURE,console.log(P),e.a(2,P);case 3:return console.log(P),e.a(2,P)}},e)}))).apply(this,arguments)}return function(){return e.apply(this,arguments)}()});console.log("[usePaymentProcessing] no tokenResult yet, doing nothing.")},[r])}(h,o,j,l,f),(0,e.useEffect)(function(){return p(function(){return c(),!0})},[p]),null===(r=n())||void 0===r||null===(r=r.afterpay)||void 0===r||r.includes("no"),wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{ref:O,role:"button",tabIndex:0,className:"afterpay-button wc-square-wallet-buttons",onClick:function(){var e,t;(e=_)?(u(""),a(),(t=Re().m(function t(){var n;return Re().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,ge(e);case 1:(n=t.v)?k(n):(console.error("Tokenization failed in onClickHandler"),c());case 2:return t.a(2)}},t)}),function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function a(e){Ie(i,r,o,a,c,"next",e)}function c(e){Ie(i,r,o,a,c,"throw",e)}a(void 0)})})()):console.error("Button instance is null or undefined")}}))},null),wp.element.createElement(function(){return wp.element.createElement(React.Fragment,null,wp.element.createElement("div",null,"afterpay"))},null),n().supports;var Ne=window.wc.wcBlocksRegistry,Me=Ne.registerPaymentMethod;(0,Ne.registerExpressPaymentMethod)(pe),Me(H)})();
     1(()=>{"use strict";const t=window.wp.element;var e=window.wc.wcSettings.getSetting,r=function(){var t=e("squaresync_credit_data",null);if(!t)throw new Error("Square initialization data is not available");return{title:t.title||"",applicationId:t.applicationId||"",locationId:t.locationId||"",isSandbox:t.is_sandbox||!1,availableCardTypes:t.accepted_credit_cards||{},loggingEnabled:t.logging_enabled||!1,generalError:t.general_error||"",showSavedCards:t.show_saved_cards||!1,showSaveOption:t.show_save_option||!1,supports:t.supports||{},isTokenizationForced:t.is_tokenization_forced||!1,paymentTokenNonce:t.payment_token_nonce||"",isDigitalWalletsEnabled:"yes"===t.enable_apple_pay||"yes"===t.enable_google_pay||"yes"===t.enable_after_pay||!1,googlePay:t.enable_google_pay||"no",applePay:t.enable_apple_pay||"no",afterPay:t.enable_after_pay||"no",isPayForOrderPage:t.is_pay_for_order_page||!1,recalculateTotalNonce:t.recalculate_totals_nonce||!1,context:t.context||"",ajaxUrl:t.ajax_url||"",paymentRequestNonce:t.payment_request_nonce||"",googlePayColor:t.google_pay_color||"black",applePayColor:t.apple_pay_color||"black",applePayType:t.apple_pay_type||"buy",hideButtonOptions:t.hide_button_options||[],hasSubscription:t.hasSubscription||!1}};function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(){o=function(){return e};var t,e={},r=Object.prototype,i=r.hasOwnProperty,a=Object.defineProperty||function(t,e,r){t[e]=r.value},c="function"==typeof Symbol?Symbol:{},u=c.iterator||"@@iterator",l=c.asyncIterator||"@@asyncIterator",s=c.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,r){return t[e]=r}}function h(t,e,r,n){var o=e&&e.prototype instanceof w?e:w,i=Object.create(o.prototype),c=new T(n||[]);return a(i,"_invoke",{value:O(t,r,c)}),i}function p(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var y="suspendedStart",d="suspendedYield",v="executing",m="completed",g={};function w(){}function b(){}function x(){}var E={};f(E,u,(function(){return this}));var L=Object.getPrototypeOf,_=L&&L(L(A([])));_&&_!==r&&i.call(_,u)&&(E=_);var C=x.prototype=w.prototype=Object.create(E);function S(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function k(t,e){function r(o,a,c,u){var l=p(t[o],t,a);if("throw"!==l.type){var s=l.arg,f=s.value;return f&&"object"==n(f)&&i.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,c,u)}),(function(t){r("throw",t,c,u)})):e.resolve(f).then((function(t){s.value=t,c(s)}),(function(t){return r("throw",t,c,u)}))}u(l.arg)}var o;a(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}})}function O(e,r,n){var o=y;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=j(c,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===y)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var l=p(e,r,n);if("normal"===l.type){if(o=n.done?m:d,l.arg===g)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=m,n.method="throw",n.arg=l.arg)}}}function j(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,j(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=p(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function N(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function A(e){if(e||""===e){var r=e[u];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(i.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(n(e)+" is not iterable")}return b.prototype=x,a(C,"constructor",{value:x,configurable:!0}),a(x,"constructor",{value:b,configurable:!0}),b.displayName=f(x,s,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===b||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,x):(t.__proto__=x,f(t,s,"GeneratorFunction")),t.prototype=Object.create(C),t},e.awrap=function(t){return{__await:t}},S(k.prototype),f(k.prototype,l,(function(){return this})),e.AsyncIterator=k,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new k(h(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},S(C),f(C,s,"Generator"),f(C,u,(function(){return this})),f(C,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=A,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(N),!e)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),l=i.call(a,"finallyLoc");if(u&&l){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),N(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;N(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:A(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function i(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function a(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?i(Object(r),!0).forEach((function(e){c(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function c(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,"string");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function u(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}var l=(0,t.createContext)(!1),s=function(e){var n=e.checkoutFormHandler,i=e.eventRegistration,c=e.emitResponse,s=(0,t.useContext)(l),f=i.onPaymentSetup,h=i.onCheckoutAfterProcessingWithError,p=i.onCheckoutAfterProcessingWithSuccess;return function(e,n,i,c,l,s){var f=(0,t.useRef)(i);(0,t.useEffect)((function(){f.current=i}),[i]),(0,t.useEffect)((function(){var t=function(){var t,e=(t=o().mark((function t(){var e,i,u,h,p,y,d,v,m,g,w,b,x,E;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i={type:n.responseTypes.SUCCESS},u={nonce:"",notices:[],logs:[]},null===(e=f.current)||void 0===e||!e.token){t.next=20;break}return t.prev=3,h=r(),p=h.paymentTokenNonce,t.next=7,fetch("".concat(wc.wcSettings.ADMIN_URL,"admin-ajax.php?action=squaresync_credit_card_get_token_by_id&token_id=").concat(f.current.token,"&nonce=").concat(p));case 7:return y=t.sent,t.next=10,y.json();case 10:d=t.sent,v=d.success,m=d.data,u.token=v?m:"",t.next=18;break;case 16:t.prev=16,t.t0=t.catch(3);case 18:t.next=31;break;case 20:return t.prev=20,t.next=23,l(f.current.card);case 23:b=t.sent,u.nonce=b.token,null!=b&&null!==(g=b.details)&&void 0!==g&&g.card&&null!=b&&null!==(w=b.details)&&void 0!==w&&w.billing&&(u.cardData=a(a({},b.details.card),b.details.billing)),t.next=31;break;case 28:t.prev=28,t.t1=t.catch(20),console.error("Error creating nonce:",t.t1);case 31:if(!(x=u.token||u.nonce)){t.next=45;break}return t.prev=33,t.next=36,s(f.current.payments,x);case 36:E=t.sent,u.verificationToken=E.verificationToken||"",u.logs=u.logs.concat(E.log||[]),u.errors=u.notices.concat(E.errors||[]),t.next=45;break;case 42:t.prev=42,t.t2=t.catch(33),console.error("Error during buyer verification:",t.t2);case 45:return x||u.logs.length>0?i.meta={paymentMethodData:c(u)}:u.notices.length>0&&(console.log("Errors or notices found:",u.notices),i.type=n.responseTypes.ERROR,i.message=u.notices),t.abrupt("return",i);case 47:case"end":return t.stop()}}),t,null,[[3,16],[20,28],[33,42]])})),function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){u(i,n,o,a,c,"next",t)}function c(t){u(i,n,o,a,c,"throw",t)}a(void 0)}))});return function(){return e.apply(this,arguments)}}();return e(t)}),[e,n.responseTypes.SUCCESS,n.responseTypes.ERROR,l,s,c])}(f,c,s,n.getPaymentMethodData,n.createNonce,n.verifyBuyer),function(e,r,n){(0,t.useEffect)((function(){var t=function(t){var e={type:n.responseTypes.SUCCESS},r=t.processingResponse,o=r.paymentStatus,i=r.paymentDetails;return o===n.responseTypes.ERROR&&i.checkoutNotices&&(e={type:n.responseTypes.ERROR,message:JSON.parse(i.checkoutNotices),messageContext:n.noticeContexts.PAYMENTS,retry:!0}),e},o=e(t),i=r(t);return function(){o(),i()}}),[e,r,n.noticeContexts.PAYMENTS,n.responseTypes.ERROR,n.responseTypes.SUCCESS])}(h,p,c),null};function f(t){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f(t)}function h(){h=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var i=e&&e.prototype instanceof w?e:w,a=Object.create(i.prototype),c=new T(n||[]);return o(a,"_invoke",{value:O(t,r,c)}),a}function p(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var y="suspendedStart",d="suspendedYield",v="executing",m="completed",g={};function w(){}function b(){}function x(){}var E={};l(E,a,(function(){return this}));var L=Object.getPrototypeOf,_=L&&L(L(A([])));_&&_!==r&&n.call(_,a)&&(E=_);var C=x.prototype=w.prototype=Object.create(E);function S(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function k(t,e){function r(o,i,a,c){var u=p(t[o],t,i);if("throw"!==u.type){var l=u.arg,s=l.value;return s&&"object"==f(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(s).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,r,n){var o=y;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=j(c,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===y)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var l=p(e,r,n);if("normal"===l.type){if(o=n.done?m:d,l.arg===g)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=m,n.method="throw",n.arg=l.arg)}}}function j(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,j(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=p(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function N(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function A(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(f(e)+" is not iterable")}return b.prototype=x,o(C,"constructor",{value:x,configurable:!0}),o(x,"constructor",{value:b,configurable:!0}),b.displayName=l(x,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===b||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,x):(t.__proto__=x,l(t,u,"GeneratorFunction")),t.prototype=Object.create(C),t},e.awrap=function(t){return{__await:t}},S(k.prototype),l(k.prototype,c,(function(){return this})),e.AsyncIterator=k,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new k(s(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},S(C),l(C,u,"Generator"),l(C,a,(function(){return this})),l(C,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=A,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(N),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),N(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;N(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:A(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function p(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function y(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){p(i,n,o,a,c,"next",t)}function c(t){p(i,n,o,a,c,"throw",t)}a(void 0)}))}}function d(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=f(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=f(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==f(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function v(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(t){l=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return c}}(t,e)||function(t,e){if(t){if("string"==typeof t)return m(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?m(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function g(t){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},g(t)}function w(){w=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),c=new T(n||[]);return o(a,"_invoke",{value:O(t,r,c)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var h="suspendedStart",p="suspendedYield",y="executing",d="completed",v={};function m(){}function b(){}function x(){}var E={};l(E,a,(function(){return this}));var L=Object.getPrototypeOf,_=L&&L(L(A([])));_&&_!==r&&n.call(_,a)&&(E=_);var C=x.prototype=m.prototype=Object.create(E);function S(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function k(t,e){function r(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,s=l.value;return s&&"object"==g(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(s).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,r,n){var o=h;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===d){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=j(c,n);if(u){if(u===v)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var l=f(e,r,n);if("normal"===l.type){if(o=n.done?d:p,l.arg===v)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=d,n.method="throw",n.arg=l.arg)}}}function j(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,j(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,v;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function N(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function A(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(g(e)+" is not iterable")}return b.prototype=x,o(C,"constructor",{value:x,configurable:!0}),o(x,"constructor",{value:b,configurable:!0}),b.displayName=l(x,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===b||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,x):(t.__proto__=x,l(t,u,"GeneratorFunction")),t.prototype=Object.create(C),t},e.awrap=function(t){return{__await:t}},S(k.prototype),l(k.prototype,c,(function(){return this})),e.AsyncIterator=k,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new k(s(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},S(C),l(C,u,"Generator"),l(C,a,(function(){return this})),l(C,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=A,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(N),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),N(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;N(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:A(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}function b(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function x(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(t){l=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return c}}(t,e)||function(t,e){if(t){if("string"==typeof t)return E(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?E(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function E(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var L=function(e){var n=e.children,o=e.token,i=void 0===o?null:o,a=e.defaults.postalCode,c=void 0===a?"":a,u=x((0,t.useState)(!1),2),s=u[0],f=u[1],h=x((0,t.useState)(!1),2),p=h[0],y=h[1],d=r(),v=d.applicationId,m=d.locationId;return(0,t.useEffect)((function(){!s&&window.Square&&f(Square.payments(v,m))}),[v,m,s]),(0,t.useEffect)((function(){if(s&&!p&&!i){var t=function(){var t,e=(t=w().mark((function t(){var e;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,s.card({postalCode:c});case 2:e=t.sent,y(e);case 4:case"end":return t.stop()}}),t)})),function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){b(i,n,o,a,c,"next",t)}function c(t){b(i,n,o,a,c,"throw",t)}a(void 0)}))});return function(){return e.apply(this,arguments)}}();t()}}),[s,p,i,c]),s?wp.element.createElement(l.Provider,{value:{payments:s,card:p,token:i}},n):null};function _(t){return _="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_(t)}function C(){C=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),c=new T(n||[]);return o(a,"_invoke",{value:O(t,r,c)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var h="suspendedStart",p="suspendedYield",y="executing",d="completed",v={};function m(){}function g(){}function w(){}var b={};l(b,a,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(A([])));E&&E!==r&&n.call(E,a)&&(b=E);var L=w.prototype=m.prototype=Object.create(b);function S(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function k(t,e){function r(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,s=l.value;return s&&"object"==_(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(s).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,r,n){var o=h;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===d){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=j(c,n);if(u){if(u===v)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var l=f(e,r,n);if("normal"===l.type){if(o=n.done?d:p,l.arg===v)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=d,n.method="throw",n.arg=l.arg)}}}function j(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,j(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,v;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function N(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function A(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(_(e)+" is not iterable")}return g.prototype=w,o(L,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:g,configurable:!0}),g.displayName=l(w,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,l(t,u,"GeneratorFunction")),t.prototype=Object.create(L),t},e.awrap=function(t){return{__await:t}},S(k.prototype),l(k.prototype,c,(function(){return this})),e.AsyncIterator=k,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new k(s(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},S(L),l(L,u,"Generator"),l(L,a,(function(){return this})),l(L,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=A,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(N),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),N(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;N(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:A(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}function S(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}var k=function(){var e=(0,t.useContext)(l).card;console.log("test");var r=(0,t.useRef)(!1);return(0,t.useEffect)((function(){if(e){var t=function(){var t,n=(t=C().mark((function t(){return C().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.attach(r.current);case 1:case"end":return t.stop()}}),t)})),function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){S(i,n,o,a,c,"next",t)}function c(t){S(i,n,o,a,c,"throw",t)}a(void 0)}))});return function(){return n.apply(this,arguments)}}();t()}}),[e]),wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{ref:r}))},O=function(e){var n=e.billing,o=e.eventRegistration,i=e.emitResponse,a=(e.shouldSavePayment,function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=v((0,t.useState)(!1),2),a=i[0],c=i[1],u=v((0,t.useState)(""),2),l=u[0],s=u[1],f=(0,t.useMemo)((function(){var t=n&&!o?"STORE":"CHARGE",r={billingContact:{familyName:e.billingData.last_name||"",givenName:e.billingData.first_name||"",email:e.billingData.email||"",country:e.billingData.country||"",region:e.billingData.state||"",city:e.billingData.city||"",postalCode:e.billingData.postcode||"",phone:e.billingData.phone||"",addressLines:[e.billingData.address_1||"",e.billingData.address_2||""]},intent:t};return"CHARGE"===t&&(r.amount=(e.cartTotal.value/100).toString(),r.currencyCode=e.currency.code),r}),[e.billingData,e.cartTotal.value,e.currency.code,n,o]),p=(0,t.useCallback)((function(t){var e,r,i,a=t.cardData,c=void 0===a?{}:a,u=t.nonce,l=t.verificationToken,s=t.notices,f=(t.logs,d(d(d(d(d(d(d(d(d(d(i={},"wc-squaresync_credit-card-type",(null==c?void 0:c.brand)||""),"wc-squaresync_credit-last-four",(null==c?void 0:c.last4)||""),"wc-squaresync_credit-exp-month",(null==c||null===(e=c.expMonth)||void 0===e?void 0:e.toString())||""),"wc-squaresync_credit-exp-year",(null==c||null===(r=c.expYear)||void 0===r?void 0:r.toString())||""),"wc-squaresync_credit-payment-postcode",(null==c?void 0:c.postalCode)||""),"wc-squaresync_credit-payment-nonce",u||""),"wc-squaresync_credit-payment-token",o||""),"wc-squaresync_credit-buyer-verification-token",l||""),"wc-squaresync_credit-tokenize-payment-method",n||!1),"log-data",""),d(i,"checkout-notices",s.length>0?JSON.stringify(s):""));return o&&(f.token=o),f}),[l,n,o]),m=(0,t.useCallback)(function(){var t=y(h().mark((function t(e){return h().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o){t.next=4;break}return t.next=3,e.tokenize();case 3:return t.abrupt("return",t.sent);case 4:return t.abrupt("return",o);case 5:case"end":return t.stop()}}),t)})));return function(_x){return t.apply(this,arguments)}}(),[o]),g=(0,t.useCallback)((function(t){var e={notices:[],logs:[]};return t&&t.token?e.verificationToken=t.token:console.log("Verification token is missing from the Square response",e),e}),[]),w=(0,t.useCallback)(function(){var t=y(h().mark((function t(e,r){var n;return h().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e.verifyBuyer(r,f);case 3:return n=t.sent,t.abrupt("return",g(n));case 7:t.prev=7,t.t0=t.catch(0),console.error("Error in verifyBuyer:",t.t0);case 10:return t.abrupt("return",!1);case 11:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(e,r){return t.apply(this,arguments)}}(),[f,g]);return{handleInputReceived:(0,t.useCallback)((function(t){if("cardBrandChanged"===t.eventType){var e=t.cardBrand,n="plain";null!==e&&"unknown"!==e||(n=""),null!==r().availableCardTypes[e]&&(n=r().availableCardTypes[e]),s(n)}}),[]),isLoaded:a,setLoaded:c,getPostalCode:(0,t.useCallback)((function(){return e.billingData.postcode||""}),[e.billingData.postcode]),cardType:l,createNonce:m,verifyBuyer:w,getPaymentMethodData:p}}(n,!1));return wp.element.createElement(L,{defaults:{postalCode:a.getPostalCode()}},wp.element.createElement(k,null),wp.element.createElement(s,{checkoutFormHandler:a,eventRegistration:o,emitResponse:i}))},j=["RenderedComponent"],P=window.wc.wcBlocksRegistry,N=(P.registerPaymentMethod,P.registerExpressPaymentMethod,function(t){var e=t.RenderedComponent,r=function(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.includes(n))continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],e.includes(r)||{}.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,j);return wp.element.createElement(e,r)});const T={name:"squaresync_credit",paymentMethodId:"squaresync_credit",label:wp.element.createElement((function(t){var e=t.components.PaymentMethodLabel,r=t.labelText;return wp.element.createElement(e,{text:r})}),{labelText:"Credit Card"}),content:wp.element.createElement(N,{RenderedComponent:O}),edit:wp.element.createElement(N,{RenderedComponent:O}),ariaLabel:"Square",canMakePayment:function(){return!(!r().applicationId||!r().locationId)},supports:{features:r().supports,showSaveOption:!r().hasSubscription}},A=window.wp.data;function I(t){return I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},I(t)}function G(){G=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),c=new P(n||[]);return o(a,"_invoke",{value:S(t,r,c)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var h="suspendedStart",p="suspendedYield",y="executing",d="completed",v={};function m(){}function g(){}function w(){}var b={};l(b,a,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(N([])));E&&E!==r&&n.call(E,a)&&(b=E);var L=w.prototype=m.prototype=Object.create(b);function _(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function C(t,e){function r(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,s=l.value;return s&&"object"==I(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(s).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function S(e,r,n){var o=h;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===d){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=k(c,n);if(u){if(u===v)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var l=f(e,r,n);if("normal"===l.type){if(o=n.done?d:p,l.arg===v)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=d,n.method="throw",n.arg=l.arg)}}}function k(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,v;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function N(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(I(e)+" is not iterable")}return g.prototype=w,o(L,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:g,configurable:!0}),g.displayName=l(w,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,l(t,u,"GeneratorFunction")),t.prototype=Object.create(L),t},e.awrap=function(t){return{__await:t}},_(C.prototype),l(C.prototype,c,(function(){return this})),e.AsyncIterator=C,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new C(s(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},_(L),l(L,u,"Generator"),l(L,a,(function(){return this})),l(L,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=N,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(j),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),j(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;j(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:N(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}function F(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function R(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){F(i,n,o,a,c,"next",t)}function c(t){F(i,n,o,a,c,"throw",t)}a(void 0)}))}}var H=function(t){return r().ajaxUrl.replace("%%endpoint%%","square_digital_wallet_".concat(t))},D=function(){var t=R(G().mark((function t(e){return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,r){return jQuery.post(H("recalculate_totals"),e,(function(e){return e.success?t(e.data):r(e.data)}))})));case 1:case"end":return t.stop()}}),t)})));return function(_x){return t.apply(this,arguments)}}(),M=function(){var t=R(G().mark((function t(e){var n,o;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n={context:r().context,shipping_option:e.id,security:r().recalculateTotalNonce,is_pay_for_order_page:r().isPayForOrderPage},t.next=3,D(n);case 3:return o=t.sent,t.abrupt("return",o);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),q=function(){var t=R(G().mark((function t(e){var n,o;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n={context:r().context,shipping_contact:e,security:r().recalculateTotalNonce,is_pay_for_order_page:r().isPayForOrderPage},t.next=3,D(n);case 3:return o=t.sent,t.abrupt("return",o);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),V=function(){var t=R(G().mark((function t(e,r,n){var o;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e.verifyBuyer(r,n);case 3:return o=t.sent,t.abrupt("return",o);case 7:throw t.prev=7,t.t0=t.catch(0),console.error("Error during buyer verification:",t.t0),t.t0;case 11:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(e,r,n){return t.apply(this,arguments)}}(),Z=function(){var t=R(G().mark((function t(e){var r;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e.tokenize();case 3:if("OK"!==(r=t.sent).status){t.next=6;break}return t.abrupt("return",r);case 6:t.next=11;break;case 8:return t.prev=8,t.t0=t.catch(0),t.abrupt("return",!1);case 11:return t.abrupt("return",!1);case 12:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(e){return t.apply(this,arguments)}}();function Y(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function U(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Y(Object(r),!0).forEach((function(e){B(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Y(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function B(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=z(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=z(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==z(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function z(t){return z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},z(t)}function $(){$=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),c=new P(n||[]);return o(a,"_invoke",{value:S(t,r,c)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var h="suspendedStart",p="suspendedYield",y="executing",d="completed",v={};function m(){}function g(){}function w(){}var b={};l(b,a,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(N([])));E&&E!==r&&n.call(E,a)&&(b=E);var L=w.prototype=m.prototype=Object.create(b);function _(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function C(t,e){function r(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,s=l.value;return s&&"object"==z(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(s).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function S(e,r,n){var o=h;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===d){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=k(c,n);if(u){if(u===v)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var l=f(e,r,n);if("normal"===l.type){if(o=n.done?d:p,l.arg===v)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=d,n.method="throw",n.arg=l.arg)}}}function k(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,v;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function N(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(z(e)+" is not iterable")}return g.prototype=w,o(L,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:g,configurable:!0}),g.displayName=l(w,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,l(t,u,"GeneratorFunction")),t.prototype=Object.create(L),t},e.awrap=function(t){return{__await:t}},_(C.prototype),l(C.prototype,c,(function(){return this})),e.AsyncIterator=C,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new C(s(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},_(L),l(L,u,"Generator"),l(L,a,(function(){return this})),l(L,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=N,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(j),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),j(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;j(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:N(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}function W(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(t){l=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return c}}(t,e)||function(t,e){if(t){if("string"==typeof t)return J(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?J(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function J(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function K(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function Q(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){K(i,n,o,a,c,"next",t)}function c(t){K(i,n,o,a,c,"throw",t)}a(void 0)}))}}function X(t){var e=t.givenName,r=t.familyName,n=t.addressLines,o=void 0===n?[]:n,i=t.city,a=t.state,c=t.email,u=t.countryCode,l=t.postalCode;return!!(e&&r&&o[0]&&i&&a&&u&&l&&c)}function tt(t,e){var r,n,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t&&"object"===z(t)||(t={});var i=t,a=i.familyName,c=i.givenName,u=i.region,l=i.state,s=i.country,f=i.countryCode,h=i.city,p=i.addressLines,y=i.postalCode,d=i.phone,v=i.email,m=o.first_name,g=void 0===m?"":m,w=o.last_name,b=void 0===w?"":w,x=o.address_1,E=void 0===x?"":x,L=o.address_2,_=void 0===L?"":L,C=o.city,S=void 0===C?"":C,k=o.state,O=void 0===k?"":k,j=o.country,P=void 0===j?"":j,N=o.postcode,T=void 0===N?"":N,A=o.phone,I=void 0===A?"":A,G=o.email,F=null!=y?y:T,R=null!=v?v:void 0===G?"":G,H=null!=d?d:I;return{givenName:null!=c?c:g,familyName:null!=a?a:b,state:e?null!=u?u:O:null!==(r=null!=l?l:u)&&void 0!==r?r:O,countryCode:e?null!=s?s:P:null!==(n=null!=f?f:s)&&void 0!==n?n:P,city:null!=h?h:S,addressLines:Array.isArray(p)&&p.length>0?p:[E,_].filter(Boolean),postalCode:F,phone:H,email:R}}function et(t){return et="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},et(t)}function rt(){rt=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),c=new P(n||[]);return o(a,"_invoke",{value:S(t,r,c)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var h="suspendedStart",p="suspendedYield",y="executing",d="completed",v={};function m(){}function g(){}function w(){}var b={};l(b,a,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(N([])));E&&E!==r&&n.call(E,a)&&(b=E);var L=w.prototype=m.prototype=Object.create(b);function _(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function C(t,e){function r(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,s=l.value;return s&&"object"==et(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(s).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function S(e,r,n){var o=h;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===d){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=k(c,n);if(u){if(u===v)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var l=f(e,r,n);if("normal"===l.type){if(o=n.done?d:p,l.arg===v)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=d,n.method="throw",n.arg=l.arg)}}}function k(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,v;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function N(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(et(e)+" is not iterable")}return g.prototype=w,o(L,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:g,configurable:!0}),g.displayName=l(w,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,l(t,u,"GeneratorFunction")),t.prototype=Object.create(L),t},e.awrap=function(t){return{__await:t}},_(C.prototype),l(C.prototype,c,(function(){return this})),e.AsyncIterator=C,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new C(s(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},_(L),l(L,u,"Generator"),l(L,a,(function(){return this})),l(L,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=N,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(j),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),j(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;j(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:N(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}function nt(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function ot(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(t){l=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return c}}(t,e)||function(t,e){if(t){if("string"==typeof t)return it(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?it(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function it(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var at=function(){return wp.element.createElement("svg",{width:"343",height:"50",viewBox:"0 0 343 50",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{width:"343",height:"50",rx:"4",fill:"black"}),wp.element.createElement("path",{d:"M97.6482 17.68H103.048C103.622 17.68 104.162 17.78 104.668 17.98C105.188 18.1667 105.642 18.4333 106.028 18.78C106.428 19.1133 106.742 19.5133 106.968 19.98C107.195 20.4467 107.308 20.9533 107.308 21.5C107.308 22.2333 107.122 22.86 106.748 23.38C106.388 23.8867 105.928 24.2667 105.368 24.52V24.64C106.088 24.8933 106.668 25.3067 107.108 25.88C107.562 26.4533 107.788 27.1467 107.788 27.96C107.788 28.5733 107.668 29.1267 107.428 29.62C107.188 30.1133 106.862 30.54 106.448 30.9C106.035 31.2467 105.555 31.52 105.008 31.72C104.475 31.9067 103.902 32 103.288 32H97.6482V17.68ZM102.968 23.66C103.302 23.66 103.602 23.6067 103.868 23.5C104.135 23.38 104.355 23.2333 104.528 23.06C104.715 22.8733 104.855 22.6667 104.948 22.44C105.042 22.2 105.088 21.96 105.088 21.72C105.088 21.48 105.042 21.2467 104.948 21.02C104.855 20.78 104.722 20.5733 104.548 20.4C104.375 20.2133 104.162 20.0667 103.908 19.96C103.655 19.84 103.368 19.78 103.048 19.78H99.9082V23.66H102.968ZM103.288 29.9C103.648 29.9 103.968 29.84 104.248 29.72C104.528 29.6 104.762 29.44 104.948 29.24C105.135 29.04 105.275 28.8133 105.368 28.56C105.475 28.3067 105.528 28.0467 105.528 27.78C105.528 27.5133 105.475 27.26 105.368 27.02C105.275 26.7667 105.128 26.5467 104.928 26.36C104.728 26.16 104.482 26 104.188 25.88C103.908 25.76 103.582 25.7 103.208 25.7H99.9082V29.9H103.288ZM116.875 30.68H116.755C116.461 31.1467 116.041 31.54 115.495 31.86C114.961 32.1667 114.355 32.32 113.675 32.32C112.435 32.32 111.508 31.9533 110.895 31.22C110.281 30.4733 109.975 29.4867 109.975 28.26V22.2H112.195V27.96C112.195 28.8133 112.388 29.4133 112.775 29.76C113.175 30.0933 113.695 30.26 114.335 30.26C114.708 30.26 115.041 30.18 115.335 30.02C115.641 29.86 115.901 29.6467 116.115 29.38C116.328 29.1 116.488 28.7867 116.595 28.44C116.701 28.08 116.755 27.7067 116.755 27.32V22.2H118.975V32H116.875V30.68ZM124.747 31.44L120.667 22.2H123.147L125.847 28.7H125.947L128.567 22.2H131.027L124.887 36.32H122.527L124.747 31.44ZM136.589 22.2H139.009L140.909 28.98H140.989L143.189 22.2H145.489L147.669 28.98H147.749L149.629 22.2H152.009L148.869 32H146.529L144.309 25.14H144.229L142.069 32H139.729L136.589 22.2ZM154.995 20.46C154.568 20.46 154.208 20.3133 153.915 20.02C153.635 19.7267 153.495 19.3733 153.495 18.96C153.495 18.5467 153.635 18.1933 153.915 17.9C154.208 17.6067 154.568 17.46 154.995 17.46C155.408 17.46 155.755 17.6067 156.035 17.9C156.328 18.1933 156.475 18.5467 156.475 18.96C156.475 19.3733 156.328 19.7267 156.035 20.02C155.755 20.3133 155.408 20.46 154.995 20.46ZM153.875 32V22.2H156.095V32H153.875ZM159.982 24.16H158.262V22.2H159.982V19.2H162.202V22.2H164.622V24.16H162.202V28.52C162.202 28.76 162.229 28.98 162.282 29.18C162.336 29.38 162.416 29.5467 162.522 29.68C162.749 29.9333 163.036 30.06 163.382 30.06C163.596 30.06 163.762 30.0467 163.882 30.02C164.002 29.98 164.129 29.9267 164.262 29.86L164.942 31.82C164.662 31.9267 164.369 32.0067 164.062 32.06C163.756 32.1267 163.409 32.16 163.022 32.16C162.556 32.16 162.142 32.0867 161.782 31.94C161.422 31.7933 161.109 31.5933 160.842 31.34C160.269 30.7667 159.982 29.9867 159.982 29V24.16ZM167.059 17.68H169.279V21.94L169.159 23.52H169.279C169.559 23.0533 169.972 22.6667 170.519 22.36C171.065 22.04 171.672 21.88 172.339 21.88C172.979 21.88 173.532 21.98 173.999 22.18C174.465 22.3667 174.852 22.64 175.159 23C175.465 23.36 175.692 23.7933 175.839 24.3C175.985 24.7933 176.059 25.34 176.059 25.94V32H173.839V26.24C173.839 25.4267 173.639 24.84 173.239 24.48C172.852 24.12 172.359 23.94 171.759 23.94C171.372 23.94 171.025 24.0267 170.719 24.2C170.425 24.36 170.165 24.58 169.939 24.86C169.725 25.14 169.559 25.46 169.439 25.82C169.332 26.18 169.279 26.5533 169.279 26.94V32H167.059V17.68Z",fill:"white"}),wp.element.createElement("path",{d:"M213.951 24.6725V31.7485H211.69V14.2748H217.684C219.203 14.2748 220.498 14.7778 221.558 15.7836C222.641 16.7895 223.183 18.0175 223.183 19.4678C223.183 20.9532 222.641 22.1813 221.558 23.1754C220.51 24.1696 219.215 24.6608 217.684 24.6608H213.951V24.6725ZM213.951 16.4269V22.5204H217.731C218.626 22.5204 219.379 22.2164 219.968 21.6199C220.569 21.0234 220.875 20.2982 220.875 19.4795C220.875 18.6725 220.569 17.9591 219.968 17.3626C219.379 16.7427 218.638 16.4386 217.731 16.4386H213.951V16.4269Z",fill:"white"}),wp.element.createElement("path",{d:"M229.094 19.3976C230.766 19.3976 232.085 19.8421 233.05 20.731C234.016 21.6199 234.499 22.8362 234.499 24.3801V31.7485H232.344V30.0877H232.25C231.319 31.4561 230.071 32.1345 228.517 32.1345C227.186 32.1345 226.079 31.7485 225.185 30.9649C224.29 30.1813 223.842 29.2105 223.842 28.0409C223.842 26.8011 224.313 25.8187 225.255 25.0935C226.197 24.3567 227.457 23.9941 229.023 23.9941C230.366 23.9941 231.472 24.2397 232.332 24.731V24.2164C232.332 23.4327 232.026 22.7778 231.402 22.228C230.778 21.6783 230.048 21.4093 229.212 21.4093C227.952 21.4093 226.951 21.9357 226.221 23L224.231 21.7602C225.326 20.1813 226.951 19.3976 229.094 19.3976ZM226.174 28.076C226.174 28.6608 226.421 29.152 226.927 29.538C227.422 29.9239 228.011 30.1228 228.682 30.1228C229.636 30.1228 230.483 29.7719 231.225 29.0701C231.967 28.3684 232.344 27.5497 232.344 26.6023C231.637 26.0526 230.66 25.7719 229.4 25.7719C228.482 25.7719 227.716 25.9941 227.104 26.4269C226.48 26.883 226.174 27.4327 226.174 28.076Z",fill:"white"}),wp.element.createElement("path",{d:"M246.792 19.7836L239.256 37H236.924L239.727 30.9766L234.758 19.7836H237.219L240.798 28.3684H240.845L244.331 19.7836H246.792Z",fill:"white"}),wp.element.createElement("path",{d:"M204.959 23.2456C204.959 22.5134 204.893 21.8128 204.77 21.1392H195.294V24.9988L200.751 25C200.53 26.2842 199.818 27.3789 198.726 28.1087V30.6128H201.975C203.872 28.869 204.959 26.2912 204.959 23.2456Z",fill:"#4285F4"}),wp.element.createElement("path",{d:"M198.727 28.1088C197.823 28.7146 196.658 29.069 195.296 29.069C192.664 29.069 190.432 27.3076 189.632 24.9333H186.281V27.5158C187.941 30.7883 191.354 33.0339 195.296 33.0339C198.021 33.0339 200.31 32.1439 201.976 30.6117L198.727 28.1088Z",fill:"#34A853"}),wp.element.createElement("path",{d:"M189.317 23.0175C189.317 22.3509 189.428 21.7064 189.632 21.1006V18.5181H186.281C185.594 19.8713 185.208 21.3988 185.208 23.0175C185.208 24.6362 185.596 26.1637 186.281 27.5169L189.632 24.9345C189.428 24.3286 189.317 23.6842 189.317 23.0175Z",fill:"#FABB05"}),wp.element.createElement("path",{d:"M195.296 16.9649C196.783 16.9649 198.115 17.4737 199.166 18.4678L202.045 15.6105C200.297 13.993 198.017 13 195.296 13C191.355 13 187.941 15.2456 186.281 18.5181L189.632 21.1006C190.432 18.7263 192.664 16.9649 195.296 16.9649Z",fill:"#E94235"}))},ct=function(){return wp.element.createElement("svg",{width:"343",height:"50",viewBox:"0 0 343 50",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{width:"343",height:"50",rx:"8",fill:"black"}),wp.element.createElement("path",{d:"M155.748 19.8275C154.411 19.8275 153.333 20.636 152.637 20.636C151.907 20.636 150.93 19.8724 149.773 19.8724C147.572 19.8724 145.337 21.7029 145.337 25.1282C145.337 27.2733 146.168 29.5306 147.19 31.0018C148.055 32.2259 148.83 33.2366 149.93 33.2366C151.02 33.2366 151.503 32.5179 152.862 32.5179C154.232 32.5179 154.546 33.2142 155.748 33.2142C156.95 33.2142 157.747 32.1248 158.499 31.0467C159.33 29.8001 159.69 28.5872 159.701 28.5311C159.634 28.5086 157.343 27.5765 157.343 24.9485C157.343 22.68 159.139 21.6693 159.241 21.5906C158.061 19.8724 156.253 19.8275 155.748 19.8275ZM155.13 18.3787C155.669 17.7161 156.051 16.8177 156.051 15.908C156.051 15.7845 156.04 15.6609 156.017 15.5599C155.141 15.5936 154.063 16.1439 153.423 16.8963C152.929 17.4691 152.457 18.3787 152.457 19.2884C152.457 19.4232 152.48 19.5692 152.491 19.6141C152.547 19.6253 152.637 19.6365 152.727 19.6365C153.524 19.6365 154.535 19.0975 155.13 18.3787ZM164.115 16.8289V33.0345H167.013V27.7225H170.528C173.807 27.7225 176.098 25.5213 176.098 22.3094C176.098 19.0413 173.886 16.8289 170.652 16.8289H164.115ZM167.013 19.2547H169.888C171.977 19.2547 173.156 20.3216 173.156 22.3094C173.156 24.241 171.943 25.3192 169.877 25.3192H167.013V19.2547ZM181.535 31.0467C180.3 31.0467 179.412 30.429 179.412 29.3958C179.412 28.3963 180.142 27.8348 181.703 27.7337L184.477 27.554V28.5311C184.477 29.9573 183.219 31.0467 181.535 31.0467ZM180.715 33.2366C182.321 33.2366 183.669 32.5403 184.354 31.3499H184.545V33.0345H187.229V24.6453C187.229 22.0399 185.454 20.5013 182.299 20.5013C179.379 20.5013 177.346 21.8826 177.121 24.0501H179.749C180.008 23.2191 180.884 22.7698 182.164 22.7698C183.669 22.7698 184.477 23.4437 184.477 24.6453V25.6785L181.31 25.8694C178.323 26.0491 176.65 27.3294 176.65 29.553C176.65 31.7991 178.345 33.2366 180.715 33.2366ZM190.329 37.493C193.081 37.493 194.395 36.4822 195.439 33.4276L199.875 20.7484H196.933L194.069 30.3392H193.878L191.003 20.7484H187.948L192.34 33.0906L192.194 33.6297C191.834 34.764 191.172 35.2132 189.992 35.2132C189.801 35.2132 189.386 35.202 189.229 35.1683V37.4481C189.408 37.4818 190.161 37.493 190.329 37.493Z",fill:"white"}),wp.element.createElement("rect",{width:"343",height:"50",rx:"8",stroke:"black"}))};const ut={name:"squaresync_credit_wallet",paymentMethodId:"squaresync_credit",content:wp.element.createElement((function(e){var n=e.billing,o=e.shippingData,i=e.onClick,a=e.onClose,c=e.onSubmit,u=e.setExpressPaymentError,l=e.emitResponse,s=e.eventRegistration,f=s.onPaymentSetup,h=s.onCheckoutFail,p=ot((0,t.useState)(!1),2),y=p[0],d=p[1],v=o.needsShipping;(0,t.useEffect)((function(){var t=(0,A.subscribe)((function(){wp.data.select("wc/store/cart").isApplyingCoupon()||d((function(t){return!t}))}));return function(){t()}}),[]);var m=function(){var e=W((0,t.useState)(null),2),n=e[0],o=e[1];return(0,t.useEffect)((function(){var t=r().applicationId,e=r().locationId;if(window.Square)try{var n=Square.payments(t,e);o(n)}catch(t){console.error(t)}}),[]),n}(),g=function(e,n,o){var i=(0,t.useRef)(null),a=W((0,t.useState)(null),2),c=a[0],u=a[1];return(0,t.useEffect)((function(){if(e){var t=function(){var t=Q($().mark((function t(){var o,a,c,l,s;return $().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,new Promise((function(t,e){var n={context:r().context,security:r().paymentRequestNonce,is_pay_for_order_page:!1};jQuery.post(H("get_payment_request"),n,(function(r){return r.success?t(r.data):e(r.data)}))}));case 3:o=t.sent,(a=JSON.parse(o))&&(Array.isArray(a.lineItems)&&(-1!==(c=a.lineItems.findIndex((function(t){var e;return null===(e=t.label)||void 0===e?void 0:e.toLowerCase().includes("shipping")})))&&a.lineItems.splice(c,1),-1!==(l=a.lineItems.findIndex((function(t){var e;return null===(e=t.label)||void 0===e?void 0:e.toLowerCase().includes("discount")})))&&a.lineItems.splice(l,1)),n&&(a.requestShippingAddress=!0)),i.current?i.current.update(a):(s=e.paymentRequest(a),i.current=s,u(s)),t.next=12;break;case 9:t.prev=9,t.t0=t.catch(0),console.error("Failed to create or update payment request:",t.t0);case 12:case"end":return t.stop()}}),t,null,[[0,9]])})));return function(){return t.apply(this,arguments)}}();t()}}),[e,n,o]),c}(m,v,y),w=function(e,n){var o=W((0,t.useState)(null),2),i=o[0],a=o[1],c=(0,t.useRef)(null);return(0,t.useEffect)((function(){e&&n&&Q($().mark((function t(){var o;return $().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e.googlePay(n);case 3:return o=t.sent,t.next=6,o.attach(c.current,{buttonColor:r().googlePayColor,buttonSizeMode:"fill",buttonType:"long"});case 6:a(o),t.next=11;break;case 9:t.prev=9,t.t0=t.catch(0);case 11:case"end":return t.stop()}}),t,null,[[0,9]])})))()}),[e,n]),[i,c]}(m,g),b=ot(w,2),x=b[0],E=b[1],L=function(e,n){var o=W((0,t.useState)(null),2),i=o[0],a=o[1],c=(0,t.useRef)(null);return(0,t.useEffect)((function(){e&&n&&Q($().mark((function t(){var r;return $().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e.applePay(n);case 3:r=t.sent,a(r),t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),console.log(t.t0);case 10:case"end":return t.stop()}}),t,null,[[0,7]])})))()}),[e,n]),(0,t.useEffect)((function(){if(null!=c&&c.current&&i){var t=r().applePayColor,e=r().applePayType;"plain"!==e&&(c.current.querySelector(".text").innerText="".concat(e.charAt(0).toUpperCase()).concat(e.slice(1)," with"),c.current.classList.add("wc-square-wallet-button-with-text")),c.current.style.cssText+="-apple-pay-button-type: ".concat(e,";"),c.current.style.cssText+="-apple-pay-button-style: ".concat(t,";"),c.current.style.display="block",c.current.classList.add("wc-square-wallet-button-".concat(t))}}),[i,c]),[i,c]}(m,g),_=ot(L,2),C=_[0],S=_[1],k=function(e,r){var n=W((0,t.useState)(null),2),o=n[0],i=n[1],a=(0,t.useRef)(null);return(0,t.useEffect)((function(){e&&r&&Q($().mark((function t(){var n;return $().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e.afterpayClearpay(r);case 3:return n=t.sent,t.next=6,n.attach(a.current,{buttonColor:"black",buttonSizeMode:"fill"});case 6:i(n),t.next=11;break;case 9:t.prev=9,t.t0=t.catch(0);case 11:case"end":return t.stop()}}),t,null,[[0,9]])})))()}),[e,r]),[o,a]}(m,g),O=ot(k,2),j=O[0],P=O[1],N=ot((0,t.useState)(!1),2),T=N[0],I=N[1];!function(e){(0,t.useEffect)((function(){null==e||e.addEventListener("shippingcontactchanged",(function(t){return q(t)})),null==e||e.addEventListener("afterpay_shippingaddresschanged",(function(t){return q(t)}))}),[e])}(g),function(e){(0,t.useEffect)((function(){null==e||e.addEventListener("shippingoptionchanged",(function(t){return M(t)})),null==e||e.addEventListener("afterpay_shippingoptionchanged",(function(t){return M(t)}))}),[e])}(g),function(e,r,n,o,i){var a=function(t){var e={familyName:t.billingData.last_name||"",givenName:t.billingData.first_name||"",email:t.billingData.email||"",country:t.billingData.country||"",region:t.billingData.state||"",city:t.billingData.city||"",postalCode:t.billingData.postcode||""};t.billingData.phone&&(e.phone=t.billingData.phone);var r=[t.billingData.address_1,t.billingData.address_2].filter(Boolean);return r.length&&(e.addressLines=r),{intent:"CHARGE",amount:(t.cartTotal.value/100).toString(),currencyCode:t.currency.code,billingContact:e}}(r);(0,t.useEffect)((function(){return i((function(){function t(){return(t=Q($().mark((function t(){var r,i,c,u,l,s,f,h,p,y,d,v,m,g,w,b,x,E,L,_,C,S,k,O,j,P,N,T,I,G,F,R,H,D,M,q,Z,Y,z,W,J,K,Q,et;return $().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(w={type:o.responseTypes.SUCCESS},n){t.next=4;break}return w={type:o.responseTypes.FAILURE},t.abrupt("return",w);case 4:return x=(b=null!=n?n:{}).details,E=b.token,_=(L=null!=x?x:{}).method,C=void 0===_?"":_,S=L.card,k=void 0===S?{}:S,O=L.shipping,j=void 0===O?{}:O,L.billing,(P=null!=j?j:{}).contact,N=P.option,T=void 0===N?{}:N,I="AfterpayClearpay"===C,G=(0,A.select)("wc/store/cart").getCustomerData().shippingAddress,F=(0,A.select)("wc/store/cart").getCustomerData().billingAddress,R=tt(null==n||null===(r=n.details)||void 0===r||null===(r=r.shipping)||void 0===r?void 0:r.contact,I,G),X(H=tt(null==n||null===(i=n.details)||void 0===i?void 0:i.billing,I,F))||(q=tt(null==n||null===(D=n.details)||void 0===D||null===(D=D.shipping)||void 0===D?void 0:D.contact,I,G),H=U(U({},q),{},{email:H.email||q.email||(null==n||null===(M=n.details)||void 0===M||null===(M=M.shipping)||void 0===M?void 0:M.contact.email)})),Z={token:""},t.prev=14,t.next=17,V(e,E,a);case 17:Z=t.sent,t.next=23;break;case 20:t.prev=20,t.t0=t.catch(14),console.error("verifyBuyer error:",t.t0);case 23:if(Y=Z.token,z=I?"AfterpayClearpay":null!==(c=null==k?void 0:k.cardType)&&void 0!==c?c:C,W=I?"":null!==(u=null==k?void 0:k.last4)&&void 0!==u?u:"",J=I?"":null!==(l=null==k||null===(s=k.expMonth)||void 0===s?void 0:s.toString())&&void 0!==l?l:"",K=I?"":null!==(f=null==k||null===(h=k.expYear)||void 0===h?void 0:h.toString())&&void 0!==f?f:"",Q=I?"":null!==(p=null==k?void 0:k.postalCode)&&void 0!==p?p:"",et="wc-squaresync_credit",w.meta={paymentMethodData:B(B(B(B(B(B(B(B({},"".concat(et,"-card-type"),z),"".concat(et,"-last-four"),W),"".concat(et,"-exp-month"),J),"".concat(et,"-exp-year"),K),"".concat(et,"-payment-postcode"),Q),"".concat(et,"-payment-nonce"),E),"".concat(et,"-buyer-verification-token"),Y||""),"shipping_method",null!==(y=null==T?void 0:T.id)&&void 0!==y&&y),billingAddress:{email:H.email,first_name:H.givenName,last_name:H.familyName,company:"",address_1:null!==(d=H.addressLines[0])&&void 0!==d?d:"",address_2:null!==(v=H.addressLines[1])&&void 0!==v?v:"",city:H.city,state:H.state,postcode:H.postalCode,country:H.countryCode,phone:H.phone},shippingAddress:{first_name:R.givenName,last_name:R.familyName,company:"",address_1:null!==(m=R.addressLines[0])&&void 0!==m?m:"",address_2:null!==(g=R.addressLines[1])&&void 0!==g?g:"",city:R.city,state:R.state,postcode:R.postalCode,country:R.countryCode,phone:R.phone}},t.prev=31,wp.data.dispatch("wc/store/cart").setBillingAddress(w.meta.billingAddress),!wp.data.select("wc/store/cart").getNeedsShipping()){t.next=40;break}if(wp.data.dispatch("wc/store/cart").setShippingAddress(w.meta.shippingAddress),wp.data.select("wc/store/cart").getShippingRates().some((function(t){return t.shipping_rates.length}))){t.next=40;break}return w.type=o.responseTypes.FAILURE,t.abrupt("return",w);case 40:t.next=47;break;case 42:return t.prev=42,t.t1=t.catch(31),console.error("WooCommerce address dispatch error:",t.t1),w.type=o.responseTypes.FAILURE,t.abrupt("return",w);case 47:return t.abrupt("return",w);case 48:case"end":return t.stop()}}),t,null,[[14,20],[31,42]])})))).apply(this,arguments)}return function(){return t.apply(this,arguments)}()}))}),[i,r.billingData,n])}(m,n,T,l,f),(0,t.useEffect)((function(){return h((function(){return a(),!0}))}),[h]);var G=r().googlePay.includes("no"),F=r().applePay.includes("no"),R=r().afterPay.includes("no");function D(t){var e;t?(u(""),i(),(e=rt().mark((function e(){var r;return rt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Z(t);case 2:(r=e.sent)?(I(r),c()):(console.error("Tokenization failed in onClickHandler"),a());case 4:case"end":return e.stop()}}),e)})),function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(t){nt(i,n,o,a,c,"next",t)}function c(t){nt(i,n,o,a,c,"throw",t)}a(void 0)}))})()):console.error("Button instance is null or undefined")}var Y=!G&&wp.element.createElement("div",{tabIndex:0,role:"button",ref:E,onClick:function(){return D(x)}}),z=!R&&wp.element.createElement("div",{tabIndex:0,role:"button",ref:P,onClick:function(){return D(j)}}),J=!F&&wp.element.createElement("div",{tabIndex:0,role:"button",ref:S,onClick:function(){return D(C)},className:"apple-pay-button wc-square-wallet-buttons"},wp.element.createElement("span",{className:"text"}),wp.element.createElement("span",{className:"logo"}));return wp.element.createElement(React.Fragment,null,J,Y,z)}),null),edit:wp.element.createElement((function(){return wp.element.createElement(React.Fragment,null,wp.element.createElement(at,null),wp.element.createElement(ct,null))}),null),canMakePayment:function(){var t=!(!r().applicationId||!r().locationId),e=r().isDigitalWalletsEnabled;return t&&e},supports:{features:r().supports}};function lt(t){return lt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},lt(t)}function st(){st=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),c=new P(n||[]);return o(a,"_invoke",{value:S(t,r,c)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var h="suspendedStart",p="suspendedYield",y="executing",d="completed",v={};function m(){}function g(){}function w(){}var b={};l(b,a,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(N([])));E&&E!==r&&n.call(E,a)&&(b=E);var L=w.prototype=m.prototype=Object.create(b);function _(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function C(t,e){function r(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,s=l.value;return s&&"object"==lt(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(s).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function S(e,r,n){var o=h;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===d){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=k(c,n);if(u){if(u===v)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var l=f(e,r,n);if("normal"===l.type){if(o=n.done?d:p,l.arg===v)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=d,n.method="throw",n.arg=l.arg)}}}function k(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,v;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function N(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(lt(e)+" is not iterable")}return g.prototype=w,o(L,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:g,configurable:!0}),g.displayName=l(w,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,l(t,u,"GeneratorFunction")),t.prototype=Object.create(L),t},e.awrap=function(t){return{__await:t}},_(C.prototype),l(C.prototype,c,(function(){return this})),e.AsyncIterator=C,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new C(s(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},_(L),l(L,u,"Generator"),l(L,a,(function(){return this})),l(L,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=N,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(j),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),j(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;j(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:N(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}function ft(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function ht(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){ft(i,n,o,a,c,"next",t)}function c(t){ft(i,n,o,a,c,"throw",t)}a(void 0)}))}}var pt=function(){var t=ht(st().mark((function t(e,r,n){var o;return st().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e.verifyBuyer(r,n);case 3:return o=t.sent,t.abrupt("return",o);case 7:throw t.prev=7,t.t0=t.catch(0),console.error("Error during buyer verification:",t.t0),t.t0;case 11:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(e,r,n){return t.apply(this,arguments)}}(),yt=function(){var t=ht(st().mark((function t(e){var r;return st().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return console.log("[utils.js] tokenize() called with button:",e),t.prev=1,t.next=4,e.tokenize();case 4:if(r=t.sent,console.log("[utils.js] tokenize() => tokenResult:",r),"OK"!==r.status){t.next=9;break}return console.log("[utils.js] tokenize() => status=OK => returning tokenResult"),t.abrupt("return",r);case 9:r.errors&&r.errors.length&&r.errors.forEach((function(t){console.error("Afterpay tokenization error:",t)})),t.next=15;break;case 12:t.prev=12,t.t0=t.catch(1),console.error("[utils.js] Exception during Afterpay tokenization:",t.t0);case 15:return console.error("[utils.js] tokenize() => returning false (tokenization failed)"),t.abrupt("return",!1);case 17:case"end":return t.stop()}}),t,null,[[1,12]])})));return function(e){return t.apply(this,arguments)}}();function dt(t){return dt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dt(t)}function vt(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Et(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var _n=0,n=function(){};return{s:n,n:function(){return _n>=t.length?{done:!0}:{done:!1,value:t[_n++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==r.return||r.return()}finally{if(a)throw o}}}}function mt(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=dt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=dt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==dt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function gt(){gt=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),c=new P(n||[]);return o(a,"_invoke",{value:S(t,r,c)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var h="suspendedStart",p="suspendedYield",y="executing",d="completed",v={};function m(){}function g(){}function w(){}var b={};l(b,a,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(N([])));E&&E!==r&&n.call(E,a)&&(b=E);var L=w.prototype=m.prototype=Object.create(b);function _(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function C(t,e){function r(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,s=l.value;return s&&"object"==dt(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(s).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function S(e,r,n){var o=h;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===d){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=k(c,n);if(u){if(u===v)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var l=f(e,r,n);if("normal"===l.type){if(o=n.done?d:p,l.arg===v)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=d,n.method="throw",n.arg=l.arg)}}}function k(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,v;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function N(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(dt(e)+" is not iterable")}return g.prototype=w,o(L,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:g,configurable:!0}),g.displayName=l(w,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,l(t,u,"GeneratorFunction")),t.prototype=Object.create(L),t},e.awrap=function(t){return{__await:t}},_(C.prototype),l(C.prototype,c,(function(){return this})),e.AsyncIterator=C,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new C(s(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},_(L),l(L,u,"Generator"),l(L,a,(function(){return this})),l(L,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=N,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(j),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),j(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;j(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:N(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}function wt(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function bt(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){wt(i,n,o,a,c,"next",t)}function c(t){wt(i,n,o,a,c,"throw",t)}a(void 0)}))}}function xt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(t){l=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return c}}(t,e)||Et(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Et(t,e){if(t){if("string"==typeof t)return Lt(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Lt(t,e):void 0}}function Lt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function _t(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return((parseInt(t,10)||0)/Math.pow(10,e)).toFixed(e)}function Ct(){return St.apply(this,arguments)}function St(){return(St=bt(gt().mark((function t(){var e,r,n,o,i,a,c,u,l,s,f,h,p,y,d,v,m,g,w;return gt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((n=(0,A.select)("wc/store/cart").getShippingRates()||[]).length){t.next=3;break}return t.abrupt("return",[]);case 3:if(o=n[0],null!==(e=o.shipping_rates)&&void 0!==e&&e.length){t.next=6;break}return t.abrupt("return",[]);case 6:i=(0,A.select)("wc/store/cart").getCartTotals()||{},a=parseInt(i.currency_minor_unit,10)||2,c=null===(r=o.shipping_rates.find((function(t){return t.is_chosen})))||void 0===r?void 0:r.rate_id,u=[],l=vt(o.shipping_rates),t.prev=11,l.s();case 13:if((s=l.n()).done){t.next=25;break}return d=s.value,(0,A.dispatch)("wc/store/cart").selectShippingRate(d.rate_id,0),t.next=18,new Promise((function(t){return setTimeout(t,300)}));case 18:v=(0,A.select)("wc/store/cart").getCartTotals()||{},m=_t(null!==(f=v.total_price)&&void 0!==f?f:"0",a),g=_t(null!==(h=v.total_tax)&&void 0!==h?h:"0",a),w=_t(null!==(p=d.price)&&void 0!==p?p:"0",a),u.push({id:d.rate_id,label:d.name,amount:w,taxLineItems:[{id:"taxItem1",label:"Taxes",amount:g}],total:{label:null!==(y=v.total_label)&&void 0!==y?y:"Total",amount:m}});case 23:t.next=13;break;case 25:t.next=30;break;case 27:t.prev=27,t.t0=t.catch(11),l.e(t.t0);case 30:return t.prev=30,l.f(),t.finish(30);case 33:if(!c){t.next=37;break}return(0,A.dispatch)("wc/store/cart").selectShippingRate(c,0),t.next=37,new Promise((function(t){return setTimeout(t,300)}));case 37:return t.abrupt("return",u);case 38:case"end":return t.stop()}}),t,null,[[11,27,30,33]])})))).apply(this,arguments)}function kt(t){return kt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kt(t)}function Ot(){Ot=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),c=new P(n||[]);return o(a,"_invoke",{value:S(t,r,c)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var h="suspendedStart",p="suspendedYield",y="executing",d="completed",v={};function m(){}function g(){}function w(){}var b={};l(b,a,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(N([])));E&&E!==r&&n.call(E,a)&&(b=E);var L=w.prototype=m.prototype=Object.create(b);function _(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function C(t,e){function r(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,s=l.value;return s&&"object"==kt(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(s).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function S(e,r,n){var o=h;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===d){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=k(c,n);if(u){if(u===v)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var l=f(e,r,n);if("normal"===l.type){if(o=n.done?d:p,l.arg===v)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=d,n.method="throw",n.arg=l.arg)}}}function k(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,v;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function N(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(kt(e)+" is not iterable")}return g.prototype=w,o(L,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:g,configurable:!0}),g.displayName=l(w,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,l(t,u,"GeneratorFunction")),t.prototype=Object.create(L),t},e.awrap=function(t){return{__await:t}},_(C.prototype),l(C.prototype,c,(function(){return this})),e.AsyncIterator=C,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new C(s(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},_(L),l(L,u,"Generator"),l(L,a,(function(){return this})),l(L,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=N,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(j),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),j(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;j(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:N(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}function jt(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function Pt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(t){l=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return c}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Nt(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Nt(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Nt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}wp.element.createElement((function(e){var n,o=e.billing,i=e.shippingData,a=e.onClick,c=e.onClose,u=(e.onSubmit,e.setExpressPaymentError),l=e.emitResponse,s=e.eventRegistration,f=s.onPaymentSetup,h=s.onCheckoutFail,p=Pt((0,t.useState)(!1),2),y=p[0],d=p[1],v=i.needsShipping;(0,t.useEffect)((function(){var t=(0,A.subscribe)((function(){wp.data.select("wc/store/cart").isApplyingCoupon()||d((function(t){return!t}))}));return function(){t()}}),[]);var m,g=function(){var e=xt((0,t.useState)(null),2),n=e[0],o=e[1];return(0,t.useEffect)((function(){var t=r(),e=t.applicationId,n=t.locationId;if(window.Square)try{var i=Square.payments(e,n);o(i)}catch(t){console.error("[useSquare] Error creating payments:",t)}else console.error("[useSquare] window.Square is not available!")}),[]),n}(),w=function(e,n,o){var i=(0,t.useRef)(null),a=xt((0,t.useState)(null),2),c=a[0],u=a[1];return(0,t.useEffect)((function(){function t(){return(t=bt(gt().mark((function t(){var o,a,c,l,s;return gt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,new Promise((function(t,e){var n,o={context:r().context,security:r().paymentRequestNonce,is_pay_for_order_page:!1};jQuery.post((n="get_payment_request",r().ajaxUrl.replace("%%endpoint%%","square_digital_wallet_".concat(n))),o,(function(r){r.success?t(r.data):e(r.data)}))}));case 3:o=t.sent,a=JSON.parse(o),Array.isArray(a.lineItems)&&(-1!==(c=a.lineItems.findIndex((function(t){var e;return null===(e=t.label)||void 0===e?void 0:e.toLowerCase().includes("shipping")})))&&a.lineItems.splice(c,1),-1!==(l=a.lineItems.findIndex((function(t){var e;return null===(e=t.label)||void 0===e?void 0:e.toLowerCase().includes("discount")})))&&a.lineItems.splice(l,1)),n&&(a.requestShippingAddress=!0),i.current?i.current.update(a):(s=e.paymentRequest(a),i.current=s,u(s)),t.next=13;break;case 10:t.prev=10,t.t0=t.catch(0),console.error("Failed to create/update PaymentRequest:",t.t0);case 13:case"end":return t.stop()}}),t,null,[[0,10]])})))).apply(this,arguments)}e&&function(){t.apply(this,arguments)}()}),[e,n,o]),[c]}(g,v,y),b=Pt(w,1)[0],x=function(e,r){var n=xt((0,t.useState)(null),2),o=n[0],i=n[1],a=(0,t.useRef)(null);return(0,t.useEffect)((function(){e&&r?bt(gt().mark((function t(){var n;return gt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return console.log(r),t.prev=1,t.next=4,e.afterpayClearpay(r);case 4:return n=t.sent,console.log(n),t.next=8,n.attach(a.current,{buttonColor:"black",buttonSizeMode:"fill"});case 8:i(n),t.next=13;break;case 11:t.prev=11,t.t0=t.catch(1);case 13:case"end":return t.stop()}}),t,null,[[1,11]])})))():console.log("no payment")}),[e,r]),[o,a]}(g,b),E=Pt(x,2),L=E[0],_=E[1],C=Pt((0,t.useState)(!1),2),S=C[0],k=C[1];return m=b,(0,t.useRef)(!1),(0,t.useEffect)((function(){if(m&&"function"==typeof m.addEventListener){var t=function(){var t=bt(gt().mark((function t(e){var r,n,o;return gt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,e.givenName,e.familyName,null===(r=e.addressLines)||void 0===r||r[0],null===(n=e.addressLines)||void 0===n||n[1],e.city,e.state,e.postalCode,e.countryCode,e.phone,t.next=4,new Promise((function(t){return setTimeout(t,300)}));case 4:return t.next=6,Ct();case 6:if((o=t.sent).length){t.next=9;break}return t.abrupt("return");case 9:return t.abrupt("return",{shippingOptions:o});case 12:t.prev=12,t.t0=t.catch(0),console.error("Error in onAfterpayShippingAddressChanged:",t.t0);case 15:case"end":return t.stop()}}),t,null,[[0,12]])})));return function(_x){return t.apply(this,arguments)}}();return m.addEventListener("afterpay_shippingaddresschanged",t),function(){"function"==typeof m.removeEventListener&&m.removeEventListener("afterpay_shippingaddresschanged",t)}}}),[m]),function(e,r,n,o,i){console.log(n);var a=function(t){var e={familyName:t.billingData.last_name||"",givenName:t.billingData.first_name||"",email:t.billingData.email||"",country:t.billingData.country||"",region:t.billingData.state||"",city:t.billingData.city||"",postalCode:t.billingData.postcode||""};t.billingData.phone&&(e.phone=t.billingData.phone);var r=[t.billingData.address_1,t.billingData.address_2].filter(Boolean);return r.length&&(e.addressLines=r),{intent:"CHARGE",amount:(t.cartTotal.value/100).toString(),currencyCode:t.currency.code,billingContact:e}}(r);(0,t.useEffect)((function(){if(n)return i((function(){function t(){return(t=bt(gt().mark((function t(){var r,i,c,u,l,s,f,h,p,y,d,v,m,g,w,b,x,E,L,_,C,S,k,O,j,P,N,T,A,I,G,F,R,H,D,M,q,V,Z,Y;return gt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(console.log(n.token),O={type:o.responseTypes.SUCCESS},n){t.next=6;break}return console.error("[usePaymentProcessing] tokenResult is null/undefined!"),O={type:o.responseTypes.FAILURE},t.abrupt("return",O);case 6:return j=n.details,P=j.card,N=j.method,T=n.token,t.next=9,pt(e,T,a);case 9:if(A=t.sent,console.log(A),I=A.token,G="wc-squaresync_credit",F=(null==n||null===(r=n.details)||void 0===r?void 0:r.billing)||{},R=(null==n||null===(i=n.details)||void 0===i?void 0:i.shipping)||{},H=R.contact,D=void 0===H?{}:H,M=R.option,q=void 0===M?{}:M,V=null!==(c=null!==(u=null==F?void 0:F.email)&&void 0!==u?u:null==D?void 0:D.email)&&void 0!==c?c:"",Z=null!==(l=null!==(s=null==F?void 0:F.phone)&&void 0!==s?s:null==D?void 0:D.phone)&&void 0!==l?l:"",Y=null!==(f=null!==(h=null==D?void 0:D.phone)&&void 0!==h?h:null==F?void 0:F.phone)&&void 0!==f?f:"",O.meta={paymentMethodData:mt(mt(mt(mt(mt(mt(mt(mt({},"".concat(G,"-card-type"),N||""),"".concat(G,"-last-four"),(null==P?void 0:P.last4)||""),"".concat(G,"-exp-month"),(null==P||null===(p=P.expMonth)||void 0===p?void 0:p.toString())||""),"".concat(G,"-exp-year"),(null==P||null===(y=P.expYear)||void 0===y?void 0:y.toString())||""),"".concat(G,"-payment-postcode"),(null==P?void 0:P.postalCode)||""),"".concat(G,"-payment-nonce"),T||""),"".concat(G,"-buyer-verification-token"),I||""),"shipping_method",null!==(d=q.id)&&void 0!==d&&d),billingAddress:{email:V,first_name:null!==(v=F.givenName)&&void 0!==v?v:"",last_name:null!==(m=F.familyName)&&void 0!==m?m:"",company:"",address_1:F.addressLines?F.addressLines[0]:"",address_2:F.addressLines?F.addressLines[1]:"",city:null!==(g=F.city)&&void 0!==g?g:"",state:null!==(w=F.state)&&void 0!==w?w:"",postcode:null!==(b=F.postalCode)&&void 0!==b?b:"",country:null!==(x=F.countryCode)&&void 0!==x?x:"",phone:Z},shippingAddress:{first_name:null!==(E=D.givenName)&&void 0!==E?E:"",last_name:null!==(L=D.familyName)&&void 0!==L?L:"",company:"",address_1:D.addressLines?D.addressLines[0]:"",address_2:D.addressLines?D.addressLines[1]:"",city:null!==(_=D.city)&&void 0!==_?_:"",state:null!==(C=D.state)&&void 0!==C?C:"",postcode:null!==(S=D.postalCode)&&void 0!==S?S:"",country:null!==(k=D.countryCode)&&void 0!==k?k:"",phone:Y}},!wp.data.select("wc/store/cart").getNeedsShipping()){t.next=27;break}if(wp.data.select("wc/store/cart").getShippingRates().some((function(t){return t.shipping_rates.length}))){t.next=27;break}return console.error("[usePaymentProcessing] No shipping rates available => FAILURE"),O.type=o.responseTypes.FAILURE,console.log(O),t.abrupt("return",O);case 27:return console.log(O),t.abrupt("return",O);case 29:case"end":return t.stop()}}),t)})))).apply(this,arguments)}return function(){return t.apply(this,arguments)}()}));console.log("[usePaymentProcessing] no tokenResult yet, doing nothing.")}),[n])}(g,o,S,l,f),(0,t.useEffect)((function(){return h((function(){return c(),!0}))}),[h]),null===(n=r())||void 0===n||null===(n=n.afterpay)||void 0===n||n.includes("no"),wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{ref:_,role:"button",tabIndex:0,className:"afterpay-button wc-square-wallet-buttons",onClick:function(){var t,e;(t=L)?(u(""),a(),(e=Ot().mark((function e(){var r;return Ot().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,yt(t);case 2:(r=e.sent)?k(r):(console.error("Tokenization failed in onClickHandler"),c());case 4:case"end":return e.stop()}}),e)})),function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(t){jt(i,n,o,a,c,"next",t)}function c(t){jt(i,n,o,a,c,"throw",t)}a(void 0)}))})()):console.error("Button instance is null or undefined")}}))}),null),wp.element.createElement((function(){return wp.element.createElement(React.Fragment,null,wp.element.createElement("div",null,"afterpay"))}),null),r().supports;var Tt=window.wc.wcBlocksRegistry,At=Tt.registerPaymentMethod;(0,Tt.registerExpressPaymentMethod)(ut),At(T)})();
  • squarewoosync/trunk/build/blocks/loyalty.asset.php

    r3315018 r3360322  
    1 <?php return array('dependencies' => array(), 'version' => '5ca364dc47bb1c621597');
     1<?php return array('dependencies' => array(), 'version' => '3054579541174d456354');
  • squarewoosync/trunk/build/blocks/loyalty.js

    r3315018 r3360322  
    1 (()=>{function e(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,l,r,o,c=[],i=!0,s=!1;try{if(r=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;i=!1}else for(;!(i=(a=r.call(n)).done)&&(c.push(a.value),c.length!==t);i=!0);}catch(e){s=!0,l=e}finally{try{if(!i&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(s)throw l}}return c}}(e,n)||function(e,n){if(e){if("string"==typeof e)return t(e,n);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?t(e,n):void 0}}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}!function(t,n){if(t&&t.plugins&&t.element&&t.data&&n&&n.blocksCheckout){var a=t.plugins.registerPlugin,l=n.blocksCheckout,r=l.ExperimentalDiscountsMeta,o=l.extensionCartUpdate,c=t.element,i=c.useState,s=c.useEffect,u=(t.data.dispatch,t.data.useSelect),m=function(){var n,a,l=e(i(!1),2),r=l[0],c=l[1],m=e(i(null),2),d=m[0],y=m[1],p=e(i(0),2),f=p[0],v=p[1],h=e(i([]),2),g=h[0],w=h[1],E=e(i(null),2),b=E[0],k=E[1],C=e(i(null),2),_=C[0],A=C[1],N=e(i(0),2),S=N[0],R=N[1],j=e(i(0),2),L=j[0],x=j[1],q=e(i({other:"points"}),2),D=q[0],I=q[1],P=e(i(loyalty_data.isLoggedIn),2),O=P[0],U=(P[1],u(function(e){var t;return null===(t=e("wc/store/cart").getCartData())||void 0===t||null===(t=t.billingAddress)||void 0===t?void 0:t.phone},[])),Y=u(function(e){var t;return null===(t=e("wc/store/cart").getCartData())||void 0===t||null===(t=t.shippingAddress)||void 0===t?void 0:t.phone},[]),M=function(){if(O){c(!0);var e=U||Y||"";console.log(e),t.ajax.post("fetch_loyalty_data",{nonce:loyalty_data.nonce,data:{phone:e}}).done(function(e){e.points?(v(e.points),I(e.terminology),w(e.rewards),x(e.pointsEarned),e.activeReward&&(A(e.activeReward.name),R(e.activeReward.points))):k("Failed to fetch loyalty data"),c(!1)}).fail(function(e){console.error("Error fetching loyalty data:",e),k("Loyalty program user not found"),c(!1)})}};return s(function(){var e=null;if(O){M();var n=t.data.subscribe(function(){var n=t.data.select("wc/store/cart").getCartTotals();n&&n!==e&&(e=n,M())});return function(){n()}}},[O]),t.element.createElement("div",{className:"loyalty-blocks--block-container"},r&&t.element.createElement("div",{id:"loyalty-loader"},"Loading..."),b&&t.element.createElement("div",{className:"error"},b),!b&&!r&&t.element.createElement("div",null,O?t.element.createElement("div",null,t.element.createElement("h4",null,"Loyalty Program"),t.element.createElement("p",null,"You currently have ",f," ",D.other,"!"),_?t.element.createElement("div",null,t.element.createElement("p",null,"Active reward: ",_),t.element.createElement("p",null,"You will redeem ",t.element.createElement("span",{className:"points-redeemed"},S)," ",t.element.createElement("span",{className:"terminology"},D.other),"."),t.element.createElement("button",{id:"blocks-remove-loyalty-reward",disabled:r,onClick:function(){c(!0),t.ajax.post("remove_loyalty_discount",{nonce:loyalty_data.nonce}).done(function(e){o({namespace:"squarewoosync"}),A(null),R(0),y(null),c(!1)}).fail(function(){alert("Error removing the reward."),c(!1)})}},"Remove Reward")):t.element.createElement("div",null,g.length>0?(null==(a=t.data.select("wc/store/cart").getCartData())||null===(n=a.fees)||void 0===n||n.some(function(e){return"gift-card"===e.key}),t.element.createElement("div",{className:"available-rewards"},t.element.createElement("p",null,"Select a reward:"),t.element.createElement("div",{className:"loyalty-blocks-rewards-container"},g.map(function(e){return t.element.createElement("label",{key:e.id},t.element.createElement("input",{type:"radio",name:"loyalty_reward",value:e.id,onChange:function(e){return y(e.target.value)}}),e.name," (",e.points," ",D.other,")")})),t.element.createElement("button",{id:"blocks-apply-loyalty-reward",disabled:r,onClick:function(){var e;(e=d)?(c(!0),o({namespace:"squarewoosync",data:{nonce:loyalty_data.nonce,selected_tier:e}}).then(function(){var t=g.find(function(t){return t.id===e});t&&(A(t.name),R(t.points)),c(!1)}).catch(function(e){console.error("Error updating the cart:",e),alert("Unable to apply loyalty reward, please contact support"),c(!1)})):alert("Please select a reward")}},"Apply Rewards"))):t.element.createElement("p",null,"No rewards available at this time."),L>0&&!_&&t.element.createElement("p",{className:"loyalty-blocks-points-earn"},"You will earn ",t.element.createElement("span",{className:"points-earned"},L)," ",t.element.createElement("span",{className:"terminology"},D.other)," from this purchase."))):t.element.createElement("div",null,t.element.createElement("p",null,"Login to take advantage of our loyalty program and earn points on this purchase and claim rewards!"),t.element.createElement("a",{href:"/my-account"},"Login here"))))};loyalty_data.loyalty_enabled&&a("squaresync-loyalty-plugin",{render:function(){return t.element.createElement(r,null,t.element.createElement(m,null))},scope:"woocommerce-checkout"})}else console.error("Required WordPress or WooCommerce scripts are not loaded.")}(window.wp,window.wc)})();
     1(()=>{function e(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,l,r,o,c=[],i=!0,s=!1;try{if(r=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;i=!1}else for(;!(i=(a=r.call(n)).done)&&(c.push(a.value),c.length!==t);i=!0);}catch(e){s=!0,l=e}finally{try{if(!i&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(s)throw l}}return c}}(e,n)||function(e,n){if(e){if("string"==typeof e)return t(e,n);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?t(e,n):void 0}}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}!function(t,n){if(t&&t.plugins&&t.element&&t.data&&n&&n.blocksCheckout){var a=t.plugins.registerPlugin,l=n.blocksCheckout,r=l.ExperimentalDiscountsMeta,o=l.extensionCartUpdate,c=t.element,i=c.useState,s=c.useEffect,u=(t.data.dispatch,t.data.useSelect),m=function(){var n,a,l=e(i(!1),2),r=l[0],c=l[1],m=e(i(null),2),d=m[0],y=m[1],p=e(i(0),2),f=p[0],v=p[1],h=e(i([]),2),g=h[0],w=h[1],E=e(i(null),2),b=E[0],k=E[1],C=e(i(null),2),_=C[0],A=C[1],N=e(i(0),2),S=N[0],R=N[1],j=e(i(0),2),L=j[0],x=j[1],q=e(i({other:"points"}),2),D=q[0],I=q[1],P=e(i(loyalty_data.isLoggedIn),2),O=P[0],U=(P[1],u((function(e){var t;return null===(t=e("wc/store/cart").getCartData())||void 0===t||null===(t=t.billingAddress)||void 0===t?void 0:t.phone}),[])),Y=u((function(e){var t;return null===(t=e("wc/store/cart").getCartData())||void 0===t||null===(t=t.shippingAddress)||void 0===t?void 0:t.phone}),[]),M=function(){if(O){c(!0);var e=U||Y||"";console.log(e),t.ajax.post("fetch_loyalty_data",{nonce:loyalty_data.nonce,data:{phone:e}}).done((function(e){e.points?(v(e.points),I(e.terminology),w(e.rewards),x(e.pointsEarned),e.activeReward&&(A(e.activeReward.name),R(e.activeReward.points))):k("Failed to fetch loyalty data"),c(!1)})).fail((function(e){console.error("Error fetching loyalty data:",e),k("Loyalty program user not found"),c(!1)}))}};return s((function(){var e=null;if(O){M();var n=t.data.subscribe((function(){var n=t.data.select("wc/store/cart").getCartTotals();n&&n!==e&&(e=n,M())}));return function(){n()}}}),[O]),t.element.createElement("div",{className:"loyalty-blocks--block-container"},r&&t.element.createElement("div",{id:"loyalty-loader"},"Loading..."),b&&t.element.createElement("div",{className:"error"},b),!b&&!r&&t.element.createElement("div",null,O?t.element.createElement("div",null,t.element.createElement("h4",null,"Loyalty Program"),t.element.createElement("p",null,"You currently have ",f," ",D.other,"!"),_?t.element.createElement("div",null,t.element.createElement("p",null,"Active reward: ",_),t.element.createElement("p",null,"You will redeem ",t.element.createElement("span",{className:"points-redeemed"},S)," ",t.element.createElement("span",{className:"terminology"},D.other),"."),t.element.createElement("button",{id:"blocks-remove-loyalty-reward",disabled:r,onClick:function(){c(!0),t.ajax.post("remove_loyalty_discount",{nonce:loyalty_data.nonce}).done((function(e){o({namespace:"squarewoosync"}),A(null),R(0),y(null),c(!1)})).fail((function(){alert("Error removing the reward."),c(!1)}))}},"Remove Reward")):t.element.createElement("div",null,g.length>0?(null==(a=t.data.select("wc/store/cart").getCartData())||null===(n=a.fees)||void 0===n||n.some((function(e){return"gift-card"===e.key})),t.element.createElement("div",{className:"available-rewards"},t.element.createElement("p",null,"Select a reward:"),t.element.createElement("div",{className:"loyalty-blocks-rewards-container"},g.map((function(e){return t.element.createElement("label",{key:e.id},t.element.createElement("input",{type:"radio",name:"loyalty_reward",value:e.id,onChange:function(e){return y(e.target.value)}}),e.name," (",e.points," ",D.other,")")}))),t.element.createElement("button",{id:"blocks-apply-loyalty-reward",disabled:r,onClick:function(){var e;(e=d)?(c(!0),o({namespace:"squarewoosync",data:{nonce:loyalty_data.nonce,selected_tier:e}}).then((function(){var t=g.find((function(t){return t.id===e}));t&&(A(t.name),R(t.points)),c(!1)})).catch((function(e){console.error("Error updating the cart:",e),alert("Unable to apply loyalty reward, please contact support"),c(!1)}))):alert("Please select a reward")}},"Apply Rewards"))):t.element.createElement("p",null,"No rewards available at this time."),L>0&&!_&&t.element.createElement("p",{className:"loyalty-blocks-points-earn"},"You will earn ",t.element.createElement("span",{className:"points-earned"},L)," ",t.element.createElement("span",{className:"terminology"},D.other)," from this purchase."))):t.element.createElement("div",null,t.element.createElement("p",null,"Login to take advantage of our loyalty program and earn points on this purchase and claim rewards!"),t.element.createElement("a",{href:"/my-account"},"Login here"))))};loyalty_data.loyalty_enabled&&a("squaresync-loyalty-plugin",{render:function(){return t.element.createElement(r,null,t.element.createElement(m,null))},scope:"woocommerce-checkout"})}else console.error("Required WordPress or WooCommerce scripts are not loaded.")}(window.wp,window.wc)})();
  • squarewoosync/trunk/build/index.asset.php

    r3319082 r3360322  
    1 <?php return array('dependencies' => array('lodash', 'moment', 'react', 'react-dom', 'wp-api-fetch', 'wp-element'), 'version' => '5f9addc66d836626c11a');
     1<?php return array('dependencies' => array('lodash', 'moment', 'react', 'react-dom', 'wp-api-fetch', 'wp-element'), 'version' => 'f2226b1c74a3c0dda3a6');
  • squarewoosync/trunk/build/index.css

    r3315018 r3360322  
    608608  }
    609609}
     610/*
     611! tailwindcss v3.4.1 | MIT License | https://tailwindcss.com
     612*//*
     6131. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
     6142. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
     615*/
     616
     617*,
     618::before,
     619::after {
     620  box-sizing: border-box; /* 1 */
     621  border-width: 0; /* 2 */
     622  border-style: solid; /* 2 */
     623  border-color: #e5e7eb; /* 2 */
     624}
     625
     626::before,
     627::after {
     628  --tw-content: '';
     629}
     630
     631/*
     6321. Use a consistent sensible line-height in all browsers.
     6332. Prevent adjustments of font size after orientation changes in iOS.
     6343. Use a more readable tab size.
     6354. Use the user's configured `sans` font-family by default.
     6365. Use the user's configured `sans` font-feature-settings by default.
     6376. Use the user's configured `sans` font-variation-settings by default.
     6387. Disable tap highlights on iOS
     639*/
     640
     641html,
     642:host {
     643  line-height: 1.5; /* 1 */
     644  -webkit-text-size-adjust: 100%; /* 2 */
     645  -moz-tab-size: 4; /* 3 */
     646  -o-tab-size: 4;
     647     tab-size: 4; /* 3 */
     648  font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; /* 4 */
     649  font-feature-settings: normal; /* 5 */
     650  font-variation-settings: normal; /* 6 */
     651  -webkit-tap-highlight-color: transparent; /* 7 */
     652}
     653
     654/*
     6551. Remove the margin in all browsers.
     6562. Inherit line-height from `html` so users can set them as a class directly on the `html` element.
     657*/
     658
     659body {
     660  margin: 0; /* 1 */
     661  line-height: inherit; /* 2 */
     662}
     663
     664/*
     6651. Add the correct height in Firefox.
     6662. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)
     6673. Ensure horizontal rules are visible by default.
     668*/
     669
     670hr {
     671  height: 0; /* 1 */
     672  color: inherit; /* 2 */
     673  border-top-width: 1px; /* 3 */
     674}
     675
     676/*
     677Add the correct text decoration in Chrome, Edge, and Safari.
     678*/
     679
     680abbr:where([title]) {
     681  -webkit-text-decoration: underline dotted;
     682          text-decoration: underline dotted;
     683}
     684
     685/*
     686Remove the default font size and weight for headings.
     687*/
     688
     689h1,
     690h2,
     691h3,
     692h4,
     693h5,
     694h6 {
     695  font-size: inherit;
     696  font-weight: inherit;
     697}
     698
     699/*
     700Reset links to optimize for opt-in styling instead of opt-out.
     701*/
     702
     703a {
     704  color: inherit;
     705  text-decoration: inherit;
     706}
     707
     708/*
     709Add the correct font weight in Edge and Safari.
     710*/
     711
     712b,
     713strong {
     714  font-weight: bolder;
     715}
     716
     717/*
     7181. Use the user's configured `mono` font-family by default.
     7192. Use the user's configured `mono` font-feature-settings by default.
     7203. Use the user's configured `mono` font-variation-settings by default.
     7214. Correct the odd `em` font sizing in all browsers.
     722*/
     723
     724code,
     725kbd,
     726samp,
     727pre {
     728  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; /* 1 */
     729  font-feature-settings: normal; /* 2 */
     730  font-variation-settings: normal; /* 3 */
     731  font-size: 1em; /* 4 */
     732}
     733
     734/*
     735Add the correct font size in all browsers.
     736*/
     737
     738small {
     739  font-size: 80%;
     740}
     741
     742/*
     743Prevent `sub` and `sup` elements from affecting the line height in all browsers.
     744*/
     745
     746sub,
     747sup {
     748  font-size: 75%;
     749  line-height: 0;
     750  position: relative;
     751  vertical-align: baseline;
     752}
     753
     754sub {
     755  bottom: -0.25em;
     756}
     757
     758sup {
     759  top: -0.5em;
     760}
     761
     762/*
     7631. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)
     7642. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)
     7653. Remove gaps between table borders by default.
     766*/
     767
     768table {
     769  text-indent: 0; /* 1 */
     770  border-color: inherit; /* 2 */
     771  border-collapse: collapse; /* 3 */
     772}
     773
     774/*
     7751. Change the font styles in all browsers.
     7762. Remove the margin in Firefox and Safari.
     7773. Remove default padding in all browsers.
     778*/
     779
     780button,
     781input,
     782optgroup,
     783select,
     784textarea {
     785  font-family: inherit; /* 1 */
     786  font-feature-settings: inherit; /* 1 */
     787  font-variation-settings: inherit; /* 1 */
     788  font-size: 100%; /* 1 */
     789  font-weight: inherit; /* 1 */
     790  line-height: inherit; /* 1 */
     791  color: inherit; /* 1 */
     792  margin: 0; /* 2 */
     793  padding: 0; /* 3 */
     794}
     795
     796/*
     797Remove the inheritance of text transform in Edge and Firefox.
     798*/
     799
     800button,
     801select {
     802  text-transform: none;
     803}
     804
     805/*
     8061. Correct the inability to style clickable types in iOS and Safari.
     8072. Remove default button styles.
     808*/
     809
     810button,
     811[type='button'],
     812[type='reset'],
     813[type='submit'] {
     814  -webkit-appearance: button; /* 1 */
     815  background-color: transparent; /* 2 */
     816  background-image: none; /* 2 */
     817}
     818
     819/*
     820Use the modern Firefox focus style for all focusable elements.
     821*/
     822
     823:-moz-focusring {
     824  outline: auto;
     825}
     826
     827/*
     828Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)
     829*/
     830
     831:-moz-ui-invalid {
     832  box-shadow: none;
     833}
     834
     835/*
     836Add the correct vertical alignment in Chrome and Firefox.
     837*/
     838
     839progress {
     840  vertical-align: baseline;
     841}
     842
     843/*
     844Correct the cursor style of increment and decrement buttons in Safari.
     845*/
     846
     847::-webkit-inner-spin-button,
     848::-webkit-outer-spin-button {
     849  height: auto;
     850}
     851
     852/*
     8531. Correct the odd appearance in Chrome and Safari.
     8542. Correct the outline style in Safari.
     855*/
     856
     857[type='search'] {
     858  -webkit-appearance: textfield; /* 1 */
     859  outline-offset: -2px; /* 2 */
     860}
     861
     862/*
     863Remove the inner padding in Chrome and Safari on macOS.
     864*/
     865
     866::-webkit-search-decoration {
     867  -webkit-appearance: none;
     868}
     869
     870/*
     8711. Correct the inability to style clickable types in iOS and Safari.
     8722. Change font properties to `inherit` in Safari.
     873*/
     874
     875::-webkit-file-upload-button {
     876  -webkit-appearance: button; /* 1 */
     877  font: inherit; /* 2 */
     878}
     879
     880/*
     881Add the correct display in Chrome and Safari.
     882*/
     883
     884summary {
     885  display: list-item;
     886}
     887
     888/*
     889Removes the default spacing and border for appropriate elements.
     890*/
     891
     892blockquote,
     893dl,
     894dd,
     895h1,
     896h2,
     897h3,
     898h4,
     899h5,
     900h6,
     901hr,
     902figure,
     903p,
     904pre {
     905  margin: 0;
     906}
     907
     908fieldset {
     909  margin: 0;
     910  padding: 0;
     911}
     912
     913legend {
     914  padding: 0;
     915}
     916
     917ol,
     918ul,
     919menu {
     920  list-style: none;
     921  margin: 0;
     922  padding: 0;
     923}
     924
     925/*
     926Reset default styling for dialogs.
     927*/
     928dialog {
     929  padding: 0;
     930}
     931
     932/*
     933Prevent resizing textareas horizontally by default.
     934*/
     935
     936textarea {
     937  resize: vertical;
     938}
     939
     940/*
     9411. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)
     9422. Set the default placeholder color to the user's configured gray 400 color.
     943*/
     944
     945input::-moz-placeholder, textarea::-moz-placeholder {
     946  opacity: 1; /* 1 */
     947  color: #9ca3af; /* 2 */
     948}
     949
     950input::placeholder,
     951textarea::placeholder {
     952  opacity: 1; /* 1 */
     953  color: #9ca3af; /* 2 */
     954}
     955
     956/*
     957Set the default cursor for buttons.
     958*/
     959
     960button,
     961[role="button"] {
     962  cursor: pointer;
     963}
     964
     965/*
     966Make sure disabled buttons don't get the pointer cursor.
     967*/
     968:disabled {
     969  cursor: default;
     970}
     971
     972/*
     9731. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)
     9742. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)
     975   This can trigger a poorly considered lint error in some tools but is included by design.
     976*/
     977
     978img,
     979svg,
     980video,
     981canvas,
     982audio,
     983iframe,
     984embed,
     985object {
     986  display: block; /* 1 */
     987  vertical-align: middle; /* 2 */
     988}
     989
     990/*
     991Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)
     992*/
     993
     994img,
     995video {
     996  max-width: 100%;
     997  height: auto;
     998}
     999
     1000/* Make elements with the HTML hidden attribute stay hidden by default */
     1001[hidden] {
     1002  display: none;
     1003}
     1004
    6101005*, ::before, ::after {
    6111006  --tw-border-spacing-x: 0;
     
    6561051  --tw-backdrop-saturate:  ;
    6571052  --tw-backdrop-sepia:  ;
    658   --tw-contain-size:  ;
    659   --tw-contain-layout:  ;
    660   --tw-contain-paint:  ;
    661   --tw-contain-style:  ;
    6621053}
    6631054
     
    7101101  --tw-backdrop-saturate:  ;
    7111102  --tw-backdrop-sepia:  ;
    712   --tw-contain-size:  ;
    713   --tw-contain-layout:  ;
    714   --tw-contain-paint:  ;
    715   --tw-contain-style:  ;
    716 }/*
    717 ! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com
    718 *//*
    719 1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
    720 2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
    721 */
    722 
    723 *,
    724 ::before,
    725 ::after {
    726   box-sizing: border-box; /* 1 */
    727   border-width: 0; /* 2 */
    728   border-style: solid; /* 2 */
    729   border-color: #e5e7eb; /* 2 */
    730 }
    731 
    732 ::before,
    733 ::after {
    734   --tw-content: '';
    735 }
    736 
    737 /*
    738 1. Use a consistent sensible line-height in all browsers.
    739 2. Prevent adjustments of font size after orientation changes in iOS.
    740 3. Use a more readable tab size.
    741 4. Use the user's configured `sans` font-family by default.
    742 5. Use the user's configured `sans` font-feature-settings by default.
    743 6. Use the user's configured `sans` font-variation-settings by default.
    744 7. Disable tap highlights on iOS
    745 */
    746 
    747 html,
    748 :host {
    749   line-height: 1.5; /* 1 */
    750   -webkit-text-size-adjust: 100%; /* 2 */
    751   -moz-tab-size: 4; /* 3 */
    752   -o-tab-size: 4;
    753      tab-size: 4; /* 3 */
    754   font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; /* 4 */
    755   font-feature-settings: normal; /* 5 */
    756   font-variation-settings: normal; /* 6 */
    757   -webkit-tap-highlight-color: transparent; /* 7 */
    758 }
    759 
    760 /*
    761 1. Remove the margin in all browsers.
    762 2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.
    763 */
    764 
    765 body {
    766   margin: 0; /* 1 */
    767   line-height: inherit; /* 2 */
    768 }
    769 
    770 /*
    771 1. Add the correct height in Firefox.
    772 2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)
    773 3. Ensure horizontal rules are visible by default.
    774 */
    775 
    776 hr {
    777   height: 0; /* 1 */
    778   color: inherit; /* 2 */
    779   border-top-width: 1px; /* 3 */
    780 }
    781 
    782 /*
    783 Add the correct text decoration in Chrome, Edge, and Safari.
    784 */
    785 
    786 abbr:where([title]) {
    787   -webkit-text-decoration: underline dotted;
    788           text-decoration: underline dotted;
    789 }
    790 
    791 /*
    792 Remove the default font size and weight for headings.
    793 */
    794 
    795 h1,
    796 h2,
    797 h3,
    798 h4,
    799 h5,
    800 h6 {
    801   font-size: inherit;
    802   font-weight: inherit;
    803 }
    804 
    805 /*
    806 Reset links to optimize for opt-in styling instead of opt-out.
    807 */
    808 
    809 a {
    810   color: inherit;
    811   text-decoration: inherit;
    812 }
    813 
    814 /*
    815 Add the correct font weight in Edge and Safari.
    816 */
    817 
    818 b,
    819 strong {
    820   font-weight: bolder;
    821 }
    822 
    823 /*
    824 1. Use the user's configured `mono` font-family by default.
    825 2. Use the user's configured `mono` font-feature-settings by default.
    826 3. Use the user's configured `mono` font-variation-settings by default.
    827 4. Correct the odd `em` font sizing in all browsers.
    828 */
    829 
    830 code,
    831 kbd,
    832 samp,
    833 pre {
    834   font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; /* 1 */
    835   font-feature-settings: normal; /* 2 */
    836   font-variation-settings: normal; /* 3 */
    837   font-size: 1em; /* 4 */
    838 }
    839 
    840 /*
    841 Add the correct font size in all browsers.
    842 */
    843 
    844 small {
    845   font-size: 80%;
    846 }
    847 
    848 /*
    849 Prevent `sub` and `sup` elements from affecting the line height in all browsers.
    850 */
    851 
    852 sub,
    853 sup {
    854   font-size: 75%;
    855   line-height: 0;
    856   position: relative;
    857   vertical-align: baseline;
    858 }
    859 
    860 sub {
    861   bottom: -0.25em;
    862 }
    863 
    864 sup {
    865   top: -0.5em;
    866 }
    867 
    868 /*
    869 1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)
    870 2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)
    871 3. Remove gaps between table borders by default.
    872 */
    873 
    874 table {
    875   text-indent: 0; /* 1 */
    876   border-color: inherit; /* 2 */
    877   border-collapse: collapse; /* 3 */
    878 }
    879 
    880 /*
    881 1. Change the font styles in all browsers.
    882 2. Remove the margin in Firefox and Safari.
    883 3. Remove default padding in all browsers.
    884 */
    885 
    886 button,
    887 input,
    888 optgroup,
    889 select,
    890 textarea {
    891   font-family: inherit; /* 1 */
    892   font-feature-settings: inherit; /* 1 */
    893   font-variation-settings: inherit; /* 1 */
    894   font-size: 100%; /* 1 */
    895   font-weight: inherit; /* 1 */
    896   line-height: inherit; /* 1 */
    897   letter-spacing: inherit; /* 1 */
    898   color: inherit; /* 1 */
    899   margin: 0; /* 2 */
    900   padding: 0; /* 3 */
    901 }
    902 
    903 /*
    904 Remove the inheritance of text transform in Edge and Firefox.
    905 */
    906 
    907 button,
    908 select {
    909   text-transform: none;
    910 }
    911 
    912 /*
    913 1. Correct the inability to style clickable types in iOS and Safari.
    914 2. Remove default button styles.
    915 */
    916 
    917 button,
    918 input:where([type='button']),
    919 input:where([type='reset']),
    920 input:where([type='submit']) {
    921   -webkit-appearance: button; /* 1 */
    922   background-color: transparent; /* 2 */
    923   background-image: none; /* 2 */
    924 }
    925 
    926 /*
    927 Use the modern Firefox focus style for all focusable elements.
    928 */
    929 
    930 :-moz-focusring {
    931   outline: auto;
    932 }
    933 
    934 /*
    935 Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)
    936 */
    937 
    938 :-moz-ui-invalid {
    939   box-shadow: none;
    940 }
    941 
    942 /*
    943 Add the correct vertical alignment in Chrome and Firefox.
    944 */
    945 
    946 progress {
    947   vertical-align: baseline;
    948 }
    949 
    950 /*
    951 Correct the cursor style of increment and decrement buttons in Safari.
    952 */
    953 
    954 ::-webkit-inner-spin-button,
    955 ::-webkit-outer-spin-button {
    956   height: auto;
    957 }
    958 
    959 /*
    960 1. Correct the odd appearance in Chrome and Safari.
    961 2. Correct the outline style in Safari.
    962 */
    963 
    964 [type='search'] {
    965   -webkit-appearance: textfield; /* 1 */
    966   outline-offset: -2px; /* 2 */
    967 }
    968 
    969 /*
    970 Remove the inner padding in Chrome and Safari on macOS.
    971 */
    972 
    973 ::-webkit-search-decoration {
    974   -webkit-appearance: none;
    975 }
    976 
    977 /*
    978 1. Correct the inability to style clickable types in iOS and Safari.
    979 2. Change font properties to `inherit` in Safari.
    980 */
    981 
    982 ::-webkit-file-upload-button {
    983   -webkit-appearance: button; /* 1 */
    984   font: inherit; /* 2 */
    985 }
    986 
    987 /*
    988 Add the correct display in Chrome and Safari.
    989 */
    990 
    991 summary {
    992   display: list-item;
    993 }
    994 
    995 /*
    996 Removes the default spacing and border for appropriate elements.
    997 */
    998 
    999 blockquote,
    1000 dl,
    1001 dd,
    1002 h1,
    1003 h2,
    1004 h3,
    1005 h4,
    1006 h5,
    1007 h6,
    1008 hr,
    1009 figure,
    1010 p,
    1011 pre {
    1012   margin: 0;
    1013 }
    1014 
    1015 fieldset {
    1016   margin: 0;
    1017   padding: 0;
    1018 }
    1019 
    1020 legend {
    1021   padding: 0;
    1022 }
    1023 
    1024 ol,
    1025 ul,
    1026 menu {
    1027   list-style: none;
    1028   margin: 0;
    1029   padding: 0;
    1030 }
    1031 
    1032 /*
    1033 Reset default styling for dialogs.
    1034 */
    1035 dialog {
    1036   padding: 0;
    1037 }
    1038 
    1039 /*
    1040 Prevent resizing textareas horizontally by default.
    1041 */
    1042 
    1043 textarea {
    1044   resize: vertical;
    1045 }
    1046 
    1047 /*
    1048 1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)
    1049 2. Set the default placeholder color to the user's configured gray 400 color.
    1050 */
    1051 
    1052 input::-moz-placeholder, textarea::-moz-placeholder {
    1053   opacity: 1; /* 1 */
    1054   color: #9ca3af; /* 2 */
    1055 }
    1056 
    1057 input::placeholder,
    1058 textarea::placeholder {
    1059   opacity: 1; /* 1 */
    1060   color: #9ca3af; /* 2 */
    1061 }
    1062 
    1063 /*
    1064 Set the default cursor for buttons.
    1065 */
    1066 
    1067 button,
    1068 [role="button"] {
    1069   cursor: pointer;
    1070 }
    1071 
    1072 /*
    1073 Make sure disabled buttons don't get the pointer cursor.
    1074 */
    1075 :disabled {
    1076   cursor: default;
    1077 }
    1078 
    1079 /*
    1080 1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)
    1081 2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)
    1082    This can trigger a poorly considered lint error in some tools but is included by design.
    1083 */
    1084 
    1085 img,
    1086 svg,
    1087 video,
    1088 canvas,
    1089 audio,
    1090 iframe,
    1091 embed,
    1092 object {
    1093   display: block; /* 1 */
    1094   vertical-align: middle; /* 2 */
    1095 }
    1096 
    1097 /*
    1098 Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)
    1099 */
    1100 
    1101 img,
    1102 video {
    1103   max-width: 100%;
    1104   height: auto;
    1105 }
    1106 
    1107 /* Make elements with the HTML hidden attribute stay hidden by default */
    1108 [hidden]:where(:not([hidden="until-found"])) {
    1109   display: none;
    11101103}
    11111104.container {
     
    12881281  margin-bottom: 1rem;
    12891282}
     1283.-ml-0 {
     1284  margin-left: -0px;
     1285}
    12901286.-ml-0\.5 {
    12911287  margin-left: -0.125rem;
     
    13411337.ml-8 {
    13421338  margin-left: 2rem;
     1339}
     1340.mr-1 {
     1341  margin-right: 0.25rem;
    13431342}
    13441343.mr-1\.5 {
     
    14401439  height: 2.25rem;
    14411440}
     1441.h-1 {
     1442  height: 0.25rem;
     1443}
    14421444.h-1\.5 {
    14431445  height: 0.375rem;
     
    15001502  width: 100% !important;
    15011503}
     1504.w-0 {
     1505  width: 0px;
     1506}
    15021507.w-0\.5 {
    15031508  width: 0.125rem;
    15041509}
     1510.w-1 {
     1511  width: 0.25rem;
     1512}
    15051513.w-1\.5 {
    15061514  width: 0.375rem;
     
    15201528.w-16 {
    15211529  width: 4rem;
     1530}
     1531.w-2 {
     1532  width: 0.5rem;
    15221533}
    15231534.w-2\.5 {
     
    17721783  gap: 1px;
    17731784}
     1785.gap-x-1 {
     1786  -moz-column-gap: 0.25rem;
     1787       column-gap: 0.25rem;
     1788}
    17741789.gap-x-1\.5 {
    17751790  -moz-column-gap: 0.375rem;
     
    18411856.divide-gray-100 > :not([hidden]) ~ :not([hidden]) {
    18421857  --tw-divide-opacity: 1;
    1843   border-color: rgb(243 244 246 / var(--tw-divide-opacity, 1));
     1858  border-color: rgb(243 244 246 / var(--tw-divide-opacity));
    18441859}
    18451860.divide-gray-200 > :not([hidden]) ~ :not([hidden]) {
    18461861  --tw-divide-opacity: 1;
    1847   border-color: rgb(229 231 235 / var(--tw-divide-opacity, 1));
     1862  border-color: rgb(229 231 235 / var(--tw-divide-opacity));
    18481863}
    18491864.divide-slate-100 > :not([hidden]) ~ :not([hidden]) {
    18501865  --tw-divide-opacity: 1;
    1851   border-color: rgb(241 245 249 / var(--tw-divide-opacity, 1));
     1866  border-color: rgb(241 245 249 / var(--tw-divide-opacity));
    18521867}
    18531868.overflow-auto {
     
    19451960.\!border-gray-200 {
    19461961  --tw-border-opacity: 1 !important;
    1947   border-color: rgb(229 231 235 / var(--tw-border-opacity, 1)) !important;
     1962  border-color: rgb(229 231 235 / var(--tw-border-opacity)) !important;
    19481963}
    19491964.border-gray-200 {
    19501965  --tw-border-opacity: 1;
    1951   border-color: rgb(229 231 235 / var(--tw-border-opacity, 1));
     1966  border-color: rgb(229 231 235 / var(--tw-border-opacity));
    19521967}
    19531968.border-gray-300 {
    19541969  --tw-border-opacity: 1;
    1955   border-color: rgb(209 213 219 / var(--tw-border-opacity, 1));
     1970  border-color: rgb(209 213 219 / var(--tw-border-opacity));
    19561971}
    19571972.border-gray-900\/10 {
     
    19631978.border-indigo-600 {
    19641979  --tw-border-opacity: 1;
    1965   border-color: rgb(79 70 229 / var(--tw-border-opacity, 1));
     1980  border-color: rgb(79 70 229 / var(--tw-border-opacity));
    19661981}
    19671982.border-sky-500 {
    19681983  --tw-border-opacity: 1;
    1969   border-color: rgb(14 165 233 / var(--tw-border-opacity, 1));
     1984  border-color: rgb(14 165 233 / var(--tw-border-opacity));
    19701985}
    19711986.border-sky-600 {
    19721987  --tw-border-opacity: 1;
    1973   border-color: rgb(2 132 199 / var(--tw-border-opacity, 1));
     1988  border-color: rgb(2 132 199 / var(--tw-border-opacity));
    19741989}
    19751990.border-slate-400 {
    19761991  --tw-border-opacity: 1;
    1977   border-color: rgb(148 163 184 / var(--tw-border-opacity, 1));
     1992  border-color: rgb(148 163 184 / var(--tw-border-opacity));
    19781993}
    19791994.border-transparent {
     
    19821997.bg-black {
    19831998  --tw-bg-opacity: 1;
    1984   background-color: rgb(0 0 0 / var(--tw-bg-opacity, 1));
     1999  background-color: rgb(0 0 0 / var(--tw-bg-opacity));
    19852000}
    19862001.bg-black\/70 {
     
    19892004.bg-blue-100 {
    19902005  --tw-bg-opacity: 1;
    1991   background-color: rgb(219 234 254 / var(--tw-bg-opacity, 1));
     2006  background-color: rgb(219 234 254 / var(--tw-bg-opacity));
    19922007}
    19932008.bg-blue-500 {
    19942009  --tw-bg-opacity: 1;
    1995   background-color: rgb(59 130 246 / var(--tw-bg-opacity, 1));
     2010  background-color: rgb(59 130 246 / var(--tw-bg-opacity));
    19962011}
    19972012.bg-blue-600 {
    19982013  --tw-bg-opacity: 1;
    1999   background-color: rgb(37 99 235 / var(--tw-bg-opacity, 1));
     2014  background-color: rgb(37 99 235 / var(--tw-bg-opacity));
    20002015}
    20012016.bg-emerald-100 {
    20022017  --tw-bg-opacity: 1;
    2003   background-color: rgb(209 250 229 / var(--tw-bg-opacity, 1));
     2018  background-color: rgb(209 250 229 / var(--tw-bg-opacity));
    20042019}
    20052020.bg-emerald-500\/90 {
     
    20082023.bg-emerald-600 {
    20092024  --tw-bg-opacity: 1;
    2010   background-color: rgb(5 150 105 / var(--tw-bg-opacity, 1));
     2025  background-color: rgb(5 150 105 / var(--tw-bg-opacity));
    20112026}
    20122027.bg-gray-100 {
    20132028  --tw-bg-opacity: 1;
    2014   background-color: rgb(243 244 246 / var(--tw-bg-opacity, 1));
     2029  background-color: rgb(243 244 246 / var(--tw-bg-opacity));
    20152030}
    20162031.bg-gray-200 {
    20172032  --tw-bg-opacity: 1;
    2018   background-color: rgb(229 231 235 / var(--tw-bg-opacity, 1));
     2033  background-color: rgb(229 231 235 / var(--tw-bg-opacity));
    20192034}
    20202035.bg-gray-400 {
    20212036  --tw-bg-opacity: 1;
    2022   background-color: rgb(156 163 175 / var(--tw-bg-opacity, 1));
     2037  background-color: rgb(156 163 175 / var(--tw-bg-opacity));
    20232038}
    20242039.bg-gray-50 {
    20252040  --tw-bg-opacity: 1;
    2026   background-color: rgb(249 250 251 / var(--tw-bg-opacity, 1));
     2041  background-color: rgb(249 250 251 / var(--tw-bg-opacity));
    20272042}
    20282043.bg-gray-500 {
    20292044  --tw-bg-opacity: 1;
    2030   background-color: rgb(107 114 128 / var(--tw-bg-opacity, 1));
     2045  background-color: rgb(107 114 128 / var(--tw-bg-opacity));
    20312046}
    20322047.bg-gray-800 {
    20332048  --tw-bg-opacity: 1;
    2034   background-color: rgb(31 41 55 / var(--tw-bg-opacity, 1));
     2049  background-color: rgb(31 41 55 / var(--tw-bg-opacity));
    20352050}
    20362051.bg-gray-900 {
    20372052  --tw-bg-opacity: 1;
    2038   background-color: rgb(17 24 39 / var(--tw-bg-opacity, 1));
     2053  background-color: rgb(17 24 39 / var(--tw-bg-opacity));
    20392054}
    20402055.bg-green-100 {
    20412056  --tw-bg-opacity: 1;
    2042   background-color: rgb(220 252 231 / var(--tw-bg-opacity, 1));
     2057  background-color: rgb(220 252 231 / var(--tw-bg-opacity));
    20432058}
    20442059.bg-green-400 {
    20452060  --tw-bg-opacity: 1;
    2046   background-color: rgb(74 222 128 / var(--tw-bg-opacity, 1));
     2061  background-color: rgb(74 222 128 / var(--tw-bg-opacity));
    20472062}
    20482063.bg-green-500 {
    20492064  --tw-bg-opacity: 1;
    2050   background-color: rgb(34 197 94 / var(--tw-bg-opacity, 1));
     2065  background-color: rgb(34 197 94 / var(--tw-bg-opacity));
    20512066}
    20522067.bg-indigo-600 {
    20532068  --tw-bg-opacity: 1;
    2054   background-color: rgb(79 70 229 / var(--tw-bg-opacity, 1));
     2069  background-color: rgb(79 70 229 / var(--tw-bg-opacity));
    20552070}
    20562071.bg-indigo-600\/90 {
     
    20622077.bg-orange-100 {
    20632078  --tw-bg-opacity: 1;
    2064   background-color: rgb(255 237 213 / var(--tw-bg-opacity, 1));
     2079  background-color: rgb(255 237 213 / var(--tw-bg-opacity));
    20652080}
    20662081.bg-purple-100 {
    20672082  --tw-bg-opacity: 1;
    2068   background-color: rgb(243 232 255 / var(--tw-bg-opacity, 1));
     2083  background-color: rgb(243 232 255 / var(--tw-bg-opacity));
    20692084}
    20702085.bg-purple-500 {
    20712086  --tw-bg-opacity: 1;
    2072   background-color: rgb(168 85 247 / var(--tw-bg-opacity, 1));
     2087  background-color: rgb(168 85 247 / var(--tw-bg-opacity));
    20732088}
    20742089.bg-red-100 {
    20752090  --tw-bg-opacity: 1;
    2076   background-color: rgb(254 226 226 / var(--tw-bg-opacity, 1));
     2091  background-color: rgb(254 226 226 / var(--tw-bg-opacity));
    20772092}
    20782093.bg-red-300 {
    20792094  --tw-bg-opacity: 1;
    2080   background-color: rgb(252 165 165 / var(--tw-bg-opacity, 1));
     2095  background-color: rgb(252 165 165 / var(--tw-bg-opacity));
    20812096}
    20822097.bg-red-400 {
    20832098  --tw-bg-opacity: 1;
    2084   background-color: rgb(248 113 113 / var(--tw-bg-opacity, 1));
     2099  background-color: rgb(248 113 113 / var(--tw-bg-opacity));
    20852100}
    20862101.bg-red-500 {
    20872102  --tw-bg-opacity: 1;
    2088   background-color: rgb(239 68 68 / var(--tw-bg-opacity, 1));
     2103  background-color: rgb(239 68 68 / var(--tw-bg-opacity));
    20892104}
    20902105.bg-red-600 {
    20912106  --tw-bg-opacity: 1;
    2092   background-color: rgb(220 38 38 / var(--tw-bg-opacity, 1));
     2107  background-color: rgb(220 38 38 / var(--tw-bg-opacity));
    20932108}
    20942109.bg-sky-100 {
    20952110  --tw-bg-opacity: 1;
    2096   background-color: rgb(224 242 254 / var(--tw-bg-opacity, 1));
     2111  background-color: rgb(224 242 254 / var(--tw-bg-opacity));
    20972112}
    20982113.bg-sky-200 {
    20992114  --tw-bg-opacity: 1;
    2100   background-color: rgb(186 230 253 / var(--tw-bg-opacity, 1));
     2115  background-color: rgb(186 230 253 / var(--tw-bg-opacity));
    21012116}
    21022117.bg-sky-300 {
    21032118  --tw-bg-opacity: 1;
    2104   background-color: rgb(125 211 252 / var(--tw-bg-opacity, 1));
     2119  background-color: rgb(125 211 252 / var(--tw-bg-opacity));
    21052120}
    21062121.bg-sky-50 {
    21072122  --tw-bg-opacity: 1;
    2108   background-color: rgb(240 249 255 / var(--tw-bg-opacity, 1));
     2123  background-color: rgb(240 249 255 / var(--tw-bg-opacity));
    21092124}
    21102125.bg-sky-500 {
    21112126  --tw-bg-opacity: 1;
    2112   background-color: rgb(14 165 233 / var(--tw-bg-opacity, 1));
     2127  background-color: rgb(14 165 233 / var(--tw-bg-opacity));
    21132128}
    21142129.bg-sky-600 {
    21152130  --tw-bg-opacity: 1;
    2116   background-color: rgb(2 132 199 / var(--tw-bg-opacity, 1));
     2131  background-color: rgb(2 132 199 / var(--tw-bg-opacity));
    21172132}
    21182133.bg-slate-50 {
    21192134  --tw-bg-opacity: 1;
    2120   background-color: rgb(248 250 252 / var(--tw-bg-opacity, 1));
     2135  background-color: rgb(248 250 252 / var(--tw-bg-opacity));
    21212136}
    21222137.bg-slate-950 {
    21232138  --tw-bg-opacity: 1;
    2124   background-color: rgb(2 6 23 / var(--tw-bg-opacity, 1));
     2139  background-color: rgb(2 6 23 / var(--tw-bg-opacity));
    21252140}
    21262141.bg-transparent {
     
    21292144.bg-white {
    21302145  --tw-bg-opacity: 1;
    2131   background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));
     2146  background-color: rgb(255 255 255 / var(--tw-bg-opacity));
    21322147}
    21332148.bg-white\/95 {
     
    21362151.bg-yellow-100 {
    21372152  --tw-bg-opacity: 1;
    2138   background-color: rgb(254 249 195 / var(--tw-bg-opacity, 1));
     2153  background-color: rgb(254 249 195 / var(--tw-bg-opacity));
    21392154}
    21402155.bg-gradient-to-br {
     
    22162231  padding-right: 1rem !important;
    22172232}
     2233.\!py-1 {
     2234  padding-top: 0.25rem !important;
     2235  padding-bottom: 0.25rem !important;
     2236}
    22182237.\!py-1\.5 {
    22192238  padding-top: 0.375rem !important;
     
    22522271  padding-right: 2rem;
    22532272}
     2273.py-0 {
     2274  padding-top: 0px;
     2275  padding-bottom: 0px;
     2276}
    22542277.py-0\.5 {
    22552278  padding-top: 0.125rem;
     
    23402363  padding-left: 1rem;
    23412364}
     2365.pr-1 {
     2366  padding-right: 0.25rem;
     2367}
    23422368.pr-1\.5 {
    23432369  padding-right: 0.375rem;
     
    24632489.\!text-gray-900 {
    24642490  --tw-text-opacity: 1 !important;
    2465   color: rgb(17 24 39 / var(--tw-text-opacity, 1)) !important;
     2491  color: rgb(17 24 39 / var(--tw-text-opacity)) !important;
    24662492}
    24672493.text-black {
    24682494  --tw-text-opacity: 1;
    2469   color: rgb(0 0 0 / var(--tw-text-opacity, 1));
     2495  color: rgb(0 0 0 / var(--tw-text-opacity));
    24702496}
    24712497.text-blue-400 {
    24722498  --tw-text-opacity: 1;
    2473   color: rgb(96 165 250 / var(--tw-text-opacity, 1));
     2499  color: rgb(96 165 250 / var(--tw-text-opacity));
    24742500}
    24752501.text-blue-500 {
    24762502  --tw-text-opacity: 1;
    2477   color: rgb(59 130 246 / var(--tw-text-opacity, 1));
     2503  color: rgb(59 130 246 / var(--tw-text-opacity));
    24782504}
    24792505.text-blue-600 {
    24802506  --tw-text-opacity: 1;
    2481   color: rgb(37 99 235 / var(--tw-text-opacity, 1));
     2507  color: rgb(37 99 235 / var(--tw-text-opacity));
    24822508}
    24832509.text-blue-900 {
    24842510  --tw-text-opacity: 1;
    2485   color: rgb(30 58 138 / var(--tw-text-opacity, 1));
     2511  color: rgb(30 58 138 / var(--tw-text-opacity));
    24862512}
    24872513.text-emerald-700 {
    24882514  --tw-text-opacity: 1;
    2489   color: rgb(4 120 87 / var(--tw-text-opacity, 1));
     2515  color: rgb(4 120 87 / var(--tw-text-opacity));
    24902516}
    24912517.text-emerald-800 {
    24922518  --tw-text-opacity: 1;
    2493   color: rgb(6 95 70 / var(--tw-text-opacity, 1));
     2519  color: rgb(6 95 70 / var(--tw-text-opacity));
    24942520}
    24952521.text-gray-100 {
    24962522  --tw-text-opacity: 1;
    2497   color: rgb(243 244 246 / var(--tw-text-opacity, 1));
     2523  color: rgb(243 244 246 / var(--tw-text-opacity));
    24982524}
    24992525.text-gray-300 {
    25002526  --tw-text-opacity: 1;
    2501   color: rgb(209 213 219 / var(--tw-text-opacity, 1));
     2527  color: rgb(209 213 219 / var(--tw-text-opacity));
    25022528}
    25032529.text-gray-400 {
    25042530  --tw-text-opacity: 1;
    2505   color: rgb(156 163 175 / var(--tw-text-opacity, 1));
     2531  color: rgb(156 163 175 / var(--tw-text-opacity));
    25062532}
    25072533.text-gray-500 {
    25082534  --tw-text-opacity: 1;
    2509   color: rgb(107 114 128 / var(--tw-text-opacity, 1));
     2535  color: rgb(107 114 128 / var(--tw-text-opacity));
    25102536}
    25112537.text-gray-600 {
    25122538  --tw-text-opacity: 1;
    2513   color: rgb(75 85 99 / var(--tw-text-opacity, 1));
     2539  color: rgb(75 85 99 / var(--tw-text-opacity));
    25142540}
    25152541.text-gray-700 {
    25162542  --tw-text-opacity: 1;
    2517   color: rgb(55 65 81 / var(--tw-text-opacity, 1));
     2543  color: rgb(55 65 81 / var(--tw-text-opacity));
    25182544}
    25192545.text-gray-800 {
    25202546  --tw-text-opacity: 1;
    2521   color: rgb(31 41 55 / var(--tw-text-opacity, 1));
     2547  color: rgb(31 41 55 / var(--tw-text-opacity));
    25222548}
    25232549.text-gray-900 {
    25242550  --tw-text-opacity: 1;
    2525   color: rgb(17 24 39 / var(--tw-text-opacity, 1));
     2551  color: rgb(17 24 39 / var(--tw-text-opacity));
    25262552}
    25272553.text-green-400 {
    25282554  --tw-text-opacity: 1;
    2529   color: rgb(74 222 128 / var(--tw-text-opacity, 1));
     2555  color: rgb(74 222 128 / var(--tw-text-opacity));
    25302556}
    25312557.text-green-500 {
    25322558  --tw-text-opacity: 1;
    2533   color: rgb(34 197 94 / var(--tw-text-opacity, 1));
     2559  color: rgb(34 197 94 / var(--tw-text-opacity));
    25342560}
    25352561.text-green-700 {
    25362562  --tw-text-opacity: 1;
    2537   color: rgb(21 128 61 / var(--tw-text-opacity, 1));
     2563  color: rgb(21 128 61 / var(--tw-text-opacity));
    25382564}
    25392565.text-indigo-600 {
    25402566  --tw-text-opacity: 1;
    2541   color: rgb(79 70 229 / var(--tw-text-opacity, 1));
     2567  color: rgb(79 70 229 / var(--tw-text-opacity));
    25422568}
    25432569.text-muted-foreground {
     
    25462572.text-orange-400 {
    25472573  --tw-text-opacity: 1;
    2548   color: rgb(251 146 60 / var(--tw-text-opacity, 1));
     2574  color: rgb(251 146 60 / var(--tw-text-opacity));
    25492575}
    25502576.text-orange-500 {
    25512577  --tw-text-opacity: 1;
    2552   color: rgb(249 115 22 / var(--tw-text-opacity, 1));
     2578  color: rgb(249 115 22 / var(--tw-text-opacity));
    25532579}
    25542580.text-orange-700 {
    25552581  --tw-text-opacity: 1;
    2556   color: rgb(194 65 12 / var(--tw-text-opacity, 1));
     2582  color: rgb(194 65 12 / var(--tw-text-opacity));
    25572583}
    25582584.text-purple-500 {
    25592585  --tw-text-opacity: 1;
    2560   color: rgb(168 85 247 / var(--tw-text-opacity, 1));
     2586  color: rgb(168 85 247 / var(--tw-text-opacity));
    25612587}
    25622588.text-purple-700 {
    25632589  --tw-text-opacity: 1;
    2564   color: rgb(126 34 206 / var(--tw-text-opacity, 1));
     2590  color: rgb(126 34 206 / var(--tw-text-opacity));
    25652591}
    25662592.text-red-400 {
    25672593  --tw-text-opacity: 1;
    2568   color: rgb(248 113 113 / var(--tw-text-opacity, 1));
     2594  color: rgb(248 113 113 / var(--tw-text-opacity));
    25692595}
    25702596.text-red-500 {
    25712597  --tw-text-opacity: 1;
    2572   color: rgb(239 68 68 / var(--tw-text-opacity, 1));
     2598  color: rgb(239 68 68 / var(--tw-text-opacity));
    25732599}
    25742600.text-red-600 {
    25752601  --tw-text-opacity: 1;
    2576   color: rgb(220 38 38 / var(--tw-text-opacity, 1));
     2602  color: rgb(220 38 38 / var(--tw-text-opacity));
    25772603}
    25782604.text-red-700 {
    25792605  --tw-text-opacity: 1;
    2580   color: rgb(185 28 28 / var(--tw-text-opacity, 1));
     2606  color: rgb(185 28 28 / var(--tw-text-opacity));
    25812607}
    25822608.text-sky-300 {
    25832609  --tw-text-opacity: 1;
    2584   color: rgb(125 211 252 / var(--tw-text-opacity, 1));
     2610  color: rgb(125 211 252 / var(--tw-text-opacity));
    25852611}
    25862612.text-sky-400 {
    25872613  --tw-text-opacity: 1;
    2588   color: rgb(56 189 248 / var(--tw-text-opacity, 1));
     2614  color: rgb(56 189 248 / var(--tw-text-opacity));
    25892615}
    25902616.text-sky-500 {
    25912617  --tw-text-opacity: 1;
    2592   color: rgb(14 165 233 / var(--tw-text-opacity, 1));
     2618  color: rgb(14 165 233 / var(--tw-text-opacity));
    25932619}
    25942620.text-sky-600 {
    25952621  --tw-text-opacity: 1;
    2596   color: rgb(2 132 199 / var(--tw-text-opacity, 1));
     2622  color: rgb(2 132 199 / var(--tw-text-opacity));
    25972623}
    25982624.text-sky-700 {
    25992625  --tw-text-opacity: 1;
    2600   color: rgb(3 105 161 / var(--tw-text-opacity, 1));
     2626  color: rgb(3 105 161 / var(--tw-text-opacity));
    26012627}
    26022628.text-slate-700 {
    26032629  --tw-text-opacity: 1;
    2604   color: rgb(51 65 85 / var(--tw-text-opacity, 1));
     2630  color: rgb(51 65 85 / var(--tw-text-opacity));
    26052631}
    26062632.text-slate-900 {
    26072633  --tw-text-opacity: 1;
    2608   color: rgb(15 23 42 / var(--tw-text-opacity, 1));
     2634  color: rgb(15 23 42 / var(--tw-text-opacity));
    26092635}
    26102636.text-slate-950 {
    26112637  --tw-text-opacity: 1;
    2612   color: rgb(2 6 23 / var(--tw-text-opacity, 1));
     2638  color: rgb(2 6 23 / var(--tw-text-opacity));
    26132639}
    26142640.text-white {
    26152641  --tw-text-opacity: 1;
    2616   color: rgb(255 255 255 / var(--tw-text-opacity, 1));
     2642  color: rgb(255 255 255 / var(--tw-text-opacity));
    26172643}
    26182644.text-yellow-700 {
    26192645  --tw-text-opacity: 1;
    2620   color: rgb(161 98 7 / var(--tw-text-opacity, 1));
     2646  color: rgb(161 98 7 / var(--tw-text-opacity));
    26212647}
    26222648.underline {
     
    27172743.\!ring-gray-300 {
    27182744  --tw-ring-opacity: 1 !important;
    2719   --tw-ring-color: rgb(209 213 219 / var(--tw-ring-opacity, 1)) !important;
     2745  --tw-ring-color: rgb(209 213 219 / var(--tw-ring-opacity)) !important;
    27202746}
    27212747.ring-emerald-400\/30 {
     
    27242750.ring-gray-300 {
    27252751  --tw-ring-opacity: 1;
    2726   --tw-ring-color: rgb(209 213 219 / var(--tw-ring-opacity, 1));
     2752  --tw-ring-color: rgb(209 213 219 / var(--tw-ring-opacity));
    27272753}
    27282754.ring-indigo-400\/30 {
     
    27312757.ring-indigo-600 {
    27322758  --tw-ring-opacity: 1;
    2733   --tw-ring-color: rgb(79 70 229 / var(--tw-ring-opacity, 1));
     2759  --tw-ring-color: rgb(79 70 229 / var(--tw-ring-opacity));
    27342760}
    27352761.ring-sky-600 {
    27362762  --tw-ring-opacity: 1;
    2737   --tw-ring-color: rgb(2 132 199 / var(--tw-ring-opacity, 1));
     2763  --tw-ring-color: rgb(2 132 199 / var(--tw-ring-opacity));
    27382764}
    27392765.ring-white {
    27402766  --tw-ring-opacity: 1;
    2741   --tw-ring-color: rgb(255 255 255 / var(--tw-ring-opacity, 1));
     2767  --tw-ring-color: rgb(255 255 255 / var(--tw-ring-opacity));
    27422768}
    27432769.blur {
     
    27632789  --tw-backdrop-blur: blur(12px);
    27642790  -webkit-backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
    2765   backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
     2791          backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
    27662792}
    27672793.transition {
     
    28592885.placeholder\:text-gray-400::-moz-placeholder {
    28602886  --tw-text-opacity: 1;
    2861   color: rgb(156 163 175 / var(--tw-text-opacity, 1));
     2887  color: rgb(156 163 175 / var(--tw-text-opacity));
    28622888}
    28632889.placeholder\:text-gray-400::placeholder {
    28642890  --tw-text-opacity: 1;
    2865   color: rgb(156 163 175 / var(--tw-text-opacity, 1));
     2891  color: rgb(156 163 175 / var(--tw-text-opacity));
    28662892}
    28672893.after\:absolute::after {
     
    28732899  inset-inline-start: 2px;
    28742900}
     2901.after\:top-0::after {
     2902  content: var(--tw-content);
     2903  top: 0px;
     2904}
    28752905.after\:top-0\.5::after {
    28762906  content: var(--tw-content);
     
    28962926  content: var(--tw-content);
    28972927  --tw-border-opacity: 1;
    2898   border-color: rgb(209 213 219 / var(--tw-border-opacity, 1));
     2928  border-color: rgb(209 213 219 / var(--tw-border-opacity));
    28992929}
    29002930.after\:bg-white::after {
    29012931  content: var(--tw-content);
    29022932  --tw-bg-opacity: 1;
    2903   background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));
     2933  background-color: rgb(255 255 255 / var(--tw-bg-opacity));
    29042934}
    29052935.after\:transition-all::after {
     
    29152945.hover\:border-gray-400:hover {
    29162946  --tw-border-opacity: 1;
    2917   border-color: rgb(156 163 175 / var(--tw-border-opacity, 1));
     2947  border-color: rgb(156 163 175 / var(--tw-border-opacity));
    29182948}
    29192949.hover\:border-sky-200:hover {
    29202950  --tw-border-opacity: 1;
    2921   border-color: rgb(186 230 253 / var(--tw-border-opacity, 1));
     2951  border-color: rgb(186 230 253 / var(--tw-border-opacity));
    29222952}
    29232953.hover\:border-sky-400:hover {
    29242954  --tw-border-opacity: 1;
    2925   border-color: rgb(56 189 248 / var(--tw-border-opacity, 1));
     2955  border-color: rgb(56 189 248 / var(--tw-border-opacity));
    29262956}
    29272957.hover\:border-sky-500:hover {
    29282958  --tw-border-opacity: 1;
    2929   border-color: rgb(14 165 233 / var(--tw-border-opacity, 1));
     2959  border-color: rgb(14 165 233 / var(--tw-border-opacity));
    29302960}
    29312961.hover\:bg-blue-200:hover {
    29322962  --tw-bg-opacity: 1;
    2933   background-color: rgb(191 219 254 / var(--tw-bg-opacity, 1));
     2963  background-color: rgb(191 219 254 / var(--tw-bg-opacity));
    29342964}
    29352965.hover\:bg-emerald-700:hover {
    29362966  --tw-bg-opacity: 1;
    2937   background-color: rgb(4 120 87 / var(--tw-bg-opacity, 1));
     2967  background-color: rgb(4 120 87 / var(--tw-bg-opacity));
    29382968}
    29392969.hover\:bg-gray-200:hover {
    29402970  --tw-bg-opacity: 1;
    2941   background-color: rgb(229 231 235 / var(--tw-bg-opacity, 1));
     2971  background-color: rgb(229 231 235 / var(--tw-bg-opacity));
    29422972}
    29432973.hover\:bg-gray-400:hover {
    29442974  --tw-bg-opacity: 1;
    2945   background-color: rgb(156 163 175 / var(--tw-bg-opacity, 1));
     2975  background-color: rgb(156 163 175 / var(--tw-bg-opacity));
    29462976}
    29472977.hover\:bg-gray-50:hover {
    29482978  --tw-bg-opacity: 1;
    2949   background-color: rgb(249 250 251 / var(--tw-bg-opacity, 1));
     2979  background-color: rgb(249 250 251 / var(--tw-bg-opacity));
    29502980}
    29512981.hover\:bg-indigo-500:hover {
    29522982  --tw-bg-opacity: 1;
    2953   background-color: rgb(99 102 241 / var(--tw-bg-opacity, 1));
     2983  background-color: rgb(99 102 241 / var(--tw-bg-opacity));
    29542984}
    29552985.hover\:bg-indigo-700:hover {
    29562986  --tw-bg-opacity: 1;
    2957   background-color: rgb(67 56 202 / var(--tw-bg-opacity, 1));
     2987  background-color: rgb(67 56 202 / var(--tw-bg-opacity));
    29582988}
    29592989.hover\:bg-muted\/50:hover {
     
    29622992.hover\:bg-red-400:hover {
    29632993  --tw-bg-opacity: 1;
    2964   background-color: rgb(248 113 113 / var(--tw-bg-opacity, 1));
     2994  background-color: rgb(248 113 113 / var(--tw-bg-opacity));
    29652995}
    29662996.hover\:bg-red-500:hover {
    29672997  --tw-bg-opacity: 1;
    2968   background-color: rgb(239 68 68 / var(--tw-bg-opacity, 1));
     2998  background-color: rgb(239 68 68 / var(--tw-bg-opacity));
    29692999}
    29703000.hover\:bg-sky-400:hover {
    29713001  --tw-bg-opacity: 1;
    2972   background-color: rgb(56 189 248 / var(--tw-bg-opacity, 1));
     3002  background-color: rgb(56 189 248 / var(--tw-bg-opacity));
    29733003}
    29743004.hover\:bg-sky-500:hover {
    29753005  --tw-bg-opacity: 1;
    2976   background-color: rgb(14 165 233 / var(--tw-bg-opacity, 1));
     3006  background-color: rgb(14 165 233 / var(--tw-bg-opacity));
    29773007}
    29783008.hover\:bg-sky-600:hover {
    29793009  --tw-bg-opacity: 1;
    2980   background-color: rgb(2 132 199 / var(--tw-bg-opacity, 1));
     3010  background-color: rgb(2 132 199 / var(--tw-bg-opacity));
    29813011}
    29823012.hover\:bg-sky-900:hover {
    29833013  --tw-bg-opacity: 1;
    2984   background-color: rgb(12 74 110 / var(--tw-bg-opacity, 1));
     3014  background-color: rgb(12 74 110 / var(--tw-bg-opacity));
    29853015}
    29863016.hover\:\!text-sky-400:hover {
    29873017  --tw-text-opacity: 1 !important;
    2988   color: rgb(56 189 248 / var(--tw-text-opacity, 1)) !important;
     3018  color: rgb(56 189 248 / var(--tw-text-opacity)) !important;
    29893019}
    29903020.hover\:text-gray-700:hover {
    29913021  --tw-text-opacity: 1;
    2992   color: rgb(55 65 81 / var(--tw-text-opacity, 1));
     3022  color: rgb(55 65 81 / var(--tw-text-opacity));
    29933023}
    29943024.hover\:text-sky-200:hover {
    29953025  --tw-text-opacity: 1;
    2996   color: rgb(186 230 253 / var(--tw-text-opacity, 1));
     3026  color: rgb(186 230 253 / var(--tw-text-opacity));
    29973027}
    29983028.hover\:text-sky-600:hover {
    29993029  --tw-text-opacity: 1;
    3000   color: rgb(2 132 199 / var(--tw-text-opacity, 1));
     3030  color: rgb(2 132 199 / var(--tw-text-opacity));
    30013031}
    30023032.hover\:text-white:hover {
    30033033  --tw-text-opacity: 1;
    3004   color: rgb(255 255 255 / var(--tw-text-opacity, 1));
     3034  color: rgb(255 255 255 / var(--tw-text-opacity));
    30053035}
    30063036.hover\:underline:hover {
     
    30093039.focus\:text-sky-400:focus {
    30103040  --tw-text-opacity: 1;
    3011   color: rgb(56 189 248 / var(--tw-text-opacity, 1));
     3041  color: rgb(56 189 248 / var(--tw-text-opacity));
    30123042}
    30133043.focus\:\!shadow-none:focus {
     
    30303060.focus\:ring-blue-500:focus {
    30313061  --tw-ring-opacity: 1;
    3032   --tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity, 1));
     3062  --tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity));
    30333063}
    30343064.focus\:ring-sky-500:focus {
    30353065  --tw-ring-opacity: 1;
    3036   --tw-ring-color: rgb(14 165 233 / var(--tw-ring-opacity, 1));
     3066  --tw-ring-color: rgb(14 165 233 / var(--tw-ring-opacity));
    30373067}
    30383068.focus\:ring-sky-600:focus {
    30393069  --tw-ring-opacity: 1;
    3040   --tw-ring-color: rgb(2 132 199 / var(--tw-ring-opacity, 1));
     3070  --tw-ring-color: rgb(2 132 199 / var(--tw-ring-opacity));
    30413071}
    30423072.focus\:ring-offset-2:focus {
     
    30763106.focus-visible\:ring-blue-500:focus-visible {
    30773107  --tw-ring-opacity: 1;
    3078   --tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity, 1));
     3108  --tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity));
    30793109}
    30803110.focus-visible\:ring-emerald-300:focus-visible {
    30813111  --tw-ring-opacity: 1;
    3082   --tw-ring-color: rgb(110 231 183 / var(--tw-ring-opacity, 1));
     3112  --tw-ring-color: rgb(110 231 183 / var(--tw-ring-opacity));
    30833113}
    30843114.focus-visible\:ring-gray-500:focus-visible {
    30853115  --tw-ring-opacity: 1;
    3086   --tw-ring-color: rgb(107 114 128 / var(--tw-ring-opacity, 1));
     3116  --tw-ring-color: rgb(107 114 128 / var(--tw-ring-opacity));
    30873117}
    30883118.focus-visible\:ring-indigo-300:focus-visible {
    30893119  --tw-ring-opacity: 1;
    3090   --tw-ring-color: rgb(165 180 252 / var(--tw-ring-opacity, 1));
     3120  --tw-ring-color: rgb(165 180 252 / var(--tw-ring-opacity));
    30913121}
    30923122.focus-visible\:ring-offset-2:focus-visible {
     
    30953125.active\:text-sky-400:active {
    30963126  --tw-text-opacity: 1;
    3097   color: rgb(56 189 248 / var(--tw-text-opacity, 1));
     3127  color: rgb(56 189 248 / var(--tw-text-opacity));
    30983128}
    30993129.disabled\:cursor-progress:disabled {
     
    31023132.disabled\:bg-gray-200:disabled {
    31033133  --tw-bg-opacity: 1;
    3104   background-color: rgb(229 231 235 / var(--tw-bg-opacity, 1));
     3134  background-color: rgb(229 231 235 / var(--tw-bg-opacity));
    31053135}
    31063136.disabled\:text-gray-700:disabled {
    31073137  --tw-text-opacity: 1;
    3108   color: rgb(55 65 81 / var(--tw-text-opacity, 1));
     3138  color: rgb(55 65 81 / var(--tw-text-opacity));
    31093139}
    31103140.disabled\:opacity-50:disabled {
     
    31323162.group:hover .group-hover\:text-sky-600 {
    31333163  --tw-text-opacity: 1;
    3134   color: rgb(2 132 199 / var(--tw-text-opacity, 1));
     3164  color: rgb(2 132 199 / var(--tw-text-opacity));
    31353165}
    31363166.group:hover .group-hover\:opacity-100 {
     
    31393169.peer:checked ~ .peer-checked\:bg-blue-600 {
    31403170  --tw-bg-opacity: 1;
    3141   background-color: rgb(37 99 235 / var(--tw-bg-opacity, 1));
     3171  background-color: rgb(37 99 235 / var(--tw-bg-opacity));
    31423172}
    31433173.peer:checked ~ .peer-checked\:after\:translate-x-full::after {
     
    31493179  content: var(--tw-content);
    31503180  --tw-border-opacity: 1;
    3151   border-color: rgb(255 255 255 / var(--tw-border-opacity, 1));
    3152 }
    3153 .data-\[state\=selected\]\:bg-muted[data-state="selected"] {
     3181  border-color: rgb(255 255 255 / var(--tw-border-opacity));
     3182}
     3183.data-\[state\=selected\]\:bg-muted[data-state=selected] {
    31543184  background-color: hsl(var(--muted));
    31553185}
     
    34103440}
    34113441
    3412 .toplevel_page_squarewoosync .wp-menu-image{--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.toplevel_page_squarewoosync #wpbody-content{height:100%;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.toplevel_page_squarewoosync #wpfooter{display:none}.toplevel_page_squarewoosync .notice{margin-left:2.5rem;margin-right:2.5rem;margin-top:0.5rem;display:none}.toplevel_page_squarewoosync .wp-submenu li:last-of-type{--tw-text-opacity:1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}#screen-meta,#screen-meta-links{display:none !important}#wpcontent{padding-left:0 !important}#square-woo-sync{margin-left:auto;margin-right:auto;height:100%;min-height:100vh;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}#square-woo-sync .plugin-nav{width:calc(100% - 160px);left:0px;z-index:50;margin-left:160px}#square-woo-sync .log-details svg{--tw-rotate:180deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#square-woo-sync .log-details[open] svg{--tw-rotate:0deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#square-woo-sync .log-details summary{cursor:pointer}@media(max-width: 960px){#square-woo-sync .plugin-nav{width:calc(100% - 36px)}}@media(max-width: 982px){#square-woo-sync .plugin-nav{width:100%}}#adminmenu div.wp-menu-image{display:flex;justify-content:center;padding:4px !important;padding-top:0px !important}.toast-position{top:8rem !important}#wpbody-content{padding-bottom:0px}.dashboard-grid{display:grid;grid-template-columns:auto 400px;align-items:start}.html-block a{--tw-text-opacity:1;color:rgb(56 189 248 / var(--tw-text-opacity, 1));text-decoration-line:underline}@media screen and (max-width: 768px){.dashboard-grid{grid-template-columns:1fr}}table select{width:100%;white-space:pre-wrap;word-wrap:break-word}table option{white-space:pre-wrap;word-wrap:break-word}.pro-badge{position:absolute;margin-left:.5rem;display:inline-flex;align-items:center;border-radius:9999px;--tw-bg-opacity: 1;background-color:rgb(243, 232, 255, var(--tw-bg-opacity));padding-left:.5rem;padding-right:.5rem;padding-top:.25rem;padding-bottom:.25rem;font-size:.75rem;line-height:1rem;font-weight:700;--tw-text-opacity: 1;color:rgb(126, 34, 206, var(--tw-text-opacity))}
     3442.toplevel_page_squarewoosync .wp-menu-image{--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity))}.toplevel_page_squarewoosync #wpbody-content{height:100%;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity))}.toplevel_page_squarewoosync #wpfooter{display:none}.toplevel_page_squarewoosync .notice{margin-left:2.5rem;margin-right:2.5rem;margin-top:0.5rem;display:none}.toplevel_page_squarewoosync .wp-submenu li:last-of-type{--tw-text-opacity:1;color:rgb(22 163 74 / var(--tw-text-opacity))}#screen-meta,#screen-meta-links{display:none !important}#wpcontent{padding-left:0 !important}#square-woo-sync{margin-left:auto;margin-right:auto;height:100%;min-height:100vh;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity))}#square-woo-sync .plugin-nav{width:calc(100% - 160px);left:0px;z-index:50;margin-left:160px}#square-woo-sync .log-details svg{--tw-rotate:180deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#square-woo-sync .log-details[open] svg{--tw-rotate:0deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#square-woo-sync .log-details summary{cursor:pointer}@media(max-width: 960px){#square-woo-sync .plugin-nav{width:calc(100% - 36px)}}@media(max-width: 982px){#square-woo-sync .plugin-nav{width:100%}}#adminmenu div.wp-menu-image{display:flex;justify-content:center;padding:4px !important;padding-top:0px !important}.toast-position{top:8rem !important}#wpbody-content{padding-bottom:0px}.dashboard-grid{display:grid;grid-template-columns:auto 400px;align-items:start}.html-block a{--tw-text-opacity:1;color:rgb(56 189 248 / var(--tw-text-opacity));text-decoration-line:underline}@media screen and (max-width: 768px){.dashboard-grid{grid-template-columns:1fr}}table select{width:100%;white-space:pre-wrap;word-wrap:break-word}table option{white-space:pre-wrap;word-wrap:break-word}.pro-badge{position:absolute;margin-left:.5rem;display:inline-flex;align-items:center;border-radius:9999px;--tw-bg-opacity: 1;background-color:rgb(243 232 255/var(--tw-bg-opacity));padding-left:.5rem;padding-right:.5rem;padding-top:.25rem;padding-bottom:.25rem;font-size:.75rem;line-height:1rem;font-weight:700;--tw-text-opacity: 1;color:rgb(126 34 206/var(--tw-text-opacity))}
  • squarewoosync/trunk/build/index.js

    r3319082 r3360322  
    1 (()=>{var e,t,n={22:(e,t,n)=>{"use strict";e.exports=n(422)},35:(e,t,n)=>{"use strict";var r=n(959),o={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},a={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},l={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},i={};function s(e){return r.isMemo(e)?l:i[e.$$typeof]||o}i[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},i[r.Memo]=l;var c=Object.defineProperty,u=Object.getOwnPropertyNames,m=Object.getOwnPropertySymbols,p=Object.getOwnPropertyDescriptor,d=Object.getPrototypeOf,f=Object.prototype;e.exports=function e(t,n,r){if("string"!=typeof n){if(f){var o=d(n);o&&o!==f&&e(t,o,r)}var l=u(n);m&&(l=l.concat(m(n)));for(var i=s(t),g=s(n),h=0;h<l.length;++h){var y=l[h];if(!(a[y]||r&&r[y]||g&&g[y]||i&&i[y])){var v=p(n,y);try{c(t,y,v)}catch(e){}}}}return t}},42:(e,t,n)=>{"use strict";var r=n(664),o={"text/plain":"Text","text/html":"Url",default:"Text"};e.exports=function(e,t){var n,a,l,i,s,c,u=!1;t||(t={}),n=t.debug||!1;try{if(l=r(),i=document.createRange(),s=document.getSelection(),(c=document.createElement("span")).textContent=e,c.ariaHidden="true",c.style.all="unset",c.style.position="fixed",c.style.top=0,c.style.clip="rect(0, 0, 0, 0)",c.style.whiteSpace="pre",c.style.webkitUserSelect="text",c.style.MozUserSelect="text",c.style.msUserSelect="text",c.style.userSelect="text",c.addEventListener("copy",function(r){if(r.stopPropagation(),t.format)if(r.preventDefault(),void 0===r.clipboardData){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var a=o[t.format]||o.default;window.clipboardData.setData(a,e)}else r.clipboardData.clearData(),r.clipboardData.setData(t.format,e);t.onCopy&&(r.preventDefault(),t.onCopy(r.clipboardData))}),document.body.appendChild(c),i.selectNodeContents(c),s.addRange(i),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");u=!0}catch(r){n&&console.error("unable to copy using execCommand: ",r),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),u=!0}catch(r){n&&console.error("unable to copy using clipboardData: ",r),n&&console.error("falling back to prompt"),a=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(a,e)}}finally{s&&("function"==typeof s.removeRange?s.removeRange(i):s.removeAllRanges()),c&&document.body.removeChild(c),l()}return u}},276:(e,t,n)=>{"use strict";n(936)},289:(e,t,n)=>{"use strict";var r=n(609),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=r.useState,l=r.useEffect,i=r.useLayoutEffect,s=r.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!o(e,n)}catch(e){return!0}}var u="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),o=r[0].inst,u=r[1];return i(function(){o.value=n,o.getSnapshot=t,c(o)&&u({inst:o})},[e,n,t]),l(function(){return c(o)&&u({inst:o}),e(function(){c(o)&&u({inst:o})})},[e]),s(n),n};t.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:u},357:(e,t,n)=>{"use strict";t.__esModule=!0,t.default=function(e){var t=(0,o.default)(e);return{getItem:function(e){return new Promise(function(n,r){n(t.getItem(e))})},setItem:function(e,n){return new Promise(function(r,o){r(t.setItem(e,n))})},removeItem:function(e){return new Promise(function(n,r){n(t.removeItem(e))})}}};var r,o=(r=n(707))&&r.__esModule?r:{default:r}},422:(e,t,n)=>{"use strict";var r=n(609),o=n(476),a="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},l=o.useSyncExternalStore,i=r.useRef,s=r.useEffect,c=r.useMemo,u=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var m=i(null);if(null===m.current){var p={hasValue:!1,value:null};m.current=p}else p=m.current;m=c(function(){function e(e){if(!s){if(s=!0,l=e,e=r(e),void 0!==o&&p.hasValue){var t=p.value;if(o(t,e))return i=t}return i=e}if(t=i,a(l,e))return t;var n=r(e);return void 0!==o&&o(t,n)?(l=e,t):(l=e,i=n)}var l,i,s=!1,c=void 0===n?null:n;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]},[t,n,r,o]);var d=l(e,m[0],m[1]);return s(function(){p.hasValue=!0,p.value=d},[d]),u(d),d}},476:(e,t,n)=>{"use strict";e.exports=n(289)},609:e=>{"use strict";e.exports=window.React},664:e=>{e.exports=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r<e.rangeCount;r++)n.push(e.getRangeAt(r));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||n.forEach(function(t){e.addRange(t)}),t&&t.focus()}}},707:(e,t)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function r(){}t.__esModule=!0,t.default=function(e){var t="".concat(e,"Storage");return function(e){if("object"!==("undefined"==typeof self?"undefined":n(self))||!(e in self))return!1;try{var t=self[e],r="redux-persist ".concat(e," test");t.setItem(r,"test"),t.getItem(r),t.removeItem(r)}catch(e){return!1}return!0}(t)?self[t]:o};var o={getItem:r,setItem:r,removeItem:r}},796:(e,t,n)=>{"use strict";var r;t.A=void 0;var o=(0,((r=n(357))&&r.__esModule?r:{default:r}).default)("session");t.A=o},843:(e,t)=>{"use strict";var n="function"==typeof Symbol&&Symbol.for,r=n?Symbol.for("react.element"):60103,o=n?Symbol.for("react.portal"):60106,a=n?Symbol.for("react.fragment"):60107,l=n?Symbol.for("react.strict_mode"):60108,i=n?Symbol.for("react.profiler"):60114,s=n?Symbol.for("react.provider"):60109,c=n?Symbol.for("react.context"):60110,u=n?Symbol.for("react.async_mode"):60111,m=n?Symbol.for("react.concurrent_mode"):60111,p=n?Symbol.for("react.forward_ref"):60112,d=n?Symbol.for("react.suspense"):60113,f=n?Symbol.for("react.suspense_list"):60120,g=n?Symbol.for("react.memo"):60115,h=n?Symbol.for("react.lazy"):60116,y=n?Symbol.for("react.block"):60121,v=n?Symbol.for("react.fundamental"):60117,b=n?Symbol.for("react.responder"):60118,w=n?Symbol.for("react.scope"):60119;function E(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case u:case m:case a:case i:case l:case d:return e;default:switch(e=e&&e.$$typeof){case c:case p:case h:case g:case s:return e;default:return t}}case o:return t}}}function x(e){return E(e)===m}t.AsyncMode=u,t.ConcurrentMode=m,t.ContextConsumer=c,t.ContextProvider=s,t.Element=r,t.ForwardRef=p,t.Fragment=a,t.Lazy=h,t.Memo=g,t.Portal=o,t.Profiler=i,t.StrictMode=l,t.Suspense=d,t.isAsyncMode=function(e){return x(e)||E(e)===u},t.isConcurrentMode=x,t.isContextConsumer=function(e){return E(e)===c},t.isContextProvider=function(e){return E(e)===s},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return E(e)===p},t.isFragment=function(e){return E(e)===a},t.isLazy=function(e){return E(e)===h},t.isMemo=function(e){return E(e)===g},t.isPortal=function(e){return E(e)===o},t.isProfiler=function(e){return E(e)===i},t.isStrictMode=function(e){return E(e)===l},t.isSuspense=function(e){return E(e)===d},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===m||e===i||e===l||e===d||e===f||"object"==typeof e&&null!==e&&(e.$$typeof===h||e.$$typeof===g||e.$$typeof===s||e.$$typeof===c||e.$$typeof===p||e.$$typeof===v||e.$$typeof===b||e.$$typeof===w||e.$$typeof===y)},t.typeOf=E},889:(e,t,n)=>{var r=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,l=/^0o[0-7]+$/i,i=parseInt,s="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,c="object"==typeof self&&self&&self.Object===Object&&self,u=s||c||Function("return this")(),m=Object.prototype.toString,p=Math.max,d=Math.min,f=function(){return u.Date.now()};function g(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function h(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==m.call(e)}(e))return NaN;if(g(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=g(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(r,"");var n=a.test(e);return n||l.test(e)?i(e.slice(2),n?2:8):o.test(e)?NaN:+e}e.exports=function(e,t,n){var r,o,a,l,i,s,c=0,u=!1,m=!1,y=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function v(t){var n=r,a=o;return r=o=void 0,c=t,l=e.apply(a,n)}function b(e){var n=e-s;return void 0===s||n>=t||n<0||m&&e-c>=a}function w(){var e=f();if(b(e))return E(e);i=setTimeout(w,function(e){var n=t-(e-s);return m?d(n,a-(e-c)):n}(e))}function E(e){return i=void 0,y&&r?v(e):(r=o=void 0,l)}function x(){var e=f(),n=b(e);if(r=arguments,o=this,s=e,n){if(void 0===i)return function(e){return c=e,i=setTimeout(w,t),u?v(e):l}(s);if(m)return i=setTimeout(w,t),v(s)}return void 0===i&&(i=setTimeout(w,t)),l}return t=h(t)||0,g(n)&&(u=!!n.leading,a=(m="maxWait"in n)?p(h(n.maxWait)||0,t):a,y="trailing"in n?!!n.trailing:y),x.cancel=function(){void 0!==i&&clearTimeout(i),c=0,r=s=o=i=void 0},x.flush=function(){return void 0===i?l:E(f())},x}},936:(e,t)=>{"use strict";Symbol.for("react.element"),Symbol.for("react.portal"),Symbol.for("react.fragment"),Symbol.for("react.strict_mode"),Symbol.for("react.profiler"),Symbol.for("react.provider"),Symbol.for("react.context"),Symbol.for("react.server_context"),Symbol.for("react.forward_ref"),Symbol.for("react.suspense"),Symbol.for("react.suspense_list"),Symbol.for("react.memo"),Symbol.for("react.lazy"),Symbol.for("react.offscreen");Symbol.for("react.module.reference")},959:(e,t,n)=>{"use strict";e.exports=n(843)}},r={};function o(e){var t=r[e];if(void 0!==t)return t.exports;var a=r[e]={exports:{}};return n[e](a,a.exports,o),a.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(n,r){if(1&r&&(n=this(n)),8&r)return n;if("object"==typeof n&&n){if(4&r&&n.__esModule)return n;if(16&r&&"function"==typeof n.then)return n}var a=Object.create(null);o.r(a);var l={};e=e||[null,t({}),t([]),t(t)];for(var i=2&r&&n;"object"==typeof i&&!~e.indexOf(i);i=t(i))Object.getOwnPropertyNames(i).forEach(e=>l[e]=()=>n[e]);return l.default=()=>n,o.d(a,l),a},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");if(n.length)for(var r=n.length-1;r>-1&&(!e||!/^http(s?):/.test(e));)e=n[r--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{"use strict";const e=window.wp.element;var t=o(609),n=o.t(t,2),r=o.n(t);function a(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=a(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}const l=function(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=a(e))&&(r&&(r+=" "),r+=t);return r},i=e=>"number"==typeof e&&!isNaN(e),s=e=>"string"==typeof e,c=e=>"function"==typeof e,u=e=>s(e)||c(e)?e:null,m=e=>(0,t.isValidElement)(e)||s(e)||c(e)||i(e);function p(e){let{enter:n,exit:r,appendPosition:o=!1,collapse:a=!0,collapseDuration:l=300}=e;return function(e){let{children:i,position:s,preventExitTransition:c,done:u,nodeRef:m,isIn:p}=e;const d=o?`${n}--${s}`:n,f=o?`${r}--${s}`:r,g=(0,t.useRef)(0);return(0,t.useLayoutEffect)(()=>{const e=m.current,t=d.split(" "),n=r=>{r.target===m.current&&(e.dispatchEvent(new Event("d")),e.removeEventListener("animationend",n),e.removeEventListener("animationcancel",n),0===g.current&&"animationcancel"!==r.type&&e.classList.remove(...t))};e.classList.add(...t),e.addEventListener("animationend",n),e.addEventListener("animationcancel",n)},[]),(0,t.useEffect)(()=>{const e=m.current,t=()=>{e.removeEventListener("animationend",t),a?function(e,t,n){void 0===n&&(n=300);const{scrollHeight:r,style:o}=e;requestAnimationFrame(()=>{o.minHeight="initial",o.height=r+"px",o.transition=`all ${n}ms`,requestAnimationFrame(()=>{o.height="0",o.padding="0",o.margin="0",setTimeout(t,n)})})}(e,u,l):u()};p||(c?t():(g.current=1,e.className+=` ${f}`,e.addEventListener("animationend",t)))},[p]),t.createElement(t.Fragment,null,i)}}function d(e,t){return null!=e?{content:e.content,containerId:e.props.containerId,id:e.props.toastId,theme:e.props.theme,type:e.props.type,data:e.props.data||{},isLoading:e.props.isLoading,icon:e.props.icon,status:t}:{}}const f={list:new Map,emitQueue:new Map,on(e,t){return this.list.has(e)||this.list.set(e,[]),this.list.get(e).push(t),this},off(e,t){if(t){const n=this.list.get(e).filter(e=>e!==t);return this.list.set(e,n),this}return this.list.delete(e),this},cancelEmit(e){const t=this.emitQueue.get(e);return t&&(t.forEach(clearTimeout),this.emitQueue.delete(e)),this},emit(e){this.list.has(e)&&this.list.get(e).forEach(t=>{const n=setTimeout(()=>{t(...[].slice.call(arguments,1))},0);this.emitQueue.has(e)||this.emitQueue.set(e,[]),this.emitQueue.get(e).push(n)})}},g=e=>{let{theme:n,type:r,...o}=e;return t.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:"colored"===n?"currentColor":`var(--toastify-icon-color-${r})`,...o})},h={info:function(e){return t.createElement(g,{...e},t.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))},warning:function(e){return t.createElement(g,{...e},t.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))},success:function(e){return t.createElement(g,{...e},t.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))},error:function(e){return t.createElement(g,{...e},t.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))},spinner:function(){return t.createElement("div",{className:"Toastify__spinner"})}};function y(e){const[,n]=(0,t.useReducer)(e=>e+1,0),[r,o]=(0,t.useState)([]),a=(0,t.useRef)(null),l=(0,t.useRef)(new Map).current,p=e=>-1!==r.indexOf(e),g=(0,t.useRef)({toastKey:1,displayedToast:0,count:0,queue:[],props:e,containerId:null,isToastActive:p,getToast:e=>l.get(e)}).current;function y(e){let{containerId:t}=e;const{limit:n}=g.props;!n||t&&g.containerId!==t||(g.count-=g.queue.length,g.queue=[])}function v(e){o(t=>null==e?[]:t.filter(t=>t!==e))}function b(){const{toastContent:e,toastProps:t,staleId:n}=g.queue.shift();E(e,t,n)}function w(e,r){let{delay:o,staleId:p,...y}=r;if(!m(e)||function(e){return!a.current||g.props.enableMultiContainer&&e.containerId!==g.props.containerId||l.has(e.toastId)&&null==e.updateId}(y))return;const{toastId:w,updateId:x,data:S}=y,{props:k}=g,O=()=>v(w),N=null==x;N&&g.count++;const C={...k,style:k.toastStyle,key:g.toastKey++,...Object.fromEntries(Object.entries(y).filter(e=>{let[t,n]=e;return null!=n})),toastId:w,updateId:x,data:S,closeToast:O,isIn:!1,className:u(y.className||k.toastClassName),bodyClassName:u(y.bodyClassName||k.bodyClassName),progressClassName:u(y.progressClassName||k.progressClassName),autoClose:!y.isLoading&&(j=y.autoClose,P=k.autoClose,!1===j||i(j)&&j>0?j:P),deleteToast(){const e=d(l.get(w),"removed");l.delete(w),f.emit(4,e);const t=g.queue.length;if(g.count=null==w?g.count-g.displayedToast:g.count-1,g.count<0&&(g.count=0),t>0){const e=null==w?g.props.limit:1;if(1===t||1===e)g.displayedToast++,b();else{const n=e>t?t:e;g.displayedToast=n;for(let e=0;e<n;e++)b()}}else n()}};var j,P;C.iconOut=function(e){let{theme:n,type:r,isLoading:o,icon:a}=e,l=null;const u={theme:n,type:r};return!1===a||(c(a)?l=a(u):(0,t.isValidElement)(a)?l=(0,t.cloneElement)(a,u):s(a)||i(a)?l=a:o?l=h.spinner():(e=>e in h)(r)&&(l=h[r](u))),l}(C),c(y.onOpen)&&(C.onOpen=y.onOpen),c(y.onClose)&&(C.onClose=y.onClose),C.closeButton=k.closeButton,!1===y.closeButton||m(y.closeButton)?C.closeButton=y.closeButton:!0===y.closeButton&&(C.closeButton=!m(k.closeButton)||k.closeButton);let R=e;(0,t.isValidElement)(e)&&!s(e.type)?R=(0,t.cloneElement)(e,{closeToast:O,toastProps:C,data:S}):c(e)&&(R=e({closeToast:O,toastProps:C,data:S})),k.limit&&k.limit>0&&g.count>k.limit&&N?g.queue.push({toastContent:R,toastProps:C,staleId:p}):i(o)?setTimeout(()=>{E(R,C,p)},o):E(R,C,p)}function E(e,t,n){const{toastId:r}=t;n&&l.delete(n);const a={content:e,props:t};l.set(r,a),o(e=>[...e,r].filter(e=>e!==n)),f.emit(4,d(a,null==a.props.updateId?"added":"updated"))}return(0,t.useEffect)(()=>(g.containerId=e.containerId,f.cancelEmit(3).on(0,w).on(1,e=>a.current&&v(e)).on(5,y).emit(2,g),()=>{l.clear(),f.emit(3,g)}),[]),(0,t.useEffect)(()=>{g.props=e,g.isToastActive=p,g.displayedToast=r.length}),{getToastToRender:function(t){const n=new Map,r=Array.from(l.values());return e.newestOnTop&&r.reverse(),r.forEach(e=>{const{position:t}=e.props;n.has(t)||n.set(t,[]),n.get(t).push(e)}),Array.from(n,e=>t(e[0],e[1]))},containerRef:a,isToastActive:p}}function v(e){return e.targetTouches&&e.targetTouches.length>=1?e.targetTouches[0].clientX:e.clientX}function b(e){return e.targetTouches&&e.targetTouches.length>=1?e.targetTouches[0].clientY:e.clientY}function w(e){const[n,r]=(0,t.useState)(!1),[o,a]=(0,t.useState)(!1),l=(0,t.useRef)(null),i=(0,t.useRef)({start:0,x:0,y:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,boundingRect:null,didMove:!1}).current,s=(0,t.useRef)(e),{autoClose:u,pauseOnHover:m,closeToast:p,onClick:d,closeOnClick:f}=e;function g(t){if(e.draggable){"touchstart"===t.nativeEvent.type&&t.nativeEvent.preventDefault(),i.didMove=!1,document.addEventListener("mousemove",E),document.addEventListener("mouseup",x),document.addEventListener("touchmove",E),document.addEventListener("touchend",x);const n=l.current;i.canCloseOnClick=!0,i.canDrag=!0,i.boundingRect=n.getBoundingClientRect(),n.style.transition="",i.x=v(t.nativeEvent),i.y=b(t.nativeEvent),"x"===e.draggableDirection?(i.start=i.x,i.removalDistance=n.offsetWidth*(e.draggablePercent/100)):(i.start=i.y,i.removalDistance=n.offsetHeight*(80===e.draggablePercent?1.5*e.draggablePercent:e.draggablePercent/100))}}function h(t){if(i.boundingRect){const{top:n,bottom:r,left:o,right:a}=i.boundingRect;"touchend"!==t.nativeEvent.type&&e.pauseOnHover&&i.x>=o&&i.x<=a&&i.y>=n&&i.y<=r?w():y()}}function y(){r(!0)}function w(){r(!1)}function E(t){const r=l.current;i.canDrag&&r&&(i.didMove=!0,n&&w(),i.x=v(t),i.y=b(t),i.delta="x"===e.draggableDirection?i.x-i.start:i.y-i.start,i.start!==i.x&&(i.canCloseOnClick=!1),r.style.transform=`translate${e.draggableDirection}(${i.delta}px)`,r.style.opacity=""+(1-Math.abs(i.delta/i.removalDistance)))}function x(){document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",x),document.removeEventListener("touchmove",E),document.removeEventListener("touchend",x);const t=l.current;if(i.canDrag&&i.didMove&&t){if(i.canDrag=!1,Math.abs(i.delta)>i.removalDistance)return a(!0),void e.closeToast();t.style.transition="transform 0.2s, opacity 0.2s",t.style.transform=`translate${e.draggableDirection}(0)`,t.style.opacity="1"}}(0,t.useEffect)(()=>{s.current=e}),(0,t.useEffect)(()=>(l.current&&l.current.addEventListener("d",y,{once:!0}),c(e.onOpen)&&e.onOpen((0,t.isValidElement)(e.children)&&e.children.props),()=>{const e=s.current;c(e.onClose)&&e.onClose((0,t.isValidElement)(e.children)&&e.children.props)}),[]),(0,t.useEffect)(()=>(e.pauseOnFocusLoss&&(document.hasFocus()||w(),window.addEventListener("focus",y),window.addEventListener("blur",w)),()=>{e.pauseOnFocusLoss&&(window.removeEventListener("focus",y),window.removeEventListener("blur",w))}),[e.pauseOnFocusLoss]);const S={onMouseDown:g,onTouchStart:g,onMouseUp:h,onTouchEnd:h};return u&&m&&(S.onMouseEnter=w,S.onMouseLeave=y),f&&(S.onClick=e=>{d&&d(e),i.canCloseOnClick&&p()}),{playToast:y,pauseToast:w,isRunning:n,preventExitTransition:o,toastRef:l,eventHandlers:S}}function E(e){let{closeToast:n,theme:r,ariaLabel:o="close"}=e;return t.createElement("button",{className:`Toastify__close-button Toastify__close-button--${r}`,type:"button",onClick:e=>{e.stopPropagation(),n(e)},"aria-label":o},t.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},t.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))}function x(e){let{delay:n,isRunning:r,closeToast:o,type:a="default",hide:i,className:s,style:u,controlledProgress:m,progress:p,rtl:d,isIn:f,theme:g}=e;const h=i||m&&0===p,y={...u,animationDuration:`${n}ms`,animationPlayState:r?"running":"paused",opacity:h?0:1};m&&(y.transform=`scaleX(${p})`);const v=l("Toastify__progress-bar",m?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${g}`,`Toastify__progress-bar--${a}`,{"Toastify__progress-bar--rtl":d}),b=c(s)?s({rtl:d,type:a,defaultClassName:v}):l(v,s);return t.createElement("div",{role:"progressbar","aria-hidden":h?"true":"false","aria-label":"notification timer",className:b,style:y,[m&&p>=1?"onTransitionEnd":"onAnimationEnd"]:m&&p<1?null:()=>{f&&o()}})}const S=e=>{const{isRunning:n,preventExitTransition:r,toastRef:o,eventHandlers:a}=w(e),{closeButton:i,children:s,autoClose:u,onClick:m,type:p,hideProgressBar:d,closeToast:f,transition:g,position:h,className:y,style:v,bodyClassName:b,bodyStyle:S,progressClassName:k,progressStyle:O,updateId:N,role:C,progress:j,rtl:P,toastId:R,deleteToast:_,isIn:A,isLoading:I,iconOut:T,closeOnClick:F,theme:M}=e,L=l("Toastify__toast",`Toastify__toast-theme--${M}`,`Toastify__toast--${p}`,{"Toastify__toast--rtl":P},{"Toastify__toast--close-on-click":F}),D=c(y)?y({rtl:P,position:h,type:p,defaultClassName:L}):l(L,y),G=!!j||!u,q={closeToast:f,type:p,theme:M};let V=null;return!1===i||(V=c(i)?i(q):(0,t.isValidElement)(i)?(0,t.cloneElement)(i,q):E(q)),t.createElement(g,{isIn:A,done:_,position:h,preventExitTransition:r,nodeRef:o},t.createElement("div",{id:R,onClick:m,className:D,...a,style:v,ref:o},t.createElement("div",{...A&&{role:C},className:c(b)?b({type:p}):l("Toastify__toast-body",b),style:S},null!=T&&t.createElement("div",{className:l("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!I})},T),t.createElement("div",null,s)),V,t.createElement(x,{...N&&!G?{key:`pb-${N}`}:{},rtl:P,theme:M,delay:u,isRunning:n,isIn:A,closeToast:f,hide:d,type:p,style:O,className:k,controlledProgress:G,progress:j||0})))},k=function(e,t){return void 0===t&&(t=!1),{enter:`Toastify--animate Toastify__${e}-enter`,exit:`Toastify--animate Toastify__${e}-exit`,appendPosition:t}},O=p(k("bounce",!0)),N=(p(k("slide",!0)),p(k("zoom")),p(k("flip")),(0,t.forwardRef)((e,n)=>{const{getToastToRender:r,containerRef:o,isToastActive:a}=y(e),{className:i,style:s,rtl:m,containerId:p}=e;function d(e){const t=l("Toastify__toast-container",`Toastify__toast-container--${e}`,{"Toastify__toast-container--rtl":m});return c(i)?i({position:e,rtl:m,defaultClassName:t}):l(t,u(i))}return(0,t.useEffect)(()=>{n&&(n.current=o.current)},[]),t.createElement("div",{ref:o,className:"Toastify",id:p},r((e,n)=>{const r=n.length?{...s}:{...s,pointerEvents:"none"};return t.createElement("div",{className:d(e),style:r,key:`container-${e}`},n.map((e,r)=>{let{content:o,props:l}=e;return t.createElement(S,{...l,isIn:a(l.toastId),style:{...l.style,"--nth":r+1,"--len":n.length},key:`toast-${l.key}`},o)}))}))}));N.displayName="ToastContainer",N.defaultProps={position:"top-right",transition:O,autoClose:5e3,closeButton:E,pauseOnHover:!0,pauseOnFocusLoss:!0,closeOnClick:!0,draggable:!0,draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};let C,j=new Map,P=[],R=1;function _(){return""+R++}function A(e){return e&&(s(e.toastId)||i(e.toastId))?e.toastId:_()}function I(e,t){return j.size>0?f.emit(0,e,t):P.push({content:e,options:t}),t.toastId}function T(e,t){return{...t,type:t&&t.type||e,toastId:A(t)}}function F(e){return(t,n)=>I(t,T(e,n))}function M(e,t){return I(e,T("default",t))}M.loading=(e,t)=>I(e,T("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...t})),M.promise=function(e,t,n){let r,{pending:o,error:a,success:l}=t;o&&(r=s(o)?M.loading(o,n):M.loading(o.render,{...n,...o}));const i={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},u=(e,t,o)=>{if(null==t)return void M.dismiss(r);const a={type:e,...i,...n,data:o},l=s(t)?{render:t}:t;return r?M.update(r,{...a,...l}):M(l.render,{...a,...l}),o},m=c(e)?e():e;return m.then(e=>u("success",l,e)).catch(e=>u("error",a,e)),m},M.success=F("success"),M.info=F("info"),M.error=F("error"),M.warning=F("warning"),M.warn=M.warning,M.dark=(e,t)=>I(e,T("default",{theme:"dark",...t})),M.dismiss=e=>{j.size>0?f.emit(1,e):P=P.filter(t=>null!=e&&t.options.toastId!==e)},M.clearWaitingQueue=function(e){return void 0===e&&(e={}),f.emit(5,e)},M.isActive=e=>{let t=!1;return j.forEach(n=>{n.isToastActive&&n.isToastActive(e)&&(t=!0)}),t},M.update=function(e,t){void 0===t&&(t={}),setTimeout(()=>{const n=function(e,t){let{containerId:n}=t;const r=j.get(n||C);return r&&r.getToast(e)}(e,t);if(n){const{props:r,content:o}=n,a={delay:100,...r,...t,toastId:t.toastId||e,updateId:_()};a.toastId!==e&&(a.staleId=e);const l=a.render||o;delete a.render,I(l,a)}},0)},M.done=e=>{M.update(e,{progress:1})},M.onChange=e=>(f.on(4,e),()=>{f.off(4,e)}),M.POSITION={TOP_LEFT:"top-left",TOP_RIGHT:"top-right",TOP_CENTER:"top-center",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",BOTTOM_CENTER:"bottom-center"},M.TYPE={INFO:"info",SUCCESS:"success",WARNING:"warning",ERROR:"error",DEFAULT:"default"},f.on(2,e=>{C=e.containerId||e,j.set(C,e),P.forEach(e=>{f.emit(0,e.content,e.options)}),P=[]}).on(3,e=>{j.delete(e.containerId||e),0===j.size&&f.off(0).off(1).off(5)});var L=o(476),D=o(22);const G=window.ReactDOM;let q=function(e){e()};const V=()=>q,W=Symbol.for("react-redux-context"),z="undefined"!=typeof globalThis?globalThis:{};function B(){var e;if(!t.createContext)return{};const n=null!=(e=z[W])?e:z[W]=new Map;let r=n.get(t.createContext);return r||(r=t.createContext(null),n.set(t.createContext,r)),r}const H=B();function U(e=H){return function(){return(0,t.useContext)(e)}}const $=U();let Z=()=>{throw new Error("uSES not initialized!")};const K=(e,t)=>e===t;function Y(e=H){const n=e===H?$:U(e);return function(e,r={}){const{equalityFn:o=K,stabilityCheck:a,noopCheck:l}="function"==typeof r?{equalityFn:r}:r,{store:i,subscription:s,getServerState:c,stabilityCheck:u,noopCheck:m}=n(),p=((0,t.useRef)(!0),(0,t.useCallback)({[e.name]:t=>e(t)}[e.name],[e,u,a])),d=Z(s.addNestedSub,i.getState,c||i.getState,p,o);return(0,t.useDebugValue)(d),d}}const X=Y();o(35),o(276);const J={notify(){},get:()=>[]};const Q="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?t.useLayoutEffect:t.useEffect;let ee=null;function te(e=H){const t=e===H?$:U(e);return function(){const{store:e}=t();return e}}const ne=te();function re(e=H){const t=e===H?ne:te(e);return function(){return t().dispatch}}const oe=re();var ae;function le(e){return le="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},le(e)}function ie(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function se(e){return se=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},se(e)}function ce(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ue(e,t){return ue=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ue(e,t)}function me(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}(e=>{Z=e})(D.useSyncExternalStoreWithSelector),(e=>{ee=e})(L.useSyncExternalStore),ae=G.unstable_batchedUpdates,q=ae;var pe,de=function(e){function t(){var e,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];return n=function(e,t){return!t||"object"!==le(t)&&"function"!=typeof t?ce(e):t}(this,(e=se(t)).call.apply(e,[this].concat(o))),me(ce(n),"state",{bootstrapped:!1}),me(ce(n),"_unsubscribe",void 0),me(ce(n),"handlePersistorState",function(){n.props.persistor.getState().bootstrapped&&(n.props.onBeforeLift?Promise.resolve(n.props.onBeforeLift()).finally(function(){return n.setState({bootstrapped:!0})}):n.setState({bootstrapped:!0}),n._unsubscribe&&n._unsubscribe())}),n}var n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ue(e,t)}(t,e),n=t,(r=[{key:"componentDidMount",value:function(){this._unsubscribe=this.props.persistor.subscribe(this.handlePersistorState),this.handlePersistorState()}},{key:"componentWillUnmount",value:function(){this._unsubscribe&&this._unsubscribe()}},{key:"render",value:function(){return"function"==typeof this.props.children?this.props.children(this.state.bootstrapped):this.state.bootstrapped?this.props.children:this.props.loading}}])&&ie(n.prototype,r),t}(t.PureComponent);function fe(){return fe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},fe.apply(this,arguments)}me(de,"defaultProps",{children:null,loading:null}),function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"}(pe||(pe={}));const ge="popstate";function he(e,t){if(!1===e||null==e)throw new Error(t)}function ye(e,t){if(!e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(e){}}}function ve(e,t){return{usr:e.state,key:e.key,idx:t}}function be(e,t,n,r){return void 0===n&&(n=null),fe({pathname:"string"==typeof e?e:e.pathname,search:"",hash:""},"string"==typeof t?Ee(t):t,{state:n,key:t&&t.key||r||Math.random().toString(36).substr(2,8)})}function we(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&"?"!==n&&(t+="?"===n.charAt(0)?n:"?"+n),r&&"#"!==r&&(t+="#"===r.charAt(0)?r:"#"+r),t}function Ee(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}var xe;function Se(e,t,n){return void 0===n&&(n="/"),function(e,t,n,r){let o=Le(("string"==typeof t?Ee(t):t).pathname||"/",n);if(null==o)return null;let a=ke(e);!function(e){e.sort((e,t)=>e.score!==t.score?t.score-e.score:function(e,t){let n=e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n]);return n?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)))}(a);let l=null;for(let e=0;null==l&&e<a.length;++e){let t=Me(o);l=Te(a[e],t,r)}return l}(e,t,n,!1)}function ke(e,t,n,r){void 0===t&&(t=[]),void 0===n&&(n=[]),void 0===r&&(r="");let o=(e,o,a)=>{let l={relativePath:void 0===a?e.path||"":a,caseSensitive:!0===e.caseSensitive,childrenIndex:o,route:e};l.relativePath.startsWith("/")&&(he(l.relativePath.startsWith(r),'Absolute route path "'+l.relativePath+'" nested under path "'+r+'" is not valid. An absolute child route path must start with the combined path of all its parent routes.'),l.relativePath=l.relativePath.slice(r.length));let i=Ve([r,l.relativePath]),s=n.concat(l);e.children&&e.children.length>0&&(he(!0!==e.index,'Index routes must not have child routes. Please remove all child routes from route path "'+i+'".'),ke(e.children,t,s,i)),(null!=e.path||e.index)&&t.push({path:i,score:Ie(i,e.index),routesMeta:s})};return e.forEach((e,t)=>{var n;if(""!==e.path&&null!=(n=e.path)&&n.includes("?"))for(let n of Oe(e.path))o(e,t,n);else o(e,t)}),t}function Oe(e){let t=e.split("/");if(0===t.length)return[];let[n,...r]=t,o=n.endsWith("?"),a=n.replace(/\?$/,"");if(0===r.length)return o?[a,""]:[a];let l=Oe(r.join("/")),i=[];return i.push(...l.map(e=>""===e?a:[a,e].join("/"))),o&&i.push(...l),i.map(t=>e.startsWith("/")&&""===t?"/":t)}!function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"}(xe||(xe={})),new Set(["lazy","caseSensitive","path","id","index","children"]);const Ne=/^:[\w-]+$/,Ce=3,je=2,Pe=1,Re=10,_e=-2,Ae=e=>"*"===e;function Ie(e,t){let n=e.split("/"),r=n.length;return n.some(Ae)&&(r+=_e),t&&(r+=je),n.filter(e=>!Ae(e)).reduce((e,t)=>e+(Ne.test(t)?Ce:""===t?Pe:Re),r)}function Te(e,t,n){void 0===n&&(n=!1);let{routesMeta:r}=e,o={},a="/",l=[];for(let e=0;e<r.length;++e){let i=r[e],s=e===r.length-1,c="/"===a?t:t.slice(a.length)||"/",u=Fe({path:i.relativePath,caseSensitive:i.caseSensitive,end:s},c),m=i.route;if(!u&&s&&n&&!r[r.length-1].route.index&&(u=Fe({path:i.relativePath,caseSensitive:i.caseSensitive,end:!1},c)),!u)return null;Object.assign(o,u.params),l.push({params:o,pathname:Ve([a,u.pathname]),pathnameBase:We(Ve([a,u.pathnameBase])),route:m}),"/"!==u.pathnameBase&&(a=Ve([a,u.pathnameBase]))}return l}function Fe(e,t){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!0),ye("*"===e||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were "'+e.replace(/\*$/,"/*")+'" because the `*` character must always follow a `/` in the pattern. To get rid of this warning, please change the route path to "'+e.replace(/\*$/,"/*")+'".');let r=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(e,t,n)=>(r.push({paramName:t,isOptional:null!=n}),n?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),o+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":""!==e&&"/"!==e&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),r]}(e.path,e.caseSensitive,e.end),o=t.match(n);if(!o)return null;let a=o[0],l=a.replace(/(.)\/+$/,"$1"),i=o.slice(1),s=r.reduce((e,t,n)=>{let{paramName:r,isOptional:o}=t;if("*"===r){let e=i[n]||"";l=a.slice(0,a.length-e.length).replace(/(.)\/+$/,"$1")}const s=i[n];return e[r]=o&&!s?void 0:(s||"").replace(/%2F/g,"/"),e},{});return{params:s,pathname:a,pathnameBase:l,pattern:e}}function Me(e){try{return e.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(t){return ye(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent encoding ('+t+")."),e}}function Le(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&"/"!==r?null:e.slice(n)||"/"}function De(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified `to."+t+"` field ["+JSON.stringify(r)+"].  Please separate it out to the `to."+n+'` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.'}function Ge(e,t){let n=function(e){return e.filter((e,t)=>0===t||e.route.path&&e.route.path.length>0)}(e);return t?n.map((e,t)=>t===n.length-1?e.pathname:e.pathnameBase):n.map(e=>e.pathnameBase)}function qe(e,t,n,r){let o;void 0===r&&(r=!1),"string"==typeof e?o=Ee(e):(o=fe({},e),he(!o.pathname||!o.pathname.includes("?"),De("?","pathname","search",o)),he(!o.pathname||!o.pathname.includes("#"),De("#","pathname","hash",o)),he(!o.search||!o.search.includes("#"),De("#","search","hash",o)));let a,l=""===e||""===o.pathname,i=l?"/":o.pathname;if(null==i)a=n;else{let e=t.length-1;if(!r&&i.startsWith("..")){let t=i.split("/");for(;".."===t[0];)t.shift(),e-=1;o.pathname=t.join("/")}a=e>=0?t[e]:"/"}let s=function(e,t){void 0===t&&(t="/");let{pathname:n,search:r="",hash:o=""}="string"==typeof e?Ee(e):e,a=n?n.startsWith("/")?n:function(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(e=>{".."===e?n.length>1&&n.pop():"."!==e&&n.push(e)}),n.length>1?n.join("/"):"/"}(n,t):t;return{pathname:a,search:ze(r),hash:Be(o)}}(o,a),c=i&&"/"!==i&&i.endsWith("/"),u=(l||"."===i)&&n.endsWith("/");return s.pathname.endsWith("/")||!c&&!u||(s.pathname+="/"),s}const Ve=e=>e.join("/").replace(/\/\/+/g,"/"),We=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),ze=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",Be=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";Error;const He=["post","put","patch","delete"],Ue=(new Set(He),["get",...He]);function $e(){return $e=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},$e.apply(this,arguments)}new Set(Ue),new Set([301,302,303,307,308]),new Set([307,308]),Symbol("deferred");const Ze=t.createContext(null),Ke=t.createContext(null),Ye=t.createContext(null),Xe=t.createContext(null),Je=t.createContext({outlet:null,matches:[],isDataRoute:!1}),Qe=t.createContext(null);function et(){return null!=t.useContext(Xe)}function tt(){return et()||he(!1),t.useContext(Xe).location}function nt(e){t.useContext(Ye).static||t.useLayoutEffect(e)}function rt(){let{isDataRoute:e}=t.useContext(Je);return e?function(){let{router:e}=function(){let e=t.useContext(Ze);return e||he(!1),e}(ut.UseNavigateStable),n=pt(mt.UseNavigateStable),r=t.useRef(!1);return nt(()=>{r.current=!0}),t.useCallback(function(t,o){void 0===o&&(o={}),r.current&&("number"==typeof t?e.navigate(t):e.navigate(t,$e({fromRouteId:n},o)))},[e,n])}():function(){et()||he(!1);let e=t.useContext(Ze),{basename:n,future:r,navigator:o}=t.useContext(Ye),{matches:a}=t.useContext(Je),{pathname:l}=tt(),i=JSON.stringify(Ge(a,r.v7_relativeSplatPath)),s=t.useRef(!1);return nt(()=>{s.current=!0}),t.useCallback(function(t,r){if(void 0===r&&(r={}),!s.current)return;if("number"==typeof t)return void o.go(t);let a=qe(t,JSON.parse(i),l,"path"===r.relative);null==e&&"/"!==n&&(a.pathname="/"===a.pathname?n:Ve([n,a.pathname])),(r.replace?o.replace:o.push)(a,r.state,r)},[n,o,i,l,e])}()}function ot(e,n){let{relative:r}=void 0===n?{}:n,{future:o}=t.useContext(Ye),{matches:a}=t.useContext(Je),{pathname:l}=tt(),i=JSON.stringify(Ge(a,o.v7_relativeSplatPath));return t.useMemo(()=>qe(e,JSON.parse(i),l,"path"===r),[e,i,l,r])}function at(e,n,r,o){et()||he(!1);let{navigator:a}=t.useContext(Ye),{matches:l}=t.useContext(Je),i=l[l.length-1],s=i?i.params:{},c=(i&&i.pathname,i?i.pathnameBase:"/");i&&i.route;let u,m=tt();if(n){var p;let e="string"==typeof n?Ee(n):n;"/"===c||(null==(p=e.pathname)?void 0:p.startsWith(c))||he(!1),u=e}else u=m;let d=u.pathname||"/",f=d;if("/"!==c){let e=c.replace(/^\//,"").split("/");f="/"+d.replace(/^\//,"").split("/").slice(e.length).join("/")}let g=Se(e,{pathname:f}),h=function(e,n,r,o){var a;if(void 0===n&&(n=[]),void 0===r&&(r=null),void 0===o&&(o=null),null==e){var l;if(!r)return null;if(r.errors)e=r.matches;else{if(!(null!=(l=o)&&l.v7_partialHydration&&0===n.length&&!r.initialized&&r.matches.length>0))return null;e=r.matches}}let i=e,s=null==(a=r)?void 0:a.errors;if(null!=s){let e=i.findIndex(e=>e.route.id&&void 0!==(null==s?void 0:s[e.route.id]));e>=0||he(!1),i=i.slice(0,Math.min(i.length,e+1))}let c=!1,u=-1;if(r&&o&&o.v7_partialHydration)for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(u=e),t.route.id){let{loaderData:e,errors:n}=r,o=t.route.loader&&void 0===e[t.route.id]&&(!n||void 0===n[t.route.id]);if(t.route.lazy||o){c=!0,i=u>=0?i.slice(0,u+1):[i[0]];break}}}return i.reduceRight((e,o,a)=>{let l,m=!1,p=null,d=null;var f;r&&(l=s&&o.route.id?s[o.route.id]:void 0,p=o.route.errorElement||it,c&&(u<0&&0===a?(dt[f="route-fallback"]||(dt[f]=!0),m=!0,d=null):u===a&&(m=!0,d=o.route.hydrateFallbackElement||null)));let g=n.concat(i.slice(0,a+1)),h=()=>{let n;return n=l?p:m?d:o.route.Component?t.createElement(o.route.Component,null):o.route.element?o.route.element:e,t.createElement(ct,{match:o,routeContext:{outlet:e,matches:g,isDataRoute:null!=r},children:n})};return r&&(o.route.ErrorBoundary||o.route.errorElement||0===a)?t.createElement(st,{location:r.location,revalidation:r.revalidation,component:p,error:l,children:h(),routeContext:{outlet:null,matches:g,isDataRoute:!0}}):h()},null)}(g&&g.map(e=>Object.assign({},e,{params:Object.assign({},s,e.params),pathname:Ve([c,a.encodeLocation?a.encodeLocation(e.pathname).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?c:Ve([c,a.encodeLocation?a.encodeLocation(e.pathnameBase).pathname:e.pathnameBase])})),l,r,o);return n&&h?t.createElement(Xe.Provider,{value:{location:$e({pathname:"/",search:"",hash:"",state:null,key:"default"},u),navigationType:pe.Pop}},h):h}function lt(){let e=function(){var e;let n=t.useContext(Qe),r=function(){let e=t.useContext(Ke);return e||he(!1),e}(mt.UseRouteError),o=pt(mt.UseRouteError);return void 0!==n?n:null==(e=r.errors)?void 0:e[o]}(),n=function(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,o={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return t.createElement(t.Fragment,null,t.createElement("h2",null,"Unexpected Application Error!"),t.createElement("h3",{style:{fontStyle:"italic"}},n),r?t.createElement("pre",{style:o},r):null,null)}const it=t.createElement(lt,null);class st extends t.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||"idle"!==t.revalidation&&"idle"===e.revalidation?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:void 0!==e.error?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return void 0!==this.state.error?t.createElement(Je.Provider,{value:this.props.routeContext},t.createElement(Qe.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function ct(e){let{routeContext:n,match:r,children:o}=e,a=t.useContext(Ze);return a&&a.static&&a.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=r.route.id),t.createElement(Je.Provider,{value:n},o)}var ut=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(ut||{}),mt=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(mt||{});function pt(e){let n=function(){let e=t.useContext(Je);return e||he(!1),e}(),r=n.matches[n.matches.length-1];return r.route.id||he(!1),r.route.id}const dt={};function ft(e){he(!1)}function gt(e){let{basename:n="/",children:r=null,location:o,navigationType:a=pe.Pop,navigator:l,static:i=!1,future:s}=e;et()&&he(!1);let c=n.replace(/^\/*/,"/"),u=t.useMemo(()=>({basename:c,navigator:l,static:i,future:$e({v7_relativeSplatPath:!1},s)}),[c,s,l,i]);"string"==typeof o&&(o=Ee(o));let{pathname:m="/",search:p="",hash:d="",state:f=null,key:g="default"}=o,h=t.useMemo(()=>{let e=Le(m,c);return null==e?null:{location:{pathname:e,search:p,hash:d,state:f,key:g},navigationType:a}},[c,m,p,d,f,g,a]);return null==h?null:t.createElement(Ye.Provider,{value:u},t.createElement(Xe.Provider,{children:r,value:h}))}function ht(e){let{children:t,location:n}=e;return function(e,t){return at(e,t)}(yt(t),n)}function yt(e,n){void 0===n&&(n=[]);let r=[];return t.Children.forEach(e,(e,o)=>{if(!t.isValidElement(e))return;let a=[...n,o];if(e.type===t.Fragment)return void r.push.apply(r,yt(e.props.children,a));e.type!==ft&&he(!1),e.props.index&&e.props.children&&he(!1);let l={id:e.props.id||a.join("-"),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,loader:e.props.loader,action:e.props.action,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:null!=e.props.ErrorBoundary||null!=e.props.errorElement,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(l.children=yt(e.props.children,a)),r.push(l)}),r}function vt(){return vt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},vt.apply(this,arguments)}function bt(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}t.startTransition,new Promise(()=>{}),t.Component,new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);const wt=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],Et=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"];try{window.__reactRouterVersion="6"}catch(Cu){}const xt=t.createContext({isTransitioning:!1});new Map;const St=t.startTransition;function kt(e){let{basename:n,children:r,future:o,window:a}=e,l=t.useRef();var i;null==l.current&&(l.current=(void 0===(i={window:a,v5Compat:!0})&&(i={}),function(e,t,n,r){void 0===r&&(r={});let{window:o=document.defaultView,v5Compat:a=!1}=r,l=o.history,i=pe.Pop,s=null,c=u();function u(){return(l.state||{idx:null}).idx}function m(){i=pe.Pop;let e=u(),t=null==e?null:e-c;c=e,s&&s({action:i,location:d.location,delta:t})}function p(e){let t="null"!==o.location.origin?o.location.origin:o.location.href,n="string"==typeof e?e:we(e);return n=n.replace(/ $/,"%20"),he(t,"No window.location.(origin|href) available to create URL for href: "+n),new URL(n,t)}null==c&&(c=0,l.replaceState(fe({},l.state,{idx:c}),""));let d={get action(){return i},get location(){return e(o,l)},listen(e){if(s)throw new Error("A history only accepts one active listener");return o.addEventListener(ge,m),s=e,()=>{o.removeEventListener(ge,m),s=null}},createHref:e=>t(o,e),createURL:p,encodeLocation(e){let t=p(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(e,t){i=pe.Push;let r=be(d.location,e,t);n&&n(r,e),c=u()+1;let m=ve(r,c),p=d.createHref(r);try{l.pushState(m,"",p)}catch(e){if(e instanceof DOMException&&"DataCloneError"===e.name)throw e;o.location.assign(p)}a&&s&&s({action:i,location:d.location,delta:1})},replace:function(e,t){i=pe.Replace;let r=be(d.location,e,t);n&&n(r,e),c=u();let o=ve(r,c),m=d.createHref(r);l.replaceState(o,"",m),a&&s&&s({action:i,location:d.location,delta:0})},go:e=>l.go(e)};return d}(function(e,t){let{pathname:n="/",search:r="",hash:o=""}=Ee(e.location.hash.substr(1));return n.startsWith("/")||n.startsWith(".")||(n="/"+n),be("",{pathname:n,search:r,hash:o},t.state&&t.state.usr||null,t.state&&t.state.key||"default")},function(e,t){let n=e.document.querySelector("base"),r="";if(n&&n.getAttribute("href")){let t=e.location.href,n=t.indexOf("#");r=-1===n?t:t.slice(0,n)}return r+"#"+("string"==typeof t?t:we(t))},function(e,t){ye("/"===e.pathname.charAt(0),"relative pathnames are not supported in hash history.push("+JSON.stringify(t)+")")},i)));let s=l.current,[c,u]=t.useState({action:s.action,location:s.location}),{v7_startTransition:m}=o||{},p=t.useCallback(e=>{m&&St?St(()=>u(e)):u(e)},[u,m]);return t.useLayoutEffect(()=>s.listen(p),[s,p]),t.useEffect(()=>{return null==(e=o)||e.v7_startTransition,void 0===(null==e?void 0:e.v7_relativeSplatPath)&&(!t||t.v7_relativeSplatPath),void(t&&(t.v7_fetcherPersist,t.v7_normalizeFormMethod,t.v7_partialHydration,t.v7_skipActionErrorRevalidation));var e,t},[o]),t.createElement(gt,{basename:n,children:r,location:c.location,navigationType:c.action,navigator:s,future:o})}G.flushSync,t.useId;const Ot="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Nt=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ct=t.forwardRef(function(e,n){let r,{onClick:o,relative:a,reloadDocument:l,replace:i,state:s,target:c,to:u,preventScrollReset:m,viewTransition:p}=e,d=bt(e,wt),{basename:f}=t.useContext(Ye),g=!1;if("string"==typeof u&&Nt.test(u)&&(r=u,Ot))try{let e=new URL(window.location.href),t=u.startsWith("//")?new URL(e.protocol+u):new URL(u),n=Le(t.pathname,f);t.origin===e.origin&&null!=n?u=n+t.search+t.hash:g=!0}catch(e){}let h=function(e,n){let{relative:r}=void 0===n?{}:n;et()||he(!1);let{basename:o,navigator:a}=t.useContext(Ye),{hash:l,pathname:i,search:s}=ot(e,{relative:r}),c=i;return"/"!==o&&(c="/"===i?o:Ve([o,i])),a.createHref({pathname:c,search:s,hash:l})}(u,{relative:a}),y=function(e,n){let{target:r,replace:o,state:a,preventScrollReset:l,relative:i,viewTransition:s}=void 0===n?{}:n,c=rt(),u=tt(),m=ot(e,{relative:i});return t.useCallback(t=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(t,r)){t.preventDefault();let n=void 0!==o?o:we(u)===we(m);c(e,{replace:n,state:a,preventScrollReset:l,relative:i,viewTransition:s})}},[u,c,m,o,a,r,e,l,i,s])}(u,{replace:i,state:s,target:c,preventScrollReset:m,relative:a,viewTransition:p});return t.createElement("a",vt({},d,{href:r||h,onClick:g||l?o:function(e){o&&o(e),e.defaultPrevented||y(e)},ref:n,target:c}))}),jt=t.forwardRef(function(e,n){let{"aria-current":r="page",caseSensitive:o=!1,className:a="",end:l=!1,style:i,to:s,viewTransition:c,children:u}=e,m=bt(e,Et),p=ot(s,{relative:m.relative}),d=tt(),f=t.useContext(Ke),{navigator:g,basename:h}=t.useContext(Ye),y=null!=f&&function(e,n){void 0===n&&(n={});let r=t.useContext(xt);null==r&&he(!1);let{basename:o}=function(){let e=t.useContext(Ze);return e||he(!1),e}(Pt.useViewTransitionState),a=ot(e,{relative:n.relative});if(!r.isTransitioning)return!1;let l=Le(r.currentLocation.pathname,o)||r.currentLocation.pathname,i=Le(r.nextLocation.pathname,o)||r.nextLocation.pathname;return null!=Fe(a.pathname,i)||null!=Fe(a.pathname,l)}(p)&&!0===c,v=g.encodeLocation?g.encodeLocation(p).pathname:p.pathname,b=d.pathname,w=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;o||(b=b.toLowerCase(),w=w?w.toLowerCase():null,v=v.toLowerCase()),w&&h&&(w=Le(w,h)||w);const E="/"!==v&&v.endsWith("/")?v.length-1:v.length;let x,S=b===v||!l&&b.startsWith(v)&&"/"===b.charAt(E),k=null!=w&&(w===v||!l&&w.startsWith(v)&&"/"===w.charAt(v.length)),O={isActive:S,isPending:k,isTransitioning:y},N=S?r:void 0;x="function"==typeof a?a(O):[a,S?"active":null,k?"pending":null,y?"transitioning":null].filter(Boolean).join(" ");let C="function"==typeof i?i(O):i;return t.createElement(Ct,vt({},m,{"aria-current":N,className:x,ref:n,style:C,to:s,viewTransition:c}),"function"==typeof u?u(O):u)});var Pt,Rt;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Pt||(Pt={})),function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"}(Rt||(Rt={}));const _t=function(){return wp.element.createElement("span",{className:"inline-flex items-center rounded-full bg-purple-100 px-1.5 py-0.5 text-xs font-medium text-purple-700"},"PRO ONLY")};function At(){return wp.element.createElement("div",{className:"bg-white p-6 rounded-xl not-prose grid grid-cols-1 gap-6 sm:grid-cols-2 w-full"},wp.element.createElement("header",{className:"mb-2 col-span-full flex flex-col"},wp.element.createElement("p",{className:" text-sm font-medium text-sky-500"},"Introduction"),wp.element.createElement("h1",{className:"text-3xl tracking-tight text-slate-900 font-bold "},"Getting started"),wp.element.createElement("p",{className:"text-xl text-gray-600 mt-2"},"Welcome to SquareWooSync. See below to learn how to start importing and syncronizing products with Square and Woo.")),wp.element.createElement("div",{className:"group relative rounded-xl border border-slate-400 "},wp.element.createElement("div",{className:"absolute -inset-px rounded-xl border-2 border-transparent opacity-0 [background:linear-gradient(var(--quick-links-hover-bg,theme(colors.sky.50)),var(--quick-links-hover-bg,theme(colors.sky.50)))_padding-box,linear-gradient(to_top,theme(colors.sky.400),theme(colors.cyan.400),theme(colors.sky.500))_border-box] group-hover:opacity-100 "}),wp.element.createElement("div",{className:"relative overflow-hidden rounded-xl p-6"},wp.element.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 32 32",fill:"none",className:"h-8 w-8 [--icon-foreground:theme(colors.slate.900)] [--icon-background:theme(colors.white)]"},wp.element.createElement("defs",null,wp.element.createElement("radialGradient",{cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",id:":S3:-gradient",gradientTransform:"matrix(0 21 -21 0 20 11)"},wp.element.createElement("stop",{stopColor:"#0EA5E9"}),wp.element.createElement("stop",{stopColor:"#22D3EE",offset:".527"}),wp.element.createElement("stop",{stopColor:"#818CF8",offset:"1"})),wp.element.createElement("radialGradient",{cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",id:":S3:-gradient-dark-1",gradientTransform:"matrix(0 22.75 -22.75 0 16 6.25)"},wp.element.createElement("stop",{stopColor:"#0EA5E9"}),wp.element.createElement("stop",{stopColor:"#22D3EE",offset:".527"}),wp.element.createElement("stop",{stopColor:"#818CF8",offset:"1"})),wp.element.createElement("radialGradient",{cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",id:":S3:-gradient-dark-2",gradientTransform:"matrix(0 14 -14 0 16 10)"},wp.element.createElement("stop",{stopColor:"#0EA5E9"}),wp.element.createElement("stop",{stopColor:"#22D3EE",offset:".527"}),wp.element.createElement("stop",{stopColor:"#818CF8",offset:"1"}))),wp.element.createElement("g",{className:""},wp.element.createElement("circle",{cx:"20",cy:"20",r:"12",fill:"url(#:S3:-gradient)"}),wp.element.createElement("g",{fillOpacity:"0.5",className:"fill-[var(--icon-background)] stroke-[color:var(--icon-foreground)]",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},wp.element.createElement("path",{d:"M3 9v14l12 6V15L3 9Z"}),wp.element.createElement("path",{d:"M27 9v14l-12 6V15l12-6Z"})),wp.element.createElement("path",{d:"M11 4h8v2l6 3-10 6L5 9l6-3V4Z",fillOpacity:"0.5",className:"fill-[var(--icon-background)]"}),wp.element.createElement("g",{className:"stroke-[color:var(--icon-foreground)]",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},wp.element.createElement("path",{d:"M20 5.5 27 9l-12 6L3 9l7-3.5"}),wp.element.createElement("path",{d:"M20 5c0 1.105-2.239 2-5 2s-5-.895-5-2m10 0c0-1.105-2.239-2-5-2s-5 .895-5 2m10 0v3c0 1.105-2.239 2-5 2s-5-.895-5-2V5"}))),wp.element.createElement("g",{className:"hidden ",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},wp.element.createElement("path",{d:"M17.676 3.38a3.887 3.887 0 0 0-3.352 0l-9 4.288C3.907 8.342 3 9.806 3 11.416v9.168c0 1.61.907 3.073 2.324 3.748l9 4.288a3.887 3.887 0 0 0 3.352 0l9-4.288C28.093 23.657 29 22.194 29 20.584v-9.168c0-1.61-.907-3.074-2.324-3.748l-9-4.288Z",stroke:"url(#:S3:-gradient-dark-1)"}),wp.element.createElement("path",{d:"M16.406 8.087a.989.989 0 0 0-.812 0l-7 3.598A1.012 1.012 0 0 0 8 12.61v6.78c0 .4.233.762.594.925l7 3.598a.989.989 0 0 0 .812 0l7-3.598c.361-.163.594-.525.594-.925v-6.78c0-.4-.233-.762-.594-.925l-7-3.598Z",fill:"url(#:S3:-gradient-dark-2)",stroke:"url(#:S3:-gradient-dark-2)"}))),wp.element.createElement("h2",{className:"mt-4  text-base text-slate-900 "},wp.element.createElement("a",{href:"/wp-admin/admin.php?page=squarewoosync#/inventory"},wp.element.createElement("span",{className:"absolute -inset-px rounded-xl"}),"Start a new import")),wp.element.createElement("p",{className:"mt-1 text-sm text-slate-700 "},"Click here to begin importing or syncronizing products from Square to Woo"))),wp.element.createElement("div",{className:"group relative rounded-xl border border-slate-400 "},wp.element.createElement("div",{className:"absolute -inset-px rounded-xl border-2 border-transparent opacity-0 [background:linear-gradient(var(--quick-links-hover-bg,theme(colors.sky.50)),var(--quick-links-hover-bg,theme(colors.sky.50)))_padding-box,linear-gradient(to_top,theme(colors.sky.400),theme(colors.cyan.400),theme(colors.sky.500))_border-box] group-hover:opacity-100 "}),wp.element.createElement("div",{className:"relative overflow-hidden rounded-xl p-6"},wp.element.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 32 32",fill:"none",className:"h-8 w-8 [--icon-foreground:theme(colors.slate.900)] [--icon-background:theme(colors.white)]"},wp.element.createElement("defs",null,wp.element.createElement("radialGradient",{cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",id:":S1:-gradient",gradientTransform:"matrix(0 21 -21 0 12 3)"},wp.element.createElement("stop",{stopColor:"#0EA5E9"}),wp.element.createElement("stop",{stopColor:"#22D3EE",offset:".527"}),wp.element.createElement("stop",{stopColor:"#818CF8",offset:"1"})),wp.element.createElement("radialGradient",{cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",id:":S1:-gradient-dark",gradientTransform:"matrix(0 21 -21 0 16 7)"},wp.element.createElement("stop",{stopColor:"#0EA5E9"}),wp.element.createElement("stop",{stopColor:"#22D3EE",offset:".527"}),wp.element.createElement("stop",{stopColor:"#818CF8",offset:"1"}))),wp.element.createElement("g",{className:""},wp.element.createElement("circle",{cx:"12",cy:"12",r:"12",fill:"url(#:S1:-gradient)"}),wp.element.createElement("path",{d:"m8 8 9 21 2-10 10-2L8 8Z",fillOpacity:"0.5",className:"fill-[var(--icon-background)] stroke-[color:var(--icon-foreground)]",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})),wp.element.createElement("g",{className:"hidden "},wp.element.createElement("path",{d:"m4 4 10.286 24 2.285-11.429L28 14.286 4 4Z",fill:"url(#:S1:-gradient-dark)",stroke:"url(#:S1:-gradient-dark)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}))),wp.element.createElement("h2",{className:"mt-4  text-base text-slate-900 "},wp.element.createElement("a",{href:"https://squaresyncforwoo.com/documentation",target:"_blank"},wp.element.createElement("span",{className:"absolute -inset-px rounded-xl"}),"Installation")),wp.element.createElement("p",{className:"mt-1 text-sm text-slate-700 "},"Step-by-step guides to setting up your Square account and Woo to talk to each other"))),wp.element.createElement("div",{className:"group relative rounded-xl border border-slate-400 "},wp.element.createElement("div",{className:"absolute -inset-px rounded-xl border-2 border-transparent opacity-0 [background:linear-gradient(var(--quick-links-hover-bg,theme(colors.sky.50)),var(--quick-links-hover-bg,theme(colors.sky.50)))_padding-box,linear-gradient(to_top,theme(colors.sky.400),theme(colors.cyan.400),theme(colors.sky.500))_border-box] group-hover:opacity-100 "}),wp.element.createElement("div",{className:"relative overflow-hidden rounded-xl p-6"},wp.element.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 32 32",fill:"none",className:"h-8 w-8 [--icon-foreground:theme(colors.slate.900)] [--icon-background:theme(colors.white)]"},wp.element.createElement("defs",null,wp.element.createElement("radialGradient",{cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",id:":S2:-gradient",gradientTransform:"matrix(0 21 -21 0 20 3)"},wp.element.createElement("stop",{stopColor:"#0EA5E9"}),wp.element.createElement("stop",{stopColor:"#22D3EE",offset:".527"}),wp.element.createElement("stop",{stopColor:"#818CF8",offset:"1"})),wp.element.createElement("radialGradient",{cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",id:":S2:-gradient-dark",gradientTransform:"matrix(0 22.75 -22.75 0 16 6.25)"},wp.element.createElement("stop",{stopColor:"#0EA5E9"}),wp.element.createElement("stop",{stopColor:"#22D3EE",offset:".527"}),wp.element.createElement("stop",{stopColor:"#818CF8",offset:"1"}))),wp.element.createElement("g",{className:""},wp.element.createElement("circle",{cx:"20",cy:"12",r:"12",fill:"url(#:S2:-gradient)"}),wp.element.createElement("g",{className:"fill-[var(--icon-background)] stroke-[color:var(--icon-foreground)]",fillOpacity:"0.5",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},wp.element.createElement("path",{d:"M3 5v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2Z"}),wp.element.createElement("path",{d:"M18 17v10a2 2 0 0 0 2 2h7a2 2 0 0 0 2-2V17a2 2 0 0 0-2-2h-7a2 2 0 0 0-2 2Z"}),wp.element.createElement("path",{d:"M18 5v4a2 2 0 0 0 2 2h7a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2h-7a2 2 0 0 0-2 2Z"}),wp.element.createElement("path",{d:"M3 25v2a2 2 0 0 0 2 2h7a2 2 0 0 0 2-2v-2a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2Z"}))),wp.element.createElement("g",{className:"hidden ",fill:"url(#:S2:-gradient-dark)"},wp.element.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 17V4a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1Zm16 10v-9a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-6a2 2 0 0 1-2-2Zm0-23v5a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1h-8a1 1 0 0 0-1 1ZM3 28v-3a1 1 0 0 1 1-1h9a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1Z"}),wp.element.createElement("path",{d:"M2 4v13h2V4H2Zm2-2a2 2 0 0 0-2 2h2V2Zm8 0H4v2h8V2Zm2 2a2 2 0 0 0-2-2v2h2Zm0 13V4h-2v13h2Zm-2 2a2 2 0 0 0 2-2h-2v2Zm-8 0h8v-2H4v2Zm-2-2a2 2 0 0 0 2 2v-2H2Zm16 1v9h2v-9h-2Zm3-3a3 3 0 0 0-3 3h2a1 1 0 0 1 1-1v-2Zm6 0h-6v2h6v-2Zm3 3a3 3 0 0 0-3-3v2a1 1 0 0 1 1 1h2Zm0 9v-9h-2v9h2Zm-3 3a3 3 0 0 0 3-3h-2a1 1 0 0 1-1 1v2Zm-6 0h6v-2h-6v2Zm-3-3a3 3 0 0 0 3 3v-2a1 1 0 0 1-1-1h-2Zm2-18V4h-2v5h2Zm0 0h-2a2 2 0 0 0 2 2V9Zm8 0h-8v2h8V9Zm0 0v2a2 2 0 0 0 2-2h-2Zm0-5v5h2V4h-2Zm0 0h2a2 2 0 0 0-2-2v2Zm-8 0h8V2h-8v2Zm0 0V2a2 2 0 0 0-2 2h2ZM2 25v3h2v-3H2Zm2-2a2 2 0 0 0-2 2h2v-2Zm9 0H4v2h9v-2Zm2 2a2 2 0 0 0-2-2v2h2Zm0 3v-3h-2v3h2Zm-2 2a2 2 0 0 0 2-2h-2v2Zm-9 0h9v-2H4v2Zm-2-2a2 2 0 0 0 2 2v-2H2Z"}))),wp.element.createElement("h2",{className:"mt-4  text-base text-slate-900 "},wp.element.createElement("a",{href:"https://squaresyncforwoo.com/documentation#import-data",target:"_blank"},wp.element.createElement("span",{className:"absolute -inset-px rounded-xl"}),"Controlling your import data")),wp.element.createElement("p",{className:"mt-1 text-sm text-slate-700 "},"Learn how the internals work and how you can choose which data you would like to sync."))),wp.element.createElement("div",{className:"group relative rounded-xl border border-slate-400 "},wp.element.createElement("div",{className:"absolute -inset-px rounded-xl border-2 border-transparent opacity-0 [background:linear-gradient(var(--quick-links-hover-bg,theme(colors.sky.50)),var(--quick-links-hover-bg,theme(colors.sky.50)))_padding-box,linear-gradient(to_top,theme(colors.sky.400),theme(colors.cyan.400),theme(colors.sky.500))_border-box] group-hover:opacity-100 "}),wp.element.createElement("div",{className:"relative overflow-hidden rounded-xl p-6"},wp.element.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 32 32",fill:"none",className:"h-8 w-8 [--icon-foreground:theme(colors.slate.900)] [--icon-background:theme(colors.white)]"},wp.element.createElement("defs",null,wp.element.createElement("radialGradient",{cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",id:":S4:-gradient",gradientTransform:"matrix(0 21 -21 0 12 11)"},wp.element.createElement("stop",{stopColor:"#0EA5E9"}),wp.element.createElement("stop",{stopColor:"#22D3EE",offset:".527"}),wp.element.createElement("stop",{stopColor:"#818CF8",offset:"1"})),wp.element.createElement("radialGradient",{cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",id:":S4:-gradient-dark",gradientTransform:"matrix(0 24.5 -24.5 0 16 5.5)"},wp.element.createElement("stop",{stopColor:"#0EA5E9"}),wp.element.createElement("stop",{stopColor:"#22D3EE",offset:".527"}),wp.element.createElement("stop",{stopColor:"#818CF8",offset:"1"}))),wp.element.createElement("g",{className:""},wp.element.createElement("circle",{cx:"12",cy:"20",r:"12",fill:"url(#:S4:-gradient)"}),wp.element.createElement("path",{d:"M27 12.13 19.87 5 13 11.87v14.26l14-14Z",className:"fill-[var(--icon-background)] stroke-[color:var(--icon-foreground)]",fillOpacity:"0.5",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),wp.element.createElement("path",{d:"M3 3h10v22a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V3Z",className:"fill-[var(--icon-background)]",fillOpacity:"0.5"}),wp.element.createElement("path",{d:"M3 9v16a4 4 0 0 0 4 4h2a4 4 0 0 0 4-4V9M3 9V3h10v6M3 9h10M3 15h10M3 21h10",className:"stroke-[color:var(--icon-foreground)]",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),wp.element.createElement("path",{d:"M29 29V19h-8.5L13 26c0 1.5-2.5 3-5 3h21Z",fillOpacity:"0.5",className:"fill-[var(--icon-background)] stroke-[color:var(--icon-foreground)]",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})),wp.element.createElement("g",{className:"hidden "},wp.element.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 2a1 1 0 0 0-1 1v21a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H3Zm16.752 3.293a1 1 0 0 0-1.593.244l-1.045 2A1 1 0 0 0 17 8v13a1 1 0 0 0 1.71.705l7.999-8.045a1 1 0 0 0-.002-1.412l-6.955-6.955ZM26 18a1 1 0 0 0-.707.293l-10 10A1 1 0 0 0 16 30h13a1 1 0 0 0 1-1V19a1 1 0 0 0-1-1h-3ZM5 18a1 1 0 1 0 0 2h6a1 1 0 1 0 0-2H5Zm-1-5a1 1 0 0 1 1-1h6a1 1 0 1 1 0 2H5a1 1 0 0 1-1-1Zm1-7a1 1 0 0 0 0 2h6a1 1 0 1 0 0-2H5Z",fill:"url(#:S4:-gradient-dark)"}))),wp.element.createElement("h2",{className:"mt-4  text-base text-slate-900 "},wp.element.createElement("a",{href:"/wp-admin/admin.php?page=squarewoosync#/settings/general"},wp.element.createElement("span",{className:"absolute -inset-px rounded-xl"}),"Settings")),wp.element.createElement("p",{className:"mt-1 text-sm text-slate-700 "},"Manage your access token, import data and webhook url for automatic synchronization"))))}function It({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 8.511c.884.284 1.5 1.128 1.5 2.097v4.286c0 1.136-.847 2.1-1.98 2.193-.34.027-.68.052-1.02.072v3.091l-3-3c-1.354 0-2.694-.055-4.02-.163a2.115 2.115 0 0 1-.825-.242m9.345-8.334a2.126 2.126 0 0 0-.476-.095 48.64 48.64 0 0 0-8.048 0c-1.131.094-1.976 1.057-1.976 2.192v4.286c0 .837.46 1.58 1.155 1.951m9.345-8.334V6.637c0-1.621-1.152-3.026-2.76-3.235A48.455 48.455 0 0 0 11.25 3c-2.115 0-4.198.137-6.24.402-1.608.209-2.76 1.614-2.76 3.235v6.226c0 1.621 1.152 3.026 2.76 3.235.577.075 1.157.14 1.74.194V21l4.155-4.155"}))}const Tt=t.forwardRef(It);function Ft({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 12.75c1.148 0 2.278.08 3.383.237 1.037.146 1.866.966 1.866 2.013 0 3.728-2.35 6.75-5.25 6.75S6.75 18.728 6.75 15c0-1.046.83-1.867 1.866-2.013A24.204 24.204 0 0 1 12 12.75Zm0 0c2.883 0 5.647.508 8.207 1.44a23.91 23.91 0 0 1-1.152 6.06M12 12.75c-2.883 0-5.647.508-8.208 1.44.125 2.104.52 4.136 1.153 6.06M12 12.75a2.25 2.25 0 0 0 2.248-2.354M12 12.75a2.25 2.25 0 0 1-2.248-2.354M12 8.25c.995 0 1.971-.08 2.922-.236.403-.066.74-.358.795-.762a3.778 3.778 0 0 0-.399-2.25M12 8.25c-.995 0-1.97-.08-2.922-.236-.402-.066-.74-.358-.795-.762a3.734 3.734 0 0 1 .4-2.253M12 8.25a2.25 2.25 0 0 0-2.248 2.146M12 8.25a2.25 2.25 0 0 1 2.248 2.146M8.683 5a6.032 6.032 0 0 1-1.155-1.002c.07-.63.27-1.222.574-1.747m.581 2.749A3.75 3.75 0 0 1 15.318 5m0 0c.427-.283.815-.62 1.155-.999a4.471 4.471 0 0 0-.575-1.752M4.921 6a24.048 24.048 0 0 0-.392 3.314c1.668.546 3.416.914 5.223 1.082M19.08 6c.205 1.08.337 2.187.392 3.314a23.882 23.882 0 0 1-5.223 1.082"}))}const Mt=t.forwardRef(Ft);function Lt({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 0 1-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0 1 15 18.257V17.25m6-12V15a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 15V5.25m18 0A2.25 2.25 0 0 0 18.75 3H5.25A2.25 2.25 0 0 0 3 5.25m18 0V12a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 12V5.25"}))}const Dt=t.forwardRef(Lt);function Gt(){return wp.element.createElement("div",{className:"isolate bg-white p-5 rounded-xl"},wp.element.createElement("div",{className:""},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900 "},"Support"),wp.element.createElement("p",{className:"leading-8 text-gray-600"})),wp.element.createElement("div",{className:"mt-3 space-y-4"},wp.element.createElement("div",{className:"flex gap-x-4"},wp.element.createElement("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-sky-600"},wp.element.createElement(Tt,{className:"h-6 w-6 text-white","aria-hidden":"true"})),wp.element.createElement("div",null,wp.element.createElement("h3",{className:"text-sm font-semibold  text-gray-900"},"Sales/License support"),wp.element.createElement("p",{className:"  text-gray-600"},"Wish to talk to us about your licence or have another questions related to sales?"),wp.element.createElement("p",{className:""},wp.element.createElement("a",{href:"https://squaresyncforwoo.com/my-account/support-portal/",target:"_blank",className:"text-sm font-semibold  text-sky-600"},"Contact us"," ",wp.element.createElement("span",{"aria-hidden":"true"},"→"))))),wp.element.createElement("div",{className:"flex gap-x-4"},wp.element.createElement("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-sky-600"},wp.element.createElement(Mt,{className:"h-6 w-6 text-white","aria-hidden":"true"})),wp.element.createElement("div",null,wp.element.createElement("h3",{className:"text-sm font-semibold  text-gray-900"},"Bug reports"),wp.element.createElement("p",{className:"  text-gray-600"},"Found a bug? Let us know so we can jump on it right away! And thank you for your help!"),wp.element.createElement("p",{className:""},wp.element.createElement("a",{href:"https://squaresyncforwoo.com/my-account/support-portal/",target:"_blank",className:"text-sm font-semibold leading-6 text-sky-600"},"Report a bug"," ",wp.element.createElement("span",{"aria-hidden":"true"},"→"))))),wp.element.createElement("div",{className:"flex gap-x-4"},wp.element.createElement("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-sky-600"},wp.element.createElement(Dt,{className:"h-6 w-6 text-white","aria-hidden":"true"})),wp.element.createElement("div",null,wp.element.createElement("h3",{className:"text-sm font-semibold  text-gray-900"},"Technical support"),wp.element.createElement("p",{className:"  text-gray-600"},"Can't figure out how to setup this plugin or having another technical issue? Let us know and we would be glad to assist you."),wp.element.createElement("p",{className:""},wp.element.createElement("a",{href:"https://squaresyncforwoo.com/#contact",target:"_blank",className:"text-sm font-semibold  text-sky-600"},"Contact us"," ",wp.element.createElement("span",{"aria-hidden":"true"},"→")))))))}const qt=window.wp.apiFetch;var Vt=o.n(qt);function Wt(e){return Wt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Wt(e)}function zt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Bt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zt(Object(n),!0).forEach(function(t){Ht(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ht(e,t,n){return(t=function(e){var t=function(e){if("object"!=Wt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Wt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Wt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Vt().use(function(e,t){return e.headers=Bt(Bt({},e.headers),{},{nonce:swsData.nonce}),t(e)});const Ut=Vt(),$t=window.moment;var Zt=o.n($t);function Kt({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16Zm3.857-9.809a.75.75 0 0 0-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 1 0-1.06 1.061l2.5 2.5a.75.75 0 0 0 1.137-.089l4-5.5Z",clipRule:"evenodd"}))}const Yt=t.forwardRef(Kt);function Xt({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-8-5a.75.75 0 0 1 .75.75v4.5a.75.75 0 0 1-1.5 0v-4.5A.75.75 0 0 1 10 5Zm0 10a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z",clipRule:"evenodd"}))}const Jt=t.forwardRef(Xt);function Qt({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-7-4a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM9 9a.75.75 0 0 0 0 1.5h.253a.25.25 0 0 1 .244.304l-.459 2.066A1.75 1.75 0 0 0 10.747 15H11a.75.75 0 0 0 0-1.5h-.253a.25.25 0 0 1-.244-.304l.459-2.066A1.75 1.75 0 0 0 9.253 9H9Z",clipRule:"evenodd"}))}const en=t.forwardRef(Qt);function tn({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{fillRule:"evenodd",d:"M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))}const nn=t.forwardRef(tn);function rn({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5"}))}const on=t.forwardRef(rn);function an(e){return an="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},an(e)}function ln(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var s=r&&r.prototype instanceof i?r:i,c=Object.create(s.prototype);return sn(c,"_invoke",function(n,r,o){var a,i,s,c=0,u=o||[],m=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return a=t,i=0,s=e,p.n=n,l}};function d(n,r){for(i=n,s=r,t=0;!m&&c&&!o&&t<u.length;t++){var o,a=u[t],d=p.p,f=a[2];n>3?(o=f===r)&&(s=a[(i=a[4])?5:(i=3,3)],a[4]=a[5]=e):a[0]<=d&&((o=n<2&&d<a[1])?(i=0,p.v=r,p.n=a[1]):d<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,p.n=f,i=0))}if(o||n>1)return l;throw m=!0,r}return function(o,u,f){if(c>1)throw TypeError("Generator is already running");for(m&&1===u&&d(u,f),i=u,s=f;(t=i<2?e:s)||!m;){a||(i?i<3?(i>1&&(p.n=-1),d(i,s)):p.n=s:p.v=s);try{if(c=2,a){if(i||(o="next"),t=a[o]){if(!(t=t.call(a,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=a.return)&&t.call(a),i<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),i=1);a=e}else if((t=(m=p.n<0)?s:n.call(r,p))!==l)break}catch(t){a=e,i=1,s=t}finally{c=1}}return{value:t,done:m}}}(n,o,a),!0),c}var l={};function i(){}function s(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(sn(t={},r,function(){return this}),t),m=c.prototype=i.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,sn(e,o,"GeneratorFunction")),e.prototype=Object.create(m),e}return s.prototype=c,sn(m,"constructor",c),sn(c,"constructor",s),s.displayName="GeneratorFunction",sn(c,o,"GeneratorFunction"),sn(m),sn(m,o,"Generator"),sn(m,r,function(){return this}),sn(m,"toString",function(){return"[object Generator]"}),(ln=function(){return{w:a,m:p}})()}function sn(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}sn=function(e,t,n,r){if(t)o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{var a=function(t,n){sn(e,t,function(e){return this._invoke(t,n,e)})};a("next",0),a("throw",1),a("return",2)}},sn(e,t,n,r)}function cn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function un(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?cn(Object(n),!0).forEach(function(t){mn(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function mn(e,t,n){return(t=function(e){var t=function(e){if("object"!=an(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=an(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==an(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pn(e,t,n,r,o,a,l){try{var i=e[a](l),s=i.value}catch(e){return void n(e)}i.done?t(s):Promise.resolve(s).then(r,o)}function dn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],s=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return fn(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?fn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const gn=function(){var t=dn((0,e.useState)([]),2),n=t[0],r=t[1],o=dn((0,e.useState)(null),2),a=(o[0],o[1]);(0,e.useEffect)(function(){var e=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){pn(a,r,o,l,i,"next",e)}function i(e){pn(a,r,o,l,i,"throw",e)}l(void 0)})}}(ln().m(function e(){var t,n,o,a;return ln().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,e.n=1,Ut({path:"/sws/v1/logs",method:"GET"});case 1:if(!((t=e.v)instanceof Error||401===t.status)){e.n=2;break}return console.error("Error fetching logs:",t.message),e.a(2);case 2:t.logs&&(n={},t.logs.forEach(function(e){var t=e.context;if(t&&t.parent_id){var r=t.parent_id;n[r]||(n[r]={children:[]}),n[r].children.push(e)}else{var o=t.process_id||e.id;n[o]?n[o]=un(un({},e),{},{children:n[o].children}):n[o]=un(un({},e),{},{children:[]})}}),o=Object.values(n).filter(function(e){return e.id}).map(function(e){return un(un({},e),{},{children:e.children.sort(function(e,t){return Zt()(t.timestamp).valueOf()-Zt()(e.timestamp).valueOf()})})}).sort(function(e,t){return Zt()(t.timestamp).valueOf()-Zt()(e.timestamp).valueOf()}),r(o)),e.n=4;break;case 3:e.p=3,a=e.v,console.error("Failed to fetch logs:",a);case 4:return e.a(2)}},e,null,[[0,3]])}));return function(){return e.apply(this,arguments)}}();e();var t=setInterval(e,3e4);return a(t),function(){return clearInterval(t)}},[]);var l=function(e){var t=e.log,r=e.isSummary,o=e.isChild;return wp.element.createElement("div",{className:"relative pb-4 ".concat(r?"flex justify-between items-center":"")},t.id===n[n.length-1].id||o?null:wp.element.createElement("span",{className:"absolute left-5 top-5 -ml-px h-full w-0.5 bg-gray-200","aria-hidden":"true"}),wp.element.createElement("div",{className:"flex items-start space-x-3 ".concat(o&&"ml-10")},wp.element.createElement("div",null,wp.element.createElement("div",{className:"relative px-1"},wp.element.createElement("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-gray-100 ring-8 ring-white"},"success"===t.log_level?wp.element.createElement(Yt,{className:"h-5 w-5 text-green-500","aria-hidden":"true"}):"error"===t.log_level||"failed"===t.log_level?wp.element.createElement(Jt,{className:"h-5 w-5 text-red-500","aria-hidden":"true"}):wp.element.createElement(en,{className:"h-5 w-5 text-blue-500","aria-hidden":"true"})))),wp.element.createElement("div",{className:"min-w-0 flex-1"},wp.element.createElement("p",{className:"text-sm text-gray-500 whitespace-nowrap"},Zt()(t.timestamp).format("MMM D h:mma")),wp.element.createElement("p",null,t.message)),r&&wp.element.createElement(nn,{className:"h-5 w-5 text-gray-400"})))};return wp.element.createElement("div",{className:" bg-white rounded-xl p-5 w-full"},wp.element.createElement("h3",{className:"text-base font-semibold text-gray-900 mb-6 flex justify-start items-center gap-2"},wp.element.createElement(on,{className:"w-6 h-6"}),"Sync Feed",wp.element.createElement("span",{className:"text-xs text-gray-500 font-normal mt-[1px] -ml-1"}," ","- Shows last 1000 logs")),n.length<1&&wp.element.createElement("p",null,"No data, starting import/syncing to view logs"),wp.element.createElement("ul",{role:"list",className:"overflow-auto max-h-[1042px] h-auto overflow-y-auto"},n.map(function(e,t){return wp.element.createElement("li",{key:e.id||"parent-".concat(t)},e.children&&e.children.length>0?wp.element.createElement("details",{open:!0,className:"log-details"},wp.element.createElement("summary",{className:"list-none"},wp.element.createElement(l,{log:e,isChild:!1,isSummary:!0})),e.children.map(function(e){return wp.element.createElement(l,{key:e.id,log:e,isChild:!0})})):wp.element.createElement(l,{log:e,isChild:!1}))})))};function hn(){var t=tt();return(0,e.useEffect)(function(){!function(){var e=jQuery,t=e("#toplevel_page_squarewoosync"),n=window.location.href,r=n.substr(n.indexOf("admin.php"));e("ul.wp-submenu li",t).removeClass("current"),t.on("click","a",function(){var n=e(this);e("ul.wp-submenu li",t).removeClass("current"),n.hasClass("wp-has-submenu")?e("li.wp-first-item",t).addClass("current"):n.parents("li").addClass("current")});var o=r.split("/");e("ul.wp-submenu a",t).each(function(t,n){void 0!==o[1]&&o[1];var a=!1;e(n).attr("href")===r&&(a=!0),a&&e(n).parent().addClass("current")})}()},[t.pathname]),null}function yn(e){var t=e.cron;return wp.element.createElement("section",{className:" bg-white rounded-xl p-4 w-full"},wp.element.createElement("header",{className:"flex flex-col items-start justify-start gap-2 relative w-full"},wp.element.createElement("span",{className:"flex gap-2"},wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"#000",className:"w-6 h-6"},wp.element.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})),wp.element.createElement(_t,null)),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Automatic scheduler is ",t&&t.status?"on":"off"),t&&t.status?wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-green-500"}))):wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-red-500"})))),t&&t.status?wp.element.createElement("div",{className:"mt-2"},wp.element.createElement("p",{className:"text-gray-500 "},"The next automatic data sync to"," ",wp.element.createElement("span",{className:"text-sky-500"},t.direction)," will occur:"," ",wp.element.createElement("br",null),wp.element.createElement("span",{className:"text-sky-500"},t.next_run),t.time_until_next_run.length>0&&wp.element.createElement(React.Fragment,null,","," ",wp.element.createElement("span",{className:"text-sky-500"},"(",t.time_until_next_run,")"))),wp.element.createElement("p",{className:"mt-3 text-gray-500 "},"The following data will be synced:"),wp.element.createElement("p",{className:"mt-px text-gray-500 "},Object.keys(t.data_to_import).filter(function(e){return t.data_to_import[e]}).map(function(e,t,n){return wp.element.createElement("span",{key:e},wp.element.createElement("span",{className:"text-sky-500"},e),t!==n.length-1?", ":"")}))):wp.element.createElement("p",{className:"mt-2 text-gray-500 "},"Automatic scheduler is currently disabled."))}function vn(e){var t=e.wooAuto;return wp.element.createElement("section",{className:"bg-white rounded-xl p-4 w-full"},wp.element.createElement("header",{className:"flex flex-col items-between flex-start gap-2 relative w-full"},wp.element.createElement("span",{className:"flex gap-2"},wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-5 h-5"},wp.element.createElement("polyline",{points:"17 1 21 5 17 9"}),wp.element.createElement("path",{d:"M3 11V9a4 4 0 0 1 4-4h14"}),wp.element.createElement("polyline",{points:"7 23 3 19 7 15"}),wp.element.createElement("path",{d:"M21 13v2a4 4 0 0 1-4 4H3"})),wp.element.createElement(_t,null)),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Real-time automatic sync from Woo to Square is ",t&&t.isActive?"on":"off"),t&&t.isActive?wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-green-500"}))):wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-red-500"})))),t&&t.isActive?wp.element.createElement("div",{className:"mt-2"},wp.element.createElement("p",{className:"mt-2 text-gray-500 "},"The following data will be synced on new woocommerce orders:"),wp.element.createElement("p",{className:"mt-px text-gray-500 "},wp.element.createElement("span",{className:"text-sky-500"},"stock"))):wp.element.createElement("p",{className:"text-gray-500 mt-2"},"Real-time automatical sync is currently disabled."))}function bn(e){var t=e.squareAuto;return wp.element.createElement("section",{className:"bg-white rounded-xl p-4 w-full"},wp.element.createElement("header",{className:"flex flex-col items-between flex-start gap-2 relative w-full"},wp.element.createElement("span",{className:"flex gap-2"},wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-5 h-5"},wp.element.createElement("polyline",{points:"17 1 21 5 17 9"}),wp.element.createElement("path",{d:"M3 11V9a4 4 0 0 1 4-4h14"}),wp.element.createElement("polyline",{points:"7 23 3 19 7 15"}),wp.element.createElement("path",{d:"M21 13v2a4 4 0 0 1-4 4H3"})),wp.element.createElement(_t,null)),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Real-time automatic sync from Square to Woo is ",t&&t.isActive?"on":"off"),t&&t.isActive?wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-green-500"}))):wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-red-500"})))),t&&t.isActive?wp.element.createElement("div",{className:"mt-2"},wp.element.createElement("p",{className:"mt-3 text-gray-500 "},"The following data will be synced:"),wp.element.createElement("p",{className:"mt-px text-gray-500 "},Object.keys(t).filter(function(e){return("stock"===e||"title"===e||"description"===e||"sku"===e||"images"===e||"category"===e||"price"===e)&&!0===t[e]}).map(function(e,t,n){return wp.element.createElement("span",{key:e},wp.element.createElement("span",{className:"text-sky-500"},e),t!==n.length-1?", ":"")}))):wp.element.createElement("p",{className:"text-gray-500 mt-2"},"Real-time automatic sync from Square to Woocommerce is currently disabled."))}function wn(e){var t=e.wooAuto;return wp.element.createElement("section",{className:"bg-white rounded-xl p-4 w-full"},wp.element.createElement("header",{className:"flex flex-col items-between flex-start gap-2 relative w-full"},wp.element.createElement("span",{className:"flex gap-2"},wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-5 h-5 text-black"},wp.element.createElement("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),wp.element.createElement("line",{x1:"12",y1:"8",x2:"12",y2:"16"}),wp.element.createElement("line",{x1:"8",y1:"12",x2:"16",y2:"12"})),wp.element.createElement(_t,null)),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Auto product creation is ",null!=t&&t.autoCreateProduct||null!=t&&t.autoWooCreation?"on":"off"),null!=t&&t.autoCreateProduct||null!=t&&t.autoWooCreation?wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-green-500"}))):wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-red-500"})))),wp.element.createElement("div",{className:"mt-2"},wp.element.createElement("p",{className:"mt-3 text-gray-500"},t&&t.autoCreateProduct&&t.autoWooCreation?"Products are being automatically created both ways between WooCommerce and Square.":t&&t.autoCreateProduct?"When a new product is created in WooCommerce, it will automatically be created in Square.":t&&t.autoWooCreation?"When a new product is created in Square, it will automatically be created in WooCommerce.":"Auto product creation is currently disabled."),!(null!=t&&t.autoCreateProduct)&&!(null!=t&&t.autoWooCreation)&&wp.element.createElement("p",{className:"text-gray-500"})))}function En(e){var t=e.orders,n=e.gatewaySettings;return wp.element.createElement("section",{className:"bg-white rounded-xl p-4 w-full"},wp.element.createElement("header",{className:"flex flex-col items-between flex-start gap-2 relative w-full text-black"},wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-5 h-5 text-black"},wp.element.createElement("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),wp.element.createElement("path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"})),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Auto sync of orders, transactions and customers is ",t&&t.enabled||n&&"yes"===n.enabled?"on":"off"),t&&t.enabled||n&&"yes"===n.enabled?wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-green-500"}))):wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-red-500"})))),t&&t.enabled||n&&"yes"===n.enabled?wp.element.createElement("div",{className:"mt-2"},wp.element.createElement("p",{className:"mt-3 text-gray-500 "},"When a new order is created with a status of ",wp.element.createElement("span",{className:"text-sky-500"},'"',t.stage,'"'),", a corresponding order, transaction and customer will be created in Square.")):wp.element.createElement("p",{className:"text-gray-500 mt-2"},"Auto orders, transactions and customer sync to Square is currently disabled. To enable, to go the order settings ",wp.element.createElement(Ct,{to:"/settings/orders",className:"text-sky-500"},"here"),"."))}function xn({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19.128a9.38 9.38 0 0 0 2.625.372 9.337 9.337 0 0 0 4.121-.952 4.125 4.125 0 0 0-7.533-2.493M15 19.128v-.003c0-1.113-.285-2.16-.786-3.07M15 19.128v.106A12.318 12.318 0 0 1 8.624 21c-2.331 0-4.512-.645-6.374-1.766l-.001-.109a6.375 6.375 0 0 1 11.964-3.07M12 6.375a3.375 3.375 0 1 1-6.75 0 3.375 3.375 0 0 1 6.75 0Zm8.25 2.25a2.625 2.625 0 1 1-5.25 0 2.625 2.625 0 0 1 5.25 0Z"}))}const Sn=t.forwardRef(xn);function kn(e){var t=e.squareWoo;return wp.element.createElement("section",{className:"bg-white rounded-xl p-4 w-full"},wp.element.createElement("header",{className:"flex flex-col items-between flex-start gap-2 relative w-full"},wp.element.createElement("div",{className:"flex gap-2 items-center"},wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-5 h-5"},wp.element.createElement("polyline",{points:"17 1 21 5 17 9"}),wp.element.createElement("path",{d:"M3 11V9a4 4 0 0 1 4-4h14"}),wp.element.createElement("polyline",{points:"7 23 3 19 7 15"}),wp.element.createElement("path",{d:"M21 13v2a4 4 0 0 1-4 4H3"})),wp.element.createElement(Sn,{className:"w-5 h-5"}),wp.element.createElement(_t,null)),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Customer real-time automatic sync from Square to Woo is ",t&&t.is_active?"on":"off"),t&&t.is_active?wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-green-500"}))):wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-red-500"})))),t&&t.is_active?wp.element.createElement("div",{className:"mt-2"},wp.element.createElement("p",{className:"mt-3 text-gray-500 "},"The following data will be synced:"),wp.element.createElement("p",{className:"mt-px text-gray-500 "},Object.keys(t).filter(function(e){return("first_name"===e||"last_name"===e||"phone"===e||"role"===e||"address"===e)&&!0===t[e]}).map(function(e,t,n){return wp.element.createElement("span",{key:e},wp.element.createElement("span",{className:"text-sky-500"},e.replace("_"," ")),t!==n.length-1?", ":"")}))):wp.element.createElement("p",{className:"text-gray-500 mt-2"},"Real-time automatic sync of customers from Square to Woocommerce is currently disabled."))}function On(e){var t=e.wooSquare;return wp.element.createElement("section",{className:"bg-white rounded-xl p-4 w-full"},wp.element.createElement("header",{className:"flex flex-col items-between flex-start gap-2 relative w-full"},wp.element.createElement("div",{className:"flex gap-2 items-center"},wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-5 h-5"},wp.element.createElement("polyline",{points:"17 1 21 5 17 9"}),wp.element.createElement("path",{d:"M3 11V9a4 4 0 0 1 4-4h14"}),wp.element.createElement("polyline",{points:"7 23 3 19 7 15"}),wp.element.createElement("path",{d:"M21 13v2a4 4 0 0 1-4 4H3"})),wp.element.createElement(Sn,{className:"w-5 h-5"}),wp.element.createElement(_t,null)),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Customer real-time automatic sync from Woo to Square is ",t&&t.is_active?"on":"off"),t&&t.is_active?wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-green-500"}))):wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-red-500"})))),t&&t.is_active?wp.element.createElement("div",{className:"mt-2"},wp.element.createElement("p",{className:"mt-3 text-gray-500 "},"The following data will be synced:"),wp.element.createElement("p",{className:"mt-px text-gray-500 "},Object.keys(t).filter(function(e){return("first_name"===e||"last_name"===e||"phone"===e||"role"===e||"address"===e)&&!0===t[e]}).map(function(e,t,n){return wp.element.createElement("span",{key:e},wp.element.createElement("span",{className:"text-sky-500"},e.replace("_"," ")),t!==n.length-1?", ":"")}))):wp.element.createElement("p",{className:"text-gray-500 mt-2"},"Real-time automatic sync of customers from Square to Woocommerce is currently disabled."))}function Nn({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"}))}const Cn=t.forwardRef(Nn);function jn(e){var t=e.wooAuto,n=e.squareAuto;return wp.element.createElement("section",{className:"bg-white rounded-xl p-4 w-full"},wp.element.createElement("header",{className:"flex flex-col items-between flex-start gap-2 relative w-full"},wp.element.createElement("span",{className:"flex gap-2"},wp.element.createElement(Cn,{className:"w-5"}),wp.element.createElement(_t,null)),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Real-time automatic delete/archive is ",t&&t.autoDeleteProduct||n&&n.autoDeleteProduct?"on":"off"),t&&t.autoDeleteProduct||n&&n.autoDeleteProduct?wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-green-500"}))):wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-red-500"})))),t&&t.autoDeleteProduct||n&&n.autoDeleteProduct?wp.element.createElement("div",{className:"mt-2"},wp.element.createElement("p",{className:"mt-2 text-gray-500 "},"When a product is deleted/archived in ",t.autoDeleteProduct?"WooCommerce":"Square",", it will also be deleted/archived in ",t.autoDeleteProduct?"Square":"WooCommerce")):wp.element.createElement("p",{className:"text-gray-500 mt-2"},"Real-time automatic sync is currently disabled."))}function Pn(e){return Pn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Pn(e)}function Rn(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var s=r&&r.prototype instanceof i?r:i,c=Object.create(s.prototype);return An(c,"_invoke",function(n,r,o){var a,i,s,c=0,u=o||[],m=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return a=t,i=0,s=e,p.n=n,l}};function d(n,r){for(i=n,s=r,t=0;!m&&c&&!o&&t<u.length;t++){var o,a=u[t],d=p.p,f=a[2];n>3?(o=f===r)&&(s=a[(i=a[4])?5:(i=3,3)],a[4]=a[5]=e):a[0]<=d&&((o=n<2&&d<a[1])?(i=0,p.v=r,p.n=a[1]):d<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,p.n=f,i=0))}if(o||n>1)return l;throw m=!0,r}return function(o,u,f){if(c>1)throw TypeError("Generator is already running");for(m&&1===u&&d(u,f),i=u,s=f;(t=i<2?e:s)||!m;){a||(i?i<3?(i>1&&(p.n=-1),d(i,s)):p.n=s:p.v=s);try{if(c=2,a){if(i||(o="next"),t=a[o]){if(!(t=t.call(a,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=a.return)&&t.call(a),i<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),i=1);a=e}else if((t=(m=p.n<0)?s:n.call(r,p))!==l)break}catch(t){a=e,i=1,s=t}finally{c=1}}return{value:t,done:m}}}(n,o,a),!0),c}var l={};function i(){}function s(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(An(t={},r,function(){return this}),t),m=c.prototype=i.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,An(e,o,"GeneratorFunction")),e.prototype=Object.create(m),e}return s.prototype=c,An(m,"constructor",c),An(c,"constructor",s),s.displayName="GeneratorFunction",An(c,o,"GeneratorFunction"),An(m),An(m,o,"Generator"),An(m,r,function(){return this}),An(m,"toString",function(){return"[object Generator]"}),(Rn=function(){return{w:a,m:p}})()}function An(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}An=function(e,t,n,r){if(t)o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{var a=function(t,n){An(e,t,function(e){return this._invoke(t,n,e)})};a("next",0),a("throw",1),a("return",2)}},An(e,t,n,r)}function In(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Tn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?In(Object(n),!0).forEach(function(t){Fn(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):In(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Fn(e,t,n){return(t=function(e){var t=function(e){if("object"!=Pn(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Pn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Pn(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Mn(e,t,n,r,o,a,l){try{var i=e[a](l),s=i.value}catch(e){return void n(e)}i.done?t(s):Promise.resolve(s).then(r,o)}function Ln(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Dn=(0,e.createContext)(),Gn=function(t){var n=t.children,r=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],s=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ln(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ln(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)({status:!1,next_run:"Hourly",data_to_import:{stock:!0,title:!0,sku:!0,price:!0,description:!0},direction:"WooCommerce",time_until_next_run:"in 31 mins"}),2),o=r[0],a=r[1];return(0,e.useEffect)(function(){var e=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){Mn(a,r,o,l,i,"next",e)}function i(e){Mn(a,r,o,l,i,"throw",e)}l(void 0)})}}(Rn().m(function e(){return Rn().w(function(e){for(;;)switch(e.n){case 0:Vt()({path:"/sws/v1/settings/get-cron",method:"GET"}).then(function(e){a(Tn(Tn({},o),e))});case 1:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}();e()},[]),wp.element.createElement(Dn.Provider,{value:{cron:o,setCron:a}},n)};function qn(e){return qn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},qn(e)}function Vn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Wn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vn(Object(n),!0).forEach(function(t){zn(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function zn(e,t,n){return(t=function(e){var t=function(e){if("object"!=qn(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=qn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==qn(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bn(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var s=r&&r.prototype instanceof i?r:i,c=Object.create(s.prototype);return Hn(c,"_invoke",function(n,r,o){var a,i,s,c=0,u=o||[],m=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return a=t,i=0,s=e,p.n=n,l}};function d(n,r){for(i=n,s=r,t=0;!m&&c&&!o&&t<u.length;t++){var o,a=u[t],d=p.p,f=a[2];n>3?(o=f===r)&&(s=a[(i=a[4])?5:(i=3,3)],a[4]=a[5]=e):a[0]<=d&&((o=n<2&&d<a[1])?(i=0,p.v=r,p.n=a[1]):d<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,p.n=f,i=0))}if(o||n>1)return l;throw m=!0,r}return function(o,u,f){if(c>1)throw TypeError("Generator is already running");for(m&&1===u&&d(u,f),i=u,s=f;(t=i<2?e:s)||!m;){a||(i?i<3?(i>1&&(p.n=-1),d(i,s)):p.n=s:p.v=s);try{if(c=2,a){if(i||(o="next"),t=a[o]){if(!(t=t.call(a,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=a.return)&&t.call(a),i<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),i=1);a=e}else if((t=(m=p.n<0)?s:n.call(r,p))!==l)break}catch(t){a=e,i=1,s=t}finally{c=1}}return{value:t,done:m}}}(n,o,a),!0),c}var l={};function i(){}function s(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Hn(t={},r,function(){return this}),t),m=c.prototype=i.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,Hn(e,o,"GeneratorFunction")),e.prototype=Object.create(m),e}return s.prototype=c,Hn(m,"constructor",c),Hn(c,"constructor",s),s.displayName="GeneratorFunction",Hn(c,o,"GeneratorFunction"),Hn(m),Hn(m,o,"Generator"),Hn(m,r,function(){return this}),Hn(m,"toString",function(){return"[object Generator]"}),(Bn=function(){return{w:a,m:p}})()}function Hn(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Hn=function(e,t,n,r){if(t)o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{var a=function(t,n){Hn(e,t,function(e){return this._invoke(t,n,e)})};a("next",0),a("throw",1),a("return",2)}},Hn(e,t,n,r)}function Un(e,t,n,r,o,a,l){try{var i=e[a](l),s=i.value}catch(e){return void n(e)}i.done?t(s):Promise.resolve(s).then(r,o)}function $n(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){Un(a,r,o,l,i,"next",e)}function i(e){Un(a,r,o,l,i,"throw",e)}l(void 0)})}}function Zn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],s=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Kn(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Kn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Kn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Yn=(0,t.createContext)(),Xn=function(e){var n=e.children,r=Zn((0,t.useState)([]),2),o=r[0],a=r[1],l=Zn((0,t.useState)(!0),2),i=l[0],s=l[1],c=Zn((0,t.useState)(!0),2),u=c[0],m=c[1],p=Zn((0,t.useState)({environment:"live",location:"",modifierSyncing:!0,importCategoryType:"categories",iventory:{isFetching:0},squareAuto:{isActive:!1,stock:!0,sku:!0,title:!0,description:!0,images:!0,price:!0,category:!0,attributesDisabled:!1},wooAuto:{autoCreateProduct:!1,autoWooCreation:!1,isActive:!1,stock:!1,sku:!0,title:!1,description:!1,images:!1,category:!1,price:!1,allLocationsStock:!1},orders:{enabled:!1,transactions:!1,stage:"processing",pickupMethod:"local_pickup",deliveryMethod:"",statusSync:!1,statusSyncWooToSquare:!1,orderImport:!1,orderImportAllLocations:!1,orderable:!1,orderable_location_mapping:{}},cron:{enabled:!1,source:"square",schedule:"hourly",batches:30,data_to_import:{stock:!1,sku:!1,title:!1,description:!1,images:!1,category:!1,price:!1}},customers:{isFetching:0,roleMappings:[],filters:{group:0,segment:0},auto:{squareWoo:{is_active:!1,first_name:!1,last_name:!1,phone:!1,role:!1,address:!1},wooSquare:{is_active:!1,first_name:!1,last_name:!1,phone:!1,role:!1,address:!1}}},loyalty:{enabled:!1,program:null,method:"square",redemptionMethod:"square",redeem:!1},performance:{rateLimiting:!1,rateLimitThreshold:30,rateLimitTimeWindow:60,delayRequests:!1,delayLength:30},accessToken:null,sandboxToken:null,exportStatus:0,exportSynced:1,exportResults:null}),2),d=p[0],f=p[1];(0,t.useEffect)(function(){var e=function(){var e=$n(Bn().m(function e(){var t,n;return Bn().w(function(e){for(;;)switch(e.n){case 0:return console.log("fetch"),s(!0),e.p=1,e.n=2,Vt()({path:"/sws/v1/settings/orderable-locations",method:"GET"});case 2:t=e.v,a(t),s(!1),e.n=4;break;case 3:e.p=3,n=e.v,M.error("Failed to get orderable locations: ".concat(n.message),{autoClose:!1,closeOnClick:!0}),s(!1);case 4:return e.a(2)}},e,null,[[1,3]])}));return function(){return e.apply(this,arguments)}}();e()},[]),(0,t.useEffect)(function(){var e=function(){var e=$n(Bn().m(function e(){var t,n;return Bn().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,e.n=1,Vt()({path:"/sws/v1/settings",method:"GET"});case 1:t=e.v,f(function(e){return Wn(Wn({},e),t)}),m(!1),e.n=3;break;case 2:e.p=2,n=e.v,m(!1),M({render:"Failed to update settings: "+n.message,type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0});case 3:return e.a(2)}},e,null,[[0,2]])}));return function(){return e.apply(this,arguments)}}();e()},[]);var g=function(){var e=$n(Bn().m(function e(t,n){var r,o,a;return Bn().w(function(e){for(;;)switch(e.n){case 0:return r=M.loading("Updating setting: ".concat(t)),e.p=1,e.n=2,Vt()({path:"/sws/v1/settings",method:"POST",data:zn({},t,n)});case 2:(o=e.v)&&(M.update(r,{render:"".concat(t," updated successfully"),type:"success",isLoading:!1,autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),f(function(e){return Wn(Wn({},e),o)})),e.n=4;break;case 3:e.p=3,a=e.v,M.update(r,{render:"Failed to update ".concat(t,": ").concat(a.message),type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0});case 4:return e.a(2)}},e,null,[[1,3]])}));return function(_x,t){return e.apply(this,arguments)}}(),h=function(){var e=$n(Bn().m(function e(){var t,n,r=arguments;return Bn().w(function(e){for(;;)switch(e.n){case 0:return(r.length>0&&void 0!==r[0]?r[0]:{}).silent,e.p=1,e.n=2,Vt()({path:"/sws/v1/settings/access-token",method:"GET"});case 2:200===(t=e.v).status&&f(function(e){return Wn(Wn({},e),{},{accessToken:t.access_token})}),e.n=4;break;case 3:throw e.p=3,n=e.v,M.error("Failed to retrieve access token: ".concat(n.message)),n;case 4:return e.a(2)}},e,null,[[1,3]])}));return function(){return e.apply(this,arguments)}}();(0,t.useEffect)(function(){h()},[]);var y=function(){var e=$n(Bn().m(function e(t){var n,r,o;return Bn().w(function(e){for(;;)switch(e.n){case 0:return n=M.loading("Updating access token"),e.p=1,e.n=2,Vt()({path:"/sws/v1/settings/access-token",method:"POST",data:{access_token:t}});case 2:if(200!==(r=e.v).status){e.n=3;break}f(function(e){return Wn(Wn({},e),{},{accessToken:t})}),M.update(n,{render:"Access token updated successfully",type:"success",isLoading:!1,autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),e.n=4;break;case 3:throw new Error(r.message);case 4:e.n=6;break;case 5:e.p=5,o=e.v,M.update(n,{render:"Failed to update access token: ".concat(o.message),type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0});case 6:return e.a(2)}},e,null,[[1,5]])}));return function(t){return e.apply(this,arguments)}}(),v=function(){var e=$n(Bn().m(function e(){var t,n;return Bn().w(function(e){for(;;)switch(e.n){case 0:return t=M.loading("Removing access token"),e.p=1,e.n=2,Vt()({path:"/sws/v1/settings/access-token",method:"DELETE"});case 2:f(function(e){return Wn(Wn({},e),{},{accessToken:null})}),M.update(t,{render:"Access token removed successfully",type:"success",isLoading:!1,autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),e.n=4;break;case 3:e.p=3,n=e.v,M.update(t,{render:"Failed to remove access token: ".concat(n.message),type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0});case 4:return e.a(2)}},e,null,[[1,3]])}));return function(){return e.apply(this,arguments)}}(),b=function(){var e=$n(Bn().m(function e(t){var n,r,o;return Bn().w(function(e){for(;;)switch(e.n){case 0:return n=M.loading("Updating sandbox access token"),e.p=1,e.n=2,Vt()({path:"/sws/v1/settings/access-token-sandbox",method:"POST",data:{access_token:t}});case 2:if(200!==(r=e.v).status){e.n=3;break}f(function(e){return Wn(Wn({},e),{},{sandboxToken:t})}),M.update(n,{render:"Sandbox access token updated successfully",type:"success",isLoading:!1,autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),e.n=4;break;case 3:throw new Error(r.message);case 4:e.n=6;break;case 5:e.p=5,o=e.v,M.update(n,{render:"Failed to update access token: ".concat(o.message),type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0});case 6:return e.a(2)}},e,null,[[1,5]])}));return function(t){return e.apply(this,arguments)}}(),w=function(){var e=$n(Bn().m(function e(){var t,n;return Bn().w(function(e){for(;;)switch(e.n){case 0:return t=M.loading("Removing sandbox access token"),e.p=1,e.n=2,Vt()({path:"/sws/v1/settings/access-token-sandbox",method:"DELETE"});case 2:f(function(e){return Wn(Wn({},e),{},{sandboxToken:null})}),M.update(t,{render:"Sandbox access token removed successfully",type:"success",isLoading:!1,autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),e.n=4;break;case 3:e.p=3,n=e.v,M.update(t,{render:"Failed to remove sandbox access token: ".concat(n.message),type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0});case 4:return e.a(2)}},e,null,[[1,3]])}));return function(){return e.apply(this,arguments)}}(),E=Zn((0,t.useState)(),2),x=E[0],S=E[1],k=Zn((0,t.useState)(!0),2),O=k[0],N=k[1];(0,t.useEffect)(function(){var e=function(){var e=$n(Bn().m(function e(){return Bn().w(function(e){for(;;)switch(e.n){case 0:Vt()({path:"/sws/v1/settings/get-gateway-settings",method:"GET"}).then(function(e){S(function(t){return Wn(Wn({},t),e)}),N(!1)}).catch(function(e){N(!1),M({render:"Failed to update settings: "+e.message,type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0})});case 1:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}();e()},[]);var C=Zn((0,t.useState)([]),2),j=C[0],P=C[1],R=Zn((0,t.useState)(!0),2),_=R[0],A=R[1];return(0,t.useEffect)(function(){A(!0);var e=function(){var e=$n(Bn().m(function e(){return Bn().w(function(e){for(;;)switch(e.n){case 0:Vt()({path:"/sws/v1/settings/get-shipping-methods",method:"GET"}).then(function(e){P(e),A(!1)}).catch(function(e){M({render:"Failed to get shipping methods: "+e.message,type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0}),A(!1)});case 1:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}();e()},[]),wp.element.createElement(Yn.Provider,{value:{settings:d,updateSettings:g,settingsLoading:u,getAccessToken:h,updateSandboxToken:b,removeSandboxToken:w,updateAccessToken:y,removeAccessToken:v,gatewaySettings:x,gatewayLoading:O,shippingMethods:j,shippingMethodsLoading:_,orderableLocations:o,orderableLocationsLoading:i}},n)},Jn=function(){return(0,t.useContext)(Yn)};const Qn=function(){var e,t,n,r,o=Jn(),a=o.settings,l=o.gatewaySettings,i=o.gatewayLoading;return wp.element.createElement("div",{className:"col-span-full grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 items-stretch gap-6"},wp.element.createElement(En,{orders:a.orders,gatewaySettings:l,gatewayLoading:i}),wp.element.createElement(vn,{wooAuto:a.wooAuto}),wp.element.createElement(bn,{squareAuto:a.squareAuto}),wp.element.createElement(yn,null),wp.element.createElement(wn,{wooAuto:a.wooAuto}),wp.element.createElement(jn,{wooAuto:a.wooAuto,squareAuto:a.squareAuto}),wp.element.createElement(kn,{squareWoo:null!==(e=null===(t=a.customers)||void 0===t||null===(t=t.auto)||void 0===t?void 0:t.squareWoo)&&void 0!==e?e:{is_active:!1,first_name:!1,last_name:!1,phone:!1,role:!1,address:!1}}),wp.element.createElement(On,{wooSquare:null!==(n=null===(r=a.customers)||void 0===r||null===(r=r.auto)||void 0===r?void 0:r.wooSquare)&&void 0!==n?n:{is_active:!1,first_name:!1,last_name:!1,phone:!1,role:!1,address:!1}}))};function er(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map(function(e){return"'"+e+"'"}).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function tr(e){return!!e&&!!e[Vr]}function nr(e){var t;return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===Wr}(e)||Array.isArray(e)||!!e[qr]||!!(null===(t=e.constructor)||void 0===t?void 0:t[qr])||sr(e)||cr(e))}function rr(e,t,n){void 0===n&&(n=!1),0===or(e)?(n?Object.keys:zr)(e).forEach(function(r){n&&"symbol"==typeof r||t(r,e[r],e)}):e.forEach(function(n,r){return t(r,n,e)})}function or(e){var t=e[Vr];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:sr(e)?2:cr(e)?3:0}function ar(e,t){return 2===or(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function lr(e,t,n){var r=or(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function ir(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function sr(e){return Mr&&e instanceof Map}function cr(e){return Lr&&e instanceof Set}function ur(e){return e.o||e.t}function mr(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Br(e);delete t[Vr];for(var n=zr(t),r=0;r<n.length;r++){var o=n[r],a=t[o];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[o]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[o]})}return Object.create(Object.getPrototypeOf(e),t)}function pr(e,t){return void 0===t&&(t=!1),fr(e)||tr(e)||!nr(e)||(or(e)>1&&(e.set=e.add=e.clear=e.delete=dr),Object.freeze(e),t&&rr(e,function(e,t){return pr(t,!0)},!0)),e}function dr(){er(2)}function fr(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function gr(e){var t=Hr[e];return t||er(18,e),t}function hr(){return Tr}function yr(e,t){t&&(gr("Patches"),e.u=[],e.s=[],e.v=t)}function vr(e){br(e),e.p.forEach(Er),e.p=null}function br(e){e===Tr&&(Tr=e.l)}function wr(e){return Tr={p:[],l:Tr,h:e,m:!0,_:0}}function Er(e){var t=e[Vr];0===t.i||1===t.i?t.j():t.g=!0}function xr(e,t){t._=t.p.length;var n=t.p[0],r=void 0!==e&&e!==n;return t.h.O||gr("ES5").S(t,e,r),r?(n[Vr].P&&(vr(t),er(4)),nr(e)&&(e=Sr(t,e),t.l||Or(t,e)),t.u&&gr("Patches").M(n[Vr].t,e,t.u,t.s)):e=Sr(t,n,[]),vr(t),t.u&&t.v(t.u,t.s),e!==Gr?e:void 0}function Sr(e,t,n){if(fr(t))return t;var r=t[Vr];if(!r)return rr(t,function(o,a){return kr(e,r,t,o,a,n)},!0),t;if(r.A!==e)return t;if(!r.P)return Or(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var o=4===r.i||5===r.i?r.o=mr(r.k):r.o,a=o,l=!1;3===r.i&&(a=new Set(o),o.clear(),l=!0),rr(a,function(t,a){return kr(e,r,o,t,a,n,l)}),Or(e,o,!1),n&&e.u&&gr("Patches").N(r,n,e.u,e.s)}return r.o}function kr(e,t,n,r,o,a,l){if(tr(o)){var i=Sr(e,o,a&&t&&3!==t.i&&!ar(t.R,r)?a.concat(r):void 0);if(lr(n,r,i),!tr(i))return;e.m=!1}else l&&n.add(o);if(nr(o)&&!fr(o)){if(!e.h.D&&e._<1)return;Sr(e,o),t&&t.A.l||Or(e,o)}}function Or(e,t,n){void 0===n&&(n=!1),!e.l&&e.h.D&&e.m&&pr(t,n)}function Nr(e,t){var n=e[Vr];return(n?ur(n):e)[t]}function Cr(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function jr(e){e.P||(e.P=!0,e.l&&jr(e.l))}function Pr(e){e.o||(e.o=mr(e.t))}function Rr(e,t,n){var r=sr(t)?gr("MapSet").F(t,n):cr(t)?gr("MapSet").T(t,n):e.O?function(e,t){var n=Array.isArray(e),r={i:n?1:0,A:t?t.A:hr(),P:!1,I:!1,R:{},l:t,t:e,k:null,o:null,j:null,C:!1},o=r,a=Ur;n&&(o=[r],a=$r);var l=Proxy.revocable(o,a),i=l.revoke,s=l.proxy;return r.k=s,r.j=i,s}(t,n):gr("ES5").J(t,n);return(n?n.A:hr()).p.push(r),r}function _r(e){return tr(e)||er(22,e),function e(t){if(!nr(t))return t;var n,r=t[Vr],o=or(t);if(r){if(!r.P&&(r.i<4||!gr("ES5").K(r)))return r.t;r.I=!0,n=Ar(t,o),r.I=!1}else n=Ar(t,o);return rr(n,function(t,o){r&&function(e,t){return 2===or(e)?e.get(t):e[t]}(r.t,t)===o||lr(n,t,e(o))}),3===o?new Set(n):n}(e)}function Ar(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return mr(e)}var Ir,Tr,Fr="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),Mr="undefined"!=typeof Map,Lr="undefined"!=typeof Set,Dr="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,Gr=Fr?Symbol.for("immer-nothing"):((Ir={})["immer-nothing"]=!0,Ir),qr=Fr?Symbol.for("immer-draftable"):"__$immer_draftable",Vr=Fr?Symbol.for("immer-state"):"__$immer_state",Wr=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),zr="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Br=Object.getOwnPropertyDescriptors||function(e){var t={};return zr(e).forEach(function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)}),t},Hr={},Ur={get:function(e,t){if(t===Vr)return e;var n=ur(e);if(!ar(n,t))return function(e,t,n){var r,o=Cr(t,n);return o?"value"in o?o.value:null===(r=o.get)||void 0===r?void 0:r.call(e.k):void 0}(e,n,t);var r=n[t];return e.I||!nr(r)?r:r===Nr(e.t,t)?(Pr(e),e.o[t]=Rr(e.A.h,r,e)):r},has:function(e,t){return t in ur(e)},ownKeys:function(e){return Reflect.ownKeys(ur(e))},set:function(e,t,n){var r=Cr(ur(e),t);if(null==r?void 0:r.set)return r.set.call(e.k,n),!0;if(!e.P){var o=Nr(ur(e),t),a=null==o?void 0:o[Vr];if(a&&a.t===n)return e.o[t]=n,e.R[t]=!1,!0;if(ir(n,o)&&(void 0!==n||ar(e.t,t)))return!0;Pr(e),jr(e)}return e.o[t]===n&&(void 0!==n||t in e.o)||Number.isNaN(n)&&Number.isNaN(e.o[t])||(e.o[t]=n,e.R[t]=!0),!0},deleteProperty:function(e,t){return void 0!==Nr(e.t,t)||t in e.t?(e.R[t]=!1,Pr(e),jr(e)):delete e.R[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=ur(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty:function(){er(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){er(12)}},$r={};rr(Ur,function(e,t){$r[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),$r.deleteProperty=function(e,t){return $r.set.call(this,e,t,void 0)},$r.set=function(e,t,n){return Ur.set.call(this,e[0],t,n,e[0])};var Zr=function(){function e(e){var t=this;this.O=Dr,this.D=!0,this.produce=function(e,n,r){if("function"==typeof e&&"function"!=typeof n){var o=n;n=e;var a=t;return function(e){var t=this;void 0===e&&(e=o);for(var r=arguments.length,l=Array(r>1?r-1:0),i=1;i<r;i++)l[i-1]=arguments[i];return a.produce(e,function(e){var r;return(r=n).call.apply(r,[t,e].concat(l))})}}var l;if("function"!=typeof n&&er(6),void 0!==r&&"function"!=typeof r&&er(7),nr(e)){var i=wr(t),s=Rr(t,e,void 0),c=!0;try{l=n(s),c=!1}finally{c?vr(i):br(i)}return"undefined"!=typeof Promise&&l instanceof Promise?l.then(function(e){return yr(i,r),xr(e,i)},function(e){throw vr(i),e}):(yr(i,r),xr(l,i))}if(!e||"object"!=typeof e){if(void 0===(l=n(e))&&(l=e),l===Gr&&(l=void 0),t.D&&pr(l,!0),r){var u=[],m=[];gr("Patches").M(e,l,u,m),r(u,m)}return l}er(21,e)},this.produceWithPatches=function(e,n){if("function"==typeof e)return function(n){for(var r=arguments.length,o=Array(r>1?r-1:0),a=1;a<r;a++)o[a-1]=arguments[a];return t.produceWithPatches(n,function(t){return e.apply(void 0,[t].concat(o))})};var r,o,a=t.produce(e,n,function(e,t){r=e,o=t});return"undefined"!=typeof Promise&&a instanceof Promise?a.then(function(e){return[e,r,o]}):[a,r,o]},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){nr(e)||er(8),tr(e)&&(e=_r(e));var t=wr(this),n=Rr(this,e,void 0);return n[Vr].C=!0,br(t),n},t.finishDraft=function(e,t){var n=(e&&e[Vr]).A;return yr(n,t),xr(void 0,n)},t.setAutoFreeze=function(e){this.D=e},t.setUseProxies=function(e){e&&!Dr&&er(20),this.O=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));var o=gr("Patches").$;return tr(e)?o(e,t):this.produce(e,function(e){return o(e,t)})},e}(),Kr=new Zr,Yr=Kr.produce;Kr.produceWithPatches.bind(Kr),Kr.setAutoFreeze.bind(Kr),Kr.setUseProxies.bind(Kr),Kr.applyPatches.bind(Kr),Kr.createDraft.bind(Kr),Kr.finishDraft.bind(Kr);const Xr=Yr;function Jr(e){return Jr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Jr(e)}function Qr(e,t,n){return(t=function(e){var t=function(e){if("object"!=Jr(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Jr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Jr(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function to(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?eo(Object(n),!0).forEach(function(t){Qr(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):eo(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function no(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var ro="function"==typeof Symbol&&Symbol.observable||"@@observable",oo=function(){return Math.random().toString(36).substring(7).split("").join(".")},ao={INIT:"@@redux/INIT"+oo(),REPLACE:"@@redux/REPLACE"+oo(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+oo()}};function lo(e,t,n){var r;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(no(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(no(1));return n(lo)(e,t)}if("function"!=typeof e)throw new Error(no(2));var o=e,a=t,l=[],i=l,s=!1;function c(){i===l&&(i=l.slice())}function u(){if(s)throw new Error(no(3));return a}function m(e){if("function"!=typeof e)throw new Error(no(4));if(s)throw new Error(no(5));var t=!0;return c(),i.push(e),function(){if(t){if(s)throw new Error(no(6));t=!1,c();var n=i.indexOf(e);i.splice(n,1),l=null}}}function p(e){if(!function(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(e))throw new Error(no(7));if(void 0===e.type)throw new Error(no(8));if(s)throw new Error(no(9));try{s=!0,a=o(a,e)}finally{s=!1}for(var t=l=i,n=0;n<t.length;n++)(0,t[n])();return e}return p({type:ao.INIT}),(r={dispatch:p,subscribe:m,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw new Error(no(10));o=e,p({type:ao.REPLACE})}})[ro]=function(){var e,t=m;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(no(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[ro]=function(){return this},e},r}function io(e){for(var t=Object.keys(e),n={},r=0;r<t.length;r++){var o=t[r];"function"==typeof e[o]&&(n[o]=e[o])}var a,l=Object.keys(n);try{!function(e){Object.keys(e).forEach(function(t){var n=e[t];if(void 0===n(void 0,{type:ao.INIT}))throw new Error(no(12));if(void 0===n(void 0,{type:ao.PROBE_UNKNOWN_ACTION()}))throw new Error(no(13))})}(n)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var r=!1,o={},i=0;i<l.length;i++){var s=l[i],c=n[s],u=e[s],m=c(u,t);if(void 0===m)throw t&&t.type,new Error(no(14));o[s]=m,r=r||m!==u}return(r=r||l.length!==Object.keys(e).length)?o:e}}function so(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce(function(e,t){return function(){return e(t.apply(void 0,arguments))}})}function co(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),r=function(){throw new Error(no(15))},o={getState:n.getState,dispatch:function(){return r.apply(void 0,arguments)}},a=t.map(function(e){return e(o)});return r=so.apply(void 0,a)(n.dispatch),to(to({},n),{},{dispatch:r})}}}function uo(e){return function(t){var n=t.dispatch,r=t.getState;return function(t){return function(o){return"function"==typeof o?o(n,r,e):t(o)}}}}var mo=uo();mo.withExtraArgument=uo;const po=mo;var fo,go=(fo=function(e,t){return fo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},fo(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function __(){this.constructor=e}fo(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}),ho=function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e},yo=Object.defineProperty,vo=Object.defineProperties,bo=Object.getOwnPropertyDescriptors,wo=Object.getOwnPropertySymbols,Eo=Object.prototype.hasOwnProperty,xo=Object.prototype.propertyIsEnumerable,So=function(e,t,n){return t in e?yo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},ko=function(e,t){for(var n in t||(t={}))Eo.call(t,n)&&So(e,n,t[n]);if(wo)for(var r=0,o=wo(t);r<o.length;r++)n=o[r],xo.call(t,n)&&So(e,n,t[n]);return e},Oo=function(e,t){return vo(e,bo(t))},No="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?so:so.apply(null,arguments)};function Co(e,t){function n(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];if(t){var o=t.apply(void 0,n);if(!o)throw new Error("prepareAction did not return an object");return ko(ko({type:e,payload:o.payload},"meta"in o&&{meta:o.meta}),"error"in o&&{error:o.error})}return{type:e,payload:n[0]}}return n.toString=function(){return""+e},n.type=e,n.match=function(t){return t.type===e},n}"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var jo=function(e){function t(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var o=e.apply(this,n)||this;return Object.setPrototypeOf(o,t.prototype),o}return go(t,e),Object.defineProperty(t,Symbol.species,{get:function(){return t},enumerable:!1,configurable:!0}),t.prototype.concat=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.prototype.concat.apply(this,t)},t.prototype.prepend=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return 1===e.length&&Array.isArray(e[0])?new(t.bind.apply(t,ho([void 0],e[0].concat(this)))):new(t.bind.apply(t,ho([void 0],e.concat(this))))},t}(Array),Po=function(e){function t(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var o=e.apply(this,n)||this;return Object.setPrototypeOf(o,t.prototype),o}return go(t,e),Object.defineProperty(t,Symbol.species,{get:function(){return t},enumerable:!1,configurable:!0}),t.prototype.concat=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.prototype.concat.apply(this,t)},t.prototype.prepend=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return 1===e.length&&Array.isArray(e[0])?new(t.bind.apply(t,ho([void 0],e[0].concat(this)))):new(t.bind.apply(t,ho([void 0],e.concat(this))))},t}(Array);function Ro(e){return nr(e)?Xr(e,function(){}):e}function _o(e){var t,n={},r=[],o={addCase:function(e,t){var r="string"==typeof e?e:e.type;if(!r)throw new Error("`builder.addCase` cannot be called with an empty action type");if(r in n)throw new Error("`builder.addCase` cannot be called with two reducers for the same action type");return n[r]=t,o},addMatcher:function(e,t){return r.push({matcher:e,reducer:t}),o},addDefaultCase:function(e){return t=e,o}};return e(o),[n,r,t]}function Ao(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");var n,r="function"==typeof e.initialState?e.initialState:Ro(e.initialState),o=e.reducers||{},a=Object.keys(o),l={},i={},s={};function c(){var t="function"==typeof e.extraReducers?_o(e.extraReducers):[e.extraReducers],n=t[0],o=void 0===n?{}:n,a=t[1],l=void 0===a?[]:a,s=t[2],c=void 0===s?void 0:s,u=ko(ko({},o),i);return function(e,t,n){void 0===n&&(n=[]);var r,o=_o(t),a=o[0],l=o[1],i=o[2];if("function"==typeof e)r=function(){return Ro(e())};else{var s=Ro(e);r=function(){return s}}function c(e,t){void 0===e&&(e=r());var n=ho([a[t.type]],l.filter(function(e){return(0,e.matcher)(t)}).map(function(e){return e.reducer}));return 0===n.filter(function(e){return!!e}).length&&(n=[i]),n.reduce(function(e,n){if(n){var r;if(tr(e))return void 0===(r=n(e,t))?e:r;if(nr(e))return Xr(e,function(e){return n(e,t)});if(void 0===(r=n(e,t))){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return r}return e},e)}return c.getInitialState=r,c}(r,function(e){for(var t in u)e.addCase(t,u[t]);for(var n=0,r=l;n<r.length;n++){var o=r[n];e.addMatcher(o.matcher,o.reducer)}c&&e.addDefaultCase(c)})}return a.forEach(function(e){var n,r,a=o[e],c=t+"/"+e;"reducer"in a?(n=a.reducer,r=a.prepare):n=a,l[e]=n,i[c]=n,s[e]=r?Co(c,r):Co(c)}),{name:t,reducer:function(e,t){return n||(n=c()),n(e,t)},actions:s,caseReducers:l,getInitialState:function(){return n||(n=c()),n.getInitialState()}}}var Io=["name","message","stack","code"],To=function(e,t){this.payload=e,this.meta=t},Fo=function(e,t){this.payload=e,this.meta=t},Mo=function(e){if("object"==typeof e&&null!==e){for(var t={},n=0,r=Io;n<r.length;n++){var o=r[n];"string"==typeof e[o]&&(t[o]=e[o])}return t}return{message:String(e)}},Lo=function(){function e(e,t,n){var r=Co(e+"/fulfilled",function(e,t,n,r){return{payload:e,meta:Oo(ko({},r||{}),{arg:n,requestId:t,requestStatus:"fulfilled"})}}),o=Co(e+"/pending",function(e,t,n){return{payload:void 0,meta:Oo(ko({},n||{}),{arg:t,requestId:e,requestStatus:"pending"})}}),a=Co(e+"/rejected",function(e,t,r,o,a){return{payload:o,error:(n&&n.serializeError||Mo)(e||"Rejected"),meta:Oo(ko({},a||{}),{arg:r,requestId:t,rejectedWithValue:!!o,requestStatus:"rejected",aborted:"AbortError"===(null==e?void 0:e.name),condition:"ConditionError"===(null==e?void 0:e.name)})}}),l="undefined"!=typeof AbortController?AbortController:function(){function e(){this.signal={aborted:!1,addEventListener:function(){},dispatchEvent:function(){return!1},onabort:function(){},removeEventListener:function(){},reason:void 0,throwIfAborted:function(){}}}return e.prototype.abort=function(){},e}();return Object.assign(function(e){return function(i,s,c){var u,m=(null==n?void 0:n.idGenerator)?n.idGenerator(e):function(e){void 0===e&&(e=21);for(var t="",n=e;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t}(),p=new l;function d(e){u=e,p.abort()}var f=function(){return l=this,f=null,g=function(){var l,f,g,h,y,v;return function(e,t){var n,r,o,a,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;l;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return l.label++,{value:a[1],done:!1};case 5:l.label++,r=a[1],a=[0];continue;case 7:a=l.ops.pop(),l.trys.pop();continue;default:if(!((o=(o=l.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){l=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){l.label=a[1];break}if(6===a[0]&&l.label<o[1]){l.label=o[1],o=a;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(a);break}o[2]&&l.ops.pop(),l.trys.pop();continue}a=t.call(e,l)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,i])}}}(this,function(b){switch(b.label){case 0:return b.trys.push([0,4,,5]),null===(w=h=null==(l=null==n?void 0:n.condition)?void 0:l.call(n,e,{getState:s,extra:c}))||"object"!=typeof w||"function"!=typeof w.then?[3,2]:[4,h];case 1:h=b.sent(),b.label=2;case 2:if(!1===h||p.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};return y=new Promise(function(e,t){return p.signal.addEventListener("abort",function(){return t({name:"AbortError",message:u||"Aborted"})})}),i(o(m,e,null==(f=null==n?void 0:n.getPendingMeta)?void 0:f.call(n,{requestId:m,arg:e},{getState:s,extra:c}))),[4,Promise.race([y,Promise.resolve(t(e,{dispatch:i,getState:s,extra:c,requestId:m,signal:p.signal,abort:d,rejectWithValue:function(e,t){return new To(e,t)},fulfillWithValue:function(e,t){return new Fo(e,t)}})).then(function(t){if(t instanceof To)throw t;return t instanceof Fo?r(t.payload,m,e,t.meta):r(t,m,e)})])];case 3:return g=b.sent(),[3,5];case 4:return v=b.sent(),g=v instanceof To?a(null,m,e,v.payload,v.meta):a(v,m,e),[3,5];case 5:return n&&!n.dispatchConditionRejection&&a.match(g)&&g.meta.condition||i(g),[2,g]}var w})},new Promise(function(e,t){var n=function(e){try{o(g.next(e))}catch(e){t(e)}},r=function(e){try{o(g.throw(e))}catch(e){t(e)}},o=function(t){return t.done?e(t.value):Promise.resolve(t.value).then(n,r)};o((g=g.apply(l,f)).next())});var l,f,g}();return Object.assign(f,{abort:d,requestId:m,arg:e,unwrap:function(){return f.then(Do)}})}},{pending:o,rejected:a,fulfilled:r,typePrefix:e})}return e.withTypes=function(){return e},e}();function Do(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}Object.assign;var Go="listenerMiddleware";Co(Go+"/add"),Co(Go+"/removeAll"),Co(Go+"/remove"),"function"==typeof queueMicrotask&&queueMicrotask.bind("undefined"!=typeof window?window:void 0!==o.g?o.g:globalThis);function qo(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var s=r&&r.prototype instanceof i?r:i,c=Object.create(s.prototype);return Vo(c,"_invoke",function(n,r,o){var a,i,s,c=0,u=o||[],m=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return a=t,i=0,s=e,p.n=n,l}};function d(n,r){for(i=n,s=r,t=0;!m&&c&&!o&&t<u.length;t++){var o,a=u[t],d=p.p,f=a[2];n>3?(o=f===r)&&(s=a[(i=a[4])?5:(i=3,3)],a[4]=a[5]=e):a[0]<=d&&((o=n<2&&d<a[1])?(i=0,p.v=r,p.n=a[1]):d<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,p.n=f,i=0))}if(o||n>1)return l;throw m=!0,r}return function(o,u,f){if(c>1)throw TypeError("Generator is already running");for(m&&1===u&&d(u,f),i=u,s=f;(t=i<2?e:s)||!m;){a||(i?i<3?(i>1&&(p.n=-1),d(i,s)):p.n=s:p.v=s);try{if(c=2,a){if(i||(o="next"),t=a[o]){if(!(t=t.call(a,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=a.return)&&t.call(a),i<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),i=1);a=e}else if((t=(m=p.n<0)?s:n.call(r,p))!==l)break}catch(t){a=e,i=1,s=t}finally{c=1}}return{value:t,done:m}}}(n,o,a),!0),c}var l={};function i(){}function s(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Vo(t={},r,function(){return this}),t),m=c.prototype=i.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,Vo(e,o,"GeneratorFunction")),e.prototype=Object.create(m),e}return s.prototype=c,Vo(m,"constructor",c),Vo(c,"constructor",s),s.displayName="GeneratorFunction",Vo(c,o,"GeneratorFunction"),Vo(m),Vo(m,o,"Generator"),Vo(m,r,function(){return this}),Vo(m,"toString",function(){return"[object Generator]"}),(qo=function(){return{w:a,m:p}})()}function Vo(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Vo=function(e,t,n,r){if(t)o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{var a=function(t,n){Vo(e,t,function(e){return this._invoke(t,n,e)})};a("next",0),a("throw",1),a("return",2)}},Vo(e,t,n,r)}function Wo(e,t,n,r,o,a,l){try{var i=e[a](l),s=i.value}catch(e){return void n(e)}i.done?t(s):Promise.resolve(s).then(r,o)}function zo(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){Wo(a,r,o,l,i,"next",e)}function i(e){Wo(a,r,o,l,i,"throw",e)}l(void 0)})}}"undefined"!=typeof window&&window.requestAnimationFrame&&window.requestAnimationFrame,function(){function e(e,t){var n=o[e];return n?n.enumerable=t:o[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[Vr];return Ur.get(t,e)},set:function(t){var n=this[Vr];Ur.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var o=e[t][Vr];if(!o.P)switch(o.i){case 5:r(o)&&jr(o);break;case 4:n(o)&&jr(o)}}}function n(e){for(var t=e.t,n=e.k,r=zr(n),o=r.length-1;o>=0;o--){var a=r[o];if(a!==Vr){var l=t[a];if(void 0===l&&!ar(t,a))return!0;var i=n[a],s=i&&i[Vr];if(s?s.t!==l:!ir(i,l))return!0}}var c=!!t[Vr];return r.length!==zr(t).length+(c?0:1)}function r(e){var t=e.k;if(t.length!==e.t.length)return!0;var n=Object.getOwnPropertyDescriptor(t,t.length-1);if(n&&!n.get)return!0;for(var r=0;r<t.length;r++)if(!t.hasOwnProperty(r))return!0;return!1}var o={};!function(e,t){Hr[e]||(Hr[e]=t)}("ES5",{J:function(t,n){var r=Array.isArray(t),o=function(t,n){if(t){for(var r=Array(n.length),o=0;o<n.length;o++)Object.defineProperty(r,""+o,e(o,!0));return r}var a=Br(n);delete a[Vr];for(var l=zr(a),i=0;i<l.length;i++){var s=l[i];a[s]=e(s,t||!!a[s].enumerable)}return Object.create(Object.getPrototypeOf(n),a)}(r,t),a={i:r?5:4,A:n?n.A:hr(),P:!1,I:!1,R:{},l:n,t,k:o,o:null,g:!1,C:!1};return Object.defineProperty(o,Vr,{value:a,writable:!0}),o},S:function(e,n,o){o?tr(n)&&n[Vr].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[Vr];if(n){var o=n.t,a=n.k,l=n.R,i=n.i;if(4===i)rr(a,function(t){t!==Vr&&(void 0!==o[t]||ar(o,t)?l[t]||e(a[t]):(l[t]=!0,jr(n)))}),rr(o,function(e){void 0!==a[e]||ar(a,e)||(l[e]=!1,jr(n))});else if(5===i){if(r(n)&&(jr(n),l.length=!0),a.length<o.length)for(var s=a.length;s<o.length;s++)l[s]=!1;else for(var c=o.length;c<a.length;c++)l[c]=!0;for(var u=Math.min(a.length,o.length),m=0;m<u;m++)a.hasOwnProperty(m)||(l[m]=!0),void 0===l[m]&&e(a[m])}}}}(e.p[0]),t(e.p))},K:function(e){return 4===e.i?n(e):r(e)}})}();var Bo=Lo("license/fetchLicense",zo(qo().m(function e(){var t;return qo().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,Ut({path:"/sws/v1/licence"});case 1:return t=e.v,e.a(2,t.licence)}},e)}))),Ho=Ao({name:"license",initialState:{data:{is_valid:!1},loading:!0,error:null},reducers:{removeLicense:function(e){e.data=null},setLicense:function(e,t){e.data=t.payload}},extraReducers:function(e){e.addCase(Bo.pending,function(e){e.loading=!0,e.error=null}).addCase(Bo.fulfilled,function(e,t){e.loading=!1,e.data=t.payload}).addCase(Bo.rejected,function(e,t){e.loading=!1,e.error=t.error.message})}});const Uo=Ho.reducer;function $o(e,t){return"function"==typeof e?e(t):e}function Zo(e,t){return n=>{t.setState(t=>({...t,[e]:$o(n,t[e])}))}}function Ko(e){return e instanceof Function}function Yo(e,t,n){let r,o=[];return a=>{let l;n.key&&n.debug&&(l=Date.now());const i=e(a);if(i.length===o.length&&!i.some((e,t)=>o[t]!==e))return r;let s;if(o=i,n.key&&n.debug&&(s=Date.now()),r=t(...i),null==n||null==n.onChange||n.onChange(r),n.key&&n.debug&&null!=n&&n.debug()){const e=Math.round(100*(Date.now()-l))/100,t=Math.round(100*(Date.now()-s))/100,r=t/16,o=(e,t)=>{for(e=String(e);e.length<t;)e=" "+e;return e};console.info(`%c⏱ ${o(t,5)} /${o(e,5)} ms`,`\n            font-size: .6rem;\n            font-weight: bold;\n            color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,null==n?void 0:n.key)}return r}}function Xo(e,t,n,r){return{debug:()=>{var n;return null!=(n=null==e?void 0:e.debugAll)?n:e[t]},key:!1,onChange:r}}Ho.actions.removeLicense,Ho.actions.setLicense;const Jo="debugHeaders";function Qo(e,t,n){var r;let o={id:null!=(r=n.id)?r:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const e=[],t=n=>{n.subHeaders&&n.subHeaders.length&&n.subHeaders.map(t),e.push(n)};return t(o),e},getContext:()=>({table:e,header:o,column:t})};return e._features.forEach(t=>{null==t.createHeader||t.createHeader(o,e)}),o}const ea={createTable:e=>{e.getHeaderGroups=Yo(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,o)=>{var a,l;const i=null!=(a=null==r?void 0:r.map(e=>n.find(t=>t.id===e)).filter(Boolean))?a:[],s=null!=(l=null==o?void 0:o.map(e=>n.find(t=>t.id===e)).filter(Boolean))?l:[];return ta(t,[...i,...n.filter(e=>!(null!=r&&r.includes(e.id)||null!=o&&o.includes(e.id))),...s],e)},Xo(e.options,Jo)),e.getCenterHeaderGroups=Yo(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,o)=>ta(t,n=n.filter(e=>!(null!=r&&r.includes(e.id)||null!=o&&o.includes(e.id))),e,"center"),Xo(e.options,Jo)),e.getLeftHeaderGroups=Yo(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>{var o;const a=null!=(o=null==r?void 0:r.map(e=>n.find(t=>t.id===e)).filter(Boolean))?o:[];return ta(t,a,e,"left")},Xo(e.options,Jo)),e.getRightHeaderGroups=Yo(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>{var o;const a=null!=(o=null==r?void 0:r.map(e=>n.find(t=>t.id===e)).filter(Boolean))?o:[];return ta(t,a,e,"right")},Xo(e.options,Jo)),e.getFooterGroups=Yo(()=>[e.getHeaderGroups()],e=>[...e].reverse(),Xo(e.options,Jo)),e.getLeftFooterGroups=Yo(()=>[e.getLeftHeaderGroups()],e=>[...e].reverse(),Xo(e.options,Jo)),e.getCenterFooterGroups=Yo(()=>[e.getCenterHeaderGroups()],e=>[...e].reverse(),Xo(e.options,Jo)),e.getRightFooterGroups=Yo(()=>[e.getRightHeaderGroups()],e=>[...e].reverse(),Xo(e.options,Jo)),e.getFlatHeaders=Yo(()=>[e.getHeaderGroups()],e=>e.map(e=>e.headers).flat(),Xo(e.options,Jo)),e.getLeftFlatHeaders=Yo(()=>[e.getLeftHeaderGroups()],e=>e.map(e=>e.headers).flat(),Xo(e.options,Jo)),e.getCenterFlatHeaders=Yo(()=>[e.getCenterHeaderGroups()],e=>e.map(e=>e.headers).flat(),Xo(e.options,Jo)),e.getRightFlatHeaders=Yo(()=>[e.getRightHeaderGroups()],e=>e.map(e=>e.headers).flat(),Xo(e.options,Jo)),e.getCenterLeafHeaders=Yo(()=>[e.getCenterFlatHeaders()],e=>e.filter(e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}),Xo(e.options,Jo)),e.getLeftLeafHeaders=Yo(()=>[e.getLeftFlatHeaders()],e=>e.filter(e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}),Xo(e.options,Jo)),e.getRightLeafHeaders=Yo(()=>[e.getRightFlatHeaders()],e=>e.filter(e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}),Xo(e.options,Jo)),e.getLeafHeaders=Yo(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(e,t,n)=>{var r,o,a,l,i,s;return[...null!=(r=null==(o=e[0])?void 0:o.headers)?r:[],...null!=(a=null==(l=t[0])?void 0:l.headers)?a:[],...null!=(i=null==(s=n[0])?void 0:s.headers)?i:[]].map(e=>e.getLeafHeaders()).flat()},Xo(e.options,Jo))}};function ta(e,t,n,r){var o,a;let l=0;const i=function(e,t){void 0===t&&(t=1),l=Math.max(l,t),e.filter(e=>e.getIsVisible()).forEach(e=>{var n;null!=(n=e.columns)&&n.length&&i(e.columns,t+1)},0)};i(e);let s=[];const c=(e,t)=>{const o={depth:t,id:[r,`${t}`].filter(Boolean).join("_"),headers:[]},a=[];e.forEach(e=>{const l=[...a].reverse()[0];let i,s=!1;if(e.column.depth===o.depth&&e.column.parent?i=e.column.parent:(i=e.column,s=!0),l&&(null==l?void 0:l.column)===i)l.subHeaders.push(e);else{const o=Qo(n,i,{id:[r,t,i.id,null==e?void 0:e.id].filter(Boolean).join("_"),isPlaceholder:s,placeholderId:s?`${a.filter(e=>e.column===i).length}`:void 0,depth:t,index:a.length});o.subHeaders.push(e),a.push(o)}o.headers.push(e),e.headerGroup=o}),s.push(o),t>0&&c(a,t-1)},u=t.map((e,t)=>Qo(n,e,{depth:l,index:t}));c(u,l-1),s.reverse();const m=e=>e.filter(e=>e.column.getIsVisible()).map(e=>{let t=0,n=0,r=[0];return e.subHeaders&&e.subHeaders.length?(r=[],m(e.subHeaders).forEach(e=>{let{colSpan:n,rowSpan:o}=e;t+=n,r.push(o)})):t=1,n+=Math.min(...r),e.colSpan=t,e.rowSpan=n,{colSpan:t,rowSpan:n}});return m(null!=(o=null==(a=s[0])?void 0:a.headers)?o:[]),s}const na=(e,t,n,r,o,a,l)=>{let i={id:t,index:r,original:n,depth:o,parentId:l,_valuesCache:{},_uniqueValuesCache:{},getValue:t=>{if(i._valuesCache.hasOwnProperty(t))return i._valuesCache[t];const n=e.getColumn(t);return null!=n&&n.accessorFn?(i._valuesCache[t]=n.accessorFn(i.original,r),i._valuesCache[t]):void 0},getUniqueValues:t=>{if(i._uniqueValuesCache.hasOwnProperty(t))return i._uniqueValuesCache[t];const n=e.getColumn(t);return null!=n&&n.accessorFn?n.columnDef.getUniqueValues?(i._uniqueValuesCache[t]=n.columnDef.getUniqueValues(i.original,r),i._uniqueValuesCache[t]):(i._uniqueValuesCache[t]=[i.getValue(t)],i._uniqueValuesCache[t]):void 0},renderValue:t=>{var n;return null!=(n=i.getValue(t))?n:e.options.renderFallbackValue},subRows:null!=a?a:[],getLeafRows:()=>function(e,t){const n=[],r=e=>{e.forEach(e=>{n.push(e);const o=t(e);null!=o&&o.length&&r(o)})};return r(e),n}(i.subRows,e=>e.subRows),getParentRow:()=>i.parentId?e.getRow(i.parentId,!0):void 0,getParentRows:()=>{let e=[],t=i;for(;;){const n=t.getParentRow();if(!n)break;e.push(n),t=n}return e.reverse()},getAllCells:Yo(()=>[e.getAllLeafColumns()],t=>t.map(t=>function(e,t,n,r){const o={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(r),renderValue:()=>{var t;return null!=(t=o.getValue())?t:e.options.renderFallbackValue},getContext:Yo(()=>[e,n,t,o],(e,t,n,r)=>({table:e,column:t,row:n,cell:r,getValue:r.getValue,renderValue:r.renderValue}),Xo(e.options,"debugCells"))};return e._features.forEach(r=>{null==r.createCell||r.createCell(o,n,t,e)},{}),o}(e,i,t,t.id)),Xo(e.options,"debugRows")),_getAllCellsByColumnId:Yo(()=>[i.getAllCells()],e=>e.reduce((e,t)=>(e[t.column.id]=t,e),{}),Xo(e.options,"debugRows"))};for(let t=0;t<e._features.length;t++){const n=e._features[t];null==n||null==n.createRow||n.createRow(i,e)}return i},ra={createColumn:(e,t)=>{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},oa=(e,t,n)=>{var r,o;const a=null==n||null==(r=n.toString())?void 0:r.toLowerCase();return Boolean(null==(o=e.getValue(t))||null==(o=o.toString())||null==(o=o.toLowerCase())?void 0:o.includes(a))};oa.autoRemove=e=>fa(e);const aa=(e,t,n)=>{var r;return Boolean(null==(r=e.getValue(t))||null==(r=r.toString())?void 0:r.includes(n))};aa.autoRemove=e=>fa(e);const la=(e,t,n)=>{var r;return(null==(r=e.getValue(t))||null==(r=r.toString())?void 0:r.toLowerCase())===(null==n?void 0:n.toLowerCase())};la.autoRemove=e=>fa(e);const ia=(e,t,n)=>{var r;return null==(r=e.getValue(t))?void 0:r.includes(n)};ia.autoRemove=e=>fa(e);const sa=(e,t,n)=>!n.some(n=>{var r;return!(null!=(r=e.getValue(t))&&r.includes(n))});sa.autoRemove=e=>fa(e)||!(null!=e&&e.length);const ca=(e,t,n)=>n.some(n=>{var r;return null==(r=e.getValue(t))?void 0:r.includes(n)});ca.autoRemove=e=>fa(e)||!(null!=e&&e.length);const ua=(e,t,n)=>e.getValue(t)===n;ua.autoRemove=e=>fa(e);const ma=(e,t,n)=>e.getValue(t)==n;ma.autoRemove=e=>fa(e);const pa=(e,t,n)=>{let[r,o]=n;const a=e.getValue(t);return a>=r&&a<=o};pa.resolveFilterValue=e=>{let[t,n]=e,r="number"!=typeof t?parseFloat(t):t,o="number"!=typeof n?parseFloat(n):n,a=null===t||Number.isNaN(r)?-1/0:r,l=null===n||Number.isNaN(o)?1/0:o;if(a>l){const e=a;a=l,l=e}return[a,l]},pa.autoRemove=e=>fa(e)||fa(e[0])&&fa(e[1]);const da={includesString:oa,includesStringSensitive:aa,equalsString:la,arrIncludes:ia,arrIncludesAll:sa,arrIncludesSome:ca,equals:ua,weakEquals:ma,inNumberRange:pa};function fa(e){return null==e||""===e}const ga={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:Zo("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=null==n?void 0:n.getValue(e.id);return"string"==typeof r?da.includesString:"number"==typeof r?da.inNumberRange:"boolean"==typeof r||null!==r&&"object"==typeof r?da.equals:Array.isArray(r)?da.arrIncludes:da.weakEquals},e.getFilterFn=()=>{var n,r;return Ko(e.columnDef.filterFn)?e.columnDef.filterFn:"auto"===e.columnDef.filterFn?e.getAutoFilterFn():null!=(n=null==(r=t.options.filterFns)?void 0:r[e.columnDef.filterFn])?n:da[e.columnDef.filterFn]},e.getCanFilter=()=>{var n,r,o;return(null==(n=e.columnDef.enableColumnFilter)||n)&&(null==(r=t.options.enableColumnFilters)||r)&&(null==(o=t.options.enableFilters)||o)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return null==(n=t.getState().columnFilters)||null==(n=n.find(t=>t.id===e.id))?void 0:n.value},e.getFilterIndex=()=>{var n,r;return null!=(n=null==(r=t.getState().columnFilters)?void 0:r.findIndex(t=>t.id===e.id))?n:-1},e.setFilterValue=n=>{t.setColumnFilters(t=>{const r=e.getFilterFn(),o=null==t?void 0:t.find(t=>t.id===e.id),a=$o(n,o?o.value:void 0);var l;if(ha(r,a,e))return null!=(l=null==t?void 0:t.filter(t=>t.id!==e.id))?l:[];const i={id:e.id,value:a};var s;return o?null!=(s=null==t?void 0:t.map(t=>t.id===e.id?i:t))?s:[]:null!=t&&t.length?[...t,i]:[i]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{const n=e.getAllLeafColumns();null==e.options.onColumnFiltersChange||e.options.onColumnFiltersChange(e=>{var r;return null==(r=$o(t,e))?void 0:r.filter(e=>{const t=n.find(t=>t.id===e.id);return!t||!ha(t.getFilterFn(),e.value,t)})})},e.resetColumnFilters=t=>{var n,r;e.setColumnFilters(t?[]:null!=(n=null==(r=e.initialState)?void 0:r.columnFilters)?n:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function ha(e,t,n){return!(!e||!e.autoRemove)&&e.autoRemove(t,n)||void 0===t||"string"==typeof t&&!t}const ya={sum:(e,t,n)=>n.reduce((t,n)=>{const r=n.getValue(e);return t+("number"==typeof r?r:0)},0),min:(e,t,n)=>{let r;return n.forEach(t=>{const n=t.getValue(e);null!=n&&(r>n||void 0===r&&n>=n)&&(r=n)}),r},max:(e,t,n)=>{let r;return n.forEach(t=>{const n=t.getValue(e);null!=n&&(r<n||void 0===r&&n>=n)&&(r=n)}),r},extent:(e,t,n)=>{let r,o;return n.forEach(t=>{const n=t.getValue(e);null!=n&&(void 0===r?n>=n&&(r=o=n):(r>n&&(r=n),o<n&&(o=n)))}),[r,o]},mean:(e,t)=>{let n=0,r=0;if(t.forEach(t=>{let o=t.getValue(e);null!=o&&(o=+o)>=o&&(++n,r+=o)}),n)return r/n},median:(e,t)=>{if(!t.length)return;const n=t.map(t=>t.getValue(e));if(!function(e){return Array.isArray(e)&&e.every(e=>"number"==typeof e)}(n))return;if(1===n.length)return n[0];const r=Math.floor(n.length/2),o=n.sort((e,t)=>e-t);return n.length%2!=0?o[r]:(o[r-1]+o[r])/2},unique:(e,t)=>Array.from(new Set(t.map(t=>t.getValue(e))).values()),uniqueCount:(e,t)=>new Set(t.map(t=>t.getValue(e))).size,count:(e,t)=>t.length},va={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return null!=(t=null==(n=e.getValue())||null==n.toString?void 0:n.toString())?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:Zo("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(t=>null!=t&&t.includes(e.id)?t.filter(t=>t!==e.id):[...null!=t?t:[],e.id])},e.getCanGroup=()=>{var n,r;return(null==(n=e.columnDef.enableGrouping)||n)&&(null==(r=t.options.enableGrouping)||r)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var n;return null==(n=t.getState().grouping)?void 0:n.includes(e.id)},e.getGroupedIndex=()=>{var n;return null==(n=t.getState().grouping)?void 0:n.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=null==n?void 0:n.getValue(e.id);return"number"==typeof r?ya.sum:"[object Date]"===Object.prototype.toString.call(r)?ya.extent:void 0},e.getAggregationFn=()=>{var n,r;if(!e)throw new Error;return Ko(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:"auto"===e.columnDef.aggregationFn?e.getAutoAggregationFn():null!=(n=null==(r=t.options.aggregationFns)?void 0:r[e.columnDef.aggregationFn])?n:ya[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>null==e.options.onGroupingChange?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var n,r;e.setGrouping(t?[]:null!=(n=null==(r=e.initialState)?void 0:r.grouping)?n:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];const r=t.getColumn(n);return null!=r&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,r)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var t;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!(null==(t=n.subRows)||!t.length)}}},ba={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Zo("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=Yo(e=>[Na(t,e)],t=>t.findIndex(t=>t.id===e.id),Xo(t.options,"debugColumns")),e.getIsFirstColumn=n=>{var r;return(null==(r=Na(t,n)[0])?void 0:r.id)===e.id},e.getIsLastColumn=n=>{var r;const o=Na(t,n);return(null==(r=o[o.length-1])?void 0:r.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>null==e.options.onColumnOrderChange?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var n;e.setColumnOrder(t?[]:null!=(n=e.initialState.columnOrder)?n:[])},e._getOrderColumnsFn=Yo(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(e,t,n)=>r=>{let o=[];if(null!=e&&e.length){const t=[...e],n=[...r];for(;n.length&&t.length;){const e=t.shift(),r=n.findIndex(t=>t.id===e);r>-1&&o.push(n.splice(r,1)[0])}o=[...o,...n]}else o=r;return function(e,t,n){if(null==t||!t.length||!n)return e;const r=e.filter(e=>!t.includes(e.id));if("remove"===n)return r;return[...t.map(t=>e.find(e=>e.id===t)).filter(Boolean),...r]}(o,t,n)},Xo(e.options,"debugTable"))}},wa={getInitialState:e=>({columnPinning:{left:[],right:[]},...e}),getDefaultOptions:e=>({onColumnPinningChange:Zo("columnPinning",e)}),createColumn:(e,t)=>{e.pin=n=>{const r=e.getLeafColumns().map(e=>e.id).filter(Boolean);t.setColumnPinning(e=>{var t,o,a,l,i,s;return"right"===n?{left:(null!=(a=null==e?void 0:e.left)?a:[]).filter(e=>!(null!=r&&r.includes(e))),right:[...(null!=(l=null==e?void 0:e.right)?l:[]).filter(e=>!(null!=r&&r.includes(e))),...r]}:"left"===n?{left:[...(null!=(i=null==e?void 0:e.left)?i:[]).filter(e=>!(null!=r&&r.includes(e))),...r],right:(null!=(s=null==e?void 0:e.right)?s:[]).filter(e=>!(null!=r&&r.includes(e)))}:{left:(null!=(t=null==e?void 0:e.left)?t:[]).filter(e=>!(null!=r&&r.includes(e))),right:(null!=(o=null==e?void 0:e.right)?o:[]).filter(e=>!(null!=r&&r.includes(e)))}})},e.getCanPin=()=>e.getLeafColumns().some(e=>{var n,r,o;return(null==(n=e.columnDef.enablePinning)||n)&&(null==(r=null!=(o=t.options.enableColumnPinning)?o:t.options.enablePinning)||r)}),e.getIsPinned=()=>{const n=e.getLeafColumns().map(e=>e.id),{left:r,right:o}=t.getState().columnPinning,a=n.some(e=>null==r?void 0:r.includes(e)),l=n.some(e=>null==o?void 0:o.includes(e));return a?"left":!!l&&"right"},e.getPinnedIndex=()=>{var n,r;const o=e.getIsPinned();return o?null!=(n=null==(r=t.getState().columnPinning)||null==(r=r[o])?void 0:r.indexOf(e.id))?n:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=Yo(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,t,n)=>{const r=[...null!=t?t:[],...null!=n?n:[]];return e.filter(e=>!r.includes(e.column.id))},Xo(t.options,"debugRows")),e.getLeftVisibleCells=Yo(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(e,t)=>{const n=(null!=t?t:[]).map(t=>e.find(e=>e.column.id===t)).filter(Boolean).map(e=>({...e,position:"left"}));return n},Xo(t.options,"debugRows")),e.getRightVisibleCells=Yo(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(e,t)=>{const n=(null!=t?t:[]).map(t=>e.find(e=>e.column.id===t)).filter(Boolean).map(e=>({...e,position:"right"}));return n},Xo(t.options,"debugRows"))},createTable:e=>{e.setColumnPinning=t=>null==e.options.onColumnPinningChange?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var n,r;return e.setColumnPinning(t?{left:[],right:[]}:null!=(n=null==(r=e.initialState)?void 0:r.columnPinning)?n:{left:[],right:[]})},e.getIsSomeColumnsPinned=t=>{var n;const r=e.getState().columnPinning;var o,a;return t?Boolean(null==(n=r[t])?void 0:n.length):Boolean((null==(o=r.left)?void 0:o.length)||(null==(a=r.right)?void 0:a.length))},e.getLeftLeafColumns=Yo(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(e,t)=>(null!=t?t:[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),Xo(e.options,"debugColumns")),e.getRightLeafColumns=Yo(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(e,t)=>(null!=t?t:[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),Xo(e.options,"debugColumns")),e.getCenterLeafColumns=Yo(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(e,t,n)=>{const r=[...null!=t?t:[],...null!=n?n:[]];return e.filter(e=>!r.includes(e.id))},Xo(e.options,"debugColumns"))}},Ea={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},xa={getDefaultColumnDef:()=>Ea,getInitialState:e=>({columnSizing:{},columnSizingInfo:{startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]},...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Zo("columnSizing",e),onColumnSizingInfoChange:Zo("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var n,r,o;const a=t.getState().columnSizing[e.id];return Math.min(Math.max(null!=(n=e.columnDef.minSize)?n:Ea.minSize,null!=(r=null!=a?a:e.columnDef.size)?r:Ea.size),null!=(o=e.columnDef.maxSize)?o:Ea.maxSize)},e.getStart=Yo(e=>[e,Na(t,e),t.getState().columnSizing],(t,n)=>n.slice(0,e.getIndex(t)).reduce((e,t)=>e+t.getSize(),0),Xo(t.options,"debugColumns")),e.getAfter=Yo(e=>[e,Na(t,e),t.getState().columnSizing],(t,n)=>n.slice(e.getIndex(t)+1).reduce((e,t)=>e+t.getSize(),0),Xo(t.options,"debugColumns")),e.resetSize=()=>{t.setColumnSizing(t=>{let{[e.id]:n,...r}=t;return r})},e.getCanResize=()=>{var n,r;return(null==(n=e.columnDef.enableResizing)||n)&&(null==(r=t.options.enableColumnResizing)||r)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let t=0;const n=e=>{var r;e.subHeaders.length?e.subHeaders.forEach(n):t+=null!=(r=e.column.getSize())?r:0};return n(e),t},e.getStart=()=>{if(e.index>0){const t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=n=>{const r=t.getColumn(e.column.id),o=null==r?void 0:r.getCanResize();return a=>{if(!r||!o)return;if(null==a.persist||a.persist(),ka(a)&&a.touches&&a.touches.length>1)return;const l=e.getSize(),i=e?e.getLeafHeaders().map(e=>[e.column.id,e.column.getSize()]):[[r.id,r.getSize()]],s=ka(a)?Math.round(a.touches[0].clientX):a.clientX,c={},u=(e,n)=>{"number"==typeof n&&(t.setColumnSizingInfo(e=>{var r,o;const a="rtl"===t.options.columnResizeDirection?-1:1,l=(n-(null!=(r=null==e?void 0:e.startOffset)?r:0))*a,i=Math.max(l/(null!=(o=null==e?void 0:e.startSize)?o:0),-.999999);return e.columnSizingStart.forEach(e=>{let[t,n]=e;c[t]=Math.round(100*Math.max(n+n*i,0))/100}),{...e,deltaOffset:l,deltaPercentage:i}}),"onChange"!==t.options.columnResizeMode&&"end"!==e||t.setColumnSizing(e=>({...e,...c})))},m=e=>u("move",e),p=e=>{u("end",e),t.setColumnSizingInfo(e=>({...e,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},d=n||("undefined"!=typeof document?document:null),f={moveHandler:e=>m(e.clientX),upHandler:e=>{null==d||d.removeEventListener("mousemove",f.moveHandler),null==d||d.removeEventListener("mouseup",f.upHandler),p(e.clientX)}},g={moveHandler:e=>(e.cancelable&&(e.preventDefault(),e.stopPropagation()),m(e.touches[0].clientX),!1),upHandler:e=>{var t;null==d||d.removeEventListener("touchmove",g.moveHandler),null==d||d.removeEventListener("touchend",g.upHandler),e.cancelable&&(e.preventDefault(),e.stopPropagation()),p(null==(t=e.touches[0])?void 0:t.clientX)}},h=!!function(){if("boolean"==typeof Sa)return Sa;let e=!1;try{const t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener("test",n,t),window.removeEventListener("test",n)}catch(t){e=!1}return Sa=e,Sa}()&&{passive:!1};ka(a)?(null==d||d.addEventListener("touchmove",g.moveHandler,h),null==d||d.addEventListener("touchend",g.upHandler,h)):(null==d||d.addEventListener("mousemove",f.moveHandler,h),null==d||d.addEventListener("mouseup",f.upHandler,h)),t.setColumnSizingInfo(e=>({...e,startOffset:s,startSize:l,deltaOffset:0,deltaPercentage:0,columnSizingStart:i,isResizingColumn:r.id}))}}},createTable:e=>{e.setColumnSizing=t=>null==e.options.onColumnSizingChange?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>null==e.options.onColumnSizingInfoChange?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var n;e.setColumnSizing(t?{}:null!=(n=e.initialState.columnSizing)?n:{})},e.resetHeaderSizeInfo=t=>{var n;e.setColumnSizingInfo(t?{startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}:null!=(n=e.initialState.columnSizingInfo)?n:{startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]})},e.getTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getHeaderGroups()[0])?void 0:n.headers.reduce((e,t)=>e+t.getSize(),0))?t:0},e.getLeftTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getLeftHeaderGroups()[0])?void 0:n.headers.reduce((e,t)=>e+t.getSize(),0))?t:0},e.getCenterTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getCenterHeaderGroups()[0])?void 0:n.headers.reduce((e,t)=>e+t.getSize(),0))?t:0},e.getRightTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getRightHeaderGroups()[0])?void 0:n.headers.reduce((e,t)=>e+t.getSize(),0))?t:0}}};let Sa=null;function ka(e){return"touchstart"===e.type}const Oa={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Zo("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(t=>({...t,[e.id]:null!=n?n:!e.getIsVisible()}))},e.getIsVisible=()=>{var n,r;const o=e.columns;return null==(n=o.length?o.some(e=>e.getIsVisible()):null==(r=t.getState().columnVisibility)?void 0:r[e.id])||n},e.getCanHide=()=>{var n,r;return(null==(n=e.columnDef.enableHiding)||n)&&(null==(r=t.options.enableHiding)||r)},e.getToggleVisibilityHandler=()=>t=>{null==e.toggleVisibility||e.toggleVisibility(t.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=Yo(()=>[e.getAllCells(),t.getState().columnVisibility],e=>e.filter(e=>e.column.getIsVisible()),Xo(t.options,"debugRows")),e.getVisibleCells=Yo(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(e,t,n)=>[...e,...t,...n],Xo(t.options,"debugRows"))},createTable:e=>{const t=(t,n)=>Yo(()=>[n(),n().filter(e=>e.getIsVisible()).map(e=>e.id).join("_")],e=>e.filter(e=>null==e.getIsVisible?void 0:e.getIsVisible()),Xo(e.options,"debugColumns"));e.getVisibleFlatColumns=t(0,()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t(0,()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t(0,()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t(0,()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t(0,()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>null==e.options.onColumnVisibilityChange?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{var n;e.setColumnVisibility(t?{}:null!=(n=e.initialState.columnVisibility)?n:{})},e.toggleAllColumnsVisible=t=>{var n;t=null!=(n=t)?n:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((e,n)=>({...e,[n.id]:t||!(null!=n.getCanHide&&n.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(e=>!(null!=e.getIsVisible&&e.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(e=>null==e.getIsVisible?void 0:e.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>t=>{var n;e.toggleAllColumnsVisible(null==(n=t.target)?void 0:n.checked)}}};function Na(e,t){return t?"center"===t?e.getCenterVisibleLeafColumns():"left"===t?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const Ca={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Zo("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{var r,o;if(t){if(null!=(r=null!=(o=e.options.autoResetAll)?o:e.options.autoResetExpanded)?r:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}}else e._queue(()=>{t=!0})},e.setExpanded=t=>null==e.options.onExpandedChange?void 0:e.options.onExpandedChange(t),e.toggleAllRowsExpanded=t=>{(null!=t?t:!e.getIsAllRowsExpanded())?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=t=>{var n,r;e.setExpanded(t?{}:null!=(n=null==(r=e.initialState)?void 0:r.expanded)?n:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(e=>e.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>t=>{null==t.persist||t.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const t=e.getState().expanded;return!0===t||Object.values(t).some(Boolean)},e.getIsAllRowsExpanded=()=>{const t=e.getState().expanded;return"boolean"==typeof t?!0===t:!!Object.keys(t).length&&!e.getRowModel().flatRows.some(e=>!e.getIsExpanded())},e.getExpandedDepth=()=>{let t=0;return(!0===e.getState().expanded?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(e=>{const n=e.split(".");t=Math.max(t,n.length)}),t},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(r=>{var o;const a=!0===r||!(null==r||!r[e.id]);let l={};if(!0===r?Object.keys(t.getRowModel().rowsById).forEach(e=>{l[e]=!0}):l=r,n=null!=(o=n)?o:!a,!a&&n)return{...l,[e.id]:!0};if(a&&!n){const{[e.id]:t,...n}=l;return n}return r})},e.getIsExpanded=()=>{var n;const r=t.getState().expanded;return!!(null!=(n=null==t.options.getIsRowExpanded?void 0:t.options.getIsRowExpanded(e))?n:!0===r||(null==r?void 0:r[e.id]))},e.getCanExpand=()=>{var n,r,o;return null!=(n=null==t.options.getRowCanExpand?void 0:t.options.getRowCanExpand(e))?n:(null==(r=t.options.enableExpanding)||r)&&!(null==(o=e.subRows)||!o.length)},e.getIsAllParentsExpanded=()=>{let n=!0,r=e;for(;n&&r.parentId;)r=t.getRow(r.parentId,!0),n=r.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{const t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},ja={getInitialState:e=>({...e,pagination:{pageIndex:0,pageSize:10,...null==e?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:Zo("pagination",e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{var r,o;if(t){if(null!=(r=null!=(o=e.options.autoResetAll)?o:e.options.autoResetPageIndex)?r:!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}}else e._queue(()=>{t=!0})},e.setPagination=t=>null==e.options.onPaginationChange?void 0:e.options.onPaginationChange(e=>$o(t,e)),e.resetPagination=t=>{var n;e.setPagination(t?{pageIndex:0,pageSize:10}:null!=(n=e.initialState.pagination)?n:{pageIndex:0,pageSize:10})},e.setPageIndex=t=>{e.setPagination(n=>{let r=$o(t,n.pageIndex);const o=void 0===e.options.pageCount||-1===e.options.pageCount?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return r=Math.max(0,Math.min(r,o)),{...n,pageIndex:r}})},e.resetPageIndex=t=>{var n,r;e.setPageIndex(t?0:null!=(n=null==(r=e.initialState)||null==(r=r.pagination)?void 0:r.pageIndex)?n:0)},e.resetPageSize=t=>{var n,r;e.setPageSize(t?10:null!=(n=null==(r=e.initialState)||null==(r=r.pagination)?void 0:r.pageSize)?n:10)},e.setPageSize=t=>{e.setPagination(e=>{const n=Math.max(1,$o(t,e.pageSize)),r=e.pageSize*e.pageIndex,o=Math.floor(r/n);return{...e,pageIndex:o,pageSize:n}})},e.setPageCount=t=>e.setPagination(n=>{var r;let o=$o(t,null!=(r=e.options.pageCount)?r:-1);return"number"==typeof o&&(o=Math.max(-1,o)),{...n,pageCount:o}}),e.getPageOptions=Yo(()=>[e.getPageCount()],e=>{let t=[];return e&&e>0&&(t=[...new Array(e)].fill(null).map((e,t)=>t)),t},Xo(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:t}=e.getState().pagination,n=e.getPageCount();return-1===n||0!==n&&t<n-1},e.previousPage=()=>e.setPageIndex(e=>e-1),e.nextPage=()=>e.setPageIndex(e=>e+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var t;return null!=(t=e.options.pageCount)?t:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var t;return null!=(t=e.options.rowCount)?t:e.getPrePaginationRowModel().rows.length}}},Pa={getInitialState:e=>({rowPinning:{top:[],bottom:[]},...e}),getDefaultOptions:e=>({onRowPinningChange:Zo("rowPinning",e)}),createRow:(e,t)=>{e.pin=(n,r,o)=>{const a=r?e.getLeafRows().map(e=>{let{id:t}=e;return t}):[],l=o?e.getParentRows().map(e=>{let{id:t}=e;return t}):[],i=new Set([...l,e.id,...a]);t.setRowPinning(e=>{var t,r,o,a,l,s;return"bottom"===n?{top:(null!=(o=null==e?void 0:e.top)?o:[]).filter(e=>!(null!=i&&i.has(e))),bottom:[...(null!=(a=null==e?void 0:e.bottom)?a:[]).filter(e=>!(null!=i&&i.has(e))),...Array.from(i)]}:"top"===n?{top:[...(null!=(l=null==e?void 0:e.top)?l:[]).filter(e=>!(null!=i&&i.has(e))),...Array.from(i)],bottom:(null!=(s=null==e?void 0:e.bottom)?s:[]).filter(e=>!(null!=i&&i.has(e)))}:{top:(null!=(t=null==e?void 0:e.top)?t:[]).filter(e=>!(null!=i&&i.has(e))),bottom:(null!=(r=null==e?void 0:e.bottom)?r:[]).filter(e=>!(null!=i&&i.has(e)))}})},e.getCanPin=()=>{var n;const{enableRowPinning:r,enablePinning:o}=t.options;return"function"==typeof r?r(e):null==(n=null!=r?r:o)||n},e.getIsPinned=()=>{const n=[e.id],{top:r,bottom:o}=t.getState().rowPinning,a=n.some(e=>null==r?void 0:r.includes(e)),l=n.some(e=>null==o?void 0:o.includes(e));return a?"top":!!l&&"bottom"},e.getPinnedIndex=()=>{var n,r;const o=e.getIsPinned();if(!o)return-1;const a=null==(n="top"===o?t.getTopRows():t.getBottomRows())?void 0:n.map(e=>{let{id:t}=e;return t});return null!=(r=null==a?void 0:a.indexOf(e.id))?r:-1}},createTable:e=>{e.setRowPinning=t=>null==e.options.onRowPinningChange?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var n,r;return e.setRowPinning(t?{top:[],bottom:[]}:null!=(n=null==(r=e.initialState)?void 0:r.rowPinning)?n:{top:[],bottom:[]})},e.getIsSomeRowsPinned=t=>{var n;const r=e.getState().rowPinning;var o,a;return t?Boolean(null==(n=r[t])?void 0:n.length):Boolean((null==(o=r.top)?void 0:o.length)||(null==(a=r.bottom)?void 0:a.length))},e._getPinnedRows=(t,n,r)=>{var o;return(null==(o=e.options.keepPinnedRows)||o?(null!=n?n:[]).map(t=>{const n=e.getRow(t,!0);return n.getIsAllParentsExpanded()?n:null}):(null!=n?n:[]).map(e=>t.find(t=>t.id===e))).filter(Boolean).map(e=>({...e,position:r}))},e.getTopRows=Yo(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,"top"),Xo(e.options,"debugRows")),e.getBottomRows=Yo(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,"bottom"),Xo(e.options,"debugRows")),e.getCenterRows=Yo(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(e,t,n)=>{const r=new Set([...null!=t?t:[],...null!=n?n:[]]);return e.filter(e=>!r.has(e.id))},Xo(e.options,"debugRows"))}},Ra={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Zo("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>null==e.options.onRowSelectionChange?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var n;return e.setRowSelection(t?{}:null!=(n=e.initialState.rowSelection)?n:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=void 0!==t?t:!e.getIsAllRowsSelected();const r={...n},o=e.getPreGroupedRowModel().flatRows;return t?o.forEach(e=>{e.getCanSelect()&&(r[e.id]=!0)}):o.forEach(e=>{delete r[e.id]}),r})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{const r=void 0!==t?t:!e.getIsAllPageRowsSelected(),o={...n};return e.getRowModel().rows.forEach(t=>{_a(o,t.id,r,!0,e)}),o}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=Yo(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?Aa(e,n):{rows:[],flatRows:[],rowsById:{}},Xo(e.options,"debugTable")),e.getFilteredSelectedRowModel=Yo(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?Aa(e,n):{rows:[],flatRows:[],rowsById:{}},Xo(e.options,"debugTable")),e.getGroupedSelectedRowModel=Yo(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?Aa(e,n):{rows:[],flatRows:[],rowsById:{}},Xo(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState();let r=Boolean(t.length&&Object.keys(n).length);return r&&t.some(e=>e.getCanSelect()&&!n[e.id])&&(r=!1),r},e.getIsAllPageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows.filter(e=>e.getCanSelect()),{rowSelection:n}=e.getState();let r=!!t.length;return r&&t.some(e=>!n[e.id])&&(r=!1),r},e.getIsSomeRowsSelected=()=>{var t;const n=Object.keys(null!=(t=e.getState().rowSelection)?t:{}).length;return n>0&&n<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows;return!e.getIsAllPageRowsSelected()&&t.filter(e=>e.getCanSelect()).some(e=>e.getIsSelected()||e.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,r)=>{const o=e.getIsSelected();t.setRowSelection(a=>{var l;if(n=void 0!==n?n:!o,e.getCanSelect()&&o===n)return a;const i={...a};return _a(i,e.id,n,null==(l=null==r?void 0:r.selectChildren)||l,t),i})},e.getIsSelected=()=>{const{rowSelection:n}=t.getState();return Ia(e,n)},e.getIsSomeSelected=()=>{const{rowSelection:n}=t.getState();return"some"===Ta(e,n)},e.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=t.getState();return"all"===Ta(e,n)},e.getCanSelect=()=>{var n;return"function"==typeof t.options.enableRowSelection?t.options.enableRowSelection(e):null==(n=t.options.enableRowSelection)||n},e.getCanSelectSubRows=()=>{var n;return"function"==typeof t.options.enableSubRowSelection?t.options.enableSubRowSelection(e):null==(n=t.options.enableSubRowSelection)||n},e.getCanMultiSelect=()=>{var n;return"function"==typeof t.options.enableMultiRowSelection?t.options.enableMultiRowSelection(e):null==(n=t.options.enableMultiRowSelection)||n},e.getToggleSelectedHandler=()=>{const t=e.getCanSelect();return n=>{var r;t&&e.toggleSelected(null==(r=n.target)?void 0:r.checked)}}}},_a=(e,t,n,r,o)=>{var a;const l=o.getRow(t,!0);n?(l.getCanMultiSelect()||Object.keys(e).forEach(t=>delete e[t]),l.getCanSelect()&&(e[t]=!0)):delete e[t],r&&null!=(a=l.subRows)&&a.length&&l.getCanSelectSubRows()&&l.subRows.forEach(t=>_a(e,t.id,n,r,o))};function Aa(e,t){const n=e.getState().rowSelection,r=[],o={},a=function(e,t){return e.map(e=>{var t;const l=Ia(e,n);if(l&&(r.push(e),o[e.id]=e),null!=(t=e.subRows)&&t.length&&(e={...e,subRows:a(e.subRows)}),l)return e}).filter(Boolean)};return{rows:a(t.rows),flatRows:r,rowsById:o}}function Ia(e,t){var n;return null!=(n=t[e.id])&&n}function Ta(e,t,n){var r;if(null==(r=e.subRows)||!r.length)return!1;let o=!0,a=!1;return e.subRows.forEach(e=>{if((!a||o)&&(e.getCanSelect()&&(Ia(e,t)?a=!0:o=!1),e.subRows&&e.subRows.length)){const n=Ta(e,t);"all"===n?a=!0:"some"===n?(a=!0,o=!1):o=!1}}),o?"all":!!a&&"some"}const Fa=/([0-9]+)/gm;function Ma(e,t){return e===t?0:e>t?1:-1}function La(e){return"number"==typeof e?isNaN(e)||e===1/0||e===-1/0?"":String(e):"string"==typeof e?e:""}function Da(e,t){const n=e.split(Fa).filter(Boolean),r=t.split(Fa).filter(Boolean);for(;n.length&&r.length;){const e=n.shift(),t=r.shift(),o=parseInt(e,10),a=parseInt(t,10),l=[o,a].sort();if(isNaN(l[0])){if(e>t)return 1;if(t>e)return-1}else{if(isNaN(l[1]))return isNaN(o)?-1:1;if(o>a)return 1;if(a>o)return-1}}return n.length-r.length}const Ga={alphanumeric:(e,t,n)=>Da(La(e.getValue(n)).toLowerCase(),La(t.getValue(n)).toLowerCase()),alphanumericCaseSensitive:(e,t,n)=>Da(La(e.getValue(n)),La(t.getValue(n))),text:(e,t,n)=>Ma(La(e.getValue(n)).toLowerCase(),La(t.getValue(n)).toLowerCase()),textCaseSensitive:(e,t,n)=>Ma(La(e.getValue(n)),La(t.getValue(n))),datetime:(e,t,n)=>{const r=e.getValue(n),o=t.getValue(n);return r>o?1:r<o?-1:0},basic:(e,t,n)=>Ma(e.getValue(n),t.getValue(n))},qa={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Zo("sorting",e),isMultiSortEvent:e=>e.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let r=!1;for(const t of n){const n=null==t?void 0:t.getValue(e.id);if("[object Date]"===Object.prototype.toString.call(n))return Ga.datetime;if("string"==typeof n&&(r=!0,n.split(Fa).length>1))return Ga.alphanumeric}return r?Ga.text:Ga.basic},e.getAutoSortDir=()=>{const n=t.getFilteredRowModel().flatRows[0];return"string"==typeof(null==n?void 0:n.getValue(e.id))?"asc":"desc"},e.getSortingFn=()=>{var n,r;if(!e)throw new Error;return Ko(e.columnDef.sortingFn)?e.columnDef.sortingFn:"auto"===e.columnDef.sortingFn?e.getAutoSortingFn():null!=(n=null==(r=t.options.sortingFns)?void 0:r[e.columnDef.sortingFn])?n:Ga[e.columnDef.sortingFn]},e.toggleSorting=(n,r)=>{const o=e.getNextSortingOrder(),a=null!=n;t.setSorting(l=>{const i=null==l?void 0:l.find(t=>t.id===e.id),s=null==l?void 0:l.findIndex(t=>t.id===e.id);let c,u=[],m=a?n:"desc"===o;var p;return c=null!=l&&l.length&&e.getCanMultiSort()&&r?i?"toggle":"add":null!=l&&l.length&&s!==l.length-1?"replace":i?"toggle":"replace","toggle"===c&&(a||o||(c="remove")),"add"===c?(u=[...l,{id:e.id,desc:m}],u.splice(0,u.length-(null!=(p=t.options.maxMultiSortColCount)?p:Number.MAX_SAFE_INTEGER))):u="toggle"===c?l.map(t=>t.id===e.id?{...t,desc:m}:t):"remove"===c?l.filter(t=>t.id!==e.id):[{id:e.id,desc:m}],u})},e.getFirstSortDir=()=>{var n,r;return(null!=(n=null!=(r=e.columnDef.sortDescFirst)?r:t.options.sortDescFirst)?n:"desc"===e.getAutoSortDir())?"desc":"asc"},e.getNextSortingOrder=n=>{var r,o;const a=e.getFirstSortDir(),l=e.getIsSorted();return l?!!(l===a||null!=(r=t.options.enableSortingRemoval)&&!r||n&&null!=(o=t.options.enableMultiRemove)&&!o)&&("desc"===l?"asc":"desc"):a},e.getCanSort=()=>{var n,r;return(null==(n=e.columnDef.enableSorting)||n)&&(null==(r=t.options.enableSorting)||r)&&!!e.accessorFn},e.getCanMultiSort=()=>{var n,r;return null!=(n=null!=(r=e.columnDef.enableMultiSort)?r:t.options.enableMultiSort)?n:!!e.accessorFn},e.getIsSorted=()=>{var n;const r=null==(n=t.getState().sorting)?void 0:n.find(t=>t.id===e.id);return!!r&&(r.desc?"desc":"asc")},e.getSortIndex=()=>{var n,r;return null!=(n=null==(r=t.getState().sorting)?void 0:r.findIndex(t=>t.id===e.id))?n:-1},e.clearSorting=()=>{t.setSorting(t=>null!=t&&t.length?t.filter(t=>t.id!==e.id):[])},e.getToggleSortingHandler=()=>{const n=e.getCanSort();return r=>{n&&(null==r.persist||r.persist(),null==e.toggleSorting||e.toggleSorting(void 0,!!e.getCanMultiSort()&&(null==t.options.isMultiSortEvent?void 0:t.options.isMultiSortEvent(r))))}}},createTable:e=>{e.setSorting=t=>null==e.options.onSortingChange?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var n,r;e.setSorting(t?[]:null!=(n=null==(r=e.initialState)?void 0:r.sorting)?n:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},Va=[ea,Oa,ba,wa,ra,ga,{createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},{getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:Zo("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n;const r=null==(n=e.getCoreRowModel().flatRows[0])||null==(n=n._getAllCellsByColumnId()[t.id])?void 0:n.getValue();return"string"==typeof r||"number"==typeof r}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var n,r,o,a;return(null==(n=e.columnDef.enableGlobalFilter)||n)&&(null==(r=t.options.enableGlobalFilter)||r)&&(null==(o=t.options.enableFilters)||o)&&(null==(a=null==t.options.getColumnCanGlobalFilter?void 0:t.options.getColumnCanGlobalFilter(e))||a)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>da.includesString,e.getGlobalFilterFn=()=>{var t,n;const{globalFilterFn:r}=e.options;return Ko(r)?r:"auto"===r?e.getGlobalAutoFilterFn():null!=(t=null==(n=e.options.filterFns)?void 0:n[r])?t:da[r]},e.setGlobalFilter=t=>{null==e.options.onGlobalFilterChange||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},qa,va,Ca,ja,Pa,Ra,xa];function Wa(e){var t,n;const r=[...Va,...null!=(t=e._features)?t:[]];let o={_features:r};const a=o._features.reduce((e,t)=>Object.assign(e,null==t.getDefaultOptions?void 0:t.getDefaultOptions(o)),{});let l={...null!=(n=e.initialState)?n:{}};o._features.forEach(e=>{var t;l=null!=(t=null==e.getInitialState?void 0:e.getInitialState(l))?t:l});const i=[];let s=!1;const c={_features:r,options:{...a,...e},initialState:l,_queue:e=>{i.push(e),s||(s=!0,Promise.resolve().then(()=>{for(;i.length;)i.shift()();s=!1}).catch(e=>setTimeout(()=>{throw e})))},reset:()=>{o.setState(o.initialState)},setOptions:e=>{const t=$o(e,o.options);o.options=(e=>o.options.mergeOptions?o.options.mergeOptions(a,e):{...a,...e})(t)},getState:()=>o.options.state,setState:e=>{null==o.options.onStateChange||o.options.onStateChange(e)},_getRowId:(e,t,n)=>{var r;return null!=(r=null==o.options.getRowId?void 0:o.options.getRowId(e,t,n))?r:`${n?[n.id,t].join("."):t}`},getCoreRowModel:()=>(o._getCoreRowModel||(o._getCoreRowModel=o.options.getCoreRowModel(o)),o._getCoreRowModel()),getRowModel:()=>o.getPaginationRowModel(),getRow:(e,t)=>{let n=(t?o.getPrePaginationRowModel():o.getRowModel()).rowsById[e];if(!n&&(n=o.getCoreRowModel().rowsById[e],!n))throw new Error;return n},_getDefaultColumnDef:Yo(()=>[o.options.defaultColumn],e=>{var t;return e=null!=(t=e)?t:{},{header:e=>{const t=e.header.column.columnDef;return t.accessorKey?t.accessorKey:t.accessorFn?t.id:null},cell:e=>{var t,n;return null!=(t=null==(n=e.renderValue())||null==n.toString?void 0:n.toString())?t:null},...o._features.reduce((e,t)=>Object.assign(e,null==t.getDefaultColumnDef?void 0:t.getDefaultColumnDef()),{}),...e}},Xo(e,"debugColumns")),_getColumnDefs:()=>o.options.columns,getAllColumns:Yo(()=>[o._getColumnDefs()],e=>{const t=function(e,n,r){return void 0===r&&(r=0),e.map(e=>{const a=function(e,t,n,r){var o,a;const l={...e._getDefaultColumnDef(),...t},i=l.accessorKey;let s,c=null!=(o=null!=(a=l.id)?a:i?"function"==typeof String.prototype.replaceAll?i.replaceAll(".","_"):i.replace(/\./g,"_"):void 0)?o:"string"==typeof l.header?l.header:void 0;if(l.accessorFn?s=l.accessorFn:i&&(s=i.includes(".")?e=>{let t=e;for(const e of i.split(".")){var n;t=null==(n=t)?void 0:n[e]}return t}:e=>e[l.accessorKey]),!c)throw new Error;let u={id:`${String(c)}`,accessorFn:s,parent:r,depth:n,columnDef:l,columns:[],getFlatColumns:Yo(()=>[!0],()=>{var e;return[u,...null==(e=u.columns)?void 0:e.flatMap(e=>e.getFlatColumns())]},Xo(e.options,"debugColumns")),getLeafColumns:Yo(()=>[e._getOrderColumnsFn()],e=>{var t;if(null!=(t=u.columns)&&t.length){let t=u.columns.flatMap(e=>e.getLeafColumns());return e(t)}return[u]},Xo(e.options,"debugColumns"))};for(const t of e._features)null==t.createColumn||t.createColumn(u,e);return u}(o,e,r,n),l=e;return a.columns=l.columns?t(l.columns,a,r+1):[],a})};return t(e)},Xo(e,"debugColumns")),getAllFlatColumns:Yo(()=>[o.getAllColumns()],e=>e.flatMap(e=>e.getFlatColumns()),Xo(e,"debugColumns")),_getAllFlatColumnsById:Yo(()=>[o.getAllFlatColumns()],e=>e.reduce((e,t)=>(e[t.id]=t,e),{}),Xo(e,"debugColumns")),getAllLeafColumns:Yo(()=>[o.getAllColumns(),o._getOrderColumnsFn()],(e,t)=>t(e.flatMap(e=>e.getLeafColumns())),Xo(e,"debugColumns")),getColumn:e=>o._getAllFlatColumnsById()[e]};Object.assign(o,c);for(let e=0;e<o._features.length;e++){const t=o._features[e];null==t||null==t.createTable||t.createTable(o)}return o}function za(){return e=>Yo(()=>[e.options.data],t=>{const n={rows:[],flatRows:[],rowsById:{}},r=function(t,o,a){void 0===o&&(o=0);const l=[];for(let s=0;s<t.length;s++){const c=na(e,e._getRowId(t[s],s,a),t[s],s,o,void 0,null==a?void 0:a.id);var i;n.flatRows.push(c),n.rowsById[c.id]=c,l.push(c),e.options.getSubRows&&(c.originalSubRows=e.options.getSubRows(t[s],s),null!=(i=c.originalSubRows)&&i.length&&(c.subRows=r(c.originalSubRows,o+1,c)))}return l};return n.rows=r(t),n},Xo(e.options,"debugTable",0,()=>e._autoResetPageIndex()))}function Ba(){return e=>Yo(()=>[e.getState().expanded,e.getPreExpandedRowModel(),e.options.paginateExpandedRows],(e,t,n)=>!t.rows.length||!0!==e&&!Object.keys(null!=e?e:{}).length?t:n?Ha(t):t,Xo(e.options,"debugTable"))}function Ha(e){const t=[],n=e=>{var r;t.push(e),null!=(r=e.subRows)&&r.length&&e.getIsExpanded()&&e.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function Ua(){return e=>Yo(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(t,n,r)=>{if(!t.rows.length||(null==n||!n.length)&&!r){for(let e=0;e<t.flatRows.length;e++)t.flatRows[e].columnFilters={},t.flatRows[e].columnFiltersMeta={};return t}const o=[],a=[];(null!=n?n:[]).forEach(t=>{var n;const r=e.getColumn(t.id);if(!r)return;const a=r.getFilterFn();a&&o.push({id:t.id,filterFn:a,resolvedValue:null!=(n=null==a.resolveFilterValue?void 0:a.resolveFilterValue(t.value))?n:t.value})});const l=(null!=n?n:[]).map(e=>e.id),i=e.getGlobalFilterFn(),s=e.getAllLeafColumns().filter(e=>e.getCanGlobalFilter());let c,u;r&&i&&s.length&&(l.push("__global__"),s.forEach(e=>{var t;a.push({id:e.id,filterFn:i,resolvedValue:null!=(t=null==i.resolveFilterValue?void 0:i.resolveFilterValue(r))?t:r})}));for(let e=0;e<t.flatRows.length;e++){const n=t.flatRows[e];if(n.columnFilters={},o.length)for(let e=0;e<o.length;e++){c=o[e];const t=c.id;n.columnFilters[t]=c.filterFn(n,t,c.resolvedValue,e=>{n.columnFiltersMeta[t]=e})}if(a.length){for(let e=0;e<a.length;e++){u=a[e];const t=u.id;if(u.filterFn(n,t,u.resolvedValue,e=>{n.columnFiltersMeta[t]=e})){n.columnFilters.__global__=!0;break}}!0!==n.columnFilters.__global__&&(n.columnFilters.__global__=!1)}}return function(e,t,n){return n.options.filterFromLeafRows?function(e,t,n){var r;const o=[],a={},l=null!=(r=n.options.maxLeafRowFilterDepth)?r:100,i=function(e,r){void 0===r&&(r=0);const s=[];for(let u=0;u<e.length;u++){var c;let m=e[u];const p=na(n,m.id,m.original,m.index,m.depth,void 0,m.parentId);if(p.columnFilters=m.columnFilters,null!=(c=m.subRows)&&c.length&&r<l){if(p.subRows=i(m.subRows,r+1),m=p,t(m)&&!p.subRows.length){s.push(m),a[m.id]=m,o.push(m);continue}if(t(m)||p.subRows.length){s.push(m),a[m.id]=m,o.push(m);continue}}else m=p,t(m)&&(s.push(m),a[m.id]=m,o.push(m))}return s};return{rows:i(e),flatRows:o,rowsById:a}}(e,t,n):function(e,t,n){var r;const o=[],a={},l=null!=(r=n.options.maxLeafRowFilterDepth)?r:100,i=function(e,r){void 0===r&&(r=0);const s=[];for(let u=0;u<e.length;u++){let m=e[u];if(t(m)){var c;if(null!=(c=m.subRows)&&c.length&&r<l){const e=na(n,m.id,m.original,m.index,m.depth,void 0,m.parentId);e.subRows=i(m.subRows,r+1),m=e}s.push(m),o.push(m),a[m.id]=m}}return s};return{rows:i(e),flatRows:o,rowsById:a}}(e,t,n)}(t.rows,e=>{for(let t=0;t<l.length;t++)if(!1===e.columnFilters[l[t]])return!1;return!0},e)},Xo(e.options,"debugTable",0,()=>e._autoResetPageIndex()))}function $a(e){return e=>Yo(()=>[e.getState().pagination,e.getPrePaginationRowModel(),e.options.paginateExpandedRows?void 0:e.getState().expanded],(t,n)=>{if(!n.rows.length)return n;const{pageSize:r,pageIndex:o}=t;let{rows:a,flatRows:l,rowsById:i}=n;const s=r*o,c=s+r;let u;a=a.slice(s,c),u=e.options.paginateExpandedRows?{rows:a,flatRows:l,rowsById:i}:Ha({rows:a,flatRows:l,rowsById:i}),u.flatRows=[];const m=e=>{u.flatRows.push(e),e.subRows.length&&e.subRows.forEach(m)};return u.rows.forEach(m),u},Xo(e.options,"debugTable"))}function Za(){return e=>Yo(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||null==t||!t.length)return n;const r=e.getState().sorting,o=[],a=r.filter(t=>{var n;return null==(n=e.getColumn(t.id))?void 0:n.getCanSort()}),l={};a.forEach(t=>{const n=e.getColumn(t.id);n&&(l[t.id]={sortUndefined:n.columnDef.sortUndefined,invertSorting:n.columnDef.invertSorting,sortingFn:n.getSortingFn()})});const i=e=>{const t=e.map(e=>({...e}));return t.sort((e,t)=>{for(let r=0;r<a.length;r+=1){var n;const o=a[r],i=l[o.id],s=i.sortUndefined,c=null!=(n=null==o?void 0:o.desc)&&n;let u=0;if(s){const n=void 0===e.getValue(o.id),r=void 0===t.getValue(o.id);if(n||r){if("first"===s)return n?-1:1;if("last"===s)return n?1:-1;u=n&&r?0:n?s:-s}}if(0===u&&(u=i.sortingFn(e,t,o.id)),0!==u)return c&&(u*=-1),i.invertSorting&&(u*=-1),u}return e.index-t.index}),t.forEach(e=>{var t;o.push(e),null!=(t=e.subRows)&&t.length&&(e.subRows=i(e.subRows))}),t};return{rows:i(n.rows),flatRows:o,rowsById:n.rowsById}},Xo(e.options,"debugTable",0,()=>e._autoResetPageIndex()))}function Ka(e,n){return e?function(e){return"function"==typeof e&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}(r=e)||"function"==typeof r||function(e){return"object"==typeof e&&"symbol"==typeof e.$$typeof&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}(r)?t.createElement(e,n):e:null;var r}function Ya(e){const n={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[r]=t.useState(()=>({current:Wa(n)})),[o,a]=t.useState(()=>r.current.initialState);return r.current.setOptions(t=>({...t,...e,state:{...o,...e.state},onStateChange:t=>{a(t),null==e.onStateChange||e.onStateChange(t)}})),r.current}function Xa({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99"}))}const Ja=t.forwardRef(Xa);function Qa({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.19 8.688a4.5 4.5 0 0 1 1.242 7.244l-4.5 4.5a4.5 4.5 0 0 1-6.364-6.364l1.757-1.757m13.35-.622 1.757-1.757a4.5 4.5 0 0 0-6.364-6.364l-4.5 4.5a4.5 4.5 0 0 0 1.242 7.244"}))}const el=t.forwardRef(Qa);function tl({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7.5 7.5h-.75A2.25 2.25 0 0 0 4.5 9.75v7.5a2.25 2.25 0 0 0 2.25 2.25h7.5a2.25 2.25 0 0 0 2.25-2.25v-7.5a2.25 2.25 0 0 0-2.25-2.25h-.75m-6 3.75 3 3m0 0 3-3m-3 3V1.5m6 9h.75a2.25 2.25 0 0 1 2.25 2.25v7.5a2.25 2.25 0 0 1-2.25 2.25h-7.5a2.25 2.25 0 0 1-2.25-2.25v-.75"}))}const nl=t.forwardRef(tl);var rl=["value","onChange","debounce"];function ol(){return ol=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ol.apply(null,arguments)}function al(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ll(t){var n=t.value,r=t.onChange,o=t.debounce,a=void 0===o?500:o,l=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,rl),i=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],s=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return al(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?al(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(n),2),s=i[0],c=i[1];return(0,e.useEffect)(function(){c(n)},[n]),(0,e.useEffect)(function(){var e=setTimeout(function(){r(s)},a);return function(){return clearTimeout(e)}},[s]),wp.element.createElement("input",ol({},l,{value:s,onChange:function(e){return c(e.target.value)}}))}function il({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"}))}const sl=t.forwardRef(il);function cl({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 15.75 7.5-7.5 7.5 7.5"}))}const ul=t.forwardRef(cl);function ml({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m8.25 4.5 7.5 7.5-7.5 7.5"}))}const pl=t.forwardRef(ml),dl=function(e){var t=e.table;return wp.element.createElement("thead",{className:"border-b border-gray-900/10 text-sm leading-6 text-gray-900"},t.getHeaderGroups().map(function(e){return wp.element.createElement("tr",{key:e.id},e.headers.map(function(e,t){return wp.element.createElement("th",{onClick:e.column.getToggleSortingHandler(),key:e.id,colSpan:e.colSpan,className:"py-2 font-bold select-none",style:{width:"".concat(e.getSize(),"px"),cursor:e.column.getCanSort()?"pointer":"default"}},e.isPlaceholder?null:wp.element.createElement("div",{className:"flex items-end leading-none capitalize"},Ka(e.column.columnDef.header,e.getContext()),wp.element.createElement("span",null,e.column.getIsSorted()?"desc"===e.column.getIsSorted()?wp.element.createElement(sl,{className:"w-3 h-3"}):wp.element.createElement(ul,{className:"w-3 h-3"}):e.column.getCanSort()?wp.element.createElement(pl,{className:"w-3 h-3"}):"")))}))}))};function fl(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.filter(Boolean).join(" ")}const gl=function(e){var t=e.row,n=e.loadingProductId,r=e.toggleExpanded,o=(t.original.type||"").toLowerCase(),a="variation"===o,l="variable"===o,i=t.original.id===n,s=t.getIsExpanded(),c=fl(a?"bg-sky-50":"",i?"bg-gray-100":"","py-4 wrap");return wp.element.createElement("tr",{key:t.id,className:fl(c,s?"bg-sky-300":"")},t.getVisibleCells().map(function(e,n){var o="select"===e.column.id,i="actions"===e.column.id;return o&&(l||a)?wp.element.createElement("td",{key:e.id,className:"py-4 ".concat(n===t.getVisibleCells().length-1?"text-right":"text-left")}):wp.element.createElement("td",{key:e.id,onClick:function(){o||i||r()},className:"py-4 wrap text-gray-600 ".concat(n===t.getVisibleCells().length-1?"text-right":"text-left"," ").concat(t.getCanExpand()&&"cursor-pointer"," ").concat(6===n?"text-wrap":""," ").concat(8===n?"whitespace-nowrap":"")},i&&l?wp.element.createElement(_t,{variant:"secondary"},"Pro only"):Ka(e.column.columnDef.cell,e.getContext()))}))},hl=function(e){var t=e.table;return e.selectablePageRows,e.rowSelection,e.setRowSelection,wp.element.createElement("div",{className:"flex justify-between items-center px-4 py-2"},wp.element.createElement("div",{className:"flex items-center gap-2 "},wp.element.createElement("button",{className:"border rounded p-1",onClick:function(){return t.setPageIndex(0)},disabled:!t.getCanPreviousPage()},"<<"),wp.element.createElement("button",{className:"border rounded p-1",onClick:function(){return t.previousPage()},disabled:!t.getCanPreviousPage()},"<"),wp.element.createElement("button",{className:"border rounded p-1",onClick:function(){return t.nextPage()},disabled:!t.getCanNextPage()},">"),wp.element.createElement("button",{className:"border rounded p-1",onClick:function(){return t.setPageIndex(t.getPageCount()-1)},disabled:!t.getCanNextPage()},">>"),wp.element.createElement("span",{className:"flex items-center gap-1"},wp.element.createElement("div",null,"Page"),wp.element.createElement("strong",null,t.getState().pagination.pageIndex+1," of"," ",t.getPageCount())),wp.element.createElement("span",{className:"flex items-center gap-1"},"| Go to page:",wp.element.createElement("input",{type:"number",defaultValue:t.getState().pagination.pageIndex+1,onChange:function(e){var n=e.target.value?Number(e.target.value)-1:0;t.setPageIndex(n)},className:"border p-1 rounded w-16"})),wp.element.createElement("select",{value:t.getState().pagination.pageSize,onChange:function(e){t.setPageSize(Number(e.target.value))}},[10,20,30,40,50].map(function(e){return wp.element.createElement("option",{key:e,value:e},"Show ",e)}))))},yl=function(t){var n=t.children,r=t.open,o=(t.onClose,t.className),a=t.backdrop,l=void 0===a||a,i=(0,e.useRef)(null);return r?wp.element.createElement("div",{className:"fixed top-0 left-0 right-0 bottom-0 flex items-center justify-start p-4 z-50",style:{marginLeft:"160px"}},l&&wp.element.createElement("div",{className:"absolute top-0 left-0 right-0 bottom-0 bg-black/70","aria-hidden":"true"}),wp.element.createElement("div",{ref:i,tabIndex:-1,className:fl("flex justify-center z-50 mx-auto",o),onClick:function(e){return e.stopPropagation()}},n)):null};function vl({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m11.25 9-3 3m0 0 3 3m-3-3h7.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}const bl=t.forwardRef(vl);function wl({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m12.75 15 3-3m0 0-3-3m3 3h-7.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}const El=t.forwardRef(wl);var xl=function(e){e.productsToImport;var t=e.rangeValue,n=e.dataToImport,r=e.handleStepChange,o=e.importProduct,a=e.importCount;return wp.element.createElement("div",null,wp.element.createElement("h4",{className:"text-base mb-4"},"Review"),wp.element.createElement("p",null,"You are about to import"," ",wp.element.createElement("span",{className:"font-semibold"},a)," products in batches of"," ",wp.element.createElement("span",{className:"font-semibold"},t),". Existing products will have their data updated, while new entries will be created for products not already in the system."),wp.element.createElement("div",{className:"mt-2"},wp.element.createElement("p",null,"You have chosen to import/sync the following:"),wp.element.createElement("ul",{className:"flex gap-2 mt-2 flex-wrap"},Object.keys(n).map(function(e,t){if(n[e])return wp.element.createElement("li",{key:n[e]+t,className:"p-2 border border-gray-300 uppercase text-xs font-semibold"},e)}))),wp.element.createElement("div",{className:"flex items-center mt-10 justify-end gap-2"},wp.element.createElement("button",{type:"button",onClick:function(){return r("backward")},className:"relative inline-flex items-center rounded-md bg-gray-400 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},wp.element.createElement(bl,{className:"mr-1.5 h-4 w-4 text-white","aria-hidden":"true"}),wp.element.createElement("span",null,"Go back")),wp.element.createElement("button",{type:"button",onClick:function(){r("forward"),o()},className:"relative inline-flex items-center rounded-md bg-red-500 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},wp.element.createElement("span",null,"IMPORT"),wp.element.createElement(El,{className:"ml-1.5 h-4 w-4 text-white","aria-hidden":"true"}))))};function Sl({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}const kl=t.forwardRef(Sl);function Ol(e){return Ol="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ol(e)}function Nl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Cl(e,t,n){return(t=function(e){var t=function(e){if("object"!=Ol(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Ol(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ol(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var jl=function(t){var n=t.progress,r=t.importCount,o=t.isImporting,a=t.setIsDialogOpen,l=t.setCurrentStep,i=(0,e.useRef)(null);return(0,e.useEffect)(function(){i.current&&(i.current.scrollTop=i.current.scrollHeight)},[n]),wp.element.createElement("div",null,wp.element.createElement("div",null,wp.element.createElement("div",{className:""},wp.element.createElement("div",{className:"h-4 bg-gray-200 w-full rounded-lg mt-2"},wp.element.createElement("div",{className:"h-full bg-blue-500 rounded-lg",style:{width:"".concat(n.filter(function(e){return"string"!=typeof e}).length/r*100,"%")}})),wp.element.createElement("div",{className:"text-sm text-gray-500 mt-1"},"Imported"," ",n.filter(function(e){return"string"!=typeof e&&"success"===e.status}).length," ","of ",r," products."," ",Number(n.filter(function(e){return"string"!=typeof e}).length/r*100).toFixed(1),"%")),wp.element.createElement("div",{ref:i,className:"bg-slate-950 p-4 rounded-xl max-h-52 overflow-y-auto overflow-x-hidden w-full flex flex-col gap-2 mt-2"},n.map(function(e,t){var n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Nl(Object(n),!0).forEach(function(t){Cl(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Nl(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},e);return delete n.variations,wp.element.createElement("p",{className:"break-words ".concat(e.status&&"success"===e.status?"text-green-500":e.status&&"failed"===e.status?"text-red-500":"text-blue-500"),key:e.square_id||t},JSON.stringify(n))})),!o&&wp.element.createElement("div",{className:"flex flex-col items-center justify-center gap-2 py-4"},wp.element.createElement(Yt,{className:"w-12 h-12 text-green-500"}),wp.element.createElement("h3",{className:"text-xl text-green-500 font-semibold"},"Import complete!"),wp.element.createElement("p",{className:"font-semibold"},"You can now safely close this window."))),!o&&wp.element.createElement("div",{className:"flex items-center justify-end gap-2 mt-6"},wp.element.createElement("button",{type:"button",onClick:function(){a(!1),l(0)},className:"relative inline-flex items-center rounded-md bg-gray-400 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},wp.element.createElement(kl,{className:"mr-1.5 h-4 w-4 text-white","aria-hidden":"true"}),wp.element.createElement("span",null,"Close"))))};function Pl(e){return Pl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Pl(e)}function Rl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Rl(Object(n),!0).forEach(function(t){Al(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Rl(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Al(e,t,n){return(t=function(e){var t=function(e){if("object"!=Pl(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Pl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Pl(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Il=function(e){var t=e.dataToImport,n=e.setDataToImport,r=e.rangeValue,o=e.handleRangeChange,a=e.handleStepChange,l=e.setCurrentStep,i=e.setIsDialogOpen;return wp.element.createElement("div",null,wp.element.createElement("h4",{className:"text-base mb-4"},"Select the data you wish to import / sync:"),wp.element.createElement("fieldset",{className:"mb-3"},wp.element.createElement("legend",{className:"sr-only"},"data to sync"),wp.element.createElement("div",{className:"flex gap-x-6 gap-y-4 items-start flex-wrap"},wp.element.createElement("label",{htmlFor:"title",className:"flex items-center gap-1 leading-none"},wp.element.createElement("input",{type:"checkbox",checked:t.title,onChange:function(){return n(_l(_l({},t),{},{title:!t.title}))},id:"title",className:"h-full !m-0"}),"Title"),wp.element.createElement("label",{htmlFor:"SKU",className:"flex items-center gap-1 leading-none"},wp.element.createElement("input",{type:"checkbox",checked:t.sku,id:"SKU",className:"h-full !m-0",onChange:function(){return n(_l(_l({},t),{},{sku:!t.sku}))}}),"SKU"),wp.element.createElement("label",{htmlFor:"price",className:"flex items-center gap-1 leading-none"},wp.element.createElement("input",{type:"checkbox",id:"price",className:"h-full !m-0",checked:t.price,onChange:function(){return n(_l(_l({},t),{},{price:!t.price}))}}),"Price"),wp.element.createElement("label",{htmlFor:"description",className:"flex items-center gap-1 leading-none"},wp.element.createElement("input",{type:"checkbox",id:"description",className:"h-full !m-0",checked:!1}),"Description ",wp.element.createElement(_t,null)),wp.element.createElement("label",{htmlFor:"image",className:"flex items-center gap-1 leading-none"},wp.element.createElement("input",{type:"checkbox",id:"image",className:"h-full !m-0",checked:!1}),"Image ",wp.element.createElement(_t,null)),wp.element.createElement("label",{htmlFor:"categories",className:"flex items-center gap-1 leading-none"},wp.element.createElement("input",{type:"checkbox",id:"categories",className:"h-full !m-0",checked:!1}),"Categories ",wp.element.createElement(_t,null)),wp.element.createElement("label",{htmlFor:"stock",className:"flex items-center gap-1 leading-none"},wp.element.createElement("input",{type:"checkbox",id:"stock",className:"h-full !m-0",checked:t.stock,onChange:function(){return n(_l(_l({},t),{},{stock:!t.stock}))}}),"Stock"))),wp.element.createElement("p",null,"Existing products will have their data updated, while new entries will be created for products not already in the system."),wp.element.createElement("h4",{className:"text-base mt-4 mb-2"},"How many products to import in each batch?"),wp.element.createElement("p",null,"Increasing the number in each batch places a greater load on the server (especially when import images). If you encounter errors, consider reducing this value for better stability or disabling image import."),wp.element.createElement("div",{className:"relative mb-6 mt-3"},wp.element.createElement("label",{htmlFor:"labels-range-input",className:"sr-only"},"Labels range"),wp.element.createElement("input",{id:"labels-range-input",type:"range",value:r,onChange:o,step:5,min:"5",max:"50",className:"w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer"}),wp.element.createElement("span",{className:"text-sm text-gray-500 absolute start-0 -bottom-6"},"Min 5"),wp.element.createElement("span",{className:"text-sm text-gray-600 font-semibold absolute start-1/2 -translate-x-1/2 -bottom-6"},r),wp.element.createElement("span",{className:"text-sm text-gray-500 absolute end-0 -bottom-6"},"Max 50")),wp.element.createElement("div",{className:"flex items-center mt-10 justify-end gap-2"},wp.element.createElement("button",{type:"button",onClick:function(){l(0),i(!1)},className:"relative inline-flex items-center rounded-md bg-gray-400 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},wp.element.createElement("span",null,"Cancel"),wp.element.createElement(kl,{className:"ml-1.5 h-4 w-4 text-white","aria-hidden":"true"})),wp.element.createElement("button",{type:"button",onClick:function(){return a("forward")},className:"relative inline-flex items-center rounded-md bg-sky-500 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},wp.element.createElement("span",null,"Continue"),wp.element.createElement(El,{className:"ml-1.5 h-4 w-4 text-white","aria-hidden":"true"}))))},Tl=function(e){var t=e.currentStep,n=e.rangeValue,r=e.dataToImport,o=e.handleStepChange,a=e.setCurrentStep,l=e.handleRangeChange,i=e.setDataToImport,s=e.importProduct,c=e.importCount,u=e.productsToImport,m=e.isImporting,p=e.setIsDialogOpen,d=e.progress;switch(t){case 0:return wp.element.createElement(Il,{dataToImport:r,setDataToImport:i,rangeValue:n,handleRangeChange:l,handleStepChange:o,setCurrentStep:a,setIsDialogOpen:p});case 1:return wp.element.createElement(xl,{progress:d,dataToImport:r,importProduct:s,importCount:c,handleStepChange:o,setCurrentStep:a,productsToImport:u,isImporting:m,rangeValue:n,setIsDialogOpen:p});case 2:return wp.element.createElement(jl,{progress:d,importCount:c,handleStepChange:o,setCurrentStep:a,isImporting:m,setIsDialogOpen:p});default:return wp.element.createElement("div",null,"Invalid step")}};function Fl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const Ml=function(t){var n=t.isDialogOpen,r=t.setIsDialogOpen,o=t.progress,a=t.rangeValue,l=t.setRangeValue,i=t.setDataToImport,s=t.dataToImport,c=t.importProduct,u=t.productsToImport,m=t.importCount,p=t.isImporting,d=[{name:"Step 1",href:"#",status:"current"},{name:"Step 2",href:"#",status:"upcoming"},{name:"Step 3",href:"#",status:"upcoming"}],f=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],s=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Fl(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Fl(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(0),2),g=f[0],h=f[1];return wp.element.createElement(yl,{open:n,onClose:function(){return r(!1)},className:"w-[40vw] max-w-[40vw] mx-auto bg-white p-6 rounded-xl"},wp.element.createElement("div",{className:"w-full"},wp.element.createElement("header",{className:"flex justify-between items-center gap-2 mb-4"},wp.element.createElement("h3",{className:"text-lg font-medium leading-6 text-gray-900"},"Import from Square"),wp.element.createElement("nav",{className:"flex items-center justify-center","aria-label":"Progress"},wp.element.createElement("p",{className:"text-sm font-medium"},"Step ",g+1," of ",d.length),wp.element.createElement("ol",{role:"list",className:"ml-8 flex items-center space-x-5"},d.map(function(e,t){return wp.element.createElement("li",{key:e.name},"complete"===e.status?wp.element.createElement("span",{className:"block h-2.5 w-2.5 rounded-full bg-sky-600 hover:bg-sky-900"},wp.element.createElement("span",{className:"sr-only"},e.name)):g===t?wp.element.createElement("span",{className:"relative flex items-center justify-center","aria-current":"step"},wp.element.createElement("span",{className:"absolute flex h-5 w-5 p-px","aria-hidden":"true"},wp.element.createElement("span",{className:"h-full w-full rounded-full bg-sky-200"})),wp.element.createElement("span",{className:"relative block h-2.5 w-2.5 rounded-full bg-sky-600","aria-hidden":"true"}),wp.element.createElement("span",{className:"sr-only"},e.name)):wp.element.createElement("span",{className:"block h-2.5 w-2.5 rounded-full bg-gray-200 hover:bg-gray-400"},wp.element.createElement("span",{className:"sr-only"},e.name)))})))),wp.element.createElement(Tl,{currentStep:g,rangeValue:a,dataToImport:s,handleStepChange:function(e){h(function(t){return"forward"===e&&t<d.length-1?t+1:"backward"===e&&t>0?t-1:t})},setCurrentStep:h,handleRangeChange:function(e){l(Number(e.target.value))},importCount:m,productsToImport:u,setDataToImport:i,importProduct:c,isImporting:p,setIsDialogOpen:r,progress:o}),p&&wp.element.createElement("p",{className:"text-red-500 font-semibold text-center mt-2"},"Do not close this window, import will be cancelled")))};function Ll(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Dl=(0,e.createContext)({blockNavigation:!1,setBlockNavigation:function(){}}),Gl=function(t){var n=t.children,r=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],s=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ll(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ll(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(!1),2),o=r[0],a=r[1];return wp.element.createElement(Dl.Provider,{value:{blockNavigation:o,setBlockNavigation:a}},n)};function ql(e){return ql="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ql(e)}function Vl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Wl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vl(Object(n),!0).forEach(function(t){zl(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vl(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function zl(e,t,n){return(t=function(e){var t=function(e){if("object"!=ql(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ql(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ql(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bl(e){return function(e){if(Array.isArray(e))return Hl(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Hl(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Hl(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Hl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Ul=["BIF","CLP","DJF","GNF","JPY","KMF","KRW","MGA","PYG","RWF","UGX","VND","VUV","XAF","XOF","XPF"];var $l=function(e){var t=e.isExpanded;return e.row.getCanExpand()?wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-4 h-4 ".concat(t?"rotate-90":"")},wp.element.createElement("polyline",{points:"9 18 15 12 9 6"})):wp.element.createElement(React.Fragment,null)},Zl=function(){return wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-gray-300"},wp.element.createElement("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),wp.element.createElement("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"}))},Kl=function(e){var t={false:{bgColor:"bg-red-100",textColor:"text-red-700",fillColor:"fill-red-500",text:"Not imported"},partial:{bgColor:"bg-yellow-100",textColor:"text-yellow-700",fillColor:"fill-yellow-500",text:"Partial"},true:{bgColor:"bg-green-100",textColor:"text-green-700",fillColor:"fill-green-500",text:"Imported"}},n=t[e.status]||t.false,r=n.bgColor,o=n.textColor,a=n.fillColor,l=n.text;return wp.element.createElement("span",{className:"inline-flex items-center gap-x-1.5 rounded-md px-2 py-1 text-xs font-medium ".concat(r," ").concat(o)},wp.element.createElement("svg",{className:"h-1.5 w-1.5 ".concat(a),viewBox:"0 0 6 6","aria-hidden":"true"},wp.element.createElement("circle",{cx:"3",cy:"3",r:"3"})),l)},Yl=function(e){var t=e.value,n=t?Object.values(t):[];return wp.element.createElement("div",{className:"group relative w-10 h-10"},n.map(function(e,t){return wp.element.createElement("img",{key:t,src:e,alt:"",width:40,height:40,className:fl("w-10 h-10 rounded object-cover flex items-center gap-2 shadow top-0 absolute transition-transform duration-300",0===t&&n.length>1&&"group-hover:-translate-y-2 rotate-12 group-hover:rotate-[-16deg]",1===t&&n.length>1&&"group-hover:translate-y-2 group-hover:rotate-[16deg]")})}))},Xl=["indeterminate","className"];function Jl(){return Jl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Jl.apply(null,arguments)}const Ql=function(e){var n=e.indeterminate,r=e.className,o=void 0===r?"":r,a=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,Xl),l=(0,t.useRef)(null);return(0,t.useEffect)(function(){"boolean"==typeof n&&(l.current.indeterminate=!a.checked&&n)},[n,a.checked]),wp.element.createElement("input",Jl({type:"checkbox",ref:l,className:o+" cursor-pointer"},a))};var ei=function(e,t,n,r,o){var a=!o||e.original.present_at_location_ids&&e.original.present_at_location_ids.includes(r),l=!!e.getValue(t)&&e.getValue(t).toString().toLowerCase().includes(n.toLowerCase()),i=!!e.subRows&&e.subRows.some(function(e){var r=e.getValue(t);return!!r&&r.toString().toLowerCase().includes(n.toLowerCase())});l&&e.subRows&&e.subRows.forEach(function(e){e.isMatch=!0});var s=l||i;return!(!l||!e.subRows)||s&&a},ti=function(e,t,n){if(t=Array.isArray(t)?t:[t],!n)return!0;var r=n.trim().toLowerCase(),o=function(e){var n=t.some(function(t){var n=e.getValue(t);return"string"==typeof n&&n.toLowerCase().includes(r)}),a=!!e.parent&&o(e.parent);return n||a};return e.depth>0||o(e)},ni=function(e,t,n){return!n||(!(r=e)||!0!==r.getValue(t));var r},ri=function(e,t,n){return!n||(!(r=e)||!0!==r.getValue(t));var r},oi=function(e,t,n){if(!n&&!1!==n)return!0;var r="true"===n||"false"!==n&&n;return e.getValue(t)===r};const ai=function(e){var t=e.content,n=e.children;return wp.element.createElement("div",{className:"relative flex justify-center group"},n,wp.element.createElement("div",{className:" absolute  hidden bottom-full  mb-2  w-max rounded  bg-gray-800 px-2  py-1  text-sm  text-white  z-50 right-full group-hover:block  transition-opacity "},t))},li=(...e)=>e.filter((e,t,n)=>Boolean(e)&&""!==e.trim()&&n.indexOf(e)===t).join(" ").trim();var ii={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const si=(0,t.forwardRef)(({color:e="currentColor",size:n=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:a="",children:l,iconNode:i,...s},c)=>(0,t.createElement)("svg",{ref:c,...ii,width:n,height:n,stroke:e,strokeWidth:o?24*Number(r)/Number(n):r,className:li("lucide",a),...s},[...i.map(([e,n])=>(0,t.createElement)(e,n)),...Array.isArray(l)?l:[l]])),ci=((e,n)=>{const r=(0,t.forwardRef)(({className:r,...o},a)=>{return(0,t.createElement)(si,{ref:a,iconNode:n,className:li(`lucide-${l=e,l.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,r),...o});var l});return r.displayName=`${e}`,r})("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);function ui(e){return ui="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ui(e)}function mi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function pi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?mi(Object(n),!0).forEach(function(t){di(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function di(e,t,n){return(t=function(e){var t=function(e){if("object"!=ui(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ui(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ui(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var fi=function(t,n,r,o,a,l){var i=n.expanded,s=n.setExpanded,c=n.sorting,u=n.setSorting,m=n.globalFilter,p=n.setGlobalFilter,d=n.isImporting,f=n.setProductsToImport,g=n.setIsDialogOpen,h=n.rowSelection,y=n.setRowSelection,v=(n.selectableRows,n.setSelectableRows,Jn().settings),b=(0,e.useMemo)(function(){return function(e){return e?e.filter(function(e){return null!==e}).map(function(e){var t,n,r,o,a,l,i,s,c,u,m,p=null===(t=e.item_data)||void 0===t||null===(t=t.variations)||void 0===t?void 0:t[0],d="USD";null!=p&&null!==(n=p.item_variation_data)&&void 0!==n&&null!==(n=n.price_money)&&void 0!==n&&n.currency&&(d=p.item_variation_data.price_money.currency);var f,g,h,y={USD:"$",CAD:"CA$",EUR:"€",GBP:"£",AUD:"A$",NZD:"NZ$",CHF:"CHF",JPY:"¥",CNY:"¥",HKD:"HK$",SGD:"S$",SEK:"kr",NOK:"kr",DKK:"kr",PLN:"zł",HUF:"Ft",CZK:"Kč",ILS:"₪",INR:"₹",RUB:"₽",ZAR:"R",BRL:"R$",MXN:"$",TRY:"₺",MYR:"RM",PHP:"₱",THB:"฿",KRW:"₩",AED:"د.إ",SAR:"ر.س",BHD:".د.ب",KWD:"د.ك"}[f=d]||f,v=((null===(r=e.item_data)||void 0===r?void 0:r.variations)||[]).map(function(t){var n=isNaN(parseInt(t.inventory_count))?0:parseInt(t.inventory_count),r=function(e){var t,n=null==e||null===(t=e.item_variation_data)||void 0===t?void 0:t.price_money;if(!n)return 0;var r=n.currency,o=n.amount;return Ul.includes(r)?o:o/100}(t);return{sku:t.item_variation_data.sku,name:t.item_variation_data.name,type:"variation",price:r,status:t.imported,stock:n,id:t.id,woocommerce_product_id:t.woocommerce_product_id||null,is_archived:e.is_archived||!1,visibility:e.visibility||!0}}),b=((null===(o=e.item_data)||void 0===o?void 0:o.variations)||[]).map(function(e){var t,n=null==e||null===(t=e.item_variation_data)||void 0===t?void 0:t.price_money;if(!n)return 0;var r=n.currency,o=n.amount;return Ul.includes(r)?o:o/100}),w=((null===(a=e.item_data)||void 0===a?void 0:a.variations)||[]).map(function(e){return isNaN(parseInt(e.inventory_count))?0:parseInt(e.inventory_count)});b.length>0?(g=Math.min.apply(Math,Bl(b)),h=Math.max.apply(Math,Bl(b))):g=h=0;var E=w.length?Math.min.apply(Math,Bl(w)):0,x=w.length?Math.max.apply(Math,Bl(w)):0,S=null!==(l=e.item_data)&&void 0!==l&&l.categories?e.item_data.categories.map(function(e){return e.name}):[];return Wl(Wl({sku:Array.isArray(null===(i=e.item_data)||void 0===i?void 0:i.variations)&&e.item_data.variations.length>0&&(null===(s=e.item_data.variations[0])||void 0===s||null===(s=s.item_variation_data)||void 0===s?void 0:s.sku)||"",id:e.id,name:(null===(c=e.item_data)||void 0===c?void 0:c.name)||"",present_at_location_ids:e.present_at_location_ids,stock:E===x?"".concat(E):"".concat(E," - ").concat(x),image:null!==(u=e.item_data)&&void 0!==u&&u.images?e.item_data.images:null,woocommerce_product_id:e.woocommerce_product_id||null,type:((null===(m=e.item_data)||void 0===m||null===(m=m.variations)||void 0===m?void 0:m.length)||0)>1?"Variable":"Simple",price:g===h?"".concat(y).concat(g):"".concat(y).concat(g," - ").concat(y).concat(h),categories:S,status:e.imported},v.length>1&&{subRows:v}),{},{is_archived:e.is_archived||!1,visibility:e.visibility,invalidVariable:e.invalid_variable_product||!1})}):[]}(t)},[t]),w=function(e){if(e.parentId){var t=e.getParentRow().original;return!(!t.invalidVariable||t.invalidVariable&&v.squareAuto.attributesDisabled)}var n;if(e.original.invalidVariable)return null===(n=v.squareAuto)||void 0===n||!n.attributesDisabled},E=(0,e.useMemo)(function(){return[{id:"expander",size:50,cell:function(e){var t=e.row;return wp.element.createElement(React.Fragment,null,t.getCanExpand()?wp.element.createElement("button",{type:"button"},wp.element.createElement($l,{isExpanded:t.getIsExpanded(),row:t})):null)}},{accessorKey:"visibility",header:"Visibility",accessorFn:function(e){return e.visibility},filterFn:"visibilityFilter",enableSorting:!1},{accessorKey:"is_archived",header:"Is Archived",accessorFn:function(e){return e.is_archived},filterFn:"archivedFilter",enableSorting:!1},{accessorKey:"id",header:function(){return"id"},show:!1},{accessorKey:"sku",header:function(){return"SKU"},canSort:!0,size:100,enableResizing:!1},{accessorKey:"image",header:function(){return""},enableSorting:!1,size:50,cell:function(e){var t=(0,e.getValue)();return t?wp.element.createElement(Yl,{value:t}):wp.element.createElement(Zl,null)}},{accessorKey:"name",header:function(){return"Name"},size:250,canSort:!0,cell:function(e){var t=e.getValue,n=e.row,r=t();return wp.element.createElement("div",null,wp.element.createElement("p",null,r),wp.element.createElement("p",{className:"text-xs text-gray-500"},"ID: ",n.original.id))}},{accessorKey:"type",size:80,header:function(){return"Type"},canSort:!0},{accessorKey:"price",size:80,canSort:!0,header:function(){return"Price"}},{size:70,accessorKey:"stock",canSort:!0,header:function(){return"Stock"}},{accessorKey:"categories",header:function(){return"Categories"},size:200,canSort:!0,cell:function(e){var t,n=(0,e.getValue)();return n&&n.length>0?wp.element.createElement("div",null,(t=n,Array.isArray(t)&&0!==t.length?t.join(", "):"")):""},filterFn:"includesCategoryFilter"},{accessorKey:"status",canSort:!0,size:120,header:function(){return"Status"},cell:function(e){var t=(0,e.getValue)();return wp.element.createElement(Kl,{status:t})},filterFn:"statusFilter"},{id:"actions",size:200,cell:function(e){var t,n,r=e.row;if(r.parentId)return wp.element.createElement(React.Fragment,null);var o=(null===(t=r.original.subRows)||void 0===t?void 0:t.filter(function(e){var t;return null===(t=r.subRows)||void 0===t?void 0:t.find(function(t){return t.id===e.id&&t.getIsSelected()})}))||[],a=pi(pi({},r.original),{},{subRows:o.length>0?o:r.original.subRows});return wp.element.createElement("div",{className:"flex items-center justify-end gap-2 w-[200px]"},!r.original.invalidVariable||null!==(n=v.squareAuto)&&void 0!==n&&n.attributesDisabled?wp.element.createElement(React.Fragment,null,r.original.woocommerce_product_id&&wp.element.createElement("a",{className:"rounded px-2 py-1 text-xs font-semibold text-sky-500 border-sky-500 border hover:border-sky-200 shadow-sm hover:text-sky-200 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-purple-600 cursor-pointer",href:"/wp-admin/post.php?post=".concat(r.original.woocommerce_product_id,"&action=edit"),target:"_blank"},"View Woo Product"),wp.element.createElement("button",{type:"button",onClick:function(){f([a]),g(!0)},disabled:d,className:"rounded bg-sky-600 px-2 py-1 text-xs font-semibold text-white shadow-sm hover:bg-sky-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-600"},!0===r.original.status?"Sync":"Import")):wp.element.createElement("div",{className:"text-wrap"},wp.element.createElement(ai,{content:wp.element.createElement("p",{className:"max-w-40 text-wrap"},"Invalid variable product, see guide ",wp.element.createElement("a",{className:"text-sky-500",target:"_blank",href:"https://squaresyncforwoo.com/documentation/how-to-properly-import-variations/"},"here"),". Or turn off attribute creation in plugins product settings.")},wp.element.createElement(ci,{className:"text-orange-500 size-5"}))))}},{id:"select",header:function(e){var t=e.table.getFilteredRowModel().rows.filter(function(e){var t;return e.getCanSelect()&&!(e.original.invalidVariable&&(null===(t=v.squareAuto)||void 0===t||!t.attributesDisabled))}),n=t.every(function(e){return e.getIsSelected()}),r=t.some(function(e){return e.getIsSelected()})&&!n;return wp.element.createElement("div",{className:"flex justify-center items-center w-full gap-2 relative"},wp.element.createElement(Ql,{checked:n,indeterminate:r,onChange:function(e){t.forEach(function(t){t.toggleSelected(e.target.checked)})}}))},cell:function(e){var t,n=e.row,r=e.table;return wp.element.createElement("div",{className:"px-1"},wp.element.createElement(Ql,{checked:!(n.original.invalidVariable&&(null===(t=v.squareAuto)||void 0===t||!t.attributesDisabled))&&n.getIsSelected(),disabled:w(n),indeterminate:n.getIsSomeSelected(),onChange:function(e){if(n.depth>0&&e.target.checked){var t=n.getParentRow();null==t||t.toggleSelected(!0),r.setRowSelection(function(t){return pi(pi({},t),{},di({},n.id,e.target.checked))})}else if(0===n.depth&&e.target.checked){var o;n.toggleSelected(e.target.checked),null===(o=n.subRows)||void 0===o||o.forEach(function(t){r.setRowSelection(function(n){return pi(pi({},n),{},di({},t.id,e.target.checked))})})}else if(0!==n.depth||e.target.checked)r.setRowSelection(function(t){return pi(pi({},t),{},di({},n.id,e.target.checked))});else{var a;n.toggleSelected(e.target.checked),null===(a=n.subRows)||void 0===a||a.forEach(function(t){r.setRowSelection(function(n){return pi(pi({},n),{},di({},t.id,e.target.checked))})})}}}))}},{accessorKey:"present_at_location_ids",header:"Location IDs",accessorFn:function(e){return e.present_at_location_ids?e.present_at_location_ids.join(","):""},filterFn:function(e,t,n){return function(e,t,n,r){if(!r)return!0;if(0===e.depth){var o=e.getValue(t);return 0===o.length||o.includes(n)}return!0}(e,t,n,o)},enableSorting:!1,columnVisibility:!1}]},[]),x=(0,e.useMemo)(function(){return function(e,t,n){return ti(e,t,n)}},[r,o,a,l]),S=function(e,t,n){var r=e.getValue(t);return!!Array.isArray(r)&&r.includes(n)};return(0,e.useMemo)(function(){return{data:b,columns:E,state:{expanded:i,sorting:c,columnVisibility:{id:!1,present_at_location_ids:!1,is_archived:!1,visibility:!1},globalFilter:m,rowSelection:h},filterFns:{visibilityFilter:ni,archivedFilter:ri,statusFilter:oi,includesCategoryFilter:S,searchFilterFn:function(e,t,n){return!!Array.isArray(t)&&ti(e,t,n)}},globalFilterFn:ti,getSubRows:function(e){return e.subRows||[]},getCoreRowModel:za(),getFilteredRowModel:Ua(),getSortedRowModel:Za(),getExpandedRowModel:Ba(),getPaginationRowModel:$a(),onExpandedChange:s,onGlobalFilterChange:p,autoResetPageIndex:!1,enableRowSelection:!0,getRowId:function(e){return e.id}}},[b,E,i,c,m,s,u,p,h,y,x,r,o,a,l])};function gi(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var s=r&&r.prototype instanceof i?r:i,c=Object.create(s.prototype);return hi(c,"_invoke",function(n,r,o){var a,i,s,c=0,u=o||[],m=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return a=t,i=0,s=e,p.n=n,l}};function d(n,r){for(i=n,s=r,t=0;!m&&c&&!o&&t<u.length;t++){var o,a=u[t],d=p.p,f=a[2];n>3?(o=f===r)&&(s=a[(i=a[4])?5:(i=3,3)],a[4]=a[5]=e):a[0]<=d&&((o=n<2&&d<a[1])?(i=0,p.v=r,p.n=a[1]):d<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,p.n=f,i=0))}if(o||n>1)return l;throw m=!0,r}return function(o,u,f){if(c>1)throw TypeError("Generator is already running");for(m&&1===u&&d(u,f),i=u,s=f;(t=i<2?e:s)||!m;){a||(i?i<3?(i>1&&(p.n=-1),d(i,s)):p.n=s:p.v=s);try{if(c=2,a){if(i||(o="next"),t=a[o]){if(!(t=t.call(a,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=a.return)&&t.call(a),i<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),i=1);a=e}else if((t=(m=p.n<0)?s:n.call(r,p))!==l)break}catch(t){a=e,i=1,s=t}finally{c=1}}return{value:t,done:m}}}(n,o,a),!0),c}var l={};function i(){}function s(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(hi(t={},r,function(){return this}),t),m=c.prototype=i.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,hi(e,o,"GeneratorFunction")),e.prototype=Object.create(m),e}return s.prototype=c,hi(m,"constructor",c),hi(c,"constructor",s),s.displayName="GeneratorFunction",hi(c,o,"GeneratorFunction"),hi(m),hi(m,o,"Generator"),hi(m,r,function(){return this}),hi(m,"toString",function(){return"[object Generator]"}),(gi=function(){return{w:a,m:p}})()}function hi(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}hi=function(e,t,n,r){if(t)o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{var a=function(t,n){hi(e,t,function(e){return this._invoke(t,n,e)})};a("next",0),a("throw",1),a("return",2)}},hi(e,t,n,r)}function yi(e,t,n,r,o,a,l){try{var i=e[a](l),s=i.value}catch(e){return void n(e)}i.done?t(s):Promise.resolve(s).then(r,o)}function vi(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){yi(a,r,o,l,i,"next",e)}function i(e){yi(a,r,o,l,i,"throw",e)}l(void 0)})}}function bi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],s=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return wi(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?wi(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function wi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ei(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=Ci(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=e.length?{done:!0}:{done:!1,value:e[_n++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw o}}}}function xi(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var s=r&&r.prototype instanceof i?r:i,c=Object.create(s.prototype);return Si(c,"_invoke",function(n,r,o){var a,i,s,c=0,u=o||[],m=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return a=t,i=0,s=e,p.n=n,l}};function d(n,r){for(i=n,s=r,t=0;!m&&c&&!o&&t<u.length;t++){var o,a=u[t],d=p.p,f=a[2];n>3?(o=f===r)&&(s=a[(i=a[4])?5:(i=3,3)],a[4]=a[5]=e):a[0]<=d&&((o=n<2&&d<a[1])?(i=0,p.v=r,p.n=a[1]):d<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,p.n=f,i=0))}if(o||n>1)return l;throw m=!0,r}return function(o,u,f){if(c>1)throw TypeError("Generator is already running");for(m&&1===u&&d(u,f),i=u,s=f;(t=i<2?e:s)||!m;){a||(i?i<3?(i>1&&(p.n=-1),d(i,s)):p.n=s:p.v=s);try{if(c=2,a){if(i||(o="next"),t=a[o]){if(!(t=t.call(a,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=a.return)&&t.call(a),i<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),i=1);a=e}else if((t=(m=p.n<0)?s:n.call(r,p))!==l)break}catch(t){a=e,i=1,s=t}finally{c=1}}return{value:t,done:m}}}(n,o,a),!0),c}var l={};function i(){}function s(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Si(t={},r,function(){return this}),t),m=c.prototype=i.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,Si(e,o,"GeneratorFunction")),e.prototype=Object.create(m),e}return s.prototype=c,Si(m,"constructor",c),Si(c,"constructor",s),s.displayName="GeneratorFunction",Si(c,o,"GeneratorFunction"),Si(m),Si(m,o,"Generator"),Si(m,r,function(){return this}),Si(m,"toString",function(){return"[object Generator]"}),(xi=function(){return{w:a,m:p}})()}function Si(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Si=function(e,t,n,r){if(t)o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{var a=function(t,n){Si(e,t,function(e){return this._invoke(t,n,e)})};a("next",0),a("throw",1),a("return",2)}},Si(e,t,n,r)}function ki(e,t,n,r,o,a,l){try{var i=e[a](l),s=i.value}catch(e){return void n(e)}i.done?t(s):Promise.resolve(s).then(r,o)}function Oi(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){ki(a,r,o,l,i,"next",e)}function i(e){ki(a,r,o,l,i,"throw",e)}l(void 0)})}}function Ni(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],s=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw o}}return i}}(e,t)||Ci(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ci(e,t){if(e){if("string"==typeof e)return ji(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ji(e,t):void 0}}function ji(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const Pi=function(t){var n=t.setIsAutoMatchOpen,r=t.inventory,o=Ni((0,e.useState)("sku"),2),a=o[0],l=o[1],i=Ni((0,e.useState)(!1),2),s=i[0],c=i[1],u=Ni((0,e.useState)(""),2),m=u[0],p=u[1],d=function(e,t){for(var n=[],r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n},f=function(){var e=Oi(xi().m(function e(t,n){var r;return xi().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,e.n=1,Ut({path:"/sws/v1/matcher",method:"POST",data:{match_key:n,inventory:t}});case 1:e.n=3;break;case 2:e.p=2,r=e.v,console.error("Error sending batch:",r);case 3:return e.a(2)}},e,null,[[0,2]])}));return function(_x,t){return e.apply(this,arguments)}}(),g=function(){var e=Oi(xi().m(function e(){var t,n,o,l,i;return xi().w(function(e){for(;;)switch(e.n){case 0:c(!0),t=d(r,100),n=Ei(t),e.p=1,n.s();case 2:if((o=n.n()).done){e.n=4;break}return l=o.value,e.n=3,f(l,a);case 3:e.n=2;break;case 4:e.n=6;break;case 5:e.p=5,i=e.v,n.e(i);case 6:return e.p=6,n.f(),e.f(6);case 7:p("Auto matcher complete, reload inventory table to see results"),c(!1);case 8:return e.a(2)}},e,null,[[1,5,6,7]])}));return function(){return e.apply(this,arguments)}}();return wp.element.createElement("div",{className:"w-[40vw] max-w-[40vw] mx-auto bg-white p-6 rounded-xl"},wp.element.createElement("div",{className:"w-full"},wp.element.createElement("header",{className:"flex justify-between items-center gap-2 mb-4"},wp.element.createElement("h3",{className:"text-lg font-medium leading-6 text-gray-900"},"Auto Matcher"))),wp.element.createElement("p",null,"Automatically link your existing WooCommerce products with Square using the SKU matcher. Products that are already linked will be skipped to avoid duplication. For the best results, ensure your WooCommerce product structure aligns with Square—for example, Square variations should correspond to WooCommerce variable products. Make sure each product has a unique SKU, as duplicates may cause issues with automatic syncing."),wp.element.createElement("p",{className:"text-sm font-semibold mt-3"},"Match via:"),wp.element.createElement("select",{className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 mt-2 !pr-10",value:a,onChange:function(e){return l(e.target.value)}},wp.element.createElement("option",{value:"sku"},"SKU")),m&&wp.element.createElement("p",{className:"text-sky-500 mt-4"},m),s?wp.element.createElement("div",{className:"flex items-center mt-10 justify-end gap-2"},wp.element.createElement("button",{type:"button",className:"relative inline-flex items-center rounded-md bg-sky-500 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400",disabled:""},wp.element.createElement("svg",{className:"animate-spin -ml-1 mr-3 h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},wp.element.createElement("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),wp.element.createElement("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})),"Processing...")):wp.element.createElement("div",{className:"flex items-center mt-10 justify-end gap-2"},wp.element.createElement("button",{type:"button",onClick:function(){return n(!1)},className:"relative inline-flex items-center rounded-md bg-gray-400 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},wp.element.createElement("span",null,"Close"),wp.element.createElement(kl,{className:"ml-1.5 h-4 w-4 text-white","aria-hidden":"true"})),wp.element.createElement("button",{type:"button",onClick:g,className:"relative inline-flex items-center rounded-md bg-sky-500 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},wp.element.createElement("span",null,"Start matching"),wp.element.createElement(El,{className:"ml-1.5 h-4 w-4 text-white","aria-hidden":"true"}))))};function Ri(e){return Ri="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ri(e)}function _i(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}throw new TypeError(Ri(e)+" is not iterable")}function Ai(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var s=r&&r.prototype instanceof i?r:i,c=Object.create(s.prototype);return Ii(c,"_invoke",function(n,r,o){var a,i,s,c=0,u=o||[],m=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return a=t,i=0,s=e,p.n=n,l}};function d(n,r){for(i=n,s=r,t=0;!m&&c&&!o&&t<u.length;t++){var o,a=u[t],d=p.p,f=a[2];n>3?(o=f===r)&&(s=a[(i=a[4])?5:(i=3,3)],a[4]=a[5]=e):a[0]<=d&&((o=n<2&&d<a[1])?(i=0,p.v=r,p.n=a[1]):d<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,p.n=f,i=0))}if(o||n>1)return l;throw m=!0,r}return function(o,u,f){if(c>1)throw TypeError("Generator is already running");for(m&&1===u&&d(u,f),i=u,s=f;(t=i<2?e:s)||!m;){a||(i?i<3?(i>1&&(p.n=-1),d(i,s)):p.n=s:p.v=s);try{if(c=2,a){if(i||(o="next"),t=a[o]){if(!(t=t.call(a,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=a.return)&&t.call(a),i<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),i=1);a=e}else if((t=(m=p.n<0)?s:n.call(r,p))!==l)break}catch(t){a=e,i=1,s=t}finally{c=1}}return{value:t,done:m}}}(n,o,a),!0),c}var l={};function i(){}function s(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Ii(t={},r,function(){return this}),t),m=c.prototype=i.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,Ii(e,o,"GeneratorFunction")),e.prototype=Object.create(m),e}return s.prototype=c,Ii(m,"constructor",c),Ii(c,"constructor",s),s.displayName="GeneratorFunction",Ii(c,o,"GeneratorFunction"),Ii(m),Ii(m,o,"Generator"),Ii(m,r,function(){return this}),Ii(m,"toString",function(){return"[object Generator]"}),(Ai=function(){return{w:a,m:p}})()}function Ii(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Ii=function(e,t,n,r){if(t)o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{var a=function(t,n){Ii(e,t,function(e){return this._invoke(t,n,e)})};a("next",0),a("throw",1),a("return",2)}},Ii(e,t,n,r)}function Ti(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Fi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ti(Object(n),!0).forEach(function(t){Mi(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ti(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Mi(e,t,n){return(t=function(e){var t=function(e){if("object"!=Ri(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Ri(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ri(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Li(e,t,n,r,o,a,l){try{var i=e[a](l),s=i.value}catch(e){return void n(e)}i.done?t(s):Promise.resolve(s).then(r,o)}function Di(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){Li(a,r,o,l,i,"next",e)}function i(e){Li(a,r,o,l,i,"throw",e)}l(void 0)})}}function Gi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],s=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw o}}return i}}(e,t)||qi(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function qi(e,t){if(e){if("string"==typeof e)return Vi(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Vi(e,t):void 0}}function Vi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}window.lodash;const Wi=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,n=Gi((0,t.useState)(null),2),r=n[0],o=n[1],a=Gi((0,t.useState)(!0),2),l=a[0],i=a[1],s=Gi((0,t.useState)(!1),2),c=s[0],u=s[1],m=Gi((0,t.useState)(""),2),p=m[0],d=m[1],f=Gi((0,t.useState)(""),2),g=f[0],h=f[1],y=Gi((0,t.useState)(""),2),v=y[0],b=y[1],w=Gi((0,t.useState)(""),2),E=w[0],x=w[1],S=Gi((0,t.useState)(""),2),k=S[0],O=S[1],N=Gi((0,t.useState)(""),2),C=N[0],j=N[1],P=Gi((0,t.useState)([]),2),R=P[0],_=P[1],A=Gi((0,t.useState)({pageIndex:0,pageSize:e,total:0,totalPages:0,importable:0}),2),I=A[0],T=A[1],F=Gi((0,t.useState)([]),2),L=F[0],D=F[1],G=(0,t.useRef)(!0),q=(0,t.useCallback)(Di(Ai().m(function e(){var t,n,r,a,l,s,u,m,f,y,w,S,N,P,R,_,A,F,D,G,q,V,W,z,B,H,U,$,Z,K,Y,X,J,Q,ee=arguments;return Ai().w(function(e){for(;;)switch(e.n){case 0:if(n=(t=ee.length>0&&void 0!==ee[0]?ee[0]:{}).pageIndex,r=void 0===n?I.pageIndex:n,a=t.pageSize,l=void 0===a?I.pageSize:a,s=t.search,u=void 0===s?p:s,m=t.sortBy,f=void 0===m?"":m,y=t.sortOrder,w=void 0===y?"":y,S=t.category,N=void 0===S?g:S,P=t.status,R=void 0===P?v:P,_=t.ecom,A=void 0===_?k:_,F=t.archive,D=void 0===F?C:F,G=t.location,q=void 0===G?E:G,!c){e.n=1;break}return e.a(2);case 1:return i(!0),e.p=2,V=r+1,z=w,!(W=f)&&L.length>0&&(W=L[0].id,z=L[0].desc?"desc":"asc"),B={search:u,page:V.toString(),per_page:l.toString()},W&&(B.orderby=W,B.order=z),N&&(B.category=N),R&&(B.status=R),A&&(B.ecom=A),D&&(B.archive=D),q&&(B.location=q),H=new URLSearchParams(B).toString(),e.n=3,Ut({path:"/sws/v1/square-inventory/saved-inventory/search?".concat(H),method:"GET",parse:!1});case 3:return U=e.v,e.n=4,U.json();case 4:$=e.v,o($),Z=U.headers.get("X-WP-Total"),K=U.headers.get("X-SWS-Importable"),Y=parseInt(Z||"0",10),X=parseInt(K||"0",10),J=Math.ceil(Y/l),d(u),h(N),b(R),j(D),x(q),O(A),T(function(e){return Fi(Fi({},e),{},{pageIndex:r,pageSize:l,total:Y,totalPages:J,importable:X})}),e.n=6;break;case 5:e.p=5,Q=e.v,console.error("Error fetching inventory:",Q),M.error("Error fetching inventory. See console for details.");case 6:return e.p=6,i(!1),e.f(6);case 7:return e.a(2)}},e,null,[[2,5,6,7]])})),[I,p,L,g,v]),V=(0,t.useCallback)(function(e){G.current&&(G.current=!1),d(e),T(function(e){return Fi(Fi({},e),{},{pageIndex:0})}),q({pageIndex:0,pageSize:I.pageSize,search:e})},[q,I.pageSize]),W=(0,t.useCallback)(Di(Ai().m(function e(){var t,n,r,a,l,s,c,m,p,f=arguments;return Ai().w(function(e){for(;;)switch(e.n){case 0:return t=f.length>0&&void 0!==f[0]&&f[0],u(!0),i(!0),e.p=1,e.n=2,Ut({path:"/sws/v1/square-inventory/?force=".concat(t,"&per_page=").concat(I.pageSize),parse:!1});case 2:if(n=e.v,t){e.n=4;break}return e.n=3,n.json();case 3:(r=e.v).loading?(u(!0),i(!0)):(o(r.data),a=n.headers.get("X-WP-Total"),l=n.headers.get("X-WP-TotalPages"),s=parseInt(a||"0",10),c=parseInt(l||"0",10),T(function(e){return Fi(Fi({},e),{},{pageIndex:0,pageSize:I.pageSize,total:s,totalPages:c})}),u(!1),i(!1));case 4:m=function(){var e=Di(Ai().m(function e(){var t,n,r,a;return Ai().w(function(e){for(;;)switch(e.n){case 0:t=0,n=100,r=Ai().m(function e(){var n,r,a,l,s,c;return Ai().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,e.n=1,Ut({path:"/sws/v1/square-inventory/saved-inventory/",parse:!1});case 1:return n=e.v,e.n=2,n.json();case 2:if(!(r=e.v).finished){e.n=3;break}return u(!1),i(!1),o(r.inventory||[]),a=n.headers.get("X-WP-Total"),l=parseInt(a||"0",10),s=Math.ceil(l/I.pageSize),d(""),T(function(e){return Fi(Fi({},e),{},{pageIndex:0,total:l,totalPages:s})}),e.a(2,{v:void 0});case 3:e.n=5;break;case 4:e.p=4,c=e.v,console.error("Error polling:",c);case 5:return t++,e.n=6,new Promise(function(e){return setTimeout(e,5e3)});case 6:return e.a(2)}},e,null,[[0,4]])});case 1:if(!(t<n)){e.n=4;break}return e.d(_i(r()),2);case 2:if(!(a=e.v)){e.n=3;break}return e.a(2,a.v);case 3:e.n=1;break;case 4:M.error("Polling timed out. Please try again.");case 5:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}(),m(),e.n=6;break;case 5:e.p=5,p=e.v,console.error("Error triggering inventory update:",p),M.error("Error triggering inventory update."),u(!1),i(!1);case 6:return e.a(2)}},e,null,[[1,5]])})),[]),z=(0,t.useCallback)(function(e){h(e),T(function(e){return Fi(Fi({},e),{},{pageIndex:0})}),q({pageIndex:0,category:e,status:v,location:E,archive:C,ecom:k})},[q,v]),B=(0,t.useCallback)(function(e){b(e),T(function(e){return Fi(Fi({},e),{},{pageIndex:0})}),q({pageIndex:0,category:g,status:e,location:E,archive:C,ecom:k})},[q,g]),H=(0,t.useCallback)(function(e){x(e),T(function(e){return Fi(Fi({},e),{},{pageIndex:0})}),q({pageIndex:0,category:g,status:v,location:e,archive:C,ecom:k})},[q,E]),U=(0,t.useCallback)(function(e){j(e),T(function(e){return Fi(Fi({},e),{},{pageIndex:0})}),q({pageIndex:0,category:g,status:v,location:E,archive:e,ecom:k})},[q,C]),$=(0,t.useCallback)(function(e){O(e),T(function(e){return Fi(Fi({},e),{},{pageIndex:0})}),q({pageIndex:0,category:g,status:v,location:E,archive:C,ecom:e})},[q,k]),Z=(0,t.useCallback)(Di(Ai().m(function e(){var t,n,r;return Ai().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,e.n=1,Ut({path:"/sws/v1/square-inventory/categories",method:"GET",parse:!1});case 1:return t=e.v,e.n=2,t.json();case 2:(n=e.v)&&Array.isArray(n.categories)?_(n.categories):_([]),e.n=4;break;case 3:e.p=3,r=e.v,console.error("Error fetching categories:",r),M.error("Error fetching categories. See console for details.");case 4:return e.a(2)}},e,null,[[0,3]])})),[]);(0,t.useEffect)(function(){Z()},[Z]);var K=(0,t.useMemo)(function(){return R&&Array.isArray(R)?function(e){return function(e){if(Array.isArray(e))return Vi(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||qi(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(R).sort(function(e,t){return"string"==typeof e&&"string"==typeof t?e.localeCompare(t):e.name&&t.name?e.name.localeCompare(t.name):0}):[]},[R]);return(0,t.useEffect)(function(){W(!1)},[]),(0,t.useEffect)(function(){q()},[I.pageSize,I.pageIndex,L]),{inventory:r,categories:R,categoryOptions:K,inventoryLoading:l,polling:c,pagination:I,searchTerm:p,categoryFilter:g,statusFilter:v,sorting:L,ecomFilter:k,locationFilter:E,archiveFilter:C,setPagination:T,setSorting:D,setSearchTerm:d,setCategoryFilter:h,setStatusFilter:b,setArchiveFilter:j,setLocationFilter:x,setEcomFilter:O,fetchInventory:q,handleSearch:V,changeCategory:z,changeStatus:B,changeLocation:H,changeEcom:$,changeArchive:U,triggerAndPollInventory:W,fetchCategories:Z}};function zi(e){return zi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},zi(e)}function Bi(e){return function(e){if(Array.isArray(e))return Yi(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Ki(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Hi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ui(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Hi(Object(n),!0).forEach(function(t){$i(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function $i(e,t,n){return(t=function(e){var t=function(e){if("object"!=zi(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=zi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==zi(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Zi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],s=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw o}}return i}}(e,t)||Ki(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ki(e,t){if(e){if("string"==typeof e)return Yi(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Yi(e,t):void 0}}function Yi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Xi="undefined"==typeof AbortController?void 0:new AbortController;const Ji=function(n){var o=n.settings,a=n.updateSettings,l=Wi(10),i=l.inventoryLoading,s=(l.polling,l.inventory),c=l.triggerAndPollInventory,u=l.fetchInventory,m=l.handleSearch,p=l.searchTerm,d=l.setPagination,f=l.pagination,g=l.sorting,h=l.setSorting,y=l.categoryFilter,v=l.statusFilter,b=l.changeCategory,w=l.changeStatus,E=l.categoryOptions,x=l.locationFilter,S=l.changeLocation,k=l.archiveFilter,O=l.changeArchive,N=l.ecomFilter,C=l.changeEcom,j=Zi((0,t.useState)({}),2),P=j[0],R=j[1],_=Zi((0,t.useState)({}),2),A=_[0],I=_[1],T=Zi((0,t.useState)(!1),2),F=T[0],L=T[1],D=Zi((0,t.useState)(!1),2),G=D[0],q=D[1],V=Zi((0,t.useState)(15),2),W=V[0],z=V[1],B=function(t,n,r,o){var a=bi((0,e.useState)(!1),2),l=a[0],i=a[1],s=bi((0,e.useState)(null),2),c=s[0],u=s[1],m=(0,e.useRef)(null),p=(0,e.useRef)(l);(0,e.useEffect)(function(){p.current=l},[l]);var d=(0,e.useCallback)(vi(gi().m(function e(){var t,n,r,o,a,l,s,c,m,p;return gi().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,e.n=1,Ut({path:"/sws/v1/square-inventory/import/status",method:"GET",parse:!1});case 1:return t=e.v,e.n=2,t.json();case 2:(n=e.v).progress&&(r=n.progress,o=r.processed,a=void 0===o?0:o,l=r.total,s=void 0===l?0:l,c=r.error,m=void 0===c?"":c,(a>0||s>0||m)&&u(n.progress)),n.isImporting&&(i(!0),f()),e.n=4;break;case 3:e.p=3,p=e.v,console.error("Error fetching existing import status:",p);case 4:return e.a(2)}},e,null,[[0,3]])})),[]);(0,e.useEffect)(function(){d()},[]);var f=(0,e.useCallback)(function(){var e=0,n=Math.max(1e4,1e3*o),r=function(){var o=vi(gi().m(function o(){var a,l,s,c;return gi().w(function(o){for(;;)switch(o.n){case 0:return o.p=0,o.n=1,Ut({path:"/sws/v1/square-inventory/import/status",method:"GET",parse:!1});case 1:return l=o.v,o.n=2,l.json();case 2:if(s=o.v,u(s.progress),s.isImporting&&(null===(a=s.progress)||void 0===a||!a.finished)){o.n=3;break}return i(!1),t&&t(),o.a(2);case 3:o.n=5;break;case 4:o.p=4,c=o.v,console.error("Polling error:",c);case 5:++e<1e3&&p.current?m.current=setTimeout(r,n):i(!1);case 6:return o.a(2)}},o,null,[[0,4]])}));return function(){return o.apply(this,arguments)}}();r()},[t]),g=(0,e.useCallback)(function(){var e=vi(gi().m(function e(t,n,r,a,l,s){var c,m,d;return gi().w(function(e){for(;;)switch(e.n){case 0:if(!p.current){e.n=1;break}return e.a(2);case 1:return i(!0),u(null),e.p=2,e.n=3,Ut({path:"/sws/v1/square-inventory/import",method:"POST",data:{product:t||[],datatoimport:a,batchSize:o,categoryFilter:l,statusFilter:s},signal:null==r?void 0:r.signal,parse:!1});case 3:return c=e.v,e.n=4,c.json();case 4:if(m=e.v,console.log("import response:",m),!m.error){e.n=5;break}return M.error("Import error: ".concat(m.error)),i(!1),e.a(2);case 5:f(),e.n=7;break;case 6:e.p=6,"AbortError"===(d=e.v).name?M.info("Import request aborted."):M.error("Import request failed: ".concat(d.message)),i(!1);case 7:return e.a(2)}},e,null,[[2,6]])}));return function(_x,t,n,r,o,a){return e.apply(this,arguments)}}(),[f]),h=function(){var e=vi(gi().m(function e(){var t,n,r;return gi().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,e.n=1,Ut({path:"/sws/v1/square-inventory/import/stop",method:"POST",parse:!1});case 1:return t=e.v,e.n=2,t.json();case 2:(n=e.v).success?(i(!1),M.info("Import was stopped.")):M.warn(n.message),e.n=4;break;case 3:e.p=3,r=e.v,console.error("Error stopping import:",r),M.error("Unable to stop import");case 4:return e.a(2)}},e,null,[[0,3]])}));return function(){return e.apply(this,arguments)}}(),y=(0,e.useCallback)(function(){i(!1),u(null),r("inventory",{})},[]);return(0,e.useEffect)(function(){return function(){m.current&&clearTimeout(m.current)}},[]),{isImporting:l,progress:c,importProduct:g,clearImportProgress:y,setIsImporting:i,setProgress:u,stopImport:h}}(u,0,a,W),H=B.isImporting,U=B.progress,$=B.importProduct,Z=B.clearImportProgress,K=(B.setIsImporting,B.setProgress,B.stopImport),Y=Zi((0,t.useState)([]),2),X=Y[0],J=Y[1],Q=Zi((0,t.useState)({title:!0,sku:!0,description:!0,stock:!0,image:!0,categories:!0,price:!0}),2),ee=Q[0],te=Q[1],ne=Zi((0,t.useState)({}),2),re=ne[0],oe=ne[1],ae=Zi((0,t.useState)(""),2),le=ae[0],ie=ae[1],se=Zi((0,t.useState)([]),2),ce=(se[0],se[1],Zi((0,t.useState)([]),2)),ue=ce[0],me=(ce[1],Zi((0,t.useState)(!0),2)),pe=me[0],de=(me[1],Zi((0,t.useState)(!1),2)),fe=de[0],ge=(de[1],Zi((0,t.useState)(!1),2)),he=ge[0],ye=(ge[1],fi(s||[],{expanded:re,setExpanded:oe,sorting:g,setSorting:h,globalFilter:le,setGlobalFilter:ie,isImporting:H,setProductsToImport:J,setIsDialogOpen:L},o.location,pe,fe,he));console.log(s);var ve,be,we,Ee=Ya(Ui(Ui({},ye),{},{manualPagination:!0,manualSorting:!0,pageCount:f.totalPages||1,state:Ui(Ui({},ye.state),{},{pagination:f,sorting:g,rowSelection:P}),onPaginationChange:d,onSortingChange:function(e){h(e),d(function(e){return Ui(Ui({},e),{},{pageIndex:0})})},enableRowSelection:function(e){var t,n,r,a=null===(t=e.original)||void 0===t||null===(t=t.type)||void 0===t?void 0:t.toLowerCase();return!("variable"===a||"variation"===a||(e.parentId?e.getParentRow().original.invalidVariable&&null!==(r=o.squareAuto)&&void 0!==r&&r.attributesDisabled:e.original.invalidVariable&&(null===(n=o.squareAuto)||void 0===n||!n.attributesDisabled)))},onRowSelectionChange:function(e){R(function(t){var n="function"==typeof e?e(t):e,r=Ui({},A);return Ee.getRowModel().rows.forEach(function(e){var t,o=n[e.id],a=null===(t=e.original)||void 0===t?void 0:t.id;if(a)if(e.parentId){var l=e.getParentRow(),i=l.original.id;if(r[i]?Array.isArray(r[i].subRows)||(r[i].subRows=[]):r[i]=Ui(Ui({},l.original),{},{subRows:[]}),o)r[i].subRows.find(function(e){return e.id===a})||r[i].subRows.push(e.original);else{r[i].subRows=r[i].subRows.filter(function(e){return e.id!==a});var s=n[l.id];0!==r[i].subRows.length||s||delete r[i]}}else o?r[a]=Ui(Ui({},e.original),{},{subRows:e.original.subRows?Bi(e.original.subRows):[]}):r[a]&&delete r[a]}),I(r),n})}}));return(0,t.useEffect)(function(){if(s&&Array.isArray(s)){var e={};Ee.getRowModel().rows.forEach(function(t){var n,r=null===(n=t.original)||void 0===n?void 0:n.id;if(r)if(t.parentId){var o,a=t.getParentRow(),l=null==a||null===(o=a.original)||void 0===o?void 0:o.id;if(!l)return;var i=A[l];i&&Array.isArray(i.subRows)&&i.subRows.some(function(e){return e.id===r})&&(e[t.id]=!0)}else A[r]&&(e[t.id]=!0)}),R(e)}},[s,A]),H||U&&(U.total>0||U.processed>0||U.error)?wp.element.createElement("div",{className:"px-4 pt-5 sm:px-6 pb-6"},function(){if(H)return wp.element.createElement(r().Fragment,null,wp.element.createElement("h2",{className:"text-xl font-semibold mb-3"},"Import in Progress"),wp.element.createElement("p",{className:"mb-2"},"Feel free to navigate away; the import process runs in the background."));var e=U.processed,t=void 0===e?0:e,n=U.total,o=void 0===n?0:n,a=U.error,l=void 0===a?"":a;return"Import stopped by user"===l?wp.element.createElement(r().Fragment,null,wp.element.createElement("h2",{className:"text-xl font-semibold mb-3"},"Import Stopped"),wp.element.createElement("p",{className:"mb-2"},"The import was manually stopped. Below are the partial results (processed ",t," of ",o,").")):l&&l.length>0?wp.element.createElement(r().Fragment,null,wp.element.createElement("h2",{className:"text-xl font-semibold mb-3"},"Import Error"),wp.element.createElement("p",{className:"mb-2"},"The import encountered an error: ",wp.element.createElement("strong",null,l),". Below are any partial results.")):t>=o?wp.element.createElement(r().Fragment,null,wp.element.createElement("h2",{className:"text-xl font-semibold mb-3"},"Import Complete"),wp.element.createElement("p",{className:"mb-2"},"The last import has completed, results below.")):wp.element.createElement(r().Fragment,null,wp.element.createElement("h2",{className:"text-xl font-semibold mb-3"},"Previous Import Results"),wp.element.createElement("p",{className:"mb-2"},"The last import has ended but did not process all items. Partial results below."))}(),wp.element.createElement("div",{className:"mb-3"},wp.element.createElement("p",{className:"text-sm font-medium mb-1"},"Processed: ",(null==U?void 0:U.processed)||0," / ",(null==U?void 0:U.total)||0),wp.element.createElement("div",{className:"relative w-full bg-gray-200 h-4 rounded"},(ve=(null==U?void 0:U.total)||0,be=(null==U?void 0:U.processed)||0,we=ve>0?Math.min(be/ve*100,100):0,wp.element.createElement("div",{className:"absolute left-0 top-0 h-4 bg-sky-500 rounded transition-all duration-300",style:{width:"".concat(we,"%")}})))),Array.isArray(null==U?void 0:U.results)&&U.results.length>0&&wp.element.createElement("div",{className:"mt-3"},wp.element.createElement("p",{className:"font-medium mb-2"},"Import Log:"),wp.element.createElement("div",{className:"bg-gray-900 text-gray-100 font-mono p-4 rounded-md max-h-60 overflow-y-auto text-xs leading-relaxed"},U.results.map(function(e,t){var n,r="text-blue-400",o=(null===(n=e.status)||void 0===n?void 0:n.toLowerCase())||"";"success"===o?r="text-green-400":"failed"===o||"failure"===o?r="text-red-400":"deleted"===o&&(r="text-orange-400");var a=e.status?"[".concat(e.status.toUpperCase(),"]"):"[INFO]",l=e.message||"Item #".concat(t+1," complete");return wp.element.createElement("div",{key:t,className:"whitespace-pre-wrap mb-1 ".concat(r)},a," ",l)}))),wp.element.createElement("div",{className:"flex items-center gap-3 justify-end mt-4"},H&&wp.element.createElement("button",{type:"button",onClick:K,className:"inline-flex items-center rounded-md bg-red-500 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-red-400"},"Stop Import"),!H&&wp.element.createElement("button",{type:"button",onClick:Z,className:"inline-flex items-center rounded-md bg-sky-500 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},"Close"))):wp.element.createElement("div",null,wp.element.createElement(yl,{open:G,onClose:function(){return q(!1)},className:"custom-dialog-class"},wp.element.createElement(Pi,{setIsAutoMatchOpen:q,inventory:s})),wp.element.createElement(Ml,{dataToImport:ee,setDataToImport:te,importCount:0===X.length?f.importable:X.length,importProduct:function(){$(X,s,Xi,ee,y,v,p)},controller:Xi,isImporting:H,productsToImport:X,rangeValue:W,setRangeValue:z,isDialogOpen:F,progress:U,setIsDialogOpen:L}),wp.element.createElement("div",{className:"px-4 pt-5 sm:px-6"},wp.element.createElement("div",{className:"grid grid-cols-3 gap-2 mb-4 items-center"},wp.element.createElement("div",{className:"flex flex-wrap items-center justify-start sm:flex-nowrap"},wp.element.createElement("h2",{className:"text-xl font-semibold"},"Square Inventory"),wp.element.createElement("div",{className:"ml-4 flex flex-shrink-0"},wp.element.createElement("button",{type:"button",onClick:function(){return c(!0)},className:"relative inline-flex items-center rounded-md bg-sky-500 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},wp.element.createElement(Ja,{className:"-ml-0.5 mr-1.5 h-4 w-4 text-white","aria-hidden":"true"}),wp.element.createElement("span",null,"Refresh")))),wp.element.createElement("div",{className:"relative flex"},wp.element.createElement(ll,{value:null!=le?le:"",onChange:function(e){return m(e)},className:"block w-full rounded-md border-0 py-1.5 pr-14 pl-4 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sku-600 sm:text-sm sm:leading-6",placeholder:"Search inventory..."}),wp.element.createElement("div",{className:"absolute inset-y-0 right-0 flex py-1.5 pr-1.5"},wp.element.createElement("kbd",{className:"inline-flex items-center rounded border border-gray-200 px-1 font-sans text-xs text-gray-400"},wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"feather feather-search w-3 h-3"},wp.element.createElement("circle",{cx:"11",cy:"11",r:"8"}),wp.element.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}))))),wp.element.createElement("div",{className:"flex justify-end items-center gap-2"},wp.element.createElement("button",{type:"button",disabled:!0,className:"disabled:bg-gray-200 relative inline-flex items-center rounded-md bg-sky-500 px-3 py-2 text-xs font-semibold text-white shadow-sm "},wp.element.createElement(el,{className:"-ml-0.5 mr-1.5 h-4 w-4 text-white","aria-hidden":"true"}),"Auto match "," | "," Pro Only"),wp.element.createElement("button",{type:"button",onClick:function(){var e=Object.keys(A).length;if(s){if(0===e)J([]);else{var t=Object.values(A);J(t)}L(!0)}},className:"disabled:bg-gray-200 relative inline-flex items-center rounded-md bg-sky-500 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400 border border-sky-500 hover:border-sky-400"},wp.element.createElement(nl,{className:"-ml-0.5 mr-1.5 h-4 w-4 text-white","aria-hidden":"true"}),wp.element.createElement("span",null,0===Object.keys(A).length?"Import all (".concat(f.importable,")"):"Import ".concat(Object.keys(A).length," selected products")))),wp.element.createElement("p",{className:"text-xs text-gray-500"},"Data is cached; refresh to update"))),i&&wp.element.createElement("div",null,wp.element.createElement("div",{className:"flex gap-2 items-center col-span-full sm:px-6 lg:px-8 relative overflow-hidden w-full"},wp.element.createElement("svg",{className:"text-sky-300 animate-spin",viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24"},wp.element.createElement("path",{d:"M32 3C35.8083 3 39.5794 3.75011 43.0978 5.20749C46.6163 6.66488 49.8132 8.80101 52.5061 11.4939C55.199 14.1868 57.3351 17.3837 58.7925 20.9022C60.2499 24.4206 61 28.1917 61 32C61 35.8083 60.2499 39.5794 58.7925 43.0978C57.3351 46.6163 55.199 49.8132 52.5061 52.5061C49.8132 55.199 46.6163 57.3351 43.0978 58.7925C39.5794 60.2499 35.8083 61 32 61C28.1917 61 24.4206 60.2499 20.9022 58.7925C17.3837 57.3351 14.1868 55.199 11.4939 52.5061C8.801 49.8132 6.66487 46.6163 5.20749 43.0978C3.7501 39.5794 3 35.8083 3 32C3 28.1917 3.75011 24.4206 5.2075 20.9022C6.66489 17.3837 8.80101 14.1868 11.4939 11.4939C14.1868 8.80099 17.3838 6.66487 20.9022 5.20749C24.4206 3.7501 28.1917 3 32 3Z",stroke:"currentColor",strokeWidth:"5",strokeLinecap:"round",strokeLinejoin:"round"}),wp.element.createElement("path",{d:"M32 3C36.5778 3 41.0906 4.08374 45.1692 6.16256C49.2477 8.24138 52.7762 11.2562 55.466 14.9605C58.1558 18.6647 59.9304 22.9531 60.6448 27.4748C61.3591 31.9965 60.9928 36.6232 59.5759 40.9762",stroke:"currentColor",strokeWidth:"5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-sky-500"})),wp.element.createElement("p",null,"Product data is being fetched in the background. Depending on your product database this may take a while. Feel free to leave this page and come back later."))),wp.element.createElement("div",null,o.location&&o.location.length>1&&!i&&wp.element.createElement("div",{className:"sm:px-6 lg:px-8 mb-4"},wp.element.createElement("div",{className:"flex gap-2 items-center flex-wrap"},wp.element.createElement("div",{className:"col-span-1"},wp.element.createElement("label",{className:"block text-sm font-medium text-gray-700 mb-1"},"Filter by Category"),wp.element.createElement("select",{className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 mt-2 !pr-10",value:y,onChange:function(e){return b(e.target.value)}},wp.element.createElement("option",{value:""},"All Categories"),E.map(function(e){return wp.element.createElement("option",{key:e.id,value:e.name},e.name)}))),wp.element.createElement("div",{className:"col-span-1"},wp.element.createElement("label",{className:"block text-sm font-medium text-gray-700 mb-1"},"Filter by Status"),wp.element.createElement("select",{className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 mt-2 !pr-10",value:v,onChange:function(e){return w(e.target.value)}},wp.element.createElement("option",{value:""},"All"),wp.element.createElement("option",{value:"imported"},"Imported Only"),wp.element.createElement("option",{value:"not_imported"},"Not Imported"))),wp.element.createElement("div",{className:"col-span-1"},wp.element.createElement("label",{className:"block text-sm font-medium text-gray-700 mb-1"},"Ecom Availablility"),wp.element.createElement("select",{className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 mt-2 !pr-10",value:N,onChange:function(e){return C(e.target.value)}},wp.element.createElement("option",{value:""},"All"),wp.element.createElement("option",{value:"ecom"},"Ecom Only"))),wp.element.createElement("div",{className:"col-span-1"},wp.element.createElement("label",{className:"block text-sm font-medium text-gray-700 mb-1"},"Archived products"),wp.element.createElement("select",{className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 mt-2 !pr-10 w-full",value:k,onChange:function(e){return O(e.target.value)}},wp.element.createElement("option",{value:""},"Show"),wp.element.createElement("option",{value:"hide"},"Hide"))),wp.element.createElement("div",{className:"col-span-1"},wp.element.createElement("label",{className:"block text-sm font-medium text-gray-700 mb-1"},"Location"),wp.element.createElement("select",{className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 mt-2 !pr-10",value:x,onChange:function(e){return S(e.target.value)}},wp.element.createElement("option",{value:""},"All"),wp.element.createElement("option",{value:"location"},"Defined location"))))),wp.element.createElement("div",{className:"sm:px-6 lg:px-8 relative overflow-y-auto w-full"},wp.element.createElement("table",{className:"w-full min-w-full text-left bg-white"},wp.element.createElement(dl,{table:Ee}),wp.element.createElement("tbody",{className:"divide-y divide-gray-200"},i?wp.element.createElement("tr",null,wp.element.createElement("td",{colSpan:Ee.getHeaderGroups()[0].headers.length},wp.element.createElement("div",{className:"w-full"},wp.element.createElement("div",{className:"h-8 bg-gray-200 w-full mb-4"}),wp.element.createElement("div",{className:"h-8 bg-gray-200 w-full mb-4"}),wp.element.createElement("div",{className:"h-8 bg-gray-200 w-full mb-4"}),wp.element.createElement("div",{className:"h-8 bg-gray-200 w-full mb-4"})))):Ee.getRowModel().rows.map(function(e){return wp.element.createElement(gl,{key:e.id,row:e,toggleExpanded:function(){e.getCanExpand()&&e.toggleExpanded()}})})))),wp.element.createElement("hr",null),wp.element.createElement(hl,{table:Ee,selectablePageRows:ue,rowSelection:P,setRowSelection:R})))};function Qi(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var s=r&&r.prototype instanceof i?r:i,c=Object.create(s.prototype);return es(c,"_invoke",function(n,r,o){var a,i,s,c=0,u=o||[],m=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return a=t,i=0,s=e,p.n=n,l}};function d(n,r){for(i=n,s=r,t=0;!m&&c&&!o&&t<u.length;t++){var o,a=u[t],d=p.p,f=a[2];n>3?(o=f===r)&&(s=a[(i=a[4])?5:(i=3,3)],a[4]=a[5]=e):a[0]<=d&&((o=n<2&&d<a[1])?(i=0,p.v=r,p.n=a[1]):d<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,p.n=f,i=0))}if(o||n>1)return l;throw m=!0,r}return function(o,u,f){if(c>1)throw TypeError("Generator is already running");for(m&&1===u&&d(u,f),i=u,s=f;(t=i<2?e:s)||!m;){a||(i?i<3?(i>1&&(p.n=-1),d(i,s)):p.n=s:p.v=s);try{if(c=2,a){if(i||(o="next"),t=a[o]){if(!(t=t.call(a,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=a.return)&&t.call(a),i<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),i=1);a=e}else if((t=(m=p.n<0)?s:n.call(r,p))!==l)break}catch(t){a=e,i=1,s=t}finally{c=1}}return{value:t,done:m}}}(n,o,a),!0),c}var l={};function i(){}function s(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(es(t={},r,function(){return this}),t),m=c.prototype=i.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,es(e,o,"GeneratorFunction")),e.prototype=Object.create(m),e}return s.prototype=c,es(m,"constructor",c),es(c,"constructor",s),s.displayName="GeneratorFunction",es(c,o,"GeneratorFunction"),es(m),es(m,o,"Generator"),es(m,r,function(){return this}),es(m,"toString",function(){return"[object Generator]"}),(Qi=function(){return{w:a,m:p}})()}function es(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}es=function(e,t,n,r){if(t)o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{var a=function(t,n){es(e,t,function(e){return this._invoke(t,n,e)})};a("next",0),a("throw",1),a("return",2)}},es(e,t,n,r)}function ts(e,t,n,r,o,a,l){try{var i=e[a](l),s=i.value}catch(e){return void n(e)}i.done?t(s):Promise.resolve(s).then(r,o)}var ns=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5e3;return new Promise(function(n,r){var o=function(){var a=function(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){ts(a,r,o,l,i,"next",e)}function i(e){ts(a,r,o,l,i,"throw",e)}l(void 0)})}}(Qi().m(function a(l){var i,s,c;return Qi().w(function(a){for(;;)switch(a.n){case 0:if(a.p=0,i=null,e)try{localStorage.removeItem("inventoryData")}catch(e){console.warn("Failed to remove data from local storage:",e)}else{try{i=localStorage.getItem("inventoryData")}catch(e){console.warn("Failed to retrieve data from local storage:",e)}i&&setTimeout(function(){var e=JSON.parse(i);return n({status:"success",data:e})},100)}return a.n=1,Ut({path:"/sws/v1/square-inventory".concat(l&&e?"?force=true":"")});case 1:if((s=a.v).loading)l&&M.info("Fetching data, please wait...",{autoClose:2e3,hideProgressBar:!1,closeOnClick:!1}),setTimeout(function(){return o(!1)},t);else if(0===s.data.length)M.info("No data available",{autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),n({status:"success",data:[]});else{try{localStorage.setItem("inventoryData",JSON.stringify(s.data))}catch(e){console.warn("Failed to store data in local storage:",e)}M.success("Products Retreived",{autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),n({status:"success",data:s.data})}a.n=3;break;case 2:a.p=2,c=a.v,M.error("Error fetching products: ".concat(c.message||"Server error"),{autoClose:5e3,closeOnClick:!0}),r({status:"error",error:c.message||"Server error"});case 3:return a.a(2)}},a,null,[[0,2]])}));return function(e){return a.apply(this,arguments)}}();o(!0)})};function rs(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var s=r&&r.prototype instanceof i?r:i,c=Object.create(s.prototype);return os(c,"_invoke",function(n,r,o){var a,i,s,c=0,u=o||[],m=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return a=t,i=0,s=e,p.n=n,l}};function d(n,r){for(i=n,s=r,t=0;!m&&c&&!o&&t<u.length;t++){var o,a=u[t],d=p.p,f=a[2];n>3?(o=f===r)&&(s=a[(i=a[4])?5:(i=3,3)],a[4]=a[5]=e):a[0]<=d&&((o=n<2&&d<a[1])?(i=0,p.v=r,p.n=a[1]):d<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,p.n=f,i=0))}if(o||n>1)return l;throw m=!0,r}return function(o,u,f){if(c>1)throw TypeError("Generator is already running");for(m&&1===u&&d(u,f),i=u,s=f;(t=i<2?e:s)||!m;){a||(i?i<3?(i>1&&(p.n=-1),d(i,s)):p.n=s:p.v=s);try{if(c=2,a){if(i||(o="next"),t=a[o]){if(!(t=t.call(a,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=a.return)&&t.call(a),i<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),i=1);a=e}else if((t=(m=p.n<0)?s:n.call(r,p))!==l)break}catch(t){a=e,i=1,s=t}finally{c=1}}return{value:t,done:m}}}(n,o,a),!0),c}var l={};function i(){}function s(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(os(t={},r,function(){return this}),t),m=c.prototype=i.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,os(e,o,"GeneratorFunction")),e.prototype=Object.create(m),e}return s.prototype=c,os(m,"constructor",c),os(c,"constructor",s),s.displayName="GeneratorFunction",os(c,o,"GeneratorFunction"),os(m),os(m,o,"Generator"),os(m,r,function(){return this}),os(m,"toString",function(){return"[object Generator]"}),(rs=function(){return{w:a,m:p}})()}function os(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}os=function(e,t,n,r){if(t)o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{var a=function(t,n){os(e,t,function(e){return this._invoke(t,n,e)})};a("next",0),a("throw",1),a("return",2)}},os(e,t,n,r)}function as(e,t,n,r,o,a,l){try{var i=e[a](l),s=i.value}catch(e){return void n(e)}i.done?t(s):Promise.resolve(s).then(r,o)}function ls(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){as(a,r,o,l,i,"next",e)}function i(e){as(a,r,o,l,i,"throw",e)}l(void 0)})}}var is=Lo("inventory/fetchIfNeeded",ls(rs().m(function e(){var t,n,r,o,a,l,i,s,c,u,m=arguments;return rs().w(function(e){for(;;)switch(e.n){case 0:if(t=m.length>0&&void 0!==m[0]&&m[0],r=(n=m.length>1?m[1]:void 0).getState,o=n.rejectWithValue,a=r(),l=a.inventory,!t&&null!==l.data){e.n=8;break}return e.p=1,e.n=2,ns(t);case 2:if("success"!==(i=e.v).status){e.n=3;break}return e.a(2,i.data);case 3:if("loading"!==i.status){e.n=4;break}return e.a(2,o("Data is being fetched, please wait..."));case 4:throw new Error(i.error);case 5:e.n=7;break;case 6:return e.p=6,c=e.v,e.a(2,o(c.message));case 7:e.n=16;break;case 8:if(!l.loading){e.n=15;break}return e.p=9,e.n=10,ns(!1);case 10:if("success"!==(s=e.v).status){e.n=11;break}return e.a(2,s.data);case 11:if("loading"!==s.status){e.n=12;break}return e.a(2,o("Data is being fetched, please wait..."));case 12:throw new Error(s.error);case 13:e.n=15;break;case 14:return e.p=14,u=e.v,e.a(2,o(u.message));case 15:return e.a(2,l.data);case 16:return e.a(2)}},e,null,[[9,14],[1,6]])}))),ss=Ao({name:"inventory",initialState:{data:null,loading:!1,error:null,fetchAttempted:!1},reducers:{setInventory:function(e,t){e.data=t.payload},addItem:function(e,t){e.data.push(t.payload)},removeItem:function(e,t){e.data=e.data.filter(function(e){return e.id!==t.payload})}},extraReducers:function(e){e.addCase(is.pending,function(e){e.loading=!0,e.fetchAttempted=!0}).addCase(is.fulfilled,function(e,t){e.loading=!1,e.data=t.payload,e.error=null}).addCase(is.rejected,function(e,t){e.loading=!1,e.data=[],e.error=t.payload})}}),cs=ss.actions;cs.setInventory,cs.addItem,cs.removeItem;const us=ss.reducer;function ms(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var s=r&&r.prototype instanceof i?r:i,c=Object.create(s.prototype);return ps(c,"_invoke",function(n,r,o){var a,i,s,c=0,u=o||[],m=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return a=t,i=0,s=e,p.n=n,l}};function d(n,r){for(i=n,s=r,t=0;!m&&c&&!o&&t<u.length;t++){var o,a=u[t],d=p.p,f=a[2];n>3?(o=f===r)&&(s=a[(i=a[4])?5:(i=3,3)],a[4]=a[5]=e):a[0]<=d&&((o=n<2&&d<a[1])?(i=0,p.v=r,p.n=a[1]):d<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,p.n=f,i=0))}if(o||n>1)return l;throw m=!0,r}return function(o,u,f){if(c>1)throw TypeError("Generator is already running");for(m&&1===u&&d(u,f),i=u,s=f;(t=i<2?e:s)||!m;){a||(i?i<3?(i>1&&(p.n=-1),d(i,s)):p.n=s:p.v=s);try{if(c=2,a){if(i||(o="next"),t=a[o]){if(!(t=t.call(a,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=a.return)&&t.call(a),i<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),i=1);a=e}else if((t=(m=p.n<0)?s:n.call(r,p))!==l)break}catch(t){a=e,i=1,s=t}finally{c=1}}return{value:t,done:m}}}(n,o,a),!0),c}var l={};function i(){}function s(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(ps(t={},r,function(){return this}),t),m=c.prototype=i.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,ps(e,o,"GeneratorFunction")),e.prototype=Object.create(m),e}return s.prototype=c,ps(m,"constructor",c),ps(c,"constructor",s),s.displayName="GeneratorFunction",ps(c,o,"GeneratorFunction"),ps(m),ps(m,o,"Generator"),ps(m,r,function(){return this}),ps(m,"toString",function(){return"[object Generator]"}),(ms=function(){return{w:a,m:p}})()}function ps(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}ps=function(e,t,n,r){if(t)o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{var a=function(t,n){ps(e,t,function(e){return this._invoke(t,n,e)})};a("next",0),a("throw",1),a("return",2)}},ps(e,t,n,r)}function ds(e,t,n,r,o,a,l){try{var i=e[a](l),s=i.value}catch(e){return void n(e)}i.done?t(s):Promise.resolve(s).then(r,o)}function fs(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function gs(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var s=r&&r.prototype instanceof i?r:i,c=Object.create(s.prototype);return hs(c,"_invoke",function(n,r,o){var a,i,s,c=0,u=o||[],m=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return a=t,i=0,s=e,p.n=n,l}};function d(n,r){for(i=n,s=r,t=0;!m&&c&&!o&&t<u.length;t++){var o,a=u[t],d=p.p,f=a[2];n>3?(o=f===r)&&(s=a[(i=a[4])?5:(i=3,3)],a[4]=a[5]=e):a[0]<=d&&((o=n<2&&d<a[1])?(i=0,p.v=r,p.n=a[1]):d<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,p.n=f,i=0))}if(o||n>1)return l;throw m=!0,r}return function(o,u,f){if(c>1)throw TypeError("Generator is already running");for(m&&1===u&&d(u,f),i=u,s=f;(t=i<2?e:s)||!m;){a||(i?i<3?(i>1&&(p.n=-1),d(i,s)):p.n=s:p.v=s);try{if(c=2,a){if(i||(o="next"),t=a[o]){if(!(t=t.call(a,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=a.return)&&t.call(a),i<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),i=1);a=e}else if((t=(m=p.n<0)?s:n.call(r,p))!==l)break}catch(t){a=e,i=1,s=t}finally{c=1}}return{value:t,done:m}}}(n,o,a),!0),c}var l={};function i(){}function s(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(hs(t={},r,function(){return this}),t),m=c.prototype=i.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,hs(e,o,"GeneratorFunction")),e.prototype=Object.create(m),e}return s.prototype=c,hs(m,"constructor",c),hs(c,"constructor",s),s.displayName="GeneratorFunction",hs(c,o,"GeneratorFunction"),hs(m),hs(m,o,"Generator"),hs(m,r,function(){return this}),hs(m,"toString",function(){return"[object Generator]"}),(gs=function(){return{w:a,m:p}})()}function hs(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}hs=function(e,t,n,r){if(t)o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{var a=function(t,n){hs(e,t,function(e){return this._invoke(t,n,e)})};a("next",0),a("throw",1),a("return",2)}},hs(e,t,n,r)}function ys(e,t,n,r,o,a,l){try{var i=e[a](l),s=i.value}catch(e){return void n(e)}i.done?t(s):Promise.resolve(s).then(r,o)}function vs(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){ys(a,r,o,l,i,"next",e)}function i(e){ys(a,r,o,l,i,"throw",e)}l(void 0)})}}function bs(){return ws.apply(this,arguments)}function ws(){return ws=vs(gs().m(function e(){var t,n,r,o,a,l=arguments;return gs().w(function(e){for(;;)switch(e.n){case 0:return t=l.length>0&&void 0!==l[0]?l[0]:0,n=l.length>1&&void 0!==l[1]?l[1]:20,r=l.length>2&&void 0!==l[2]?l[2]:[],e.p=1,e.n=2,Ut({path:"/sws/v1/orders?page=".concat(t,"&per_page=").concat(n)});case 2:if(o=e.v,(a=o.orders||o)&&0!==a.length){e.n=3;break}return e.a(2,r);case 3:if(r=r.concat(a),!(a.length<n)){e.n=4;break}return e.a(2,r);case 4:return e.a(2,bs(t+1,n,r));case 5:throw e.p=5,e.v;case 6:return e.a(2)}},e,null,[[1,5]])})),ws.apply(this,arguments)}var Es=function(){var e=vs(gs().m(function e(){var t,n,r,o,a=arguments;return gs().w(function(e){for(;;)switch(e.n){case 0:return t=a.length>0&&void 0!==a[0]?a[0]:99,n=M.loading("Retrieving Woo Orders"),e.p=1,e.n=2,bs(1,t);case 2:return r=e.v,M.update(n,{render:"Orders Received",type:"success",isLoading:!1,autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),e.a(2,{status:"success",data:{orders:r}});case 3:throw e.p=3,o=e.v,M.update(n,{render:"Error fetching orders: ".concat(o.message||"Server error"),type:"error",isLoading:!1,closeOnClick:!0,autoClose:5e3}),console.error("Error fetching orders:",o),o;case 4:return e.a(2)}},e,null,[[1,3]])}));return function(){return e.apply(this,arguments)}}();function xs(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var s=r&&r.prototype instanceof i?r:i,c=Object.create(s.prototype);return Ss(c,"_invoke",function(n,r,o){var a,i,s,c=0,u=o||[],m=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return a=t,i=0,s=e,p.n=n,l}};function d(n,r){for(i=n,s=r,t=0;!m&&c&&!o&&t<u.length;t++){var o,a=u[t],d=p.p,f=a[2];n>3?(o=f===r)&&(s=a[(i=a[4])?5:(i=3,3)],a[4]=a[5]=e):a[0]<=d&&((o=n<2&&d<a[1])?(i=0,p.v=r,p.n=a[1]):d<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,p.n=f,i=0))}if(o||n>1)return l;throw m=!0,r}return function(o,u,f){if(c>1)throw TypeError("Generator is already running");for(m&&1===u&&d(u,f),i=u,s=f;(t=i<2?e:s)||!m;){a||(i?i<3?(i>1&&(p.n=-1),d(i,s)):p.n=s:p.v=s);try{if(c=2,a){if(i||(o="next"),t=a[o]){if(!(t=t.call(a,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=a.return)&&t.call(a),i<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),i=1);a=e}else if((t=(m=p.n<0)?s:n.call(r,p))!==l)break}catch(t){a=e,i=1,s=t}finally{c=1}}return{value:t,done:m}}}(n,o,a),!0),c}var l={};function i(){}function s(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Ss(t={},r,function(){return this}),t),m=c.prototype=i.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,Ss(e,o,"GeneratorFunction")),e.prototype=Object.create(m),e}return s.prototype=c,Ss(m,"constructor",c),Ss(c,"constructor",s),s.displayName="GeneratorFunction",Ss(c,o,"GeneratorFunction"),Ss(m),Ss(m,o,"Generator"),Ss(m,r,function(){return this}),Ss(m,"toString",function(){return"[object Generator]"}),(xs=function(){return{w:a,m:p}})()}function Ss(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Ss=function(e,t,n,r){if(t)o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{var a=function(t,n){Ss(e,t,function(e){return this._invoke(t,n,e)})};a("next",0),a("throw",1),a("return",2)}},Ss(e,t,n,r)}function ks(e,t,n,r,o,a,l){try{var i=e[a](l),s=i.value}catch(e){return void n(e)}i.done?t(s):Promise.resolve(s).then(r,o)}function Os(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){ks(a,r,o,l,i,"next",e)}function i(e){ks(a,r,o,l,i,"throw",e)}l(void 0)})}}var Ns=Lo("orders/fetchIfNeeded",Os(xs().m(function e(){var t,n,r,o,a,l,i,s,c,u,m=arguments;return xs().w(function(e){for(;;)switch(e.n){case 0:if(n=(t=m.length>0&&void 0!==m[0]?m[0]:{}).forceRefresh,r=void 0!==n&&n,t.page,t.perPage,a=(o=m.length>1?m[1]:void 0).getState,l=o.rejectWithValue,i=a(),s=i.orders,!(r||!s.data||s.data.length<1)){e.n=4;break}return e.p=1,e.n=2,Es();case 2:return c=e.v,e.a(2,c.data.orders);case 3:return e.p=3,u=e.v,e.a(2,l(u.error));case 4:return e.a(2,s.data);case 5:return e.a(2)}},e,null,[[1,3]])}))),Cs=Ao({name:"orders",initialState:{data:null,loading:!1,error:null},reducers:{setOrders:function(e,t){e.data=t.payload}},extraReducers:function(e){e.addCase(Ns.pending,function(e){e.loading=!0}).addCase(Ns.fulfilled,function(e,t){e.loading=!1,e.data=t.payload,e.error=null}).addCase(Ns.rejected,function(e,t){e.loading=!1,e.data=[],e.error=t.payload})}}),js=Cs.actions.setOrders;const Ps=Cs.reducer;function Rs({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{fillRule:"evenodd",d:"M15.312 11.424a5.5 5.5 0 0 1-9.201 2.466l-.312-.311h2.433a.75.75 0 0 0 0-1.5H3.989a.75.75 0 0 0-.75.75v4.242a.75.75 0 0 0 1.5 0v-2.43l.31.31a7 7 0 0 0 11.712-3.138.75.75 0 0 0-1.449-.39Zm1.23-3.723a.75.75 0 0 0 .219-.53V2.929a.75.75 0 0 0-1.5 0V5.36l-.31-.31A7 7 0 0 0 3.239 8.188a.75.75 0 1 0 1.448.389A5.5 5.5 0 0 1 13.89 6.11l.311.31h-2.432a.75.75 0 0 0 0 1.5h4.243a.75.75 0 0 0 .53-.219Z",clipRule:"evenodd"}))}const _s=t.forwardRef(Rs),As=function(e){var t=e.fetchOrders;return e.globalFilter,e.setGlobalFilter,wp.element.createElement("div",{className:"flex flex-col justify-between items-start w-full mb-4"},wp.element.createElement("div",{className:"text-sm leading-6 text-gray-900 pt-4  flex gap-4 items-center"},wp.element.createElement("h2",{className:"text-xl font-semibold"},"Woo Orders"),wp.element.createElement("button",{type:"button",onClick:function(){return t()},className:"relative inline-flex items-center rounded-md bg-sky-500 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},wp.element.createElement(_s,{className:"-ml-0.5 mr-1.5 h-4 w-4 text-white","aria-hidden":"true"}),wp.element.createElement("span",null,"Refresh"))),wp.element.createElement("p",{className:"text-base"},"Integrating your orders with Square seamlessly generates both a transaction and a customer profile. For orders that require fulfillment, such as shipping, they will automatically appear on Square's Orders page."))};function Is({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{fillRule:"evenodd",d:"M8.22 5.22a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L11.94 10 8.22 6.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))}const Ts=t.forwardRef(Is);function Fs({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{fillRule:"evenodd",d:"M9.47 6.47a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 1 1-1.06 1.06L10 8.06l-3.72 3.72a.75.75 0 0 1-1.06-1.06l4.25-4.25Z",clipRule:"evenodd"}))}const Ms=t.forwardRef(Fs),Ls=function(e){var t=e.table;return wp.element.createElement("div",{className:"flex justify-between items-center"},wp.element.createElement("div",{className:"flex items-center gap-2 "},wp.element.createElement("button",{className:"border rounded p-1",onClick:function(){return t.setPageIndex(0)},disabled:!t.getCanPreviousPage()},"<<"),wp.element.createElement("button",{className:"border rounded p-1",onClick:function(){return t.previousPage()},disabled:!t.getCanPreviousPage()},"<"),wp.element.createElement("button",{className:"border rounded p-1",onClick:function(){return t.nextPage()},disabled:!t.getCanNextPage()},">"),wp.element.createElement("button",{className:"border rounded p-1",onClick:function(){return t.setPageIndex(t.getPageCount()-1)},disabled:!t.getCanNextPage()},">>"),wp.element.createElement("span",{className:"flex items-center gap-1"},wp.element.createElement("div",null,"Page"),wp.element.createElement("strong",null,t.getState().pagination.pageIndex+1," of"," ",t.getPageCount())),wp.element.createElement("span",{className:"flex items-center gap-1"},"| Go to page:",wp.element.createElement("input",{type:"number",defaultValue:t.getState().pagination.pageIndex+1,onChange:function(e){var n=e.target.value?Number(e.target.value)-1:0;t.setPageIndex(n)},className:"border p-1 rounded w-16"})),wp.element.createElement("select",{value:t.getState().pagination.pageSize,onChange:function(e){t.setPageSize(Number(e.target.value))}},[10,20,30,40,50].map(function(e){return wp.element.createElement("option",{key:e,value:e},"Show ",e)}))))};function Ds(e){return Ds="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ds(e)}function Gs(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var s=r&&r.prototype instanceof i?r:i,c=Object.create(s.prototype);return qs(c,"_invoke",function(n,r,o){var a,i,s,c=0,u=o||[],m=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return a=t,i=0,s=e,p.n=n,l}};function d(n,r){for(i=n,s=r,t=0;!m&&c&&!o&&t<u.length;t++){var o,a=u[t],d=p.p,f=a[2];n>3?(o=f===r)&&(s=a[(i=a[4])?5:(i=3,3)],a[4]=a[5]=e):a[0]<=d&&((o=n<2&&d<a[1])?(i=0,p.v=r,p.n=a[1]):d<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,p.n=f,i=0))}if(o||n>1)return l;throw m=!0,r}return function(o,u,f){if(c>1)throw TypeError("Generator is already running");for(m&&1===u&&d(u,f),i=u,s=f;(t=i<2?e:s)||!m;){a||(i?i<3?(i>1&&(p.n=-1),d(i,s)):p.n=s:p.v=s);try{if(c=2,a){if(i||(o="next"),t=a[o]){if(!(t=t.call(a,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=a.return)&&t.call(a),i<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),i=1);a=e}else if((t=(m=p.n<0)?s:n.call(r,p))!==l)break}catch(t){a=e,i=1,s=t}finally{c=1}}return{value:t,done:m}}}(n,o,a),!0),c}var l={};function i(){}function s(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(qs(t={},r,function(){return this}),t),m=c.prototype=i.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,qs(e,o,"GeneratorFunction")),e.prototype=Object.create(m),e}return s.prototype=c,qs(m,"constructor",c),qs(c,"constructor",s),s.displayName="GeneratorFunction",qs(c,o,"GeneratorFunction"),qs(m),qs(m,o,"Generator"),qs(m,r,function(){return this}),qs(m,"toString",function(){return"[object Generator]"}),(Gs=function(){return{w:a,m:p}})()}function qs(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}qs=function(e,t,n,r){if(t)o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{var a=function(t,n){qs(e,t,function(e){return this._invoke(t,n,e)})};a("next",0),a("throw",1),a("return",2)}},qs(e,t,n,r)}function Vs(e,t,n,r,o,a,l){try{var i=e[a](l),s=i.value}catch(e){return void n(e)}i.done?t(s):Promise.resolve(s).then(r,o)}function Ws(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zs(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ws(Object(n),!0).forEach(function(t){Bs(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ws(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Bs(e,t,n){return(t=function(e){var t=function(e){if("object"!=Ds(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Ds(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ds(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Hs(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],s=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Us(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Us(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Us(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const $s=function(t){var n=t.data,r=oe(),o=(X(function(e){return e.orders}).loading,Hs((0,e.useState)(""),2)),a=o[0],l=o[1],i=Hs((0,e.useState)([]),2),s=i[0],c=i[1],u=Hs((0,e.useState)({}),2),m=u[0],p=u[1],d=Hs((0,e.useState)(null),2),f=d[0],g=d[1],h=function(e,t){return n.map(function(n){return n&&n.id&&n.id===e?zs(zs({},n),{},{square_data:JSON.stringify(t)}):n})},y=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){Vs(a,r,o,l,i,"next",e)}function i(e){Vs(a,r,o,l,i,"throw",e)}l(void 0)})}}(Gs().m(function e(t){var n,o,a;return Gs().w(function(e){for(;;)switch(e.n){case 0:return g(t),n=M.loading("Attempting to create Square order & transaction"),e.p=1,e.n=2,Ut({path:"/sws/v1/orders",method:"POST",data:{order_id:t}});case 2:(o=e.v).data.payment||o.data.order?(M.update(n,{render:"Created successfully",type:"success",isLoading:!1,autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),r(js(h(t,o.data)))):M.update(n,{render:"Failed to create order & transaction",type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0}),g(null),e.n=4;break;case 3:e.p=3,a=e.v,M.update(n,{render:"Failed to create order & transaction: "+a.error,type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0}),console.log(a),g(null);case 4:return e.a(2)}},e,null,[[1,3]])}));return function(_x){return e.apply(this,arguments)}}(),v=(0,e.useMemo)(function(){return[{id:"expander",width:50,cell:function(e){var t=e.row;return t.getCanExpand()?wp.element.createElement("button",{type:"button",onClick:function(){p(function(e){return zs(zs({},e),{},Bs({},t.id,!e[t.id]))})}},t.getIsExpanded()?wp.element.createElement(nn,{className:"w-4 h-4 text-black"}):wp.element.createElement(Ts,{className:"w-4 h-4 text-black"})):null}},{accessorKey:"id",header:function(){return"ID"},enableSorting:!0},{accessorKey:"date",header:function(){return"Order Created"},enableSorting:!0},{accessorKey:"status",header:function(){return"Order Status"},cell:function(e){var t=(0,e.getValue)();return wp.element.createElement("span",{className:fl("capitalize inline-flex items-center gap-x-1.5 rounded-md px-2 py-1 text-xs font-medium","pending"===t?"bg-orange-100 text-orange-700":"completed"===t?"bg-green-100 text-green-700":"processing"===t?"bg-sky-100 text-sky-700":"bg-gray-100 text-gray-700")},wp.element.createElement("svg",{className:"h-1.5 w-1.5 mt-[2px]",viewBox:"0 0 6 6","aria-hidden":"true",fill:"currentColor"},wp.element.createElement("circle",{cx:3,cy:3,r:3})),t)},enableSorting:!0},{accessorKey:"customer",header:function(){return"Customer"},cell:function(e){var t=(0,e.getValue)();return wp.element.createElement("span",null,t.first_name?t.first_name:"Guest"," ",t.last_name)},enableSorting:!0},{accessorKey:"total",header:function(){return"Order Total"},cell:function(e){var t=e.getValue;return wp.element.createElement("span",null,"$",t())},enableSorting:!0},{accessorKey:"sync_statuc",header:function(){return"Sync Status"},cell:function(e){return e.row.original.square_data?wp.element.createElement("span",{className:"inline-flex items-center gap-x-1.5 rounded-md bg-green-100 px-2 py-1 text-xs font-medium text-green-700"},wp.element.createElement("svg",{className:"h-1.5 w-1.5 fill-green-500",viewBox:"0 0 6 6","aria-hidden":"true"},wp.element.createElement("circle",{cx:"3",cy:"3",r:"3"})),"Synced"):wp.element.createElement("span",{className:"inline-flex items-center gap-x-1.5 rounded-md bg-red-100 px-2 py-1 text-xs font-medium text-red-700"},wp.element.createElement("svg",{className:"h-1.5 w-1.5 fill-red-500",viewBox:"0 0 6 6","aria-hidden":"true"},wp.element.createElement("circle",{cx:3,cy:3,r:3})),"Not synced")},enableSorting:!0},{id:"actions",colSpan:2,cell:function(e){var t=e.row;return wp.element.createElement("div",{className:"flex items-center justify-end gap-2"},wp.element.createElement("button",{type:"button",onClick:function(e){e.stopPropagation(),b.setExpanded(function(e){return zs(zs({},e),{},Bs({},t.id,!e[t.id]))})},className:"rounded  px-2 py-1 text-xs font-semibold text-sky-500 border-sky-500 border hover:border-sky-200 shadow-sm  hover:text-sky-200 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-purple-600 cursor-pointer"},"View details"))}}]},[]),b=Ya(Bs(Bs(Bs({data:n,columns:v,state:{sorting:s,globalFilter:a,expanded:m},filterFns:{custom:ei},onSortingChange:c,onExpandedChange:p,globalFilterFn:"custom",onGlobalFilterChange:l,getCoreRowModel:za(),getSortedRowModel:Za(),getFilteredRowModel:Ua(),getPaginationRowModel:$a(),getExpandedRowModel:Ba()},"onSortingChange",c),"onGlobalFilterChange",l),"debugTable",!0)),w=function(e){return JSON.parse(e)};return wp.element.createElement(React.Fragment,null,wp.element.createElement(As,{fetchOrders:function(){return r(Ns({forceRefresh:!0}))},setGlobalFilter:l,globalFilter:a}),wp.element.createElement("table",{className:"w-full"},wp.element.createElement("thead",{className:"border-b border-gray-900/10 text-sm leading-6 text-gray-900"},b.getHeaderGroups().map(function(e){return wp.element.createElement("tr",{key:e.id},e.headers.map(function(e){var t;return wp.element.createElement("th",{key:e.id,colSpan:e.colSpan,className:"p-2 font-bold text-left"},e.isPlaceholder?null:wp.element.createElement("div",{className:e.column.getCanSort()?"cursor-pointer select-none":"",onClick:e.column.getToggleSortingHandler()},Ka(e.column.columnDef.header,e.getContext()),null!==(t={asc:wp.element.createElement(Ms,{className:"w-4 h-4 inline-block ml-1"}),desc:wp.element.createElement(nn,{className:"w-4 h-4 inline-block ml-1"})}[e.column.getIsSorted()])&&void 0!==t?t:null))}))})),wp.element.createElement("tbody",{className:"divide-y divide-gray-200"},b.getRowModel().rows.map(function(t){return f&&f===t.original.id?wp.element.createElement("tr",{key:t.id},wp.element.createElement("td",{colSpan:100},wp.element.createElement("div",{className:"animate-pulse h-6 bg-gray-200 rounded my-1"}))):wp.element.createElement(e.Fragment,{key:t.id},wp.element.createElement("tr",{className:"cursor-pointer",onClick:function(){b.setExpanded(function(e){return zs(zs({},e),{},Bs({},t.id,!e[t.id]))})}},t.getVisibleCells().map(function(e){return"expander"===e.column.id?wp.element.createElement("td",{key:e.id,className:"py-4 px-2",onClick:function(e){e.stopPropagation(),b.setExpanded(function(e){return zs(zs({},e),{},Bs({},t.id,!e[t.id]))})}},wp.element.createElement("button",{type:"button","aria-label":"Expand row"},t.getIsExpanded()?wp.element.createElement(nn,{className:"w-4 h-4 text-black"}):wp.element.createElement(Ts,{className:"w-4 h-4 text-black"}))):wp.element.createElement("td",{key:e.id,className:"py-4 px-2 text-gray-600"},Ka(e.column.columnDef.cell,e.getContext()))})),t.getIsExpanded()&&wp.element.createElement("tr",null,wp.element.createElement("td",{colSpan:100,className:""}," ",wp.element.createElement("div",{className:"p-6 mb-4 grid md:grid-cols-12 w-full gap-10 bg-slate-50 rounded-b-xl"},wp.element.createElement("div",{className:"md:col-span-full"},wp.element.createElement("div",{className:" flex items-center justify-center gap-4"},wp.element.createElement("a",{className:"rounded  px-2 py-1 text-xs font-semibold text-sky-500 border-sky-500 border hover:border-sky-200 shadow-sm  hover:text-sky-200 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-purple-600 cursor-pointer",href:"/wp-admin/post.php?post=".concat(t.original.id,"&action=edit"),target:"_blank"},"View Woo Order"),t.original.square_data||"completed"!==t.original.status&&"processing"!==t.original.status?wp.element.createElement(React.Fragment,null):wp.element.createElement("button",{type:"button",onClick:function(){return y(t.original.id)},className:"rounded bg-sky-600 px-2 py-1 text-xs font-semibold text-white border border-sky-600 hover:border-sky-500 shadow-sm hover:bg-sky-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-600"},"Sync to Square")),t.original.square_data||"completed"===t.original.status&&"processing"===t.original.status?wp.element.createElement(React.Fragment,null):wp.element.createElement("p",{className:"text-center mt-2 mx-auto max-w-xl"},"Only completed or processing orders can be synced to Square")),wp.element.createElement("div",{className:"md:col-span-6"},wp.element.createElement("p",{className:"font-semibold text-lg mb-4"},"Order Line Items"),wp.element.createElement("ul",{className:"divide-y divide-gray-200"},t.original.line_items.map(function(e){return wp.element.createElement("li",{key:e.product_id,className:"flex gap-2 items-center py-2"},e.image?wp.element.createElement("img",{src:e.image,className:"w-12 h-12 object-contain rounded-lg"}):wp.element.createElement("div",{className:"w-12 h-12 object-contain rounded-lg bg-white flex items-center justify-center"},wp.element.createElement(Zl,null)),wp.element.createElement("div",null,wp.element.createElement("p",{className:"font-semibold"},e.product_name),wp.element.createElement("p",null,"SKU:"," ",wp.element.createElement("span",{className:"text-sky-500"},e.sku)),wp.element.createElement("p",null,"Square product ID:"," ",wp.element.createElement("span",{className:"".concat(e.square_product_id.length>0?"text-sky-500":"text-red-500")},e.square_product_id.length>0?e.square_product_id:"Not Linked")),wp.element.createElement("p",null,"Price: $",e.price," ","x"," ",e.quantity," ","| Total cost: $",e.total)))}))),wp.element.createElement("div",{className:"md:col-span-6"},wp.element.createElement("p",{className:"font-semibold text-lg mb-4"},"Order Totals"),wp.element.createElement("ul",{className:"w-fulldivide-y divide-slate-100"},wp.element.createElement("li",{className:"flex justify-between"},"Subtotal:"," ",wp.element.createElement("strong",null,"$",t.original.order_subtotal.toFixed(2))),wp.element.createElement("li",{className:"flex justify-between"},"Discount Total:"," ",wp.element.createElement("strong",null,"-$",t.original.discount_total)),wp.element.createElement("li",{className:"flex justify-between"},"Shipping Total:"," ",wp.element.createElement("strong",null,"$",t.original.shipping_total)),wp.element.createElement("li",{className:"flex justify-between"},"Total Tax:"," ",wp.element.createElement("strong",null,"$",t.original.total_tax)),wp.element.createElement("li",{className:"flex justify-between"},"Total:"," ",wp.element.createElement("strong",null,"$",t.original.total))),wp.element.createElement("p",{className:"font-semibold text-lg mb-4 mt-8"},"Customer Details"),wp.element.createElement("ul",{className:"divide-y divide-slate-100"},t.original.customer&&Object.keys(t.original.customer).length>0?Object.keys(t.original.customer).map(function(e){return wp.element.createElement(React.Fragment,null,t.original.customer[e]&&wp.element.createElement("li",{key:t.original.customer[e],className:"grid grid-cols-2"},wp.element.createElement("span",{className:"capitalize"},e.replace("_"," "),":")," ",wp.element.createElement("span",{className:"text-left font-bold"},t.original.customer[e])))}):wp.element.createElement("p",null,"Guest Customer"))),wp.element.createElement("div",{className:"md:col-span-full"},wp.element.createElement("p",{className:"font-semibold text-lg mb-4"},"Square Order Details"),t.original.square_data?wp.element.createElement("div",{className:"flex justify-start gap-20 items-start"},wp.element.createElement("div",null,wp.element.createElement("p",{className:"text-base font-semibold"},"Order details:"),wp.element.createElement("p",null,"Order ID:"," ",wp.element.createElement("span",{className:"font-semibold"},w(t.original.square_data).order.data.order.id)),wp.element.createElement("p",null,"Ticket name:"," ",wp.element.createElement("span",{className:"font-semibold"},w(t.original.square_data).order.data.order.ticket_name)),wp.element.createElement("a",{href:"https://squareup.com/dashboard/orders/overview/".concat(w(t.original.square_data).order.data.order.id),target:"_blank",className:"text-sky-500"},"View order")),wp.element.createElement("div",null,w(t.original.square_data).payment&&w(t.original.square_data).payment.data&&wp.element.createElement(React.Fragment,null," ",wp.element.createElement("p",{className:"text-base font-semibold"},"Payment Details:"),wp.element.createElement("p",null,"Payment ID:"," ",wp.element.createElement("span",{className:"font-semibold"},w(t.original.square_data).payment.data.payment.id)),wp.element.createElement("p",null,"Receipt Number:"," ",wp.element.createElement("span",{className:"font-semibold"},w(t.original.square_data).payment.data.payment.receipt_number)),wp.element.createElement("a",{href:w(t.original.square_data).payment.data.payment.receipt_url,target:"_blank",className:"text-sky-500"},"View receipt")))):wp.element.createElement("p",null,"Sync this order with Square to view orders details provided by Square"))))))}))),wp.element.createElement("hr",null),wp.element.createElement("div",{className:"py-4"},wp.element.createElement(Ls,{table:b})))};function Zs(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const Ks=function(){return wp.element.createElement("div",null,wp.element.createElement("div",{className:" sm:px-6 px-4 py-5"},wp.element.createElement("div",{className:"flex flex-wrap items-center justify-start sm:flex-nowrap"},wp.element.createElement("h2",{className:"text-base font-semibold leading-7 text-gray-900"},"Woo Orders"))),wp.element.createElement("div",{className:"overflow-x-auto"},wp.element.createElement("table",{className:"whitespace-nowrap text-left bg-white w-full"},wp.element.createElement("colgroup",null,wp.element.createElement("col",{className:"w-full lg:w-1/12"}),wp.element.createElement("col",{className:"w-full lg:w-2/12"})),wp.element.createElement("thead",{className:"border-b border-gray-900/10 text-sm leading-6 text-gray-900"},wp.element.createElement("tr",null,wp.element.createElement("th",{scope:"col",className:"py-2 pl-4 pr-8 font-semibold sm:pl-6 lg:pl-8"},"ID"),wp.element.createElement("th",{scope:"col",className:"py-2 pl-4 pr-8 font-semibold sm:pl-6 lg:pl-8"},"Order Created"),wp.element.createElement("th",{scope:"col",className:"hidden py-2 pl-0 pr-8 font-semibold sm:table-cell"},"Order Status"),wp.element.createElement("th",{scope:"col",className:"hidden py-2 pl-0 pr-8 font-semibold sm:table-cell"},"Customer"),wp.element.createElement("th",{scope:"col",className:"hidden py-2 pl-0 pr-8 font-semibold sm:table-cell"},"Order Total"),wp.element.createElement("th",{scope:"col",className:"py-2 pl-0 pr-4 text-right font-semibold sm:pr-8 sm:text-left lg:pr-20"},"Sync Status"),wp.element.createElement("th",{scope:"col",className:"hidden py-2 pl-0 pr-4 text-right font-semibold sm:table-cell sm:pr-6 lg:pr-8"},"Actions"))),wp.element.createElement("tbody",{className:"divide-y divide-gray-200 animate-pulse"},function(e){return function(e){if(Array.isArray(e))return Zs(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Zs(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Zs(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(Array(3)).map(function(e,t){return wp.element.createElement("tr",{key:t},wp.element.createElement("td",{colSpan:7,className:"py-2 pl-4 pr-8 sm:pl-6 lg:pl-8"},wp.element.createElement("div",{className:"h-6 bg-gray-200 rounded"})))})))))};function Ys(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var s=r&&r.prototype instanceof i?r:i,c=Object.create(s.prototype);return Xs(c,"_invoke",function(n,r,o){var a,i,s,c=0,u=o||[],m=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return a=t,i=0,s=e,p.n=n,l}};function d(n,r){for(i=n,s=r,t=0;!m&&c&&!o&&t<u.length;t++){var o,a=u[t],d=p.p,f=a[2];n>3?(o=f===r)&&(s=a[(i=a[4])?5:(i=3,3)],a[4]=a[5]=e):a[0]<=d&&((o=n<2&&d<a[1])?(i=0,p.v=r,p.n=a[1]):d<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,p.n=f,i=0))}if(o||n>1)return l;throw m=!0,r}return function(o,u,f){if(c>1)throw TypeError("Generator is already running");for(m&&1===u&&d(u,f),i=u,s=f;(t=i<2?e:s)||!m;){a||(i?i<3?(i>1&&(p.n=-1),d(i,s)):p.n=s:p.v=s);try{if(c=2,a){if(i||(o="next"),t=a[o]){if(!(t=t.call(a,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=a.return)&&t.call(a),i<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),i=1);a=e}else if((t=(m=p.n<0)?s:n.call(r,p))!==l)break}catch(t){a=e,i=1,s=t}finally{c=1}}return{value:t,done:m}}}(n,o,a),!0),c}var l={};function i(){}function s(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Xs(t={},r,function(){return this}),t),m=c.prototype=i.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,Xs(e,o,"GeneratorFunction")),e.prototype=Object.create(m),e}return s.prototype=c,Xs(m,"constructor",c),Xs(c,"constructor",s),s.displayName="GeneratorFunction",Xs(c,o,"GeneratorFunction"),Xs(m),Xs(m,o,"Generator"),Xs(m,r,function(){return this}),Xs(m,"toString",function(){return"[object Generator]"}),(Ys=function(){return{w:a,m:p}})()}function Xs(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Xs=function(e,t,n,r){if(t)o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{var a=function(t,n){Xs(e,t,function(e){return this._invoke(t,n,e)})};a("next",0),a("throw",1),a("return",2)}},Xs(e,t,n,r)}function Js(e,t,n,r,o,a,l){try{var i=e[a](l),s=i.value}catch(e){return void n(e)}i.done?t(s):Promise.resolve(s).then(r,o)}function Qs(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){Js(a,r,o,l,i,"next",e)}function i(e){Js(a,r,o,l,i,"throw",e)}l(void 0)})}}function ec(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],s=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return tc(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?tc(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function tc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function nc(){var t=!1!==(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).autoPrompt,n=ec((0,e.useState)(!0),2),r=n[0],o=n[1],a=ec((0,e.useState)(!1),2),l=a[0],i=a[1],s=ec((0,e.useState)(""),2),c=s[0],u=s[1],m=ec((0,e.useState)(""),2),p=m[0],d=m[1],f=ec((0,e.useState)(!1),2),g=f[0],h=f[1],y=(0,e.useCallback)(Qs(Ys().m(function e(){var t,n,r,o;return Ys().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,Vt()({path:"/sws/v1/square/check-token"});case 1:t=e.v,n=t.exists,r=t.merchant,o=t.merchant_id,i(Boolean(n)),u(r),d(o);case 2:return e.a(2)}},e)})),[]),v=(0,e.useCallback)(Qs(Ys().m(function e(){return Ys().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,Vt()({path:"/sws/v1/square/clear-token",method:"DELETE"});case 1:return e.n=2,y();case 2:return e.a(2)}},e)})),[y]);return(0,e.useEffect)(function(){var e=!1;return Qs(Ys().m(function t(){var n,r,a;return Ys().w(function(t){for(;;)switch(t.n){case 0:if(n=new URL(window.location.href),r=n.searchParams.get("access_token"),a=n.searchParams.get("refresh_token"),t.p=1,!r){t.n=3;break}return t.n=2,Vt()({path:"/sws/v1/square/save-token",method:"POST",data:{access_token:r,refresh_token:a}});case 2:h(!0),n.searchParams.delete("access_token"),n.searchParams.delete("refresh_token"),window.history.replaceState({},"","".concat(n.pathname).concat(n.search).concat(n.hash));case 3:return t.n=4,y();case 4:return t.p=4,e||o(!1),t.f(4);case 5:return t.a(2)}},t,null,[[1,,4,5]])}))(),function(){e=!0}},[y]),{loading:r,isAuthenticated:l,merchantName:c,merchantId:p,justConnected:g,autoPrompt:t,refreshStatus:y,disconnect:v}}function rc(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var s=r&&r.prototype instanceof i?r:i,c=Object.create(s.prototype);return oc(c,"_invoke",function(n,r,o){var a,i,s,c=0,u=o||[],m=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return a=t,i=0,s=e,p.n=n,l}};function d(n,r){for(i=n,s=r,t=0;!m&&c&&!o&&t<u.length;t++){var o,a=u[t],d=p.p,f=a[2];n>3?(o=f===r)&&(s=a[(i=a[4])?5:(i=3,3)],a[4]=a[5]=e):a[0]<=d&&((o=n<2&&d<a[1])?(i=0,p.v=r,p.n=a[1]):d<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,p.n=f,i=0))}if(o||n>1)return l;throw m=!0,r}return function(o,u,f){if(c>1)throw TypeError("Generator is already running");for(m&&1===u&&d(u,f),i=u,s=f;(t=i<2?e:s)||!m;){a||(i?i<3?(i>1&&(p.n=-1),d(i,s)):p.n=s:p.v=s);try{if(c=2,a){if(i||(o="next"),t=a[o]){if(!(t=t.call(a,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=a.return)&&t.call(a),i<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),i=1);a=e}else if((t=(m=p.n<0)?s:n.call(r,p))!==l)break}catch(t){a=e,i=1,s=t}finally{c=1}}return{value:t,done:m}}}(n,o,a),!0),c}var l={};function i(){}function s(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(oc(t={},r,function(){return this}),t),m=c.prototype=i.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,oc(e,o,"GeneratorFunction")),e.prototype=Object.create(m),e}return s.prototype=c,oc(m,"constructor",c),oc(c,"constructor",s),s.displayName="GeneratorFunction",oc(c,o,"GeneratorFunction"),oc(m),oc(m,o,"Generator"),oc(m,r,function(){return this}),oc(m,"toString",function(){return"[object Generator]"}),(rc=function(){return{w:a,m:p}})()}function oc(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}oc=function(e,t,n,r){if(t)o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{var a=function(t,n){oc(e,t,function(e){return this._invoke(t,n,e)})};a("next",0),a("throw",1),a("return",2)}},oc(e,t,n,r)}function ac(e,t,n,r,o,a,l){try{var i=e[a](l),s=i.value}catch(e){return void n(e)}i.done?t(s):Promise.resolve(s).then(r,o)}function lc(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){ac(a,r,o,l,i,"next",e)}function i(e){ac(a,r,o,l,i,"throw",e)}l(void 0)})}}function ic(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],s=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return sc(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?sc(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function sc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var cc=(0,t.createContext)(),uc=function(e){var n=e.children,r=Jn().settings,o=nc().isAuthenticated,a=ic((0,t.useState)([]),2),l=a[0],i=a[1],s=ic((0,t.useState)(!1),2),c=s[0],u=s[1],m=ic((0,t.useState)(""),2),p=m[0],d=m[1];(0,t.useEffect)(function(){if(o||r.accessToken&&r.accessToken.length>2){var e=function(){var e=lc(rc().m(function e(){var t,n;return rc().w(function(e){for(;;)switch(e.n){case 0:return u(!0),e.p=1,e.n=2,Ut({path:"/sws/v1/settings/get-locations",method:"GET"});case 2:t=e.v,i(t.locations.data.locations),didFetch.current=!0,e.n=4;break;case 3:e.p=3,n=e.v,d("Failed to get locations"),M({render:"Failed to get locations: "+n.message,type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0});case 4:return e.p=4,u(!1),e.f(4);case 5:return e.a(2)}},e,null,[[1,3,4,5]])}));return function(){return e.apply(this,arguments)}}();e()}},[r.environment,o,r.accessToken]);var f=(0,t.useCallback)(lc(rc().m(function e(){var t,n;return rc().w(function(e){for(;;)switch(e.n){case 0:return u(!0),e.p=1,e.n=2,Ut({path:"/sws/v1/settings/get-locations",method:"GET"});case 2:t=e.v,i(t.locations.data.locations),e.n=4;break;case 3:e.p=3,n=e.v,d("Failed to get locations"),M.error("Failed to get locations: ".concat(n.message));case 4:return e.p=4,u(!1),e.f(4);case 5:return e.a(2)}},e,null,[[1,3,4,5]])})),[r.environment,r.accessToken]);return wp.element.createElement(cc.Provider,{value:{locations:l,loading:c,error:p,refetchLocations:f,setLocations:i}},n)},mc=function(){return(0,t.useContext)(cc)},pc=function(){return window.location.hostname};function dc(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var s=r&&r.prototype instanceof i?r:i,c=Object.create(s.prototype);return fc(c,"_invoke",function(n,r,o){var a,i,s,c=0,u=o||[],m=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return a=t,i=0,s=e,p.n=n,l}};function d(n,r){for(i=n,s=r,t=0;!m&&c&&!o&&t<u.length;t++){var o,a=u[t],d=p.p,f=a[2];n>3?(o=f===r)&&(s=a[(i=a[4])?5:(i=3,3)],a[4]=a[5]=e):a[0]<=d&&((o=n<2&&d<a[1])?(i=0,p.v=r,p.n=a[1]):d<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,p.n=f,i=0))}if(o||n>1)return l;throw m=!0,r}return function(o,u,f){if(c>1)throw TypeError("Generator is already running");for(m&&1===u&&d(u,f),i=u,s=f;(t=i<2?e:s)||!m;){a||(i?i<3?(i>1&&(p.n=-1),d(i,s)):p.n=s:p.v=s);try{if(c=2,a){if(i||(o="next"),t=a[o]){if(!(t=t.call(a,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=a.return)&&t.call(a),i<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),i=1);a=e}else if((t=(m=p.n<0)?s:n.call(r,p))!==l)break}catch(t){a=e,i=1,s=t}finally{c=1}}return{value:t,done:m}}}(n,o,a),!0),c}var l={};function i(){}function s(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(fc(t={},r,function(){return this}),t),m=c.prototype=i.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,fc(e,o,"GeneratorFunction")),e.prototype=Object.create(m),e}return s.prototype=c,fc(m,"constructor",c),fc(c,"constructor",s),s.displayName="GeneratorFunction",fc(c,o,"GeneratorFunction"),fc(m),fc(m,o,"Generator"),fc(m,r,function(){return this}),fc(m,"toString",function(){return"[object Generator]"}),(dc=function(){return{w:a,m:p}})()}function fc(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}fc=function(e,t,n,r){if(t)o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{var a=function(t,n){fc(e,t,function(e){return this._invoke(t,n,e)})};a("next",0),a("throw",1),a("return",2)}},fc(e,t,n,r)}function gc(e,t,n,r,o,a,l){try{var i=e[a](l),s=i.value}catch(e){return void n(e)}i.done?t(s):Promise.resolve(s).then(r,o)}function hc(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){gc(a,r,o,l,i,"next",e)}function i(e){gc(a,r,o,l,i,"throw",e)}l(void 0)})}}function yc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],s=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return vc(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vc(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function vc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function bc(){var t=Jn(),n=t.settings,r=t.removeAccessToken,o=t.updateSettings,a=mc().setLocations,l=nc(),i=l.loading,s=l.isAuthenticated,c=l.merchantName,u=l.merchantId,m=l.refreshStatus,p=l.disconnect,d=yc((0,e.useState)(!1),2),f=d[0],g=d[1],h=yc((0,e.useState)(!1),2),y=h[0],v=h[1];(0,e.useEffect)(function(){m()},[n.environment,m]);var b=function(){var e=hc(dc().m(function e(){var t,r,o,a;return dc().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,g(!0),e.n=1,fetch("https://api.squaresyncforwoo.com/wp-json/square-oauth/v1/generate-url",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:n.environment||"live",redirect_uri:"".concat(window.location.origin,"/wp-admin/admin.php?page=squarewoosync#/settings/general"),callback_url:"https://".concat(pc(),"/wp-json/sws/v1/square-inventory/update"),plan:"free"})});case 1:return t=e.v,e.n=2,t.json();case 2:if(r=e.v,o=r.oauthUrl){e.n=3;break}throw new Error("No URL from proxy");case 3:window.location.href=o,e.n=5;break;case 4:return e.p=4,a=e.v,console.error(a),M.error("Could not open Square authorisation page."),g(!1),e.n=5,m();case 5:return e.a(2)}},e,null,[[0,4]])}));return function(){return e.apply(this,arguments)}}(),w=function(){var e=hc(dc().m(function e(){var t;return dc().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,e.n=1,p();case 1:M.success("Square connection removed."),a([]),e.n=3;break;case 2:return e.p=2,t=e.v,console.error(t),M.error("Could not disconnect Square."),e.n=3,m();case 3:return e.a(2)}},e,null,[[0,2]])}));return function(){return e.apply(this,arguments)}}(),E=function(){var e=hc(dc().m(function e(){return dc().w(function(e){for(;;)switch(e.n){case 0:return v(!0),e.n=1,r().then(function(){o("location",""),a([]),M.success("Legacy token removed.")});case 1:v(!1);case 2:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}();return wp.element.createElement("div",{className:"space-y-10 px-4 pb-8"},wp.element.createElement("section",null,wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Square connection (OAuth 2.0)"),i?wp.element.createElement("p",{className:"mt-4 text-sm text-gray-600"},"Checking status…"):s?wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"mt-4 flex flex-col gap-4 sm:flex-row sm:items-center"},wp.element.createElement("span",{className:"inline-flex items-center gap-2 rounded-lg bg-emerald-100 px-3 py-1.5 text-sm font-medium text-emerald-700"},wp.element.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",className:"fill-current"},wp.element.createElement("path",{d:"M9.8 16.4 5.3 12l1.5-1.5 3 3 8-8L19.1 6l-9.3 10.4Z"})),"Connected",c?" to ".concat(c," | ").concat(u):""),wp.element.createElement("button",{onClick:w,className:"w-fit rounded-md bg-red-600 px-4 py-2 text-sm font-medium text-white shadow-sm transition hover:bg-red-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-red-500"},"Disconnect Square")),wp.element.createElement("p",{className:"mt-2 max-w-lg text-sm text-gray-600"},"Square is authenticated via OAuth. All synchronisation will use this connection.")):f?wp.element.createElement("p",{className:"mt-4 text-sm text-gray-600"},"Switching environment… redirecting to Square login."):wp.element.createElement(React.Fragment,null,wp.element.createElement("p",{className:"mt-2 max-w-lg text-sm text-gray-600"},"You haven’t linked a Square account yet."),wp.element.createElement("button",{onClick:b,className:"mt-4 inline-flex items-center justify-center rounded-md bg-indigo-600 px-5 py-2.5 text-sm font-medium text-white shadow-sm transition hover:bg-indigo-500 focus-visible:outline focus-visible:ring-4 focus-visible:ring-indigo-300"},"Connect with Square"))),n.accessToken&&wp.element.createElement("details",{className:"rounded-lg border border-gray-200 p-4"},wp.element.createElement("summary",{className:"cursor-pointer select-none text-sm font-medium text-gray-900"},"Legacy access token (deprecated)"),wp.element.createElement("div",{className:"mt-4 space-y-4"},wp.element.createElement("p",{className:"text-sm text-gray-500"},"Your store was configured with the old copy-paste token. You can remove it below. New installs should use OAuth instead."),wp.element.createElement("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center"},wp.element.createElement("input",{type:"text",value:n.accessToken,disabled:!0,className:"block w-full rounded-lg border border-gray-300 px-3 py-2 text-sm text-gray-800 max-w-md"}),wp.element.createElement("button",{onClick:E,disabled:y,className:"w-fit rounded-md bg-red-600 px-4 py-2 text-sm font-medium text-white transition hover:bg-red-500 disabled:cursor-progress"},y?"Removing…":"Remove token")),wp.element.createElement("p",{className:"text-sm text-gray-600"},"Removing the token will stop sync unless OAuth is connected."))))}o(42);const wc=function(){return wp.element.createElement("svg",{className:"animate-spin mt-4 h-5 w-5 text-sky-500",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},wp.element.createElement("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),wp.element.createElement("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"}))};function Ec(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var s=r&&r.prototype instanceof i?r:i,c=Object.create(s.prototype);return xc(c,"_invoke",function(n,r,o){var a,i,s,c=0,u=o||[],m=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return a=t,i=0,s=e,p.n=n,l}};function d(n,r){for(i=n,s=r,t=0;!m&&c&&!o&&t<u.length;t++){var o,a=u[t],d=p.p,f=a[2];n>3?(o=f===r)&&(s=a[(i=a[4])?5:(i=3,3)],a[4]=a[5]=e):a[0]<=d&&((o=n<2&&d<a[1])?(i=0,p.v=r,p.n=a[1]):d<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,p.n=f,i=0))}if(o||n>1)return l;throw m=!0,r}return function(o,u,f){if(c>1)throw TypeError("Generator is already running");for(m&&1===u&&d(u,f),i=u,s=f;(t=i<2?e:s)||!m;){a||(i?i<3?(i>1&&(p.n=-1),d(i,s)):p.n=s:p.v=s);try{if(c=2,a){if(i||(o="next"),t=a[o]){if(!(t=t.call(a,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=a.return)&&t.call(a),i<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),i=1);a=e}else if((t=(m=p.n<0)?s:n.call(r,p))!==l)break}catch(t){a=e,i=1,s=t}finally{c=1}}return{value:t,done:m}}}(n,o,a),!0),c}var l={};function i(){}function s(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(xc(t={},r,function(){return this}),t),m=c.prototype=i.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,xc(e,o,"GeneratorFunction")),e.prototype=Object.create(m),e}return s.prototype=c,xc(m,"constructor",c),xc(c,"constructor",s),s.displayName="GeneratorFunction",xc(c,o,"GeneratorFunction"),xc(m),xc(m,o,"Generator"),xc(m,r,function(){return this}),xc(m,"toString",function(){return"[object Generator]"}),(Ec=function(){return{w:a,m:p}})()}function xc(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}xc=function(e,t,n,r){if(t)o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{var a=function(t,n){xc(e,t,function(e){return this._invoke(t,n,e)})};a("next",0),a("throw",1),a("return",2)}},xc(e,t,n,r)}function Sc(e,t,n,r,o,a,l){try{var i=e[a](l),s=i.value}catch(e){return void n(e)}i.done?t(s):Promise.resolve(s).then(r,o)}function kc(e){var t=e.updateSettings,n=e.locations,r=e.settings,o=e.locationsLoading,a=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){Sc(a,r,o,l,i,"next",e)}function i(e){Sc(a,r,o,l,i,"throw",e)}l(void 0)})}}(Ec().m(function e(n){return Ec().w(function(e){for(;;)switch(e.n){case 0:n.preventDefault(),t("location",n.target.value);case 1:return e.a(2)}},e)}));return function(_x){return e.apply(this,arguments)}}();return wp.element.createElement("div",{className:"px-4 pb-5"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Square Locations"),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500"},wp.element.createElement("p",null,"Select the default location. Used to determine which location to create orders on. You can adjust whether to track stock and import orders to this location specificly or all locations on the products and orders setting pages: ",wp.element.createElement("br",null))),o?wp.element.createElement(wc,null):wp.element.createElement("div",null,wp.element.createElement("select",{id:"location",name:"location",onChange:function(e){return a(e)},value:r.location?r.location:"",className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 mt-2 !pr-10"},wp.element.createElement("option",{value:"",disabled:!0},"Select your location"),n.map(function(e){return wp.element.createElement("option",{key:e.id,value:e.id},e.name)}))))}function Oc({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 0 1 1.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.559.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.894.149c-.424.07-.764.383-.929.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 0 1-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.398.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 0 1-.12-1.45l.527-.737c.25-.35.272-.806.108-1.204-.165-.397-.506-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.108-1.204l-.526-.738a1.125 1.125 0 0 1 .12-1.45l.773-.773a1.125 1.125 0 0 1 1.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894Z"}),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))}function Nc({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 8.25h19.5M2.25 9h19.5m-16.5 5.25h6m-6 2.25h3m-3.75 3h15a2.25 2.25 0 0 0 2.25-2.25V6.75A2.25 2.25 0 0 0 19.5 4.5h-15a2.25 2.25 0 0 0-2.25 2.25v10.5A2.25 2.25 0 0 0 4.5 19.5Z"}))}function Cc({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m20.25 7.5-.625 10.632a2.25 2.25 0 0 1-2.247 2.118H6.622a2.25 2.25 0 0 1-2.247-2.118L3.75 7.5M10 11.25h4M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125Z"}))}function jc({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 0 0 2.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 0 0-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75 2.25 2.25 0 0 0-.1-.664m-5.8 0A2.251 2.251 0 0 1 13.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m0 0H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V9.375c0-.621-.504-1.125-1.125-1.125H8.25ZM6.75 12h.008v.008H6.75V12Zm0 3h.008v.008H6.75V15Zm0 3h.008v.008H6.75V18Z"}))}function Pc({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 11.25v8.25a1.5 1.5 0 0 1-1.5 1.5H5.25a1.5 1.5 0 0 1-1.5-1.5v-8.25M12 4.875A2.625 2.625 0 1 0 9.375 7.5H12m0-2.625V7.5m0-2.625A2.625 2.625 0 1 1 14.625 7.5H12m0 0V21m-8.625-9.75h18c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125h-18c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125Z"}))}var Rc=[{name:"General",href:"/settings/general",icon:t.forwardRef(Oc)},{name:"Payments",href:"/settings/payments",icon:t.forwardRef(Nc)},{name:"Products",href:"/settings/inventory",icon:t.forwardRef(Cc)},{name:"Customers",href:"/settings/customers",icon:Sn},{name:"Orders",href:"/settings/orders",icon:t.forwardRef(jc)},{name:"Loyalty",href:"/settings/loyalty",icon:t.forwardRef(Pc)}];function _c(e){var t=e.children;return hn(),wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"lg:flex lg:gap-x-4 bg-white rounded-2xl shadow-lg p-6"},wp.element.createElement("aside",{className:"flex border-b border-gray-900/5 lg:block lg:w-64 lg:flex-none lg:border-0 "},wp.element.createElement("nav",{className:"flex-none px-4 sm:px-6 lg:px-0"},wp.element.createElement("ul",{role:"list",className:"flex gap-x-3 gap-y-1 whitespace-nowrap lg:flex-col"},Rc.map(function(e){return"Payments"===e.name?wp.element.createElement("li",{key:e.name},wp.element.createElement("a",{href:"/wp-admin/admin.php?page=wc-settings&tab=checkout&section=squaresync_credit",className:fl(location.hash.replace(/^#/,"")===e.href?"bg-gray-50 text-sky-600":"text-gray-700 hover:text-sky-600 hover:bg-gray-50","group flex gap-x-3 rounded-lg py-2 pl-2 pr-3 text-sm leading-6 font-semibold")},wp.element.createElement(e.icon,{className:fl(location.hash.replace(/^#/,"")===e.href?"text-sky-600":"text-gray-400 group-hover:text-sky-600","h-6 w-6 shrink-0"),"aria-hidden":"true"}),e.name)):wp.element.createElement("li",{key:e.name},wp.element.createElement(Ct,{to:e.href,className:fl(location.hash.replace(/^#/,"")===e.href?"bg-gray-50 text-sky-600":"text-gray-700 hover:text-sky-600 hover:bg-gray-50","group flex gap-x-3 rounded-lg py-2 pl-2 pr-3 text-sm leading-6 font-semibold")},wp.element.createElement(e.icon,{className:fl(location.hash.replace(/^#/,"")===e.href?"text-sky-600":"text-gray-400 group-hover:text-sky-600","h-6 w-6 shrink-0"),"aria-hidden":"true"}),e.name))})))),wp.element.createElement("main",{className:"px-4 sm:px-6 lg:flex-auto lg:px-0"},t)))}function Ac(e){return Ac="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ac(e)}function Ic(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var s=r&&r.prototype instanceof i?r:i,c=Object.create(s.prototype);return Tc(c,"_invoke",function(n,r,o){var a,i,s,c=0,u=o||[],m=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return a=t,i=0,s=e,p.n=n,l}};function d(n,r){for(i=n,s=r,t=0;!m&&c&&!o&&t<u.length;t++){var o,a=u[t],d=p.p,f=a[2];n>3?(o=f===r)&&(s=a[(i=a[4])?5:(i=3,3)],a[4]=a[5]=e):a[0]<=d&&((o=n<2&&d<a[1])?(i=0,p.v=r,p.n=a[1]):d<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,p.n=f,i=0))}if(o||n>1)return l;throw m=!0,r}return function(o,u,f){if(c>1)throw TypeError("Generator is already running");for(m&&1===u&&d(u,f),i=u,s=f;(t=i<2?e:s)||!m;){a||(i?i<3?(i>1&&(p.n=-1),d(i,s)):p.n=s:p.v=s);try{if(c=2,a){if(i||(o="next"),t=a[o]){if(!(t=t.call(a,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=a.return)&&t.call(a),i<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),i=1);a=e}else if((t=(m=p.n<0)?s:n.call(r,p))!==l)break}catch(t){a=e,i=1,s=t}finally{c=1}}return{value:t,done:m}}}(n,o,a),!0),c}var l={};function i(){}function s(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Tc(t={},r,function(){return this}),t),m=c.prototype=i.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,Tc(e,o,"GeneratorFunction")),e.prototype=Object.create(m),e}return s.prototype=c,Tc(m,"constructor",c),Tc(c,"constructor",s),s.displayName="GeneratorFunction",Tc(c,o,"GeneratorFunction"),Tc(m),Tc(m,o,"Generator"),Tc(m,r,function(){return this}),Tc(m,"toString",function(){return"[object Generator]"}),(Ic=function(){return{w:a,m:p}})()}function Tc(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Tc=function(e,t,n,r){if(t)o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{var a=function(t,n){Tc(e,t,function(e){return this._invoke(t,n,e)})};a("next",0),a("throw",1),a("return",2)}},Tc(e,t,n,r)}function Fc(e,t,n){return(t=function(e){var t=function(e){if("object"!=Ac(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Ac(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ac(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Mc(e,t,n,r,o,a,l){try{var i=e[a](l),s=i.value}catch(e){return void n(e)}i.done?t(s):Promise.resolve(s).then(r,o)}function Lc(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){Mc(a,r,o,l,i,"next",e)}function i(e){Mc(a,r,o,l,i,"throw",e)}l(void 0)})}}function Dc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Gc(t){var n=t.updateSettings,r=t.settings,o=nc({autoPrompt:!1}).isAuthenticated,a=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],s=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Dc(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Dc(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(!1),2),l=a[0],i=a[1],s=function(){var e=Lc(Ic().m(function e(t,n){var r;return Ic().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,e.n=1,Vt()({path:"/sws/v1/settings/update-gateway-settings",method:"POST",data:Fc({},t,n)});case 1:e.n=3;break;case 2:throw e.p=2,r=e.v,M.error("Failed to update gateway: ".concat(r.message)),r;case 3:return e.a(2)}},e,null,[[0,2]])}));return function(_x,t){return e.apply(this,arguments)}}(),c=function(){var e=Lc(Ic().m(function e(t){var r,a,l,c;return Ic().w(function(e){for(;;)switch(e.n){case 0:return r=t.target.value,i(!0),e.p=1,e.n=2,n("environment",r);case 2:return e.n=3,s("square_mode",r);case 3:if(!o){e.n=7;break}return e.n=4,Vt()({path:"/sws/v1/square/clear-token",method:"DELETE"});case 4:return M.info("Environment switched – please re-authorise Square"),e.n=5,fetch("https://api.squaresyncforwoo.com/wp-json/square-oauth/v1/generate-url",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:r,redirect_uri:"".concat(window.location.origin,"/wp-admin/admin.php?page=squarewoosync-pro#/settings/general")})});case 5:return a=e.v,e.n=6,a.json();case 6:if(l=e.v,!(c=l.oauthUrl)){e.n=7;break}return window.location.href=c,e.a(2);case 7:M.success("Environment updated."),e.n=9;break;case 8:e.p=8,e.v;case 9:return e.p=9,i(!1),e.f(9);case 10:return e.a(2)}},e,null,[[1,8,9,10]])}));return function(t){return e.apply(this,arguments)}}();return wp.element.createElement("div",{className:"px-4 pb-5"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Environment"),wp.element.createElement("p",{className:"mt-2 max-w-xl text-sm text-gray-500"},"Switch between your live Square account and the Sandbox. ",wp.element.createElement("b",null,"Please note"),", to use sandbox you must create a Square developer account and login to the test environment before authenticating. Please refer to the documentation on our website."),wp.element.createElement("select",{id:"environment",className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 mt-2 !pr-10",value:r.environment||"live",onChange:c,disabled:l},wp.element.createElement("option",{value:"live"},"Live"),wp.element.createElement("option",{value:"sandbox"},"Sandbox")))}function qc(){hn();var e=Jn(),t=e.settings,n=e.updateSettings,r=e.settingsLoading,o=mc(),a=o.locations,l=o.loading,i=(o.error,o.refetchLocations);return o.setLocations,wp.element.createElement(_c,null,r?wp.element.createElement("div",null,"Loading..."):wp.element.createElement(React.Fragment,null,wp.element.createElement(bc,null),wp.element.createElement(Gc,{updateSettings:n,environment:t.environment,settings:t}),wp.element.createElement(kc,{updateSettings:n,locations:a,locationsLoading:l,settings:t,refetchLocations:i})))}function Vc(e){return Vc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Vc(e)}function Wc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zc(e,t,n){return(t=function(e){var t=function(e){if("object"!=Vc(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Vc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Vc(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const Hc=function(t){var n=t.settings,r=(t.updateSettings,t.settingsLoading,(0,e.useState)(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Wc(Object(n),!0).forEach(function(t){zc(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wc(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},n.customers.auto.squareWoo))),o=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],s=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Bc(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Bc(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(r,2),a=o[0],l=o[1];return(0,e.useEffect)(function(){l(n.customers.auto.squareWoo)},[n]),a.first_name,a.last_name,a.address,a.phone,a.role,wp.element.createElement("div",{className:"px-4 pb-3 sm:px-6 mt-4"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Automatic Customer Syncing",wp.element.createElement("a",{className:"pro-badge !relative",href:"https://squaresyncforwoo.com",target:"_blank"},"PRO ONLY")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",null,"Sync your customer info in real-time from Square to WooCommerce and vise-versa.",wp.element.createElement("br",null))),wp.element.createElement("div",{className:""},wp.element.createElement("label",{className:"relative inline-flex items-center cursor-pointer justify-start"},wp.element.createElement("input",{type:"checkbox",checked:!1,disabled:!0,className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer  peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all  peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Square to Woo (Webhook customer.updated must be setup)"))))};function Uc(e){return Uc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Uc(e)}function $c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Zc(e,t,n){return(t=function(e){var t=function(e){if("object"!=Uc(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Uc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Uc(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Kc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const Yc=function(t){var n=t.settings,r=(t.updateSettings,t.settingsLoading,(0,e.useState)(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$c(Object(n),!0).forEach(function(t){Zc(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$c(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},n.customers.auto.wooSquare))),o=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],s=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Kc(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Kc(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(r,2),a=o[0],l=o[1];return(0,e.useEffect)(function(){l(n.customers.auto.wooSquare)},[n]),a.first_name,a.last_name,a.address,a.phone,a.role,wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6"},wp.element.createElement("div",{className:""},wp.element.createElement("label",{className:"relative inline-flex items-center cursor-pointer justify-start"},wp.element.createElement("input",{type:"checkbox",checked:!1,disabled:!0,className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer  peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all  peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Woo to Square"))))},Xc=function(e){var t=e.settings;return e.updateSettings,e.setSettings,t.customers,wp.element.createElement("div",{className:"px-4 pb-3 sm:px-6 mt-4"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Auto Customer Matching",wp.element.createElement("a",{className:"pro-badge !relative",href:"https://squaresyncforwoo.com",target:"_blank"},"PRO ONLY")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Automatically match newly created WordPress or Square users with existing accounts on the corresponding platform. This will also set the users role based on the role mapping setup.")),wp.element.createElement("div",{className:"flex flex-col gap-3"},wp.element.createElement("label",{className:"relative inline-flex items-center cursor-pointer justify-start"},wp.element.createElement("input",{type:"checkbox",checked:!1,className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer  peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all  peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Square to Woo (Webhook customer.created must be setup)")),wp.element.createElement("label",{className:"relative inline-flex items-center cursor-pointer justify-start"},wp.element.createElement("input",{type:"checkbox",checked:!1,className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer  peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all  peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Woo to Square"))))},Jc=function(e){var t=e.settings;return e.updateSettings,e.setSettings,t.customers,wp.element.createElement("div",{className:"px-4 pb-3 sm:px-6 mt-4"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Auto Customer Creation",wp.element.createElement("a",{className:"pro-badge !relative",href:"https://squaresyncforwoo.com",target:"_blank"},"PRO ONLY")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Automatically create Square and WordPress users when one is created on either platform. User roles and groups will be automatically assigned based on role mappings.")),wp.element.createElement("div",{className:"flex flex-col gap-3"},wp.element.createElement("label",{className:"relative inline-flex items-center cursor-pointer justify-start"},wp.element.createElement("input",{type:"checkbox",checked:!1,disabled:!0,className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer  peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all  peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Square to Woo (Webhook customer.created must be setup)")),wp.element.createElement("label",{className:"relative inline-flex items-center cursor-pointer justify-start"},wp.element.createElement("input",{type:"checkbox",checked:!1,disabled:!0,className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer  peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all  peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Woo to Square"))))};function Qc(e){return Qc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qc(e)}function eu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function tu(e,t,n){return(t=function(e){var t=function(e){if("object"!=Qc(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Qc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Qc(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const ru=function(t){var n=t.settings,r=(t.updateSettings,t.settingsLoading),o=(0,e.useState)(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?eu(Object(n),!0).forEach(function(t){tu(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):eu(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},n.squareAuto)),a=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],s=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return nu(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?nu(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(o,2),l=a[0],i=a[1];(0,e.useEffect)(function(){i(n.squareAuto)},[n]);var s=function(e){var t=e.id,n=e.label;return e.checked,e.squareWoo,wp.element.createElement("li",{className:"w-auto mb-0"},wp.element.createElement("div",{className:"flex items-center gap-2 p-4"},wp.element.createElement("input",{id:t,type:"checkbox",checked:!1,className:"!m-0 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 focus:ring-2 leading-normal"}),wp.element.createElement("label",{htmlFor:t,className:"w-full text-sm font-light text-gray-700 leading-normal"},n)))},c=[{id:"stock",label:"Stock",checked:l.stock||!1},{id:"title",label:"Title",checked:l.title||!1},{id:"sku",label:"SKU",checked:l.sku||!1},{id:"price",label:"Price",checked:l.price||!1},{id:"description",label:"Description",checked:l.description||!1},{id:"images",label:"Images",checked:l.images||!1},{id:"category",label:"Category",checked:l.category||!1}];return wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Automatic syncing on product update",wp.element.createElement("a",{className:"pro-badge !relative",href:"https://squaresyncforwoo.com",target:"_blank"},"PRO ONLY")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",null,"Enable or disable automatic inventory syncing between Woo and Square effortlessly with our Inventory Sync Toggle. This automatic update is triggered when your Square or Woocommerce data is updated.",wp.element.createElement("br",null),wp.element.createElement("a",{href:"https://squaresyncforwoo.com/documentation#import-data",className:"underline text-sky-500",target:"_blank"},"How to setup and control automatic syncing between Square and Woo"))),wp.element.createElement("div",{className:""},wp.element.createElement("label",{className:"relative inline-flex items-center cursor-pointer justify-start"},wp.element.createElement("input",{type:"checkbox",checked:!1,disabled:!0,className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer  peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all  peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Square to woo (Webhook must be setup)")),l.isActive&&!r&&wp.element.createElement(React.Fragment,null,wp.element.createElement("ul",{className:"text-sm font-medium text-gray-900 bg-white my-3 flex flex-wrap fit-content"},c.map(function(e){return wp.element.createElement(s,{key:e.id,id:e.id,label:e.label,checked:e.checked,squareWoo:l})})))))};function ou(e){return ou="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ou(e)}function au(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function lu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?au(Object(n),!0).forEach(function(t){iu(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):au(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function iu(e,t,n){return(t=function(e){var t=function(e){if("object"!=ou(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ou(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ou(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function su(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const cu=function(t){var n=t.settings,r=t.updateSettings,o=t.settingsLoading,a=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],s=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return su(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?su(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(lu({},n.wooAuto)),2),l=a[0],i=a[1];(0,e.useEffect)(function(){i(n.wooAuto)},[n]);var s=function(e){var t=e.id,n=e.label,o=e.checked;return e.squareWoo,wp.element.createElement("li",{className:"w-auto mb-0"},wp.element.createElement("div",{className:"flex items-center gap-2 p-4"},wp.element.createElement("input",{id:t,type:"checkbox",checked:!1,onChange:function(){return r("wooAuto",lu(lu({},l),{},iu({},t,!o)))},className:"!m-0 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 focus:ring-2 leading-normal"}),wp.element.createElement("label",{htmlFor:t,className:"w-full text-sm font-light text-gray-700 leading-normal"},n)))},c=[{id:"stock",label:"Stock",checked:l.stock||!1}];return wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6"},wp.element.createElement("div",{className:"mb-6"},wp.element.createElement("label",{className:"relative inline-flex items-center cursor-pointer"},wp.element.createElement("input",{type:"checkbox",checked:!1,className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer  peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all  peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Woo to Square")),l.isActive&&!o&&wp.element.createElement(React.Fragment,null,wp.element.createElement("p",{className:"mt-4"},"Sync stock on order processing. Stock/Inventory count is the the sole permitted auto-sync option from Woo to Square (other wise an infinite update loop is created, we don't want that). You can also manually sync from the product actions."),wp.element.createElement("ul",{className:"fit-content flex-wrap items-center justify-start text-sm font-medium text-gray-900 bg-white  sm:flex"},c.map(function(e){return wp.element.createElement(s,{key:e.id,id:e.id,label:e.label,checked:e.checked,squareWoo:l})})))))};var uu=Object.defineProperty,mu=(e,t,n)=>(((e,t,n)=>{t in e?uu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n);let pu=new class{constructor(){mu(this,"current",this.detect()),mu(this,"handoffState","pending"),mu(this,"currentId",0)}set(e){this.current!==e&&(this.handoffState="pending",this.currentId=0,this.current=e)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return"server"===this.current}get isClient(){return"client"===this.current}detect(){return"undefined"==typeof window||"undefined"==typeof document?"server":"client"}handoff(){"pending"===this.handoffState&&(this.handoffState="complete")}get isHandoffComplete(){return"complete"===this.handoffState}},du=(e,n)=>{pu.isServer?(0,t.useEffect)(e,n):(0,t.useLayoutEffect)(e,n)};function fu(e){let n=(0,t.useRef)(e);return du(()=>{n.current=e},[e]),n}let gu=function(e){let n=fu(e);return t.useCallback((...e)=>n.current(...e),[n])};function hu(e,n,r){let[o,a]=(0,t.useState)(r),l=void 0!==e,i=(0,t.useRef)(l),s=(0,t.useRef)(!1),c=(0,t.useRef)(!1);return!l||i.current||s.current?!l&&i.current&&!c.current&&(c.current=!0,i.current=l,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")):(s.current=!0,i.current=l,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")),[l?e:o,gu(e=>(l||a(e),null==n?void 0:n(e)))]}function yu(){let e=[],t={addEventListener:(e,n,r,o)=>(e.addEventListener(n,r,o),t.add(()=>e.removeEventListener(n,r,o))),requestAnimationFrame(...e){let n=requestAnimationFrame(...e);return t.add(()=>cancelAnimationFrame(n))},nextFrame:(...e)=>t.requestAnimationFrame(()=>t.requestAnimationFrame(...e)),setTimeout(...e){let n=setTimeout(...e);return t.add(()=>clearTimeout(n))},microTask(...e){let n={current:!0};return function(e){"function"==typeof queueMicrotask?queueMicrotask(e):Promise.resolve().then(e).catch(e=>setTimeout(()=>{throw e}))}(()=>{n.current&&e[0]()}),t.add(()=>{n.current=!1})},style(e,t,n){let r=e.style.getPropertyValue(t);return Object.assign(e.style,{[t]:n}),this.add(()=>{Object.assign(e.style,{[t]:r})})},group(e){let t=yu();return e(t),this.add(()=>t.dispose())},add:t=>(e.push(t),()=>{let n=e.indexOf(t);if(n>=0)for(let t of e.splice(n,1))t()}),dispose(){for(let t of e.splice(0))t()}};return t}function vu(){let[e]=(0,t.useState)(yu);return(0,t.useEffect)(()=>()=>e.dispose(),[e]),e}var bu;let wu=null!=(bu=t.useId)?bu:function(){let e=function(){let e=function(){let e="undefined"==typeof document;return"useSyncExternalStore"in n&&(e=>e.useSyncExternalStore)(n)(()=>()=>{},()=>!1,()=>!e)}(),[r,o]=t.useState(pu.isHandoffComplete);return r&&!1===pu.isHandoffComplete&&o(!1),t.useEffect(()=>{!0!==r&&o(!0)},[r]),t.useEffect(()=>pu.handoff(),[]),!e&&r}(),[r,o]=t.useState(e?()=>pu.nextId():null);return du(()=>{null===r&&o(pu.nextId())},[r]),null!=r?""+r:void 0};function Eu(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 xu(e,n){let[r,o]=(0,t.useState)(()=>Eu(e));return du(()=>{o(Eu(e))},[e.type,e.as]),du(()=>{r||n.current&&n.current instanceof HTMLButtonElement&&!n.current.hasAttribute("type")&&o("button")},[r,n]),r}let Su=Symbol();function ku(...e){let n=(0,t.useRef)(e);(0,t.useEffect)(()=>{n.current=e},[e]);let r=gu(e=>{for(let t of n.current)null!=t&&("function"==typeof t?t(e):t.current=e)});return e.every(e=>null==e||(null==e?void 0:e[Su]))?void 0:r}function Ou(...e){return Array.from(new Set(e.flatMap(e=>"string"==typeof e?e.split(" "):[]))).filter(Boolean).join(" ")}function Nu(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,Nu),r}var Cu,ju=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(ju||{}),Pu=((Cu=Pu||{})[Cu.Unmount=0]="Unmount",Cu[Cu.Hidden=1]="Hidden",Cu);function Ru({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:a=!0,name:l,mergeRefs:i}){i=null!=i?i:Au;let s=Iu(t,e);if(a)return _u(s,n,r,l,i);let c=null!=o?o:0;if(2&c){let{static:e=!1,...t}=s;if(e)return _u(t,n,r,l,i)}if(1&c){let{unmount:e=!0,...t}=s;return Nu(e?0:1,{0:()=>null,1:()=>_u({...t,hidden:!0,style:{display:"none"}},n,r,l,i)})}return _u(s,n,r,l,i)}function _u(e,n={},r,o,a){let{as:l=r,children:i,refName:s="ref",...c}=Mu(e,["unmount","static"]),u=void 0!==e.ref?{[s]:e.ref}:{},m="function"==typeof i?i(n):i;"className"in c&&c.className&&"function"==typeof c.className&&(c.className=c.className(n));let p={};if(n){let e=!1,t=[];for(let[r,o]of Object.entries(n))"boolean"==typeof o&&(e=!0),!0===o&&t.push(r);e&&(p["data-headlessui-state"]=t.join(" "))}if(l===t.Fragment&&Object.keys(Fu(c)).length>0){if(!(0,t.isValidElement)(m)||Array.isArray(m)&&m.length>1)throw new Error(['Passing props on "Fragment"!',"",`The current component <${o} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(c).map(e=>`  - ${e}`).join("\n"),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(e=>`  - ${e}`).join("\n")].join("\n"));let e=m.props,n="function"==typeof(null==e?void 0:e.className)?(...t)=>Ou(null==e?void 0:e.className(...t),c.className):Ou(null==e?void 0:e.className,c.className),r=n?{className:n}:{};return(0,t.cloneElement)(m,Object.assign({},Iu(m.props,Fu(Mu(c,["ref"]))),p,u,{ref:a(m.ref,u.ref)},r))}return(0,t.createElement)(l,Object.assign({},Mu(c,["ref"]),l!==t.Fragment&&u,l!==t.Fragment&&p),m)}function Au(...e){return e.every(e=>null==e)?void 0:t=>{for(let n of e)null!=n&&("function"==typeof n?n(t):n.current=t)}}function Iu(...e){if(0===e.length)return{};if(1===e.length)return e[0];let t={},n={};for(let r of e)for(let e in r)e.startsWith("on")&&"function"==typeof r[e]?(null!=n[e]||(n[e]=[]),n[e].push(r[e])):t[e]=r[e];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(n).map(e=>[e,void 0])));for(let e in n)Object.assign(t,{[e](t,...r){let o=n[e];for(let e of o){if((t instanceof Event||(null==t?void 0:t.nativeEvent)instanceof Event)&&t.defaultPrevented)return;e(t,...r)}}});return t}function Tu(e){var n;return Object.assign((0,t.forwardRef)(e),{displayName:null!=(n=e.displayName)?n:e.name})}function Fu(e){let t=Object.assign({},e);for(let e in t)void 0===t[e]&&delete t[e];return t}function Mu(e,t=[]){let n=Object.assign({},e);for(let e of t)e in n&&delete n[e];return n}var Lu=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(Lu||{});let Du=Tu(function(e,t){var n;let{features:r=1,...o}=e;return Ru({ourProps:{ref:t,"aria-hidden":!(2&~r)||(null!=(n=o["aria-hidden"])?n:void 0),hidden:!(4&~r)||void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...!(4&~r)&&!!(2&~r)&&{display:"none"}}},theirProps:o,slot:{},defaultTag:"div",name:"Hidden"})});function Gu(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 qu(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))Wu(n,Vu(t,r),o);return n}function Vu(e,t){return e?e+"["+t+"]":t}function Wu(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())Wu(e,Vu(t,r.toString()),o);else n instanceof Date?e.push([t,n.toISOString()]):"boolean"==typeof n?e.push([t,n?"1":"0"]):"string"==typeof n?e.push([t,n]):"number"==typeof n?e.push([t,`${n}`]):null==n?e.push([t,""]):qu(n,t,e)}function zu(e){var t,n;let r=null!=(t=null==e?void 0:e.form)?t:e.closest("form");if(r){for(let t of r.elements)if(t!==e&&("INPUT"===t.tagName&&"submit"===t.type||"BUTTON"===t.tagName&&"submit"===t.type||"INPUT"===t.nodeName&&"image"===t.type))return void t.click();null==(n=r.requestSubmit)||n.call(r)}}let Bu=(0,t.createContext)(null);function Hu(){let e=(0,t.useContext)(Bu);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,Hu),e}return e}function Uu(){let[e,n]=(0,t.useState)([]);return[e.length>0?e.join(" "):void 0,(0,t.useMemo)(()=>function(e){let r=gu(e=>(n(t=>[...t,e]),()=>n(t=>{let n=t.slice(),r=n.indexOf(e);return-1!==r&&n.splice(r,1),n}))),o=(0,t.useMemo)(()=>({register:r,slot:e.slot,name:e.name,props:e.props}),[r,e.slot,e.name,e.props]);return t.createElement(Bu.Provider,{value:o},e.children)},[n])]}let $u=Tu(function(e,t){let n=wu(),{id:r=`headlessui-description-${n}`,...o}=e,a=Hu(),l=ku(t);return du(()=>a.register(r),[r,a.register]),Ru({ourProps:{ref:l,...a.props,id:r},theirProps:o,slot:a.slot||{},defaultTag:"p",name:a.name||"Description"})}),Zu=Object.assign($u,{});var Ku=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(Ku||{});let Yu=(0,t.createContext)(null);function Xu(){let e=(0,t.useContext)(Yu);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,Xu),e}return e}function Ju(){let[e,n]=(0,t.useState)([]);return[e.length>0?e.join(" "):void 0,(0,t.useMemo)(()=>function(e){let r=gu(e=>(n(t=>[...t,e]),()=>n(t=>{let n=t.slice(),r=n.indexOf(e);return-1!==r&&n.splice(r,1),n}))),o=(0,t.useMemo)(()=>({register:r,slot:e.slot,name:e.name,props:e.props}),[r,e.slot,e.name,e.props]);return t.createElement(Yu.Provider,{value:o},e.children)},[n])]}let Qu=Tu(function(e,t){let n=wu(),{id:r=`headlessui-label-${n}`,passive:o=!1,...a}=e,l=Xu(),i=ku(t);du(()=>l.register(r),[r,l.register]);let s={ref:i,...l.props,id:r};return o&&("onClick"in s&&(delete s.htmlFor,delete s.onClick),"onClick"in a&&delete a.onClick),Ru({ourProps:s,theirProps:a,slot:l.slot||{},defaultTag:"label",name:l.name||"Label"})}),em=Object.assign(Qu,{}),tm=(0,t.createContext)(null);tm.displayName="GroupContext";let nm=t.Fragment,rm=Tu(function(e,n){var r;let o=wu(),{id:a=`headlessui-switch-${o}`,checked:l,defaultChecked:i=!1,onChange:s,disabled:c=!1,name:u,value:m,form:p,...d}=e,f=(0,t.useContext)(tm),g=(0,t.useRef)(null),h=ku(g,n,null===f?null:f.setSwitch),[y,v]=hu(l,s,i),b=gu(()=>null==v?void 0:v(!y)),w=gu(e=>{if(Gu(e.currentTarget))return e.preventDefault();e.preventDefault(),b()}),E=gu(e=>{e.key===Ku.Space?(e.preventDefault(),b()):e.key===Ku.Enter&&zu(e.currentTarget)}),x=gu(e=>e.preventDefault()),S=(0,t.useMemo)(()=>({checked:y}),[y]),k={id:a,ref:h,role:"switch",type:xu(e,g),tabIndex:-1===e.tabIndex?0:null!=(r=e.tabIndex)?r:0,"aria-checked":y,"aria-labelledby":null==f?void 0:f.labelledby,"aria-describedby":null==f?void 0:f.describedby,disabled:c,onClick:w,onKeyUp:E,onKeyPress:x},O=vu();return(0,t.useEffect)(()=>{var e;let t=null==(e=g.current)?void 0:e.closest("form");t&&void 0!==i&&O.addEventListener(t,"reset",()=>{v(i)})},[g,v]),t.createElement(t.Fragment,null,null!=u&&y&&t.createElement(Du,{features:Lu.Hidden,...Fu({as:"input",type:"checkbox",hidden:!0,readOnly:!0,disabled:c,form:p,checked:y,name:u,value:m})}),Ru({ourProps:k,theirProps:d,slot:S,defaultTag:"button",name:"Switch"}))}),om=Object.assign(rm,{Group:function(e){var n;let[r,o]=(0,t.useState)(null),[a,l]=Ju(),[i,s]=Uu(),c=(0,t.useMemo)(()=>({switch:r,setSwitch:o,labelledby:a,describedby:i}),[r,o,a,i]),u=e;return t.createElement(s,{name:"Switch.Description"},t.createElement(l,{name:"Switch.Label",props:{htmlFor:null==(n=c.switch)?void 0:n.id,onClick(e){r&&("LABEL"===e.currentTarget.tagName&&e.preventDefault(),r.click(),r.focus({preventScroll:!0}))}}},t.createElement(tm.Provider,{value:c},Ru({ourProps:{},theirProps:u,defaultTag:nm,name:"Switch.Group"}))))},Label:em,Description:Zu});const am=function(e){return e.setSettings,e.updateSettings,e.settings,wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6 mt-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Automatically create Square products",wp.element.createElement("a",{className:"pro-badge !relative",href:"https://squaresyncforwoo.com",target:"_blank"},"PRO ONLY")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"When this feature is enabled, every time you create a new product in WooCommerce, it will automatically be exported and linked to your Square account. This ensures that your product listings are consistently updated across both platforms, saving you time and maintaining synchronization between your WooCommerce store and Square inventory."),wp.element.createElement(om,{checked:!1,className:"bg-gray-200 relative inline-flex h-6 w-11 items-center rounded-full"},wp.element.createElement("span",{className:"sr-only"},"Enable auto product creation"),wp.element.createElement("span",{className:"translate-x-1 inline-block h-4 w-4 transform rounded-full bg-white transition"}))))};function lm(e){return lm="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},lm(e)}function im(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function sm(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?im(Object(n),!0).forEach(function(t){cm(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):im(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function cm(e,t,n){return(t=function(e){var t=function(e){if("object"!=lm(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=lm(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==lm(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function um(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const mm=function(n){var r,o,a,l,i,s=n.settings,c=n.updateSettings,u=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],s=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return um(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?um(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,t.useState)(s.cron.schedule||"hourly"),2),m=u[0],p=u[1];(0,e.useEffect)(function(){s.cron&&s.cron.schedule?p(s.cron.schedule):console.log("Settings not loaded or missing cron.scheduleFrequency")},[s]);var d=[{id:"stock",label:"Stock",checked:(null===(r=s.cron.dataToUpdate)||void 0===r?void 0:r.stock)||!1},{id:"title",label:"Title",checked:(null===(o=s.cron.dataToUpdate)||void 0===o?void 0:o.title)||!1},{id:"sku",label:"SKU",checked:(null===(a=s.cron.dataToUpdate)||void 0===a?void 0:a.sku)||!1},{id:"price",label:"Price",checked:(null===(l=s.cron.dataToUpdate)||void 0===l?void 0:l.price)||!1},{id:"description",label:"Description",checked:(null===(i=s.cron.dataToUpdate)||void 0===i?void 0:i.description)||!1}],f=function(e){var t=e.id,n=e.label,r=e.checked,o=e.cron;return wp.element.createElement("li",{className:"w-auto mb-0"},wp.element.createElement("div",{className:"flex items-center gap-1"},wp.element.createElement("input",{id:t,type:"checkbox",checked:r,onChange:function(){return c("cron",sm(sm({},o),{},{dataToUpdate:sm(sm({},o.dataToUpdate),{},cm({},t,!r))}))},className:"!m-0 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 focus:ring-2 leading-normal"}),wp.element.createElement("label",{htmlFor:t,className:"w-full text-sm font-light text-gray-700 leading-normal"},n)))};return wp.element.createElement("div",null,wp.element.createElement("div",{className:"flex flex-col gap-2 my-2"},wp.element.createElement("fieldset",null,wp.element.createElement("legend",{className:"font-semibold text-base mb-4"},"Select schedule frequency:"),wp.element.createElement("div",{className:"space-y-2"},["hourly","twicedaily","daily","weekly"].map(function(e){return wp.element.createElement("div",{key:e,className:"flex items-center"},wp.element.createElement("input",{id:e,type:"radio",name:"scheduleFrequency",value:e,checked:m===e,onChange:function(e){c("cron",sm(sm({},s.cron),{},{schedule:e.target.value})),p(e.target.value)},className:"focus:ring-sky-500 h-4 w-4 text-sky-600 border-gray-300"}),wp.element.createElement("label",{htmlFor:e,className:"ml-1 block text-sm capitalize"},e," ",wp.element.createElement("span",{className:"text-gray-500 text-sm"},"twicedaily"===e||"daily"===e?"(starting midnight)":"weekly"===e?"(starting monday at midnight)":"")))}),wp.element.createElement("div",{className:"flex items-center"},wp.element.createElement("input",{id:"custom",type:"radio",name:"scheduleFrequency",disabled:!0,className:"focus:ring-sky-500 h-4 w-4 text-sky-600 border-gray-300"}),wp.element.createElement("label",{htmlFor:"custom",className:"ml-1 block text-sm capitalize"},"Custom",wp.element.createElement("span",{className:"text-gray-500 text-sm"}," (coming soon)")))))),wp.element.createElement("p",{className:"font-semibold text-base mt-4"},"Data to update:"),wp.element.createElement("ul",{className:"text-sm font-medium text-gray-900 bg-white flex flex-wrap gap-2 mt-2"},d.map(function(e){return wp.element.createElement(f,{key:e.id,id:e.id,label:e.label,checked:e.checked,cron:s.cron})})))};function pm(e){return pm="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pm(e)}function dm(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function fm(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?dm(Object(n),!0).forEach(function(t){gm(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dm(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function gm(e,t,n){return(t=function(e){var t=function(e){if("object"!=pm(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=pm(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==pm(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function hm(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ym(t){var n=t.settings,r=t.updateSettings,o=t.setSettings,a=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],s=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return hm(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?hm(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)("square"===n.cron.source),2),l=a[0],i=a[1];return wp.element.createElement("div",{className:"blur-sm"},wp.element.createElement("p",{className:"text-base font-semibold mb-2"},"Source of truth:"),wp.element.createElement("p",{className:"text-sm text-gray-500"},"The Source of Trust setting determines the primary source for your product information. Choose Square to automatically sync and update your product details based on data from Square. This option is ideal if Square is your primary platform for inventory and sales management. Alternatively, selecting Woocommerce means your product updates will be based on the information stored within your WooCommerce system, best for those who manage their inventory directly through WooCommerce."),wp.element.createElement("div",{className:"flex gap-2 items-center my-4"},wp.element.createElement("p",{className:"font-semibold text-sm"},"Woocommerce"),wp.element.createElement(om,{checked:l,onChange:function(e){i(e),r("cron",fm(fm({},n.cron),{},{source:e?"square":"woocommerce"}))},className:fl(l?"bg-slate-950":"bg-purple-500","relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-sky-600 focus:ring-offset-2")},wp.element.createElement("span",{className:"sr-only"},"Source of truth"),wp.element.createElement("span",{className:fl(l?"translate-x-5":"translate-x-0","pointer-events-none relative inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out")},wp.element.createElement("span",{className:fl(l?"opacity-0 duration-100 ease-out":"opacity-100 duration-200 ease-in","absolute inset-0 flex h-full w-full items-center justify-center transition-opacity"),"aria-hidden":"true"},wp.element.createElement("span",{className:"font-semibold text-purple-500 p-0 m-0 flex items-center justify-center text-xs leading-none pb-[2px]"},"w")),wp.element.createElement("span",{className:fl(l?"opacity-100 duration-200 ease-in":"opacity-0 duration-100 ease-out","absolute inset-0 flex h-full w-full items-center justify-center transition-opacity"),"aria-hidden":"true"},wp.element.createElement("span",{className:"font-semibold text-slate-950 p-0 m-0 flex items-center justify-center text-xs leading-none pb-[3px]"},"s")))),wp.element.createElement("p",{className:"font-semibold text-sm"},"Square")),wp.element.createElement("p",{className:"text-base font-semibold mb-2"},"Build your own schedule:"),wp.element.createElement("p",{className:"text-sm text-gray-500"},"Setup your update schedule! Please be aware that updating, particularly with a large product inventory, may significantly impact server performance. To minimize potential strain, we recommend spacing your updates to the maximum extent feasible and verifying that your server infrastructure is robust enough to manage the load smoothly. This approach helps ensure a seamless operation and maintains optimal system performance."),wp.element.createElement("div",null,wp.element.createElement(mm,{settings:n,updateSettings:r})),wp.element.createElement("p",{className:"text-base font-semibold mt-4"},"Batches:"),wp.element.createElement("p",{className:"text-sm text-gray-500"},"How many products to be updated per batch. A higher number will put greater load on the server."),wp.element.createElement("p",{className:"mt-2"},"Products will be updated in batches of:"," ",wp.element.createElement("span",{className:"text-sky-500 font-bold"},n.cron.batches)),wp.element.createElement("div",{className:"flex items-center gap-1 mt-2"},wp.element.createElement("p",null,"10"),wp.element.createElement("div",{className:"relative w-[300px]"},wp.element.createElement("input",{id:"steps-range",type:"range",min:"10",max:"100",onChange:function(e){console.log(e),o(function(t){return fm(fm({},t),{},{batches:e.target.value})}),r("cron",fm(fm({},n.cron),{},{batches:e.target.value}))},value:n.cron.batches,step:"10",className:"w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer"})),wp.element.createElement("p",null,"100")))}const vm=function(e){var t=e.setSettings,n=e.updateSettings,r=e.settings;return wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Automatic update scheduler",wp.element.createElement("a",{className:"pro-badge !relative",href:"https://squaresyncforwoo.com",target:"_blank"},"PRO ONLY")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"The Automatic Update Scheduler allows you to set up a recurring schedule for product updates, adding another level of data accuracy, ensuring your information stays current without manual intervention. Simply select the frequency of updates—daily, weekly, or monthly—and the system will automatically apply the latest updates according to your chosen schedule."),wp.element.createElement(om,{checked:r.cron.enabled,className:"".concat(r.cron.enabled?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"sr-only"},"Enable notifications"),wp.element.createElement("span",{className:"".concat(r.cron.enabled?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")}))),wp.element.createElement(ym,{settings:r,updateSettings:n,setSettings:t}))},bm=function(e){e.setSettings,e.updateSettings;var t=e.settings;return wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6 mt-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Automatically delete Square & Woo products",wp.element.createElement("a",{className:"pro-badge !relative",href:"https://squaresyncforwoo.com",target:"_blank"},"PRO ONLY")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Choose whether to automatically delete or archive products in Square or WooCommerce when they are removed from their respective catalogs. Archived products in Square will be put to 'draft' in WooCommerce, whereas deleted products will be moved to trash."),t.squareAuto.isActive?wp.element.createElement(React.Fragment,null,"  ",wp.element.createElement("div",{className:"flex items-center"},wp.element.createElement(om,{checked:t.wooAuto.autoDeleteProduct,className:"".concat(t.wooAuto.autoDeleteProduct?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"sr-only"},"Enable auto product deletion"),wp.element.createElement("span",{className:"".concat(t.wooAuto.autoDeleteProduct?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Woo to Square")),wp.element.createElement("div",{className:"flex items-center mt-4"},wp.element.createElement(om,{checked:t.squareAuto.autoDeleteProduct,className:"".concat(t.squareAuto.autoDeleteProduct?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"sr-only"},"Enable auto product deletion"),wp.element.createElement("span",{className:"".concat(t.squareAuto.autoDeleteProduct?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Square to Woo"))):wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"font-semibold"},"Square to Woo automatic syncing on product update with webhook setup must be enabled to use this feature."))))},wm=function(e){return e.updateSettings,e.settings,wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6 mt-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Automatically create WooCommerce products",wp.element.createElement("a",{className:"pro-badge !relative",href:"https://squaresyncforwoo.com",target:"_blank"},"PRO ONLY")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"When this feature is enabled, every time you create a new product in Square, it will be imported into WooCommerce and linked automatically. This ensures that your product listings are consistently updated across both platforms, saving you time and maintaining synchronization between your WooCommerce store and Square inventory. ",wp.element.createElement("span",{className:"italic font-semibold"},"Automatic syncing on product update (Square to Woo) must be enabled."))))};function Em(e){return pu.isServer?null:e instanceof Node?e.ownerDocument:null!=e&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}let xm=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var Sm=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e))(Sm||{}),km=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(km||{}),Om=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(Om||{});var Nm=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Nm||{}),Cm=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(Cm||{});"undefined"!=typeof window&&"undefined"!=typeof document&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{1===e.detail?delete document.documentElement.dataset.headlessuiFocusVisible:0===e.detail&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));let jm=["textarea","input"].join(",");function Pm(e,t=e=>e){return e.slice().sort((e,n)=>{let r=t(e),o=t(n);if(null===r||null===o)return 0;let a=r.compareDocumentPosition(o);return a&Node.DOCUMENT_POSITION_FOLLOWING?-1:a&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function Rm(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let a=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,l=Array.isArray(e)?n?Pm(e):e:function(e=document.body){return null==e?[]:Array.from(e.querySelectorAll(xm)).sort((e,t)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER)))}(e);o.length>0&&l.length>1&&(l=l.filter(e=>!o.includes(e))),r=null!=r?r:a.activeElement;let i,s=(()=>{if(5&t)return 1;if(10&t)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),c=(()=>{if(1&t)return 0;if(2&t)return Math.max(0,l.indexOf(r))-1;if(4&t)return Math.max(0,l.indexOf(r))+1;if(8&t)return l.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),u=32&t?{preventScroll:!0}:{},m=0,p=l.length;do{if(m>=p||m+p<=0)return 0;let e=c+m;if(16&t)e=(e+p)%p;else{if(e<0)return 3;if(e>=p)return 1}i=l[e],null==i||i.focus(u),m+=s}while(i!==a.activeElement);return 6&t&&function(e){var t,n;return null!=(n=null==(t=null==e?void 0:e.matches)?void 0:t.call(e,jm))&&n}(i)&&i.select(),2}var _m=(e=>(e[e.RegisterOption=0]="RegisterOption",e[e.UnregisterOption=1]="UnregisterOption",e))(_m||{});let Am={0(e,t){let n=[...e.options,{id:t.id,element:t.element,propsRef:t.propsRef}];return{...e,options:Pm(n,e=>e.element.current)}},1(e,t){let n=e.options.slice(),r=e.options.findIndex(e=>e.id===t.id);return-1===r?e:(n.splice(r,1),{...e,options:n})}},Im=(0,t.createContext)(null);function Tm(e){let n=(0,t.useContext)(Im);if(null===n){let t=new Error(`<${e} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,Tm),t}return n}Im.displayName="RadioGroupDataContext";let Fm=(0,t.createContext)(null);function Mm(e){let n=(0,t.useContext)(Fm);if(null===n){let t=new Error(`<${e} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,Mm),t}return n}function Lm(e,t){return Nu(t.type,Am,e,t)}Fm.displayName="RadioGroupActionsContext";var Dm=(e=>(e[e.Empty=1]="Empty",e[e.Active=2]="Active",e))(Dm||{});let Gm=Tu(function(e,n){let r=wu(),{id:o=`headlessui-radiogroup-${r}`,value:a,defaultValue:l,form:i,name:s,onChange:c,by:u=(e,t)=>e===t,disabled:m=!1,...p}=e,d=gu("string"==typeof u?(e,t)=>{let n=u;return(null==e?void 0:e[n])===(null==t?void 0:t[n])}:u),[f,g]=(0,t.useReducer)(Lm,{options:[]}),h=f.options,[y,v]=Ju(),[b,w]=Uu(),E=(0,t.useRef)(null),x=ku(E,n),[S,k]=hu(a,c,l),O=(0,t.useMemo)(()=>h.find(e=>!e.propsRef.current.disabled),[h]),N=(0,t.useMemo)(()=>h.some(e=>d(e.propsRef.current.value,S)),[h,S]),C=gu(e=>{var t;if(m||d(e,S))return!1;let n=null==(t=h.find(t=>d(t.propsRef.current.value,e)))?void 0:t.propsRef.current;return!(null!=n&&n.disabled||(null==k||k(e),0))});!function({container:e,accept:n,walk:r,enabled:o=!0}){let a=(0,t.useRef)(n),l=(0,t.useRef)(r);(0,t.useEffect)(()=>{a.current=n,l.current=r},[n,r]),du(()=>{if(!e||!o)return;let t=Em(e);if(!t)return;let n=a.current,r=l.current,i=Object.assign(e=>n(e),{acceptNode:n}),s=t.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,i,!1);for(;s.nextNode();)r(s.currentNode)},[e,o,a,l])}({container:E.current,accept:e=>"radio"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT,walk(e){e.setAttribute("role","none")}});let j=gu(e=>{let t=E.current;if(!t)return;let n=Em(t),r=h.filter(e=>!1===e.propsRef.current.disabled).map(e=>e.element.current);switch(e.key){case Ku.Enter:zu(e.currentTarget);break;case Ku.ArrowLeft:case Ku.ArrowUp:if(e.preventDefault(),e.stopPropagation(),Rm(r,Sm.Previous|Sm.WrapAround)===km.Success){let e=h.find(e=>e.element.current===(null==n?void 0:n.activeElement));e&&C(e.propsRef.current.value)}break;case Ku.ArrowRight:case Ku.ArrowDown:if(e.preventDefault(),e.stopPropagation(),Rm(r,Sm.Next|Sm.WrapAround)===km.Success){let e=h.find(e=>e.element.current===(null==n?void 0:n.activeElement));e&&C(e.propsRef.current.value)}break;case Ku.Space:{e.preventDefault(),e.stopPropagation();let t=h.find(e=>e.element.current===(null==n?void 0:n.activeElement));t&&C(t.propsRef.current.value)}}}),P=gu(e=>(g({type:0,...e}),()=>g({type:1,id:e.id}))),R=(0,t.useMemo)(()=>({value:S,firstOption:O,containsCheckedOption:N,disabled:m,compare:d,...f}),[S,O,N,m,d,f]),_=(0,t.useMemo)(()=>({registerOption:P,change:C}),[P,C]),A={ref:x,id:o,role:"radiogroup","aria-labelledby":y,"aria-describedby":b,onKeyDown:j},I=(0,t.useMemo)(()=>({value:S}),[S]),T=(0,t.useRef)(null),F=vu();return(0,t.useEffect)(()=>{T.current&&void 0!==l&&F.addEventListener(T.current,"reset",()=>{C(l)})},[T,C]),t.createElement(w,{name:"RadioGroup.Description"},t.createElement(v,{name:"RadioGroup.Label"},t.createElement(Fm.Provider,{value:_},t.createElement(Im.Provider,{value:R},null!=s&&null!=S&&qu({[s]:S}).map(([e,n],r)=>t.createElement(Du,{features:Lu.Hidden,ref:0===r?e=>{var t;T.current=null!=(t=null==e?void 0:e.closest("form"))?t:null}:void 0,...Fu({key:e,as:"input",type:"radio",checked:null!=n,hidden:!0,readOnly:!0,form:i,disabled:m,name:e,value:n})})),Ru({ourProps:A,theirProps:p,slot:I,defaultTag:"div",name:"RadioGroup"})))))}),qm=Tu(function(e,n){var r;let o=wu(),{id:a=`headlessui-radiogroup-option-${o}`,value:l,disabled:i=!1,...s}=e,c=(0,t.useRef)(null),u=ku(c,n),[m,p]=Ju(),[d,f]=Uu(),{addFlag:g,removeFlag:h,hasFlag:y}=function(e=0){let[n,r]=(0,t.useState)(e),o=function(){let e=(0,t.useRef)(!1);return du(()=>(e.current=!0,()=>{e.current=!1}),[]),e}(),a=(0,t.useCallback)(e=>{o.current&&r(t=>t|e)},[n,o]),l=(0,t.useCallback)(e=>Boolean(n&e),[n]),i=(0,t.useCallback)(e=>{o.current&&r(t=>t&~e)},[r,o]),s=(0,t.useCallback)(e=>{o.current&&r(t=>t^e)},[r]);return{flags:n,addFlag:a,hasFlag:l,removeFlag:i,toggleFlag:s}}(1),v=fu({value:l,disabled:i}),b=Tm("RadioGroup.Option"),w=Mm("RadioGroup.Option");du(()=>w.registerOption({id:a,element:c,propsRef:v}),[a,w,c,v]);let E=gu(e=>{var t;if(Gu(e.currentTarget))return e.preventDefault();w.change(l)&&(g(2),null==(t=c.current)||t.focus())}),x=gu(e=>{if(Gu(e.currentTarget))return e.preventDefault();g(2)}),S=gu(()=>h(2)),k=(null==(r=b.firstOption)?void 0:r.id)===a,O=b.disabled||i,N=b.compare(b.value,l),C={ref:u,id:a,role:"radio","aria-checked":N?"true":"false","aria-labelledby":m,"aria-describedby":d,"aria-disabled":!!O||void 0,tabIndex:O?-1:N||!b.containsCheckedOption&&k?0:-1,onClick:O?void 0:E,onFocus:O?void 0:x,onBlur:O?void 0:S},j=(0,t.useMemo)(()=>({checked:N,disabled:O,active:y(2)}),[N,O,y]);return t.createElement(f,{name:"RadioGroup.Description"},t.createElement(p,{name:"RadioGroup.Label"},Ru({ourProps:C,theirProps:s,slot:j,defaultTag:"div",name:"RadioGroup.Option"})))}),Vm=Object.assign(Gm,{Option:qm,Label:em,Description:Zu});function Wm(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],s=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return zm(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?zm(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function zm(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Bm=[{id:"square",title:"Let Square calculate",description:"Square will calculate points based on items contained in the order id. Item eligibility is determined by Square settings.",pros:["Points will be assigned to order and transaction","Easy to track point earning"],cons:["Shipping will be included in point calculation","May earn more points then desired"]},{id:"custom",title:"Custom calculation",description:"This plugin will manually calculate points based on item eligibility defined in Square and program details below.",pros:["Shipping not included in point earnings","Only give points for revenue generating items"],cons:["Points are not tied to Square order or transaction","Harder to track point earning"]}],Hm=[{id:"square",title:"Square redemption",description:"We'll use Square's orders  and loyalty API to attached reward redemptions to orders and transcations.",pros:["Reward redemptions are tied to orders","Easy to track point earning"],cons:["Must use SquareSync for Woo payment gateway","Strict point redemption"]},{id:"custom",title:"Custom redemption",description:"Using a custom integration, we'll adjust a customers points manually.",pros:["Compatible with any WooCommerce payment gateway","More flexibility"],cons:["Reward redemptions are added to Square orders as discounts not rewards","Harder to track reward redemptions"]}];const Um=function(t){var n=t.settings,r=(t.updateSettings,t.getLoyaltyProgram,Wm((0,e.useState)(""),2)),o=r[0],a=(r[1],Wm((0,e.useState)(n.loyalty.method),2)),l=a[0],i=a[1],s=Wm((0,e.useState)(n.loyalty.redemptionMethod),2),c=s[0],u=s[1];return(0,e.useEffect)(function(){i(n.loyalty.method),u(n.loyalty.redemptionMethod)},[n]),wp.element.createElement("div",null,wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900 flex gap-2 items-center"},"Loyalty Program",wp.element.createElement(_t,null)),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Integrate Square's Loyalty program into your website, allowing customers to earn points on purchases through online orders.")),wp.element.createElement("div",{className:"flex items-center gap-2"},wp.element.createElement(om,{checked:!1,className:"bg-gray-200 relative inline-flex h-6 w-11 items-center rounded-full"},wp.element.createElement("span",{className:"translate-x-1 inline-block h-4 w-4 transform rounded-full bg-white transition"})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Enable or disable accrual of points on customer orders")),o&&wp.element.createElement("p",{className:"text-red-600 font-semibold text-sm mt-2"},o),n.loyalty.program&&n.loyalty.enabled&&wp.element.createElement("div",{className:"flex items-center gap-2 mt-4"},wp.element.createElement(om,{checked:!1,className:"".concat(n.loyalty.redeem?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"".concat(n.loyalty.redeem?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Enable or disable redeeming of points on orders")),wp.element.createElement(React.Fragment,null,wp.element.createElement("fieldset",{className:"my-12"},wp.element.createElement("legend",{className:"text-base font-semibold leading-6 text-gray-900 text-center"},"Select a point ",wp.element.createElement("span",{className:"text-sky-500"},"accumulation")," option"),wp.element.createElement("p",{className:"text-center max-w-lg mx-auto text-gray-500"},"Due to the nature of Square and their current API, we have to make a compromise. Pro's and Cons of each are defined below."),wp.element.createElement(Vm,{value:l,className:"mt-6 grid grid-cols-1 gap-y-6 sm:grid-cols-2 sm:gap-x-4"},Bm.map(function(e,t){return wp.element.createElement(Vm.Option,{key:e.id,value:e.id,className:function(e){var t=e.active,n=e.checked;return"group relative flex cursor-pointer rounded-lg border p-4 shadow-sm focus:outline-none ".concat(n?"border-sky-600":"border-gray-300"," ").concat(t?"ring-2 ring-sky-600":"")}},function(n){var r=n.checked;return wp.element.createElement(React.Fragment,null,wp.element.createElement("span",{className:"flex flex-1"},wp.element.createElement("span",{className:"flex flex-col justify-between"},wp.element.createElement("span",{className:"block text-sm font-medium text-gray-900"},e.title),wp.element.createElement("span",{className:"mt-1 flex items-center text-sm text-gray-500"},e.description),wp.element.createElement("div",{className:"mt-4 gap-2 flex flex-col ".concat(1===t&&"flex-col-reverse")},e.pros.map(function(e){return wp.element.createElement("div",{className:"flex gap-2 "},wp.element.createElement(Yt,{className:"min-w-5 w-5 h-5 text-green-500 min-h-5"}),wp.element.createElement("span",{className:" text-sm text-gray-900"},e))}),e.cons.map(function(e){return wp.element.createElement("div",{className:"flex gap-2 "},wp.element.createElement(kl,{className:"min-w-5 w-5 min-h-5 text-red-500"}),wp.element.createElement("span",{className:"text-sm text-gray-900"},e))})))),wp.element.createElement(Yt,{"aria-hidden":"true",className:"h-5 w-5 ".concat(r?"text-sky-600":"invisible")}),wp.element.createElement("span",{"aria-hidden":"true",className:"pointer-events-none absolute -inset-px rounded-lg border-2 ".concat(r?"border-sky-600":"border-transparent")}))})})))),wp.element.createElement(React.Fragment,null,wp.element.createElement("fieldset",{className:"my-12"},wp.element.createElement("legend",{className:"text-base font-semibold leading-6 text-gray-900 text-center"},"Select a point ",wp.element.createElement("span",{className:"text-sky-500"},"redemption")," option"),wp.element.createElement("p",{className:"text-center max-w-lg mx-auto text-gray-500"},"Again, due to the nature of Square and their current API, we have to make a compromise. Pro's and Cons of each are defined below."),wp.element.createElement(Vm,{value:c,className:"mt-6 grid grid-cols-1 gap-y-6 sm:grid-cols-2 sm:gap-x-4"},Hm.map(function(e,t){return wp.element.createElement(Vm.Option,{key:e.id,value:e.id,className:function(e){var t=e.active,n=e.checked;return"group relative flex cursor-pointer rounded-lg border p-4 shadow-sm focus:outline-none ".concat(n?"border-sky-600":"border-gray-300"," ").concat(t?"ring-2 ring-sky-600":"")}},function(n){var r=n.checked;return wp.element.createElement(React.Fragment,null,wp.element.createElement("span",{className:"flex flex-1"},wp.element.createElement("span",{className:"flex flex-col justify-between"},wp.element.createElement("span",{className:"block text-sm font-medium text-gray-900"},e.title),wp.element.createElement("span",{className:"mt-1 flex items-center text-sm text-gray-500"},e.description),wp.element.createElement("div",{className:"mt-4 gap-2 flex flex-col ".concat(1===t&&"flex-col-reverse")},e.pros.map(function(e){return wp.element.createElement("div",{className:"flex gap-2 "},wp.element.createElement(Yt,{className:"min-w-5 w-5 h-5 text-green-500 min-h-5"}),wp.element.createElement("span",{className:" text-sm text-gray-900"},e))}),e.cons.map(function(e){return wp.element.createElement("div",{className:"flex gap-2 "},wp.element.createElement(kl,{className:"min-w-5 w-5 min-h-5 text-red-500"}),wp.element.createElement("span",{className:"text-sm text-gray-900"},e))})))),wp.element.createElement(Yt,{"aria-hidden":"true",className:"h-5 w-5 ".concat(r?"text-sky-600":"invisible")}),wp.element.createElement("span",{"aria-hidden":"true",className:"pointer-events-none absolute -inset-px rounded-lg border-2 ".concat(r?"border-sky-600":"border-transparent")}))})})))))};function $m({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.48 3.499a.562.562 0 0 1 1.04 0l2.125 5.111a.563.563 0 0 0 .475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 0 0-.182.557l1.285 5.385a.562.562 0 0 1-.84.61l-4.725-2.885a.562.562 0 0 0-.586 0L6.982 20.54a.562.562 0 0 1-.84-.61l1.285-5.386a.562.562 0 0 0-.182-.557l-4.204-3.602a.562.562 0 0 1 .321-.988l5.518-.442a.563.563 0 0 0 .475-.345L11.48 3.5Z"}))}const Zm=t.forwardRef($m);function Km(e){var t=e.program;return wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"mt-6 p-4 border rounded-lg border-gray-300"},wp.element.createElement("div",{className:"flex flex-col gap-2 items-center justify-center mb-4 border-b pb-2"},wp.element.createElement(Zm,{className:"size-10"}),wp.element.createElement("h3",{className:"text-lg font-semibold leading-7 text-gray-900 flex gap-2 items-center"},"Your Loyalty Program"),wp.element.createElement("p",{className:"text-center text-gray-500 -mt-2"},"You can only edit your loyalty program on Square")),wp.element.createElement("div",{className:"mb-3"},wp.element.createElement("div",null,wp.element.createElement("h3",{className:"text-base font-semibold leading-7 text-gray-900 flex gap-2 items-center"},"Loyalty Program Terminology"),wp.element.createElement("div",{className:"max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Customize the terminology of your loyalty program to fit your brand (Examples: Star/Stars, Point/Points, Punch/Punches).")))),wp.element.createElement("dl",{className:"divide-y divide-gray-100 border border-gray-200 rounded-lg px-4"},wp.element.createElement("div",{className:"px-4 py-3 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0"},wp.element.createElement("dt",{className:"text-sm font-medium leading-6 text-gray-900"},"Singular"),wp.element.createElement("dd",{className:"mt-1 flex text-sm leading-6 text-gray-700 sm:col-span-2 sm:mt-0"},wp.element.createElement("span",{className:"flex-grow"},t.terminology.one))),wp.element.createElement("div",{className:"px-4 py-3 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0"},wp.element.createElement("dt",{className:"text-sm font-medium leading-6 text-gray-900"},"Plural"),wp.element.createElement("dd",{className:"mt-1 flex text-sm leading-6 text-gray-700 sm:col-span-2 sm:mt-0"},wp.element.createElement("span",{className:"flex-grow"},t.terminology.other)))),wp.element.createElement("div",{className:"px-4 sm:px-0 mt-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-7 text-gray-900"},"Earning Points"),wp.element.createElement("div",{className:"max-w-xl text-sm text-gray-500 mb-2"},wp.element.createElement("p",{className:""},"Allow customers to earn points on purchases made through your website."))),wp.element.createElement("dl",null,wp.element.createElement("div",{className:"-mx-4 flow-root sm:mx-0"},wp.element.createElement("table",{className:"min-w-full"},wp.element.createElement("colgroup",null,wp.element.createElement("col",{className:"sm:w-1/6"}),wp.element.createElement("col",{className:"sm:w-3/6"}),wp.element.createElement("col",{className:"sm:w-2/6"})),wp.element.createElement("thead",{className:"border-b border-gray-300 text-gray-900"},wp.element.createElement("tr",null,wp.element.createElement("th",{scope:"col",className:"py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-0"},"Rule value"),wp.element.createElement("th",{scope:"col",className:"hidden px-3 py-3.5 text-left text-sm font-semibold text-gray-900 sm:table-cell"},"Rule description"))),wp.element.createElement("tbody",null,t.accrual_rules.map(function(e,n){return wp.element.createElement("tr",{key:n,className:"border-b border-gray-200"},wp.element.createElement("td",{className:"max-w-0 py-5 pl-4 pr-3 text-sm sm:pl-0"},wp.element.createElement("div",{className:"font-medium text-gray-900"},e.points," ",1===e.points?t.terminology.one:t.terminology.other)),wp.element.createElement("td",{className:"px-3 py-5 text-left text-sm text-gray-500 sm:table-cell"},wp.element.createElement("div",{className:"mt-1 truncate text-gray-500"},"Earn ",e.points," ",1===e.points?t.terminology.one:t.terminology.other," for every $",(e.spend_data.amount_money.amount/100).toFixed(2)," spend in a single transaction")))}))))),wp.element.createElement("dl",null,wp.element.createElement("div",{className:"px-4 sm:px-0 mt-6 mb-3"},wp.element.createElement("h3",{className:"text-base font-semibold leading-7 text-gray-900"},"Redeeming rewards"),wp.element.createElement("div",{className:"max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Allow customers to redeem their points for discounts on purchases. Currently product and category specific rewards are not supported. Stay tuned for a future release."))),wp.element.createElement("div",{className:"px-4 pb-6 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0"},wp.element.createElement("dd",{className:"mt-1 text-sm leading-6 text-gray-700 sm:col-span-3 sm:mt-0"},wp.element.createElement("div",{className:"-mx-4 flow-root sm:mx-0"},wp.element.createElement("table",{className:"min-w-full"},wp.element.createElement("colgroup",null,wp.element.createElement("col",{className:"sm:w-1/6"}),wp.element.createElement("col",{className:"sm:w-3/6"})),wp.element.createElement("thead",{className:"border-b border-gray-300 text-gray-900"},wp.element.createElement("tr",null,wp.element.createElement("th",{scope:"col",className:"py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-0"},"Reward Value"),wp.element.createElement("th",{scope:"col",className:"hidden px-3 py-3.5 text-left text-sm font-semibold text-gray-900 sm:table-cell"},"Reward Description"))),wp.element.createElement("tbody",null,t.reward_tiers.map(function(e,n){var r;return wp.element.createElement("tr",{key:n,className:"border-b border-gray-200 relative select-none"},wp.element.createElement("td",{className:"max-w-0 py-5 pl-4 pr-3 text-sm sm:pl-0"},wp.element.createElement("div",{className:"font-medium text-gray-900"},e.points," ",1===e.points?t.terminology.one:t.terminology.other)),wp.element.createElement("td",{className:"px-3 py-5 text-left text-sm text-gray-500 sm:table-cell"},wp.element.createElement("div",{className:"mt-1 truncate text-gray-500"},e.name)),(null===(r=e.definition.catalog_object_ids)||void 0===r?void 0:r.length)>0&&wp.element.createElement("td",{className:"absolute left-0 w-full h-full flex justify-center items-center select-none"},wp.element.createElement("div",{className:"w-full h-full bg-red-300 opacity-30 absolute left-0 top-0 z-0"}),wp.element.createElement("div",{className:"relative z-10 text-base font-semibold bg-red-300 p-2"},"Disabled, not yet compatible with plugin")))})))))))))}function Ym(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],s=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Xm(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Xm(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Xm(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Jm(e){return Jm="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Jm(e)}function Qm(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var s=r&&r.prototype instanceof i?r:i,c=Object.create(s.prototype);return ep(c,"_invoke",function(n,r,o){var a,i,s,c=0,u=o||[],m=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return a=t,i=0,s=e,p.n=n,l}};function d(n,r){for(i=n,s=r,t=0;!m&&c&&!o&&t<u.length;t++){var o,a=u[t],d=p.p,f=a[2];n>3?(o=f===r)&&(s=a[(i=a[4])?5:(i=3,3)],a[4]=a[5]=e):a[0]<=d&&((o=n<2&&d<a[1])?(i=0,p.v=r,p.n=a[1]):d<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,p.n=f,i=0))}if(o||n>1)return l;throw m=!0,r}return function(o,u,f){if(c>1)throw TypeError("Generator is already running");for(m&&1===u&&d(u,f),i=u,s=f;(t=i<2?e:s)||!m;){a||(i?i<3?(i>1&&(p.n=-1),d(i,s)):p.n=s:p.v=s);try{if(c=2,a){if(i||(o="next"),t=a[o]){if(!(t=t.call(a,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=a.return)&&t.call(a),i<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),i=1);a=e}else if((t=(m=p.n<0)?s:n.call(r,p))!==l)break}catch(t){a=e,i=1,s=t}finally{c=1}}return{value:t,done:m}}}(n,o,a),!0),c}var l={};function i(){}function s(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(ep(t={},r,function(){return this}),t),m=c.prototype=i.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,ep(e,o,"GeneratorFunction")),e.prototype=Object.create(m),e}return s.prototype=c,ep(m,"constructor",c),ep(c,"constructor",s),s.displayName="GeneratorFunction",ep(c,o,"GeneratorFunction"),ep(m),ep(m,o,"Generator"),ep(m,r,function(){return this}),ep(m,"toString",function(){return"[object Generator]"}),(Qm=function(){return{w:a,m:p}})()}function ep(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}ep=function(e,t,n,r){if(t)o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{var a=function(t,n){ep(e,t,function(e){return this._invoke(t,n,e)})};a("next",0),a("throw",1),a("return",2)}},ep(e,t,n,r)}function tp(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function np(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?tp(Object(n),!0).forEach(function(t){rp(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tp(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function rp(e,t,n){return(t=function(e){var t=function(e){if("object"!=Jm(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Jm(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Jm(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function op(e,t,n,r,o,a,l){try{var i=e[a](l),s=i.value}catch(e){return void n(e)}i.done?t(s):Promise.resolve(s).then(r,o)}function ap(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){op(a,r,o,l,i,"next",e)}function i(e){op(a,r,o,l,i,"throw",e)}l(void 0)})}}function lp(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],s=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ip(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ip(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ip(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var sp=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];function cp(e){return cp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},cp(e)}function up(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var s=r&&r.prototype instanceof i?r:i,c=Object.create(s.prototype);return mp(c,"_invoke",function(n,r,o){var a,i,s,c=0,u=o||[],m=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return a=t,i=0,s=e,p.n=n,l}};function d(n,r){for(i=n,s=r,t=0;!m&&c&&!o&&t<u.length;t++){var o,a=u[t],d=p.p,f=a[2];n>3?(o=f===r)&&(s=a[(i=a[4])?5:(i=3,3)],a[4]=a[5]=e):a[0]<=d&&((o=n<2&&d<a[1])?(i=0,p.v=r,p.n=a[1]):d<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,p.n=f,i=0))}if(o||n>1)return l;throw m=!0,r}return function(o,u,f){if(c>1)throw TypeError("Generator is already running");for(m&&1===u&&d(u,f),i=u,s=f;(t=i<2?e:s)||!m;){a||(i?i<3?(i>1&&(p.n=-1),d(i,s)):p.n=s:p.v=s);try{if(c=2,a){if(i||(o="next"),t=a[o]){if(!(t=t.call(a,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=a.return)&&t.call(a),i<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),i=1);a=e}else if((t=(m=p.n<0)?s:n.call(r,p))!==l)break}catch(t){a=e,i=1,s=t}finally{c=1}}return{value:t,done:m}}}(n,o,a),!0),c}var l={};function i(){}function s(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(mp(t={},r,function(){return this}),t),m=c.prototype=i.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,mp(e,o,"GeneratorFunction")),e.prototype=Object.create(m),e}return s.prototype=c,mp(m,"constructor",c),mp(c,"constructor",s),s.displayName="GeneratorFunction",mp(c,o,"GeneratorFunction"),mp(m),mp(m,o,"Generator"),mp(m,r,function(){return this}),mp(m,"toString",function(){return"[object Generator]"}),(up=function(){return{w:a,m:p}})()}function mp(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}mp=function(e,t,n,r){if(t)o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{var a=function(t,n){mp(e,t,function(e){return this._invoke(t,n,e)})};a("next",0),a("throw",1),a("return",2)}},mp(e,t,n,r)}function pp(e,t,n,r,o,a,l){try{var i=e[a](l),s=i.value}catch(e){return void n(e)}i.done?t(s):Promise.resolve(s).then(r,o)}function dp(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){pp(a,r,o,l,i,"next",e)}function i(e){pp(a,r,o,l,i,"throw",e)}l(void 0)})}}function fp(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function gp(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fp(Object(n),!0).forEach(function(t){hp(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fp(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function hp(e,t,n){return(t=function(e){var t=function(e){if("object"!=cp(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=cp(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==cp(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function yp(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],s=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw o}}return i}}(e,t)||vp(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function vp(e,t){if(e){if("string"==typeof e)return bp(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?bp(e,t):void 0}}function bp(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}o(889);var Ep=[{path:"/",element:function(){return hn(),wp.element.createElement("div",{className:"dashboard-grid gap-x-6 gap-y-6"},wp.element.createElement(Qn,null),wp.element.createElement("div",{className:"flex flex-col gap-6"},wp.element.createElement(At,null),wp.element.createElement(Gt,null)),wp.element.createElement("div",null,wp.element.createElement(gn,null)))}},{path:"/inventory",element:function(){hn();var t=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],s=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return fs(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?fs(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(!1),2),n=(t[0],t[1]),r=Jn(),o=r.settings,a=r.updateSettings;return(0,e.useEffect)(function(){var e=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){ds(a,r,o,l,i,"next",e)}function i(e){ds(a,r,o,l,i,"throw",e)}l(void 0)})}}(ms().m(function e(){var t,r;return ms().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,e.n=1,Ut({path:"/sws/v1/settings/access-token"});case 1:(t=e.v).access_token&&t.access_token.length>0&&"Token not set or empty"!==t.access_token&&n(t.access_token),e.n=3;break;case 2:e.p=2,r=e.v,console.error(r);case 3:return e.a(2)}},e,null,[[0,2]])}));return function(){return e.apply(this,arguments)}}();e()},[]),wp.element.createElement("div",null,wp.element.createElement("div",{className:"bg-white rounded-xl shadow-lg overflow-auto"},wp.element.createElement(Ji,{settings:o,updateSettings:a})))}},{path:"/customers",element:function(){return wp.element.createElement(r().Fragment,null,wp.element.createElement("div",null,wp.element.createElement("div",{className:"bg-white p-6 rounded-xl not-prose grid grid-cols-1 gap-3 sm:grid-cols-2 w-full mb-4"},wp.element.createElement("header",{className:"col-span-full flex gap-2 items-center"},wp.element.createElement("p",{className:"text-xl font-semibold"},"Customer Syncing and Role Mapping"),wp.element.createElement(_t,null)),wp.element.createElement("div",{className:" w-full col-span-full"},wp.element.createElement("ul",{className:"grid grid-cols-2 w-full text-lg gap-x-24 gap-y-3"},wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Customer Import"),wp.element.createElement("p",{className:"text-base"},"Import and link your existing Square customers to WooCommerce")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Role & Group Mapping"),wp.element.createElement("p",{className:"text-base"},"Map Square groups to WordPress roles, perfect for role based pricing or restritced content")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Customer Export"),wp.element.createElement("p",{className:"text-base"},"Export and link your existing WordPress users to Square")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Real-time Customer Sync"),wp.element.createElement("p",{className:"text-base"},"Sync customers from Square and WordPress in real-time.")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Auto Customer Match"),wp.element.createElement("p",{className:"text-base"},"Match your existing WordPress users to Square users automatically")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Auto Customer Create"),wp.element.createElement("p",{className:"text-base"},"Create customers on Square or WordPress automatically")))),wp.element.createElement("h2",{className:"text-xl text-center col-span-full mt-4 font-bold"},"Watch Demo"))),wp.element.createElement("div",{style:{position:"relative",paddingBottom:"56.25%",height:0,overflow:"hidden"}},wp.element.createElement("iframe",{src:"https://www.youtube.com/embed/K4Ac4q7vEGg?si=mKp08JGnHBiiwd6N",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%"},frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,title:"YouTube video"})))}},{path:"/loyalty",element:function(){return wp.element.createElement(r().Fragment,null,wp.element.createElement("div",null,wp.element.createElement("div",{className:"bg-white p-6 rounded-xl not-prose grid grid-cols-1 gap-3 sm:grid-cols-2 w-full mb-4"},wp.element.createElement("header",{className:"col-span-full flex gap-2 items-center"},wp.element.createElement("p",{className:"text-xl font-semibold"},"Square Loyalty Program"),wp.element.createElement(_t,null)),wp.element.createElement("div",{className:" w-full col-span-full"},wp.element.createElement("ul",{className:"grid grid-cols-2 w-full text-lg gap-x-24 gap-y-3"},wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Point Earning"),wp.element.createElement("p",{className:"text-base"},"Customers earn points for every purchase they make, with the ability to set customizable point accrual rates based on purchase amounts.")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Reward Redemption"),wp.element.createElement("p",{className:"text-base"},"Allow customers to redeem their loyalty points for exclusive rewards, discounts, or special offers directly through your online store.")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Auto Customer Loyalty Account Creation"),wp.element.createElement("p",{className:"text-base"},"Automatically create loyalty accounts for customers upon their first purchase, streamlining the process and ensuring seamless point tracking.")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Rewards Dashboard"),wp.element.createElement("p",{className:"text-base"},"A user-friendly dashboard where customers can view their current points balance, reward tiers, and track their progress towards their next reward.")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Customizable Reward Tiers"),wp.element.createElement("p",{className:"text-base"},"Create multiple reward tiers with varying points requirements, allowing you to offer different levels of rewards to your loyal customers.")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Points Progress Tracking"),wp.element.createElement("p",{className:"text-base"},"Display a visual progress bar for customers, showing how close they are to unlocking their next reward, encouraging more purchases.")))),wp.element.createElement("h2",{className:"text-xl text-center col-span-full mt-4 font-bold"},"Watch Demo"))),wp.element.createElement("div",{style:{position:"relative",paddingBottom:"56.25%",height:0,overflow:"hidden"}},wp.element.createElement("iframe",{src:"https://www.youtube.com/embed/kQtLJesQSGI?si=QP4tGkFsKkgB68JD",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%"},frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,title:"YouTube video"})))}},{path:"/orders",element:function(){hn();var t=oe(),n=X(function(e){return e.orders}),r=n.data,o=n.loading,a=n.error;return(0,e.useEffect)(function(){t(Ns())},[t]),wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"bg-white rounded-xl overflow-hidden"},o&&wp.element.createElement(Ks,null),!o&&!a&&wp.element.createElement("div",{className:"sm:px-6 px-4"},r&&r.length>0?wp.element.createElement($s,{data:r.filter(function(e){return null!==e})}):wp.element.createElement("div",null,"No orders found.")),!o&&a&&wp.element.createElement("div",{className:"sm:px-6 px-4 py-5"},"Unable to fetch orders: ",a)))}},{path:"/settings",element:function(){return hn(),wp.element.createElement(qc,null)}},{path:"/settings/general",element:qc},{path:"/settings/payments",element:function(){hn();var t=yp((0,e.useState)({enabled:"no",title:"Credit Card",description:"Pay securely using your credit card.",accepted_credit_cards:["visa","mastercard","amex","discover","jcb","diners","union"],square_application_id_sandbox:"",square_application_id_live:"",enable_google_pay:"no",enable_apple_pay:"no"}),2),n=t[0],r=t[1],o=yp((0,e.useState)({title:!1,description:!1,sandboxId:!1,liveId:!1}),2),a=o[0],l=o[1],i=yp((0,e.useState)(!0),2),s=i[0],c=i[1];(0,e.useEffect)(function(){Vt()({path:"/sws/v1/settings/get-gateway-settings",method:"GET"}).then(function(e){r(e),c(!1)}).catch(function(e){c(!1),M.error("Failed to update settings: ".concat(e.message))})},[]);var u=function(e){var t="yes"===n[e]?"no":"yes";r(function(n){return gp(gp({},n),{},hp({},e,t))}),p(e,t)},m=function(){var e=dp(up().m(function e(t,r){return up().w(function(e){for(;;)switch(e.n){case 0:return l(function(e){return gp(gp({},e),{},hp({},r,!0))}),e.n=1,p(t,n[t]);case 1:l(function(e){return gp(gp({},e),{},hp({},r,!1))});case 2:return e.a(2)}},e)}));return function(_x,t){return e.apply(this,arguments)}}(),p=function(){var e=dp(up().m(function e(t,n){var r,o;return up().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,e.n=1,Vt()({path:"/sws/v1/settings/update-gateway-settings",method:"POST",data:hp({},t,n)});case 1:return r=e.v,M.success("Settings updated successfully!"),e.a(2,r);case 2:e.p=2,o=e.v,M.error("Failed to update settings: ".concat(o.message));case 3:return e.a(2)}},e,null,[[0,2]])}));return function(t,n){return e.apply(this,arguments)}}();return wp.element.createElement(_c,null,wp.element.createElement("div",{className:"px-4"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Payment Settings"),wp.element.createElement("div",null,s?wp.element.createElement(wc,null):wp.element.createElement(React.Fragment,null,wp.element.createElement("p",{className:"mb-4"},"Modify the payment settings for your store."),wp.element.createElement("div",{className:"flex items-center gap-2 mb-4 mt-3"},wp.element.createElement(om,{checked:"yes"===n.enabled,onChange:function(){return u("enabled")},className:"".concat("yes"===n.enabled?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"".concat("yes"===n.enabled?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Enable Gateway")),wp.element.createElement("div",{className:"max-w-xl flex items-end mt-4"},wp.element.createElement("div",{className:"flex-grow items-end"},wp.element.createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},"Title"),wp.element.createElement("input",{type:"text",value:n.title,onChange:function(e){return r(gp(gp({},n),{},{title:e.target.value}))},className:"block w-full !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6"})),wp.element.createElement("button",{onClick:function(){return m("title","title")},type:"button",className:"mt-3 inline-flex w-full items-center justify-center rounded-md bg-sky-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-sky-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-600 sm:ml-3 sm:mt-0 sm:w-auto",loading:a.title},a.title?"Saving...":"Save")),wp.element.createElement("div",{className:"max-w-xl flex items-end mt-4"},wp.element.createElement("div",{className:"flex-grow items-end"},wp.element.createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},"Description"),wp.element.createElement("input",{type:"text",value:n.description,onChange:function(e){return r(gp(gp({},n),{},{description:e.target.value}))},className:"block w-full !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6"})),wp.element.createElement("button",{onClick:function(){return m("description","description")},type:"button",className:"mt-3 inline-flex w-full items-center justify-center rounded-md bg-sky-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-sky-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-600 sm:ml-3 sm:mt-0 sm:w-auto",loading:a.description},a.description?"Saving...":"Save")),wp.element.createElement("div",{className:"max-w-xl flex items-end mt-4"},wp.element.createElement("div",{className:"flex-grow items-end"},wp.element.createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},"Square Sandbox Application ID"),wp.element.createElement("input",{type:"text",value:n.square_application_id_sandbox,onChange:function(e){return r(gp(gp({},n),{},{square_application_id_sandbox:e.target.value}))},className:"block w-full !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6"})),wp.element.createElement("button",{onClick:function(){return m("square_application_id_sandbox","square_application_id_sandbox")},type:"button",className:"mt-3 inline-flex w-full items-center justify-center rounded-md bg-sky-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-sky-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-600 sm:ml-3 sm:mt-0 sm:w-auto",loading:a.square_application_id_sandbox},a.square_application_id_sandbox?"Saving...":"Save")),wp.element.createElement("div",{className:"max-w-xl flex items-end mt-4"},wp.element.createElement("div",{className:"flex-grow items-end"},wp.element.createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},"Square Live Application ID"),wp.element.createElement("input",{type:"text",value:n.square_application_id_live,onChange:function(e){return r(gp(gp({},n),{},{square_application_id_live:e.target.value}))},className:"block w-full !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6"})),wp.element.createElement("button",{onClick:function(){return m("square_application_id_live","square_application_id_live")},type:"button",className:"mt-3 inline-flex w-full items-center justify-center rounded-md bg-sky-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-sky-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-600 sm:ml-3 sm:mt-0 sm:w-auto",loading:a.square_application_id_live},a.square_application_id_live?"Saving...":"Save")),wp.element.createElement("div",{className:"mb-4 mt-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900 mb-3"},"Payment Methods"),wp.element.createElement("div",{className:"grid grid-cols-2 gap-4"},["visa","mastercard","amex","discover","jcb","diners","union"].map(function(e){var t=!!n.accepted_credit_cards&&n.accepted_credit_cards.includes(e);return wp.element.createElement("div",{key:e,className:"flex items-center"},wp.element.createElement("input",{type:"checkbox",checked:t,onChange:function(){return function(e){var t,o=!!n.accepted_credit_cards&&n.accepted_credit_cards.includes(e);t=o?n.accepted_credit_cards.filter(function(t){return t!==e}):[].concat(function(e){return function(e){if(Array.isArray(e))return bp(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||vp(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(n.accepted_credit_cards),[e]),r(function(e){return gp(gp({},e),{},{accepted_credit_cards:t})}),p("accepted_credit_cards",t)}(e)},className:"h-4 w-4 text-sky-600 border-gray-300 rounded"}),wp.element.createElement("label",{htmlFor:e,className:"ml-2 block text-sm font-medium text-gray-700"},e.charAt(0).toUpperCase()+e.slice(1)))}),".")),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900 mt-6"},"Digital Wallets"),wp.element.createElement("div",{className:"flex items-center gap-2 mb-4 mt-6"},wp.element.createElement(om,{checked:"yes"===n.enable_google_pay,onChange:function(){return u("enable_google_pay")},className:"".concat("yes"===n.enable_google_pay?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"".concat("yes"===n.enable_google_pay?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Enable Google Pay")),wp.element.createElement("div",{className:"flex items-center gap-2 mb-4"},wp.element.createElement(om,{checked:"yes"===n.enable_apple_pay,onChange:function(){return u("enable_apple_pay")},className:"".concat("yes"===n.enable_apple_pay?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"".concat("yes"===n.enable_apple_pay?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Enable Apple Pay"))))))}},{path:"/settings/inventory",element:function(){hn();var e=Jn(),t=e.settings,n=e.updateSettings,r=e.settingsLoading;return wp.element.createElement(_c,null,wp.element.createElement(React.Fragment,null,!r&&wp.element.createElement(React.Fragment,null,wp.element.createElement(ru,{settings:t,updateSettings:n,settingsLoading:r}),wp.element.createElement(cu,{settings:t,updateSettings:n,settingsLoading:r}),wp.element.createElement(vm,{settings:t,updateSettings:n}),wp.element.createElement(am,{settings:t,updateSettings:n}),wp.element.createElement(wm,{settings:t,updateSettings:n}),wp.element.createElement(bm,{settings:t,updateSettings:n}))))}},{path:"/settings/customers",element:function(){hn();var e=Jn(),t=e.settings,n=e.updateSettings,r=e.settingsLoading;return wp.element.createElement(_c,null,wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6  text-black"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Filter Square Customers",wp.element.createElement("a",{className:"pro-badge !relative",href:"https://squaresyncforwoo.com",target:"_blank"},"PRO ONLY")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Select the Square customer segment or group you wish to use for WordPress syncing (if any)."))),wp.element.createElement(Hc,{settings:t,updateSettings:n,settingsLoading:r}),wp.element.createElement(Yc,{settings:t,updateSettings:n,settingsLoading:r}),wp.element.createElement(Xc,{settings:t,updateSettings:n,settingsLoading:r}),wp.element.createElement(Jc,{settings:t,updateSettings:n,settingsLoading:r})))}},{path:"/settings/orders",element:function(){hn();var t=Jn(),n=t.settings,r=t.updateSettings,o=t.settingsLoading,a=lp((0,e.useState)([]),2),l=a[0],i=a[1],s=lp((0,e.useState)(!0),2),c=s[0],u=s[1],m=lp((0,e.useState)(),2),p=m[0],d=m[1],f=lp((0,e.useState)(!0),2),g=f[0],h=f[1];(0,e.useEffect)(function(){var e=function(){var e=ap(Qm().m(function e(){return Qm().w(function(e){for(;;)switch(e.n){case 0:Vt()({path:"/sws/v1/settings/get-gateway-settings",method:"GET"}).then(function(e){d(function(t){return np(np({},t),e)}),h(!1)}).catch(function(e){h(!1),M({render:"Failed to update settings: "+e.message,type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0})});case 1:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}();e()},[]),(0,e.useEffect)(function(){u(!0);var e=function(){var e=ap(Qm().m(function e(){return Qm().w(function(e){for(;;)switch(e.n){case 0:Vt()({path:"/sws/v1/settings/get-shipping-methods",method:"GET"}).then(function(e){i(e),u(!1)}).catch(function(e){M({render:"Failed to get shipping methods: "+e.message,type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0}),u(!1)});case 1:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}();e()},[]);var y=n.orders.pickupSchedule||sp.reduce(function(e,t){return np(np({},e),{},rp({},t,{enabled:!1,from:"09:00",to:"17:00"}))},{});return wp.element.createElement(_c,null,wp.element.createElement(React.Fragment,null,o&&!g?wp.element.createElement("div",null,"Loading..."):wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Automatic Order Sync"),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Streamline your business operations by synchronizing your WooCommerce orders with Square automatically."),p&&"yes"!==p.enabled?wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("div",{className:"flex items-center gap-2"},wp.element.createElement(om,{checked:n.orders.enabled,onChange:function(e){r("orders",np(np({},n.orders),{},{enabled:e}))},className:"".concat(n.orders.enabled?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"".concat(n.orders.enabled?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Enable or disable automatic order sync")),wp.element.createElement("div",{className:"flex items-center gap-2 mt-4"},wp.element.createElement(om,{checked:n.orders.transactions,onChange:function(e){r("orders",np(np({},n.orders),{},{transactions:e}))},className:"".concat(n.orders.transactions?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"".concat(n.orders.transactions?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Enable or disable transaction/receipt sync")),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900 mt-6"},"Woo Status"),wp.element.createElement("p",{className:"mb-4"},"Select the specific stage within the WooCommerce order cycle at which the order will be synchronized with Square."),wp.element.createElement("select",{className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 mt-2 !pr-10",value:n.orders.stage,onChange:function(e){r("orders",np(np({},n.orders),{},{stage:e.target.value}))}},wp.element.createElement("option",{value:"processing"},"processing"),wp.element.createElement("option",{value:"completed"},"completed")))):wp.element.createElement("div",null,wp.element.createElement("p",{className:"mb-4 text-sky-500"},"SquareSync Payment Gateway is currently enabled, and because orders and transactions are automatically generated, these settings cannot be edited. To make changes, please disable the SquareSync Payment Gateway."))))),wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6 mb-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Real-time Order Import ",wp.element.createElement(_t,null)),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Automatically import your Square orders into WooCommerce")),wp.element.createElement("div",{className:"flex items-center gap-2 mt-4"},wp.element.createElement(om,{checked:!1,className:"".concat(n.orders.orderImport?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"".concat(n.orders.orderImport?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Enable or disable real-time order import")),wp.element.createElement("div",{className:"flex items-center gap-2 mt-4"},wp.element.createElement(om,{checked:!1,className:"".concat(n.orders.orderImportAllLocations?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"".concat(n.orders.orderImportAllLocations?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Import orders from all locations ",wp.element.createElement("span",{className:"font-normal"},"(Default is the currently selected location on general settings page)"))),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 "},wp.element.createElement("p",{className:""},"Ensure your webhook has been subscribed to event ",wp.element.createElement("span",{className:"font-semibold"},"order.created")))),wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6 mb-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Real-time Order Status Sync ",wp.element.createElement(_t,null)),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Syncronize your order statuses from Square to WooCommerce.")),wp.element.createElement("div",{className:"flex items-center gap-2 mt-4"},wp.element.createElement(om,{checked:!1,className:"".concat(n.orders.statusSync?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"".concat(n.orders.statusSync?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Enable or disable real-time order status sync")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 "},wp.element.createElement("p",{className:""},"Ensure your webhook has been subscribed to event ",wp.element.createElement("span",{className:"font-semibold"},"order.fulfillment.updated")))),c?wp.element.createElement("div",null,"Shipping methods loading.."):wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Local Pickup Setup",wp.element.createElement(_t,null)),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Configure the linkage between WooCommerce shipping methods and Square's local pickup orders. Select which WooCommerce shipping method corresponds to local pickups at your Square locations. Additionally, set preferences for the pickup time window and specify the default Square location for pickups.")),wp.element.createElement("div",{className:"blur-sm"},wp.element.createElement("div",null,wp.element.createElement("select",{id:"pickup",name:"pickup",value:n.orders.pickupMethod||"local_pickup",className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 mt-2 !pr-10"},wp.element.createElement("option",{value:"",disabled:!0},"Select your local pickup shipping method"),l.map(function(e){return wp.element.createElement("option",{key:e.id,value:e.id},e.title)}))),wp.element.createElement("div",{className:"mt-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Preparation Time"),wp.element.createElement("p",{className:"text-sm text-gray-500 mb-4"},"Specify the time required for order preparation before it can be available for pickup. Enter the time in minutes."),wp.element.createElement("input",{type:"number",min:"0",value:n.orders.preparationTime||60,className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 mt-2"}),wp.element.createElement("p",{className:"text-sm text-gray-500 mt-1"},'Time in minutes before a pickup order can be available after being placed. For example, enter "30" for a 30-minute preparation time.')),wp.element.createElement("div",{className:"mt-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Pickup Schedule"),wp.element.createElement("p",{className:"text-sm text-gray-500 mb-4"},"Define your pickup times for each day of the week. Enable pickup on specific days and set available time ranges."),wp.element.createElement("table",{className:"min-w-full"},wp.element.createElement("thead",null,wp.element.createElement("tr",null,wp.element.createElement("th",{className:"text-left"},"Day"),wp.element.createElement("th",{className:"text-left"},"Enable Pickup"),wp.element.createElement("th",{className:"text-left"},"From"),wp.element.createElement("th",{className:"text-left"},"To"))),wp.element.createElement("tbody",null,sp.map(function(e){var t,n,r,o,a;return wp.element.createElement("tr",{key:e},wp.element.createElement("td",null,e),wp.element.createElement("td",null,wp.element.createElement("input",{type:"checkbox",checked:(null===(t=y[e])||void 0===t?void 0:t.enabled)||!1})),wp.element.createElement("td",null,wp.element.createElement("input",{type:"time",value:(null===(n=y[e])||void 0===n?void 0:n.from)||"09:00",disabled:!(null!==(r=y[e])&&void 0!==r&&r.enabled),className:"ml-2"})),wp.element.createElement("td",null,wp.element.createElement("input",{type:"time",value:(null===(o=y[e])||void 0===o?void 0:o.to)||"17:00",disabled:!(null!==(a=y[e])&&void 0!==a&&a.enabled),className:"ml-2"})))}))))))))}},{path:"/settings/loyalty",element:function(){hn();var t=Jn(),n=t.settings,r=t.updateSettings,o=Ym((0,e.useState)(!1),2),a=o[0],l=(o[1],Ym((0,e.useState)(""),2)),i=l[0],s=(l[1],Ym((0,e.useState)(n.loyalty.program||null),2)),c=s[0];return s[1],wp.element.createElement(_c,null,wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6 text-black"},wp.element.createElement(Um,{settings:n,updateSettings:r}),a&&wp.element.createElement("div",{className:"flex gap-2 mt-4"},wp.element.createElement("svg",{className:"animate-spin h-5 w-5 text-sky-500",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},wp.element.createElement("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),wp.element.createElement("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})),wp.element.createElement("p",null,"Loading loyalty program")),i&&wp.element.createElement("p",{className:"text-sm text-red-500 mt-2"},i),c&&!a&&wp.element.createElement(Km,{program:c}))))}}];const xp=Ep;function Sp(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var s=r&&r.prototype instanceof i?r:i,c=Object.create(s.prototype);return kp(c,"_invoke",function(n,r,o){var a,i,s,c=0,u=o||[],m=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return a=t,i=0,s=e,p.n=n,l}};function d(n,r){for(i=n,s=r,t=0;!m&&c&&!o&&t<u.length;t++){var o,a=u[t],d=p.p,f=a[2];n>3?(o=f===r)&&(s=a[(i=a[4])?5:(i=3,3)],a[4]=a[5]=e):a[0]<=d&&((o=n<2&&d<a[1])?(i=0,p.v=r,p.n=a[1]):d<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,p.n=f,i=0))}if(o||n>1)return l;throw m=!0,r}return function(o,u,f){if(c>1)throw TypeError("Generator is already running");for(m&&1===u&&d(u,f),i=u,s=f;(t=i<2?e:s)||!m;){a||(i?i<3?(i>1&&(p.n=-1),d(i,s)):p.n=s:p.v=s);try{if(c=2,a){if(i||(o="next"),t=a[o]){if(!(t=t.call(a,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=a.return)&&t.call(a),i<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),i=1);a=e}else if((t=(m=p.n<0)?s:n.call(r,p))!==l)break}catch(t){a=e,i=1,s=t}finally{c=1}}return{value:t,done:m}}}(n,o,a),!0),c}var l={};function i(){}function s(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(kp(t={},r,function(){return this}),t),m=c.prototype=i.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,kp(e,o,"GeneratorFunction")),e.prototype=Object.create(m),e}return s.prototype=c,kp(m,"constructor",c),kp(c,"constructor",s),s.displayName="GeneratorFunction",kp(c,o,"GeneratorFunction"),kp(m),kp(m,o,"Generator"),kp(m,r,function(){return this}),kp(m,"toString",function(){return"[object Generator]"}),(Sp=function(){return{w:a,m:p}})()}function kp(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}kp=function(e,t,n,r){if(t)o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{var a=function(t,n){kp(e,t,function(e){return this._invoke(t,n,e)})};a("next",0),a("throw",1),a("return",2)}},kp(e,t,n,r)}function Op(e,t,n,r,o,a,l){try{var i=e[a](l),s=i.value}catch(e){return void n(e)}i.done?t(s):Promise.resolve(s).then(r,o)}function Np(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],s=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Cp(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Cp(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Cp(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var jp=(0,e.createContext)(),Pp=function(t){var n=t.children,r=Jn().settings,o=nc().isAuthenticated,a=Np((0,e.useState)({groups:[],segments:[]}),2),l=a[0],i=a[1],s=Np((0,e.useState)(!1),2),c=s[0],u=s[1],m=Np((0,e.useState)(""),2),p=m[0],d=m[1];return(0,e.useEffect)(function(){if(r.accessToken&&r.accessToken.length>1||o){var e=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){Op(a,r,o,l,i,"next",e)}function i(e){Op(a,r,o,l,i,"throw",e)}l(void 0)})}}(Sp().m(function e(){var t,n;return Sp().w(function(e){for(;;)switch(e.n){case 0:return u(!0),e.p=1,e.n=2,Ut({path:"/sws/v1/customers/groups-segments",method:"GET"});case 2:t=e.v,i(t),e.n=4;break;case 3:e.p=3,n=e.v,d("Failed to fetch groups and segments"),console.error(n);case 4:return e.p=4,u(!1),e.f(4);case 5:return e.a(2)}},e,null,[[1,3,4,5]])}));return function(){return e.apply(this,arguments)}}();e()}},[o,r.accessToken]),wp.element.createElement(jp.Provider,{value:{groupsSegments:l,loading:c,error:p}},n)};const Rp=function(e){var t=e.children;return wp.element.createElement(Gl,null,wp.element.createElement(Xn,null,wp.element.createElement(uc,null,wp.element.createElement(Pp,null,wp.element.createElement(Gn,null,t)))))};function _p(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var s=r&&r.prototype instanceof i?r:i,c=Object.create(s.prototype);return Ap(c,"_invoke",function(n,r,o){var a,i,s,c=0,u=o||[],m=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return a=t,i=0,s=e,p.n=n,l}};function d(n,r){for(i=n,s=r,t=0;!m&&c&&!o&&t<u.length;t++){var o,a=u[t],d=p.p,f=a[2];n>3?(o=f===r)&&(s=a[(i=a[4])?5:(i=3,3)],a[4]=a[5]=e):a[0]<=d&&((o=n<2&&d<a[1])?(i=0,p.v=r,p.n=a[1]):d<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,p.n=f,i=0))}if(o||n>1)return l;throw m=!0,r}return function(o,u,f){if(c>1)throw TypeError("Generator is already running");for(m&&1===u&&d(u,f),i=u,s=f;(t=i<2?e:s)||!m;){a||(i?i<3?(i>1&&(p.n=-1),d(i,s)):p.n=s:p.v=s);try{if(c=2,a){if(i||(o="next"),t=a[o]){if(!(t=t.call(a,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=a.return)&&t.call(a),i<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),i=1);a=e}else if((t=(m=p.n<0)?s:n.call(r,p))!==l)break}catch(t){a=e,i=1,s=t}finally{c=1}}return{value:t,done:m}}}(n,o,a),!0),c}var l={};function i(){}function s(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Ap(t={},r,function(){return this}),t),m=c.prototype=i.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,Ap(e,o,"GeneratorFunction")),e.prototype=Object.create(m),e}return s.prototype=c,Ap(m,"constructor",c),Ap(c,"constructor",s),s.displayName="GeneratorFunction",Ap(c,o,"GeneratorFunction"),Ap(m),Ap(m,o,"Generator"),Ap(m,r,function(){return this}),Ap(m,"toString",function(){return"[object Generator]"}),(_p=function(){return{w:a,m:p}})()}function Ap(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Ap=function(e,t,n,r){if(t)o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{var a=function(t,n){Ap(e,t,function(e){return this._invoke(t,n,e)})};a("next",0),a("throw",1),a("return",2)}},Ap(e,t,n,r)}function Ip(e,t,n,r,o,a,l){try{var i=e[a](l),s=i.value}catch(e){return void n(e)}i.done?t(s):Promise.resolve(s).then(r,o)}function Tp(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){Ip(a,r,o,l,i,"next",e)}function i(e){Ip(a,r,o,l,i,"throw",e)}l(void 0)})}}function Fp(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],s=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Mp(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Mp(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Mp(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Lp(t){var n=t.open,r=t.onOpenChange,o=t.mode,a=void 0===o?"loading":o,l=mc(),i=l.locations,s=l.refetchLocations,c=Jn(),u=c.updateSettings,m=c.settings,p=c.settingsLoading,d=(0,e.useRef)(!1),f=Fp((0,e.useState)(!1),2),g=f[0],h=f[1],y=Fp((0,e.useState)(void 0),2),v=y[0],b=y[1],w=Fp((0,e.useState)(!1),2),E=w[0],x=w[1];(0,e.useEffect)(function(){var e;p||void 0!==v||b(null!==(e=null==m?void 0:m.environment)&&void 0!==e?e:"live")},[p,null==m?void 0:m.environment,v]);var S=p||void 0===v?"loading":a,k=(0,e.useCallback)(Tp(_p().m(function e(){var t,n,r,o;return _p().w(function(e){for(;;)switch(e.n){case 0:return h(!0),e.p=1,e.n=2,fetch("https://api.squaresyncforwoo.com/wp-json/square-oauth/v1/generate-url",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:v,redirect_uri:"".concat(window.location.origin,"/wp-admin/admin.php?page=squarewoosync#/settings/general"),callback_url:"https://".concat(window.location.hostname,"/wp-json/sws/v1/square-inventory/update"),plan:"free"})});case 2:return t=e.v,e.n=3,t.json();case 3:if(n=e.v,r=n.oauthUrl){e.n=4;break}throw new Error("No OAuth URL returned");case 4:window.location.href=r,e.n=6;break;case 5:e.p=5,o=e.v,alert("Could not open the Square permission screen. Please try again."),console.error(o),h(!1);case 6:return e.a(2)}},e,null,[[1,5]])})),[v]);(0,e.useEffect)(function(){"success"!==a||d.current||i.length||(d.current=!0,x(!0),s().finally(function(){return x(!1)}))},[a,i.length,s]);var O=function(){var e=Tp(_p().m(function e(t){var n,o;return _p().w(function(e){for(;;)switch(e.n){case 0:return n=M.loading("Saving location…"),e.p=1,e.n=2,u("location",t);case 2:M.update(n,{render:"Location updated!",type:"success",isLoading:!1,autoClose:2e3}),r(!1),e.n=4;break;case 3:e.p=3,o=e.v,M.update(n,{render:"Error: ".concat(o.message),type:"error",isLoading:!1,autoClose:!1});case 4:return e.a(2)}},e,null,[[1,3]])}));return function(_x){return e.apply(this,arguments)}}(),N="relative isolate w-full md:max-w-2xl min-h-[26rem] overflow-hidden rounded-2xl bg-white/95 p-10 lg:p-12 shadow-2xl backdrop-blur-md",C="pointer-events-none absolute -inset-40 -z-10 opacity-15 blur-3xl";return wp.element.createElement(yl,{open:n,onClose:function(){return r(!1)}},"loading"===S&&wp.element.createElement("div",{className:"".concat(N," flex flex-col items-center justify-center gap-6")},wp.element.createElement("svg",{viewBox:"0 0 24 24",className:"size-9 animate-spin text-indigo-600",fill:"none","aria-hidden":"true"},wp.element.createElement("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),wp.element.createElement("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8H4z"})),wp.element.createElement("p",{className:"text-sm text-gray-700"},"Checking Square connection…")),"connect"===S&&wp.element.createElement("div",{className:N},wp.element.createElement("div",{className:"".concat(C," ").concat("bg-gradient-to-br from-slate-300 via-slate-200 to-white")}),wp.element.createElement("header",{className:"mb-6 flex flex-col items-center gap-3"},wp.element.createElement("div",{className:"flex size-16 items-center justify-center rounded-full bg-indigo-600/90 text-white shadow-lg ring-4 ring-indigo-400/30"},wp.element.createElement("svg",{width:"28",height:"28",viewBox:"0 0 24 24",className:"fill-current"},wp.element.createElement("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3"}))),wp.element.createElement("h2",{className:"text-2xl font-semibold text-gray-900"},"Connect Square"),wp.element.createElement("p",{className:"max-w-sm text-center text-sm text-gray-600"},"Authorise access so we can sync products, orders and inventory.")),wp.element.createElement("fieldset",{className:"mb-8"},wp.element.createElement("legend",{className:"sr-only"},"Square environment"),wp.element.createElement("div",{className:"grid grid-cols-1 gap-y-6 sm:grid-cols-2 sm:gap-x-4"},["live","sandbox"].map(function(e){var t=v===e,n="live"===e?"Production (Live)":"Sandbox (Test)",r="live"===e?"Real payments & inventory":"Safe test mode with fake money";return wp.element.createElement("label",{key:e,className:"\n                      relative flex cursor-pointer rounded-lg border bg-white p-4 shadow-sm\n                      focus:outline-none transition\n                      ".concat(t?"border-indigo-600 ring-2 ring-indigo-600":"border-gray-300 hover:border-gray-400","\n                    ")},wp.element.createElement("input",{type:"radio",name:"square-environment",value:e,checked:t,onChange:function(){return b(e)},className:"sr-only"}),wp.element.createElement("span",{className:"flex flex-1"},wp.element.createElement("span",{className:"flex flex-col"},wp.element.createElement("span",{className:"block text-sm font-medium text-gray-900"},n),wp.element.createElement("span",{className:"mt-1 text-sm text-gray-500"},r))),wp.element.createElement("svg",{viewBox:"0 0 20 20",className:"size-5 text-indigo-600 transition ".concat(t?"":"invisible"),fill:"currentColor","aria-hidden":"true"},wp.element.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16Zm3.857-9.809a.75.75 0 0 0-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 1 0-1.06 1.061l2.5 2.5a.75.75 0 0 0 1.137-.089l4-5.5Z",clipRule:"evenodd"})),wp.element.createElement("span",{className:"\n                        pointer-events-none absolute -inset-px rounded-lg border-2\n                        ".concat(t?"border-indigo-600":"border-transparent","\n                      "),"aria-hidden":"true"}))}))),wp.element.createElement("div",{className:"flex flex-col gap-4 sm:flex-row sm:justify-center"},wp.element.createElement("button",{onClick:k,disabled:g,className:"inline-flex items-center justify-center rounded-lg bg-indigo-600 px-8 py-3 text-sm font-medium tracking-wide text-white shadow-sm transition hover:bg-indigo-700 focus-visible:ring-4 focus-visible:ring-indigo-300 disabled:cursor-progress"},g?"Redirecting…":"Authorise with Square"),wp.element.createElement("button",{onClick:function(){return r(!1)},className:"text-sm font-medium text-gray-500 transition hover:text-gray-700"},"Cancel"))),"success"===S&&wp.element.createElement("div",{className:N},wp.element.createElement("div",{className:"".concat(C," ").concat("bg-gradient-to-br from-emerald-200 via-emerald-100 to-white")}),wp.element.createElement("header",{className:"mb-6 flex flex-col items-center gap-3"},wp.element.createElement("div",{className:"flex size-16 items-center justify-center rounded-full bg-emerald-500/90 text-white shadow-lg ring-4 ring-emerald-400/30"},wp.element.createElement("svg",{width:"30",height:"30",viewBox:"0 0 24 24",className:"fill-current"},wp.element.createElement("path",{d:"M9.8 16.4 5.3 12l1.5-1.5 3 3 8-8L19.1 6l-9.3 10.4Z"}))),wp.element.createElement("h2",{className:"text-2xl font-semibold text-emerald-800"},"Connected!"),wp.element.createElement("p",{className:"max-w-sm text-center text-sm text-emerald-700"},"Pick the default Square location.")),E?wp.element.createElement("p",{className:"mb-6 text-center text-sm text-gray-600"},"Loading locations…"):wp.element.createElement("div",{className:"flex flex-col items-center"},wp.element.createElement("select",{className:"block w-full rounded-lg border-0 px-4 py-1.5 pr-10 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-sky-600 sm:text-sm",defaultValue:"",onChange:function(e){return e.target.value&&O(e.target.value)}},wp.element.createElement("option",{value:"",disabled:!0},"Select location"),i.map(function(e){return wp.element.createElement("option",{key:e.id,value:e.id},e.name)})),wp.element.createElement("button",{onClick:function(){r(!1),requestAnimationFrame(function(){var e,t=document.querySelector("#location");t&&(t.scrollIntoView({behavior:"smooth",block:"center"}),null===(e=t.focus)||void 0===e||e.call(t))})},className:"mt-4 rounded-xl bg-emerald-600 px-8 py-3 text-sm font-medium text-white shadow-md transition hover:bg-emerald-700 focus-visible:ring-4 focus-visible:ring-emerald-300"},"I'll choose later"))))}function Dp(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],s=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Gp(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Gp(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Gp(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function qp(e){var n=e.children,r=nc(),o=r.loading,a=r.isAuthenticated,l=r.justConnected,i=r.autoPrompt,s=Dp((0,t.useState)(!1),2),c=s[0],u=s[1],m=Dp((0,t.useState)("loading"),2),p=m[0],d=m[1];return(0,t.useEffect)(function(){if(o)return d("loading"),void u(!0);l?(d("success"),u(!0)):!a&&i?(d("connect"),u(!0)):u(!1)},[o,a,i,l]),wp.element.createElement(React.Fragment,null,n,wp.element.createElement(Lp,{open:c,onOpenChange:u,mode:p}))}const Vp=o.p+"images/logo.4a5282be.png";function Wp(e){var t=e.to,n=e.children;return wp.element.createElement(jt,{to:t,className:function(e){return e.isActive?"text-sky-400 focus:!shadow-none active:text-sky-400 focus:text-sky-400 hover:!text-sky-400":"focus:!shadow-none active:text-sky-400 focus:text-sky-400 hover:!text-sky-400"}},n)}const zp=function(e){var t=e.children,n="h-full flex items-center justify-center mb-0";return wp.element.createElement("div",{className:"relative"},wp.element.createElement("header",{className:"bg-white px-6 items-stretch justify-between h-14 hidden md:flex"},wp.element.createElement("div",{className:"flex items-center gap-px py-4 "},wp.element.createElement("img",{className:"h-10 w-auto",src:Vp,alt:"SquareWooSync"}),wp.element.createElement("nav",{className:"h-full ml-2"},wp.element.createElement("ul",{className:"flex items-center h-full gap-4 justify-center divide-x divide-gray-200 font-semibold "},wp.element.createElement("li",{className:n},wp.element.createElement(Wp,{to:"/"},"Dashboard")),wp.element.createElement("li",{className:"".concat(n," pl-4")},wp.element.createElement(Wp,{to:"/inventory"},"Products")),wp.element.createElement("li",{className:"".concat(n," pl-4")},wp.element.createElement(Wp,{to:"/customers"},"Customers")),wp.element.createElement("li",{className:"".concat(n," pl-4")},wp.element.createElement(Wp,{to:"/loyalty"},"Loyalty")),wp.element.createElement("li",{className:"".concat(n," pl-4")},wp.element.createElement(Wp,{to:"/orders"},"Orders")),wp.element.createElement("li",{className:"".concat(n," pl-4")},wp.element.createElement(Wp,{to:"/settings/general"},"Settings")),wp.element.createElement("li",{className:"".concat(n," pl-4")},wp.element.createElement("a",{target:"_blank",href:"https://squaresyncforwoo.com/documentation",className:function(e){return e.isActive?"text-sky-400 focus:!shadow-none active:text-sky-400 focus:text-sky-400 hover:!text-sky-400":"focus:!shadow-none active:text-sky-400 focus:text-sky-400 hover:!text-sky-400"}},"Documentation")),wp.element.createElement("li",{className:"".concat(n," pl-4")},wp.element.createElement("a",{target:"_blank",href:"https://squaresyncforwoo.com",className:"text-green-500 font-bold"},"GO PRO")))))),wp.element.createElement("main",{className:" mx-auto pb-20 mt-6 px-6"},t))};var Bp="persist:",Hp="persist/FLUSH",Up="persist/REHYDRATE",$p="persist/PAUSE",Zp="persist/PERSIST",Kp="persist/PURGE",Yp="persist/REGISTER";function Xp(e){return Xp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Xp(e)}function Jp(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Qp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ed(e){return JSON.stringify(e)}function td(e){return JSON.parse(e)}function nd(e){}function rd(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function od(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?rd(n,!0).forEach(function(t){ad(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rd(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ad(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ld(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function id(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function sd(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?id(n,!0).forEach(function(t){cd(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):id(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function cd(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ud={registry:[],bootstrapped:!1},md=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ud,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case Yp:return sd({},e,{registry:[].concat(ld(e.registry),[t.key])});case Up:var n=e.registry.indexOf(t.key),r=ld(e.registry);return r.splice(n,1),sd({},e,{registry:r,bootstrapped:0===r.length});default:return e}},pd=o(796);function dd(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var s=r&&r.prototype instanceof i?r:i,c=Object.create(s.prototype);return fd(c,"_invoke",function(n,r,o){var a,i,s,c=0,u=o||[],m=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return a=t,i=0,s=e,p.n=n,l}};function d(n,r){for(i=n,s=r,t=0;!m&&c&&!o&&t<u.length;t++){var o,a=u[t],d=p.p,f=a[2];n>3?(o=f===r)&&(s=a[(i=a[4])?5:(i=3,3)],a[4]=a[5]=e):a[0]<=d&&((o=n<2&&d<a[1])?(i=0,p.v=r,p.n=a[1]):d<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,p.n=f,i=0))}if(o||n>1)return l;throw m=!0,r}return function(o,u,f){if(c>1)throw TypeError("Generator is already running");for(m&&1===u&&d(u,f),i=u,s=f;(t=i<2?e:s)||!m;){a||(i?i<3?(i>1&&(p.n=-1),d(i,s)):p.n=s:p.v=s);try{if(c=2,a){if(i||(o="next"),t=a[o]){if(!(t=t.call(a,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=a.return)&&t.call(a),i<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),i=1);a=e}else if((t=(m=p.n<0)?s:n.call(r,p))!==l)break}catch(t){a=e,i=1,s=t}finally{c=1}}return{value:t,done:m}}}(n,o,a),!0),c}var l={};function i(){}function s(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(fd(t={},r,function(){return this}),t),m=c.prototype=i.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,fd(e,o,"GeneratorFunction")),e.prototype=Object.create(m),e}return s.prototype=c,fd(m,"constructor",c),fd(c,"constructor",s),s.displayName="GeneratorFunction",fd(c,o,"GeneratorFunction"),fd(m),fd(m,o,"Generator"),fd(m,r,function(){return this}),fd(m,"toString",function(){return"[object Generator]"}),(dd=function(){return{w:a,m:p}})()}function fd(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}fd=function(e,t,n,r){if(t)o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{var a=function(t,n){fd(e,t,function(e){return this._invoke(t,n,e)})};a("next",0),a("throw",1),a("return",2)}},fd(e,t,n,r)}function gd(e,t,n,r,o,a,l){try{var i=e[a](l),s=i.value}catch(e){return void n(e)}i.done?t(s):Promise.resolve(s).then(r,o)}function hd(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){gd(a,r,o,l,i,"next",e)}function i(e){gd(a,r,o,l,i,"throw",e)}l(void 0)})}}function yd(){return vd.apply(this,arguments)}function vd(){return(vd=hd(dd().m(function e(){var t,n;return dd().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,e.n=1,Ut({path:"/sws/v1/customers/get-groups"});case 1:if(t=e.v,console.log("API Response:",t),!(t&&t.square_groups&&t.wp_user_roles)){e.n=2;break}return e.a(2,{groups:t.square_groups,roles:t.wp_user_roles,roleMappings:t.roleMappings||[]});case 2:throw new Error("Invalid API response format");case 3:e.n=5;break;case 4:throw e.p=4,n=e.v,console.error("API Fetch Error:",n),n;case 5:return e.a(2)}},e,null,[[0,4]])}))).apply(this,arguments)}var bd=function(){var e=hd(dd().m(function e(){var t,n,r;return dd().w(function(e){for(;;)switch(e.n){case 0:return console.log("Fetching Customer Groups and Roles"),t=M.loading("Retrieving Customer Groups and Roles"),e.p=1,e.n=2,yd();case 2:return n=e.v,M.update(t,{render:"Groups and Roles Received",type:"success",isLoading:!1,autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),e.a(2,{status:"success",data:n});case 3:return e.p=3,r=e.v,M.update(t,{render:"Error fetching groups and roles: ".concat(r),type:"error",isLoading:!1,closeOnClick:!0,autoClose:5e3}),console.error(r),e.a(2,{status:"error",error:r})}},e,null,[[1,3]])}));return function(){return e.apply(this,arguments)}}(),wd=function(){var e=hd(dd().m(function e(t){var n,r,o;return dd().w(function(e){for(;;)switch(e.n){case 0:return console.log("Saving Role Mappings"),n=M.loading("Saving Role Mappings"),e.p=1,e.n=2,Ut({path:"/sws/v1/customers/role-mappings",method:"POST",data:{roleMappings:t}});case 2:if(r=e.v,console.log("Save Response:",r),!r||"success"!==r.status){e.n=3;break}return M.update(n,{render:"Role Mappings Saved",type:"success",isLoading:!1,autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),e.a(2,{status:"success",roleMappings:r.roleMappings});case 3:throw new Error("Invalid API response format");case 4:e.n=6;break;case 5:return e.p=5,o=e.v,M.update(n,{render:"Error saving role mappings: ".concat(o.message||"Server error"),type:"error",isLoading:!1,closeOnClick:!0,autoClose:5e3}),console.error("Error saving role mappings:",o),e.a(2,{status:"error",error:o.message||"Server error"});case 6:return e.a(2)}},e,null,[[1,5]])}));return function(_x){return e.apply(this,arguments)}}(),Ed=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5e3;return new Promise(function(n,r){var o=function(){var a=hd(dd().m(function a(l){var i,s,c;return dd().w(function(a){for(;;)switch(a.n){case 0:if(a.p=0,i=null,e)try{localStorage.removeItem("customersData")}catch(e){console.warn("Failed to remove data from local storage:",e)}else{try{i=localStorage.getItem("customersData")}catch(e){console.warn("Failed to retrieve data from local storage:",e)}i&&setTimeout(function(){var e=JSON.parse(i);return n({status:"success",data:e})},100)}return a.n=1,Ut({path:"/sws/v1/customers".concat(l&&e?"?force=true":"")});case 1:if(s=a.v,console.log(s),s.loading)l&&M.info("Fetching data, please wait...",{autoClose:2e3,hideProgressBar:!1,closeOnClick:!1}),setTimeout(function(){return o(!1)},t);else if(0===s.data.length)M.info("No data available",{autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),n({status:"success",data:[]});else{try{localStorage.setItem("customersData",JSON.stringify(s.data))}catch(e){console.warn("Failed to store data in local storage:",e)}M.success("Customers Retrieved",{autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),n({status:"success",data:s.data})}a.n=3;break;case 2:a.p=2,c=a.v,M.error("Error fetching customers: ".concat(c.message||"Server error"),{autoClose:5e3,closeOnClick:!0}),r({status:"error",error:c.message||"Server error"});case 3:return a.a(2)}},a,null,[[0,2]])}));return function(e){return a.apply(this,arguments)}}();o(!0)})};function xd(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var s=r&&r.prototype instanceof i?r:i,c=Object.create(s.prototype);return Sd(c,"_invoke",function(n,r,o){var a,i,s,c=0,u=o||[],m=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return a=t,i=0,s=e,p.n=n,l}};function d(n,r){for(i=n,s=r,t=0;!m&&c&&!o&&t<u.length;t++){var o,a=u[t],d=p.p,f=a[2];n>3?(o=f===r)&&(s=a[(i=a[4])?5:(i=3,3)],a[4]=a[5]=e):a[0]<=d&&((o=n<2&&d<a[1])?(i=0,p.v=r,p.n=a[1]):d<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,p.n=f,i=0))}if(o||n>1)return l;throw m=!0,r}return function(o,u,f){if(c>1)throw TypeError("Generator is already running");for(m&&1===u&&d(u,f),i=u,s=f;(t=i<2?e:s)||!m;){a||(i?i<3?(i>1&&(p.n=-1),d(i,s)):p.n=s:p.v=s);try{if(c=2,a){if(i||(o="next"),t=a[o]){if(!(t=t.call(a,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=a.return)&&t.call(a),i<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),i=1);a=e}else if((t=(m=p.n<0)?s:n.call(r,p))!==l)break}catch(t){a=e,i=1,s=t}finally{c=1}}return{value:t,done:m}}}(n,o,a),!0),c}var l={};function i(){}function s(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Sd(t={},r,function(){return this}),t),m=c.prototype=i.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,Sd(e,o,"GeneratorFunction")),e.prototype=Object.create(m),e}return s.prototype=c,Sd(m,"constructor",c),Sd(c,"constructor",s),s.displayName="GeneratorFunction",Sd(c,o,"GeneratorFunction"),Sd(m),Sd(m,o,"Generator"),Sd(m,r,function(){return this}),Sd(m,"toString",function(){return"[object Generator]"}),(xd=function(){return{w:a,m:p}})()}function Sd(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Sd=function(e,t,n,r){if(t)o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{var a=function(t,n){Sd(e,t,function(e){return this._invoke(t,n,e)})};a("next",0),a("throw",1),a("return",2)}},Sd(e,t,n,r)}function kd(e,t,n,r,o,a,l){try{var i=e[a](l),s=i.value}catch(e){return void n(e)}i.done?t(s):Promise.resolve(s).then(r,o)}function Od(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){kd(a,r,o,l,i,"next",e)}function i(e){kd(a,r,o,l,i,"throw",e)}l(void 0)})}}var Nd=Lo("customerGroupsAndRoles/fetchIfNeeded",Od(xd().m(function e(){var t,n,r,o,a,l,i,s,c=arguments;return xd().w(function(e){for(;;)switch(e.n){case 0:return t=c.length>0&&void 0!==c[0]&&c[0],r=(n=c.length>1?c[1]:void 0).getState,o=n.rejectWithValue,a=r(),l=a.customerGroupsAndRoles,i=0,s=function(){var e=Od(xd().m(function e(){var n,r;return xd().w(function(e){for(;;)switch(e.n){case 0:if(e.p=0,!t&&(l.data.groups.length||l.data.roles.length)){e.n=4;break}return e.n=1,bd();case 1:if("success"!==(n=e.v).status){e.n=2;break}return e.a(2,n.data);case 2:throw new Error(n.error);case 3:e.n=5;break;case 4:return e.a(2,l.data);case 5:e.n=9;break;case 6:if(e.p=6,r=e.v,!(i<1)){e.n=8;break}return i++,console.warn("Retrying fetch groups and roles (".concat(i,"/").concat(1,")...")),e.n=7,s();case 7:return e.a(2,e.v);case 8:return console.error("Max retries reached. Unable to fetch groups and roles."),e.a(2,o(r.message));case 9:return e.a(2)}},e,null,[[0,6]])}));return function(){return e.apply(this,arguments)}}(),e.n=1,s();case 1:return e.a(2,e.v)}},e)}))),Cd=Lo("customerGroupsAndRoles/saveMappings",function(){var e=Od(xd().m(function e(t,n){var r,o,a,l,i;return xd().w(function(e){for(;;)switch(e.n){case 0:if(r=n.rejectWithValue,e.p=1,o=Object.values(t).map(function(e){return e.priority}),a=new Set(o),o.length===a.size){e.n=2;break}throw new Error("Each mapping must have a unique priority.");case 2:return e.n=3,wd(t);case 3:if("success"!==(l=e.v).status){e.n=4;break}return e.a(2,{roleMappings:l.roleMappings});case 4:throw new Error(l.error);case 5:e.n=7;break;case 6:return e.p=6,i=e.v,e.a(2,r(i.message));case 7:return e.a(2)}},e,null,[[1,6]])}));return function(_x,t){return e.apply(this,arguments)}}());const jd=Ao({name:"customerGroupsAndRoles",initialState:{data:{groups:[],roles:{},roleMappings:{}},loading:!1,error:null},reducers:{},extraReducers:function(e){e.addCase(Nd.pending,function(e){e.loading=!0}).addCase(Nd.fulfilled,function(e,t){e.loading=!1,e.data=t.payload,e.error=null}).addCase(Nd.rejected,function(e,t){e.loading=!1,e.data={groups:[],roles:{},roleMappings:{}},e.error=t.payload}).addCase(Cd.pending,function(e){e.loading=!0}).addCase(Cd.fulfilled,function(e,t){e.loading=!1,e.data.roleMappings=t.payload.roleMappings,e.error=null}).addCase(Cd.rejected,function(e,t){e.loading=!1,e.error=t.payload})}}).reducer;function Pd(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var s=r&&r.prototype instanceof i?r:i,c=Object.create(s.prototype);return Rd(c,"_invoke",function(n,r,o){var a,i,s,c=0,u=o||[],m=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return a=t,i=0,s=e,p.n=n,l}};function d(n,r){for(i=n,s=r,t=0;!m&&c&&!o&&t<u.length;t++){var o,a=u[t],d=p.p,f=a[2];n>3?(o=f===r)&&(s=a[(i=a[4])?5:(i=3,3)],a[4]=a[5]=e):a[0]<=d&&((o=n<2&&d<a[1])?(i=0,p.v=r,p.n=a[1]):d<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,p.n=f,i=0))}if(o||n>1)return l;throw m=!0,r}return function(o,u,f){if(c>1)throw TypeError("Generator is already running");for(m&&1===u&&d(u,f),i=u,s=f;(t=i<2?e:s)||!m;){a||(i?i<3?(i>1&&(p.n=-1),d(i,s)):p.n=s:p.v=s);try{if(c=2,a){if(i||(o="next"),t=a[o]){if(!(t=t.call(a,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,i<2&&(i=0)}else 1===i&&(t=a.return)&&t.call(a),i<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),i=1);a=e}else if((t=(m=p.n<0)?s:n.call(r,p))!==l)break}catch(t){a=e,i=1,s=t}finally{c=1}}return{value:t,done:m}}}(n,o,a),!0),c}var l={};function i(){}function s(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Rd(t={},r,function(){return this}),t),m=c.prototype=i.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,Rd(e,o,"GeneratorFunction")),e.prototype=Object.create(m),e}return s.prototype=c,Rd(m,"constructor",c),Rd(c,"constructor",s),s.displayName="GeneratorFunction",Rd(c,o,"GeneratorFunction"),Rd(m),Rd(m,o,"Generator"),Rd(m,r,function(){return this}),Rd(m,"toString",function(){return"[object Generator]"}),(Pd=function(){return{w:a,m:p}})()}function Rd(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Rd=function(e,t,n,r){if(t)o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{var a=function(t,n){Rd(e,t,function(e){return this._invoke(t,n,e)})};a("next",0),a("throw",1),a("return",2)}},Rd(e,t,n,r)}function _d(e,t,n,r,o,a,l){try{var i=e[a](l),s=i.value}catch(e){return void n(e)}i.done?t(s):Promise.resolve(s).then(r,o)}function Ad(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){_d(a,r,o,l,i,"next",e)}function i(e){_d(a,r,o,l,i,"throw",e)}l(void 0)})}}var Id,Td,Fd,Md,Ld,Dd,Gd,qd,Vd,Wd,zd=Lo("customers/fetchIfNeeded",Ad(Pd().m(function e(){var t,n,r,o,a,l,i,s,c,u,m=arguments;return Pd().w(function(e){for(;;)switch(e.n){case 0:if(t=m.length>0&&void 0!==m[0]&&m[0],r=(n=m.length>1?m[1]:void 0).getState,o=n.rejectWithValue,a=r(),l=a.customers,!t&&null!==l.data){e.n=8;break}return e.p=1,e.n=2,Ed(t);case 2:if("success"!==(i=e.v).status){e.n=3;break}return e.a(2,i.data);case 3:if("loading"!==i.status){e.n=4;break}return e.a(2,o("Data is being fetched, please wait..."));case 4:throw new Error(i.error);case 5:e.n=7;break;case 6:return e.p=6,c=e.v,e.a(2,o(c.message));case 7:e.n=16;break;case 8:if(!l.loading){e.n=15;break}return e.p=9,e.n=10,Ed(!1);case 10:if("success"!==(s=e.v).status){e.n=11;break}return e.a(2,s.data);case 11:if("loading"!==s.status){e.n=12;break}return e.a(2,o("Data is being fetched, please wait..."));case 12:throw new Error(s.error);case 13:e.n=15;break;case 14:return e.p=14,u=e.v,e.a(2,o(u.message));case 15:return e.a(2,l.data);case 16:return e.a(2)}},e,null,[[9,14],[1,6]])}))),Bd=io({inventory:us,licence:Uo,orders:Ps,customerGroupsAndRoles:jd,customers:Ao({name:"customers",initialState:{data:null,loading:!1,error:null,fetchAttempted:!1},reducers:{},extraReducers:function(e){e.addCase(zd.pending,function(e){e.loading=!0,e.fetchAttempted=!0}).addCase(zd.fulfilled,function(e,t){e.loading=!1,e.data=t.payload,e.error=null}).addCase(zd.rejected,function(e,t){e.loading=!1,e.data=[],e.error=t.payload})}}).reducer}),Hd={key:"root",storage:pd.A,whitelist:["inventory","customerGroupsAndRoles","customers"]},Ud=(Td=Bd,Fd=void 0!==(Id=Hd).version?Id.version:-1,Md=void 0===Id.stateReconciler?function(e,t,n,r){r.debug;var o=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Jp(n,!0).forEach(function(t){Qp(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Jp(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},n);return e&&"object"===Xp(e)&&Object.keys(e).forEach(function(r){"_persist"!==r&&t[r]===n[r]&&(o[r]=e[r])}),o}:Id.stateReconciler,Ld=Id.getStoredState||function(e){var t,n=e.transforms||[],r="".concat(void 0!==e.keyPrefix?e.keyPrefix:Bp).concat(e.key),o=e.storage;return e.debug,t=!1===e.deserialize?function(e){return e}:"function"==typeof e.deserialize?e.deserialize:td,o.getItem(r).then(function(e){if(e)try{var r={},o=t(e);return Object.keys(o).forEach(function(e){r[e]=n.reduceRight(function(t,n){return n.out(t,e,o)},t(o[e]))}),r}catch(e){throw e}})},Dd=void 0!==Id.timeout?Id.timeout:5e3,Gd=null,qd=!1,Vd=!0,Wd=function(e){return e._persist.rehydrated&&Gd&&!Vd&&Gd.update(e),e},function(e,t){var n=e||{},r=n._persist,o=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(n,["_persist"]);if(t.type===Zp){var a=!1,l=function(e,n){a||(t.rehydrate(Id.key,e,n),a=!0)};if(Dd&&setTimeout(function(){!a&&l(void 0,new Error('redux-persist: persist timed out for persist key "'.concat(Id.key,'"')))},Dd),Vd=!1,Gd||(Gd=function(e){var t,n=e.blacklist||null,r=e.whitelist||null,o=e.transforms||[],a=e.throttle||0,l="".concat(void 0!==e.keyPrefix?e.keyPrefix:Bp).concat(e.key),i=e.storage;t=!1===e.serialize?function(e){return e}:"function"==typeof e.serialize?e.serialize:ed;var s=e.writeFailHandler||null,c={},u={},m=[],p=null,d=null;function f(){if(0===m.length)return p&&clearInterval(p),void(p=null);var e=m.shift(),n=o.reduce(function(t,n){return n.in(t,e,c)},c[e]);if(void 0!==n)try{u[e]=t(n)}catch(e){console.error("redux-persist/createPersistoid: error serializing state",e)}else delete u[e];0===m.length&&(Object.keys(u).forEach(function(e){void 0===c[e]&&delete u[e]}),d=i.setItem(l,t(u)).catch(h))}function g(e){return!(r&&-1===r.indexOf(e)&&"_persist"!==e||n&&-1!==n.indexOf(e))}function h(e){s&&s(e)}return{update:function(e){Object.keys(e).forEach(function(t){g(t)&&c[t]!==e[t]&&-1===m.indexOf(t)&&m.push(t)}),Object.keys(c).forEach(function(t){void 0===e[t]&&g(t)&&-1===m.indexOf(t)&&void 0!==c[t]&&m.push(t)}),null===p&&(p=setInterval(f,a)),c=e},flush:function(){for(;0!==m.length;)f();return d||Promise.resolve()}}}(Id)),r)return od({},Td(o,t),{_persist:r});if("function"!=typeof t.rehydrate||"function"!=typeof t.register)throw new Error("redux-persist: either rehydrate or register is not a function on the PERSIST action. This can happen if the action is being replayed. This is an unexplored use case, please open an issue and we will figure out a resolution.");return t.register(Id.key),Ld(Id).then(function(e){var t=Id.migrate||function(e,t){return Promise.resolve(e)};t(e,Fd).then(function(e){l(e)},function(e){l(void 0,e)})},function(e){l(void 0,e)}),od({},Td(o,t),{_persist:{version:Fd,rehydrated:!1}})}if(t.type===Kp)return qd=!0,t.result(function(e){var t=e.storage,n="".concat(void 0!==e.keyPrefix?e.keyPrefix:Bp).concat(e.key);return t.removeItem(n,nd)}(Id)),od({},Td(o,t),{_persist:r});if(t.type===Hp)return t.result(Gd&&Gd.flush()),od({},Td(o,t),{_persist:r});if(t.type===$p)Vd=!0;else if(t.type===Up){if(qd)return od({},o,{_persist:od({},r,{rehydrated:!0})});if(t.key===Id.key){var i=Td(o,t),s=t.payload,c=od({},!1!==Md&&void 0!==s?Md(s,e,i,Id):i,{_persist:od({},r,{rehydrated:!0})});return Wd(c)}}if(!r)return Td(e,t);var u=Td(o,t);return u===o?e:Wd(od({},u,{_persist:r}))}),$d=function(e){var t,n=function(e){return function(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,r=(e.immutableCheck,e.serializableCheck,e.actionCreatorCheck,new jo);return n&&("boolean"!=typeof n?r.push(po.withExtraArgument(n.extraArgument)):r.push(po)),r}(e)},r=e||{},o=r.reducer,a=void 0===o?void 0:o,l=r.middleware,i=void 0===l?n():l,s=r.devTools,c=void 0===s||s,u=r.preloadedState,m=void 0===u?void 0:u,p=r.enhancers,d=void 0===p?void 0:p;if("function"==typeof a)t=a;else{if(!function(e){if("object"!=typeof e||null===e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var n=t;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return t===n}(a))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=io(a)}var f=i;"function"==typeof f&&(f=f(n));var g=co.apply(void 0,f),h=so;c&&(h=No(ko({trace:!1},"object"==typeof c&&c)));var y=new Po(g),v=y;return Array.isArray(d)?v=ho([g],d):"function"==typeof d&&(v=d(y)),lo(t,m,h.apply(void 0,v))}({reducer:Ud,middleware:function(e){return e({serializableCheck:!1})}}),Zd=function(e){var t=!1,n=lo(md,ud,void 0),r=function(e){n.dispatch({type:Yp,key:e})},o=function(r,o,l){var i={type:Up,payload:o,err:l,key:r};e.dispatch(i),n.dispatch(i),t&&a.getState().bootstrapped&&(t(),t=!1)},a=sd({},n,{purge:function(){var t=[];return e.dispatch({type:Kp,result:function(e){t.push(e)}}),Promise.all(t)},flush:function(){var t=[];return e.dispatch({type:Hp,result:function(e){t.push(e)}}),Promise.all(t)},pause:function(){e.dispatch({type:$p})},persist:function(){e.dispatch({type:Zp,register:r,rehydrate:o})}});return a.persist(),a}($d),Kd=document.getElementById("square-woo-sync");null!=Kd&&(0,e.createRoot)(Kd).render(wp.element.createElement(React.Fragment,null,wp.element.createElement(N,{className:"toast-position",position:"top-right",autoClose:500,hideProgressBar:!0,newestOnTop:!1,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"light"}),wp.element.createElement(function({store:e,context:n,children:r,serverState:o,stabilityCheck:a="once",noopCheck:l="once"}){const i=t.useMemo(()=>{const t=function(e,t){let n,r=J,o=0,a=!1;function l(){c.onStateChange&&c.onStateChange()}function i(){o++,n||(n=t?t.addNestedSub(l):e.subscribe(l),r=function(){const e=V();let t=null,n=null;return{clear(){t=null,n=null},notify(){e(()=>{let e=t;for(;e;)e.callback(),e=e.next})},get(){let e=[],n=t;for(;n;)e.push(n),n=n.next;return e},subscribe(e){let r=!0,o=n={callback:e,next:null,prev:n};return o.prev?o.prev.next=o:t=o,function(){r&&null!==t&&(r=!1,o.next?o.next.prev=o.prev:n=o.prev,o.prev?o.prev.next=o.next:t=o.next)}}}}())}function s(){o--,n&&0===o&&(n(),n=void 0,r.clear(),r=J)}const c={addNestedSub:function(e){i();const t=r.subscribe(e);let n=!1;return()=>{n||(n=!0,t(),s())}},notifyNestedSubs:function(){r.notify()},handleChangeWrapper:l,isSubscribed:function(){return a},trySubscribe:function(){a||(a=!0,i())},tryUnsubscribe:function(){a&&(a=!1,s())},getListeners:()=>r};return c}(e);return{store:e,subscription:t,getServerState:o?()=>o:void 0,stabilityCheck:a,noopCheck:l}},[e,o,a,l]),s=t.useMemo(()=>e.getState(),[e]);Q(()=>{const{subscription:t}=i;return t.onStateChange=t.notifyNestedSubs,t.trySubscribe(),s!==e.getState()&&t.notifyNestedSubs(),()=>{t.tryUnsubscribe(),t.onStateChange=void 0}},[i,s]);const c=n||H;return t.createElement(c.Provider,{value:i},r)},{store:$d},wp.element.createElement(de,{loading:null,persistor:Zd},wp.element.createElement(function(){return wp.element.createElement(kt,null,wp.element.createElement(zp,null,wp.element.createElement(Rp,null,wp.element.createElement(qp,null,wp.element.createElement(ht,null,xp.map(function(e,t){return wp.element.createElement(ft,{key:t,path:e.path,element:wp.element.createElement(e.element,null)})}))))))},null)))))})()})();
     1(()=>{var e,t,r={42:(e,t,r)=>{"use strict";var n=r(664),o={"text/plain":"Text","text/html":"Url",default:"Text"};e.exports=function(e,t){var r,a,i,l,c,s,u=!1;t||(t={}),r=t.debug||!1;try{if(i=n(),l=document.createRange(),c=document.getSelection(),(s=document.createElement("span")).textContent=e,s.ariaHidden="true",s.style.all="unset",s.style.position="fixed",s.style.top=0,s.style.clip="rect(0, 0, 0, 0)",s.style.whiteSpace="pre",s.style.webkitUserSelect="text",s.style.MozUserSelect="text",s.style.msUserSelect="text",s.style.userSelect="text",s.addEventListener("copy",(function(n){if(n.stopPropagation(),t.format)if(n.preventDefault(),void 0===n.clipboardData){r&&console.warn("unable to use e.clipboardData"),r&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var a=o[t.format]||o.default;window.clipboardData.setData(a,e)}else n.clipboardData.clearData(),n.clipboardData.setData(t.format,e);t.onCopy&&(n.preventDefault(),t.onCopy(n.clipboardData))})),document.body.appendChild(s),l.selectNodeContents(s),c.addRange(l),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");u=!0}catch(n){r&&console.error("unable to copy using execCommand: ",n),r&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),u=!0}catch(n){r&&console.error("unable to copy using clipboardData: ",n),r&&console.error("falling back to prompt"),a=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(a,e)}}finally{c&&("function"==typeof c.removeRange?c.removeRange(l):c.removeAllRanges()),s&&document.body.removeChild(s),i()}return u}},35:(e,t,r)=>{"use strict";var n=r(959),o={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},a={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},i={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},l={};function c(e){return n.isMemo(e)?i:l[e.$$typeof]||o}l[n.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},l[n.Memo]=i;var s=Object.defineProperty,u=Object.getOwnPropertyNames,m=Object.getOwnPropertySymbols,p=Object.getOwnPropertyDescriptor,f=Object.getPrototypeOf,d=Object.prototype;e.exports=function e(t,r,n){if("string"!=typeof r){if(d){var o=f(r);o&&o!==d&&e(t,o,n)}var i=u(r);m&&(i=i.concat(m(r)));for(var l=c(t),h=c(r),g=0;g<i.length;++g){var y=i[g];if(!(a[y]||n&&n[y]||h&&h[y]||l&&l[y])){var v=p(r,y);try{s(t,y,v)}catch(e){}}}}return t}},889:(e,t,r)=>{var n=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,i=/^0o[0-7]+$/i,l=parseInt,c="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,s="object"==typeof self&&self&&self.Object===Object&&self,u=c||s||Function("return this")(),m=Object.prototype.toString,p=Math.max,f=Math.min,d=function(){return u.Date.now()};function h(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function g(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==m.call(e)}(e))return NaN;if(h(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=h(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(n,"");var r=a.test(e);return r||i.test(e)?l(e.slice(2),r?2:8):o.test(e)?NaN:+e}e.exports=function(e,t,r){var n,o,a,i,l,c,s=0,u=!1,m=!1,y=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function v(t){var r=n,a=o;return n=o=void 0,s=t,i=e.apply(a,r)}function w(e){var r=e-c;return void 0===c||r>=t||r<0||m&&e-s>=a}function b(){var e=d();if(w(e))return x(e);l=setTimeout(b,function(e){var r=t-(e-c);return m?f(r,a-(e-s)):r}(e))}function x(e){return l=void 0,y&&n?v(e):(n=o=void 0,i)}function E(){var e=d(),r=w(e);if(n=arguments,o=this,c=e,r){if(void 0===l)return function(e){return s=e,l=setTimeout(b,t),u?v(e):i}(c);if(m)return l=setTimeout(b,t),v(c)}return void 0===l&&(l=setTimeout(b,t)),i}return t=g(t)||0,h(r)&&(u=!!r.leading,a=(m="maxWait"in r)?p(g(r.maxWait)||0,t):a,y="trailing"in r?!!r.trailing:y),E.cancel=function(){void 0!==l&&clearTimeout(l),s=0,n=c=o=l=void 0},E.flush=function(){return void 0===l?i:x(d())},E}},843:(e,t)=>{"use strict";var r="function"==typeof Symbol&&Symbol.for,n=r?Symbol.for("react.element"):60103,o=r?Symbol.for("react.portal"):60106,a=r?Symbol.for("react.fragment"):60107,i=r?Symbol.for("react.strict_mode"):60108,l=r?Symbol.for("react.profiler"):60114,c=r?Symbol.for("react.provider"):60109,s=r?Symbol.for("react.context"):60110,u=r?Symbol.for("react.async_mode"):60111,m=r?Symbol.for("react.concurrent_mode"):60111,p=r?Symbol.for("react.forward_ref"):60112,f=r?Symbol.for("react.suspense"):60113,d=r?Symbol.for("react.suspense_list"):60120,h=r?Symbol.for("react.memo"):60115,g=r?Symbol.for("react.lazy"):60116,y=r?Symbol.for("react.block"):60121,v=r?Symbol.for("react.fundamental"):60117,w=r?Symbol.for("react.responder"):60118,b=r?Symbol.for("react.scope"):60119;function x(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:switch(e=e.type){case u:case m:case a:case l:case i:case f:return e;default:switch(e=e&&e.$$typeof){case s:case p:case g:case h:case c:return e;default:return t}}case o:return t}}}function E(e){return x(e)===m}t.AsyncMode=u,t.ConcurrentMode=m,t.ContextConsumer=s,t.ContextProvider=c,t.Element=n,t.ForwardRef=p,t.Fragment=a,t.Lazy=g,t.Memo=h,t.Portal=o,t.Profiler=l,t.StrictMode=i,t.Suspense=f,t.isAsyncMode=function(e){return E(e)||x(e)===u},t.isConcurrentMode=E,t.isContextConsumer=function(e){return x(e)===s},t.isContextProvider=function(e){return x(e)===c},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},t.isForwardRef=function(e){return x(e)===p},t.isFragment=function(e){return x(e)===a},t.isLazy=function(e){return x(e)===g},t.isMemo=function(e){return x(e)===h},t.isPortal=function(e){return x(e)===o},t.isProfiler=function(e){return x(e)===l},t.isStrictMode=function(e){return x(e)===i},t.isSuspense=function(e){return x(e)===f},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===m||e===l||e===i||e===f||e===d||"object"==typeof e&&null!==e&&(e.$$typeof===g||e.$$typeof===h||e.$$typeof===c||e.$$typeof===s||e.$$typeof===p||e.$$typeof===v||e.$$typeof===w||e.$$typeof===b||e.$$typeof===y)},t.typeOf=x},959:(e,t,r)=>{"use strict";e.exports=r(843)},604:(e,t)=>{"use strict";Symbol.for("react.element"),Symbol.for("react.portal"),Symbol.for("react.fragment"),Symbol.for("react.strict_mode"),Symbol.for("react.profiler"),Symbol.for("react.provider"),Symbol.for("react.context"),Symbol.for("react.server_context"),Symbol.for("react.forward_ref"),Symbol.for("react.suspense"),Symbol.for("react.suspense_list"),Symbol.for("react.memo"),Symbol.for("react.lazy"),Symbol.for("react.offscreen");Symbol.for("react.module.reference")},176:(e,t,r)=>{"use strict";r(604)},670:(e,t,r)=>{"use strict";t.__esModule=!0,t.default=function(e){var t=(0,o.default)(e);return{getItem:function(e){return new Promise((function(r,n){r(t.getItem(e))}))},setItem:function(e,r){return new Promise((function(n,o){n(t.setItem(e,r))}))},removeItem:function(e){return new Promise((function(r,n){r(t.removeItem(e))}))}}};var n,o=(n=r(532))&&n.__esModule?n:{default:n}},532:(e,t)=>{"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function n(){}t.__esModule=!0,t.default=function(e){var t="".concat(e,"Storage");return function(e){if("object"!==("undefined"==typeof self?"undefined":r(self))||!(e in self))return!1;try{var t=self[e],n="redux-persist ".concat(e," test");t.setItem(n,"test"),t.getItem(n),t.removeItem(n)}catch(e){return!1}return!0}(t)?self[t]:o};var o={getItem:n,setItem:n,removeItem:n}},181:(e,t,r)=>{"use strict";var n;t.A=void 0;var o=(0,((n=r(670))&&n.__esModule?n:{default:n}).default)("session");t.A=o},664:e=>{e.exports=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,r=[],n=0;n<e.rangeCount;n++)r.push(e.getRangeAt(n));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||r.forEach((function(t){e.addRange(t)})),t&&t.focus()}}},859:(e,t,r)=>{"use strict";var n=r(609),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=n.useState,i=n.useEffect,l=n.useLayoutEffect,c=n.useDebugValue;function s(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!o(e,r)}catch(e){return!0}}var u="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var r=t(),n=a({inst:{value:r,getSnapshot:t}}),o=n[0].inst,u=n[1];return l((function(){o.value=r,o.getSnapshot=t,s(o)&&u({inst:o})}),[e,r,t]),i((function(){return s(o)&&u({inst:o}),e((function(){s(o)&&u({inst:o})}))}),[e]),c(r),r};t.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:u},632:(e,t,r)=>{"use strict";var n=r(609),o=r(524),a="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=o.useSyncExternalStore,l=n.useRef,c=n.useEffect,s=n.useMemo,u=n.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,r,n,o){var m=l(null);if(null===m.current){var p={hasValue:!1,value:null};m.current=p}else p=m.current;m=s((function(){function e(e){if(!c){if(c=!0,i=e,e=n(e),void 0!==o&&p.hasValue){var t=p.value;if(o(t,e))return l=t}return l=e}if(t=l,a(i,e))return t;var r=n(e);return void 0!==o&&o(t,r)?t:(i=e,l=r)}var i,l,c=!1,s=void 0===r?null:r;return[function(){return e(t())},null===s?void 0:function(){return e(s())}]}),[t,r,n,o]);var f=i(e,m[0],m[1]);return c((function(){p.hasValue=!0,p.value=f}),[f]),u(f),f}},524:(e,t,r)=>{"use strict";e.exports=r(859)},822:(e,t,r)=>{"use strict";e.exports=r(632)},609:e=>{"use strict";e.exports=window.React}},n={};function o(e){var t=n[e];if(void 0!==t)return t.exports;var a=n[e]={exports:{}};return r[e](a,a.exports,o),a.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(r,n){if(1&n&&(r=this(r)),8&n)return r;if("object"==typeof r&&r){if(4&n&&r.__esModule)return r;if(16&n&&"function"==typeof r.then)return r}var a=Object.create(null);o.r(a);var i={};e=e||[null,t({}),t([]),t(t)];for(var l=2&n&&r;"object"==typeof l&&!~e.indexOf(l);l=t(l))Object.getOwnPropertyNames(l).forEach((e=>i[e]=()=>r[e]));return i.default=()=>r,o.d(a,i),a},o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=r[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{"use strict";const e=window.wp.element;var t=o(609),r=o.t(t,2),n=o.n(t);function a(e){var t,r,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(r=a(e[t]))&&(n&&(n+=" "),n+=r);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}const i=function(){for(var e,t,r=0,n="";r<arguments.length;)(e=arguments[r++])&&(t=a(e))&&(n&&(n+=" "),n+=t);return n},l=e=>"number"==typeof e&&!isNaN(e),c=e=>"string"==typeof e,s=e=>"function"==typeof e,u=e=>c(e)||s(e)?e:null,m=e=>(0,t.isValidElement)(e)||c(e)||s(e)||l(e);function p(e){let{enter:r,exit:n,appendPosition:o=!1,collapse:a=!0,collapseDuration:i=300}=e;return function(e){let{children:l,position:c,preventExitTransition:s,done:u,nodeRef:m,isIn:p}=e;const f=o?`${r}--${c}`:r,d=o?`${n}--${c}`:n,h=(0,t.useRef)(0);return(0,t.useLayoutEffect)((()=>{const e=m.current,t=f.split(" "),r=n=>{n.target===m.current&&(e.dispatchEvent(new Event("d")),e.removeEventListener("animationend",r),e.removeEventListener("animationcancel",r),0===h.current&&"animationcancel"!==n.type&&e.classList.remove(...t))};e.classList.add(...t),e.addEventListener("animationend",r),e.addEventListener("animationcancel",r)}),[]),(0,t.useEffect)((()=>{const e=m.current,t=()=>{e.removeEventListener("animationend",t),a?function(e,t,r){void 0===r&&(r=300);const{scrollHeight:n,style:o}=e;requestAnimationFrame((()=>{o.minHeight="initial",o.height=n+"px",o.transition=`all ${r}ms`,requestAnimationFrame((()=>{o.height="0",o.padding="0",o.margin="0",setTimeout(t,r)}))}))}(e,u,i):u()};p||(s?t():(h.current=1,e.className+=` ${d}`,e.addEventListener("animationend",t)))}),[p]),t.createElement(t.Fragment,null,l)}}function f(e,t){return null!=e?{content:e.content,containerId:e.props.containerId,id:e.props.toastId,theme:e.props.theme,type:e.props.type,data:e.props.data||{},isLoading:e.props.isLoading,icon:e.props.icon,status:t}:{}}const d={list:new Map,emitQueue:new Map,on(e,t){return this.list.has(e)||this.list.set(e,[]),this.list.get(e).push(t),this},off(e,t){if(t){const r=this.list.get(e).filter((e=>e!==t));return this.list.set(e,r),this}return this.list.delete(e),this},cancelEmit(e){const t=this.emitQueue.get(e);return t&&(t.forEach(clearTimeout),this.emitQueue.delete(e)),this},emit(e){this.list.has(e)&&this.list.get(e).forEach((t=>{const r=setTimeout((()=>{t(...[].slice.call(arguments,1))}),0);this.emitQueue.has(e)||this.emitQueue.set(e,[]),this.emitQueue.get(e).push(r)}))}},h=e=>{let{theme:r,type:n,...o}=e;return t.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:"colored"===r?"currentColor":`var(--toastify-icon-color-${n})`,...o})},g={info:function(e){return t.createElement(h,{...e},t.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))},warning:function(e){return t.createElement(h,{...e},t.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))},success:function(e){return t.createElement(h,{...e},t.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))},error:function(e){return t.createElement(h,{...e},t.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))},spinner:function(){return t.createElement("div",{className:"Toastify__spinner"})}};function y(e){const[,r]=(0,t.useReducer)((e=>e+1),0),[n,o]=(0,t.useState)([]),a=(0,t.useRef)(null),i=(0,t.useRef)(new Map).current,p=e=>-1!==n.indexOf(e),h=(0,t.useRef)({toastKey:1,displayedToast:0,count:0,queue:[],props:e,containerId:null,isToastActive:p,getToast:e=>i.get(e)}).current;function y(e){let{containerId:t}=e;const{limit:r}=h.props;!r||t&&h.containerId!==t||(h.count-=h.queue.length,h.queue=[])}function v(e){o((t=>null==e?[]:t.filter((t=>t!==e))))}function w(){const{toastContent:e,toastProps:t,staleId:r}=h.queue.shift();x(e,t,r)}function b(e,n){let{delay:o,staleId:p,...y}=n;if(!m(e)||function(e){return!a.current||h.props.enableMultiContainer&&e.containerId!==h.props.containerId||i.has(e.toastId)&&null==e.updateId}(y))return;const{toastId:b,updateId:E,data:S}=y,{props:k}=h,N=()=>v(b),O=null==E;O&&h.count++;const j={...k,style:k.toastStyle,key:h.toastKey++,...Object.fromEntries(Object.entries(y).filter((e=>{let[t,r]=e;return null!=r}))),toastId:b,updateId:E,data:S,closeToast:N,isIn:!1,className:u(y.className||k.toastClassName),bodyClassName:u(y.bodyClassName||k.bodyClassName),progressClassName:u(y.progressClassName||k.progressClassName),autoClose:!y.isLoading&&(C=y.autoClose,L=k.autoClose,!1===C||l(C)&&C>0?C:L),deleteToast(){const e=f(i.get(b),"removed");i.delete(b),d.emit(4,e);const t=h.queue.length;if(h.count=null==b?h.count-h.displayedToast:h.count-1,h.count<0&&(h.count=0),t>0){const e=null==b?h.props.limit:1;if(1===t||1===e)h.displayedToast++,w();else{const r=e>t?t:e;h.displayedToast=r;for(let e=0;e<r;e++)w()}}else r()}};var C,L;j.iconOut=function(e){let{theme:r,type:n,isLoading:o,icon:a}=e,i=null;const u={theme:r,type:n};return!1===a||(s(a)?i=a(u):(0,t.isValidElement)(a)?i=(0,t.cloneElement)(a,u):c(a)||l(a)?i=a:o?i=g.spinner():(e=>e in g)(n)&&(i=g[n](u))),i}(j),s(y.onOpen)&&(j.onOpen=y.onOpen),s(y.onClose)&&(j.onClose=y.onClose),j.closeButton=k.closeButton,!1===y.closeButton||m(y.closeButton)?j.closeButton=y.closeButton:!0===y.closeButton&&(j.closeButton=!m(k.closeButton)||k.closeButton);let P=e;(0,t.isValidElement)(e)&&!c(e.type)?P=(0,t.cloneElement)(e,{closeToast:N,toastProps:j,data:S}):s(e)&&(P=e({closeToast:N,toastProps:j,data:S})),k.limit&&k.limit>0&&h.count>k.limit&&O?h.queue.push({toastContent:P,toastProps:j,staleId:p}):l(o)?setTimeout((()=>{x(P,j,p)}),o):x(P,j,p)}function x(e,t,r){const{toastId:n}=t;r&&i.delete(r);const a={content:e,props:t};i.set(n,a),o((e=>[...e,n].filter((e=>e!==r)))),d.emit(4,f(a,null==a.props.updateId?"added":"updated"))}return(0,t.useEffect)((()=>(h.containerId=e.containerId,d.cancelEmit(3).on(0,b).on(1,(e=>a.current&&v(e))).on(5,y).emit(2,h),()=>{i.clear(),d.emit(3,h)})),[]),(0,t.useEffect)((()=>{h.props=e,h.isToastActive=p,h.displayedToast=n.length})),{getToastToRender:function(t){const r=new Map,n=Array.from(i.values());return e.newestOnTop&&n.reverse(),n.forEach((e=>{const{position:t}=e.props;r.has(t)||r.set(t,[]),r.get(t).push(e)})),Array.from(r,(e=>t(e[0],e[1])))},containerRef:a,isToastActive:p}}function v(e){return e.targetTouches&&e.targetTouches.length>=1?e.targetTouches[0].clientX:e.clientX}function w(e){return e.targetTouches&&e.targetTouches.length>=1?e.targetTouches[0].clientY:e.clientY}function b(e){const[r,n]=(0,t.useState)(!1),[o,a]=(0,t.useState)(!1),i=(0,t.useRef)(null),l=(0,t.useRef)({start:0,x:0,y:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,boundingRect:null,didMove:!1}).current,c=(0,t.useRef)(e),{autoClose:u,pauseOnHover:m,closeToast:p,onClick:f,closeOnClick:d}=e;function h(t){if(e.draggable){"touchstart"===t.nativeEvent.type&&t.nativeEvent.preventDefault(),l.didMove=!1,document.addEventListener("mousemove",x),document.addEventListener("mouseup",E),document.addEventListener("touchmove",x),document.addEventListener("touchend",E);const r=i.current;l.canCloseOnClick=!0,l.canDrag=!0,l.boundingRect=r.getBoundingClientRect(),r.style.transition="",l.x=v(t.nativeEvent),l.y=w(t.nativeEvent),"x"===e.draggableDirection?(l.start=l.x,l.removalDistance=r.offsetWidth*(e.draggablePercent/100)):(l.start=l.y,l.removalDistance=r.offsetHeight*(80===e.draggablePercent?1.5*e.draggablePercent:e.draggablePercent/100))}}function g(t){if(l.boundingRect){const{top:r,bottom:n,left:o,right:a}=l.boundingRect;"touchend"!==t.nativeEvent.type&&e.pauseOnHover&&l.x>=o&&l.x<=a&&l.y>=r&&l.y<=n?b():y()}}function y(){n(!0)}function b(){n(!1)}function x(t){const n=i.current;l.canDrag&&n&&(l.didMove=!0,r&&b(),l.x=v(t),l.y=w(t),l.delta="x"===e.draggableDirection?l.x-l.start:l.y-l.start,l.start!==l.x&&(l.canCloseOnClick=!1),n.style.transform=`translate${e.draggableDirection}(${l.delta}px)`,n.style.opacity=""+(1-Math.abs(l.delta/l.removalDistance)))}function E(){document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",E),document.removeEventListener("touchmove",x),document.removeEventListener("touchend",E);const t=i.current;if(l.canDrag&&l.didMove&&t){if(l.canDrag=!1,Math.abs(l.delta)>l.removalDistance)return a(!0),void e.closeToast();t.style.transition="transform 0.2s, opacity 0.2s",t.style.transform=`translate${e.draggableDirection}(0)`,t.style.opacity="1"}}(0,t.useEffect)((()=>{c.current=e})),(0,t.useEffect)((()=>(i.current&&i.current.addEventListener("d",y,{once:!0}),s(e.onOpen)&&e.onOpen((0,t.isValidElement)(e.children)&&e.children.props),()=>{const e=c.current;s(e.onClose)&&e.onClose((0,t.isValidElement)(e.children)&&e.children.props)})),[]),(0,t.useEffect)((()=>(e.pauseOnFocusLoss&&(document.hasFocus()||b(),window.addEventListener("focus",y),window.addEventListener("blur",b)),()=>{e.pauseOnFocusLoss&&(window.removeEventListener("focus",y),window.removeEventListener("blur",b))})),[e.pauseOnFocusLoss]);const S={onMouseDown:h,onTouchStart:h,onMouseUp:g,onTouchEnd:g};return u&&m&&(S.onMouseEnter=b,S.onMouseLeave=y),d&&(S.onClick=e=>{f&&f(e),l.canCloseOnClick&&p()}),{playToast:y,pauseToast:b,isRunning:r,preventExitTransition:o,toastRef:i,eventHandlers:S}}function x(e){let{closeToast:r,theme:n,ariaLabel:o="close"}=e;return t.createElement("button",{className:`Toastify__close-button Toastify__close-button--${n}`,type:"button",onClick:e=>{e.stopPropagation(),r(e)},"aria-label":o},t.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},t.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))}function E(e){let{delay:r,isRunning:n,closeToast:o,type:a="default",hide:l,className:c,style:u,controlledProgress:m,progress:p,rtl:f,isIn:d,theme:h}=e;const g=l||m&&0===p,y={...u,animationDuration:`${r}ms`,animationPlayState:n?"running":"paused",opacity:g?0:1};m&&(y.transform=`scaleX(${p})`);const v=i("Toastify__progress-bar",m?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${h}`,`Toastify__progress-bar--${a}`,{"Toastify__progress-bar--rtl":f}),w=s(c)?c({rtl:f,type:a,defaultClassName:v}):i(v,c);return t.createElement("div",{role:"progressbar","aria-hidden":g?"true":"false","aria-label":"notification timer",className:w,style:y,[m&&p>=1?"onTransitionEnd":"onAnimationEnd"]:m&&p<1?null:()=>{d&&o()}})}const S=e=>{const{isRunning:r,preventExitTransition:n,toastRef:o,eventHandlers:a}=b(e),{closeButton:l,children:c,autoClose:u,onClick:m,type:p,hideProgressBar:f,closeToast:d,transition:h,position:g,className:y,style:v,bodyClassName:w,bodyStyle:S,progressClassName:k,progressStyle:N,updateId:O,role:j,progress:C,rtl:L,toastId:P,deleteToast:_,isIn:R,isLoading:I,iconOut:A,closeOnClick:T,theme:F}=e,M=i("Toastify__toast",`Toastify__toast-theme--${F}`,`Toastify__toast--${p}`,{"Toastify__toast--rtl":L},{"Toastify__toast--close-on-click":T}),D=s(y)?y({rtl:L,position:g,type:p,defaultClassName:M}):i(M,y),G=!!C||!u,q={closeToast:d,type:p,theme:F};let V=null;return!1===l||(V=s(l)?l(q):(0,t.isValidElement)(l)?(0,t.cloneElement)(l,q):x(q)),t.createElement(h,{isIn:R,done:_,position:g,preventExitTransition:n,nodeRef:o},t.createElement("div",{id:P,onClick:m,className:D,...a,style:v,ref:o},t.createElement("div",{...R&&{role:j},className:s(w)?w({type:p}):i("Toastify__toast-body",w),style:S},null!=A&&t.createElement("div",{className:i("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!I})},A),t.createElement("div",null,c)),V,t.createElement(E,{...O&&!G?{key:`pb-${O}`}:{},rtl:L,theme:F,delay:u,isRunning:r,isIn:R,closeToast:d,hide:f,type:p,style:N,className:k,controlledProgress:G,progress:C||0})))},k=function(e,t){return void 0===t&&(t=!1),{enter:`Toastify--animate Toastify__${e}-enter`,exit:`Toastify--animate Toastify__${e}-exit`,appendPosition:t}},N=p(k("bounce",!0)),O=(p(k("slide",!0)),p(k("zoom")),p(k("flip")),(0,t.forwardRef)(((e,r)=>{const{getToastToRender:n,containerRef:o,isToastActive:a}=y(e),{className:l,style:c,rtl:m,containerId:p}=e;function f(e){const t=i("Toastify__toast-container",`Toastify__toast-container--${e}`,{"Toastify__toast-container--rtl":m});return s(l)?l({position:e,rtl:m,defaultClassName:t}):i(t,u(l))}return(0,t.useEffect)((()=>{r&&(r.current=o.current)}),[]),t.createElement("div",{ref:o,className:"Toastify",id:p},n(((e,r)=>{const n=r.length?{...c}:{...c,pointerEvents:"none"};return t.createElement("div",{className:f(e),style:n,key:`container-${e}`},r.map(((e,n)=>{let{content:o,props:i}=e;return t.createElement(S,{...i,isIn:a(i.toastId),style:{...i.style,"--nth":n+1,"--len":r.length},key:`toast-${i.key}`},o)})))})))})));O.displayName="ToastContainer",O.defaultProps={position:"top-right",transition:N,autoClose:5e3,closeButton:x,pauseOnHover:!0,pauseOnFocusLoss:!0,closeOnClick:!0,draggable:!0,draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};let j,C=new Map,L=[],P=1;function _(){return""+P++}function R(e){return e&&(c(e.toastId)||l(e.toastId))?e.toastId:_()}function I(e,t){return C.size>0?d.emit(0,e,t):L.push({content:e,options:t}),t.toastId}function A(e,t){return{...t,type:t&&t.type||e,toastId:R(t)}}function T(e){return(t,r)=>I(t,A(e,r))}function F(e,t){return I(e,A("default",t))}F.loading=(e,t)=>I(e,A("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...t})),F.promise=function(e,t,r){let n,{pending:o,error:a,success:i}=t;o&&(n=c(o)?F.loading(o,r):F.loading(o.render,{...r,...o}));const l={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},u=(e,t,o)=>{if(null==t)return void F.dismiss(n);const a={type:e,...l,...r,data:o},i=c(t)?{render:t}:t;return n?F.update(n,{...a,...i}):F(i.render,{...a,...i}),o},m=s(e)?e():e;return m.then((e=>u("success",i,e))).catch((e=>u("error",a,e))),m},F.success=T("success"),F.info=T("info"),F.error=T("error"),F.warning=T("warning"),F.warn=F.warning,F.dark=(e,t)=>I(e,A("default",{theme:"dark",...t})),F.dismiss=e=>{C.size>0?d.emit(1,e):L=L.filter((t=>null!=e&&t.options.toastId!==e))},F.clearWaitingQueue=function(e){return void 0===e&&(e={}),d.emit(5,e)},F.isActive=e=>{let t=!1;return C.forEach((r=>{r.isToastActive&&r.isToastActive(e)&&(t=!0)})),t},F.update=function(e,t){void 0===t&&(t={}),setTimeout((()=>{const r=function(e,t){let{containerId:r}=t;const n=C.get(r||j);return n&&n.getToast(e)}(e,t);if(r){const{props:n,content:o}=r,a={delay:100,...n,...t,toastId:t.toastId||e,updateId:_()};a.toastId!==e&&(a.staleId=e);const i=a.render||o;delete a.render,I(i,a)}}),0)},F.done=e=>{F.update(e,{progress:1})},F.onChange=e=>(d.on(4,e),()=>{d.off(4,e)}),F.POSITION={TOP_LEFT:"top-left",TOP_RIGHT:"top-right",TOP_CENTER:"top-center",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",BOTTOM_CENTER:"bottom-center"},F.TYPE={INFO:"info",SUCCESS:"success",WARNING:"warning",ERROR:"error",DEFAULT:"default"},d.on(2,(e=>{j=e.containerId||e,C.set(j,e),L.forEach((e=>{d.emit(0,e.content,e.options)})),L=[]})).on(3,(e=>{C.delete(e.containerId||e),0===C.size&&d.off(0).off(1).off(5)}));var M=o(524),D=o(822);const G=window.ReactDOM;let q=function(e){e()};const V=()=>q,W=Symbol.for("react-redux-context"),z="undefined"!=typeof globalThis?globalThis:{};function B(){var e;if(!t.createContext)return{};const r=null!=(e=z[W])?e:z[W]=new Map;let n=r.get(t.createContext);return n||(n=t.createContext(null),r.set(t.createContext,n)),n}const U=B();function H(e=U){return function(){return(0,t.useContext)(e)}}const $=H();let Z=()=>{throw new Error("uSES not initialized!")};const Y=(e,t)=>e===t;function K(e=U){const r=e===U?$:H(e);return function(e,n={}){const{equalityFn:o=Y,stabilityCheck:a,noopCheck:i}="function"==typeof n?{equalityFn:n}:n,{store:l,subscription:c,getServerState:s,stabilityCheck:u,noopCheck:m}=r(),p=((0,t.useRef)(!0),(0,t.useCallback)({[e.name]:t=>e(t)}[e.name],[e,u,a])),f=Z(c.addNestedSub,l.getState,s||l.getState,p,o);return(0,t.useDebugValue)(f),f}}const X=K();o(35),o(176);const J={notify(){},get:()=>[]};const Q="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?t.useLayoutEffect:t.useEffect;let ee=null;function te(e=U){const t=e===U?$:H(e);return function(){const{store:e}=t();return e}}const re=te();function ne(e=U){const t=e===U?re:te(e);return function(){return t().dispatch}}const oe=ne();var ae;function ie(e){return ie="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ie(e)}function le(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ce(e){return ce=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ce(e)}function se(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ue(e,t){return ue=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ue(e,t)}function me(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}(e=>{Z=e})(D.useSyncExternalStoreWithSelector),(e=>{ee=e})(M.useSyncExternalStore),ae=G.unstable_batchedUpdates,q=ae;var pe,fe=function(e){function t(){var e,r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return r=function(e,t){return!t||"object"!==ie(t)&&"function"!=typeof t?se(e):t}(this,(e=ce(t)).call.apply(e,[this].concat(o))),me(se(r),"state",{bootstrapped:!1}),me(se(r),"_unsubscribe",void 0),me(se(r),"handlePersistorState",(function(){r.props.persistor.getState().bootstrapped&&(r.props.onBeforeLift?Promise.resolve(r.props.onBeforeLift()).finally((function(){return r.setState({bootstrapped:!0})})):r.setState({bootstrapped:!0}),r._unsubscribe&&r._unsubscribe())})),r}var r,n;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ue(e,t)}(t,e),r=t,(n=[{key:"componentDidMount",value:function(){this._unsubscribe=this.props.persistor.subscribe(this.handlePersistorState),this.handlePersistorState()}},{key:"componentWillUnmount",value:function(){this._unsubscribe&&this._unsubscribe()}},{key:"render",value:function(){return"function"==typeof this.props.children?this.props.children(this.state.bootstrapped):this.state.bootstrapped?this.props.children:this.props.loading}}])&&le(r.prototype,n),t}(t.PureComponent);function de(){return de=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},de.apply(this,arguments)}me(fe,"defaultProps",{children:null,loading:null}),function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"}(pe||(pe={}));const he="popstate";function ge(e,t){if(!1===e||null==e)throw new Error(t)}function ye(e,t){if(!e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(e){}}}function ve(e,t){return{usr:e.state,key:e.key,idx:t}}function we(e,t,r,n){return void 0===r&&(r=null),de({pathname:"string"==typeof e?e:e.pathname,search:"",hash:""},"string"==typeof t?xe(t):t,{state:r,key:t&&t.key||n||Math.random().toString(36).substr(2,8)})}function be(e){let{pathname:t="/",search:r="",hash:n=""}=e;return r&&"?"!==r&&(t+="?"===r.charAt(0)?r:"?"+r),n&&"#"!==n&&(t+="#"===n.charAt(0)?n:"#"+n),t}function xe(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}var Ee;function Se(e,t,r){void 0===r&&(r="/");let n=Me(("string"==typeof t?xe(t):t).pathname||"/",r);if(null==n)return null;let o=ke(e);!function(e){e.sort(((e,t)=>e.score!==t.score?t.score-e.score:function(e,t){let r=e.length===t.length&&e.slice(0,-1).every(((e,r)=>e===t[r]));return r?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map((e=>e.childrenIndex)),t.routesMeta.map((e=>e.childrenIndex)))))}(o);let a=null;for(let e=0;null==a&&e<o.length;++e){let t=Fe(n);a=Ae(o[e],t)}return a}function ke(e,t,r,n){void 0===t&&(t=[]),void 0===r&&(r=[]),void 0===n&&(n="");let o=(e,o,a)=>{let i={relativePath:void 0===a?e.path||"":a,caseSensitive:!0===e.caseSensitive,childrenIndex:o,route:e};i.relativePath.startsWith("/")&&(ge(i.relativePath.startsWith(n),'Absolute route path "'+i.relativePath+'" nested under path "'+n+'" is not valid. An absolute child route path must start with the combined path of all its parent routes.'),i.relativePath=i.relativePath.slice(n.length));let l=Ve([n,i.relativePath]),c=r.concat(i);e.children&&e.children.length>0&&(ge(!0!==e.index,'Index routes must not have child routes. Please remove all child routes from route path "'+l+'".'),ke(e.children,t,c,l)),(null!=e.path||e.index)&&t.push({path:l,score:Ie(l,e.index),routesMeta:c})};return e.forEach(((e,t)=>{var r;if(""!==e.path&&null!=(r=e.path)&&r.includes("?"))for(let r of Ne(e.path))o(e,t,r);else o(e,t)})),t}function Ne(e){let t=e.split("/");if(0===t.length)return[];let[r,...n]=t,o=r.endsWith("?"),a=r.replace(/\?$/,"");if(0===n.length)return o?[a,""]:[a];let i=Ne(n.join("/")),l=[];return l.push(...i.map((e=>""===e?a:[a,e].join("/")))),o&&l.push(...i),l.map((t=>e.startsWith("/")&&""===t?"/":t))}!function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"}(Ee||(Ee={})),new Set(["lazy","caseSensitive","path","id","index","children"]);const Oe=/^:[\w-]+$/,je=3,Ce=2,Le=1,Pe=10,_e=-2,Re=e=>"*"===e;function Ie(e,t){let r=e.split("/"),n=r.length;return r.some(Re)&&(n+=_e),t&&(n+=Ce),r.filter((e=>!Re(e))).reduce(((e,t)=>e+(Oe.test(t)?je:""===t?Le:Pe)),n)}function Ae(e,t){let{routesMeta:r}=e,n={},o="/",a=[];for(let e=0;e<r.length;++e){let i=r[e],l=e===r.length-1,c="/"===o?t:t.slice(o.length)||"/",s=Te({path:i.relativePath,caseSensitive:i.caseSensitive,end:l},c);if(!s)return null;Object.assign(n,s.params);let u=i.route;a.push({params:n,pathname:Ve([o,s.pathname]),pathnameBase:We(Ve([o,s.pathnameBase])),route:u}),"/"!==s.pathnameBase&&(o=Ve([o,s.pathnameBase]))}return a}function Te(e,t){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=function(e,t,r){void 0===t&&(t=!1),void 0===r&&(r=!0),ye("*"===e||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were "'+e.replace(/\*$/,"/*")+'" because the `*` character must always follow a `/` in the pattern. To get rid of this warning, please change the route path to "'+e.replace(/\*$/,"/*")+'".');let n=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,((e,t,r)=>(n.push({paramName:t,isOptional:null!=r}),r?"/?([^\\/]+)?":"/([^\\/]+)")));return e.endsWith("*")?(n.push({paramName:"*"}),o+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?o+="\\/*$":""!==e&&"/"!==e&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),n]}(e.path,e.caseSensitive,e.end),o=t.match(r);if(!o)return null;let a=o[0],i=a.replace(/(.)\/+$/,"$1"),l=o.slice(1),c=n.reduce(((e,t,r)=>{let{paramName:n,isOptional:o}=t;if("*"===n){let e=l[r]||"";i=a.slice(0,a.length-e.length).replace(/(.)\/+$/,"$1")}const c=l[r];return e[n]=o&&!c?void 0:(c||"").replace(/%2F/g,"/"),e}),{});return{params:c,pathname:a,pathnameBase:i,pattern:e}}function Fe(e){try{return e.split("/").map((e=>decodeURIComponent(e).replace(/\//g,"%2F"))).join("/")}catch(t){return ye(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent encoding ('+t+")."),e}}function Me(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&"/"!==n?null:e.slice(r)||"/"}function De(e,t,r,n){return"Cannot include a '"+e+"' character in a manually specified `to."+t+"` field ["+JSON.stringify(n)+"].  Please separate it out to the `to."+r+'` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.'}function Ge(e,t){let r=function(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}(e);return t?r.map(((t,r)=>r===e.length-1?t.pathname:t.pathnameBase)):r.map((e=>e.pathnameBase))}function qe(e,t,r,n){let o;void 0===n&&(n=!1),"string"==typeof e?o=xe(e):(o=de({},e),ge(!o.pathname||!o.pathname.includes("?"),De("?","pathname","search",o)),ge(!o.pathname||!o.pathname.includes("#"),De("#","pathname","hash",o)),ge(!o.search||!o.search.includes("#"),De("#","search","hash",o)));let a,i=""===e||""===o.pathname,l=i?"/":o.pathname;if(null==l)a=r;else{let e=t.length-1;if(!n&&l.startsWith("..")){let t=l.split("/");for(;".."===t[0];)t.shift(),e-=1;o.pathname=t.join("/")}a=e>=0?t[e]:"/"}let c=function(e,t){void 0===t&&(t="/");let{pathname:r,search:n="",hash:o=""}="string"==typeof e?xe(e):e,a=r?r.startsWith("/")?r:function(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach((e=>{".."===e?r.length>1&&r.pop():"."!==e&&r.push(e)})),r.length>1?r.join("/"):"/"}(r,t):t;return{pathname:a,search:ze(n),hash:Be(o)}}(o,a),s=l&&"/"!==l&&l.endsWith("/"),u=(i||"."===l)&&r.endsWith("/");return c.pathname.endsWith("/")||!s&&!u||(c.pathname+="/"),c}const Ve=e=>e.join("/").replace(/\/\/+/g,"/"),We=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),ze=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",Be=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";Error;const Ue=["post","put","patch","delete"],He=(new Set(Ue),["get",...Ue]);function $e(){return $e=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},$e.apply(this,arguments)}new Set(He),new Set([301,302,303,307,308]),new Set([307,308]),Symbol("deferred");const Ze=t.createContext(null),Ye=t.createContext(null),Ke=t.createContext(null),Xe=t.createContext(null),Je=t.createContext({outlet:null,matches:[],isDataRoute:!1}),Qe=t.createContext(null);function et(){return null!=t.useContext(Xe)}function tt(){return et()||ge(!1),t.useContext(Xe).location}function rt(e){t.useContext(Ke).static||t.useLayoutEffect(e)}function nt(){let{isDataRoute:e}=t.useContext(Je);return e?function(){let{router:e}=function(e){let r=t.useContext(Ze);return r||ge(!1),r}(ut.UseNavigateStable),r=pt(mt.UseNavigateStable),n=t.useRef(!1);return rt((()=>{n.current=!0})),t.useCallback((function(t,o){void 0===o&&(o={}),n.current&&("number"==typeof t?e.navigate(t):e.navigate(t,$e({fromRouteId:r},o)))}),[e,r])}():function(){et()||ge(!1);let e=t.useContext(Ze),{basename:r,future:n,navigator:o}=t.useContext(Ke),{matches:a}=t.useContext(Je),{pathname:i}=tt(),l=JSON.stringify(Ge(a,n.v7_relativeSplatPath)),c=t.useRef(!1);return rt((()=>{c.current=!0})),t.useCallback((function(t,n){if(void 0===n&&(n={}),!c.current)return;if("number"==typeof t)return void o.go(t);let a=qe(t,JSON.parse(l),i,"path"===n.relative);null==e&&"/"!==r&&(a.pathname="/"===a.pathname?r:Ve([r,a.pathname])),(n.replace?o.replace:o.push)(a,n.state,n)}),[r,o,l,i,e])}()}function ot(e,r){let{relative:n}=void 0===r?{}:r,{future:o}=t.useContext(Ke),{matches:a}=t.useContext(Je),{pathname:i}=tt(),l=JSON.stringify(Ge(a,o.v7_relativeSplatPath));return t.useMemo((()=>qe(e,JSON.parse(l),i,"path"===n)),[e,l,i,n])}function at(e,r,n,o){et()||ge(!1);let{navigator:a}=t.useContext(Ke),{matches:i}=t.useContext(Je),l=i[i.length-1],c=l?l.params:{},s=(l&&l.pathname,l?l.pathnameBase:"/");l&&l.route;let u,m=tt();if(r){var p;let e="string"==typeof r?xe(r):r;"/"===s||(null==(p=e.pathname)?void 0:p.startsWith(s))||ge(!1),u=e}else u=m;let f=u.pathname||"/",d=f;if("/"!==s){let e=s.replace(/^\//,"").split("/");d="/"+f.replace(/^\//,"").split("/").slice(e.length).join("/")}let h=Se(e,{pathname:d}),g=function(e,r,n,o){var a;if(void 0===r&&(r=[]),void 0===n&&(n=null),void 0===o&&(o=null),null==e){var i;if(null==(i=n)||!i.errors)return null;e=n.matches}let l=e,c=null==(a=n)?void 0:a.errors;if(null!=c){let e=l.findIndex((e=>e.route.id&&(null==c?void 0:c[e.route.id])));e>=0||ge(!1),l=l.slice(0,Math.min(l.length,e+1))}let s=!1,u=-1;if(n&&o&&o.v7_partialHydration)for(let e=0;e<l.length;e++){let t=l[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(u=e),t.route.id){let{loaderData:e,errors:r}=n,o=t.route.loader&&void 0===e[t.route.id]&&(!r||void 0===r[t.route.id]);if(t.route.lazy||o){s=!0,l=u>=0?l.slice(0,u+1):[l[0]];break}}}return l.reduceRight(((e,o,a)=>{let i,m=!1,p=null,f=null;var d;n&&(i=c&&o.route.id?c[o.route.id]:void 0,p=o.route.errorElement||lt,s&&(u<0&&0===a?(ft[d="route-fallback"]||(ft[d]=!0),m=!0,f=null):u===a&&(m=!0,f=o.route.hydrateFallbackElement||null)));let h=r.concat(l.slice(0,a+1)),g=()=>{let r;return r=i?p:m?f:o.route.Component?t.createElement(o.route.Component,null):o.route.element?o.route.element:e,t.createElement(st,{match:o,routeContext:{outlet:e,matches:h,isDataRoute:null!=n},children:r})};return n&&(o.route.ErrorBoundary||o.route.errorElement||0===a)?t.createElement(ct,{location:n.location,revalidation:n.revalidation,component:p,error:i,children:g(),routeContext:{outlet:null,matches:h,isDataRoute:!0}}):g()}),null)}(h&&h.map((e=>Object.assign({},e,{params:Object.assign({},c,e.params),pathname:Ve([s,a.encodeLocation?a.encodeLocation(e.pathname).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?s:Ve([s,a.encodeLocation?a.encodeLocation(e.pathnameBase).pathname:e.pathnameBase])}))),i,n,o);return r&&g?t.createElement(Xe.Provider,{value:{location:$e({pathname:"/",search:"",hash:"",state:null,key:"default"},u),navigationType:pe.Pop}},g):g}function it(){let e=function(){var e;let r=t.useContext(Qe),n=function(e){let r=t.useContext(Ye);return r||ge(!1),r}(mt.UseRouteError),o=pt(mt.UseRouteError);return void 0!==r?r:null==(e=n.errors)?void 0:e[o]}(),r=function(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,o={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return t.createElement(t.Fragment,null,t.createElement("h2",null,"Unexpected Application Error!"),t.createElement("h3",{style:{fontStyle:"italic"}},r),n?t.createElement("pre",{style:o},n):null,null)}const lt=t.createElement(it,null);class ct extends t.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||"idle"!==t.revalidation&&"idle"===e.revalidation?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:void 0!==e.error?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return void 0!==this.state.error?t.createElement(Je.Provider,{value:this.props.routeContext},t.createElement(Qe.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function st(e){let{routeContext:r,match:n,children:o}=e,a=t.useContext(Ze);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),t.createElement(Je.Provider,{value:r},o)}var ut=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(ut||{}),mt=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(mt||{});function pt(e){let r=function(e){let r=t.useContext(Je);return r||ge(!1),r}(),n=r.matches[r.matches.length-1];return n.route.id||ge(!1),n.route.id}const ft={};function dt(e){ge(!1)}function ht(e){let{basename:r="/",children:n=null,location:o,navigationType:a=pe.Pop,navigator:i,static:l=!1,future:c}=e;et()&&ge(!1);let s=r.replace(/^\/*/,"/"),u=t.useMemo((()=>({basename:s,navigator:i,static:l,future:$e({v7_relativeSplatPath:!1},c)})),[s,c,i,l]);"string"==typeof o&&(o=xe(o));let{pathname:m="/",search:p="",hash:f="",state:d=null,key:h="default"}=o,g=t.useMemo((()=>{let e=Me(m,s);return null==e?null:{location:{pathname:e,search:p,hash:f,state:d,key:h},navigationType:a}}),[s,m,p,f,d,h,a]);return null==g?null:t.createElement(Ke.Provider,{value:u},t.createElement(Xe.Provider,{children:n,value:g}))}function gt(e){let{children:t,location:r}=e;return function(e,t){return at(e,t)}(yt(t),r)}function yt(e,r){void 0===r&&(r=[]);let n=[];return t.Children.forEach(e,((e,o)=>{if(!t.isValidElement(e))return;let a=[...r,o];if(e.type===t.Fragment)return void n.push.apply(n,yt(e.props.children,a));e.type!==dt&&ge(!1),e.props.index&&e.props.children&&ge(!1);let i={id:e.props.id||a.join("-"),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,loader:e.props.loader,action:e.props.action,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:null!=e.props.ErrorBoundary||null!=e.props.errorElement,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(i.children=yt(e.props.children,a)),n.push(i)})),n}function vt(){return vt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},vt.apply(this,arguments)}function wt(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}t.startTransition,new Promise((()=>{})),t.Component,new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);const bt=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],xt=["aria-current","caseSensitive","className","end","style","to","unstable_viewTransition","children"];try{window.__reactRouterVersion="6"}catch(Xs){}const Et=t.createContext({isTransitioning:!1});new Map;const St=t.startTransition;function kt(e){let{basename:r,children:n,future:o,window:a}=e,i=t.useRef();var l;null==i.current&&(i.current=(void 0===(l={window:a,v5Compat:!0})&&(l={}),function(e,t,r,n){void 0===n&&(n={});let{window:o=document.defaultView,v5Compat:a=!1}=n,i=o.history,l=pe.Pop,c=null,s=u();function u(){return(i.state||{idx:null}).idx}function m(){l=pe.Pop;let e=u(),t=null==e?null:e-s;s=e,c&&c({action:l,location:f.location,delta:t})}function p(e){let t="null"!==o.location.origin?o.location.origin:o.location.href,r="string"==typeof e?e:be(e);return r=r.replace(/ $/,"%20"),ge(t,"No window.location.(origin|href) available to create URL for href: "+r),new URL(r,t)}null==s&&(s=0,i.replaceState(de({},i.state,{idx:s}),""));let f={get action(){return l},get location(){return e(o,i)},listen(e){if(c)throw new Error("A history only accepts one active listener");return o.addEventListener(he,m),c=e,()=>{o.removeEventListener(he,m),c=null}},createHref:e=>t(o,e),createURL:p,encodeLocation(e){let t=p(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(e,t){l=pe.Push;let n=we(f.location,e,t);r&&r(n,e),s=u()+1;let m=ve(n,s),p=f.createHref(n);try{i.pushState(m,"",p)}catch(e){if(e instanceof DOMException&&"DataCloneError"===e.name)throw e;o.location.assign(p)}a&&c&&c({action:l,location:f.location,delta:1})},replace:function(e,t){l=pe.Replace;let n=we(f.location,e,t);r&&r(n,e),s=u();let o=ve(n,s),m=f.createHref(n);i.replaceState(o,"",m),a&&c&&c({action:l,location:f.location,delta:0})},go:e=>i.go(e)};return f}((function(e,t){let{pathname:r="/",search:n="",hash:o=""}=xe(e.location.hash.substr(1));return r.startsWith("/")||r.startsWith(".")||(r="/"+r),we("",{pathname:r,search:n,hash:o},t.state&&t.state.usr||null,t.state&&t.state.key||"default")}),(function(e,t){let r=e.document.querySelector("base"),n="";if(r&&r.getAttribute("href")){let t=e.location.href,r=t.indexOf("#");n=-1===r?t:t.slice(0,r)}return n+"#"+("string"==typeof t?t:be(t))}),(function(e,t){ye("/"===e.pathname.charAt(0),"relative pathnames are not supported in hash history.push("+JSON.stringify(t)+")")}),l)));let c=i.current,[s,u]=t.useState({action:c.action,location:c.location}),{v7_startTransition:m}=o||{},p=t.useCallback((e=>{m&&St?St((()=>u(e))):u(e)}),[u,m]);return t.useLayoutEffect((()=>c.listen(p)),[c,p]),t.createElement(ht,{basename:r,children:n,location:s.location,navigationType:s.action,navigator:c,future:o})}G.flushSync,t.useId;const Nt="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Ot=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,jt=t.forwardRef((function(e,r){let n,{onClick:o,relative:a,reloadDocument:i,replace:l,state:c,target:s,to:u,preventScrollReset:m,unstable_viewTransition:p}=e,f=wt(e,bt),{basename:d}=t.useContext(Ke),h=!1;if("string"==typeof u&&Ot.test(u)&&(n=u,Nt))try{let e=new URL(window.location.href),t=u.startsWith("//")?new URL(e.protocol+u):new URL(u),r=Me(t.pathname,d);t.origin===e.origin&&null!=r?u=r+t.search+t.hash:h=!0}catch(e){}let g=function(e,r){let{relative:n}=void 0===r?{}:r;et()||ge(!1);let{basename:o,navigator:a}=t.useContext(Ke),{hash:i,pathname:l,search:c}=ot(e,{relative:n}),s=l;return"/"!==o&&(s="/"===l?o:Ve([o,l])),a.createHref({pathname:s,search:c,hash:i})}(u,{relative:a}),y=function(e,r){let{target:n,replace:o,state:a,preventScrollReset:i,relative:l,unstable_viewTransition:c}=void 0===r?{}:r,s=nt(),u=tt(),m=ot(e,{relative:l});return t.useCallback((t=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(t,n)){t.preventDefault();let r=void 0!==o?o:be(u)===be(m);s(e,{replace:r,state:a,preventScrollReset:i,relative:l,unstable_viewTransition:c})}}),[u,s,m,o,a,n,e,i,l,c])}(u,{replace:l,state:c,target:s,preventScrollReset:m,relative:a,unstable_viewTransition:p});return t.createElement("a",vt({},f,{href:n||g,onClick:h||i?o:function(e){o&&o(e),e.defaultPrevented||y(e)},ref:r,target:s}))})),Ct=t.forwardRef((function(e,r){let{"aria-current":n="page",caseSensitive:o=!1,className:a="",end:i=!1,style:l,to:c,unstable_viewTransition:s,children:u}=e,m=wt(e,xt),p=ot(c,{relative:m.relative}),f=tt(),d=t.useContext(Ye),{navigator:h,basename:g}=t.useContext(Ke),y=null!=d&&function(e,r){void 0===r&&(r={});let n=t.useContext(Et);null==n&&ge(!1);let{basename:o}=function(e){let r=t.useContext(Ze);return r||ge(!1),r}(Lt.useViewTransitionState),a=ot(e,{relative:r.relative});if(!n.isTransitioning)return!1;let i=Me(n.currentLocation.pathname,o)||n.currentLocation.pathname,l=Me(n.nextLocation.pathname,o)||n.nextLocation.pathname;return null!=Te(a.pathname,l)||null!=Te(a.pathname,i)}(p)&&!0===s,v=h.encodeLocation?h.encodeLocation(p).pathname:p.pathname,w=f.pathname,b=d&&d.navigation&&d.navigation.location?d.navigation.location.pathname:null;o||(w=w.toLowerCase(),b=b?b.toLowerCase():null,v=v.toLowerCase()),b&&g&&(b=Me(b,g)||b);const x="/"!==v&&v.endsWith("/")?v.length-1:v.length;let E,S=w===v||!i&&w.startsWith(v)&&"/"===w.charAt(x),k=null!=b&&(b===v||!i&&b.startsWith(v)&&"/"===b.charAt(v.length)),N={isActive:S,isPending:k,isTransitioning:y},O=S?n:void 0;E="function"==typeof a?a(N):[a,S?"active":null,k?"pending":null,y?"transitioning":null].filter(Boolean).join(" ");let j="function"==typeof l?l(N):l;return t.createElement(jt,vt({},m,{"aria-current":O,className:E,ref:r,style:j,to:c,unstable_viewTransition:s}),"function"==typeof u?u(N):u)}));var Lt,Pt;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Lt||(Lt={})),function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"}(Pt||(Pt={}));const _t=function(){return wp.element.createElement("span",{className:"inline-flex items-center rounded-full bg-purple-100 px-1.5 py-0.5 text-xs font-medium text-purple-700"},"PRO ONLY")};function Rt(){return wp.element.createElement("div",{className:"bg-white p-6 rounded-xl not-prose grid grid-cols-1 gap-6 sm:grid-cols-2 w-full"},wp.element.createElement("header",{className:"mb-2 col-span-full flex flex-col"},wp.element.createElement("p",{className:" text-sm font-medium text-sky-500"},"Introduction"),wp.element.createElement("h1",{className:"text-3xl tracking-tight text-slate-900 font-bold "},"Getting started"),wp.element.createElement("p",{className:"text-xl text-gray-600 mt-2"},"Welcome to SquareWooSync. See below to learn how to start importing and syncronizing products with Square and Woo.")),wp.element.createElement("div",{className:"group relative rounded-xl border border-slate-400 "},wp.element.createElement("div",{className:"absolute -inset-px rounded-xl border-2 border-transparent opacity-0 [background:linear-gradient(var(--quick-links-hover-bg,theme(colors.sky.50)),var(--quick-links-hover-bg,theme(colors.sky.50)))_padding-box,linear-gradient(to_top,theme(colors.sky.400),theme(colors.cyan.400),theme(colors.sky.500))_border-box] group-hover:opacity-100 "}),wp.element.createElement("div",{className:"relative overflow-hidden rounded-xl p-6"},wp.element.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 32 32",fill:"none",className:"h-8 w-8 [--icon-foreground:theme(colors.slate.900)] [--icon-background:theme(colors.white)]"},wp.element.createElement("defs",null,wp.element.createElement("radialGradient",{cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",id:":S3:-gradient",gradientTransform:"matrix(0 21 -21 0 20 11)"},wp.element.createElement("stop",{stopColor:"#0EA5E9"}),wp.element.createElement("stop",{stopColor:"#22D3EE",offset:".527"}),wp.element.createElement("stop",{stopColor:"#818CF8",offset:"1"})),wp.element.createElement("radialGradient",{cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",id:":S3:-gradient-dark-1",gradientTransform:"matrix(0 22.75 -22.75 0 16 6.25)"},wp.element.createElement("stop",{stopColor:"#0EA5E9"}),wp.element.createElement("stop",{stopColor:"#22D3EE",offset:".527"}),wp.element.createElement("stop",{stopColor:"#818CF8",offset:"1"})),wp.element.createElement("radialGradient",{cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",id:":S3:-gradient-dark-2",gradientTransform:"matrix(0 14 -14 0 16 10)"},wp.element.createElement("stop",{stopColor:"#0EA5E9"}),wp.element.createElement("stop",{stopColor:"#22D3EE",offset:".527"}),wp.element.createElement("stop",{stopColor:"#818CF8",offset:"1"}))),wp.element.createElement("g",{className:""},wp.element.createElement("circle",{cx:"20",cy:"20",r:"12",fill:"url(#:S3:-gradient)"}),wp.element.createElement("g",{fillOpacity:"0.5",className:"fill-[var(--icon-background)] stroke-[color:var(--icon-foreground)]",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},wp.element.createElement("path",{d:"M3 9v14l12 6V15L3 9Z"}),wp.element.createElement("path",{d:"M27 9v14l-12 6V15l12-6Z"})),wp.element.createElement("path",{d:"M11 4h8v2l6 3-10 6L5 9l6-3V4Z",fillOpacity:"0.5",className:"fill-[var(--icon-background)]"}),wp.element.createElement("g",{className:"stroke-[color:var(--icon-foreground)]",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},wp.element.createElement("path",{d:"M20 5.5 27 9l-12 6L3 9l7-3.5"}),wp.element.createElement("path",{d:"M20 5c0 1.105-2.239 2-5 2s-5-.895-5-2m10 0c0-1.105-2.239-2-5-2s-5 .895-5 2m10 0v3c0 1.105-2.239 2-5 2s-5-.895-5-2V5"}))),wp.element.createElement("g",{className:"hidden ",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},wp.element.createElement("path",{d:"M17.676 3.38a3.887 3.887 0 0 0-3.352 0l-9 4.288C3.907 8.342 3 9.806 3 11.416v9.168c0 1.61.907 3.073 2.324 3.748l9 4.288a3.887 3.887 0 0 0 3.352 0l9-4.288C28.093 23.657 29 22.194 29 20.584v-9.168c0-1.61-.907-3.074-2.324-3.748l-9-4.288Z",stroke:"url(#:S3:-gradient-dark-1)"}),wp.element.createElement("path",{d:"M16.406 8.087a.989.989 0 0 0-.812 0l-7 3.598A1.012 1.012 0 0 0 8 12.61v6.78c0 .4.233.762.594.925l7 3.598a.989.989 0 0 0 .812 0l7-3.598c.361-.163.594-.525.594-.925v-6.78c0-.4-.233-.762-.594-.925l-7-3.598Z",fill:"url(#:S3:-gradient-dark-2)",stroke:"url(#:S3:-gradient-dark-2)"}))),wp.element.createElement("h2",{className:"mt-4  text-base text-slate-900 "},wp.element.createElement("a",{href:"/wp-admin/admin.php?page=squarewoosync#/inventory"},wp.element.createElement("span",{className:"absolute -inset-px rounded-xl"}),"Start a new import")),wp.element.createElement("p",{className:"mt-1 text-sm text-slate-700 "},"Click here to begin importing or syncronizing products from Square to Woo"))),wp.element.createElement("div",{className:"group relative rounded-xl border border-slate-400 "},wp.element.createElement("div",{className:"absolute -inset-px rounded-xl border-2 border-transparent opacity-0 [background:linear-gradient(var(--quick-links-hover-bg,theme(colors.sky.50)),var(--quick-links-hover-bg,theme(colors.sky.50)))_padding-box,linear-gradient(to_top,theme(colors.sky.400),theme(colors.cyan.400),theme(colors.sky.500))_border-box] group-hover:opacity-100 "}),wp.element.createElement("div",{className:"relative overflow-hidden rounded-xl p-6"},wp.element.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 32 32",fill:"none",className:"h-8 w-8 [--icon-foreground:theme(colors.slate.900)] [--icon-background:theme(colors.white)]"},wp.element.createElement("defs",null,wp.element.createElement("radialGradient",{cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",id:":S1:-gradient",gradientTransform:"matrix(0 21 -21 0 12 3)"},wp.element.createElement("stop",{stopColor:"#0EA5E9"}),wp.element.createElement("stop",{stopColor:"#22D3EE",offset:".527"}),wp.element.createElement("stop",{stopColor:"#818CF8",offset:"1"})),wp.element.createElement("radialGradient",{cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",id:":S1:-gradient-dark",gradientTransform:"matrix(0 21 -21 0 16 7)"},wp.element.createElement("stop",{stopColor:"#0EA5E9"}),wp.element.createElement("stop",{stopColor:"#22D3EE",offset:".527"}),wp.element.createElement("stop",{stopColor:"#818CF8",offset:"1"}))),wp.element.createElement("g",{className:""},wp.element.createElement("circle",{cx:"12",cy:"12",r:"12",fill:"url(#:S1:-gradient)"}),wp.element.createElement("path",{d:"m8 8 9 21 2-10 10-2L8 8Z",fillOpacity:"0.5",className:"fill-[var(--icon-background)] stroke-[color:var(--icon-foreground)]",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})),wp.element.createElement("g",{className:"hidden "},wp.element.createElement("path",{d:"m4 4 10.286 24 2.285-11.429L28 14.286 4 4Z",fill:"url(#:S1:-gradient-dark)",stroke:"url(#:S1:-gradient-dark)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}))),wp.element.createElement("h2",{className:"mt-4  text-base text-slate-900 "},wp.element.createElement("a",{href:"https://squaresyncforwoo.com/documentation",target:"_blank"},wp.element.createElement("span",{className:"absolute -inset-px rounded-xl"}),"Installation")),wp.element.createElement("p",{className:"mt-1 text-sm text-slate-700 "},"Step-by-step guides to setting up your Square account and Woo to talk to each other"))),wp.element.createElement("div",{className:"group relative rounded-xl border border-slate-400 "},wp.element.createElement("div",{className:"absolute -inset-px rounded-xl border-2 border-transparent opacity-0 [background:linear-gradient(var(--quick-links-hover-bg,theme(colors.sky.50)),var(--quick-links-hover-bg,theme(colors.sky.50)))_padding-box,linear-gradient(to_top,theme(colors.sky.400),theme(colors.cyan.400),theme(colors.sky.500))_border-box] group-hover:opacity-100 "}),wp.element.createElement("div",{className:"relative overflow-hidden rounded-xl p-6"},wp.element.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 32 32",fill:"none",className:"h-8 w-8 [--icon-foreground:theme(colors.slate.900)] [--icon-background:theme(colors.white)]"},wp.element.createElement("defs",null,wp.element.createElement("radialGradient",{cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",id:":S2:-gradient",gradientTransform:"matrix(0 21 -21 0 20 3)"},wp.element.createElement("stop",{stopColor:"#0EA5E9"}),wp.element.createElement("stop",{stopColor:"#22D3EE",offset:".527"}),wp.element.createElement("stop",{stopColor:"#818CF8",offset:"1"})),wp.element.createElement("radialGradient",{cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",id:":S2:-gradient-dark",gradientTransform:"matrix(0 22.75 -22.75 0 16 6.25)"},wp.element.createElement("stop",{stopColor:"#0EA5E9"}),wp.element.createElement("stop",{stopColor:"#22D3EE",offset:".527"}),wp.element.createElement("stop",{stopColor:"#818CF8",offset:"1"}))),wp.element.createElement("g",{className:""},wp.element.createElement("circle",{cx:"20",cy:"12",r:"12",fill:"url(#:S2:-gradient)"}),wp.element.createElement("g",{className:"fill-[var(--icon-background)] stroke-[color:var(--icon-foreground)]",fillOpacity:"0.5",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},wp.element.createElement("path",{d:"M3 5v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2Z"}),wp.element.createElement("path",{d:"M18 17v10a2 2 0 0 0 2 2h7a2 2 0 0 0 2-2V17a2 2 0 0 0-2-2h-7a2 2 0 0 0-2 2Z"}),wp.element.createElement("path",{d:"M18 5v4a2 2 0 0 0 2 2h7a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2h-7a2 2 0 0 0-2 2Z"}),wp.element.createElement("path",{d:"M3 25v2a2 2 0 0 0 2 2h7a2 2 0 0 0 2-2v-2a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2Z"}))),wp.element.createElement("g",{className:"hidden ",fill:"url(#:S2:-gradient-dark)"},wp.element.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 17V4a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1Zm16 10v-9a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-6a2 2 0 0 1-2-2Zm0-23v5a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1h-8a1 1 0 0 0-1 1ZM3 28v-3a1 1 0 0 1 1-1h9a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1Z"}),wp.element.createElement("path",{d:"M2 4v13h2V4H2Zm2-2a2 2 0 0 0-2 2h2V2Zm8 0H4v2h8V2Zm2 2a2 2 0 0 0-2-2v2h2Zm0 13V4h-2v13h2Zm-2 2a2 2 0 0 0 2-2h-2v2Zm-8 0h8v-2H4v2Zm-2-2a2 2 0 0 0 2 2v-2H2Zm16 1v9h2v-9h-2Zm3-3a3 3 0 0 0-3 3h2a1 1 0 0 1 1-1v-2Zm6 0h-6v2h6v-2Zm3 3a3 3 0 0 0-3-3v2a1 1 0 0 1 1 1h2Zm0 9v-9h-2v9h2Zm-3 3a3 3 0 0 0 3-3h-2a1 1 0 0 1-1 1v2Zm-6 0h6v-2h-6v2Zm-3-3a3 3 0 0 0 3 3v-2a1 1 0 0 1-1-1h-2Zm2-18V4h-2v5h2Zm0 0h-2a2 2 0 0 0 2 2V9Zm8 0h-8v2h8V9Zm0 0v2a2 2 0 0 0 2-2h-2Zm0-5v5h2V4h-2Zm0 0h2a2 2 0 0 0-2-2v2Zm-8 0h8V2h-8v2Zm0 0V2a2 2 0 0 0-2 2h2ZM2 25v3h2v-3H2Zm2-2a2 2 0 0 0-2 2h2v-2Zm9 0H4v2h9v-2Zm2 2a2 2 0 0 0-2-2v2h2Zm0 3v-3h-2v3h2Zm-2 2a2 2 0 0 0 2-2h-2v2Zm-9 0h9v-2H4v2Zm-2-2a2 2 0 0 0 2 2v-2H2Z"}))),wp.element.createElement("h2",{className:"mt-4  text-base text-slate-900 "},wp.element.createElement("a",{href:"https://squaresyncforwoo.com/documentation#import-data",target:"_blank"},wp.element.createElement("span",{className:"absolute -inset-px rounded-xl"}),"Controlling your import data")),wp.element.createElement("p",{className:"mt-1 text-sm text-slate-700 "},"Learn how the internals work and how you can choose which data you would like to sync."))),wp.element.createElement("div",{className:"group relative rounded-xl border border-slate-400 "},wp.element.createElement("div",{className:"absolute -inset-px rounded-xl border-2 border-transparent opacity-0 [background:linear-gradient(var(--quick-links-hover-bg,theme(colors.sky.50)),var(--quick-links-hover-bg,theme(colors.sky.50)))_padding-box,linear-gradient(to_top,theme(colors.sky.400),theme(colors.cyan.400),theme(colors.sky.500))_border-box] group-hover:opacity-100 "}),wp.element.createElement("div",{className:"relative overflow-hidden rounded-xl p-6"},wp.element.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 32 32",fill:"none",className:"h-8 w-8 [--icon-foreground:theme(colors.slate.900)] [--icon-background:theme(colors.white)]"},wp.element.createElement("defs",null,wp.element.createElement("radialGradient",{cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",id:":S4:-gradient",gradientTransform:"matrix(0 21 -21 0 12 11)"},wp.element.createElement("stop",{stopColor:"#0EA5E9"}),wp.element.createElement("stop",{stopColor:"#22D3EE",offset:".527"}),wp.element.createElement("stop",{stopColor:"#818CF8",offset:"1"})),wp.element.createElement("radialGradient",{cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",id:":S4:-gradient-dark",gradientTransform:"matrix(0 24.5 -24.5 0 16 5.5)"},wp.element.createElement("stop",{stopColor:"#0EA5E9"}),wp.element.createElement("stop",{stopColor:"#22D3EE",offset:".527"}),wp.element.createElement("stop",{stopColor:"#818CF8",offset:"1"}))),wp.element.createElement("g",{className:""},wp.element.createElement("circle",{cx:"12",cy:"20",r:"12",fill:"url(#:S4:-gradient)"}),wp.element.createElement("path",{d:"M27 12.13 19.87 5 13 11.87v14.26l14-14Z",className:"fill-[var(--icon-background)] stroke-[color:var(--icon-foreground)]",fillOpacity:"0.5",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),wp.element.createElement("path",{d:"M3 3h10v22a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V3Z",className:"fill-[var(--icon-background)]",fillOpacity:"0.5"}),wp.element.createElement("path",{d:"M3 9v16a4 4 0 0 0 4 4h2a4 4 0 0 0 4-4V9M3 9V3h10v6M3 9h10M3 15h10M3 21h10",className:"stroke-[color:var(--icon-foreground)]",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),wp.element.createElement("path",{d:"M29 29V19h-8.5L13 26c0 1.5-2.5 3-5 3h21Z",fillOpacity:"0.5",className:"fill-[var(--icon-background)] stroke-[color:var(--icon-foreground)]",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})),wp.element.createElement("g",{className:"hidden "},wp.element.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 2a1 1 0 0 0-1 1v21a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H3Zm16.752 3.293a1 1 0 0 0-1.593.244l-1.045 2A1 1 0 0 0 17 8v13a1 1 0 0 0 1.71.705l7.999-8.045a1 1 0 0 0-.002-1.412l-6.955-6.955ZM26 18a1 1 0 0 0-.707.293l-10 10A1 1 0 0 0 16 30h13a1 1 0 0 0 1-1V19a1 1 0 0 0-1-1h-3ZM5 18a1 1 0 1 0 0 2h6a1 1 0 1 0 0-2H5Zm-1-5a1 1 0 0 1 1-1h6a1 1 0 1 1 0 2H5a1 1 0 0 1-1-1Zm1-7a1 1 0 0 0 0 2h6a1 1 0 1 0 0-2H5Z",fill:"url(#:S4:-gradient-dark)"}))),wp.element.createElement("h2",{className:"mt-4  text-base text-slate-900 "},wp.element.createElement("a",{href:"/wp-admin/admin.php?page=squarewoosync#/settings/general"},wp.element.createElement("span",{className:"absolute -inset-px rounded-xl"}),"Settings")),wp.element.createElement("p",{className:"mt-1 text-sm text-slate-700 "},"Manage your access token, import data and webhook url for automatic synchronization"))))}const It=t.forwardRef((function({title:e,titleId:r,...n},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":r},n),e?t.createElement("title",{id:r},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 8.511c.884.284 1.5 1.128 1.5 2.097v4.286c0 1.136-.847 2.1-1.98 2.193-.34.027-.68.052-1.02.072v3.091l-3-3c-1.354 0-2.694-.055-4.02-.163a2.115 2.115 0 0 1-.825-.242m9.345-8.334a2.126 2.126 0 0 0-.476-.095 48.64 48.64 0 0 0-8.048 0c-1.131.094-1.976 1.057-1.976 2.192v4.286c0 .837.46 1.58 1.155 1.951m9.345-8.334V6.637c0-1.621-1.152-3.026-2.76-3.235A48.455 48.455 0 0 0 11.25 3c-2.115 0-4.198.137-6.24.402-1.608.209-2.76 1.614-2.76 3.235v6.226c0 1.621 1.152 3.026 2.76 3.235.577.075 1.157.14 1.74.194V21l4.155-4.155"}))})),At=t.forwardRef((function({title:e,titleId:r,...n},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":r},n),e?t.createElement("title",{id:r},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 12.75c1.148 0 2.278.08 3.383.237 1.037.146 1.866.966 1.866 2.013 0 3.728-2.35 6.75-5.25 6.75S6.75 18.728 6.75 15c0-1.046.83-1.867 1.866-2.013A24.204 24.204 0 0 1 12 12.75Zm0 0c2.883 0 5.647.508 8.207 1.44a23.91 23.91 0 0 1-1.152 6.06M12 12.75c-2.883 0-5.647.508-8.208 1.44.125 2.104.52 4.136 1.153 6.06M12 12.75a2.25 2.25 0 0 0 2.248-2.354M12 12.75a2.25 2.25 0 0 1-2.248-2.354M12 8.25c.995 0 1.971-.08 2.922-.236.403-.066.74-.358.795-.762a3.778 3.778 0 0 0-.399-2.25M12 8.25c-.995 0-1.97-.08-2.922-.236-.402-.066-.74-.358-.795-.762a3.734 3.734 0 0 1 .4-2.253M12 8.25a2.25 2.25 0 0 0-2.248 2.146M12 8.25a2.25 2.25 0 0 1 2.248 2.146M8.683 5a6.032 6.032 0 0 1-1.155-1.002c.07-.63.27-1.222.574-1.747m.581 2.749A3.75 3.75 0 0 1 15.318 5m0 0c.427-.283.815-.62 1.155-.999a4.471 4.471 0 0 0-.575-1.752M4.921 6a24.048 24.048 0 0 0-.392 3.314c1.668.546 3.416.914 5.223 1.082M19.08 6c.205 1.08.337 2.187.392 3.314a23.882 23.882 0 0 1-5.223 1.082"}))})),Tt=t.forwardRef((function({title:e,titleId:r,...n},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":r},n),e?t.createElement("title",{id:r},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 0 1-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0 1 15 18.257V17.25m6-12V15a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 15V5.25m18 0A2.25 2.25 0 0 0 18.75 3H5.25A2.25 2.25 0 0 0 3 5.25m18 0V12a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 12V5.25"}))}));function Ft(){return wp.element.createElement("div",{className:"isolate bg-white p-5 rounded-xl"},wp.element.createElement("div",{className:""},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900 "},"Support"),wp.element.createElement("p",{className:"leading-8 text-gray-600"})),wp.element.createElement("div",{className:"mt-3 space-y-4"},wp.element.createElement("div",{className:"flex gap-x-4"},wp.element.createElement("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-sky-600"},wp.element.createElement(It,{className:"h-6 w-6 text-white","aria-hidden":"true"})),wp.element.createElement("div",null,wp.element.createElement("h3",{className:"text-sm font-semibold  text-gray-900"},"Sales/License support"),wp.element.createElement("p",{className:"  text-gray-600"},"Wish to talk to us about your licence or have another questions related to sales?"),wp.element.createElement("p",{className:""},wp.element.createElement("a",{href:"https://squaresyncforwoo.com/my-account/support-portal/",target:"_blank",className:"text-sm font-semibold  text-sky-600"},"Contact us"," ",wp.element.createElement("span",{"aria-hidden":"true"},"→"))))),wp.element.createElement("div",{className:"flex gap-x-4"},wp.element.createElement("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-sky-600"},wp.element.createElement(At,{className:"h-6 w-6 text-white","aria-hidden":"true"})),wp.element.createElement("div",null,wp.element.createElement("h3",{className:"text-sm font-semibold  text-gray-900"},"Bug reports"),wp.element.createElement("p",{className:"  text-gray-600"},"Found a bug? Let us know so we can jump on it right away! And thank you for your help!"),wp.element.createElement("p",{className:""},wp.element.createElement("a",{href:"https://squaresyncforwoo.com/my-account/support-portal/",target:"_blank",className:"text-sm font-semibold leading-6 text-sky-600"},"Report a bug"," ",wp.element.createElement("span",{"aria-hidden":"true"},"→"))))),wp.element.createElement("div",{className:"flex gap-x-4"},wp.element.createElement("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-sky-600"},wp.element.createElement(Tt,{className:"h-6 w-6 text-white","aria-hidden":"true"})),wp.element.createElement("div",null,wp.element.createElement("h3",{className:"text-sm font-semibold  text-gray-900"},"Technical support"),wp.element.createElement("p",{className:"  text-gray-600"},"Can't figure out how to setup this plugin or having another technical issue? Let us know and we would be glad to assist you."),wp.element.createElement("p",{className:""},wp.element.createElement("a",{href:"https://squaresyncforwoo.com/#contact",target:"_blank",className:"text-sm font-semibold  text-sky-600"},"Contact us"," ",wp.element.createElement("span",{"aria-hidden":"true"},"→")))))))}const Mt=window.wp.apiFetch;var Dt=o.n(Mt);function Gt(e){return Gt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Gt(e)}function qt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Vt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?qt(Object(r),!0).forEach((function(t){Wt(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):qt(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Wt(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=Gt(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=Gt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Gt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Dt().use((function(e,t){return e.headers=Vt(Vt({},e.headers),{},{nonce:swsData.nonce}),t(e)}));const zt=Dt(),Bt=window.moment;var Ut=o.n(Bt);const Ht=t.forwardRef((function({title:e,titleId:r,...n},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":r},n),e?t.createElement("title",{id:r},e):null,t.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16Zm3.857-9.809a.75.75 0 0 0-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 1 0-1.06 1.061l2.5 2.5a.75.75 0 0 0 1.137-.089l4-5.5Z",clipRule:"evenodd"}))})),$t=t.forwardRef((function({title:e,titleId:r,...n},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":r},n),e?t.createElement("title",{id:r},e):null,t.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-8-5a.75.75 0 0 1 .75.75v4.5a.75.75 0 0 1-1.5 0v-4.5A.75.75 0 0 1 10 5Zm0 10a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z",clipRule:"evenodd"}))})),Zt=t.forwardRef((function({title:e,titleId:r,...n},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":r},n),e?t.createElement("title",{id:r},e):null,t.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-7-4a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM9 9a.75.75 0 0 0 0 1.5h.253a.25.25 0 0 1 .244.304l-.459 2.066A1.75 1.75 0 0 0 10.747 15H11a.75.75 0 0 0 0-1.5h-.253a.25.25 0 0 1-.244-.304l.459-2.066A1.75 1.75 0 0 0 9.253 9H9Z",clipRule:"evenodd"}))})),Yt=t.forwardRef((function({title:e,titleId:r,...n},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":r},n),e?t.createElement("title",{id:r},e):null,t.createElement("path",{fillRule:"evenodd",d:"M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))})),Kt=t.forwardRef((function({title:e,titleId:r,...n},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":r},n),e?t.createElement("title",{id:r},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5"}))}));function Xt(e){return Xt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Xt(e)}function Jt(){Jt=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var a=t&&t.prototype instanceof y?t:y,i=Object.create(a.prototype),l=new P(n||[]);return o(i,"_invoke",{value:O(e,r,l)}),i}function m(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,i,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,i)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,i,l){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Xt(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,i,l)}),(function(e){r("throw",e,i,l)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return r("throw",e,i,l)}))}l(c.arg)}var a;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,r,n){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=j(l,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=m(t,r,n);if("normal"===s.type){if(o=n.done?h:f,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=h,n.method="throw",n.arg=s.arg)}}}function j(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,j(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=m(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(Xt(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,l,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},k(S),s(S,c,"Generator"),s(S,i,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=_,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return l.type="throw",l.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],l=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:_(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function Qt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function er(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Qt(Object(r),!0).forEach((function(t){tr(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qt(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function tr(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=Xt(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=Xt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Xt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function rr(e,t,r,n,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,o)}function nr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return or(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?or(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function or(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const ar=function(){var t=nr((0,e.useState)([]),2),r=t[0],n=t[1],o=nr((0,e.useState)(null),2),a=(o[0],o[1]);(0,e.useEffect)((function(){var e=function(){var e=function(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){rr(a,n,o,i,l,"next",e)}function l(e){rr(a,n,o,i,l,"throw",e)}i(void 0)}))}}(Jt().mark((function e(){var t,r,o;return Jt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,zt({path:"/sws/v1/logs",method:"GET"});case 3:if(!((t=e.sent)instanceof Error||401===t.status)){e.next=7;break}return console.error("Error fetching logs:",t.message),e.abrupt("return");case 7:t.logs&&(r={},t.logs.forEach((function(e){var t=e.context;if(t&&t.parent_id){var n=t.parent_id;r[n]||(r[n]={children:[]}),r[n].children.push(e)}else{var o=t.process_id||e.id;r[o]?r[o]=er(er({},e),{},{children:r[o].children}):r[o]=er(er({},e),{},{children:[]})}})),o=Object.values(r).filter((function(e){return e.id})).map((function(e){return er(er({},e),{},{children:e.children.sort((function(e,t){return Ut()(t.timestamp).valueOf()-Ut()(e.timestamp).valueOf()}))})})).sort((function(e,t){return Ut()(t.timestamp).valueOf()-Ut()(e.timestamp).valueOf()})),n(o)),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(0),console.error("Failed to fetch logs:",e.t0);case 13:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(){return e.apply(this,arguments)}}();e();var t=setInterval(e,3e4);return a(t),function(){return clearInterval(t)}}),[]);var i=function(e){var t=e.log,n=e.isSummary,o=e.isChild;return wp.element.createElement("div",{className:"relative pb-4 ".concat(n?"flex justify-between items-center":"")},t.id===r[r.length-1].id||o?null:wp.element.createElement("span",{className:"absolute left-5 top-5 -ml-px h-full w-0.5 bg-gray-200","aria-hidden":"true"}),wp.element.createElement("div",{className:"flex items-start space-x-3 ".concat(o&&"ml-10")},wp.element.createElement("div",null,wp.element.createElement("div",{className:"relative px-1"},wp.element.createElement("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-gray-100 ring-8 ring-white"},"success"===t.log_level?wp.element.createElement(Ht,{className:"h-5 w-5 text-green-500","aria-hidden":"true"}):"error"===t.log_level||"failed"===t.log_level?wp.element.createElement($t,{className:"h-5 w-5 text-red-500","aria-hidden":"true"}):wp.element.createElement(Zt,{className:"h-5 w-5 text-blue-500","aria-hidden":"true"})))),wp.element.createElement("div",{className:"min-w-0 flex-1"},wp.element.createElement("p",{className:"text-sm text-gray-500 whitespace-nowrap"},Ut()(t.timestamp).format("MMM D h:mma")),wp.element.createElement("p",null,t.message)),n&&wp.element.createElement(Yt,{className:"h-5 w-5 text-gray-400"})))};return wp.element.createElement("div",{className:" bg-white rounded-xl p-5 w-full"},wp.element.createElement("h3",{className:"text-base font-semibold text-gray-900 mb-6 flex justify-start items-center gap-2"},wp.element.createElement(Kt,{className:"w-6 h-6"}),"Sync Feed",wp.element.createElement("span",{className:"text-xs text-gray-500 font-normal mt-[1px] -ml-1"}," ","- Shows last 1000 logs")),r.length<1&&wp.element.createElement("p",null,"No data, starting import/syncing to view logs"),wp.element.createElement("ul",{role:"list",className:"overflow-auto max-h-[1042px] h-auto overflow-y-auto"},r.map((function(e,t){return wp.element.createElement("li",{key:e.id||"parent-".concat(t)},e.children&&e.children.length>0?wp.element.createElement("details",{open:!0,className:"log-details"},wp.element.createElement("summary",{className:"list-none"},wp.element.createElement(i,{log:e,isChild:!1,isSummary:!0})),e.children.map((function(e){return wp.element.createElement(i,{key:e.id,log:e,isChild:!0})}))):wp.element.createElement(i,{log:e,isChild:!1}))}))))};var ir="squarewoosync";function lr(){var t=tt();return(0,e.useEffect)((function(){!function(){var e=jQuery,t=e("#toplevel_page_"+ir),r=window.location.href,n=r.substr(r.indexOf("admin.php"));e("ul.wp-submenu li",t).removeClass("current"),t.on("click","a",(function(){var r=e(this);e("ul.wp-submenu li",t).removeClass("current"),r.hasClass("wp-has-submenu")?e("li.wp-first-item",t).addClass("current"):r.parents("li").addClass("current")}));var o=n.split("/");e("ul.wp-submenu a",t).each((function(t,r){void 0!==o[1]&&o[1];var a=!1;e(r).attr("href")===n&&(a=!0),a&&e(r).parent().addClass("current")}))}()}),[t.pathname]),null}function cr(e){var t=e.cron;return wp.element.createElement("section",{className:" bg-white rounded-xl p-4 w-full"},wp.element.createElement("header",{className:"flex flex-col items-start justify-start gap-2 relative w-full"},wp.element.createElement("span",{className:"flex gap-2"},wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"#000",className:"w-6 h-6"},wp.element.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})),wp.element.createElement(_t,null)),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Automatic scheduler is ",t&&t.status?"on":"off"),t&&t.status?wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-green-500"}))):wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-red-500"})))),t&&t.status?wp.element.createElement("div",{className:"mt-2"},wp.element.createElement("p",{className:"text-gray-500 "},"The next automatic data sync to"," ",wp.element.createElement("span",{className:"text-sky-500"},t.direction)," will occur:"," ",wp.element.createElement("br",null),wp.element.createElement("span",{className:"text-sky-500"},t.next_run),t.time_until_next_run.length>0&&wp.element.createElement(React.Fragment,null,","," ",wp.element.createElement("span",{className:"text-sky-500"},"(",t.time_until_next_run,")"))),wp.element.createElement("p",{className:"mt-3 text-gray-500 "},"The following data will be synced:"),wp.element.createElement("p",{className:"mt-px text-gray-500 "},Object.keys(t.data_to_import).filter((function(e){return t.data_to_import[e]})).map((function(e,t,r){return wp.element.createElement("span",{key:e},wp.element.createElement("span",{className:"text-sky-500"},e),t!==r.length-1?", ":"")})))):wp.element.createElement("p",{className:"mt-2 text-gray-500 "},"Automatic scheduler is currently disabled."))}function sr(e){var t=e.wooAuto;return wp.element.createElement("section",{className:"bg-white rounded-xl p-4 w-full"},wp.element.createElement("header",{className:"flex flex-col items-between flex-start gap-2 relative w-full"},wp.element.createElement("span",{className:"flex gap-2"},wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-5 h-5"},wp.element.createElement("polyline",{points:"17 1 21 5 17 9"}),wp.element.createElement("path",{d:"M3 11V9a4 4 0 0 1 4-4h14"}),wp.element.createElement("polyline",{points:"7 23 3 19 7 15"}),wp.element.createElement("path",{d:"M21 13v2a4 4 0 0 1-4 4H3"})),wp.element.createElement(_t,null)),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Real-time automatic sync from Woo to Square is ",t&&t.isActive?"on":"off"),t&&t.isActive?wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-green-500"}))):wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-red-500"})))),t&&t.isActive?wp.element.createElement("div",{className:"mt-2"},wp.element.createElement("p",{className:"mt-2 text-gray-500 "},"The following data will be synced on new woocommerce orders:"),wp.element.createElement("p",{className:"mt-px text-gray-500 "},wp.element.createElement("span",{className:"text-sky-500"},"stock"))):wp.element.createElement("p",{className:"text-gray-500 mt-2"},"Real-time automatical sync is currently disabled."))}function ur(e){var t=e.squareAuto;return wp.element.createElement("section",{className:"bg-white rounded-xl p-4 w-full"},wp.element.createElement("header",{className:"flex flex-col items-between flex-start gap-2 relative w-full"},wp.element.createElement("span",{className:"flex gap-2"},wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-5 h-5"},wp.element.createElement("polyline",{points:"17 1 21 5 17 9"}),wp.element.createElement("path",{d:"M3 11V9a4 4 0 0 1 4-4h14"}),wp.element.createElement("polyline",{points:"7 23 3 19 7 15"}),wp.element.createElement("path",{d:"M21 13v2a4 4 0 0 1-4 4H3"})),wp.element.createElement(_t,null)),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Real-time automatic sync from Square to Woo is ",t&&t.isActive?"on":"off"),t&&t.isActive?wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-green-500"}))):wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-red-500"})))),t&&t.isActive?wp.element.createElement("div",{className:"mt-2"},wp.element.createElement("p",{className:"mt-3 text-gray-500 "},"The following data will be synced:"),wp.element.createElement("p",{className:"mt-px text-gray-500 "},Object.keys(t).filter((function(e){return("stock"===e||"title"===e||"description"===e||"sku"===e||"images"===e||"category"===e||"price"===e)&&!0===t[e]})).map((function(e,t,r){return wp.element.createElement("span",{key:e},wp.element.createElement("span",{className:"text-sky-500"},e),t!==r.length-1?", ":"")})))):wp.element.createElement("p",{className:"text-gray-500 mt-2"},"Real-time automatic sync from Square to Woocommerce is currently disabled."))}function mr(e){var t=e.wooAuto;return wp.element.createElement("section",{className:"bg-white rounded-xl p-4 w-full"},wp.element.createElement("header",{className:"flex flex-col items-between flex-start gap-2 relative w-full"},wp.element.createElement("span",{className:"flex gap-2"},wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-5 h-5 text-black"},wp.element.createElement("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),wp.element.createElement("line",{x1:"12",y1:"8",x2:"12",y2:"16"}),wp.element.createElement("line",{x1:"8",y1:"12",x2:"16",y2:"12"})),wp.element.createElement(_t,null)),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Auto product creation is ",null!=t&&t.autoCreateProduct||null!=t&&t.autoWooCreation?"on":"off"),null!=t&&t.autoCreateProduct||null!=t&&t.autoWooCreation?wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-green-500"}))):wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-red-500"})))),wp.element.createElement("div",{className:"mt-2"},wp.element.createElement("p",{className:"mt-3 text-gray-500"},t&&t.autoCreateProduct&&t.autoWooCreation?"Products are being automatically created both ways between WooCommerce and Square.":t&&t.autoCreateProduct?"When a new product is created in WooCommerce, it will automatically be created in Square.":t&&t.autoWooCreation?"When a new product is created in Square, it will automatically be created in WooCommerce.":"Auto product creation is currently disabled."),!(null!=t&&t.autoCreateProduct)&&!(null!=t&&t.autoWooCreation)&&wp.element.createElement("p",{className:"text-gray-500"})))}function pr(e){var t=e.orders,r=e.gatewaySettings;return wp.element.createElement("section",{className:"bg-white rounded-xl p-4 w-full"},wp.element.createElement("header",{className:"flex flex-col items-between flex-start gap-2 relative w-full text-black"},wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-5 h-5 text-black"},wp.element.createElement("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),wp.element.createElement("path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"})),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Auto sync of orders, transactions and customers is ",t&&t.enabled||r&&"yes"===r.enabled?"on":"off"),t&&t.enabled||r&&"yes"===r.enabled?wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-green-500"}))):wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-red-500"})))),t&&t.enabled||r&&"yes"===r.enabled?wp.element.createElement("div",{className:"mt-2"},wp.element.createElement("p",{className:"mt-3 text-gray-500 "},"When a new order is created with a status of ",wp.element.createElement("span",{className:"text-sky-500"},'"',t.stage,'"'),", a corresponding order, transaction and customer will be created in Square.")):wp.element.createElement("p",{className:"text-gray-500 mt-2"},"Auto orders, transactions and customer sync to Square is currently disabled. To enable, to go the order settings ",wp.element.createElement(jt,{to:"/settings/orders",className:"text-sky-500"},"here"),"."))}const fr=t.forwardRef((function({title:e,titleId:r,...n},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":r},n),e?t.createElement("title",{id:r},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19.128a9.38 9.38 0 0 0 2.625.372 9.337 9.337 0 0 0 4.121-.952 4.125 4.125 0 0 0-7.533-2.493M15 19.128v-.003c0-1.113-.285-2.16-.786-3.07M15 19.128v.106A12.318 12.318 0 0 1 8.624 21c-2.331 0-4.512-.645-6.374-1.766l-.001-.109a6.375 6.375 0 0 1 11.964-3.07M12 6.375a3.375 3.375 0 1 1-6.75 0 3.375 3.375 0 0 1 6.75 0Zm8.25 2.25a2.625 2.625 0 1 1-5.25 0 2.625 2.625 0 0 1 5.25 0Z"}))}));function dr(e){var t=e.squareWoo;return wp.element.createElement("section",{className:"bg-white rounded-xl p-4 w-full"},wp.element.createElement("header",{className:"flex flex-col items-between flex-start gap-2 relative w-full"},wp.element.createElement("div",{className:"flex gap-2 items-center"},wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-5 h-5"},wp.element.createElement("polyline",{points:"17 1 21 5 17 9"}),wp.element.createElement("path",{d:"M3 11V9a4 4 0 0 1 4-4h14"}),wp.element.createElement("polyline",{points:"7 23 3 19 7 15"}),wp.element.createElement("path",{d:"M21 13v2a4 4 0 0 1-4 4H3"})),wp.element.createElement(fr,{className:"w-5 h-5"}),wp.element.createElement(_t,null)),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Customer real-time automatic sync from Square to Woo is ",t&&t.is_active?"on":"off"),t&&t.is_active?wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-green-500"}))):wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-red-500"})))),t&&t.is_active?wp.element.createElement("div",{className:"mt-2"},wp.element.createElement("p",{className:"mt-3 text-gray-500 "},"The following data will be synced:"),wp.element.createElement("p",{className:"mt-px text-gray-500 "},Object.keys(t).filter((function(e){return("first_name"===e||"last_name"===e||"phone"===e||"role"===e||"address"===e)&&!0===t[e]})).map((function(e,t,r){return wp.element.createElement("span",{key:e},wp.element.createElement("span",{className:"text-sky-500"},e.replace("_"," ")),t!==r.length-1?", ":"")})))):wp.element.createElement("p",{className:"text-gray-500 mt-2"},"Real-time automatic sync of customers from Square to Woocommerce is currently disabled."))}function hr(e){var t=e.wooSquare;return wp.element.createElement("section",{className:"bg-white rounded-xl p-4 w-full"},wp.element.createElement("header",{className:"flex flex-col items-between flex-start gap-2 relative w-full"},wp.element.createElement("div",{className:"flex gap-2 items-center"},wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-5 h-5"},wp.element.createElement("polyline",{points:"17 1 21 5 17 9"}),wp.element.createElement("path",{d:"M3 11V9a4 4 0 0 1 4-4h14"}),wp.element.createElement("polyline",{points:"7 23 3 19 7 15"}),wp.element.createElement("path",{d:"M21 13v2a4 4 0 0 1-4 4H3"})),wp.element.createElement(fr,{className:"w-5 h-5"}),wp.element.createElement(_t,null)),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Customer real-time automatic sync from Woo to Square is ",t&&t.is_active?"on":"off"),t&&t.is_active?wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-green-500"}))):wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-red-500"})))),t&&t.is_active?wp.element.createElement("div",{className:"mt-2"},wp.element.createElement("p",{className:"mt-3 text-gray-500 "},"The following data will be synced:"),wp.element.createElement("p",{className:"mt-px text-gray-500 "},Object.keys(t).filter((function(e){return("first_name"===e||"last_name"===e||"phone"===e||"role"===e||"address"===e)&&!0===t[e]})).map((function(e,t,r){return wp.element.createElement("span",{key:e},wp.element.createElement("span",{className:"text-sky-500"},e.replace("_"," ")),t!==r.length-1?", ":"")})))):wp.element.createElement("p",{className:"text-gray-500 mt-2"},"Real-time automatic sync of customers from Square to Woocommerce is currently disabled."))}const gr=t.forwardRef((function({title:e,titleId:r,...n},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":r},n),e?t.createElement("title",{id:r},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"}))}));function yr(e){var t=e.wooAuto,r=e.squareAuto;return wp.element.createElement("section",{className:"bg-white rounded-xl p-4 w-full"},wp.element.createElement("header",{className:"flex flex-col items-between flex-start gap-2 relative w-full"},wp.element.createElement("span",{className:"flex gap-2"},wp.element.createElement(gr,{className:"w-5"}),wp.element.createElement(_t,null)),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Real-time automatic delete/archive is ",t&&t.autoDeleteProduct||r&&r.autoDeleteProduct?"on":"off"),t&&t.autoDeleteProduct||r&&r.autoDeleteProduct?wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-green-500"}))):wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-red-500"})))),t&&t.autoDeleteProduct||r&&r.autoDeleteProduct?wp.element.createElement("div",{className:"mt-2"},wp.element.createElement("p",{className:"mt-2 text-gray-500 "},"When a product is deleted/archived in ",t.autoDeleteProduct?"WooCommerce":"Square",", it will also be deleted/archived in ",t.autoDeleteProduct?"Square":"WooCommerce")):wp.element.createElement("p",{className:"text-gray-500 mt-2"},"Real-time automatic sync is currently disabled."))}function vr(e){return vr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vr(e)}function wr(){wr=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var a=t&&t.prototype instanceof y?t:y,i=Object.create(a.prototype),l=new P(n||[]);return o(i,"_invoke",{value:O(e,r,l)}),i}function m(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,i,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,i)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,i,l){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==vr(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,i,l)}),(function(e){r("throw",e,i,l)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return r("throw",e,i,l)}))}l(c.arg)}var a;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,r,n){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=j(l,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=m(t,r,n);if("normal"===s.type){if(o=n.done?h:f,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=h,n.method="throw",n.arg=s.arg)}}}function j(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,j(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=m(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(vr(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,l,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},k(S),s(S,c,"Generator"),s(S,i,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=_,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return l.type="throw",l.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],l=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:_(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function br(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function xr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?br(Object(r),!0).forEach((function(t){Er(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):br(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Er(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=vr(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=vr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==vr(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Sr(e,t,r,n,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,o)}function kr(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var Nr=(0,e.createContext)(),Or=function(t){var r=t.children,n=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return kr(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?kr(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)({status:!1,next_run:"Hourly",data_to_import:{stock:!0,title:!0,sku:!0,price:!0,description:!0},direction:"WooCommerce",time_until_next_run:"in 31 mins"}),2),o=n[0],a=n[1];return(0,e.useEffect)((function(){var e=function(){var e=function(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){Sr(a,n,o,i,l,"next",e)}function l(e){Sr(a,n,o,i,l,"throw",e)}i(void 0)}))}}(wr().mark((function e(){return wr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Dt()({path:"/sws/v1/settings/get-cron",method:"GET"}).then((function(e){a(xr(xr({},o),e))}));case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();e()}),[]),wp.element.createElement(Nr.Provider,{value:{cron:o,setCron:a}},r)};function jr(e){return jr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},jr(e)}function Cr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Lr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Cr(Object(r),!0).forEach((function(t){Pr(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Cr(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Pr(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=jr(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=jr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==jr(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _r(){_r=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var a=t&&t.prototype instanceof y?t:y,i=Object.create(a.prototype),l=new P(n||[]);return o(i,"_invoke",{value:O(e,r,l)}),i}function m(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,i,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,i)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,i,l){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==jr(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,i,l)}),(function(e){r("throw",e,i,l)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return r("throw",e,i,l)}))}l(c.arg)}var a;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,r,n){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=j(l,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=m(t,r,n);if("normal"===s.type){if(o=n.done?h:f,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=h,n.method="throw",n.arg=s.arg)}}}function j(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,j(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=m(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(jr(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,l,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},k(S),s(S,c,"Generator"),s(S,i,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=_,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return l.type="throw",l.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],l=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:_(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function Rr(e,t,r,n,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,o)}function Ir(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){Rr(a,n,o,i,l,"next",e)}function l(e){Rr(a,n,o,i,l,"throw",e)}i(void 0)}))}}function Ar(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Tr(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Tr(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Tr(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var Fr=(0,t.createContext)(),Mr=function(e){var r=e.children,n=Ar((0,t.useState)([]),2),o=n[0],a=n[1],i=Ar((0,t.useState)(!0),2),l=i[0],c=i[1],s=Ar((0,t.useState)(!0),2),u=s[0],m=s[1],p=Ar((0,t.useState)({environment:"live",location:"",modifierSyncing:!0,importCategoryType:"categories",iventory:{isFetching:0},squareAuto:{isActive:!1,stock:!0,sku:!0,title:!0,description:!0,images:!0,price:!0,category:!0,attributesDisabled:!1},wooAuto:{autoCreateProduct:!1,autoWooCreation:!1,isActive:!1,stock:!1,sku:!0,title:!1,description:!1,images:!1,category:!1,price:!1,allLocationsStock:!1},orders:{enabled:!1,transactions:!1,stage:"processing",pickupMethod:"local_pickup",deliveryMethod:"",statusSync:!1,statusSyncWooToSquare:!1,orderImport:!1,orderImportAllLocations:!1,orderable:!1,orderable_location_mapping:{}},cron:{enabled:!1,source:"square",schedule:"hourly",batches:30,data_to_import:{stock:!1,sku:!1,title:!1,description:!1,images:!1,category:!1,price:!1}},customers:{isFetching:0,roleMappings:[],filters:{group:0,segment:0},auto:{squareWoo:{is_active:!1,first_name:!1,last_name:!1,phone:!1,role:!1,address:!1},wooSquare:{is_active:!1,first_name:!1,last_name:!1,phone:!1,role:!1,address:!1}}},loyalty:{enabled:!1,program:null,method:"square",redemptionMethod:"square",redeem:!1},performance:{rateLimiting:!1,rateLimitThreshold:30,rateLimitTimeWindow:60,delayRequests:!1,delayLength:30},accessToken:null,sandboxToken:null,exportStatus:0,exportSynced:1,exportResults:null}),2),f=p[0],d=p[1];(0,t.useEffect)((function(){var e=function(){var e=Ir(_r().mark((function e(){var t;return _r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("fetch"),c(!0),e.prev=2,e.next=5,Dt()({path:"/sws/v1/settings/orderable-locations",method:"GET"});case 5:t=e.sent,a(t),c(!1),e.next=14;break;case 10:e.prev=10,e.t0=e.catch(2),F.error("Failed to get orderable locations: ".concat(e.t0.message),{autoClose:!1,closeOnClick:!0}),c(!1);case 14:case"end":return e.stop()}}),e,null,[[2,10]])})));return function(){return e.apply(this,arguments)}}();e()}),[]),(0,t.useEffect)((function(){var e=function(){var e=Ir(_r().mark((function e(){var t;return _r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Dt()({path:"/sws/v1/settings",method:"GET"});case 3:t=e.sent,d((function(e){return Lr(Lr({},e),t)})),m(!1),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(0),m(!1),F({render:"Failed to update settings: "+e.t0.message,type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0});case 12:case"end":return e.stop()}}),e,null,[[0,8]])})));return function(){return e.apply(this,arguments)}}();e()}),[]);var h=function(){var e=Ir(_r().mark((function e(t,r){var n,o;return _r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=F.loading("Updating setting: ".concat(t)),e.prev=1,e.next=4,Dt()({path:"/sws/v1/settings",method:"POST",data:Pr({},t,r)});case 4:(o=e.sent)&&(F.update(n,{render:"".concat(t," updated successfully"),type:"success",isLoading:!1,autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),d((function(e){return Lr(Lr({},e),o)}))),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),F.update(n,{render:"Failed to update ".concat(t,": ").concat(e.t0.message),type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0});case 11:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(_x,t){return e.apply(this,arguments)}}(),g=function(){var e=Ir(_r().mark((function e(){var t,r=arguments;return _r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(r.length>0&&void 0!==r[0]?r[0]:{}).silent,e.prev=1,e.next=4,Dt()({path:"/sws/v1/settings/access-token",method:"GET"});case 4:200===(t=e.sent).status&&d((function(e){return Lr(Lr({},e),{},{accessToken:t.access_token})})),e.next=12;break;case 8:throw e.prev=8,e.t0=e.catch(1),F.error("Failed to retrieve access token: ".concat(e.t0.message)),e.t0;case 12:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(){return e.apply(this,arguments)}}();(0,t.useEffect)((function(){g()}),[]);var y=function(){var e=Ir(_r().mark((function e(t){var r,n;return _r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=F.loading("Updating access token"),e.prev=1,e.next=4,Dt()({path:"/sws/v1/settings/access-token",method:"POST",data:{access_token:t}});case 4:if(200!==(n=e.sent).status){e.next=10;break}d((function(e){return Lr(Lr({},e),{},{accessToken:t})})),F.update(r,{render:"Access token updated successfully",type:"success",isLoading:!1,autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),e.next=11;break;case 10:throw new Error(n.message);case 11:e.next=16;break;case 13:e.prev=13,e.t0=e.catch(1),F.update(r,{render:"Failed to update access token: ".concat(e.t0.message),type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0});case 16:case"end":return e.stop()}}),e,null,[[1,13]])})));return function(t){return e.apply(this,arguments)}}(),v=function(){var e=Ir(_r().mark((function e(){var t;return _r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=F.loading("Removing access token"),e.prev=1,e.next=4,Dt()({path:"/sws/v1/settings/access-token",method:"DELETE"});case 4:d((function(e){return Lr(Lr({},e),{},{accessToken:null})})),F.update(t,{render:"Access token removed successfully",type:"success",isLoading:!1,autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),F.update(t,{render:"Failed to remove access token: ".concat(e.t0.message),type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0});case 11:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(){return e.apply(this,arguments)}}(),w=function(){var e=Ir(_r().mark((function e(t){var r,n;return _r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=F.loading("Updating sandbox access token"),e.prev=1,e.next=4,Dt()({path:"/sws/v1/settings/access-token-sandbox",method:"POST",data:{access_token:t}});case 4:if(200!==(n=e.sent).status){e.next=10;break}d((function(e){return Lr(Lr({},e),{},{sandboxToken:t})})),F.update(r,{render:"Sandbox access token updated successfully",type:"success",isLoading:!1,autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),e.next=11;break;case 10:throw new Error(n.message);case 11:e.next=16;break;case 13:e.prev=13,e.t0=e.catch(1),F.update(r,{render:"Failed to update access token: ".concat(e.t0.message),type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0});case 16:case"end":return e.stop()}}),e,null,[[1,13]])})));return function(t){return e.apply(this,arguments)}}(),b=function(){var e=Ir(_r().mark((function e(){var t;return _r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=F.loading("Removing sandbox access token"),e.prev=1,e.next=4,Dt()({path:"/sws/v1/settings/access-token-sandbox",method:"DELETE"});case 4:d((function(e){return Lr(Lr({},e),{},{sandboxToken:null})})),F.update(t,{render:"Sandbox access token removed successfully",type:"success",isLoading:!1,autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),F.update(t,{render:"Failed to remove sandbox access token: ".concat(e.t0.message),type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0});case 11:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(){return e.apply(this,arguments)}}(),x=Ar((0,t.useState)(),2),E=x[0],S=x[1],k=Ar((0,t.useState)(!0),2),N=k[0],O=k[1];(0,t.useEffect)((function(){var e=function(){var e=Ir(_r().mark((function e(){return _r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Dt()({path:"/sws/v1/settings/get-gateway-settings",method:"GET"}).then((function(e){S((function(t){return Lr(Lr({},t),e)})),O(!1)})).catch((function(e){O(!1),F({render:"Failed to update settings: "+e.message,type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0})}));case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();e()}),[]);var j=Ar((0,t.useState)([]),2),C=j[0],L=j[1],P=Ar((0,t.useState)(!0),2),_=P[0],R=P[1];return(0,t.useEffect)((function(){R(!0);var e=function(){var e=Ir(_r().mark((function e(){return _r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Dt()({path:"/sws/v1/settings/get-shipping-methods",method:"GET"}).then((function(e){L(e),R(!1)})).catch((function(e){F({render:"Failed to get shipping methods: "+e.message,type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0}),R(!1)}));case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();e()}),[]),wp.element.createElement(Fr.Provider,{value:{settings:f,updateSettings:h,settingsLoading:u,getAccessToken:g,updateSandboxToken:w,removeSandboxToken:b,updateAccessToken:y,removeAccessToken:v,gatewaySettings:E,gatewayLoading:N,shippingMethods:C,shippingMethodsLoading:_,orderableLocations:o,orderableLocationsLoading:l}},r)},Dr=function(){return(0,t.useContext)(Fr)};const Gr=function(){var e,t,r,n,o=Dr(),a=o.settings,i=o.gatewaySettings,l=o.gatewayLoading;return wp.element.createElement("div",{className:"col-span-full grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 items-stretch gap-6"},wp.element.createElement(pr,{orders:a.orders,gatewaySettings:i,gatewayLoading:l}),wp.element.createElement(sr,{wooAuto:a.wooAuto}),wp.element.createElement(ur,{squareAuto:a.squareAuto}),wp.element.createElement(cr,null),wp.element.createElement(mr,{wooAuto:a.wooAuto}),wp.element.createElement(yr,{wooAuto:a.wooAuto,squareAuto:a.squareAuto}),wp.element.createElement(dr,{squareWoo:null!==(e=null===(t=a.customers)||void 0===t||null===(t=t.auto)||void 0===t?void 0:t.squareWoo)&&void 0!==e?e:{is_active:!1,first_name:!1,last_name:!1,phone:!1,role:!1,address:!1}}),wp.element.createElement(hr,{wooSquare:null!==(r=null===(n=a.customers)||void 0===n||null===(n=n.auto)||void 0===n?void 0:n.wooSquare)&&void 0!==r?r:{is_active:!1,first_name:!1,last_name:!1,phone:!1,role:!1,address:!1}}))};function qr(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];throw Error("[Immer] minified error nr: "+e+(r.length?" "+r.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function Vr(e){return!!e&&!!e[Cn]}function Wr(e){var t;return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return r===Object||"function"==typeof r&&Function.toString.call(r)===Ln}(e)||Array.isArray(e)||!!e[jn]||!!(null===(t=e.constructor)||void 0===t?void 0:t[jn])||Zr(e)||Yr(e))}function zr(e,t,r){void 0===r&&(r=!1),0===Br(e)?(r?Object.keys:Pn)(e).forEach((function(n){r&&"symbol"==typeof n||t(n,e[n],e)})):e.forEach((function(r,n){return t(n,r,e)}))}function Br(e){var t=e[Cn];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:Zr(e)?2:Yr(e)?3:0}function Ur(e,t){return 2===Br(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Hr(e,t,r){var n=Br(e);2===n?e.set(t,r):3===n?e.add(r):e[t]=r}function $r(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function Zr(e){return Sn&&e instanceof Map}function Yr(e){return kn&&e instanceof Set}function Kr(e){return e.o||e.t}function Xr(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Rn(e);delete t[Cn];for(var r=Pn(t),n=0;n<r.length;n++){var o=r[n],a=t[o];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[o]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[o]})}return Object.create(Object.getPrototypeOf(e),t)}function Jr(e,t){return void 0===t&&(t=!1),en(e)||Vr(e)||!Wr(e)||(Br(e)>1&&(e.set=e.add=e.clear=e.delete=Qr),Object.freeze(e),t&&zr(e,(function(e,t){return Jr(t,!0)}),!0)),e}function Qr(){qr(2)}function en(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function tn(e){var t=In[e];return t||qr(18,e),t}function rn(){return xn}function nn(e,t){t&&(tn("Patches"),e.u=[],e.s=[],e.v=t)}function on(e){an(e),e.p.forEach(cn),e.p=null}function an(e){e===xn&&(xn=e.l)}function ln(e){return xn={p:[],l:xn,h:e,m:!0,_:0}}function cn(e){var t=e[Cn];0===t.i||1===t.i?t.j():t.g=!0}function sn(e,t){t._=t.p.length;var r=t.p[0],n=void 0!==e&&e!==r;return t.h.O||tn("ES5").S(t,e,n),n?(r[Cn].P&&(on(t),qr(4)),Wr(e)&&(e=un(t,e),t.l||pn(t,e)),t.u&&tn("Patches").M(r[Cn].t,e,t.u,t.s)):e=un(t,r,[]),on(t),t.u&&t.v(t.u,t.s),e!==On?e:void 0}function un(e,t,r){if(en(t))return t;var n=t[Cn];if(!n)return zr(t,(function(o,a){return mn(e,n,t,o,a,r)}),!0),t;if(n.A!==e)return t;if(!n.P)return pn(e,n.t,!0),n.t;if(!n.I){n.I=!0,n.A._--;var o=4===n.i||5===n.i?n.o=Xr(n.k):n.o,a=o,i=!1;3===n.i&&(a=new Set(o),o.clear(),i=!0),zr(a,(function(t,a){return mn(e,n,o,t,a,r,i)})),pn(e,o,!1),r&&e.u&&tn("Patches").N(n,r,e.u,e.s)}return n.o}function mn(e,t,r,n,o,a,i){if(Vr(o)){var l=un(e,o,a&&t&&3!==t.i&&!Ur(t.R,n)?a.concat(n):void 0);if(Hr(r,n,l),!Vr(l))return;e.m=!1}else i&&r.add(o);if(Wr(o)&&!en(o)){if(!e.h.D&&e._<1)return;un(e,o),t&&t.A.l||pn(e,o)}}function pn(e,t,r){void 0===r&&(r=!1),!e.l&&e.h.D&&e.m&&Jr(t,r)}function fn(e,t){var r=e[Cn];return(r?Kr(r):e)[t]}function dn(e,t){if(t in e)for(var r=Object.getPrototypeOf(e);r;){var n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Object.getPrototypeOf(r)}}function hn(e){e.P||(e.P=!0,e.l&&hn(e.l))}function gn(e){e.o||(e.o=Xr(e.t))}function yn(e,t,r){var n=Zr(t)?tn("MapSet").F(t,r):Yr(t)?tn("MapSet").T(t,r):e.O?function(e,t){var r=Array.isArray(e),n={i:r?1:0,A:t?t.A:rn(),P:!1,I:!1,R:{},l:t,t:e,k:null,o:null,j:null,C:!1},o=n,a=An;r&&(o=[n],a=Tn);var i=Proxy.revocable(o,a),l=i.revoke,c=i.proxy;return n.k=c,n.j=l,c}(t,r):tn("ES5").J(t,r);return(r?r.A:rn()).p.push(n),n}function vn(e){return Vr(e)||qr(22,e),function e(t){if(!Wr(t))return t;var r,n=t[Cn],o=Br(t);if(n){if(!n.P&&(n.i<4||!tn("ES5").K(n)))return n.t;n.I=!0,r=wn(t,o),n.I=!1}else r=wn(t,o);return zr(r,(function(t,o){n&&function(e,t){return 2===Br(e)?e.get(t):e[t]}(n.t,t)===o||Hr(r,t,e(o))})),3===o?new Set(r):r}(e)}function wn(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return Xr(e)}var bn,xn,En="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),Sn="undefined"!=typeof Map,kn="undefined"!=typeof Set,Nn="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,On=En?Symbol.for("immer-nothing"):((bn={})["immer-nothing"]=!0,bn),jn=En?Symbol.for("immer-draftable"):"__$immer_draftable",Cn=En?Symbol.for("immer-state"):"__$immer_state",Ln=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),Pn="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Rn=Object.getOwnPropertyDescriptors||function(e){var t={};return Pn(e).forEach((function(r){t[r]=Object.getOwnPropertyDescriptor(e,r)})),t},In={},An={get:function(e,t){if(t===Cn)return e;var r=Kr(e);if(!Ur(r,t))return function(e,t,r){var n,o=dn(t,r);return o?"value"in o?o.value:null===(n=o.get)||void 0===n?void 0:n.call(e.k):void 0}(e,r,t);var n=r[t];return e.I||!Wr(n)?n:n===fn(e.t,t)?(gn(e),e.o[t]=yn(e.A.h,n,e)):n},has:function(e,t){return t in Kr(e)},ownKeys:function(e){return Reflect.ownKeys(Kr(e))},set:function(e,t,r){var n=dn(Kr(e),t);if(null==n?void 0:n.set)return n.set.call(e.k,r),!0;if(!e.P){var o=fn(Kr(e),t),a=null==o?void 0:o[Cn];if(a&&a.t===r)return e.o[t]=r,e.R[t]=!1,!0;if($r(r,o)&&(void 0!==r||Ur(e.t,t)))return!0;gn(e),hn(e)}return e.o[t]===r&&(void 0!==r||t in e.o)||Number.isNaN(r)&&Number.isNaN(e.o[t])||(e.o[t]=r,e.R[t]=!0),!0},deleteProperty:function(e,t){return void 0!==fn(e.t,t)||t in e.t?(e.R[t]=!1,gn(e),hn(e)):delete e.R[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var r=Kr(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:n.enumerable,value:r[t]}:n},defineProperty:function(){qr(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){qr(12)}},Tn={};zr(An,(function(e,t){Tn[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Tn.deleteProperty=function(e,t){return Tn.set.call(this,e,t,void 0)},Tn.set=function(e,t,r){return An.set.call(this,e[0],t,r,e[0])};var Fn=function(){function e(e){var t=this;this.O=Nn,this.D=!0,this.produce=function(e,r,n){if("function"==typeof e&&"function"!=typeof r){var o=r;r=e;var a=t;return function(e){var t=this;void 0===e&&(e=o);for(var n=arguments.length,i=Array(n>1?n-1:0),l=1;l<n;l++)i[l-1]=arguments[l];return a.produce(e,(function(e){var n;return(n=r).call.apply(n,[t,e].concat(i))}))}}var i;if("function"!=typeof r&&qr(6),void 0!==n&&"function"!=typeof n&&qr(7),Wr(e)){var l=ln(t),c=yn(t,e,void 0),s=!0;try{i=r(c),s=!1}finally{s?on(l):an(l)}return"undefined"!=typeof Promise&&i instanceof Promise?i.then((function(e){return nn(l,n),sn(e,l)}),(function(e){throw on(l),e})):(nn(l,n),sn(i,l))}if(!e||"object"!=typeof e){if(void 0===(i=r(e))&&(i=e),i===On&&(i=void 0),t.D&&Jr(i,!0),n){var u=[],m=[];tn("Patches").M(e,i,u,m),n(u,m)}return i}qr(21,e)},this.produceWithPatches=function(e,r){if("function"==typeof e)return function(r){for(var n=arguments.length,o=Array(n>1?n-1:0),a=1;a<n;a++)o[a-1]=arguments[a];return t.produceWithPatches(r,(function(t){return e.apply(void 0,[t].concat(o))}))};var n,o,a=t.produce(e,r,(function(e,t){n=e,o=t}));return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(e){return[e,n,o]})):[a,n,o]},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){Wr(e)||qr(8),Vr(e)&&(e=vn(e));var t=ln(this),r=yn(this,e,void 0);return r[Cn].C=!0,an(t),r},t.finishDraft=function(e,t){var r=(e&&e[Cn]).A;return nn(r,t),sn(void 0,r)},t.setAutoFreeze=function(e){this.D=e},t.setUseProxies=function(e){e&&!Nn&&qr(20),this.O=e},t.applyPatches=function(e,t){var r;for(r=t.length-1;r>=0;r--){var n=t[r];if(0===n.path.length&&"replace"===n.op){e=n.value;break}}r>-1&&(t=t.slice(r+1));var o=tn("Patches").$;return Vr(e)?o(e,t):this.produce(e,(function(e){return o(e,t)}))},e}(),Mn=new Fn,Dn=Mn.produce;Mn.produceWithPatches.bind(Mn),Mn.setAutoFreeze.bind(Mn),Mn.setUseProxies.bind(Mn),Mn.applyPatches.bind(Mn),Mn.createDraft.bind(Mn),Mn.finishDraft.bind(Mn);const Gn=Dn;function qn(e){return qn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},qn(e)}function Vn(e){var t=function(e,t){if("object"!=qn(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=qn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==qn(t)?t:String(t)}function Wn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function zn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Wn(Object(r),!0).forEach((function(t){var n,o,a;n=e,o=t,a=r[t],(o=Vn(o))in n?Object.defineProperty(n,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[o]=a})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Wn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Bn(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var Un="function"==typeof Symbol&&Symbol.observable||"@@observable",Hn=function(){return Math.random().toString(36).substring(7).split("").join(".")},$n={INIT:"@@redux/INIT"+Hn(),REPLACE:"@@redux/REPLACE"+Hn(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Hn()}};function Zn(e,t,r){var n;if("function"==typeof t&&"function"==typeof r||"function"==typeof r&&"function"==typeof arguments[3])throw new Error(Bn(0));if("function"==typeof t&&void 0===r&&(r=t,t=void 0),void 0!==r){if("function"!=typeof r)throw new Error(Bn(1));return r(Zn)(e,t)}if("function"!=typeof e)throw new Error(Bn(2));var o=e,a=t,i=[],l=i,c=!1;function s(){l===i&&(l=i.slice())}function u(){if(c)throw new Error(Bn(3));return a}function m(e){if("function"!=typeof e)throw new Error(Bn(4));if(c)throw new Error(Bn(5));var t=!0;return s(),l.push(e),function(){if(t){if(c)throw new Error(Bn(6));t=!1,s();var r=l.indexOf(e);l.splice(r,1),i=null}}}function p(e){if(!function(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(e))throw new Error(Bn(7));if(void 0===e.type)throw new Error(Bn(8));if(c)throw new Error(Bn(9));try{c=!0,a=o(a,e)}finally{c=!1}for(var t=i=l,r=0;r<t.length;r++)(0,t[r])();return e}return p({type:$n.INIT}),(n={dispatch:p,subscribe:m,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw new Error(Bn(10));o=e,p({type:$n.REPLACE})}})[Un]=function(){var e,t=m;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(Bn(11));function r(){e.next&&e.next(u())}return r(),{unsubscribe:t(r)}}})[Un]=function(){return this},e},n}function Yn(e){for(var t=Object.keys(e),r={},n=0;n<t.length;n++){var o=t[n];"function"==typeof e[o]&&(r[o]=e[o])}var a,i=Object.keys(r);try{!function(e){Object.keys(e).forEach((function(t){var r=e[t];if(void 0===r(void 0,{type:$n.INIT}))throw new Error(Bn(12));if(void 0===r(void 0,{type:$n.PROBE_UNKNOWN_ACTION()}))throw new Error(Bn(13))}))}(r)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var n=!1,o={},l=0;l<i.length;l++){var c=i[l],s=r[c],u=e[c],m=s(u,t);if(void 0===m)throw t&&t.type,new Error(Bn(14));o[c]=m,n=n||m!==u}return(n=n||i.length!==Object.keys(e).length)?o:e}}function Kn(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}function Xn(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){return function(){var r=e.apply(void 0,arguments),n=function(){throw new Error(Bn(15))},o={getState:r.getState,dispatch:function(){return n.apply(void 0,arguments)}},a=t.map((function(e){return e(o)}));return n=Kn.apply(void 0,a)(r.dispatch),zn(zn({},r),{},{dispatch:n})}}}function Jn(e){return function(t){var r=t.dispatch,n=t.getState;return function(t){return function(o){return"function"==typeof o?o(r,n,e):t(o)}}}}var Qn=Jn();Qn.withExtraArgument=Jn;const eo=Qn;var to,ro=(to=function(e,t){return to=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},to(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function __(){this.constructor=e}to(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}),no=function(e,t){for(var r=0,n=t.length,o=e.length;r<n;r++,o++)e[o]=t[r];return e},oo=Object.defineProperty,ao=Object.defineProperties,io=Object.getOwnPropertyDescriptors,lo=Object.getOwnPropertySymbols,co=Object.prototype.hasOwnProperty,so=Object.prototype.propertyIsEnumerable,uo=function(e,t,r){return t in e?oo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r},mo=function(e,t){for(var r in t||(t={}))co.call(t,r)&&uo(e,r,t[r]);if(lo)for(var n=0,o=lo(t);n<o.length;n++)r=o[n],so.call(t,r)&&uo(e,r,t[r]);return e},po=function(e,t){return ao(e,io(t))},fo="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Kn:Kn.apply(null,arguments)};function ho(e,t){function r(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(t){var o=t.apply(void 0,r);if(!o)throw new Error("prepareAction did not return an object");return mo(mo({type:e,payload:o.payload},"meta"in o&&{meta:o.meta}),"error"in o&&{error:o.error})}return{type:e,payload:r[0]}}return r.toString=function(){return""+e},r.type=e,r.match=function(t){return t.type===e},r}"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var go=function(e){function t(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var o=e.apply(this,r)||this;return Object.setPrototypeOf(o,t.prototype),o}return ro(t,e),Object.defineProperty(t,Symbol.species,{get:function(){return t},enumerable:!1,configurable:!0}),t.prototype.concat=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.prototype.concat.apply(this,t)},t.prototype.prepend=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return 1===e.length&&Array.isArray(e[0])?new(t.bind.apply(t,no([void 0],e[0].concat(this)))):new(t.bind.apply(t,no([void 0],e.concat(this))))},t}(Array),yo=function(e){function t(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var o=e.apply(this,r)||this;return Object.setPrototypeOf(o,t.prototype),o}return ro(t,e),Object.defineProperty(t,Symbol.species,{get:function(){return t},enumerable:!1,configurable:!0}),t.prototype.concat=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.prototype.concat.apply(this,t)},t.prototype.prepend=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return 1===e.length&&Array.isArray(e[0])?new(t.bind.apply(t,no([void 0],e[0].concat(this)))):new(t.bind.apply(t,no([void 0],e.concat(this))))},t}(Array);function vo(e){return Wr(e)?Gn(e,(function(){})):e}function wo(e){var t,r={},n=[],o={addCase:function(e,t){var n="string"==typeof e?e:e.type;if(!n)throw new Error("`builder.addCase` cannot be called with an empty action type");if(n in r)throw new Error("`builder.addCase` cannot be called with two reducers for the same action type");return r[n]=t,o},addMatcher:function(e,t){return n.push({matcher:e,reducer:t}),o},addDefaultCase:function(e){return t=e,o}};return e(o),[r,n,t]}function bo(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");var r,n="function"==typeof e.initialState?e.initialState:vo(e.initialState),o=e.reducers||{},a=Object.keys(o),i={},l={},c={};function s(){var t="function"==typeof e.extraReducers?wo(e.extraReducers):[e.extraReducers],r=t[0],o=void 0===r?{}:r,a=t[1],i=void 0===a?[]:a,c=t[2],s=void 0===c?void 0:c,u=mo(mo({},o),l);return function(e,t,r,n){void 0===r&&(r=[]);var o,a=wo(t),i=a[0],l=a[1],c=a[2];if("function"==typeof e)o=function(){return vo(e())};else{var s=vo(e);o=function(){return s}}function u(e,t){void 0===e&&(e=o());var r=no([i[t.type]],l.filter((function(e){return(0,e.matcher)(t)})).map((function(e){return e.reducer})));return 0===r.filter((function(e){return!!e})).length&&(r=[c]),r.reduce((function(e,r){if(r){var n;if(Vr(e))return void 0===(n=r(e,t))?e:n;if(Wr(e))return Gn(e,(function(e){return r(e,t)}));if(void 0===(n=r(e,t))){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return n}return e}),e)}return u.getInitialState=o,u}(n,(function(e){for(var t in u)e.addCase(t,u[t]);for(var r=0,n=i;r<n.length;r++){var o=n[r];e.addMatcher(o.matcher,o.reducer)}s&&e.addDefaultCase(s)}))}return a.forEach((function(e){var r,n,a=o[e],s=t+"/"+e;"reducer"in a?(r=a.reducer,n=a.prepare):r=a,i[e]=r,l[s]=r,c[e]=n?ho(s,n):ho(s)})),{name:t,reducer:function(e,t){return r||(r=s()),r(e,t)},actions:c,caseReducers:i,getInitialState:function(){return r||(r=s()),r.getInitialState()}}}var xo=["name","message","stack","code"],Eo=function(e,t){this.payload=e,this.meta=t},So=function(e,t){this.payload=e,this.meta=t},ko=function(e){if("object"==typeof e&&null!==e){for(var t={},r=0,n=xo;r<n.length;r++){var o=n[r];"string"==typeof e[o]&&(t[o]=e[o])}return t}return{message:String(e)}},No=function(){function e(e,t,r){var n=ho(e+"/fulfilled",(function(e,t,r,n){return{payload:e,meta:po(mo({},n||{}),{arg:r,requestId:t,requestStatus:"fulfilled"})}})),o=ho(e+"/pending",(function(e,t,r){return{payload:void 0,meta:po(mo({},r||{}),{arg:t,requestId:e,requestStatus:"pending"})}})),a=ho(e+"/rejected",(function(e,t,n,o,a){return{payload:o,error:(r&&r.serializeError||ko)(e||"Rejected"),meta:po(mo({},a||{}),{arg:n,requestId:t,rejectedWithValue:!!o,requestStatus:"rejected",aborted:"AbortError"===(null==e?void 0:e.name),condition:"ConditionError"===(null==e?void 0:e.name)})}})),i="undefined"!=typeof AbortController?AbortController:function(){function e(){this.signal={aborted:!1,addEventListener:function(){},dispatchEvent:function(){return!1},onabort:function(){},removeEventListener:function(){},reason:void 0,throwIfAborted:function(){}}}return e.prototype.abort=function(){},e}();return Object.assign((function(e){return function(l,c,s){var u,m=(null==r?void 0:r.idGenerator)?r.idGenerator(e):function(e){void 0===e&&(e=21);for(var t="",r=e;r--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t}(),p=new i;function f(e){u=e,p.abort()}var d=function(){return i=this,d=null,h=function(){var i,d,h,g,y,v;return function(e,t){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(w){switch(w.label){case 0:return w.trys.push([0,4,,5]),null===(b=g=null==(i=null==r?void 0:r.condition)?void 0:i.call(r,e,{getState:c,extra:s}))||"object"!=typeof b||"function"!=typeof b.then?[3,2]:[4,g];case 1:g=w.sent(),w.label=2;case 2:if(!1===g||p.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};return y=new Promise((function(e,t){return p.signal.addEventListener("abort",(function(){return t({name:"AbortError",message:u||"Aborted"})}))})),l(o(m,e,null==(d=null==r?void 0:r.getPendingMeta)?void 0:d.call(r,{requestId:m,arg:e},{getState:c,extra:s}))),[4,Promise.race([y,Promise.resolve(t(e,{dispatch:l,getState:c,extra:s,requestId:m,signal:p.signal,abort:f,rejectWithValue:function(e,t){return new Eo(e,t)},fulfillWithValue:function(e,t){return new So(e,t)}})).then((function(t){if(t instanceof Eo)throw t;return t instanceof So?n(t.payload,m,e,t.meta):n(t,m,e)}))])];case 3:return h=w.sent(),[3,5];case 4:return v=w.sent(),h=v instanceof Eo?a(null,m,e,v.payload,v.meta):a(v,m,e),[3,5];case 5:return r&&!r.dispatchConditionRejection&&a.match(h)&&h.meta.condition||l(h),[2,h]}var b}))},new Promise((function(e,t){var r=function(e){try{o(h.next(e))}catch(e){t(e)}},n=function(e){try{o(h.throw(e))}catch(e){t(e)}},o=function(t){return t.done?e(t.value):Promise.resolve(t.value).then(r,n)};o((h=h.apply(i,d)).next())}));var i,d,h}();return Object.assign(d,{abort:f,requestId:m,arg:e,unwrap:function(){return d.then(Oo)}})}}),{pending:o,rejected:a,fulfilled:n,typePrefix:e})}return e.withTypes=function(){return e},e}();function Oo(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}Object.assign;var jo="listenerMiddleware";ho(jo+"/add"),ho(jo+"/removeAll"),ho(jo+"/remove"),"function"==typeof queueMicrotask&&queueMicrotask.bind("undefined"!=typeof window?window:void 0!==o.g?o.g:globalThis);function Co(e){return Co="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Co(e)}function Lo(){Lo=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var a=t&&t.prototype instanceof y?t:y,i=Object.create(a.prototype),l=new P(n||[]);return o(i,"_invoke",{value:O(e,r,l)}),i}function m(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,i,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,i)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,i,l){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Co(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,i,l)}),(function(e){r("throw",e,i,l)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return r("throw",e,i,l)}))}l(c.arg)}var a;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,r,n){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=j(l,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=m(t,r,n);if("normal"===s.type){if(o=n.done?h:f,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=h,n.method="throw",n.arg=s.arg)}}}function j(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,j(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=m(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(Co(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,l,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},k(S),s(S,c,"Generator"),s(S,i,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=_,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return l.type="throw",l.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],l=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:_(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function Po(e,t,r,n,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,o)}function _o(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){Po(a,n,o,i,l,"next",e)}function l(e){Po(a,n,o,i,l,"throw",e)}i(void 0)}))}}"undefined"!=typeof window&&window.requestAnimationFrame&&window.requestAnimationFrame,function(){function e(e,t){var r=o[e];return r?r.enumerable=t:o[e]=r={configurable:!0,enumerable:t,get:function(){var t=this[Cn];return An.get(t,e)},set:function(t){var r=this[Cn];An.set(r,e,t)}},r}function t(e){for(var t=e.length-1;t>=0;t--){var o=e[t][Cn];if(!o.P)switch(o.i){case 5:n(o)&&hn(o);break;case 4:r(o)&&hn(o)}}}function r(e){for(var t=e.t,r=e.k,n=Pn(r),o=n.length-1;o>=0;o--){var a=n[o];if(a!==Cn){var i=t[a];if(void 0===i&&!Ur(t,a))return!0;var l=r[a],c=l&&l[Cn];if(c?c.t!==i:!$r(l,i))return!0}}var s=!!t[Cn];return n.length!==Pn(t).length+(s?0:1)}function n(e){var t=e.k;if(t.length!==e.t.length)return!0;var r=Object.getOwnPropertyDescriptor(t,t.length-1);if(r&&!r.get)return!0;for(var n=0;n<t.length;n++)if(!t.hasOwnProperty(n))return!0;return!1}var o={};!function(e,t){In[e]||(In[e]=t)}("ES5",{J:function(t,r){var n=Array.isArray(t),o=function(t,r){if(t){for(var n=Array(r.length),o=0;o<r.length;o++)Object.defineProperty(n,""+o,e(o,!0));return n}var a=Rn(r);delete a[Cn];for(var i=Pn(a),l=0;l<i.length;l++){var c=i[l];a[c]=e(c,t||!!a[c].enumerable)}return Object.create(Object.getPrototypeOf(r),a)}(n,t),a={i:n?5:4,A:r?r.A:rn(),P:!1,I:!1,R:{},l:r,t,k:o,o:null,g:!1,C:!1};return Object.defineProperty(o,Cn,{value:a,writable:!0}),o},S:function(e,r,o){o?Vr(r)&&r[Cn].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var r=t[Cn];if(r){var o=r.t,a=r.k,i=r.R,l=r.i;if(4===l)zr(a,(function(t){t!==Cn&&(void 0!==o[t]||Ur(o,t)?i[t]||e(a[t]):(i[t]=!0,hn(r)))})),zr(o,(function(e){void 0!==a[e]||Ur(a,e)||(i[e]=!1,hn(r))}));else if(5===l){if(n(r)&&(hn(r),i.length=!0),a.length<o.length)for(var c=a.length;c<o.length;c++)i[c]=!1;else for(var s=o.length;s<a.length;s++)i[s]=!0;for(var u=Math.min(a.length,o.length),m=0;m<u;m++)a.hasOwnProperty(m)||(i[m]=!0),void 0===i[m]&&e(a[m])}}}}(e.p[0]),t(e.p))},K:function(e){return 4===e.i?r(e):n(e)}})}();var Ro=No("license/fetchLicense",_o(Lo().mark((function e(){var t;return Lo().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,zt({path:"/sws/v1/licence"});case 2:return t=e.sent,e.abrupt("return",t.licence);case 4:case"end":return e.stop()}}),e)})))),Io=bo({name:"license",initialState:{data:{is_valid:!1},loading:!0,error:null},reducers:{removeLicense:function(e){e.data=null},setLicense:function(e,t){e.data=t.payload}},extraReducers:function(e){e.addCase(Ro.pending,(function(e){e.loading=!0,e.error=null})).addCase(Ro.fulfilled,(function(e,t){e.loading=!1,e.data=t.payload})).addCase(Ro.rejected,(function(e,t){e.loading=!1,e.error=t.error.message}))}});const Ao=Io.reducer;function To(e,t){return"function"==typeof e?e(t):e}function Fo(e,t){return r=>{t.setState((t=>({...t,[e]:To(r,t[e])})))}}function Mo(e){return e instanceof Function}function Do(e,t,r){let n,o=[];return a=>{let i;r.key&&r.debug&&(i=Date.now());const l=e(a);if(l.length===o.length&&!l.some(((e,t)=>o[t]!==e)))return n;let c;if(o=l,r.key&&r.debug&&(c=Date.now()),n=t(...l),null==r||null==r.onChange||r.onChange(n),r.key&&r.debug&&null!=r&&r.debug()){const e=Math.round(100*(Date.now()-i))/100,t=Math.round(100*(Date.now()-c))/100,n=t/16,o=(e,t)=>{for(e=String(e);e.length<t;)e=" "+e;return e};console.info(`%c⏱ ${o(t,5)} /${o(e,5)} ms`,`\n            font-size: .6rem;\n            font-weight: bold;\n            color: hsl(${Math.max(0,Math.min(120-120*n,120))}deg 100% 31%);`,null==r?void 0:r.key)}return n}}function Go(e,t,r,n){return{debug:()=>{var r;return null!=(r=null==e?void 0:e.debugAll)?r:e[t]},key:!1,onChange:n}}Io.actions.removeLicense,Io.actions.setLicense;const qo="debugHeaders";function Vo(e,t,r){var n;let o={id:null!=(n=r.id)?n:t.id,column:t,index:r.index,isPlaceholder:!!r.isPlaceholder,placeholderId:r.placeholderId,depth:r.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const e=[],t=r=>{r.subHeaders&&r.subHeaders.length&&r.subHeaders.map(t),e.push(r)};return t(o),e},getContext:()=>({table:e,header:o,column:t})};return e._features.forEach((t=>{null==t.createHeader||t.createHeader(o,e)})),o}const Wo={createTable:e=>{e.getHeaderGroups=Do((()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right]),((t,r,n,o)=>{var a,i;const l=null!=(a=null==n?void 0:n.map((e=>r.find((t=>t.id===e)))).filter(Boolean))?a:[],c=null!=(i=null==o?void 0:o.map((e=>r.find((t=>t.id===e)))).filter(Boolean))?i:[];return zo(t,[...l,...r.filter((e=>!(null!=n&&n.includes(e.id)||null!=o&&o.includes(e.id)))),...c],e)}),Go(e.options,qo)),e.getCenterHeaderGroups=Do((()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right]),((t,r,n,o)=>zo(t,r=r.filter((e=>!(null!=n&&n.includes(e.id)||null!=o&&o.includes(e.id)))),e,"center")),Go(e.options,qo)),e.getLeftHeaderGroups=Do((()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left]),((t,r,n)=>{var o;const a=null!=(o=null==n?void 0:n.map((e=>r.find((t=>t.id===e)))).filter(Boolean))?o:[];return zo(t,a,e,"left")}),Go(e.options,qo)),e.getRightHeaderGroups=Do((()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right]),((t,r,n)=>{var o;const a=null!=(o=null==n?void 0:n.map((e=>r.find((t=>t.id===e)))).filter(Boolean))?o:[];return zo(t,a,e,"right")}),Go(e.options,qo)),e.getFooterGroups=Do((()=>[e.getHeaderGroups()]),(e=>[...e].reverse()),Go(e.options,qo)),e.getLeftFooterGroups=Do((()=>[e.getLeftHeaderGroups()]),(e=>[...e].reverse()),Go(e.options,qo)),e.getCenterFooterGroups=Do((()=>[e.getCenterHeaderGroups()]),(e=>[...e].reverse()),Go(e.options,qo)),e.getRightFooterGroups=Do((()=>[e.getRightHeaderGroups()]),(e=>[...e].reverse()),Go(e.options,qo)),e.getFlatHeaders=Do((()=>[e.getHeaderGroups()]),(e=>e.map((e=>e.headers)).flat()),Go(e.options,qo)),e.getLeftFlatHeaders=Do((()=>[e.getLeftHeaderGroups()]),(e=>e.map((e=>e.headers)).flat()),Go(e.options,qo)),e.getCenterFlatHeaders=Do((()=>[e.getCenterHeaderGroups()]),(e=>e.map((e=>e.headers)).flat()),Go(e.options,qo)),e.getRightFlatHeaders=Do((()=>[e.getRightHeaderGroups()]),(e=>e.map((e=>e.headers)).flat()),Go(e.options,qo)),e.getCenterLeafHeaders=Do((()=>[e.getCenterFlatHeaders()]),(e=>e.filter((e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}))),Go(e.options,qo)),e.getLeftLeafHeaders=Do((()=>[e.getLeftFlatHeaders()]),(e=>e.filter((e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}))),Go(e.options,qo)),e.getRightLeafHeaders=Do((()=>[e.getRightFlatHeaders()]),(e=>e.filter((e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}))),Go(e.options,qo)),e.getLeafHeaders=Do((()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()]),((e,t,r)=>{var n,o,a,i,l,c;return[...null!=(n=null==(o=e[0])?void 0:o.headers)?n:[],...null!=(a=null==(i=t[0])?void 0:i.headers)?a:[],...null!=(l=null==(c=r[0])?void 0:c.headers)?l:[]].map((e=>e.getLeafHeaders())).flat()}),Go(e.options,qo))}};function zo(e,t,r,n){var o,a;let i=0;const l=function(e,t){void 0===t&&(t=1),i=Math.max(i,t),e.filter((e=>e.getIsVisible())).forEach((e=>{var r;null!=(r=e.columns)&&r.length&&l(e.columns,t+1)}),0)};l(e);let c=[];const s=(e,t)=>{const o={depth:t,id:[n,`${t}`].filter(Boolean).join("_"),headers:[]},a=[];e.forEach((e=>{const i=[...a].reverse()[0];let l,c=!1;if(e.column.depth===o.depth&&e.column.parent?l=e.column.parent:(l=e.column,c=!0),i&&(null==i?void 0:i.column)===l)i.subHeaders.push(e);else{const o=Vo(r,l,{id:[n,t,l.id,null==e?void 0:e.id].filter(Boolean).join("_"),isPlaceholder:c,placeholderId:c?`${a.filter((e=>e.column===l)).length}`:void 0,depth:t,index:a.length});o.subHeaders.push(e),a.push(o)}o.headers.push(e),e.headerGroup=o})),c.push(o),t>0&&s(a,t-1)},u=t.map(((e,t)=>Vo(r,e,{depth:i,index:t})));s(u,i-1),c.reverse();const m=e=>e.filter((e=>e.column.getIsVisible())).map((e=>{let t=0,r=0,n=[0];return e.subHeaders&&e.subHeaders.length?(n=[],m(e.subHeaders).forEach((e=>{let{colSpan:r,rowSpan:o}=e;t+=r,n.push(o)}))):t=1,r+=Math.min(...n),e.colSpan=t,e.rowSpan=r,{colSpan:t,rowSpan:r}}));return m(null!=(o=null==(a=c[0])?void 0:a.headers)?o:[]),c}const Bo={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Uo={getDefaultColumnDef:()=>Bo,getInitialState:e=>({columnSizing:{},columnSizingInfo:{startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]},...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Fo("columnSizing",e),onColumnSizingInfoChange:Fo("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var r,n,o;const a=t.getState().columnSizing[e.id];return Math.min(Math.max(null!=(r=e.columnDef.minSize)?r:Bo.minSize,null!=(n=null!=a?a:e.columnDef.size)?n:Bo.size),null!=(o=e.columnDef.maxSize)?o:Bo.maxSize)},e.getStart=Do((e=>[e,Na(t,e),t.getState().columnSizing]),((t,r)=>r.slice(0,e.getIndex(t)).reduce(((e,t)=>e+t.getSize()),0)),Go(t.options,"debugColumns")),e.getAfter=Do((e=>[e,Na(t,e),t.getState().columnSizing]),((t,r)=>r.slice(e.getIndex(t)+1).reduce(((e,t)=>e+t.getSize()),0)),Go(t.options,"debugColumns")),e.resetSize=()=>{t.setColumnSizing((t=>{let{[e.id]:r,...n}=t;return n}))},e.getCanResize=()=>{var r,n;return(null==(r=e.columnDef.enableResizing)||r)&&(null==(n=t.options.enableColumnResizing)||n)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let t=0;const r=e=>{var n;e.subHeaders.length?e.subHeaders.forEach(r):t+=null!=(n=e.column.getSize())?n:0};return r(e),t},e.getStart=()=>{if(e.index>0){const t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=r=>{const n=t.getColumn(e.column.id),o=null==n?void 0:n.getCanResize();return a=>{if(!n||!o)return;if(null==a.persist||a.persist(),$o(a)&&a.touches&&a.touches.length>1)return;const i=e.getSize(),l=e?e.getLeafHeaders().map((e=>[e.column.id,e.column.getSize()])):[[n.id,n.getSize()]],c=$o(a)?Math.round(a.touches[0].clientX):a.clientX,s={},u=(e,r)=>{"number"==typeof r&&(t.setColumnSizingInfo((e=>{var n,o;const a="rtl"===t.options.columnResizeDirection?-1:1,i=(r-(null!=(n=null==e?void 0:e.startOffset)?n:0))*a,l=Math.max(i/(null!=(o=null==e?void 0:e.startSize)?o:0),-.999999);return e.columnSizingStart.forEach((e=>{let[t,r]=e;s[t]=Math.round(100*Math.max(r+r*l,0))/100})),{...e,deltaOffset:i,deltaPercentage:l}})),"onChange"!==t.options.columnResizeMode&&"end"!==e||t.setColumnSizing((e=>({...e,...s}))))},m=e=>u("move",e),p=e=>{u("end",e),t.setColumnSizingInfo((e=>({...e,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]})))},f=r||"undefined"!=typeof document?document:null,d={moveHandler:e=>m(e.clientX),upHandler:e=>{null==f||f.removeEventListener("mousemove",d.moveHandler),null==f||f.removeEventListener("mouseup",d.upHandler),p(e.clientX)}},h={moveHandler:e=>(e.cancelable&&(e.preventDefault(),e.stopPropagation()),m(e.touches[0].clientX),!1),upHandler:e=>{var t;null==f||f.removeEventListener("touchmove",h.moveHandler),null==f||f.removeEventListener("touchend",h.upHandler),e.cancelable&&(e.preventDefault(),e.stopPropagation()),p(null==(t=e.touches[0])?void 0:t.clientX)}},g=!!function(){if("boolean"==typeof Ho)return Ho;let e=!1;try{const t={get passive(){return e=!0,!1}},r=()=>{};window.addEventListener("test",r,t),window.removeEventListener("test",r)}catch(t){e=!1}return Ho=e,Ho}()&&{passive:!1};$o(a)?(null==f||f.addEventListener("touchmove",h.moveHandler,g),null==f||f.addEventListener("touchend",h.upHandler,g)):(null==f||f.addEventListener("mousemove",d.moveHandler,g),null==f||f.addEventListener("mouseup",d.upHandler,g)),t.setColumnSizingInfo((e=>({...e,startOffset:c,startSize:i,deltaOffset:0,deltaPercentage:0,columnSizingStart:l,isResizingColumn:n.id})))}}},createTable:e=>{e.setColumnSizing=t=>null==e.options.onColumnSizingChange?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>null==e.options.onColumnSizingInfoChange?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var r;e.setColumnSizing(t?{}:null!=(r=e.initialState.columnSizing)?r:{})},e.resetHeaderSizeInfo=t=>{var r;e.setColumnSizingInfo(t?{startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}:null!=(r=e.initialState.columnSizingInfo)?r:{startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]})},e.getTotalSize=()=>{var t,r;return null!=(t=null==(r=e.getHeaderGroups()[0])?void 0:r.headers.reduce(((e,t)=>e+t.getSize()),0))?t:0},e.getLeftTotalSize=()=>{var t,r;return null!=(t=null==(r=e.getLeftHeaderGroups()[0])?void 0:r.headers.reduce(((e,t)=>e+t.getSize()),0))?t:0},e.getCenterTotalSize=()=>{var t,r;return null!=(t=null==(r=e.getCenterHeaderGroups()[0])?void 0:r.headers.reduce(((e,t)=>e+t.getSize()),0))?t:0},e.getRightTotalSize=()=>{var t,r;return null!=(t=null==(r=e.getRightHeaderGroups()[0])?void 0:r.headers.reduce(((e,t)=>e+t.getSize()),0))?t:0}}};let Ho=null;function $o(e){return"touchstart"===e.type}const Zo={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Fo("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,r=!1;e._autoResetExpanded=()=>{var n,o;if(t){if(null!=(n=null!=(o=e.options.autoResetAll)?o:e.options.autoResetExpanded)?n:!e.options.manualExpanding){if(r)return;r=!0,e._queue((()=>{e.resetExpanded(),r=!1}))}}else e._queue((()=>{t=!0}))},e.setExpanded=t=>null==e.options.onExpandedChange?void 0:e.options.onExpandedChange(t),e.toggleAllRowsExpanded=t=>{(null!=t?t:!e.getIsAllRowsExpanded())?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=t=>{var r,n;e.setExpanded(t?{}:null!=(r=null==(n=e.initialState)?void 0:n.expanded)?r:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some((e=>e.getCanExpand())),e.getToggleAllRowsExpandedHandler=()=>t=>{null==t.persist||t.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const t=e.getState().expanded;return!0===t||Object.values(t).some(Boolean)},e.getIsAllRowsExpanded=()=>{const t=e.getState().expanded;return"boolean"==typeof t?!0===t:!!Object.keys(t).length&&!e.getRowModel().flatRows.some((e=>!e.getIsExpanded()))},e.getExpandedDepth=()=>{let t=0;return(!0===e.getState().expanded?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach((e=>{const r=e.split(".");t=Math.max(t,r.length)})),t},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=r=>{t.setExpanded((n=>{var o;const a=!0===n||!(null==n||!n[e.id]);let i={};if(!0===n?Object.keys(t.getRowModel().rowsById).forEach((e=>{i[e]=!0})):i=n,r=null!=(o=r)?o:!a,!a&&r)return{...i,[e.id]:!0};if(a&&!r){const{[e.id]:t,...r}=i;return r}return n}))},e.getIsExpanded=()=>{var r;const n=t.getState().expanded;return!!(null!=(r=null==t.options.getIsRowExpanded?void 0:t.options.getIsRowExpanded(e))?r:!0===n||(null==n?void 0:n[e.id]))},e.getCanExpand=()=>{var r,n,o;return null!=(r=null==t.options.getRowCanExpand?void 0:t.options.getRowCanExpand(e))?r:(null==(n=t.options.enableExpanding)||n)&&!(null==(o=e.subRows)||!o.length)},e.getIsAllParentsExpanded=()=>{let r=!0,n=e;for(;r&&n.parentId;)n=t.getRow(n.parentId,!0),r=n.getIsExpanded();return r},e.getToggleExpandedHandler=()=>{const t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},Yo=(e,t,r)=>{var n;const o=r.toLowerCase();return Boolean(null==(n=e.getValue(t))||null==(n=n.toString())||null==(n=n.toLowerCase())?void 0:n.includes(o))};Yo.autoRemove=e=>aa(e);const Ko=(e,t,r)=>{var n;return Boolean(null==(n=e.getValue(t))||null==(n=n.toString())?void 0:n.includes(r))};Ko.autoRemove=e=>aa(e);const Xo=(e,t,r)=>{var n;return(null==(n=e.getValue(t))||null==(n=n.toString())?void 0:n.toLowerCase())===(null==r?void 0:r.toLowerCase())};Xo.autoRemove=e=>aa(e);const Jo=(e,t,r)=>{var n;return null==(n=e.getValue(t))?void 0:n.includes(r)};Jo.autoRemove=e=>aa(e)||!(null!=e&&e.length);const Qo=(e,t,r)=>!r.some((r=>{var n;return!(null!=(n=e.getValue(t))&&n.includes(r))}));Qo.autoRemove=e=>aa(e)||!(null!=e&&e.length);const ea=(e,t,r)=>r.some((r=>{var n;return null==(n=e.getValue(t))?void 0:n.includes(r)}));ea.autoRemove=e=>aa(e)||!(null!=e&&e.length);const ta=(e,t,r)=>e.getValue(t)===r;ta.autoRemove=e=>aa(e);const ra=(e,t,r)=>e.getValue(t)==r;ra.autoRemove=e=>aa(e);const na=(e,t,r)=>{let[n,o]=r;const a=e.getValue(t);return a>=n&&a<=o};na.resolveFilterValue=e=>{let[t,r]=e,n="number"!=typeof t?parseFloat(t):t,o="number"!=typeof r?parseFloat(r):r,a=null===t||Number.isNaN(n)?-1/0:n,i=null===r||Number.isNaN(o)?1/0:o;if(a>i){const e=a;a=i,i=e}return[a,i]},na.autoRemove=e=>aa(e)||aa(e[0])&&aa(e[1]);const oa={includesString:Yo,includesStringSensitive:Ko,equalsString:Xo,arrIncludes:Jo,arrIncludesAll:Qo,arrIncludesSome:ea,equals:ta,weakEquals:ra,inNumberRange:na};function aa(e){return null==e||""===e}const ia={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],globalFilter:void 0,...e}),getDefaultOptions:e=>({onColumnFiltersChange:Fo("columnFilters",e),onGlobalFilterChange:Fo("globalFilter",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100,globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var r;const n=null==(r=e.getCoreRowModel().flatRows[0])||null==(r=r._getAllCellsByColumnId()[t.id])?void 0:r.getValue();return"string"==typeof n||"number"==typeof n}}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{const r=t.getCoreRowModel().flatRows[0],n=null==r?void 0:r.getValue(e.id);return"string"==typeof n?oa.includesString:"number"==typeof n?oa.inNumberRange:"boolean"==typeof n||null!==n&&"object"==typeof n?oa.equals:Array.isArray(n)?oa.arrIncludes:oa.weakEquals},e.getFilterFn=()=>{var r,n;return Mo(e.columnDef.filterFn)?e.columnDef.filterFn:"auto"===e.columnDef.filterFn?e.getAutoFilterFn():null!=(r=null==(n=t.options.filterFns)?void 0:n[e.columnDef.filterFn])?r:oa[e.columnDef.filterFn]},e.getCanFilter=()=>{var r,n,o;return(null==(r=e.columnDef.enableColumnFilter)||r)&&(null==(n=t.options.enableColumnFilters)||n)&&(null==(o=t.options.enableFilters)||o)&&!!e.accessorFn},e.getCanGlobalFilter=()=>{var r,n,o,a;return(null==(r=e.columnDef.enableGlobalFilter)||r)&&(null==(n=t.options.enableGlobalFilter)||n)&&(null==(o=t.options.enableFilters)||o)&&(null==(a=null==t.options.getColumnCanGlobalFilter?void 0:t.options.getColumnCanGlobalFilter(e))||a)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var r;return null==(r=t.getState().columnFilters)||null==(r=r.find((t=>t.id===e.id)))?void 0:r.value},e.getFilterIndex=()=>{var r,n;return null!=(r=null==(n=t.getState().columnFilters)?void 0:n.findIndex((t=>t.id===e.id)))?r:-1},e.setFilterValue=r=>{t.setColumnFilters((t=>{const n=e.getFilterFn(),o=null==t?void 0:t.find((t=>t.id===e.id)),a=To(r,o?o.value:void 0);var i;if(la(n,a,e))return null!=(i=null==t?void 0:t.filter((t=>t.id!==e.id)))?i:[];const l={id:e.id,value:a};var c;return o?null!=(c=null==t?void 0:t.map((t=>t.id===e.id?l:t)))?c:[]:null!=t&&t.length?[...t,l]:[l]}))},e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.getGlobalAutoFilterFn=()=>oa.includesString,e.getGlobalFilterFn=()=>{var t,r;const{globalFilterFn:n}=e.options;return Mo(n)?n:"auto"===n?e.getGlobalAutoFilterFn():null!=(t=null==(r=e.options.filterFns)?void 0:r[n])?t:oa[n]},e.setColumnFilters=t=>{const r=e.getAllLeafColumns();null==e.options.onColumnFiltersChange||e.options.onColumnFiltersChange((e=>{var n;return null==(n=To(t,e))?void 0:n.filter((e=>{const t=r.find((t=>t.id===e.id));return!t||!la(t.getFilterFn(),e.value,t)}))}))},e.setGlobalFilter=t=>{null==e.options.onGlobalFilterChange||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)},e.resetColumnFilters=t=>{var r,n;e.setColumnFilters(t?[]:null!=(r=null==(n=e.initialState)?void 0:n.columnFilters)?r:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel()),e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}};function la(e,t,r){return!(!e||!e.autoRemove)&&e.autoRemove(t,r)||void 0===t||"string"==typeof t&&!t}const ca={sum:(e,t,r)=>r.reduce(((t,r)=>{const n=r.getValue(e);return t+("number"==typeof n?n:0)}),0),min:(e,t,r)=>{let n;return r.forEach((t=>{const r=t.getValue(e);null!=r&&(n>r||void 0===n&&r>=r)&&(n=r)})),n},max:(e,t,r)=>{let n;return r.forEach((t=>{const r=t.getValue(e);null!=r&&(n<r||void 0===n&&r>=r)&&(n=r)})),n},extent:(e,t,r)=>{let n,o;return r.forEach((t=>{const r=t.getValue(e);null!=r&&(void 0===n?r>=r&&(n=o=r):(n>r&&(n=r),o<r&&(o=r)))})),[n,o]},mean:(e,t)=>{let r=0,n=0;if(t.forEach((t=>{let o=t.getValue(e);null!=o&&(o=+o)>=o&&(++r,n+=o)})),r)return n/r},median:(e,t)=>{if(!t.length)return;const r=t.map((t=>t.getValue(e)));if(!function(e){return Array.isArray(e)&&e.every((e=>"number"==typeof e))}(r))return;if(1===r.length)return r[0];const n=Math.floor(r.length/2),o=r.sort(((e,t)=>e-t));return r.length%2!=0?o[n]:(o[n-1]+o[n])/2},unique:(e,t)=>Array.from(new Set(t.map((t=>t.getValue(e)))).values()),uniqueCount:(e,t)=>new Set(t.map((t=>t.getValue(e)))).size,count:(e,t)=>t.length},sa={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,r;return null!=(t=null==(r=e.getValue())||null==r.toString?void 0:r.toString())?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:Fo("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping((t=>null!=t&&t.includes(e.id)?t.filter((t=>t!==e.id)):[...null!=t?t:[],e.id]))},e.getCanGroup=()=>{var r,n,o,a;return null!=(r=null==(n=null!=(o=null==(a=e.columnDef.enableGrouping)||a)?o:t.options.enableGrouping)||n)?r:!!e.accessorFn},e.getIsGrouped=()=>{var r;return null==(r=t.getState().grouping)?void 0:r.includes(e.id)},e.getGroupedIndex=()=>{var r;return null==(r=t.getState().grouping)?void 0:r.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const r=t.getCoreRowModel().flatRows[0],n=null==r?void 0:r.getValue(e.id);return"number"==typeof n?ca.sum:"[object Date]"===Object.prototype.toString.call(n)?ca.extent:void 0},e.getAggregationFn=()=>{var r,n;if(!e)throw new Error;return Mo(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:"auto"===e.columnDef.aggregationFn?e.getAutoAggregationFn():null!=(r=null==(n=t.options.aggregationFns)?void 0:n[e.columnDef.aggregationFn])?r:ca[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>null==e.options.onGroupingChange?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var r,n;e.setGrouping(t?[]:null!=(r=null==(n=e.initialState)?void 0:n.grouping)?r:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=r=>{if(e._groupingValuesCache.hasOwnProperty(r))return e._groupingValuesCache[r];const n=t.getColumn(r);return null!=n&&n.columnDef.getGroupingValue?(e._groupingValuesCache[r]=n.columnDef.getGroupingValue(e.original),e._groupingValuesCache[r]):e.getValue(r)},e._groupingValuesCache={}},createCell:(e,t,r,n)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===r.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var t;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!(null==(t=r.subRows)||!t.length)}}},ua={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Fo("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=Do((e=>[Na(t,e)]),(t=>t.findIndex((t=>t.id===e.id))),Go(t.options,"debugColumns")),e.getIsFirstColumn=r=>{var n;return(null==(n=Na(t,r)[0])?void 0:n.id)===e.id},e.getIsLastColumn=r=>{var n;const o=Na(t,r);return(null==(n=o[o.length-1])?void 0:n.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>null==e.options.onColumnOrderChange?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var r;e.setColumnOrder(t?[]:null!=(r=e.initialState.columnOrder)?r:[])},e._getOrderColumnsFn=Do((()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode]),((e,t,r)=>n=>{let o=[];if(null!=e&&e.length){const t=[...e],r=[...n];for(;r.length&&t.length;){const e=t.shift(),n=r.findIndex((t=>t.id===e));n>-1&&o.push(r.splice(n,1)[0])}o=[...o,...r]}else o=n;return function(e,t,r){if(null==t||!t.length||!r)return e;const n=e.filter((e=>!t.includes(e.id)));if("remove"===r)return n;return[...t.map((t=>e.find((e=>e.id===t)))).filter(Boolean),...n]}(o,t,r)}),Go(e.options,"debugTable"))}},ma={getInitialState:e=>({...e,pagination:{pageIndex:0,pageSize:10,...null==e?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:Fo("pagination",e)}),createTable:e=>{let t=!1,r=!1;e._autoResetPageIndex=()=>{var n,o;if(t){if(null!=(n=null!=(o=e.options.autoResetAll)?o:e.options.autoResetPageIndex)?n:!e.options.manualPagination){if(r)return;r=!0,e._queue((()=>{e.resetPageIndex(),r=!1}))}}else e._queue((()=>{t=!0}))},e.setPagination=t=>null==e.options.onPaginationChange?void 0:e.options.onPaginationChange((e=>To(t,e))),e.resetPagination=t=>{var r;e.setPagination(t?{pageIndex:0,pageSize:10}:null!=(r=e.initialState.pagination)?r:{pageIndex:0,pageSize:10})},e.setPageIndex=t=>{e.setPagination((r=>{let n=To(t,r.pageIndex);const o=void 0===e.options.pageCount||-1===e.options.pageCount?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return n=Math.max(0,Math.min(n,o)),{...r,pageIndex:n}}))},e.resetPageIndex=t=>{var r,n;e.setPageIndex(t?0:null!=(r=null==(n=e.initialState)||null==(n=n.pagination)?void 0:n.pageIndex)?r:0)},e.resetPageSize=t=>{var r,n;e.setPageSize(t?10:null!=(r=null==(n=e.initialState)||null==(n=n.pagination)?void 0:n.pageSize)?r:10)},e.setPageSize=t=>{e.setPagination((e=>{const r=Math.max(1,To(t,e.pageSize)),n=e.pageSize*e.pageIndex,o=Math.floor(n/r);return{...e,pageIndex:o,pageSize:r}}))},e.setPageCount=t=>e.setPagination((r=>{var n;let o=To(t,null!=(n=e.options.pageCount)?n:-1);return"number"==typeof o&&(o=Math.max(-1,o)),{...r,pageCount:o}})),e.getPageOptions=Do((()=>[e.getPageCount()]),(e=>{let t=[];return e&&e>0&&(t=[...new Array(e)].fill(null).map(((e,t)=>t))),t}),Go(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:t}=e.getState().pagination,r=e.getPageCount();return-1===r||0!==r&&t<r-1},e.previousPage=()=>e.setPageIndex((e=>e-1)),e.nextPage=()=>e.setPageIndex((e=>e+1)),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var t;return null!=(t=e.options.pageCount)?t:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var t;return null!=(t=e.options.rowCount)?t:e.getPrePaginationRowModel().rows.length}}},pa={getInitialState:e=>({columnPinning:{left:[],right:[]},rowPinning:{top:[],bottom:[]},...e}),getDefaultOptions:e=>({onColumnPinningChange:Fo("columnPinning",e),onRowPinningChange:Fo("rowPinning",e)}),createColumn:(e,t)=>{e.pin=r=>{const n=e.getLeafColumns().map((e=>e.id)).filter(Boolean);t.setColumnPinning((e=>{var t,o,a,i,l,c;return"right"===r?{left:(null!=(a=null==e?void 0:e.left)?a:[]).filter((e=>!(null!=n&&n.includes(e)))),right:[...(null!=(i=null==e?void 0:e.right)?i:[]).filter((e=>!(null!=n&&n.includes(e)))),...n]}:"left"===r?{left:[...(null!=(l=null==e?void 0:e.left)?l:[]).filter((e=>!(null!=n&&n.includes(e)))),...n],right:(null!=(c=null==e?void 0:e.right)?c:[]).filter((e=>!(null!=n&&n.includes(e))))}:{left:(null!=(t=null==e?void 0:e.left)?t:[]).filter((e=>!(null!=n&&n.includes(e)))),right:(null!=(o=null==e?void 0:e.right)?o:[]).filter((e=>!(null!=n&&n.includes(e))))}}))},e.getCanPin=()=>e.getLeafColumns().some((e=>{var r,n,o;return(null==(r=e.columnDef.enablePinning)||r)&&(null==(n=null!=(o=t.options.enableColumnPinning)?o:t.options.enablePinning)||n)})),e.getIsPinned=()=>{const r=e.getLeafColumns().map((e=>e.id)),{left:n,right:o}=t.getState().columnPinning,a=r.some((e=>null==n?void 0:n.includes(e))),i=r.some((e=>null==o?void 0:o.includes(e)));return a?"left":!!i&&"right"},e.getPinnedIndex=()=>{var r,n;const o=e.getIsPinned();return o?null!=(r=null==(n=t.getState().columnPinning)||null==(n=n[o])?void 0:n.indexOf(e.id))?r:-1:0}},createRow:(e,t)=>{e.pin=(r,n,o)=>{const a=n?e.getLeafRows().map((e=>{let{id:t}=e;return t})):[],i=o?e.getParentRows().map((e=>{let{id:t}=e;return t})):[],l=new Set([...i,e.id,...a]);t.setRowPinning((e=>{var t,n,o,a,i,c;return"bottom"===r?{top:(null!=(o=null==e?void 0:e.top)?o:[]).filter((e=>!(null!=l&&l.has(e)))),bottom:[...(null!=(a=null==e?void 0:e.bottom)?a:[]).filter((e=>!(null!=l&&l.has(e)))),...Array.from(l)]}:"top"===r?{top:[...(null!=(i=null==e?void 0:e.top)?i:[]).filter((e=>!(null!=l&&l.has(e)))),...Array.from(l)],bottom:(null!=(c=null==e?void 0:e.bottom)?c:[]).filter((e=>!(null!=l&&l.has(e))))}:{top:(null!=(t=null==e?void 0:e.top)?t:[]).filter((e=>!(null!=l&&l.has(e)))),bottom:(null!=(n=null==e?void 0:e.bottom)?n:[]).filter((e=>!(null!=l&&l.has(e))))}}))},e.getCanPin=()=>{var r;const{enableRowPinning:n,enablePinning:o}=t.options;return"function"==typeof n?n(e):null==(r=null!=n?n:o)||r},e.getIsPinned=()=>{const r=[e.id],{top:n,bottom:o}=t.getState().rowPinning,a=r.some((e=>null==n?void 0:n.includes(e))),i=r.some((e=>null==o?void 0:o.includes(e)));return a?"top":!!i&&"bottom"},e.getPinnedIndex=()=>{var r,n;const o=e.getIsPinned();if(!o)return-1;const a=null==(r=t._getPinnedRows(o))?void 0:r.map((e=>{let{id:t}=e;return t}));return null!=(n=null==a?void 0:a.indexOf(e.id))?n:-1},e.getCenterVisibleCells=Do((()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right]),((e,t,r)=>{const n=[...null!=t?t:[],...null!=r?r:[]];return e.filter((e=>!n.includes(e.column.id)))}),Go(t.options,"debugRows")),e.getLeftVisibleCells=Do((()=>[e._getAllVisibleCells(),t.getState().columnPinning.left]),((e,t)=>{const r=(null!=t?t:[]).map((t=>e.find((e=>e.column.id===t)))).filter(Boolean).map((e=>({...e,position:"left"})));return r}),Go(t.options,"debugRows")),e.getRightVisibleCells=Do((()=>[e._getAllVisibleCells(),t.getState().columnPinning.right]),((e,t)=>{const r=(null!=t?t:[]).map((t=>e.find((e=>e.column.id===t)))).filter(Boolean).map((e=>({...e,position:"right"})));return r}),Go(t.options,"debugRows"))},createTable:e=>{e.setColumnPinning=t=>null==e.options.onColumnPinningChange?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var r,n;return e.setColumnPinning(t?{left:[],right:[]}:null!=(r=null==(n=e.initialState)?void 0:n.columnPinning)?r:{left:[],right:[]})},e.getIsSomeColumnsPinned=t=>{var r;const n=e.getState().columnPinning;var o,a;return t?Boolean(null==(r=n[t])?void 0:r.length):Boolean((null==(o=n.left)?void 0:o.length)||(null==(a=n.right)?void 0:a.length))},e.getLeftLeafColumns=Do((()=>[e.getAllLeafColumns(),e.getState().columnPinning.left]),((e,t)=>(null!=t?t:[]).map((t=>e.find((e=>e.id===t)))).filter(Boolean)),Go(e.options,"debugColumns")),e.getRightLeafColumns=Do((()=>[e.getAllLeafColumns(),e.getState().columnPinning.right]),((e,t)=>(null!=t?t:[]).map((t=>e.find((e=>e.id===t)))).filter(Boolean)),Go(e.options,"debugColumns")),e.getCenterLeafColumns=Do((()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right]),((e,t,r)=>{const n=[...null!=t?t:[],...null!=r?r:[]];return e.filter((e=>!n.includes(e.id)))}),Go(e.options,"debugColumns")),e.setRowPinning=t=>null==e.options.onRowPinningChange?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var r,n;return e.setRowPinning(t?{top:[],bottom:[]}:null!=(r=null==(n=e.initialState)?void 0:n.rowPinning)?r:{top:[],bottom:[]})},e.getIsSomeRowsPinned=t=>{var r;const n=e.getState().rowPinning;var o,a;return t?Boolean(null==(r=n[t])?void 0:r.length):Boolean((null==(o=n.top)?void 0:o.length)||(null==(a=n.bottom)?void 0:a.length))},e._getPinnedRows=Do((t=>[e.getRowModel().rows,e.getState().rowPinning[t],t]),((t,r,n)=>{var o;return(null==(o=e.options.keepPinnedRows)||o?(null!=r?r:[]).map((t=>{const r=e.getRow(t,!0);return r.getIsAllParentsExpanded()?r:null})):(null!=r?r:[]).map((e=>t.find((t=>t.id===e))))).filter(Boolean).map((e=>({...e,position:n})))}),Go(e.options,"debugRows")),e.getTopRows=()=>e._getPinnedRows("top"),e.getBottomRows=()=>e._getPinnedRows("bottom"),e.getCenterRows=Do((()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom]),((e,t,r)=>{const n=new Set([...null!=t?t:[],...null!=r?r:[]]);return e.filter((e=>!n.has(e.id)))}),Go(e.options,"debugRows"))}},fa={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Fo("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>null==e.options.onRowSelectionChange?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var r;return e.setRowSelection(t?{}:null!=(r=e.initialState.rowSelection)?r:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection((r=>{t=void 0!==t?t:!e.getIsAllRowsSelected();const n={...r},o=e.getPreGroupedRowModel().flatRows;return t?o.forEach((e=>{e.getCanSelect()&&(n[e.id]=!0)})):o.forEach((e=>{delete n[e.id]})),n}))},e.toggleAllPageRowsSelected=t=>e.setRowSelection((r=>{const n=void 0!==t?t:!e.getIsAllPageRowsSelected(),o={...r};return e.getRowModel().rows.forEach((t=>{da(o,t.id,n,!0,e)})),o})),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=Do((()=>[e.getState().rowSelection,e.getCoreRowModel()]),((t,r)=>Object.keys(t).length?ha(e,r):{rows:[],flatRows:[],rowsById:{}}),Go(e.options,"debugTable")),e.getFilteredSelectedRowModel=Do((()=>[e.getState().rowSelection,e.getFilteredRowModel()]),((t,r)=>Object.keys(t).length?ha(e,r):{rows:[],flatRows:[],rowsById:{}}),Go(e.options,"debugTable")),e.getGroupedSelectedRowModel=Do((()=>[e.getState().rowSelection,e.getSortedRowModel()]),((t,r)=>Object.keys(t).length?ha(e,r):{rows:[],flatRows:[],rowsById:{}}),Go(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:r}=e.getState();let n=Boolean(t.length&&Object.keys(r).length);return n&&t.some((e=>e.getCanSelect()&&!r[e.id]))&&(n=!1),n},e.getIsAllPageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows.filter((e=>e.getCanSelect())),{rowSelection:r}=e.getState();let n=!!t.length;return n&&t.some((e=>!r[e.id]))&&(n=!1),n},e.getIsSomeRowsSelected=()=>{var t;const r=Object.keys(null!=(t=e.getState().rowSelection)?t:{}).length;return r>0&&r<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows;return!e.getIsAllPageRowsSelected()&&t.filter((e=>e.getCanSelect())).some((e=>e.getIsSelected()||e.getIsSomeSelected()))},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(r,n)=>{const o=e.getIsSelected();t.setRowSelection((a=>{var i;if(r=void 0!==r?r:!o,e.getCanSelect()&&o===r)return a;const l={...a};return da(l,e.id,r,null==(i=null==n?void 0:n.selectChildren)||i,t),l}))},e.getIsSelected=()=>{const{rowSelection:r}=t.getState();return ga(e,r)},e.getIsSomeSelected=()=>{const{rowSelection:r}=t.getState();return"some"===ya(e,r)},e.getIsAllSubRowsSelected=()=>{const{rowSelection:r}=t.getState();return"all"===ya(e,r)},e.getCanSelect=()=>{var r;return"function"==typeof t.options.enableRowSelection?t.options.enableRowSelection(e):null==(r=t.options.enableRowSelection)||r},e.getCanSelectSubRows=()=>{var r;return"function"==typeof t.options.enableSubRowSelection?t.options.enableSubRowSelection(e):null==(r=t.options.enableSubRowSelection)||r},e.getCanMultiSelect=()=>{var r;return"function"==typeof t.options.enableMultiRowSelection?t.options.enableMultiRowSelection(e):null==(r=t.options.enableMultiRowSelection)||r},e.getToggleSelectedHandler=()=>{const t=e.getCanSelect();return r=>{var n;t&&e.toggleSelected(null==(n=r.target)?void 0:n.checked)}}}},da=(e,t,r,n,o)=>{var a;const i=o.getRow(t,!0);r?(i.getCanMultiSelect()||Object.keys(e).forEach((t=>delete e[t])),i.getCanSelect()&&(e[t]=!0)):delete e[t],n&&null!=(a=i.subRows)&&a.length&&i.getCanSelectSubRows()&&i.subRows.forEach((t=>da(e,t.id,r,n,o)))};function ha(e,t){const r=e.getState().rowSelection,n=[],o={},a=function(e,t){return e.map((e=>{var t;const i=ga(e,r);if(i&&(n.push(e),o[e.id]=e),null!=(t=e.subRows)&&t.length&&(e={...e,subRows:a(e.subRows)}),i)return e})).filter(Boolean)};return{rows:a(t.rows),flatRows:n,rowsById:o}}function ga(e,t){var r;return null!=(r=t[e.id])&&r}function ya(e,t,r){var n;if(null==(n=e.subRows)||!n.length)return!1;let o=!0,a=!1;return e.subRows.forEach((e=>{if((!a||o)&&(e.getCanSelect()&&(ga(e,t)?a=!0:o=!1),e.subRows&&e.subRows.length)){const r=ya(e,t);"all"===r?a=!0:"some"===r?(a=!0,o=!1):o=!1}})),o?"all":!!a&&"some"}const va=/([0-9]+)/gm;function wa(e,t){return e===t?0:e>t?1:-1}function ba(e){return"number"==typeof e?isNaN(e)||e===1/0||e===-1/0?"":String(e):"string"==typeof e?e:""}function xa(e,t){const r=e.split(va).filter(Boolean),n=t.split(va).filter(Boolean);for(;r.length&&n.length;){const e=r.shift(),t=n.shift(),o=parseInt(e,10),a=parseInt(t,10),i=[o,a].sort();if(isNaN(i[0])){if(e>t)return 1;if(t>e)return-1}else{if(isNaN(i[1]))return isNaN(o)?-1:1;if(o>a)return 1;if(a>o)return-1}}return r.length-n.length}const Ea={alphanumeric:(e,t,r)=>xa(ba(e.getValue(r)).toLowerCase(),ba(t.getValue(r)).toLowerCase()),alphanumericCaseSensitive:(e,t,r)=>xa(ba(e.getValue(r)),ba(t.getValue(r))),text:(e,t,r)=>wa(ba(e.getValue(r)).toLowerCase(),ba(t.getValue(r)).toLowerCase()),textCaseSensitive:(e,t,r)=>wa(ba(e.getValue(r)),ba(t.getValue(r))),datetime:(e,t,r)=>{const n=e.getValue(r),o=t.getValue(r);return n>o?1:n<o?-1:0},basic:(e,t,r)=>wa(e.getValue(r),t.getValue(r))},Sa={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Fo("sorting",e),isMultiSortEvent:e=>e.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{const r=t.getFilteredRowModel().flatRows.slice(10);let n=!1;for(const t of r){const r=null==t?void 0:t.getValue(e.id);if("[object Date]"===Object.prototype.toString.call(r))return Ea.datetime;if("string"==typeof r&&(n=!0,r.split(va).length>1))return Ea.alphanumeric}return n?Ea.text:Ea.basic},e.getAutoSortDir=()=>{const r=t.getFilteredRowModel().flatRows[0];return"string"==typeof(null==r?void 0:r.getValue(e.id))?"asc":"desc"},e.getSortingFn=()=>{var r,n;if(!e)throw new Error;return Mo(e.columnDef.sortingFn)?e.columnDef.sortingFn:"auto"===e.columnDef.sortingFn?e.getAutoSortingFn():null!=(r=null==(n=t.options.sortingFns)?void 0:n[e.columnDef.sortingFn])?r:Ea[e.columnDef.sortingFn]},e.toggleSorting=(r,n)=>{const o=e.getNextSortingOrder(),a=null!=r;t.setSorting((i=>{const l=null==i?void 0:i.find((t=>t.id===e.id)),c=null==i?void 0:i.findIndex((t=>t.id===e.id));let s,u=[],m=a?r:"desc"===o;var p;return s=null!=i&&i.length&&e.getCanMultiSort()&&n?l?"toggle":"add":null!=i&&i.length&&c!==i.length-1?"replace":l?"toggle":"replace","toggle"===s&&(a||o||(s="remove")),"add"===s?(u=[...i,{id:e.id,desc:m}],u.splice(0,u.length-(null!=(p=t.options.maxMultiSortColCount)?p:Number.MAX_SAFE_INTEGER))):u="toggle"===s?i.map((t=>t.id===e.id?{...t,desc:m}:t)):"remove"===s?i.filter((t=>t.id!==e.id)):[{id:e.id,desc:m}],u}))},e.getFirstSortDir=()=>{var r,n;return(null!=(r=null!=(n=e.columnDef.sortDescFirst)?n:t.options.sortDescFirst)?r:"desc"===e.getAutoSortDir())?"desc":"asc"},e.getNextSortingOrder=r=>{var n,o;const a=e.getFirstSortDir(),i=e.getIsSorted();return i?!!(i===a||null!=(n=t.options.enableSortingRemoval)&&!n||r&&null!=(o=t.options.enableMultiRemove)&&!o)&&("desc"===i?"asc":"desc"):a},e.getCanSort=()=>{var r,n;return(null==(r=e.columnDef.enableSorting)||r)&&(null==(n=t.options.enableSorting)||n)&&!!e.accessorFn},e.getCanMultiSort=()=>{var r,n;return null!=(r=null!=(n=e.columnDef.enableMultiSort)?n:t.options.enableMultiSort)?r:!!e.accessorFn},e.getIsSorted=()=>{var r;const n=null==(r=t.getState().sorting)?void 0:r.find((t=>t.id===e.id));return!!n&&(n.desc?"desc":"asc")},e.getSortIndex=()=>{var r,n;return null!=(r=null==(n=t.getState().sorting)?void 0:n.findIndex((t=>t.id===e.id)))?r:-1},e.clearSorting=()=>{t.setSorting((t=>null!=t&&t.length?t.filter((t=>t.id!==e.id)):[]))},e.getToggleSortingHandler=()=>{const r=e.getCanSort();return n=>{r&&(null==n.persist||n.persist(),null==e.toggleSorting||e.toggleSorting(void 0,!!e.getCanMultiSort()&&(null==t.options.isMultiSortEvent?void 0:t.options.isMultiSortEvent(n))))}}},createTable:e=>{e.setSorting=t=>null==e.options.onSortingChange?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var r,n;e.setSorting(t?[]:null!=(r=null==(n=e.initialState)?void 0:n.sorting)?r:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},ka={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Fo("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=r=>{e.getCanHide()&&t.setColumnVisibility((t=>({...t,[e.id]:null!=r?r:!e.getIsVisible()})))},e.getIsVisible=()=>{var r,n;const o=e.columns;return null==(r=o.length?o.some((e=>e.getIsVisible())):null==(n=t.getState().columnVisibility)?void 0:n[e.id])||r},e.getCanHide=()=>{var r,n;return(null==(r=e.columnDef.enableHiding)||r)&&(null==(n=t.options.enableHiding)||n)},e.getToggleVisibilityHandler=()=>t=>{null==e.toggleVisibility||e.toggleVisibility(t.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=Do((()=>[e.getAllCells(),t.getState().columnVisibility]),(e=>e.filter((e=>e.column.getIsVisible()))),Go(t.options,"debugRows")),e.getVisibleCells=Do((()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()]),((e,t,r)=>[...e,...t,...r]),Go(t.options,"debugRows"))},createTable:e=>{const t=(t,r)=>Do((()=>[r(),r().filter((e=>e.getIsVisible())).map((e=>e.id)).join("_")]),(e=>e.filter((e=>null==e.getIsVisible?void 0:e.getIsVisible()))),Go(e.options,"debugColumns"));e.getVisibleFlatColumns=t(0,(()=>e.getAllFlatColumns())),e.getVisibleLeafColumns=t(0,(()=>e.getAllLeafColumns())),e.getLeftVisibleLeafColumns=t(0,(()=>e.getLeftLeafColumns())),e.getRightVisibleLeafColumns=t(0,(()=>e.getRightLeafColumns())),e.getCenterVisibleLeafColumns=t(0,(()=>e.getCenterLeafColumns())),e.setColumnVisibility=t=>null==e.options.onColumnVisibilityChange?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{var r;e.setColumnVisibility(t?{}:null!=(r=e.initialState.columnVisibility)?r:{})},e.toggleAllColumnsVisible=t=>{var r;t=null!=(r=t)?r:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce(((e,r)=>({...e,[r.id]:t||!(null!=r.getCanHide&&r.getCanHide())})),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some((e=>!(null!=e.getIsVisible&&e.getIsVisible()))),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some((e=>null==e.getIsVisible?void 0:e.getIsVisible())),e.getToggleAllColumnsVisibilityHandler=()=>t=>{var r;e.toggleAllColumnsVisible(null==(r=t.target)?void 0:r.checked)}}};function Na(e,t){return t?"center"===t?e.getCenterVisibleLeafColumns():"left"===t?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const Oa=[Wo,ka,ua,pa,ia,Sa,sa,Zo,ma,fa,Uo];function ja(e){var t;(e.debugAll||e.debugTable)&&console.info("Creating Table Instance...");let r={_features:Oa};const n=r._features.reduce(((e,t)=>Object.assign(e,null==t.getDefaultOptions?void 0:t.getDefaultOptions(r))),{});let o={...null!=(t=e.initialState)?t:{}};r._features.forEach((e=>{var t;o=null!=(t=null==e.getInitialState?void 0:e.getInitialState(o))?t:o}));const a=[];let i=!1;const l={_features:Oa,options:{...n,...e},initialState:o,_queue:e=>{a.push(e),i||(i=!0,Promise.resolve().then((()=>{for(;a.length;)a.shift()();i=!1})).catch((e=>setTimeout((()=>{throw e})))))},reset:()=>{r.setState(r.initialState)},setOptions:e=>{const t=To(e,r.options);r.options=(e=>r.options.mergeOptions?r.options.mergeOptions(n,e):{...n,...e})(t)},getState:()=>r.options.state,setState:e=>{null==r.options.onStateChange||r.options.onStateChange(e)},_getRowId:(e,t,n)=>{var o;return null!=(o=null==r.options.getRowId?void 0:r.options.getRowId(e,t,n))?o:`${n?[n.id,t].join("."):t}`},getCoreRowModel:()=>(r._getCoreRowModel||(r._getCoreRowModel=r.options.getCoreRowModel(r)),r._getCoreRowModel()),getRowModel:()=>r.getPaginationRowModel(),getRow:(e,t)=>{let n=(t?r.getPrePaginationRowModel():r.getRowModel()).rowsById[e];if(!n&&(n=r.getCoreRowModel().rowsById[e],!n))throw new Error;return n},_getDefaultColumnDef:Do((()=>[r.options.defaultColumn]),(e=>{var t;return e=null!=(t=e)?t:{},{header:e=>{const t=e.header.column.columnDef;return t.accessorKey?t.accessorKey:t.accessorFn?t.id:null},cell:e=>{var t,r;return null!=(t=null==(r=e.renderValue())||null==r.toString?void 0:r.toString())?t:null},...r._features.reduce(((e,t)=>Object.assign(e,null==t.getDefaultColumnDef?void 0:t.getDefaultColumnDef())),{}),...e}}),Go(e,"debugColumns")),_getColumnDefs:()=>r.options.columns,getAllColumns:Do((()=>[r._getColumnDefs()]),(e=>{const t=function(e,n,o){return void 0===o&&(o=0),e.map((e=>{const a=function(e,t,r,n){var o,a;const i={...e._getDefaultColumnDef(),...t},l=i.accessorKey;let c,s=null!=(o=null!=(a=i.id)?a:l?l.replace(".","_"):void 0)?o:"string"==typeof i.header?i.header:void 0;if(i.accessorFn?c=i.accessorFn:l&&(c=l.includes(".")?e=>{let t=e;for(const e of l.split(".")){var r;t=null==(r=t)?void 0:r[e]}return t}:e=>e[i.accessorKey]),!s)throw new Error;let u={id:`${String(s)}`,accessorFn:c,parent:n,depth:r,columnDef:i,columns:[],getFlatColumns:Do((()=>[!0]),(()=>{var e;return[u,...null==(e=u.columns)?void 0:e.flatMap((e=>e.getFlatColumns()))]}),Go(e.options,"debugColumns")),getLeafColumns:Do((()=>[e._getOrderColumnsFn()]),(e=>{var t;if(null!=(t=u.columns)&&t.length){let t=u.columns.flatMap((e=>e.getLeafColumns()));return e(t)}return[u]}),Go(e.options,"debugColumns"))};for(const t of e._features)null==t.createColumn||t.createColumn(u,e);return u}(r,e,o,n),i=e;return a.columns=i.columns?t(i.columns,a,o+1):[],a}))};return t(e)}),Go(e,"debugColumns")),getAllFlatColumns:Do((()=>[r.getAllColumns()]),(e=>e.flatMap((e=>e.getFlatColumns()))),Go(e,"debugColumns")),_getAllFlatColumnsById:Do((()=>[r.getAllFlatColumns()]),(e=>e.reduce(((e,t)=>(e[t.id]=t,e)),{})),Go(e,"debugColumns")),getAllLeafColumns:Do((()=>[r.getAllColumns(),r._getOrderColumnsFn()]),((e,t)=>t(e.flatMap((e=>e.getLeafColumns())))),Go(e,"debugColumns")),getColumn:e=>r._getAllFlatColumnsById()[e]};Object.assign(r,l);for(let e=0;e<r._features.length;e++){const t=r._features[e];null==t||null==t.createTable||t.createTable(r)}return r}const Ca=(e,t,r,n,o,a,i)=>{let l={id:t,index:n,original:r,depth:o,parentId:i,_valuesCache:{},_uniqueValuesCache:{},getValue:t=>{if(l._valuesCache.hasOwnProperty(t))return l._valuesCache[t];const r=e.getColumn(t);return null!=r&&r.accessorFn?(l._valuesCache[t]=r.accessorFn(l.original,n),l._valuesCache[t]):void 0},getUniqueValues:t=>{if(l._uniqueValuesCache.hasOwnProperty(t))return l._uniqueValuesCache[t];const r=e.getColumn(t);return null!=r&&r.accessorFn?r.columnDef.getUniqueValues?(l._uniqueValuesCache[t]=r.columnDef.getUniqueValues(l.original,n),l._uniqueValuesCache[t]):(l._uniqueValuesCache[t]=[l.getValue(t)],l._uniqueValuesCache[t]):void 0},renderValue:t=>{var r;return null!=(r=l.getValue(t))?r:e.options.renderFallbackValue},subRows:null!=a?a:[],getLeafRows:()=>function(e,t){const r=[],n=e=>{e.forEach((e=>{r.push(e);const o=t(e);null!=o&&o.length&&n(o)}))};return n(e),r}(l.subRows,(e=>e.subRows)),getParentRow:()=>l.parentId?e.getRow(l.parentId,!0):void 0,getParentRows:()=>{let e=[],t=l;for(;;){const r=t.getParentRow();if(!r)break;e.push(r),t=r}return e.reverse()},getAllCells:Do((()=>[e.getAllLeafColumns()]),(t=>t.map((t=>function(e,t,r,n){const o={id:`${t.id}_${r.id}`,row:t,column:r,getValue:()=>t.getValue(n),renderValue:()=>{var t;return null!=(t=o.getValue())?t:e.options.renderFallbackValue},getContext:Do((()=>[e,r,t,o]),((e,t,r,n)=>({table:e,column:t,row:r,cell:n,getValue:n.getValue,renderValue:n.renderValue})),Go(e.options,"debugCells"))};return e._features.forEach((n=>{null==n.createCell||n.createCell(o,r,t,e)}),{}),o}(e,l,t,t.id)))),Go(e.options,"debugRows")),_getAllCellsByColumnId:Do((()=>[l.getAllCells()]),(e=>e.reduce(((e,t)=>(e[t.column.id]=t,e)),{})),Go(e.options,"debugRows"))};for(let t=0;t<e._features.length;t++){const r=e._features[t];null==r||null==r.createRow||r.createRow(l,e)}return l};function La(){return e=>Do((()=>[e.options.data]),(t=>{const r={rows:[],flatRows:[],rowsById:{}},n=function(t,o,a){void 0===o&&(o=0);const i=[];for(let c=0;c<t.length;c++){const s=Ca(e,e._getRowId(t[c],c,a),t[c],c,o,void 0,null==a?void 0:a.id);var l;r.flatRows.push(s),r.rowsById[s.id]=s,i.push(s),e.options.getSubRows&&(s.originalSubRows=e.options.getSubRows(t[c],c),null!=(l=s.originalSubRows)&&l.length&&(s.subRows=n(s.originalSubRows,o+1,s)))}return i};return r.rows=n(t),r}),Go(e.options,"debugTable",0,(()=>e._autoResetPageIndex())))}function Pa(){return e=>Do((()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter]),((t,r,n)=>{if(!t.rows.length||(null==r||!r.length)&&!n){for(let e=0;e<t.flatRows.length;e++)t.flatRows[e].columnFilters={},t.flatRows[e].columnFiltersMeta={};return t}const o=[],a=[];(null!=r?r:[]).forEach((t=>{var r;const n=e.getColumn(t.id);if(!n)return;const a=n.getFilterFn();a&&o.push({id:t.id,filterFn:a,resolvedValue:null!=(r=null==a.resolveFilterValue?void 0:a.resolveFilterValue(t.value))?r:t.value})}));const i=r.map((e=>e.id)),l=e.getGlobalFilterFn(),c=e.getAllLeafColumns().filter((e=>e.getCanGlobalFilter()));let s,u;n&&l&&c.length&&(i.push("__global__"),c.forEach((e=>{var t;a.push({id:e.id,filterFn:l,resolvedValue:null!=(t=null==l.resolveFilterValue?void 0:l.resolveFilterValue(n))?t:n})})));for(let e=0;e<t.flatRows.length;e++){const r=t.flatRows[e];if(r.columnFilters={},o.length)for(let e=0;e<o.length;e++){s=o[e];const t=s.id;r.columnFilters[t]=s.filterFn(r,t,s.resolvedValue,(e=>{r.columnFiltersMeta[t]=e}))}if(a.length){for(let e=0;e<a.length;e++){u=a[e];const t=u.id;if(u.filterFn(r,t,u.resolvedValue,(e=>{r.columnFiltersMeta[t]=e}))){r.columnFilters.__global__=!0;break}}!0!==r.columnFilters.__global__&&(r.columnFilters.__global__=!1)}}return function(e,t,r){return r.options.filterFromLeafRows?function(e,t,r){var n;const o=[],a={},i=null!=(n=r.options.maxLeafRowFilterDepth)?n:100,l=function(e,n){void 0===n&&(n=0);const c=[];for(let u=0;u<e.length;u++){var s;let m=e[u];const p=Ca(r,m.id,m.original,m.index,m.depth,void 0,m.parentId);if(p.columnFilters=m.columnFilters,null!=(s=m.subRows)&&s.length&&n<i){if(p.subRows=l(m.subRows,n+1),m=p,t(m)&&!p.subRows.length){c.push(m),a[m.id]=m,o.push(m);continue}if(t(m)||p.subRows.length){c.push(m),a[m.id]=m,o.push(m);continue}}else m=p,t(m)&&(c.push(m),a[m.id]=m,o.push(m))}return c};return{rows:l(e),flatRows:o,rowsById:a}}(e,t,r):function(e,t,r){var n;const o=[],a={},i=null!=(n=r.options.maxLeafRowFilterDepth)?n:100,l=function(e,n){void 0===n&&(n=0);const c=[];for(let u=0;u<e.length;u++){let m=e[u];if(t(m)){var s;if(null!=(s=m.subRows)&&s.length&&n<i){const e=Ca(r,m.id,m.original,m.index,m.depth,void 0,m.parentId);e.subRows=l(m.subRows,n+1),m=e}c.push(m),o.push(m),a[m.id]=m}}return c};return{rows:l(e),flatRows:o,rowsById:a}}(e,t,r)}(t.rows,(e=>{for(let t=0;t<i.length;t++)if(!1===e.columnFilters[i[t]])return!1;return!0}),e)}),Go(e.options,"debugTable",0,(()=>e._autoResetPageIndex())))}function _a(){return e=>Do((()=>[e.getState().sorting,e.getPreSortedRowModel()]),((t,r)=>{if(!r.rows.length||null==t||!t.length)return r;const n=e.getState().sorting,o=[],a=n.filter((t=>{var r;return null==(r=e.getColumn(t.id))?void 0:r.getCanSort()})),i={};a.forEach((t=>{const r=e.getColumn(t.id);r&&(i[t.id]={sortUndefined:r.columnDef.sortUndefined,invertSorting:r.columnDef.invertSorting,sortingFn:r.getSortingFn()})}));const l=e=>{const t=e.map((e=>({...e})));return t.sort(((e,t)=>{for(let n=0;n<a.length;n+=1){var r;const o=a[n],l=i[o.id],c=null!=(r=null==o?void 0:o.desc)&&r;let s=0;if(l.sortUndefined){const r=void 0===e.getValue(o.id),n=void 0===t.getValue(o.id);(r||n)&&(s=r&&n?0:r?l.sortUndefined:-l.sortUndefined)}if(0===s&&(s=l.sortingFn(e,t,o.id)),0!==s)return c&&(s*=-1),l.invertSorting&&(s*=-1),s}return e.index-t.index})),t.forEach((e=>{var t;o.push(e),null!=(t=e.subRows)&&t.length&&(e.subRows=l(e.subRows))})),t};return{rows:l(r.rows),flatRows:o,rowsById:r.rowsById}}),Go(e.options,"debugTable",0,(()=>e._autoResetPageIndex())))}function Ra(){return e=>Do((()=>[e.getState().expanded,e.getPreExpandedRowModel(),e.options.paginateExpandedRows]),((e,t,r)=>!t.rows.length||!0!==e&&!Object.keys(null!=e?e:{}).length?t:r?Ia(t):t),Go(e.options,"debugTable"))}function Ia(e){const t=[],r=e=>{var n;t.push(e),null!=(n=e.subRows)&&n.length&&e.getIsExpanded()&&e.subRows.forEach(r)};return e.rows.forEach(r),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function Aa(e){return e=>Do((()=>[e.getState().pagination,e.getPrePaginationRowModel(),e.options.paginateExpandedRows?void 0:e.getState().expanded]),((t,r)=>{if(!r.rows.length)return r;const{pageSize:n,pageIndex:o}=t;let{rows:a,flatRows:i,rowsById:l}=r;const c=n*o,s=c+n;let u;a=a.slice(c,s),u=e.options.paginateExpandedRows?{rows:a,flatRows:i,rowsById:l}:Ia({rows:a,flatRows:i,rowsById:l}),u.flatRows=[];const m=e=>{u.flatRows.push(e),e.subRows.length&&e.subRows.forEach(m)};return u.rows.forEach(m),u}),Go(e.options,"debugTable"))}function Ta(e,r){return e?function(e){return"function"==typeof e&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}(n=e)||"function"==typeof n||function(e){return"object"==typeof e&&"symbol"==typeof e.$$typeof&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}(n)?t.createElement(e,r):e:null;var n}function Fa(e){const r={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=t.useState((()=>({current:ja(r)}))),[o,a]=t.useState((()=>n.current.initialState));return n.current.setOptions((t=>({...t,...e,state:{...o,...e.state},onStateChange:t=>{a(t),null==e.onStateChange||e.onStateChange(t)}}))),n.current}const Ma=t.forwardRef((function({title:e,titleId:r,...n},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":r},n),e?t.createElement("title",{id:r},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99"}))})),Da=t.forwardRef((function({title:e,titleId:r,...n},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":r},n),e?t.createElement("title",{id:r},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.19 8.688a4.5 4.5 0 0 1 1.242 7.244l-4.5 4.5a4.5 4.5 0 0 1-6.364-6.364l1.757-1.757m13.35-.622 1.757-1.757a4.5 4.5 0 0 0-6.364-6.364l-4.5 4.5a4.5 4.5 0 0 0 1.242 7.244"}))})),Ga=t.forwardRef((function({title:e,titleId:r,...n},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":r},n),e?t.createElement("title",{id:r},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7.5 7.5h-.75A2.25 2.25 0 0 0 4.5 9.75v7.5a2.25 2.25 0 0 0 2.25 2.25h7.5a2.25 2.25 0 0 0 2.25-2.25v-7.5a2.25 2.25 0 0 0-2.25-2.25h-.75m-6 3.75 3 3m0 0 3-3m-3 3V1.5m6 9h.75a2.25 2.25 0 0 1 2.25 2.25v7.5a2.25 2.25 0 0 1-2.25 2.25h-7.5a2.25 2.25 0 0 1-2.25-2.25v-.75"}))}));var qa=["value","onChange","debounce"];function Va(){return Va=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Va.apply(null,arguments)}function Wa(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function za(t){var r=t.value,n=t.onChange,o=t.debounce,a=void 0===o?500:o,i=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.includes(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.includes(r)||{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(t,qa),l=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Wa(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Wa(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(r),2),c=l[0],s=l[1];return(0,e.useEffect)((function(){s(r)}),[r]),(0,e.useEffect)((function(){var e=setTimeout((function(){n(c)}),a);return function(){return clearTimeout(e)}}),[c]),wp.element.createElement("input",Va({},i,{value:c,onChange:function(e){return s(e.target.value)}}))}const Ba=t.forwardRef((function({title:e,titleId:r,...n},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":r},n),e?t.createElement("title",{id:r},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"}))})),Ua=t.forwardRef((function({title:e,titleId:r,...n},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":r},n),e?t.createElement("title",{id:r},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 15.75 7.5-7.5 7.5 7.5"}))})),Ha=t.forwardRef((function({title:e,titleId:r,...n},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":r},n),e?t.createElement("title",{id:r},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m8.25 4.5 7.5 7.5-7.5 7.5"}))})),$a=function(e){var t=e.table;return wp.element.createElement("thead",{className:"border-b border-gray-900/10 text-sm leading-6 text-gray-900"},t.getHeaderGroups().map((function(e){return wp.element.createElement("tr",{key:e.id},e.headers.map((function(e,t){return wp.element.createElement("th",{onClick:e.column.getToggleSortingHandler(),key:e.id,colSpan:e.colSpan,className:"py-2 font-bold select-none",style:{width:"".concat(e.getSize(),"px"),cursor:e.column.getCanSort()?"pointer":"default"}},e.isPlaceholder?null:wp.element.createElement("div",{className:"flex items-end leading-none capitalize"},Ta(e.column.columnDef.header,e.getContext()),wp.element.createElement("span",null,e.column.getIsSorted()?"desc"===e.column.getIsSorted()?wp.element.createElement(Ba,{className:"w-3 h-3"}):wp.element.createElement(Ua,{className:"w-3 h-3"}):e.column.getCanSort()?wp.element.createElement(Ha,{className:"w-3 h-3"}):"")))})))})))};function Za(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.filter(Boolean).join(" ")}const Ya=function(e){var t=e.row,r=e.loadingProductId,n=e.toggleExpanded,o=(t.original.type||"").toLowerCase(),a="variation"===o,i="variable"===o,l=t.original.id===r,c=t.getIsExpanded(),s=Za(a?"bg-sky-50":"",l?"bg-gray-100":"","py-4 wrap");return wp.element.createElement("tr",{key:t.id,className:Za(s,c?"bg-sky-300":"")},t.getVisibleCells().map((function(e,r){var o="select"===e.column.id,l="actions"===e.column.id;return o&&(i||a)?wp.element.createElement("td",{key:e.id,className:"py-4 ".concat(r===t.getVisibleCells().length-1?"text-right":"text-left")}):wp.element.createElement("td",{key:e.id,onClick:function(){o||l||n()},className:"py-4 wrap text-gray-600 ".concat(r===t.getVisibleCells().length-1?"text-right":"text-left"," ").concat(t.getCanExpand()&&"cursor-pointer"," ").concat(6===r?"text-wrap":""," ").concat(8===r?"whitespace-nowrap":"")},l&&i?wp.element.createElement(_t,{variant:"secondary"},"Pro only"):Ta(e.column.columnDef.cell,e.getContext()))})))},Ka=function(e){var t=e.table;return e.selectablePageRows,e.rowSelection,e.setRowSelection,wp.element.createElement("div",{className:"flex justify-between items-center px-4 py-2"},wp.element.createElement("div",{className:"flex items-center gap-2 "},wp.element.createElement("button",{className:"border rounded p-1",onClick:function(){return t.setPageIndex(0)},disabled:!t.getCanPreviousPage()},"<<"),wp.element.createElement("button",{className:"border rounded p-1",onClick:function(){return t.previousPage()},disabled:!t.getCanPreviousPage()},"<"),wp.element.createElement("button",{className:"border rounded p-1",onClick:function(){return t.nextPage()},disabled:!t.getCanNextPage()},">"),wp.element.createElement("button",{className:"border rounded p-1",onClick:function(){return t.setPageIndex(t.getPageCount()-1)},disabled:!t.getCanNextPage()},">>"),wp.element.createElement("span",{className:"flex items-center gap-1"},wp.element.createElement("div",null,"Page"),wp.element.createElement("strong",null,t.getState().pagination.pageIndex+1," of"," ",t.getPageCount())),wp.element.createElement("span",{className:"flex items-center gap-1"},"| Go to page:",wp.element.createElement("input",{type:"number",defaultValue:t.getState().pagination.pageIndex+1,onChange:function(e){var r=e.target.value?Number(e.target.value)-1:0;t.setPageIndex(r)},className:"border p-1 rounded w-16"})),wp.element.createElement("select",{value:t.getState().pagination.pageSize,onChange:function(e){t.setPageSize(Number(e.target.value))}},[10,20,30,40,50].map((function(e){return wp.element.createElement("option",{key:e,value:e},"Show ",e)})))))},Xa=function(t){var r=t.children,n=t.open,o=(t.onClose,t.className),a=t.backdrop,i=void 0===a||a,l=(0,e.useRef)(null);return n?wp.element.createElement("div",{className:"fixed top-0 left-0 right-0 bottom-0 flex items-center justify-start p-4 z-50",style:{marginLeft:"160px"}},i&&wp.element.createElement("div",{className:"absolute top-0 left-0 right-0 bottom-0 bg-black/70","aria-hidden":"true"}),wp.element.createElement("div",{ref:l,tabIndex:-1,className:Za("flex justify-center z-50 mx-auto",o),onClick:function(e){return e.stopPropagation()}},r)):null},Ja=t.forwardRef((function({title:e,titleId:r,...n},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":r},n),e?t.createElement("title",{id:r},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m11.25 9-3 3m0 0 3 3m-3-3h7.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))})),Qa=t.forwardRef((function({title:e,titleId:r,...n},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":r},n),e?t.createElement("title",{id:r},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m12.75 15 3-3m0 0-3-3m3 3h-7.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}));var ei=function(e){e.productsToImport;var t=e.rangeValue,r=e.dataToImport,n=e.handleStepChange,o=e.importProduct,a=e.importCount;return wp.element.createElement("div",null,wp.element.createElement("h4",{className:"text-base mb-4"},"Review"),wp.element.createElement("p",null,"You are about to import"," ",wp.element.createElement("span",{className:"font-semibold"},a)," products in batches of"," ",wp.element.createElement("span",{className:"font-semibold"},t),". Existing products will have their data updated, while new entries will be created for products not already in the system."),wp.element.createElement("div",{className:"mt-2"},wp.element.createElement("p",null,"You have chosen to import/sync the following:"),wp.element.createElement("ul",{className:"flex gap-2 mt-2 flex-wrap"},Object.keys(r).map((function(e,t){if(r[e])return wp.element.createElement("li",{key:r[e]+t,className:"p-2 border border-gray-300 uppercase text-xs font-semibold"},e)})))),wp.element.createElement("div",{className:"flex items-center mt-10 justify-end gap-2"},wp.element.createElement("button",{type:"button",onClick:function(){return n("backward")},className:"relative inline-flex items-center rounded-md bg-gray-400 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},wp.element.createElement(Ja,{className:"mr-1.5 h-4 w-4 text-white","aria-hidden":"true"}),wp.element.createElement("span",null,"Go back")),wp.element.createElement("button",{type:"button",onClick:function(){n("forward"),o()},className:"relative inline-flex items-center rounded-md bg-red-500 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},wp.element.createElement("span",null,"IMPORT"),wp.element.createElement(Qa,{className:"ml-1.5 h-4 w-4 text-white","aria-hidden":"true"}))))};const ti=t.forwardRef((function({title:e,titleId:r,...n},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":r},n),e?t.createElement("title",{id:r},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}));function ri(e){return ri="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ri(e)}function ni(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function oi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=ri(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=ri(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ri(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ai=function(t){var r=t.progress,n=t.importCount,o=t.isImporting,a=t.setIsDialogOpen,i=t.setCurrentStep,l=(0,e.useRef)(null);return(0,e.useEffect)((function(){l.current&&(l.current.scrollTop=l.current.scrollHeight)}),[r]),wp.element.createElement("div",null,wp.element.createElement("div",null,wp.element.createElement("div",{className:""},wp.element.createElement("div",{className:"h-4 bg-gray-200 w-full rounded-lg mt-2"},wp.element.createElement("div",{className:"h-full bg-blue-500 rounded-lg",style:{width:"".concat(r.filter((function(e){return"string"!=typeof e})).length/n*100,"%")}})),wp.element.createElement("div",{className:"text-sm text-gray-500 mt-1"},"Imported"," ",r.filter((function(e){return"string"!=typeof e&&"success"===e.status})).length," ","of ",n," products."," ",Number(r.filter((function(e){return"string"!=typeof e})).length/n*100).toFixed(1),"%")),wp.element.createElement("div",{ref:l,className:"bg-slate-950 p-4 rounded-xl max-h-52 overflow-y-auto overflow-x-hidden w-full flex flex-col gap-2 mt-2"},r.map((function(e,t){var r=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ni(Object(r),!0).forEach((function(t){oi(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ni(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},e);return delete r.variations,wp.element.createElement("p",{className:"break-words ".concat(e.status&&"success"===e.status?"text-green-500":e.status&&"failed"===e.status?"text-red-500":"text-blue-500"),key:e.square_id||t},JSON.stringify(r))}))),!o&&wp.element.createElement("div",{className:"flex flex-col items-center justify-center gap-2 py-4"},wp.element.createElement(Ht,{className:"w-12 h-12 text-green-500"}),wp.element.createElement("h3",{className:"text-xl text-green-500 font-semibold"},"Import complete!"),wp.element.createElement("p",{className:"font-semibold"},"You can now safely close this window."))),!o&&wp.element.createElement("div",{className:"flex items-center justify-end gap-2 mt-6"},wp.element.createElement("button",{type:"button",onClick:function(){a(!1),i(0)},className:"relative inline-flex items-center rounded-md bg-gray-400 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},wp.element.createElement(ti,{className:"mr-1.5 h-4 w-4 text-white","aria-hidden":"true"}),wp.element.createElement("span",null,"Close"))))};function ii(e){return ii="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ii(e)}function li(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ci(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?li(Object(r),!0).forEach((function(t){si(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):li(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function si(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=ii(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=ii(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ii(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ui=function(e){var t=e.dataToImport,r=e.setDataToImport,n=e.rangeValue,o=e.handleRangeChange,a=e.handleStepChange,i=e.setCurrentStep,l=e.setIsDialogOpen;return wp.element.createElement("div",null,wp.element.createElement("h4",{className:"text-base mb-4"},"Select the data you wish to import / sync:"),wp.element.createElement("fieldset",{className:"mb-3"},wp.element.createElement("legend",{className:"sr-only"},"data to sync"),wp.element.createElement("div",{className:"flex gap-x-6 gap-y-4 items-start flex-wrap"},wp.element.createElement("label",{htmlFor:"title",className:"flex items-center gap-1 leading-none"},wp.element.createElement("input",{type:"checkbox",checked:t.title,onChange:function(){return r(ci(ci({},t),{},{title:!t.title}))},id:"title",className:"h-full !m-0"}),"Title"),wp.element.createElement("label",{htmlFor:"SKU",className:"flex items-center gap-1 leading-none"},wp.element.createElement("input",{type:"checkbox",checked:t.sku,id:"SKU",className:"h-full !m-0",onChange:function(){return r(ci(ci({},t),{},{sku:!t.sku}))}}),"SKU"),wp.element.createElement("label",{htmlFor:"price",className:"flex items-center gap-1 leading-none"},wp.element.createElement("input",{type:"checkbox",id:"price",className:"h-full !m-0",checked:t.price,onChange:function(){return r(ci(ci({},t),{},{price:!t.price}))}}),"Price"),wp.element.createElement("label",{htmlFor:"description",className:"flex items-center gap-1 leading-none"},wp.element.createElement("input",{type:"checkbox",id:"description",className:"h-full !m-0",checked:!1}),"Description ",wp.element.createElement(_t,null)),wp.element.createElement("label",{htmlFor:"image",className:"flex items-center gap-1 leading-none"},wp.element.createElement("input",{type:"checkbox",id:"image",className:"h-full !m-0",checked:!1}),"Image ",wp.element.createElement(_t,null)),wp.element.createElement("label",{htmlFor:"categories",className:"flex items-center gap-1 leading-none"},wp.element.createElement("input",{type:"checkbox",id:"categories",className:"h-full !m-0",checked:!1}),"Categories ",wp.element.createElement(_t,null)),wp.element.createElement("label",{htmlFor:"stock",className:"flex items-center gap-1 leading-none"},wp.element.createElement("input",{type:"checkbox",id:"stock",className:"h-full !m-0",checked:t.stock,onChange:function(){return r(ci(ci({},t),{},{stock:!t.stock}))}}),"Stock"))),wp.element.createElement("p",null,"Existing products will have their data updated, while new entries will be created for products not already in the system."),wp.element.createElement("h4",{className:"text-base mt-4 mb-2"},"How many products to import in each batch?"),wp.element.createElement("p",null,"Increasing the number in each batch places a greater load on the server (especially when import images). If you encounter errors, consider reducing this value for better stability or disabling image import."),wp.element.createElement("div",{className:"relative mb-6 mt-3"},wp.element.createElement("label",{htmlFor:"labels-range-input",className:"sr-only"},"Labels range"),wp.element.createElement("input",{id:"labels-range-input",type:"range",value:n,onChange:o,step:5,min:"5",max:"50",className:"w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer"}),wp.element.createElement("span",{className:"text-sm text-gray-500 absolute start-0 -bottom-6"},"Min 5"),wp.element.createElement("span",{className:"text-sm text-gray-600 font-semibold absolute start-1/2 -translate-x-1/2 -bottom-6"},n),wp.element.createElement("span",{className:"text-sm text-gray-500 absolute end-0 -bottom-6"},"Max 50")),wp.element.createElement("div",{className:"flex items-center mt-10 justify-end gap-2"},wp.element.createElement("button",{type:"button",onClick:function(){i(0),l(!1)},className:"relative inline-flex items-center rounded-md bg-gray-400 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},wp.element.createElement("span",null,"Cancel"),wp.element.createElement(ti,{className:"ml-1.5 h-4 w-4 text-white","aria-hidden":"true"})),wp.element.createElement("button",{type:"button",onClick:function(){return a("forward")},className:"relative inline-flex items-center rounded-md bg-sky-500 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},wp.element.createElement("span",null,"Continue"),wp.element.createElement(Qa,{className:"ml-1.5 h-4 w-4 text-white","aria-hidden":"true"}))))},mi=function(e){var t=e.currentStep,r=e.rangeValue,n=e.dataToImport,o=e.handleStepChange,a=e.setCurrentStep,i=e.handleRangeChange,l=e.setDataToImport,c=e.importProduct,s=e.importCount,u=e.productsToImport,m=e.isImporting,p=e.setIsDialogOpen,f=e.progress;switch(t){case 0:return wp.element.createElement(ui,{dataToImport:n,setDataToImport:l,rangeValue:r,handleRangeChange:i,handleStepChange:o,setCurrentStep:a,setIsDialogOpen:p});case 1:return wp.element.createElement(ei,{progress:f,dataToImport:n,importProduct:c,importCount:s,handleStepChange:o,setCurrentStep:a,productsToImport:u,isImporting:m,rangeValue:r,setIsDialogOpen:p});case 2:return wp.element.createElement(ai,{progress:f,importCount:s,handleStepChange:o,setCurrentStep:a,isImporting:m,setIsDialogOpen:p});default:return wp.element.createElement("div",null,"Invalid step")}};function pi(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const fi=function(t){var r=t.isDialogOpen,n=t.setIsDialogOpen,o=t.progress,a=t.rangeValue,i=t.setRangeValue,l=t.setDataToImport,c=t.dataToImport,s=t.importProduct,u=t.productsToImport,m=t.importCount,p=t.isImporting,f=[{name:"Step 1",href:"#",status:"current"},{name:"Step 2",href:"#",status:"upcoming"},{name:"Step 3",href:"#",status:"upcoming"}],d=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return pi(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?pi(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(0),2),h=d[0],g=d[1];return wp.element.createElement(Xa,{open:r,onClose:function(){return n(!1)},className:"w-[40vw] max-w-[40vw] mx-auto bg-white p-6 rounded-xl"},wp.element.createElement("div",{className:"w-full"},wp.element.createElement("header",{className:"flex justify-between items-center gap-2 mb-4"},wp.element.createElement("h3",{className:"text-lg font-medium leading-6 text-gray-900"},"Import from Square"),wp.element.createElement("nav",{className:"flex items-center justify-center","aria-label":"Progress"},wp.element.createElement("p",{className:"text-sm font-medium"},"Step ",h+1," of ",f.length),wp.element.createElement("ol",{role:"list",className:"ml-8 flex items-center space-x-5"},f.map((function(e,t){return wp.element.createElement("li",{key:e.name},"complete"===e.status?wp.element.createElement("span",{className:"block h-2.5 w-2.5 rounded-full bg-sky-600 hover:bg-sky-900"},wp.element.createElement("span",{className:"sr-only"},e.name)):h===t?wp.element.createElement("span",{className:"relative flex items-center justify-center","aria-current":"step"},wp.element.createElement("span",{className:"absolute flex h-5 w-5 p-px","aria-hidden":"true"},wp.element.createElement("span",{className:"h-full w-full rounded-full bg-sky-200"})),wp.element.createElement("span",{className:"relative block h-2.5 w-2.5 rounded-full bg-sky-600","aria-hidden":"true"}),wp.element.createElement("span",{className:"sr-only"},e.name)):wp.element.createElement("span",{className:"block h-2.5 w-2.5 rounded-full bg-gray-200 hover:bg-gray-400"},wp.element.createElement("span",{className:"sr-only"},e.name)))}))))),wp.element.createElement(mi,{currentStep:h,rangeValue:a,dataToImport:c,handleStepChange:function(e){g((function(t){return"forward"===e&&t<f.length-1?t+1:"backward"===e&&t>0?t-1:t}))},setCurrentStep:g,handleRangeChange:function(e){i(Number(e.target.value))},importCount:m,productsToImport:u,setDataToImport:l,importProduct:s,isImporting:p,setIsDialogOpen:n,progress:o}),p&&wp.element.createElement("p",{className:"text-red-500 font-semibold text-center mt-2"},"Do not close this window, import will be cancelled")))};function di(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var hi=(0,e.createContext)({blockNavigation:!1,setBlockNavigation:function(){}}),gi=function(t){var r=t.children,n=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return di(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?di(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(!1),2),o=n[0],a=n[1];return wp.element.createElement(hi.Provider,{value:{blockNavigation:o,setBlockNavigation:a}},r)};function yi(e){return yi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},yi(e)}function vi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function wi(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?vi(Object(r),!0).forEach((function(t){bi(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vi(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function bi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=yi(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=yi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==yi(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xi(e){return function(e){if(Array.isArray(e))return Ei(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Ei(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ei(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ei(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var Si=["BIF","CLP","DJF","GNF","JPY","KMF","KRW","MGA","PYG","RWF","UGX","VND","VUV","XAF","XOF","XPF"];var ki=function(e){var t=e.isExpanded;return e.row.getCanExpand()?wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-4 h-4 ".concat(t?"rotate-90":"")},wp.element.createElement("polyline",{points:"9 18 15 12 9 6"})):wp.element.createElement(React.Fragment,null)},Ni=function(){return wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-gray-300"},wp.element.createElement("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),wp.element.createElement("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"}))},Oi=function(e){var t={false:{bgColor:"bg-red-100",textColor:"text-red-700",fillColor:"fill-red-500",text:"Not imported"},partial:{bgColor:"bg-yellow-100",textColor:"text-yellow-700",fillColor:"fill-yellow-500",text:"Partial"},true:{bgColor:"bg-green-100",textColor:"text-green-700",fillColor:"fill-green-500",text:"Imported"}},r=t[e.status]||t.false,n=r.bgColor,o=r.textColor,a=r.fillColor,i=r.text;return wp.element.createElement("span",{className:"inline-flex items-center gap-x-1.5 rounded-md px-2 py-1 text-xs font-medium ".concat(n," ").concat(o)},wp.element.createElement("svg",{className:"h-1.5 w-1.5 ".concat(a),viewBox:"0 0 6 6","aria-hidden":"true"},wp.element.createElement("circle",{cx:"3",cy:"3",r:"3"})),i)},ji=function(e){var t=e.value,r=t?Object.values(t):[];return wp.element.createElement("div",{className:"group relative w-10 h-10"},r.map((function(e,t){return wp.element.createElement("img",{key:t,src:e,alt:"",width:40,height:40,className:Za("w-10 h-10 rounded object-cover flex items-center gap-2 shadow top-0 absolute transition-transform duration-300",0===t&&r.length>1&&"group-hover:-translate-y-2 rotate-12 group-hover:rotate-[-16deg]",1===t&&r.length>1&&"group-hover:translate-y-2 group-hover:rotate-[16deg]")})})))},Ci=["indeterminate","className"];function Li(){return Li=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Li.apply(null,arguments)}const Pi=function(e){var r=e.indeterminate,n=e.className,o=void 0===n?"":n,a=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.includes(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.includes(r)||{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,Ci),i=(0,t.useRef)(null);return(0,t.useEffect)((function(){"boolean"==typeof r&&(i.current.indeterminate=!a.checked&&r)}),[r,a.checked]),wp.element.createElement("input",Li({type:"checkbox",ref:i,className:o+" cursor-pointer"},a))};var _i=function(e,t,r,n,o){var a=!o||e.original.present_at_location_ids&&e.original.present_at_location_ids.includes(n),i=!!e.getValue(t)&&e.getValue(t).toString().toLowerCase().includes(r.toLowerCase()),l=!!e.subRows&&e.subRows.some((function(e){var n=e.getValue(t);return!!n&&n.toString().toLowerCase().includes(r.toLowerCase())}));i&&e.subRows&&e.subRows.forEach((function(e){e.isMatch=!0}));var c=i||l;return!(!i||!e.subRows)||c&&a},Ri=function(e,t,r){if(t=Array.isArray(t)?t:[t],!r)return!0;var n=r.trim().toLowerCase(),o=function(e){var r=t.some((function(t){var r=e.getValue(t);return"string"==typeof r&&r.toLowerCase().includes(n)})),a=!!e.parent&&o(e.parent);return r||a};return e.depth>0||o(e)},Ii=function(e,t,r){return!r||(!(n=e)||!0!==n.getValue(t));var n},Ai=function(e,t,r){return!r||(!(n=e)||!0!==n.getValue(t));var n},Ti=function(e,t,r){if(!r&&!1!==r)return!0;var n="true"===r||"false"!==r&&r;return e.getValue(t)===n};const Fi=function(e){var t=e.content,r=e.children;return wp.element.createElement("div",{className:"relative flex justify-center group"},r,wp.element.createElement("div",{className:" absolute  hidden bottom-full  mb-2  w-max rounded  bg-gray-800 px-2  py-1  text-sm  text-white  z-50 right-full group-hover:block  transition-opacity "},t))},Mi=(...e)=>e.filter(((e,t,r)=>Boolean(e)&&""!==e.trim()&&r.indexOf(e)===t)).join(" ").trim();var Di={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const Gi=(0,t.forwardRef)((({color:e="currentColor",size:r=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:a="",children:i,iconNode:l,...c},s)=>(0,t.createElement)("svg",{ref:s,...Di,width:r,height:r,stroke:e,strokeWidth:o?24*Number(n)/Number(r):n,className:Mi("lucide",a),...c},[...l.map((([e,r])=>(0,t.createElement)(e,r))),...Array.isArray(i)?i:[i]]))),qi=((e,r)=>{const n=(0,t.forwardRef)((({className:n,...o},a)=>{return(0,t.createElement)(Gi,{ref:a,iconNode:r,className:Mi(`lucide-${i=e,i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,n),...o});var i}));return n.displayName=`${e}`,n})("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);function Vi(e){return Vi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Vi(e)}function Wi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function zi(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Wi(Object(r),!0).forEach((function(t){Bi(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Wi(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Bi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=Vi(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=Vi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Vi(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Ui=function(t,r,n,o,a,i){var l=r.expanded,c=r.setExpanded,s=r.sorting,u=r.setSorting,m=r.globalFilter,p=r.setGlobalFilter,f=r.isImporting,d=r.setProductsToImport,h=r.setIsDialogOpen,g=r.rowSelection,y=r.setRowSelection,v=(r.selectableRows,r.setSelectableRows,Dr().settings),w=(0,e.useMemo)((function(){return function(e){return e?e.filter((function(e){return null!==e})).map((function(e){var t,r,n,o,a,i,l,c,s,u,m,p=null===(t=e.item_data)||void 0===t||null===(t=t.variations)||void 0===t?void 0:t[0],f="USD";null!=p&&null!==(r=p.item_variation_data)&&void 0!==r&&null!==(r=r.price_money)&&void 0!==r&&r.currency&&(f=p.item_variation_data.price_money.currency);var d,h,g,y={USD:"$",CAD:"CA$",EUR:"€",GBP:"£",AUD:"A$",NZD:"NZ$",CHF:"CHF",JPY:"¥",CNY:"¥",HKD:"HK$",SGD:"S$",SEK:"kr",NOK:"kr",DKK:"kr",PLN:"zł",HUF:"Ft",CZK:"Kč",ILS:"₪",INR:"₹",RUB:"₽",ZAR:"R",BRL:"R$",MXN:"$",TRY:"₺",MYR:"RM",PHP:"₱",THB:"฿",KRW:"₩",AED:"د.إ",SAR:"ر.س",BHD:".د.ب",KWD:"د.ك"}[d=f]||d,v=((null===(n=e.item_data)||void 0===n?void 0:n.variations)||[]).map((function(t){var r=isNaN(parseInt(t.inventory_count))?0:parseInt(t.inventory_count),n=function(e){var t,r=null==e||null===(t=e.item_variation_data)||void 0===t?void 0:t.price_money;if(!r)return 0;var n=r.currency,o=r.amount;return Si.includes(n)?o:o/100}(t);return{sku:t.item_variation_data.sku,name:t.item_variation_data.name,type:"variation",price:n,status:t.imported,stock:r,id:t.id,woocommerce_product_id:t.woocommerce_product_id||null,is_archived:e.is_archived||!1,visibility:e.visibility||!0}})),w=((null===(o=e.item_data)||void 0===o?void 0:o.variations)||[]).map((function(e){var t,r=null==e||null===(t=e.item_variation_data)||void 0===t?void 0:t.price_money;if(!r)return 0;var n=r.currency,o=r.amount;return Si.includes(n)?o:o/100})),b=((null===(a=e.item_data)||void 0===a?void 0:a.variations)||[]).map((function(e){return isNaN(parseInt(e.inventory_count))?0:parseInt(e.inventory_count)}));w.length>0?(h=Math.min.apply(Math,xi(w)),g=Math.max.apply(Math,xi(w))):h=g=0;var x=b.length?Math.min.apply(Math,xi(b)):0,E=b.length?Math.max.apply(Math,xi(b)):0,S=null!==(i=e.item_data)&&void 0!==i&&i.categories?e.item_data.categories.map((function(e){return e.name})):[];return wi(wi({sku:Array.isArray(null===(l=e.item_data)||void 0===l?void 0:l.variations)&&e.item_data.variations.length>0&&(null===(c=e.item_data.variations[0])||void 0===c||null===(c=c.item_variation_data)||void 0===c?void 0:c.sku)||"",id:e.id,name:(null===(s=e.item_data)||void 0===s?void 0:s.name)||"",present_at_location_ids:e.present_at_location_ids,stock:x===E?"".concat(x):"".concat(x," - ").concat(E),image:null!==(u=e.item_data)&&void 0!==u&&u.images?e.item_data.images:null,woocommerce_product_id:e.woocommerce_product_id||null,type:((null===(m=e.item_data)||void 0===m||null===(m=m.variations)||void 0===m?void 0:m.length)||0)>1?"Variable":"Simple",price:h===g?"".concat(y).concat(h):"".concat(y).concat(h," - ").concat(y).concat(g),categories:S,status:e.imported},v.length>1&&{subRows:v}),{},{is_archived:e.is_archived||!1,visibility:e.visibility,invalidVariable:e.invalid_variable_product||!1})})):[]}(t)}),[t]),b=function(e){if(e.parentId){var t=e.getParentRow().original;return!(!t.invalidVariable||t.invalidVariable&&v.squareAuto.attributesDisabled)}var r;if(e.original.invalidVariable)return null===(r=v.squareAuto)||void 0===r||!r.attributesDisabled},x=(0,e.useMemo)((function(){return[{id:"expander",size:50,cell:function(e){var t=e.row;return wp.element.createElement(React.Fragment,null,t.getCanExpand()?wp.element.createElement("button",{type:"button"},wp.element.createElement(ki,{isExpanded:t.getIsExpanded(),row:t})):null)}},{accessorKey:"visibility",header:"Visibility",accessorFn:function(e){return e.visibility},filterFn:"visibilityFilter",enableSorting:!1},{accessorKey:"is_archived",header:"Is Archived",accessorFn:function(e){return e.is_archived},filterFn:"archivedFilter",enableSorting:!1},{accessorKey:"id",header:function(){return"id"},show:!1},{accessorKey:"sku",header:function(){return"SKU"},canSort:!0,size:100,enableResizing:!1},{accessorKey:"image",header:function(){return""},enableSorting:!1,size:50,cell:function(e){var t=(0,e.getValue)();return t?wp.element.createElement(ji,{value:t}):wp.element.createElement(Ni,null)}},{accessorKey:"name",header:function(){return"Name"},size:250,canSort:!0,cell:function(e){var t=e.getValue,r=e.row,n=t();return wp.element.createElement("div",null,wp.element.createElement("p",null,n),wp.element.createElement("p",{className:"text-xs text-gray-500"},"ID: ",r.original.id))}},{accessorKey:"type",size:80,header:function(){return"Type"},canSort:!0},{accessorKey:"price",size:80,canSort:!0,header:function(){return"Price"}},{size:70,accessorKey:"stock",canSort:!0,header:function(){return"Stock"}},{accessorKey:"categories",header:function(){return"Categories"},size:200,canSort:!0,cell:function(e){var t,r=(0,e.getValue)();return r&&r.length>0?wp.element.createElement("div",null,(t=r,Array.isArray(t)&&0!==t.length?t.join(", "):"")):""},filterFn:"includesCategoryFilter"},{accessorKey:"status",canSort:!0,size:120,header:function(){return"Status"},cell:function(e){var t=(0,e.getValue)();return wp.element.createElement(Oi,{status:t})},filterFn:"statusFilter"},{id:"actions",size:200,cell:function(e){var t,r,n=e.row;if(n.parentId)return wp.element.createElement(React.Fragment,null);var o=(null===(t=n.original.subRows)||void 0===t?void 0:t.filter((function(e){var t;return null===(t=n.subRows)||void 0===t?void 0:t.find((function(t){return t.id===e.id&&t.getIsSelected()}))})))||[],a=zi(zi({},n.original),{},{subRows:o.length>0?o:n.original.subRows});return wp.element.createElement("div",{className:"flex items-center justify-end gap-2 w-[200px]"},!n.original.invalidVariable||null!==(r=v.squareAuto)&&void 0!==r&&r.attributesDisabled?wp.element.createElement(React.Fragment,null,n.original.woocommerce_product_id&&wp.element.createElement("a",{className:"rounded px-2 py-1 text-xs font-semibold text-sky-500 border-sky-500 border hover:border-sky-200 shadow-sm hover:text-sky-200 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-purple-600 cursor-pointer",href:"/wp-admin/post.php?post=".concat(n.original.woocommerce_product_id,"&action=edit"),target:"_blank"},"View Woo Product"),wp.element.createElement("button",{type:"button",onClick:function(){d([a]),h(!0)},disabled:f,className:"rounded bg-sky-600 px-2 py-1 text-xs font-semibold text-white shadow-sm hover:bg-sky-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-600"},!0===n.original.status?"Sync":"Import")):wp.element.createElement("div",{className:"text-wrap"},wp.element.createElement(Fi,{content:wp.element.createElement("p",{className:"max-w-40 text-wrap"},"Invalid variable product, see guide ",wp.element.createElement("a",{className:"text-sky-500",target:"_blank",href:"https://squaresyncforwoo.com/documentation/how-to-properly-import-variations/"},"here"),". Or turn off attribute creation in plugins product settings.")},wp.element.createElement(qi,{className:"text-orange-500 size-5"}))))}},{id:"select",header:function(e){var t=e.table.getFilteredRowModel().rows.filter((function(e){var t;return e.getCanSelect()&&!(e.original.invalidVariable&&(null===(t=v.squareAuto)||void 0===t||!t.attributesDisabled))})),r=t.every((function(e){return e.getIsSelected()})),n=t.some((function(e){return e.getIsSelected()}))&&!r;return wp.element.createElement("div",{className:"flex justify-center items-center w-full gap-2 relative"},wp.element.createElement(Pi,{checked:r,indeterminate:n,onChange:function(e){t.forEach((function(t){t.toggleSelected(e.target.checked)}))}}))},cell:function(e){var t,r=e.row,n=e.table;return wp.element.createElement("div",{className:"px-1"},wp.element.createElement(Pi,{checked:!(r.original.invalidVariable&&(null===(t=v.squareAuto)||void 0===t||!t.attributesDisabled))&&r.getIsSelected(),disabled:b(r),indeterminate:r.getIsSomeSelected(),onChange:function(e){if(r.depth>0&&e.target.checked){var t=r.getParentRow();null==t||t.toggleSelected(!0),n.setRowSelection((function(t){return zi(zi({},t),{},Bi({},r.id,e.target.checked))}))}else if(0===r.depth&&e.target.checked){var o;r.toggleSelected(e.target.checked),null===(o=r.subRows)||void 0===o||o.forEach((function(t){n.setRowSelection((function(r){return zi(zi({},r),{},Bi({},t.id,e.target.checked))}))}))}else if(0!==r.depth||e.target.checked)n.setRowSelection((function(t){return zi(zi({},t),{},Bi({},r.id,e.target.checked))}));else{var a;r.toggleSelected(e.target.checked),null===(a=r.subRows)||void 0===a||a.forEach((function(t){n.setRowSelection((function(r){return zi(zi({},r),{},Bi({},t.id,e.target.checked))}))}))}}}))}},{accessorKey:"present_at_location_ids",header:"Location IDs",accessorFn:function(e){return e.present_at_location_ids?e.present_at_location_ids.join(","):""},filterFn:function(e,t,r){return function(e,t,r,n){if(!n)return!0;if(0===e.depth){var o=e.getValue(t);return 0===o.length||o.includes(r)}return!0}(e,t,r,o)},enableSorting:!1,columnVisibility:!1}]}),[]),E=(0,e.useMemo)((function(){return function(e,t,r){return Ri(e,t,r)}}),[n,o,a,i]),S=function(e,t,r){var n=e.getValue(t);return!!Array.isArray(n)&&n.includes(r)};return(0,e.useMemo)((function(){return{data:w,columns:x,state:{expanded:l,sorting:s,columnVisibility:{id:!1,present_at_location_ids:!1,is_archived:!1,visibility:!1},globalFilter:m,rowSelection:g},filterFns:{visibilityFilter:Ii,archivedFilter:Ai,statusFilter:Ti,includesCategoryFilter:S,searchFilterFn:function(e,t,r){return!!Array.isArray(t)&&Ri(e,t,r)}},globalFilterFn:Ri,getSubRows:function(e){return e.subRows||[]},getCoreRowModel:La(),getFilteredRowModel:Pa(),getSortedRowModel:_a(),getExpandedRowModel:Ra(),getPaginationRowModel:Aa(),onExpandedChange:c,onGlobalFilterChange:p,autoResetPageIndex:!1,enableRowSelection:!0,getRowId:function(e){return e.id}}}),[w,x,l,s,m,c,u,p,g,y,E,n,o,a,i])};function Hi(e){return Hi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Hi(e)}function $i(){$i=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var a=t&&t.prototype instanceof y?t:y,i=Object.create(a.prototype),l=new P(n||[]);return o(i,"_invoke",{value:O(e,r,l)}),i}function m(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,i,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,i)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,i,l){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Hi(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,i,l)}),(function(e){r("throw",e,i,l)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return r("throw",e,i,l)}))}l(c.arg)}var a;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,r,n){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=j(l,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=m(t,r,n);if("normal"===s.type){if(o=n.done?h:f,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=h,n.method="throw",n.arg=s.arg)}}}function j(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,j(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=m(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(Hi(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,l,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},k(S),s(S,c,"Generator"),s(S,i,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=_,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return l.type="throw",l.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],l=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:_(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function Zi(e,t,r,n,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,o)}function Yi(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){Zi(a,n,o,i,l,"next",e)}function l(e){Zi(a,n,o,i,l,"throw",e)}i(void 0)}))}}function Ki(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Xi(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Xi(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Xi(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Ji(e){return Ji="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ji(e)}function Qi(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=ol(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var _n=0,n=function(){};return{s:n,n:function(){return _n>=e.length?{done:!0}:{done:!1,value:e[_n++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,i=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){i=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(i)throw o}}}}function el(){el=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var a=t&&t.prototype instanceof y?t:y,i=Object.create(a.prototype),l=new P(n||[]);return o(i,"_invoke",{value:O(e,r,l)}),i}function m(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,i,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,i)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,i,l){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Ji(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,i,l)}),(function(e){r("throw",e,i,l)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return r("throw",e,i,l)}))}l(c.arg)}var a;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,r,n){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=j(l,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=m(t,r,n);if("normal"===s.type){if(o=n.done?h:f,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=h,n.method="throw",n.arg=s.arg)}}}function j(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,j(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=m(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(Ji(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,l,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},k(S),s(S,c,"Generator"),s(S,i,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=_,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return l.type="throw",l.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],l=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:_(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function tl(e,t,r,n,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,o)}function rl(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){tl(a,n,o,i,l,"next",e)}function l(e){tl(a,n,o,i,l,"throw",e)}i(void 0)}))}}function nl(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(e,t)||ol(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ol(e,t){if(e){if("string"==typeof e)return al(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?al(e,t):void 0}}function al(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const il=function(t){var r=t.setIsAutoMatchOpen,n=t.inventory,o=nl((0,e.useState)("sku"),2),a=o[0],i=o[1],l=nl((0,e.useState)(!1),2),c=l[0],s=l[1],u=nl((0,e.useState)(""),2),m=u[0],p=u[1],f=function(e,t){for(var r=[],n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r},d=function(){var e=rl(el().mark((function e(t,r){return el().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,zt({path:"/sws/v1/matcher",method:"POST",data:{match_key:r,inventory:t}});case 3:e.next=8;break;case 5:e.prev=5,e.t0=e.catch(0),console.error("Error sending batch:",e.t0);case 8:case"end":return e.stop()}}),e,null,[[0,5]])})));return function(_x,t){return e.apply(this,arguments)}}(),h=function(){var e=rl(el().mark((function e(){var t,r,o,i;return el().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:s(!0),t=f(n,100),r=Qi(t),e.prev=4,r.s();case 6:if((o=r.n()).done){e.next=12;break}return i=o.value,e.next=10,d(i,a);case 10:e.next=6;break;case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(4),r.e(e.t0);case 17:return e.prev=17,r.f(),e.finish(17);case 20:p("Auto matcher complete, reload inventory table to see results"),s(!1);case 22:case"end":return e.stop()}}),e,null,[[4,14,17,20]])})));return function(){return e.apply(this,arguments)}}();return wp.element.createElement("div",{className:"w-[40vw] max-w-[40vw] mx-auto bg-white p-6 rounded-xl"},wp.element.createElement("div",{className:"w-full"},wp.element.createElement("header",{className:"flex justify-between items-center gap-2 mb-4"},wp.element.createElement("h3",{className:"text-lg font-medium leading-6 text-gray-900"},"Auto Matcher"))),wp.element.createElement("p",null,"Automatically link your existing WooCommerce products with Square using the SKU matcher. Products that are already linked will be skipped to avoid duplication. For the best results, ensure your WooCommerce product structure aligns with Square—for example, Square variations should correspond to WooCommerce variable products. Make sure each product has a unique SKU, as duplicates may cause issues with automatic syncing."),wp.element.createElement("p",{className:"text-sm font-semibold mt-3"},"Match via:"),wp.element.createElement("select",{className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 mt-2 !pr-10",value:a,onChange:function(e){return i(e.target.value)}},wp.element.createElement("option",{value:"sku"},"SKU")),m&&wp.element.createElement("p",{className:"text-sky-500 mt-4"},m),c?wp.element.createElement("div",{className:"flex items-center mt-10 justify-end gap-2"},wp.element.createElement("button",{type:"button",className:"relative inline-flex items-center rounded-md bg-sky-500 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400",disabled:""},wp.element.createElement("svg",{className:"animate-spin -ml-1 mr-3 h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},wp.element.createElement("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),wp.element.createElement("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})),"Processing...")):wp.element.createElement("div",{className:"flex items-center mt-10 justify-end gap-2"},wp.element.createElement("button",{type:"button",onClick:function(){return r(!1)},className:"relative inline-flex items-center rounded-md bg-gray-400 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},wp.element.createElement("span",null,"Close"),wp.element.createElement(ti,{className:"ml-1.5 h-4 w-4 text-white","aria-hidden":"true"})),wp.element.createElement("button",{type:"button",onClick:h,className:"relative inline-flex items-center rounded-md bg-sky-500 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},wp.element.createElement("span",null,"Start matching"),wp.element.createElement(Qa,{className:"ml-1.5 h-4 w-4 text-white","aria-hidden":"true"}))))};function ll(e){return ll="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ll(e)}function cl(){cl=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var a=t&&t.prototype instanceof y?t:y,i=Object.create(a.prototype),l=new P(n||[]);return o(i,"_invoke",{value:O(e,r,l)}),i}function m(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,i,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,i)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,i,l){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==ll(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,i,l)}),(function(e){r("throw",e,i,l)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return r("throw",e,i,l)}))}l(c.arg)}var a;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,r,n){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=j(l,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=m(t,r,n);if("normal"===s.type){if(o=n.done?h:f,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=h,n.method="throw",n.arg=s.arg)}}}function j(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,j(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=m(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(ll(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,l,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},k(S),s(S,c,"Generator"),s(S,i,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=_,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return l.type="throw",l.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],l=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:_(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function sl(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ul(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?sl(Object(r),!0).forEach((function(t){ml(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):sl(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ml(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=ll(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=ll(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ll(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function pl(e,t,r,n,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,o)}function fl(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){pl(a,n,o,i,l,"next",e)}function l(e){pl(a,n,o,i,l,"throw",e)}i(void 0)}))}}function dl(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(e,t)||hl(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function hl(e,t){if(e){if("string"==typeof e)return gl(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?gl(e,t):void 0}}function gl(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}window.lodash;const yl=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,r=dl((0,t.useState)(null),2),n=r[0],o=r[1],a=dl((0,t.useState)(!0),2),i=a[0],l=a[1],c=dl((0,t.useState)(!1),2),s=c[0],u=c[1],m=dl((0,t.useState)(""),2),p=m[0],f=m[1],d=dl((0,t.useState)(""),2),h=d[0],g=d[1],y=dl((0,t.useState)(""),2),v=y[0],w=y[1],b=dl((0,t.useState)(""),2),x=b[0],E=b[1],S=dl((0,t.useState)(""),2),k=S[0],N=S[1],O=dl((0,t.useState)(""),2),j=O[0],C=O[1],L=dl((0,t.useState)([]),2),P=L[0],_=L[1],R=dl((0,t.useState)({pageIndex:0,pageSize:e,total:0,totalPages:0,importable:0}),2),I=R[0],A=R[1],T=dl((0,t.useState)([]),2),M=T[0],D=T[1],G=(0,t.useRef)(!0),q=(0,t.useCallback)(fl(cl().mark((function e(){var t,r,n,a,i,c,u,m,d,y,b,S,O,L,P,_,R,T,D,G,q,V,W,z,B,U,H,$,Z,Y,K,X,J,Q=arguments;return cl().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=(t=Q.length>0&&void 0!==Q[0]?Q[0]:{}).pageIndex,n=void 0===r?I.pageIndex:r,a=t.pageSize,i=void 0===a?I.pageSize:a,c=t.search,u=void 0===c?p:c,m=t.sortBy,d=void 0===m?"":m,y=t.sortOrder,b=void 0===y?"":y,S=t.category,O=void 0===S?h:S,L=t.status,P=void 0===L?v:L,_=t.ecom,R=void 0===_?k:_,T=t.archive,D=void 0===T?j:T,G=t.location,q=void 0===G?x:G,!s){e.next=3;break}return e.abrupt("return");case 3:return l(!0),e.prev=4,V=n+1,z=b,!(W=d)&&M.length>0&&(W=M[0].id,z=M[0].desc?"desc":"asc"),B={search:u,page:V.toString(),per_page:i.toString()},W&&(B.orderby=W,B.order=z),O&&(B.category=O),P&&(B.status=P),R&&(B.ecom=R),D&&(B.archive=D),q&&(B.location=q),U=new URLSearchParams(B).toString(),e.next=19,zt({path:"/sws/v1/square-inventory/saved-inventory/search?".concat(U),method:"GET",parse:!1});case 19:return H=e.sent,e.next=22,H.json();case 22:$=e.sent,o($),Z=H.headers.get("X-WP-Total"),Y=H.headers.get("X-SWS-Importable"),K=parseInt(Z||"0",10),X=parseInt(Y||"0",10),J=Math.ceil(K/i),f(u),g(O),w(P),C(D),E(q),N(R),A((function(e){return ul(ul({},e),{},{pageIndex:n,pageSize:i,total:K,totalPages:J,importable:X})})),e.next=42;break;case 38:e.prev=38,e.t0=e.catch(4),console.error("Error fetching inventory:",e.t0),F.error("Error fetching inventory. See console for details.");case 42:return e.prev=42,l(!1),e.finish(42);case 45:case"end":return e.stop()}}),e,null,[[4,38,42,45]])}))),[I,p,M,h,v]),V=(0,t.useCallback)((function(e){G.current&&(G.current=!1),f(e),A((function(e){return ul(ul({},e),{},{pageIndex:0})})),q({pageIndex:0,pageSize:I.pageSize,search:e})}),[q,I.pageSize]),W=(0,t.useCallback)(fl(cl().mark((function e(){var t,r,n,a,i,c,s,m,p=arguments;return cl().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=p.length>0&&void 0!==p[0]&&p[0],u(!0),l(!0),e.prev=3,e.next=6,zt({path:"/sws/v1/square-inventory/?force=".concat(t,"&per_page=").concat(I.pageSize),parse:!1});case 6:if(r=e.sent,t){e.next=12;break}return e.next=10,r.json();case 10:(n=e.sent).loading?(u(!0),l(!0)):(o(n.data),a=r.headers.get("X-WP-Total"),i=r.headers.get("X-WP-TotalPages"),c=parseInt(a||"0",10),s=parseInt(i||"0",10),A((function(e){return ul(ul({},e),{},{pageIndex:0,pageSize:I.pageSize,total:c,totalPages:s})})),u(!1),l(!1));case 12:m=function(){var e=fl(cl().mark((function e(){var t,r,n,a;return cl().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=0,r=100,n=cl().mark((function e(){var r,n,a,i,c;return cl().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,zt({path:"/sws/v1/square-inventory/saved-inventory/",parse:!1});case 3:return r=e.sent,e.next=6,r.json();case 6:if(!(n=e.sent).finished){e.next=17;break}return u(!1),l(!1),o(n.inventory||[]),a=r.headers.get("X-WP-Total"),i=parseInt(a||"0",10),c=Math.ceil(i/I.pageSize),f(""),A((function(e){return ul(ul({},e),{},{pageIndex:0,total:i,totalPages:c})})),e.abrupt("return",{v:void 0});case 17:e.next=22;break;case 19:e.prev=19,e.t0=e.catch(0),console.error("Error polling:",e.t0);case 22:return t++,e.next=25,new Promise((function(e){return setTimeout(e,5e3)}));case 25:case"end":return e.stop()}}),e,null,[[0,19]])}));case 4:if(!(t<r)){e.next=11;break}return e.delegateYield(n(),"t0",6);case 6:if(!(a=e.t0)){e.next=9;break}return e.abrupt("return",a.v);case 9:e.next=4;break;case 11:F.error("Polling timed out. Please try again.");case 12:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),m(),e.next=22;break;case 16:e.prev=16,e.t0=e.catch(3),console.error("Error triggering inventory update:",e.t0),F.error("Error triggering inventory update."),u(!1),l(!1);case 22:case"end":return e.stop()}}),e,null,[[3,16]])}))),[]),z=(0,t.useCallback)((function(e){g(e),A((function(e){return ul(ul({},e),{},{pageIndex:0})})),q({pageIndex:0,category:e,status:v,location:x,archive:j,ecom:k})}),[q,v]),B=(0,t.useCallback)((function(e){w(e),A((function(e){return ul(ul({},e),{},{pageIndex:0})})),q({pageIndex:0,category:h,status:e,location:x,archive:j,ecom:k})}),[q,h]),U=(0,t.useCallback)((function(e){E(e),A((function(e){return ul(ul({},e),{},{pageIndex:0})})),q({pageIndex:0,category:h,status:v,location:e,archive:j,ecom:k})}),[q,x]),H=(0,t.useCallback)((function(e){C(e),A((function(e){return ul(ul({},e),{},{pageIndex:0})})),q({pageIndex:0,category:h,status:v,location:x,archive:e,ecom:k})}),[q,j]),$=(0,t.useCallback)((function(e){N(e),A((function(e){return ul(ul({},e),{},{pageIndex:0})})),q({pageIndex:0,category:h,status:v,location:x,archive:j,ecom:e})}),[q,k]),Z=(0,t.useCallback)(fl(cl().mark((function e(){var t,r;return cl().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,zt({path:"/sws/v1/square-inventory/categories",method:"GET",parse:!1});case 3:return t=e.sent,e.next=6,t.json();case 6:(r=e.sent)&&Array.isArray(r.categories)?_(r.categories):_([]),e.next=14;break;case 10:e.prev=10,e.t0=e.catch(0),console.error("Error fetching categories:",e.t0),F.error("Error fetching categories. See console for details.");case 14:case"end":return e.stop()}}),e,null,[[0,10]])}))),[]);(0,t.useEffect)((function(){Z()}),[Z]);var Y=(0,t.useMemo)((function(){return P&&Array.isArray(P)?function(e){return function(e){if(Array.isArray(e))return gl(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||hl(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(P).sort((function(e,t){return"string"==typeof e&&"string"==typeof t?e.localeCompare(t):e.name&&t.name?e.name.localeCompare(t.name):0})):[]}),[P]);return(0,t.useEffect)((function(){W(!1)}),[]),(0,t.useEffect)((function(){q()}),[I.pageSize,I.pageIndex,M]),{inventory:n,categories:P,categoryOptions:Y,inventoryLoading:i,polling:s,pagination:I,searchTerm:p,categoryFilter:h,statusFilter:v,sorting:M,ecomFilter:k,locationFilter:x,archiveFilter:j,setPagination:A,setSorting:D,setSearchTerm:f,setCategoryFilter:g,setStatusFilter:w,setArchiveFilter:C,setLocationFilter:E,setEcomFilter:N,fetchInventory:q,handleSearch:V,changeCategory:z,changeStatus:B,changeLocation:U,changeEcom:$,changeArchive:H,triggerAndPollInventory:W,fetchCategories:Z}};function vl(e){return vl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vl(e)}function wl(e){return function(e){if(Array.isArray(e))return Nl(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||kl(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function bl(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function xl(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?bl(Object(r),!0).forEach((function(t){El(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):bl(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function El(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=vl(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=vl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==vl(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Sl(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(e,t)||kl(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function kl(e,t){if(e){if("string"==typeof e)return Nl(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Nl(e,t):void 0}}function Nl(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var Ol="undefined"==typeof AbortController?void 0:new AbortController;const jl=function(r){var o=r.settings,a=r.updateSettings,i=yl(10),l=i.inventoryLoading,c=(i.polling,i.inventory),s=i.triggerAndPollInventory,u=i.fetchInventory,m=i.handleSearch,p=i.searchTerm,f=i.setPagination,d=i.pagination,h=i.sorting,g=i.setSorting,y=i.categoryFilter,v=i.statusFilter,w=i.changeCategory,b=i.changeStatus,x=i.categoryOptions,E=i.locationFilter,S=i.changeLocation,k=i.archiveFilter,N=i.changeArchive,O=i.ecomFilter,j=i.changeEcom,C=Sl((0,t.useState)({}),2),L=C[0],P=C[1],_=Sl((0,t.useState)({}),2),R=_[0],I=_[1],A=Sl((0,t.useState)(!1),2),T=A[0],M=A[1],D=Sl((0,t.useState)(!1),2),G=D[0],q=D[1],V=Sl((0,t.useState)(15),2),W=V[0],z=V[1],B=function(t,r,n,o){var a=Ki((0,e.useState)(!1),2),i=a[0],l=a[1],c=Ki((0,e.useState)(null),2),s=c[0],u=c[1],m=(0,e.useRef)(null),p=(0,e.useRef)(i);(0,e.useEffect)((function(){p.current=i}),[i]);var f=(0,e.useCallback)(Yi($i().mark((function e(){var t,r,n,o,a,i,c,s,m;return $i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,zt({path:"/sws/v1/square-inventory/import/status",method:"GET",parse:!1});case 3:return t=e.sent,e.next=6,t.json();case 6:(r=e.sent).progress&&(n=r.progress,o=n.processed,a=void 0===o?0:o,i=n.total,c=void 0===i?0:i,s=n.error,m=void 0===s?"":s,(a>0||c>0||m)&&u(r.progress)),r.isImporting&&(l(!0),d()),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(0),console.error("Error fetching existing import status:",e.t0);case 14:case"end":return e.stop()}}),e,null,[[0,11]])}))),[]);(0,e.useEffect)((function(){f()}),[]);var d=(0,e.useCallback)((function(){var e=0,r=Math.max(1e4,1e3*o),n=function(){var o=Yi($i().mark((function o(){var a,i,c;return $i().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.prev=0,o.next=3,zt({path:"/sws/v1/square-inventory/import/status",method:"GET",parse:!1});case 3:return i=o.sent,o.next=6,i.json();case 6:if(c=o.sent,u(c.progress),c.isImporting&&(null===(a=c.progress)||void 0===a||!a.finished)){o.next=12;break}return l(!1),t&&t(),o.abrupt("return");case 12:o.next=17;break;case 14:o.prev=14,o.t0=o.catch(0),console.error("Polling error:",o.t0);case 17:++e<1e3&&p.current?m.current=setTimeout(n,r):l(!1);case 19:case"end":return o.stop()}}),o,null,[[0,14]])})));return function(){return o.apply(this,arguments)}}();n()}),[t]),h=(0,e.useCallback)(function(){var e=Yi($i().mark((function e(t,r,n,a,i,c){var s,m;return $i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!p.current){e.next=2;break}return e.abrupt("return");case 2:return l(!0),u(null),e.prev=4,e.next=7,zt({path:"/sws/v1/square-inventory/import",method:"POST",data:{product:t||[],datatoimport:a,batchSize:o,categoryFilter:i,statusFilter:c},signal:null==n?void 0:n.signal,parse:!1});case 7:return s=e.sent,e.next=10,s.json();case 10:if(m=e.sent,console.log("import response:",m),!m.error){e.next=16;break}return F.error("Import error: ".concat(m.error)),l(!1),e.abrupt("return");case 16:d(),e.next=23;break;case 19:e.prev=19,e.t0=e.catch(4),"AbortError"===e.t0.name?F.info("Import request aborted."):F.error("Import request failed: ".concat(e.t0.message)),l(!1);case 23:case"end":return e.stop()}}),e,null,[[4,19]])})));return function(_x,t,r,n,o,a){return e.apply(this,arguments)}}(),[d]),g=function(){var e=Yi($i().mark((function e(){var t,r;return $i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,zt({path:"/sws/v1/square-inventory/import/stop",method:"POST",parse:!1});case 3:return t=e.sent,e.next=6,t.json();case 6:(r=e.sent).success?(l(!1),F.info("Import was stopped.")):F.warn(r.message),e.next=14;break;case 10:e.prev=10,e.t0=e.catch(0),console.error("Error stopping import:",e.t0),F.error("Unable to stop import");case 14:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(){return e.apply(this,arguments)}}(),y=(0,e.useCallback)((function(){l(!1),u(null),n("inventory",{})}),[]);return(0,e.useEffect)((function(){return function(){m.current&&clearTimeout(m.current)}}),[]),{isImporting:i,progress:s,importProduct:h,clearImportProgress:y,setIsImporting:l,setProgress:u,stopImport:g}}(u,0,a,W),U=B.isImporting,H=B.progress,$=B.importProduct,Z=B.clearImportProgress,Y=(B.setIsImporting,B.setProgress,B.stopImport),K=Sl((0,t.useState)([]),2),X=K[0],J=K[1],Q=Sl((0,t.useState)({title:!0,sku:!0,description:!0,stock:!0,image:!0,categories:!0,price:!0}),2),ee=Q[0],te=Q[1],re=Sl((0,t.useState)({}),2),ne=re[0],oe=re[1],ae=Sl((0,t.useState)(""),2),ie=ae[0],le=ae[1],ce=Sl((0,t.useState)([]),2),se=(ce[0],ce[1],Sl((0,t.useState)([]),2)),ue=se[0],me=(se[1],Sl((0,t.useState)(!0),2)),pe=me[0],fe=(me[1],Sl((0,t.useState)(!1),2)),de=fe[0],he=(fe[1],Sl((0,t.useState)(!1),2)),ge=he[0],ye=(he[1],Ui(c||[],{expanded:ne,setExpanded:oe,sorting:h,setSorting:g,globalFilter:ie,setGlobalFilter:le,isImporting:U,setProductsToImport:J,setIsDialogOpen:M},o.location,pe,de,ge));console.log(c);var ve,we,be,xe=Fa(xl(xl({},ye),{},{manualPagination:!0,manualSorting:!0,pageCount:d.totalPages||1,state:xl(xl({},ye.state),{},{pagination:d,sorting:h,rowSelection:L}),onPaginationChange:f,onSortingChange:function(e){g(e),f((function(e){return xl(xl({},e),{},{pageIndex:0})}))},enableRowSelection:function(e){var t,r,n,a=null===(t=e.original)||void 0===t||null===(t=t.type)||void 0===t?void 0:t.toLowerCase();return!("variable"===a||"variation"===a||(e.parentId?e.getParentRow().original.invalidVariable&&null!==(n=o.squareAuto)&&void 0!==n&&n.attributesDisabled:e.original.invalidVariable&&(null===(r=o.squareAuto)||void 0===r||!r.attributesDisabled)))},onRowSelectionChange:function(e){P((function(t){var r="function"==typeof e?e(t):e,n=xl({},R);return xe.getRowModel().rows.forEach((function(e){var t,o=r[e.id],a=null===(t=e.original)||void 0===t?void 0:t.id;if(a)if(e.parentId){var i=e.getParentRow(),l=i.original.id;if(n[l]?Array.isArray(n[l].subRows)||(n[l].subRows=[]):n[l]=xl(xl({},i.original),{},{subRows:[]}),o)n[l].subRows.find((function(e){return e.id===a}))||n[l].subRows.push(e.original);else{n[l].subRows=n[l].subRows.filter((function(e){return e.id!==a}));var c=r[i.id];0!==n[l].subRows.length||c||delete n[l]}}else o?n[a]=xl(xl({},e.original),{},{subRows:e.original.subRows?wl(e.original.subRows):[]}):n[a]&&delete n[a]})),I(n),r}))}}));return(0,t.useEffect)((function(){if(c&&Array.isArray(c)){var e={};xe.getRowModel().rows.forEach((function(t){var r,n=null===(r=t.original)||void 0===r?void 0:r.id;if(n)if(t.parentId){var o,a=t.getParentRow(),i=null==a||null===(o=a.original)||void 0===o?void 0:o.id;if(!i)return;var l=R[i];l&&Array.isArray(l.subRows)&&l.subRows.some((function(e){return e.id===n}))&&(e[t.id]=!0)}else R[n]&&(e[t.id]=!0)})),P(e)}}),[c,R]),U||H&&(H.total>0||H.processed>0||H.error)?wp.element.createElement("div",{className:"px-4 pt-5 sm:px-6 pb-6"},function(){if(U)return wp.element.createElement(n().Fragment,null,wp.element.createElement("h2",{className:"text-xl font-semibold mb-3"},"Import in Progress"),wp.element.createElement("p",{className:"mb-2"},"Feel free to navigate away; the import process runs in the background."));var e=H.processed,t=void 0===e?0:e,r=H.total,o=void 0===r?0:r,a=H.error,i=void 0===a?"":a;return"Import stopped by user"===i?wp.element.createElement(n().Fragment,null,wp.element.createElement("h2",{className:"text-xl font-semibold mb-3"},"Import Stopped"),wp.element.createElement("p",{className:"mb-2"},"The import was manually stopped. Below are the partial results (processed ",t," of ",o,").")):i&&i.length>0?wp.element.createElement(n().Fragment,null,wp.element.createElement("h2",{className:"text-xl font-semibold mb-3"},"Import Error"),wp.element.createElement("p",{className:"mb-2"},"The import encountered an error: ",wp.element.createElement("strong",null,i),". Below are any partial results.")):t>=o?wp.element.createElement(n().Fragment,null,wp.element.createElement("h2",{className:"text-xl font-semibold mb-3"},"Import Complete"),wp.element.createElement("p",{className:"mb-2"},"The last import has completed, results below.")):wp.element.createElement(n().Fragment,null,wp.element.createElement("h2",{className:"text-xl font-semibold mb-3"},"Previous Import Results"),wp.element.createElement("p",{className:"mb-2"},"The last import has ended but did not process all items. Partial results below."))}(),wp.element.createElement("div",{className:"mb-3"},wp.element.createElement("p",{className:"text-sm font-medium mb-1"},"Processed: ",(null==H?void 0:H.processed)||0," / ",(null==H?void 0:H.total)||0),wp.element.createElement("div",{className:"relative w-full bg-gray-200 h-4 rounded"},(ve=(null==H?void 0:H.total)||0,we=(null==H?void 0:H.processed)||0,be=ve>0?Math.min(we/ve*100,100):0,wp.element.createElement("div",{className:"absolute left-0 top-0 h-4 bg-sky-500 rounded transition-all duration-300",style:{width:"".concat(be,"%")}})))),Array.isArray(null==H?void 0:H.results)&&H.results.length>0&&wp.element.createElement("div",{className:"mt-3"},wp.element.createElement("p",{className:"font-medium mb-2"},"Import Log:"),wp.element.createElement("div",{className:"bg-gray-900 text-gray-100 font-mono p-4 rounded-md max-h-60 overflow-y-auto text-xs leading-relaxed"},H.results.map((function(e,t){var r,n="text-blue-400",o=(null===(r=e.status)||void 0===r?void 0:r.toLowerCase())||"";"success"===o?n="text-green-400":"failed"===o||"failure"===o?n="text-red-400":"deleted"===o&&(n="text-orange-400");var a=e.status?"[".concat(e.status.toUpperCase(),"]"):"[INFO]",i=e.message||"Item #".concat(t+1," complete");return wp.element.createElement("div",{key:t,className:"whitespace-pre-wrap mb-1 ".concat(n)},a," ",i)})))),wp.element.createElement("div",{className:"flex items-center gap-3 justify-end mt-4"},U&&wp.element.createElement("button",{type:"button",onClick:Y,className:"inline-flex items-center rounded-md bg-red-500 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-red-400"},"Stop Import"),!U&&wp.element.createElement("button",{type:"button",onClick:Z,className:"inline-flex items-center rounded-md bg-sky-500 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},"Close"))):wp.element.createElement("div",null,wp.element.createElement(Xa,{open:G,onClose:function(){return q(!1)},className:"custom-dialog-class"},wp.element.createElement(il,{setIsAutoMatchOpen:q,inventory:c})),wp.element.createElement(fi,{dataToImport:ee,setDataToImport:te,importCount:0===X.length?d.importable:X.length,importProduct:function(){$(X,c,Ol,ee,y,v,p)},controller:Ol,isImporting:U,productsToImport:X,rangeValue:W,setRangeValue:z,isDialogOpen:T,progress:H,setIsDialogOpen:M}),wp.element.createElement("div",{className:"px-4 pt-5 sm:px-6"},wp.element.createElement("div",{className:"grid grid-cols-3 gap-2 mb-4 items-center"},wp.element.createElement("div",{className:"flex flex-wrap items-center justify-start sm:flex-nowrap"},wp.element.createElement("h2",{className:"text-xl font-semibold"},"Square Inventory"),wp.element.createElement("div",{className:"ml-4 flex flex-shrink-0"},wp.element.createElement("button",{type:"button",onClick:function(){return s(!0)},className:"relative inline-flex items-center rounded-md bg-sky-500 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},wp.element.createElement(Ma,{className:"-ml-0.5 mr-1.5 h-4 w-4 text-white","aria-hidden":"true"}),wp.element.createElement("span",null,"Refresh")))),wp.element.createElement("div",{className:"relative flex"},wp.element.createElement(za,{value:null!=ie?ie:"",onChange:function(e){return m(e)},className:"block w-full rounded-md border-0 py-1.5 pr-14 pl-4 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sku-600 sm:text-sm sm:leading-6",placeholder:"Search inventory..."}),wp.element.createElement("div",{className:"absolute inset-y-0 right-0 flex py-1.5 pr-1.5"},wp.element.createElement("kbd",{className:"inline-flex items-center rounded border border-gray-200 px-1 font-sans text-xs text-gray-400"},wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"feather feather-search w-3 h-3"},wp.element.createElement("circle",{cx:"11",cy:"11",r:"8"}),wp.element.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}))))),wp.element.createElement("div",{className:"flex justify-end items-center gap-2"},wp.element.createElement("button",{type:"button",disabled:!0,className:"disabled:bg-gray-200 relative inline-flex items-center rounded-md bg-sky-500 px-3 py-2 text-xs font-semibold text-white shadow-sm "},wp.element.createElement(Da,{className:"-ml-0.5 mr-1.5 h-4 w-4 text-white","aria-hidden":"true"}),"Auto match "," | "," Pro Only"),wp.element.createElement("button",{type:"button",onClick:function(){var e=Object.keys(R).length;if(c){if(0===e)J([]);else{var t=Object.values(R);J(t)}M(!0)}},className:"disabled:bg-gray-200 relative inline-flex items-center rounded-md bg-sky-500 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400 border border-sky-500 hover:border-sky-400"},wp.element.createElement(Ga,{className:"-ml-0.5 mr-1.5 h-4 w-4 text-white","aria-hidden":"true"}),wp.element.createElement("span",null,0===Object.keys(R).length?"Import all (".concat(d.importable,")"):"Import ".concat(Object.keys(R).length," selected products")))),wp.element.createElement("p",{className:"text-xs text-gray-500"},"Data is cached; refresh to update"))),l&&wp.element.createElement("div",null,wp.element.createElement("div",{className:"flex gap-2 items-center col-span-full sm:px-6 lg:px-8 relative overflow-hidden w-full"},wp.element.createElement("svg",{className:"text-sky-300 animate-spin",viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24"},wp.element.createElement("path",{d:"M32 3C35.8083 3 39.5794 3.75011 43.0978 5.20749C46.6163 6.66488 49.8132 8.80101 52.5061 11.4939C55.199 14.1868 57.3351 17.3837 58.7925 20.9022C60.2499 24.4206 61 28.1917 61 32C61 35.8083 60.2499 39.5794 58.7925 43.0978C57.3351 46.6163 55.199 49.8132 52.5061 52.5061C49.8132 55.199 46.6163 57.3351 43.0978 58.7925C39.5794 60.2499 35.8083 61 32 61C28.1917 61 24.4206 60.2499 20.9022 58.7925C17.3837 57.3351 14.1868 55.199 11.4939 52.5061C8.801 49.8132 6.66487 46.6163 5.20749 43.0978C3.7501 39.5794 3 35.8083 3 32C3 28.1917 3.75011 24.4206 5.2075 20.9022C6.66489 17.3837 8.80101 14.1868 11.4939 11.4939C14.1868 8.80099 17.3838 6.66487 20.9022 5.20749C24.4206 3.7501 28.1917 3 32 3Z",stroke:"currentColor",strokeWidth:"5",strokeLinecap:"round",strokeLinejoin:"round"}),wp.element.createElement("path",{d:"M32 3C36.5778 3 41.0906 4.08374 45.1692 6.16256C49.2477 8.24138 52.7762 11.2562 55.466 14.9605C58.1558 18.6647 59.9304 22.9531 60.6448 27.4748C61.3591 31.9965 60.9928 36.6232 59.5759 40.9762",stroke:"currentColor",strokeWidth:"5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-sky-500"})),wp.element.createElement("p",null,"Product data is being fetched in the background. Depending on your product database this may take a while. Feel free to leave this page and come back later."))),wp.element.createElement("div",null,o.location&&o.location.length>1&&!l&&wp.element.createElement("div",{className:"sm:px-6 lg:px-8 mb-4"},wp.element.createElement("div",{className:"flex gap-2 items-center flex-wrap"},wp.element.createElement("div",{className:"col-span-1"},wp.element.createElement("label",{className:"block text-sm font-medium text-gray-700 mb-1"},"Filter by Category"),wp.element.createElement("select",{className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 mt-2 !pr-10",value:y,onChange:function(e){return w(e.target.value)}},wp.element.createElement("option",{value:""},"All Categories"),x.map((function(e){return wp.element.createElement("option",{key:e.id,value:e.name},e.name)})))),wp.element.createElement("div",{className:"col-span-1"},wp.element.createElement("label",{className:"block text-sm font-medium text-gray-700 mb-1"},"Filter by Status"),wp.element.createElement("select",{className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 mt-2 !pr-10",value:v,onChange:function(e){return b(e.target.value)}},wp.element.createElement("option",{value:""},"All"),wp.element.createElement("option",{value:"imported"},"Imported Only"),wp.element.createElement("option",{value:"not_imported"},"Not Imported"))),wp.element.createElement("div",{className:"col-span-1"},wp.element.createElement("label",{className:"block text-sm font-medium text-gray-700 mb-1"},"Ecom Availablility"),wp.element.createElement("select",{className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 mt-2 !pr-10",value:O,onChange:function(e){return j(e.target.value)}},wp.element.createElement("option",{value:""},"All"),wp.element.createElement("option",{value:"ecom"},"Ecom Only"))),wp.element.createElement("div",{className:"col-span-1"},wp.element.createElement("label",{className:"block text-sm font-medium text-gray-700 mb-1"},"Archived products"),wp.element.createElement("select",{className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 mt-2 !pr-10 w-full",value:k,onChange:function(e){return N(e.target.value)}},wp.element.createElement("option",{value:""},"Show"),wp.element.createElement("option",{value:"hide"},"Hide"))),wp.element.createElement("div",{className:"col-span-1"},wp.element.createElement("label",{className:"block text-sm font-medium text-gray-700 mb-1"},"Location"),wp.element.createElement("select",{className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 mt-2 !pr-10",value:E,onChange:function(e){return S(e.target.value)}},wp.element.createElement("option",{value:""},"All"),wp.element.createElement("option",{value:"location"},"Defined location"))))),wp.element.createElement("div",{className:"sm:px-6 lg:px-8 relative overflow-y-auto w-full"},wp.element.createElement("table",{className:"w-full min-w-full text-left bg-white"},wp.element.createElement($a,{table:xe}),wp.element.createElement("tbody",{className:"divide-y divide-gray-200"},l?wp.element.createElement("tr",null,wp.element.createElement("td",{colSpan:xe.getHeaderGroups()[0].headers.length},wp.element.createElement("div",{className:"w-full"},wp.element.createElement("div",{className:"h-8 bg-gray-200 w-full mb-4"}),wp.element.createElement("div",{className:"h-8 bg-gray-200 w-full mb-4"}),wp.element.createElement("div",{className:"h-8 bg-gray-200 w-full mb-4"}),wp.element.createElement("div",{className:"h-8 bg-gray-200 w-full mb-4"})))):xe.getRowModel().rows.map((function(e){return wp.element.createElement(Ya,{key:e.id,row:e,toggleExpanded:function(){e.getCanExpand()&&e.toggleExpanded()}})}))))),wp.element.createElement("hr",null),wp.element.createElement(Ka,{table:xe,selectablePageRows:ue,rowSelection:L,setRowSelection:P})))};function Cl(e){return Cl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Cl(e)}function Ll(){Ll=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var a=t&&t.prototype instanceof y?t:y,i=Object.create(a.prototype),l=new P(n||[]);return o(i,"_invoke",{value:O(e,r,l)}),i}function m(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,i,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,i)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,i,l){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Cl(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,i,l)}),(function(e){r("throw",e,i,l)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return r("throw",e,i,l)}))}l(c.arg)}var a;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,r,n){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=j(l,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=m(t,r,n);if("normal"===s.type){if(o=n.done?h:f,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=h,n.method="throw",n.arg=s.arg)}}}function j(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,j(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=m(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(Cl(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,l,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},k(S),s(S,c,"Generator"),s(S,i,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=_,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return l.type="throw",l.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],l=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:_(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function Pl(e,t,r,n,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,o)}var _l=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5e3;return new Promise((function(r,n){var o=function(){var a=function(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){Pl(a,n,o,i,l,"next",e)}function l(e){Pl(a,n,o,i,l,"throw",e)}i(void 0)}))}}(Ll().mark((function a(i){var l,c;return Ll().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if(a.prev=0,l=null,e)try{localStorage.removeItem("inventoryData")}catch(e){console.warn("Failed to remove data from local storage:",e)}else{try{l=localStorage.getItem("inventoryData")}catch(e){console.warn("Failed to retrieve data from local storage:",e)}l&&setTimeout((function(){var e=JSON.parse(l);return r({status:"success",data:e})}),100)}return a.next=5,zt({path:"/sws/v1/square-inventory".concat(i&&e?"?force=true":"")});case 5:if((c=a.sent).loading)i&&F.info("Fetching data, please wait...",{autoClose:2e3,hideProgressBar:!1,closeOnClick:!1}),setTimeout((function(){return o(!1)}),t);else if(0===c.data.length)F.info("No data available",{autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),r({status:"success",data:[]});else{try{localStorage.setItem("inventoryData",JSON.stringify(c.data))}catch(e){console.warn("Failed to store data in local storage:",e)}F.success("Products Retreived",{autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),r({status:"success",data:c.data})}a.next=13;break;case 9:a.prev=9,a.t0=a.catch(0),F.error("Error fetching products: ".concat(a.t0.message||"Server error"),{autoClose:5e3,closeOnClick:!0}),n({status:"error",error:a.t0.message||"Server error"});case 13:case"end":return a.stop()}}),a,null,[[0,9]])})));return function(e){return a.apply(this,arguments)}}();o(!0)}))};function Rl(e){return Rl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Rl(e)}function Il(){Il=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var a=t&&t.prototype instanceof y?t:y,i=Object.create(a.prototype),l=new P(n||[]);return o(i,"_invoke",{value:O(e,r,l)}),i}function m(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,i,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,i)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,i,l){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Rl(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,i,l)}),(function(e){r("throw",e,i,l)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return r("throw",e,i,l)}))}l(c.arg)}var a;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,r,n){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=j(l,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=m(t,r,n);if("normal"===s.type){if(o=n.done?h:f,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=h,n.method="throw",n.arg=s.arg)}}}function j(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,j(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=m(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(Rl(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,l,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},k(S),s(S,c,"Generator"),s(S,i,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=_,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return l.type="throw",l.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],l=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:_(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function Al(e,t,r,n,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,o)}function Tl(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){Al(a,n,o,i,l,"next",e)}function l(e){Al(a,n,o,i,l,"throw",e)}i(void 0)}))}}var Fl=No("inventory/fetchIfNeeded",Tl(Il().mark((function e(){var t,r,n,o,a,i,l,c,s=arguments;return Il().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=s.length>0&&void 0!==s[0]&&s[0],n=(r=s.length>1?s[1]:void 0).getState,o=r.rejectWithValue,a=n(),i=a.inventory,!t&&null!==i.data){e.next=24;break}return e.prev=4,e.next=7,_l(t);case 7:if("success"!==(l=e.sent).status){e.next=12;break}return e.abrupt("return",l.data);case 12:if("loading"!==l.status){e.next=16;break}return e.abrupt("return",o("Data is being fetched, please wait..."));case 16:throw new Error(l.error);case 17:e.next=22;break;case 19:return e.prev=19,e.t0=e.catch(4),e.abrupt("return",o(e.t0.message));case 22:e.next=44;break;case 24:if(!i.loading){e.next=43;break}return e.prev=25,e.next=28,_l(!1);case 28:if("success"!==(c=e.sent).status){e.next=33;break}return e.abrupt("return",c.data);case 33:if("loading"!==c.status){e.next=37;break}return e.abrupt("return",o("Data is being fetched, please wait..."));case 37:throw new Error(c.error);case 38:e.next=43;break;case 40:return e.prev=40,e.t1=e.catch(25),e.abrupt("return",o(e.t1.message));case 43:return e.abrupt("return",i.data);case 44:case"end":return e.stop()}}),e,null,[[4,19],[25,40]])})))),Ml=bo({name:"inventory",initialState:{data:null,loading:!1,error:null,fetchAttempted:!1},reducers:{setInventory:function(e,t){e.data=t.payload},addItem:function(e,t){e.data.push(t.payload)},removeItem:function(e,t){e.data=e.data.filter((function(e){return e.id!==t.payload}))}},extraReducers:function(e){e.addCase(Fl.pending,(function(e){e.loading=!0,e.fetchAttempted=!0})).addCase(Fl.fulfilled,(function(e,t){e.loading=!1,e.data=t.payload,e.error=null})).addCase(Fl.rejected,(function(e,t){e.loading=!1,e.data=[],e.error=t.payload}))}}),Dl=Ml.actions;Dl.setInventory,Dl.addItem,Dl.removeItem;const Gl=Ml.reducer;function ql(e){return ql="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ql(e)}function Vl(){Vl=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var a=t&&t.prototype instanceof y?t:y,i=Object.create(a.prototype),l=new P(n||[]);return o(i,"_invoke",{value:O(e,r,l)}),i}function m(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,i,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,i)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,i,l){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==ql(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,i,l)}),(function(e){r("throw",e,i,l)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return r("throw",e,i,l)}))}l(c.arg)}var a;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,r,n){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=j(l,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=m(t,r,n);if("normal"===s.type){if(o=n.done?h:f,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=h,n.method="throw",n.arg=s.arg)}}}function j(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,j(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=m(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(ql(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,l,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},k(S),s(S,c,"Generator"),s(S,i,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=_,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return l.type="throw",l.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],l=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:_(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function Wl(e,t,r,n,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,o)}function zl(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Bl(e){return Bl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Bl(e)}function Ul(){Ul=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var a=t&&t.prototype instanceof y?t:y,i=Object.create(a.prototype),l=new P(n||[]);return o(i,"_invoke",{value:O(e,r,l)}),i}function m(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,i,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,i)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,i,l){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Bl(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,i,l)}),(function(e){r("throw",e,i,l)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return r("throw",e,i,l)}))}l(c.arg)}var a;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,r,n){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=j(l,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=m(t,r,n);if("normal"===s.type){if(o=n.done?h:f,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=h,n.method="throw",n.arg=s.arg)}}}function j(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,j(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=m(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(Bl(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,l,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},k(S),s(S,c,"Generator"),s(S,i,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=_,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return l.type="throw",l.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],l=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:_(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function Hl(e,t,r,n,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,o)}function $l(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){Hl(a,n,o,i,l,"next",e)}function l(e){Hl(a,n,o,i,l,"throw",e)}i(void 0)}))}}function Zl(){return Yl.apply(this,arguments)}function Yl(){return Yl=$l(Ul().mark((function e(){var t,r,n,o,a,i=arguments;return Ul().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:0,r=i.length>1&&void 0!==i[1]?i[1]:20,n=i.length>2&&void 0!==i[2]?i[2]:[],e.prev=3,e.next=6,zt({path:"/sws/v1/orders?page=".concat(t,"&per_page=").concat(r)});case 6:if(o=e.sent,(a=o.orders||o)&&0!==a.length){e.next=10;break}return e.abrupt("return",n);case 10:if(n=n.concat(a),!(a.length<r)){e.next=13;break}return e.abrupt("return",n);case 13:return e.abrupt("return",Zl(t+1,r,n));case 16:throw e.prev=16,e.t0=e.catch(3),e.t0;case 19:case"end":return e.stop()}}),e,null,[[3,16]])}))),Yl.apply(this,arguments)}var Kl=function(){var e=$l(Ul().mark((function e(){var t,r,n,o=arguments;return Ul().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.length>0&&void 0!==o[0]?o[0]:99,r=F.loading("Retrieving Woo Orders"),e.prev=2,e.next=5,Zl(1,t);case 5:return n=e.sent,F.update(r,{render:"Orders Received",type:"success",isLoading:!1,autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),e.abrupt("return",{status:"success",data:{orders:n}});case 10:throw e.prev=10,e.t0=e.catch(2),F.update(r,{render:"Error fetching orders: ".concat(e.t0.message||"Server error"),type:"error",isLoading:!1,closeOnClick:!0,autoClose:5e3}),console.error("Error fetching orders:",e.t0),e.t0;case 15:case"end":return e.stop()}}),e,null,[[2,10]])})));return function(){return e.apply(this,arguments)}}();function Xl(e){return Xl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Xl(e)}function Jl(){Jl=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var a=t&&t.prototype instanceof y?t:y,i=Object.create(a.prototype),l=new P(n||[]);return o(i,"_invoke",{value:O(e,r,l)}),i}function m(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,i,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,i)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,i,l){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Xl(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,i,l)}),(function(e){r("throw",e,i,l)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return r("throw",e,i,l)}))}l(c.arg)}var a;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,r,n){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=j(l,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=m(t,r,n);if("normal"===s.type){if(o=n.done?h:f,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=h,n.method="throw",n.arg=s.arg)}}}function j(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,j(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=m(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(Xl(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,l,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},k(S),s(S,c,"Generator"),s(S,i,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=_,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return l.type="throw",l.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],l=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:_(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function Ql(e,t,r,n,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,o)}function ec(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){Ql(a,n,o,i,l,"next",e)}function l(e){Ql(a,n,o,i,l,"throw",e)}i(void 0)}))}}var tc=No("orders/fetchIfNeeded",ec(Jl().mark((function e(){var t,r,n,o,a,i,l,c,s,u=arguments;return Jl().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=(t=u.length>0&&void 0!==u[0]?u[0]:{}).forceRefresh,n=void 0!==r&&r,t.page,t.perPage,a=(o=u.length>1?u[1]:void 0).getState,i=o.rejectWithValue,l=a(),c=l.orders,!(n||!c.data||c.data.length<1)){e.next=16;break}return e.prev=4,e.next=7,Kl();case 7:return s=e.sent,e.abrupt("return",s.data.orders);case 11:return e.prev=11,e.t0=e.catch(4),e.abrupt("return",i(e.t0.error));case 14:e.next=17;break;case 16:return e.abrupt("return",c.data);case 17:case"end":return e.stop()}}),e,null,[[4,11]])})))),rc=bo({name:"orders",initialState:{data:null,loading:!1,error:null},reducers:{setOrders:function(e,t){e.data=t.payload}},extraReducers:function(e){e.addCase(tc.pending,(function(e){e.loading=!0})).addCase(tc.fulfilled,(function(e,t){e.loading=!1,e.data=t.payload,e.error=null})).addCase(tc.rejected,(function(e,t){e.loading=!1,e.data=[],e.error=t.payload}))}}),nc=rc.actions.setOrders;const oc=rc.reducer,ac=t.forwardRef((function({title:e,titleId:r,...n},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":r},n),e?t.createElement("title",{id:r},e):null,t.createElement("path",{fillRule:"evenodd",d:"M15.312 11.424a5.5 5.5 0 0 1-9.201 2.466l-.312-.311h2.433a.75.75 0 0 0 0-1.5H3.989a.75.75 0 0 0-.75.75v4.242a.75.75 0 0 0 1.5 0v-2.43l.31.31a7 7 0 0 0 11.712-3.138.75.75 0 0 0-1.449-.39Zm1.23-3.723a.75.75 0 0 0 .219-.53V2.929a.75.75 0 0 0-1.5 0V5.36l-.31-.31A7 7 0 0 0 3.239 8.188a.75.75 0 1 0 1.448.389A5.5 5.5 0 0 1 13.89 6.11l.311.31h-2.432a.75.75 0 0 0 0 1.5h4.243a.75.75 0 0 0 .53-.219Z",clipRule:"evenodd"}))})),ic=function(e){var t=e.fetchOrders;return e.globalFilter,e.setGlobalFilter,wp.element.createElement("div",{className:"flex flex-col justify-between items-start w-full mb-4"},wp.element.createElement("div",{className:"text-sm leading-6 text-gray-900 pt-4  flex gap-4 items-center"},wp.element.createElement("h2",{className:"text-xl font-semibold"},"Woo Orders"),wp.element.createElement("button",{type:"button",onClick:function(){return t()},className:"relative inline-flex items-center rounded-md bg-sky-500 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},wp.element.createElement(ac,{className:"-ml-0.5 mr-1.5 h-4 w-4 text-white","aria-hidden":"true"}),wp.element.createElement("span",null,"Refresh"))),wp.element.createElement("p",{className:"text-base"},"Integrating your orders with Square seamlessly generates both a transaction and a customer profile. For orders that require fulfillment, such as shipping, they will automatically appear on Square's Orders page."))},lc=t.forwardRef((function({title:e,titleId:r,...n},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":r},n),e?t.createElement("title",{id:r},e):null,t.createElement("path",{fillRule:"evenodd",d:"M8.22 5.22a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L11.94 10 8.22 6.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))})),cc=t.forwardRef((function({title:e,titleId:r,...n},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":r},n),e?t.createElement("title",{id:r},e):null,t.createElement("path",{fillRule:"evenodd",d:"M9.47 6.47a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 1 1-1.06 1.06L10 8.06l-3.72 3.72a.75.75 0 0 1-1.06-1.06l4.25-4.25Z",clipRule:"evenodd"}))})),sc=function(e){var t=e.table;return wp.element.createElement("div",{className:"flex justify-between items-center"},wp.element.createElement("div",{className:"flex items-center gap-2 "},wp.element.createElement("button",{className:"border rounded p-1",onClick:function(){return t.setPageIndex(0)},disabled:!t.getCanPreviousPage()},"<<"),wp.element.createElement("button",{className:"border rounded p-1",onClick:function(){return t.previousPage()},disabled:!t.getCanPreviousPage()},"<"),wp.element.createElement("button",{className:"border rounded p-1",onClick:function(){return t.nextPage()},disabled:!t.getCanNextPage()},">"),wp.element.createElement("button",{className:"border rounded p-1",onClick:function(){return t.setPageIndex(t.getPageCount()-1)},disabled:!t.getCanNextPage()},">>"),wp.element.createElement("span",{className:"flex items-center gap-1"},wp.element.createElement("div",null,"Page"),wp.element.createElement("strong",null,t.getState().pagination.pageIndex+1," of"," ",t.getPageCount())),wp.element.createElement("span",{className:"flex items-center gap-1"},"| Go to page:",wp.element.createElement("input",{type:"number",defaultValue:t.getState().pagination.pageIndex+1,onChange:function(e){var r=e.target.value?Number(e.target.value)-1:0;t.setPageIndex(r)},className:"border p-1 rounded w-16"})),wp.element.createElement("select",{value:t.getState().pagination.pageSize,onChange:function(e){t.setPageSize(Number(e.target.value))}},[10,20,30,40,50].map((function(e){return wp.element.createElement("option",{key:e,value:e},"Show ",e)})))))};function uc(e){return uc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},uc(e)}function mc(){mc=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var a=t&&t.prototype instanceof y?t:y,i=Object.create(a.prototype),l=new P(n||[]);return o(i,"_invoke",{value:O(e,r,l)}),i}function m(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,i,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,i)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,i,l){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==uc(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,i,l)}),(function(e){r("throw",e,i,l)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return r("throw",e,i,l)}))}l(c.arg)}var a;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,r,n){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=j(l,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=m(t,r,n);if("normal"===s.type){if(o=n.done?h:f,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=h,n.method="throw",n.arg=s.arg)}}}function j(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,j(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=m(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(uc(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,l,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},k(S),s(S,c,"Generator"),s(S,i,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=_,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return l.type="throw",l.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],l=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:_(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function pc(e,t,r,n,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,o)}function fc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function dc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?fc(Object(r),!0).forEach((function(t){hc(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function hc(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=uc(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=uc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==uc(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function gc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return yc(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?yc(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function yc(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const vc=function(t){var r=t.data,n=oe(),o=(X((function(e){return e.orders})).loading,gc((0,e.useState)(""),2)),a=o[0],i=o[1],l=gc((0,e.useState)([]),2),c=l[0],s=l[1],u=gc((0,e.useState)({}),2),m=u[0],p=u[1],f=gc((0,e.useState)(null),2),d=f[0],h=f[1],g=function(e,t){return r.map((function(r){return r&&r.id&&r.id===e?dc(dc({},r),{},{square_data:JSON.stringify(t)}):r}))},y=function(){var e=function(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){pc(a,n,o,i,l,"next",e)}function l(e){pc(a,n,o,i,l,"throw",e)}i(void 0)}))}}(mc().mark((function e(t){var r,o;return mc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return h(t),r=F.loading("Attempting to create Square order & transaction"),e.prev=2,e.next=5,zt({path:"/sws/v1/orders",method:"POST",data:{order_id:t}});case 5:(o=e.sent).data.payment||o.data.order?(F.update(r,{render:"Created successfully",type:"success",isLoading:!1,autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),n(nc(g(t,o.data)))):F.update(r,{render:"Failed to create order & transaction",type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0}),h(null),e.next=15;break;case 10:e.prev=10,e.t0=e.catch(2),F.update(r,{render:"Failed to create order & transaction: "+e.t0.error,type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0}),console.log(e.t0),h(null);case 15:case"end":return e.stop()}}),e,null,[[2,10]])})));return function(_x){return e.apply(this,arguments)}}(),v=(0,e.useMemo)((function(){return[{id:"expander",width:50,cell:function(e){var t=e.row;return t.getCanExpand()?wp.element.createElement("button",{type:"button",onClick:function(){p((function(e){return dc(dc({},e),{},hc({},t.id,!e[t.id]))}))}},t.getIsExpanded()?wp.element.createElement(Yt,{className:"w-4 h-4 text-black"}):wp.element.createElement(lc,{className:"w-4 h-4 text-black"})):null}},{accessorKey:"id",header:function(){return"ID"},enableSorting:!0},{accessorKey:"date",header:function(){return"Order Created"},enableSorting:!0},{accessorKey:"status",header:function(){return"Order Status"},cell:function(e){var t=(0,e.getValue)();return wp.element.createElement("span",{className:Za("capitalize inline-flex items-center gap-x-1.5 rounded-md px-2 py-1 text-xs font-medium","pending"===t?"bg-orange-100 text-orange-700":"completed"===t?"bg-green-100 text-green-700":"processing"===t?"bg-sky-100 text-sky-700":"bg-gray-100 text-gray-700")},wp.element.createElement("svg",{className:"h-1.5 w-1.5 mt-[2px]",viewBox:"0 0 6 6","aria-hidden":"true",fill:"currentColor"},wp.element.createElement("circle",{cx:3,cy:3,r:3})),t)},enableSorting:!0},{accessorKey:"customer",header:function(){return"Customer"},cell:function(e){var t=(0,e.getValue)();return wp.element.createElement("span",null,t.first_name?t.first_name:"Guest"," ",t.last_name)},enableSorting:!0},{accessorKey:"total",header:function(){return"Order Total"},cell:function(e){var t=e.getValue;return wp.element.createElement("span",null,"$",t())},enableSorting:!0},{accessorKey:"sync_statuc",header:function(){return"Sync Status"},cell:function(e){return e.row.original.square_data?wp.element.createElement("span",{className:"inline-flex items-center gap-x-1.5 rounded-md bg-green-100 px-2 py-1 text-xs font-medium text-green-700"},wp.element.createElement("svg",{className:"h-1.5 w-1.5 fill-green-500",viewBox:"0 0 6 6","aria-hidden":"true"},wp.element.createElement("circle",{cx:"3",cy:"3",r:"3"})),"Synced"):wp.element.createElement("span",{className:"inline-flex items-center gap-x-1.5 rounded-md bg-red-100 px-2 py-1 text-xs font-medium text-red-700"},wp.element.createElement("svg",{className:"h-1.5 w-1.5 fill-red-500",viewBox:"0 0 6 6","aria-hidden":"true"},wp.element.createElement("circle",{cx:3,cy:3,r:3})),"Not synced")},enableSorting:!0},{id:"actions",colSpan:2,cell:function(e){var t=e.row;return wp.element.createElement("div",{className:"flex items-center justify-end gap-2"},wp.element.createElement("button",{type:"button",onClick:function(e){e.stopPropagation(),w.setExpanded((function(e){return dc(dc({},e),{},hc({},t.id,!e[t.id]))}))},className:"rounded  px-2 py-1 text-xs font-semibold text-sky-500 border-sky-500 border hover:border-sky-200 shadow-sm  hover:text-sky-200 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-purple-600 cursor-pointer"},"View details"))}}]}),[]),w=Fa(hc(hc(hc({data:r,columns:v,state:{sorting:c,globalFilter:a,expanded:m},filterFns:{custom:_i},onSortingChange:s,onExpandedChange:p,globalFilterFn:"custom",onGlobalFilterChange:i,getCoreRowModel:La(),getSortedRowModel:_a(),getFilteredRowModel:Pa(),getPaginationRowModel:Aa(),getExpandedRowModel:Ra()},"onSortingChange",s),"onGlobalFilterChange",i),"debugTable",!0)),b=function(e){return JSON.parse(e)};return wp.element.createElement(React.Fragment,null,wp.element.createElement(ic,{fetchOrders:function(){return n(tc({forceRefresh:!0}))},setGlobalFilter:i,globalFilter:a}),wp.element.createElement("table",{className:"w-full"},wp.element.createElement("thead",{className:"border-b border-gray-900/10 text-sm leading-6 text-gray-900"},w.getHeaderGroups().map((function(e){return wp.element.createElement("tr",{key:e.id},e.headers.map((function(e){var t;return wp.element.createElement("th",{key:e.id,colSpan:e.colSpan,className:"p-2 font-bold text-left"},e.isPlaceholder?null:wp.element.createElement("div",{className:e.column.getCanSort()?"cursor-pointer select-none":"",onClick:e.column.getToggleSortingHandler()},Ta(e.column.columnDef.header,e.getContext()),null!==(t={asc:wp.element.createElement(cc,{className:"w-4 h-4 inline-block ml-1"}),desc:wp.element.createElement(Yt,{className:"w-4 h-4 inline-block ml-1"})}[e.column.getIsSorted()])&&void 0!==t?t:null))})))}))),wp.element.createElement("tbody",{className:"divide-y divide-gray-200"},w.getRowModel().rows.map((function(t){return d&&d===t.original.id?wp.element.createElement("tr",{key:t.id},wp.element.createElement("td",{colSpan:100},wp.element.createElement("div",{className:"animate-pulse h-6 bg-gray-200 rounded my-1"}))):wp.element.createElement(e.Fragment,{key:t.id},wp.element.createElement("tr",{className:"cursor-pointer",onClick:function(){w.setExpanded((function(e){return dc(dc({},e),{},hc({},t.id,!e[t.id]))}))}},t.getVisibleCells().map((function(e){return"expander"===e.column.id?wp.element.createElement("td",{key:e.id,className:"py-4 px-2",onClick:function(e){e.stopPropagation(),w.setExpanded((function(e){return dc(dc({},e),{},hc({},t.id,!e[t.id]))}))}},wp.element.createElement("button",{type:"button","aria-label":"Expand row"},t.getIsExpanded()?wp.element.createElement(Yt,{className:"w-4 h-4 text-black"}):wp.element.createElement(lc,{className:"w-4 h-4 text-black"}))):wp.element.createElement("td",{key:e.id,className:"py-4 px-2 text-gray-600"},Ta(e.column.columnDef.cell,e.getContext()))}))),t.getIsExpanded()&&wp.element.createElement("tr",null,wp.element.createElement("td",{colSpan:100,className:""}," ",wp.element.createElement("div",{className:"p-6 mb-4 grid md:grid-cols-12 w-full gap-10 bg-slate-50 rounded-b-xl"},wp.element.createElement("div",{className:"md:col-span-full"},wp.element.createElement("div",{className:" flex items-center justify-center gap-4"},wp.element.createElement("a",{className:"rounded  px-2 py-1 text-xs font-semibold text-sky-500 border-sky-500 border hover:border-sky-200 shadow-sm  hover:text-sky-200 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-purple-600 cursor-pointer",href:"/wp-admin/post.php?post=".concat(t.original.id,"&action=edit"),target:"_blank"},"View Woo Order"),t.original.square_data||"completed"!==t.original.status&&"processing"!==t.original.status?wp.element.createElement(React.Fragment,null):wp.element.createElement("button",{type:"button",onClick:function(){return y(t.original.id)},className:"rounded bg-sky-600 px-2 py-1 text-xs font-semibold text-white border border-sky-600 hover:border-sky-500 shadow-sm hover:bg-sky-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-600"},"Sync to Square")),t.original.square_data||"completed"===t.original.status&&"processing"===t.original.status?wp.element.createElement(React.Fragment,null):wp.element.createElement("p",{className:"text-center mt-2 mx-auto max-w-xl"},"Only completed or processing orders can be synced to Square")),wp.element.createElement("div",{className:"md:col-span-6"},wp.element.createElement("p",{className:"font-semibold text-lg mb-4"},"Order Line Items"),wp.element.createElement("ul",{className:"divide-y divide-gray-200"},t.original.line_items.map((function(e){return wp.element.createElement("li",{key:e.product_id,className:"flex gap-2 items-center py-2"},e.image?wp.element.createElement("img",{src:e.image,className:"w-12 h-12 object-contain rounded-lg"}):wp.element.createElement("div",{className:"w-12 h-12 object-contain rounded-lg bg-white flex items-center justify-center"},wp.element.createElement(Ni,null)),wp.element.createElement("div",null,wp.element.createElement("p",{className:"font-semibold"},e.product_name),wp.element.createElement("p",null,"SKU:"," ",wp.element.createElement("span",{className:"text-sky-500"},e.sku)),wp.element.createElement("p",null,"Square product ID:"," ",wp.element.createElement("span",{className:"".concat(e.square_product_id.length>0?"text-sky-500":"text-red-500")},e.square_product_id.length>0?e.square_product_id:"Not Linked")),wp.element.createElement("p",null,"Price: $",e.price," ","x"," ",e.quantity," ","| Total cost: $",e.total)))})))),wp.element.createElement("div",{className:"md:col-span-6"},wp.element.createElement("p",{className:"font-semibold text-lg mb-4"},"Order Totals"),wp.element.createElement("ul",{className:"w-fulldivide-y divide-slate-100"},wp.element.createElement("li",{className:"flex justify-between"},"Subtotal:"," ",wp.element.createElement("strong",null,"$",t.original.order_subtotal.toFixed(2))),wp.element.createElement("li",{className:"flex justify-between"},"Discount Total:"," ",wp.element.createElement("strong",null,"-$",t.original.discount_total)),wp.element.createElement("li",{className:"flex justify-between"},"Shipping Total:"," ",wp.element.createElement("strong",null,"$",t.original.shipping_total)),wp.element.createElement("li",{className:"flex justify-between"},"Total Tax:"," ",wp.element.createElement("strong",null,"$",t.original.total_tax)),wp.element.createElement("li",{className:"flex justify-between"},"Total:"," ",wp.element.createElement("strong",null,"$",t.original.total))),wp.element.createElement("p",{className:"font-semibold text-lg mb-4 mt-8"},"Customer Details"),wp.element.createElement("ul",{className:"divide-y divide-slate-100"},t.original.customer&&Object.keys(t.original.customer).length>0?Object.keys(t.original.customer).map((function(e){return wp.element.createElement(React.Fragment,null,t.original.customer[e]&&wp.element.createElement("li",{key:t.original.customer[e],className:"grid grid-cols-2"},wp.element.createElement("span",{className:"capitalize"},e.replace("_"," "),":")," ",wp.element.createElement("span",{className:"text-left font-bold"},t.original.customer[e])))})):wp.element.createElement("p",null,"Guest Customer"))),wp.element.createElement("div",{className:"md:col-span-full"},wp.element.createElement("p",{className:"font-semibold text-lg mb-4"},"Square Order Details"),t.original.square_data?wp.element.createElement("div",{className:"flex justify-start gap-20 items-start"},wp.element.createElement("div",null,wp.element.createElement("p",{className:"text-base font-semibold"},"Order details:"),wp.element.createElement("p",null,"Order ID:"," ",wp.element.createElement("span",{className:"font-semibold"},b(t.original.square_data).order.data.order.id)),wp.element.createElement("p",null,"Ticket name:"," ",wp.element.createElement("span",{className:"font-semibold"},b(t.original.square_data).order.data.order.ticket_name)),wp.element.createElement("a",{href:"https://squareup.com/dashboard/orders/overview/".concat(b(t.original.square_data).order.data.order.id),target:"_blank",className:"text-sky-500"},"View order")),wp.element.createElement("div",null,b(t.original.square_data).payment&&b(t.original.square_data).payment.data&&wp.element.createElement(React.Fragment,null," ",wp.element.createElement("p",{className:"text-base font-semibold"},"Payment Details:"),wp.element.createElement("p",null,"Payment ID:"," ",wp.element.createElement("span",{className:"font-semibold"},b(t.original.square_data).payment.data.payment.id)),wp.element.createElement("p",null,"Receipt Number:"," ",wp.element.createElement("span",{className:"font-semibold"},b(t.original.square_data).payment.data.payment.receipt_number)),wp.element.createElement("a",{href:b(t.original.square_data).payment.data.payment.receipt_url,target:"_blank",className:"text-sky-500"},"View receipt")))):wp.element.createElement("p",null,"Sync this order with Square to view orders details provided by Square"))))))})))),wp.element.createElement("hr",null),wp.element.createElement("div",{className:"py-4"},wp.element.createElement(sc,{table:w})))};function wc(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const bc=function(){return wp.element.createElement("div",null,wp.element.createElement("div",{className:" sm:px-6 px-4 py-5"},wp.element.createElement("div",{className:"flex flex-wrap items-center justify-start sm:flex-nowrap"},wp.element.createElement("h2",{className:"text-base font-semibold leading-7 text-gray-900"},"Woo Orders"))),wp.element.createElement("div",{className:"overflow-x-auto"},wp.element.createElement("table",{className:"whitespace-nowrap text-left bg-white w-full"},wp.element.createElement("colgroup",null,wp.element.createElement("col",{className:"w-full lg:w-1/12"}),wp.element.createElement("col",{className:"w-full lg:w-2/12"})),wp.element.createElement("thead",{className:"border-b border-gray-900/10 text-sm leading-6 text-gray-900"},wp.element.createElement("tr",null,wp.element.createElement("th",{scope:"col",className:"py-2 pl-4 pr-8 font-semibold sm:pl-6 lg:pl-8"},"ID"),wp.element.createElement("th",{scope:"col",className:"py-2 pl-4 pr-8 font-semibold sm:pl-6 lg:pl-8"},"Order Created"),wp.element.createElement("th",{scope:"col",className:"hidden py-2 pl-0 pr-8 font-semibold sm:table-cell"},"Order Status"),wp.element.createElement("th",{scope:"col",className:"hidden py-2 pl-0 pr-8 font-semibold sm:table-cell"},"Customer"),wp.element.createElement("th",{scope:"col",className:"hidden py-2 pl-0 pr-8 font-semibold sm:table-cell"},"Order Total"),wp.element.createElement("th",{scope:"col",className:"py-2 pl-0 pr-4 text-right font-semibold sm:pr-8 sm:text-left lg:pr-20"},"Sync Status"),wp.element.createElement("th",{scope:"col",className:"hidden py-2 pl-0 pr-4 text-right font-semibold sm:table-cell sm:pr-6 lg:pr-8"},"Actions"))),wp.element.createElement("tbody",{className:"divide-y divide-gray-200 animate-pulse"},function(e){return function(e){if(Array.isArray(e))return wc(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return wc(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?wc(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(Array(3)).map((function(e,t){return wp.element.createElement("tr",{key:t},wp.element.createElement("td",{colSpan:7,className:"py-2 pl-4 pr-8 sm:pl-6 lg:pl-8"},wp.element.createElement("div",{className:"h-6 bg-gray-200 rounded"})))}))))))};function xc(e){return xc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},xc(e)}function Ec(){Ec=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var a=t&&t.prototype instanceof y?t:y,i=Object.create(a.prototype),l=new P(n||[]);return o(i,"_invoke",{value:O(e,r,l)}),i}function m(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,i,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,i)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,i,l){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==xc(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,i,l)}),(function(e){r("throw",e,i,l)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return r("throw",e,i,l)}))}l(c.arg)}var a;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,r,n){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=j(l,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=m(t,r,n);if("normal"===s.type){if(o=n.done?h:f,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=h,n.method="throw",n.arg=s.arg)}}}function j(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,j(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=m(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(xc(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,l,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},k(S),s(S,c,"Generator"),s(S,i,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=_,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return l.type="throw",l.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],l=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:_(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function Sc(e,t,r,n,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,o)}function kc(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){Sc(a,n,o,i,l,"next",e)}function l(e){Sc(a,n,o,i,l,"throw",e)}i(void 0)}))}}function Nc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Oc(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Oc(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Oc(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function jc(){var t=!1!==(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).autoPrompt,r=Nc((0,e.useState)(!0),2),n=r[0],o=r[1],a=Nc((0,e.useState)(!1),2),i=a[0],l=a[1],c=Nc((0,e.useState)(""),2),s=c[0],u=c[1],m=Nc((0,e.useState)(""),2),p=m[0],f=m[1],d=Nc((0,e.useState)(!1),2),h=d[0],g=d[1],y=(0,e.useCallback)(kc(Ec().mark((function e(){var t,r,n,o;return Ec().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Dt()({path:"/sws/v1/square/check-token"});case 2:t=e.sent,r=t.exists,n=t.merchant,o=t.merchant_id,l(Boolean(r)),u(n),f(o);case 9:case"end":return e.stop()}}),e)}))),[]),v=(0,e.useCallback)(kc(Ec().mark((function e(){return Ec().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Dt()({path:"/sws/v1/square/clear-token",method:"DELETE"});case 2:return e.next=4,y();case 4:case"end":return e.stop()}}),e)}))),[y]);return(0,e.useEffect)((function(){var e=!1;return kc(Ec().mark((function t(){var r,n,a;return Ec().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=new URL(window.location.href),n=r.searchParams.get("access_token"),a=r.searchParams.get("refresh_token"),t.prev=3,!n){t.next=11;break}return t.next=7,Dt()({path:"/sws/v1/square/save-token",method:"POST",data:{access_token:n,refresh_token:a}});case 7:g(!0),r.searchParams.delete("access_token"),r.searchParams.delete("refresh_token"),window.history.replaceState({},"","".concat(r.pathname).concat(r.search).concat(r.hash));case 11:return t.next=13,y();case 13:return t.prev=13,e||o(!1),t.finish(13);case 16:case"end":return t.stop()}}),t,null,[[3,,13,16]])})))(),function(){e=!0}}),[y]),{loading:n,isAuthenticated:i,merchantName:s,merchantId:p,justConnected:h,autoPrompt:t,refreshStatus:y,disconnect:v}}function Cc(e){return Cc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Cc(e)}function Lc(){Lc=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var a=t&&t.prototype instanceof y?t:y,i=Object.create(a.prototype),l=new P(n||[]);return o(i,"_invoke",{value:O(e,r,l)}),i}function m(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,i,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,i)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,i,l){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Cc(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,i,l)}),(function(e){r("throw",e,i,l)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return r("throw",e,i,l)}))}l(c.arg)}var a;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,r,n){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=j(l,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=m(t,r,n);if("normal"===s.type){if(o=n.done?h:f,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=h,n.method="throw",n.arg=s.arg)}}}function j(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,j(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=m(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(Cc(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,l,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},k(S),s(S,c,"Generator"),s(S,i,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=_,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return l.type="throw",l.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],l=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:_(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function Pc(e,t,r,n,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,o)}function _c(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){Pc(a,n,o,i,l,"next",e)}function l(e){Pc(a,n,o,i,l,"throw",e)}i(void 0)}))}}function Rc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ic(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ic(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ic(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var Ac=(0,t.createContext)(),Tc=function(e){var r=e.children,n=Dr().settings,o=jc().isAuthenticated,a=Rc((0,t.useState)([]),2),i=a[0],l=a[1],c=Rc((0,t.useState)(!1),2),s=c[0],u=c[1],m=Rc((0,t.useState)(""),2),p=m[0],f=m[1];(0,t.useEffect)((function(){if(o||n.accessToken&&n.accessToken.length>2){var e=function(){var e=_c(Lc().mark((function e(){var t;return Lc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u(!0),e.prev=1,e.next=4,zt({path:"/sws/v1/settings/get-locations",method:"GET"});case 4:t=e.sent,l(t.locations.data.locations),didFetch.current=!0,e.next=13;break;case 9:e.prev=9,e.t0=e.catch(1),f("Failed to get locations"),F({render:"Failed to get locations: "+e.t0.message,type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0});case 13:return e.prev=13,u(!1),e.finish(13);case 16:case"end":return e.stop()}}),e,null,[[1,9,13,16]])})));return function(){return e.apply(this,arguments)}}();e()}}),[n.environment,o,n.accessToken]);var d=(0,t.useCallback)(_c(Lc().mark((function e(){var t;return Lc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u(!0),e.prev=1,e.next=4,zt({path:"/sws/v1/settings/get-locations",method:"GET"});case 4:t=e.sent,l(t.locations.data.locations),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),f("Failed to get locations"),F.error("Failed to get locations: ".concat(e.t0.message));case 12:return e.prev=12,u(!1),e.finish(12);case 15:case"end":return e.stop()}}),e,null,[[1,8,12,15]])}))),[n.environment,n.accessToken]);return wp.element.createElement(Ac.Provider,{value:{locations:i,loading:s,error:p,refetchLocations:d,setLocations:l}},r)},Fc=function(){return(0,t.useContext)(Ac)},Mc=function(){return window.location.hostname};function Dc(e){return Dc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Dc(e)}function Gc(){Gc=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var a=t&&t.prototype instanceof y?t:y,i=Object.create(a.prototype),l=new P(n||[]);return o(i,"_invoke",{value:O(e,r,l)}),i}function m(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,i,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,i)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,i,l){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Dc(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,i,l)}),(function(e){r("throw",e,i,l)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return r("throw",e,i,l)}))}l(c.arg)}var a;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,r,n){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=j(l,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=m(t,r,n);if("normal"===s.type){if(o=n.done?h:f,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=h,n.method="throw",n.arg=s.arg)}}}function j(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,j(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=m(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(Dc(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,l,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},k(S),s(S,c,"Generator"),s(S,i,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=_,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return l.type="throw",l.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],l=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:_(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function qc(e,t,r,n,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,o)}function Vc(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){qc(a,n,o,i,l,"next",e)}function l(e){qc(a,n,o,i,l,"throw",e)}i(void 0)}))}}function Wc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return zc(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?zc(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function zc(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Bc(){var t=Dr(),r=t.settings,n=t.removeAccessToken,o=t.updateSettings,a=Fc().setLocations,i=jc(),l=i.loading,c=i.isAuthenticated,s=i.merchantName,u=i.merchantId,m=i.refreshStatus,p=i.disconnect,f=Wc((0,e.useState)(!1),2),d=f[0],h=f[1],g=Wc((0,e.useState)(!1),2),y=g[0],v=g[1];(0,e.useEffect)((function(){m()}),[r.environment,m]);var w=function(){var e=Vc(Gc().mark((function e(){var t,n,o;return Gc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,h(!0),e.next=4,fetch("https://api.squaresyncforwoo.com/wp-json/square-oauth/v1/generate-url",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:r.environment||"live",redirect_uri:"".concat(window.location.origin,"/wp-admin/admin.php?page=squarewoosync#/settings/general"),callback_url:"https://".concat(Mc(),"/wp-json/sws/v1/square-inventory/update"),plan:"free"})});case 4:return t=e.sent,e.next=7,t.json();case 7:if(n=e.sent,o=n.oauthUrl){e.next=11;break}throw new Error("No URL from proxy");case 11:window.location.href=o,e.next=21;break;case 14:return e.prev=14,e.t0=e.catch(0),console.error(e.t0),F.error("Could not open Square authorisation page."),h(!1),e.next=21,m();case 21:case"end":return e.stop()}}),e,null,[[0,14]])})));return function(){return e.apply(this,arguments)}}(),b=function(){var e=Vc(Gc().mark((function e(){return Gc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,p();case 3:F.success("Square connection removed."),a([]),e.next=13;break;case 7:return e.prev=7,e.t0=e.catch(0),console.error(e.t0),F.error("Could not disconnect Square."),e.next=13,m();case 13:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(){return e.apply(this,arguments)}}(),x=function(){var e=Vc(Gc().mark((function e(){return Gc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return v(!0),e.next=3,n().then((function(){o("location",""),a([]),F.success("Legacy token removed.")}));case 3:v(!1);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return wp.element.createElement("div",{className:"space-y-10 px-4 pb-8"},wp.element.createElement("section",null,wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Square connection (OAuth 2.0)"),l?wp.element.createElement("p",{className:"mt-4 text-sm text-gray-600"},"Checking status…"):c?wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"mt-4 flex flex-col gap-4 sm:flex-row sm:items-center"},wp.element.createElement("span",{className:"inline-flex items-center gap-2 rounded-lg bg-emerald-100 px-3 py-1.5 text-sm font-medium text-emerald-700"},wp.element.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",className:"fill-current"},wp.element.createElement("path",{d:"M9.8 16.4 5.3 12l1.5-1.5 3 3 8-8L19.1 6l-9.3 10.4Z"})),"Connected",s?" to ".concat(s," | ").concat(u):""),wp.element.createElement("button",{onClick:b,className:"w-fit rounded-md bg-red-600 px-4 py-2 text-sm font-medium text-white shadow-sm transition hover:bg-red-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-red-500"},"Disconnect Square")),wp.element.createElement("p",{className:"mt-2 max-w-lg text-sm text-gray-600"},"Square is authenticated via OAuth. All synchronisation will use this connection.")):d?wp.element.createElement("p",{className:"mt-4 text-sm text-gray-600"},"Switching environment… redirecting to Square login."):wp.element.createElement(React.Fragment,null,wp.element.createElement("p",{className:"mt-2 max-w-lg text-sm text-gray-600"},"You haven’t linked a Square account yet."),wp.element.createElement("button",{onClick:w,className:"mt-4 inline-flex items-center justify-center rounded-md bg-indigo-600 px-5 py-2.5 text-sm font-medium text-white shadow-sm transition hover:bg-indigo-500 focus-visible:outline focus-visible:ring-4 focus-visible:ring-indigo-300"},"Connect with Square"))),r.accessToken&&wp.element.createElement("details",{className:"rounded-lg border border-gray-200 p-4"},wp.element.createElement("summary",{className:"cursor-pointer select-none text-sm font-medium text-gray-900"},"Legacy access token (deprecated)"),wp.element.createElement("div",{className:"mt-4 space-y-4"},wp.element.createElement("p",{className:"text-sm text-gray-500"},"Your store was configured with the old copy-paste token. You can remove it below. New installs should use OAuth instead."),wp.element.createElement("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center"},wp.element.createElement("input",{type:"text",value:r.accessToken,disabled:!0,className:"block w-full rounded-lg border border-gray-300 px-3 py-2 text-sm text-gray-800 max-w-md"}),wp.element.createElement("button",{onClick:x,disabled:y,className:"w-fit rounded-md bg-red-600 px-4 py-2 text-sm font-medium text-white transition hover:bg-red-500 disabled:cursor-progress"},y?"Removing…":"Remove token")),wp.element.createElement("p",{className:"text-sm text-gray-600"},"Removing the token will stop sync unless OAuth is connected."))))}o(42);const Uc=function(){return wp.element.createElement("svg",{className:"animate-spin mt-4 h-5 w-5 text-sky-500",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},wp.element.createElement("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),wp.element.createElement("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"}))};function Hc(e){return Hc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Hc(e)}function $c(){$c=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var a=t&&t.prototype instanceof y?t:y,i=Object.create(a.prototype),l=new P(n||[]);return o(i,"_invoke",{value:O(e,r,l)}),i}function m(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,i,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,i)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,i,l){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Hc(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,i,l)}),(function(e){r("throw",e,i,l)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return r("throw",e,i,l)}))}l(c.arg)}var a;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,r,n){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=j(l,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=m(t,r,n);if("normal"===s.type){if(o=n.done?h:f,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=h,n.method="throw",n.arg=s.arg)}}}function j(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,j(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=m(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(Hc(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,l,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},k(S),s(S,c,"Generator"),s(S,i,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=_,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return l.type="throw",l.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],l=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:_(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function Zc(e,t,r,n,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,o)}function Yc(e){var t=e.updateSettings,r=e.locations,n=e.settings,o=e.locationsLoading,a=function(){var e=function(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){Zc(a,n,o,i,l,"next",e)}function l(e){Zc(a,n,o,i,l,"throw",e)}i(void 0)}))}}($c().mark((function e(r){return $c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r.preventDefault(),t("location",r.target.value);case 2:case"end":return e.stop()}}),e)})));return function(_x){return e.apply(this,arguments)}}();return wp.element.createElement("div",{className:"px-4 pb-5"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Square Locations"),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500"},wp.element.createElement("p",null,"Select the default location. Used to determine which location to create orders on. You can adjust whether to track stock and import orders to this location specificly or all locations on the products and orders setting pages: ",wp.element.createElement("br",null))),o?wp.element.createElement(Uc,null):wp.element.createElement("div",null,wp.element.createElement("select",{id:"location",name:"location",onChange:function(e){return a(e)},value:n.location?n.location:"",className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 mt-2 !pr-10"},wp.element.createElement("option",{value:"",disabled:!0},"Select your location"),r.map((function(e){return wp.element.createElement("option",{key:e.id,value:e.id},e.name)})))))}const Kc=t.forwardRef((function({title:e,titleId:r,...n},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":r},n),e?t.createElement("title",{id:r},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 0 1 1.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.559.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.894.149c-.424.07-.764.383-.929.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 0 1-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.398.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 0 1-.12-1.45l.527-.737c.25-.35.272-.806.108-1.204-.165-.397-.506-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.108-1.204l-.526-.738a1.125 1.125 0 0 1 .12-1.45l.773-.773a1.125 1.125 0 0 1 1.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894Z"}),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))})),Xc=t.forwardRef((function({title:e,titleId:r,...n},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":r},n),e?t.createElement("title",{id:r},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 8.25h19.5M2.25 9h19.5m-16.5 5.25h6m-6 2.25h3m-3.75 3h15a2.25 2.25 0 0 0 2.25-2.25V6.75A2.25 2.25 0 0 0 19.5 4.5h-15a2.25 2.25 0 0 0-2.25 2.25v10.5A2.25 2.25 0 0 0 4.5 19.5Z"}))})),Jc=t.forwardRef((function({title:e,titleId:r,...n},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":r},n),e?t.createElement("title",{id:r},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m20.25 7.5-.625 10.632a2.25 2.25 0 0 1-2.247 2.118H6.622a2.25 2.25 0 0 1-2.247-2.118L3.75 7.5M10 11.25h4M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125Z"}))})),Qc=t.forwardRef((function({title:e,titleId:r,...n},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":r},n),e?t.createElement("title",{id:r},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 0 0 2.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 0 0-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75 2.25 2.25 0 0 0-.1-.664m-5.8 0A2.251 2.251 0 0 1 13.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m0 0H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V9.375c0-.621-.504-1.125-1.125-1.125H8.25ZM6.75 12h.008v.008H6.75V12Zm0 3h.008v.008H6.75V15Zm0 3h.008v.008H6.75V18Z"}))})),es=t.forwardRef((function({title:e,titleId:r,...n},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":r},n),e?t.createElement("title",{id:r},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 11.25v8.25a1.5 1.5 0 0 1-1.5 1.5H5.25a1.5 1.5 0 0 1-1.5-1.5v-8.25M12 4.875A2.625 2.625 0 1 0 9.375 7.5H12m0-2.625V7.5m0-2.625A2.625 2.625 0 1 1 14.625 7.5H12m0 0V21m-8.625-9.75h18c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125h-18c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125Z"}))}));var ts=[{name:"General",href:"/settings/general",icon:Kc},{name:"Payments",href:"/settings/payments",icon:Xc},{name:"Products",href:"/settings/inventory",icon:Jc},{name:"Customers",href:"/settings/customers",icon:fr},{name:"Orders",href:"/settings/orders",icon:Qc},{name:"Loyalty",href:"/settings/loyalty",icon:es}];function rs(e){var t=e.children;return lr(),wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"lg:flex lg:gap-x-4 bg-white rounded-2xl shadow-lg p-6"},wp.element.createElement("aside",{className:"flex border-b border-gray-900/5 lg:block lg:w-64 lg:flex-none lg:border-0 "},wp.element.createElement("nav",{className:"flex-none px-4 sm:px-6 lg:px-0"},wp.element.createElement("ul",{role:"list",className:"flex gap-x-3 gap-y-1 whitespace-nowrap lg:flex-col"},ts.map((function(e){return"Payments"===e.name?wp.element.createElement("li",{key:e.name},wp.element.createElement("a",{href:"/wp-admin/admin.php?page=wc-settings&tab=checkout&section=squaresync_credit",className:Za(location.hash.replace(/^#/,"")===e.href?"bg-gray-50 text-sky-600":"text-gray-700 hover:text-sky-600 hover:bg-gray-50","group flex gap-x-3 rounded-lg py-2 pl-2 pr-3 text-sm leading-6 font-semibold")},wp.element.createElement(e.icon,{className:Za(location.hash.replace(/^#/,"")===e.href?"text-sky-600":"text-gray-400 group-hover:text-sky-600","h-6 w-6 shrink-0"),"aria-hidden":"true"}),e.name)):wp.element.createElement("li",{key:e.name},wp.element.createElement(jt,{to:e.href,className:Za(location.hash.replace(/^#/,"")===e.href?"bg-gray-50 text-sky-600":"text-gray-700 hover:text-sky-600 hover:bg-gray-50","group flex gap-x-3 rounded-lg py-2 pl-2 pr-3 text-sm leading-6 font-semibold")},wp.element.createElement(e.icon,{className:Za(location.hash.replace(/^#/,"")===e.href?"text-sky-600":"text-gray-400 group-hover:text-sky-600","h-6 w-6 shrink-0"),"aria-hidden":"true"}),e.name))}))))),wp.element.createElement("main",{className:"px-4 sm:px-6 lg:flex-auto lg:px-0"},t)))}function ns(e){return ns="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ns(e)}function os(){os=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var a=t&&t.prototype instanceof y?t:y,i=Object.create(a.prototype),l=new P(n||[]);return o(i,"_invoke",{value:O(e,r,l)}),i}function m(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,i,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,i)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,i,l){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==ns(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,i,l)}),(function(e){r("throw",e,i,l)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return r("throw",e,i,l)}))}l(c.arg)}var a;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,r,n){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=j(l,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=m(t,r,n);if("normal"===s.type){if(o=n.done?h:f,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=h,n.method="throw",n.arg=s.arg)}}}function j(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,j(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=m(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(ns(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,l,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},k(S),s(S,c,"Generator"),s(S,i,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=_,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return l.type="throw",l.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],l=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:_(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function as(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=ns(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=ns(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ns(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function is(e,t,r,n,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,o)}function ls(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){is(a,n,o,i,l,"next",e)}function l(e){is(a,n,o,i,l,"throw",e)}i(void 0)}))}}function cs(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function ss(t){var r=t.updateSettings,n=t.settings,o=jc({autoPrompt:!1}).isAuthenticated,a=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return cs(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?cs(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(!1),2),i=a[0],l=a[1],c=function(){var e=ls(os().mark((function e(t,r){return os().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Dt()({path:"/sws/v1/settings/update-gateway-settings",method:"POST",data:as({},t,r)});case 3:e.next=9;break;case 5:throw e.prev=5,e.t0=e.catch(0),F.error("Failed to update gateway: ".concat(e.t0.message)),e.t0;case 9:case"end":return e.stop()}}),e,null,[[0,5]])})));return function(_x,t){return e.apply(this,arguments)}}(),s=function(){var e=ls(os().mark((function e(t){var n,a,i,s;return os().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.target.value,l(!0),e.prev=2,e.next=5,r("environment",n);case 5:return e.next=7,c("square_mode",n);case 7:if(!o){e.next=21;break}return e.next=10,Dt()({path:"/sws/v1/square/clear-token",method:"DELETE"});case 10:return F.info("Environment switched – please re-authorise Square"),e.next=13,fetch("https://api.squaresyncforwoo.com/wp-json/square-oauth/v1/generate-url",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:n,redirect_uri:"".concat(window.location.origin,"/wp-admin/admin.php?page=squarewoosync-pro#/settings/general")})});case 13:return a=e.sent,e.next=16,a.json();case 16:if(i=e.sent,!(s=i.oauthUrl)){e.next=21;break}return window.location.href=s,e.abrupt("return");case 21:F.success("Environment updated."),e.next=26;break;case 24:e.prev=24,e.t0=e.catch(2);case 26:return e.prev=26,l(!1),e.finish(26);case 29:case"end":return e.stop()}}),e,null,[[2,24,26,29]])})));return function(t){return e.apply(this,arguments)}}();return wp.element.createElement("div",{className:"px-4 pb-5"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Environment"),wp.element.createElement("p",{className:"mt-2 max-w-xl text-sm text-gray-500"},"Switch between your live Square account and the Sandbox. ",wp.element.createElement("b",null,"Please note"),", to use sandbox you must create a Square developer account and login to the test environment before authenticating. Please refer to the documentation on our website."),wp.element.createElement("select",{id:"environment",className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 mt-2 !pr-10",value:n.environment||"live",onChange:s,disabled:i},wp.element.createElement("option",{value:"live"},"Live"),wp.element.createElement("option",{value:"sandbox"},"Sandbox")))}function us(){lr();var e=Dr(),t=e.settings,r=e.updateSettings,n=e.settingsLoading,o=Fc(),a=o.locations,i=o.loading,l=(o.error,o.refetchLocations);return o.setLocations,wp.element.createElement(rs,null,n?wp.element.createElement("div",null,"Loading..."):wp.element.createElement(React.Fragment,null,wp.element.createElement(Bc,null),wp.element.createElement(ss,{updateSettings:r,environment:t.environment,settings:t}),wp.element.createElement(Yc,{updateSettings:r,locations:a,locationsLoading:i,settings:t,refetchLocations:l})))}function ms(e){return ms="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ms(e)}function ps(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function fs(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=ms(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=ms(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ms(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ds(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const hs=function(t){var r=t.settings,n=(t.updateSettings,t.settingsLoading,(0,e.useState)(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ps(Object(r),!0).forEach((function(t){fs(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ps(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},r.customers.auto.squareWoo))),o=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ds(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ds(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(n,2),a=o[0],i=o[1];return(0,e.useEffect)((function(){i(r.customers.auto.squareWoo)}),[r]),a.first_name,a.last_name,a.address,a.phone,a.role,wp.element.createElement("div",{className:"px-4 pb-3 sm:px-6 mt-4"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Automatic Customer Syncing",wp.element.createElement("a",{className:"pro-badge !relative",href:"https://squaresyncforwoo.com",target:"_blank"},"PRO ONLY")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",null,"Sync your customer info in real-time from Square to WooCommerce and vise-versa.",wp.element.createElement("br",null))),wp.element.createElement("div",{className:""},wp.element.createElement("label",{className:"relative inline-flex items-center cursor-pointer justify-start"},wp.element.createElement("input",{type:"checkbox",checked:!1,disabled:!0,className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer  peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all  peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Square to Woo (Webhook customer.updated must be setup)"))))};function gs(e){return gs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gs(e)}function ys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function vs(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=gs(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=gs(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==gs(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ws(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const bs=function(t){var r=t.settings,n=(t.updateSettings,t.settingsLoading,(0,e.useState)(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ys(Object(r),!0).forEach((function(t){vs(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},r.customers.auto.wooSquare))),o=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ws(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ws(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(n,2),a=o[0],i=o[1];return(0,e.useEffect)((function(){i(r.customers.auto.wooSquare)}),[r]),a.first_name,a.last_name,a.address,a.phone,a.role,wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6"},wp.element.createElement("div",{className:""},wp.element.createElement("label",{className:"relative inline-flex items-center cursor-pointer justify-start"},wp.element.createElement("input",{type:"checkbox",checked:!1,disabled:!0,className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer  peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all  peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Woo to Square"))))},xs=function(e){var t=e.settings;return e.updateSettings,e.setSettings,t.customers,wp.element.createElement("div",{className:"px-4 pb-3 sm:px-6 mt-4"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Auto Customer Matching",wp.element.createElement("a",{className:"pro-badge !relative",href:"https://squaresyncforwoo.com",target:"_blank"},"PRO ONLY")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Automatically match newly created WordPress or Square users with existing accounts on the corresponding platform. This will also set the users role based on the role mapping setup.")),wp.element.createElement("div",{className:"flex flex-col gap-3"},wp.element.createElement("label",{className:"relative inline-flex items-center cursor-pointer justify-start"},wp.element.createElement("input",{type:"checkbox",checked:!1,className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer  peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all  peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Square to Woo (Webhook customer.created must be setup)")),wp.element.createElement("label",{className:"relative inline-flex items-center cursor-pointer justify-start"},wp.element.createElement("input",{type:"checkbox",checked:!1,className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer  peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all  peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Woo to Square"))))},Es=function(e){var t=e.settings;return e.updateSettings,e.setSettings,t.customers,wp.element.createElement("div",{className:"px-4 pb-3 sm:px-6 mt-4"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Auto Customer Creation",wp.element.createElement("a",{className:"pro-badge !relative",href:"https://squaresyncforwoo.com",target:"_blank"},"PRO ONLY")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Automatically create Square and WordPress users when one is created on either platform. User roles and groups will be automatically assigned based on role mappings.")),wp.element.createElement("div",{className:"flex flex-col gap-3"},wp.element.createElement("label",{className:"relative inline-flex items-center cursor-pointer justify-start"},wp.element.createElement("input",{type:"checkbox",checked:!1,disabled:!0,className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer  peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all  peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Square to Woo (Webhook customer.created must be setup)")),wp.element.createElement("label",{className:"relative inline-flex items-center cursor-pointer justify-start"},wp.element.createElement("input",{type:"checkbox",checked:!1,disabled:!0,className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer  peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all  peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Woo to Square"))))};function Ss(e){return Ss="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ss(e)}function ks(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ns(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=Ss(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=Ss(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ss(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Os(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const js=function(t){var r=t.settings,n=(t.updateSettings,t.settingsLoading),o=(0,e.useState)(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ks(Object(r),!0).forEach((function(t){Ns(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ks(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},r.squareAuto)),a=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Os(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Os(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(o,2),i=a[0],l=a[1];(0,e.useEffect)((function(){l(r.squareAuto)}),[r]);var c=function(e){var t=e.id,r=e.label;return e.checked,e.squareWoo,wp.element.createElement("li",{className:"w-auto mb-0"},wp.element.createElement("div",{className:"flex items-center gap-2 p-4"},wp.element.createElement("input",{id:t,type:"checkbox",checked:!1,className:"!m-0 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 focus:ring-2 leading-normal"}),wp.element.createElement("label",{htmlFor:t,className:"w-full text-sm font-light text-gray-700 leading-normal"},r)))},s=[{id:"stock",label:"Stock",checked:i.stock||!1},{id:"title",label:"Title",checked:i.title||!1},{id:"sku",label:"SKU",checked:i.sku||!1},{id:"price",label:"Price",checked:i.price||!1},{id:"description",label:"Description",checked:i.description||!1},{id:"images",label:"Images",checked:i.images||!1},{id:"category",label:"Category",checked:i.category||!1}];return wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Automatic syncing on product update",wp.element.createElement("a",{className:"pro-badge !relative",href:"https://squaresyncforwoo.com",target:"_blank"},"PRO ONLY")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",null,"Enable or disable automatic inventory syncing between Woo and Square effortlessly with our Inventory Sync Toggle. This automatic update is triggered when your Square or Woocommerce data is updated.",wp.element.createElement("br",null),wp.element.createElement("a",{href:"https://squaresyncforwoo.com/documentation#import-data",className:"underline text-sky-500",target:"_blank"},"How to setup and control automatic syncing between Square and Woo"))),wp.element.createElement("div",{className:""},wp.element.createElement("label",{className:"relative inline-flex items-center cursor-pointer justify-start"},wp.element.createElement("input",{type:"checkbox",checked:!1,disabled:!0,className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer  peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all  peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Square to woo (Webhook must be setup)")),i.isActive&&!n&&wp.element.createElement(React.Fragment,null,wp.element.createElement("ul",{className:"text-sm font-medium text-gray-900 bg-white my-3 flex flex-wrap fit-content"},s.map((function(e){return wp.element.createElement(c,{key:e.id,id:e.id,label:e.label,checked:e.checked,squareWoo:i})}))))))};function Cs(e){return Cs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Cs(e)}function Ls(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ps(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ls(Object(r),!0).forEach((function(t){_s(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ls(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _s(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=Cs(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=Cs(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Cs(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Rs(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const Is=function(t){var r=t.settings,n=t.updateSettings,o=t.settingsLoading,a=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Rs(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Rs(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(Ps({},r.wooAuto)),2),i=a[0],l=a[1];(0,e.useEffect)((function(){l(r.wooAuto)}),[r]);var c=function(e){var t=e.id,r=e.label,o=e.checked;return e.squareWoo,wp.element.createElement("li",{className:"w-auto mb-0"},wp.element.createElement("div",{className:"flex items-center gap-2 p-4"},wp.element.createElement("input",{id:t,type:"checkbox",checked:!1,onChange:function(){return n("wooAuto",Ps(Ps({},i),{},_s({},t,!o)))},className:"!m-0 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 focus:ring-2 leading-normal"}),wp.element.createElement("label",{htmlFor:t,className:"w-full text-sm font-light text-gray-700 leading-normal"},r)))},s=[{id:"stock",label:"Stock",checked:i.stock||!1}];return wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6"},wp.element.createElement("div",{className:"mb-6"},wp.element.createElement("label",{className:"relative inline-flex items-center cursor-pointer"},wp.element.createElement("input",{type:"checkbox",checked:!1,className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer  peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all  peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Woo to Square")),i.isActive&&!o&&wp.element.createElement(React.Fragment,null,wp.element.createElement("p",{className:"mt-4"},"Sync stock on order processing. Stock/Inventory count is the the sole permitted auto-sync option from Woo to Square (other wise an infinite update loop is created, we don't want that). You can also manually sync from the product actions."),wp.element.createElement("ul",{className:"fit-content flex-wrap items-center justify-start text-sm font-medium text-gray-900 bg-white  sm:flex"},s.map((function(e){return wp.element.createElement(c,{key:e.id,id:e.id,label:e.label,checked:e.checked,squareWoo:i})}))))))};var As=Object.defineProperty,Ts=(e,t,r)=>(((e,t,r)=>{t in e?As(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r);let Fs=new class{constructor(){Ts(this,"current",this.detect()),Ts(this,"handoffState","pending"),Ts(this,"currentId",0)}set(e){this.current!==e&&(this.handoffState="pending",this.currentId=0,this.current=e)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return"server"===this.current}get isClient(){return"client"===this.current}detect(){return"undefined"==typeof window||"undefined"==typeof document?"server":"client"}handoff(){"pending"===this.handoffState&&(this.handoffState="complete")}get isHandoffComplete(){return"complete"===this.handoffState}},Ms=(e,r)=>{Fs.isServer?(0,t.useEffect)(e,r):(0,t.useLayoutEffect)(e,r)};function Ds(e){let r=(0,t.useRef)(e);return Ms((()=>{r.current=e}),[e]),r}let Gs=function(e){let r=Ds(e);return t.useCallback(((...e)=>r.current(...e)),[r])};function qs(e,r,n){let[o,a]=(0,t.useState)(n),i=void 0!==e,l=(0,t.useRef)(i),c=(0,t.useRef)(!1),s=(0,t.useRef)(!1);return!i||l.current||c.current?!i&&l.current&&!s.current&&(s.current=!0,l.current=i,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")):(c.current=!0,l.current=i,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")),[i?e:o,Gs((e=>(i||a(e),null==r?void 0:r(e))))]}function Vs(){let e=[],t={addEventListener:(e,r,n,o)=>(e.addEventListener(r,n,o),t.add((()=>e.removeEventListener(r,n,o)))),requestAnimationFrame(...e){let r=requestAnimationFrame(...e);return t.add((()=>cancelAnimationFrame(r)))},nextFrame:(...e)=>t.requestAnimationFrame((()=>t.requestAnimationFrame(...e))),setTimeout(...e){let r=setTimeout(...e);return t.add((()=>clearTimeout(r)))},microTask(...e){let r={current:!0};return function(e){"function"==typeof queueMicrotask?queueMicrotask(e):Promise.resolve().then(e).catch((e=>setTimeout((()=>{throw e}))))}((()=>{r.current&&e[0]()})),t.add((()=>{r.current=!1}))},style(e,t,r){let n=e.style.getPropertyValue(t);return Object.assign(e.style,{[t]:r}),this.add((()=>{Object.assign(e.style,{[t]:n})}))},group(e){let t=Vs();return e(t),this.add((()=>t.dispose()))},add:t=>(e.push(t),()=>{let r=e.indexOf(t);if(r>=0)for(let t of e.splice(r,1))t()}),dispose(){for(let t of e.splice(0))t()}};return t}function Ws(){let[e]=(0,t.useState)(Vs);return(0,t.useEffect)((()=>()=>e.dispose()),[e]),e}var zs;let Bs=null!=(zs=t.useId)?zs:function(){let e=function(){let e=function(){let e="undefined"==typeof document;return"useSyncExternalStore"in r&&(e=>e.useSyncExternalStore)(r)((()=>()=>{}),(()=>!1),(()=>!e))}(),[n,o]=t.useState(Fs.isHandoffComplete);return n&&!1===Fs.isHandoffComplete&&o(!1),t.useEffect((()=>{!0!==n&&o(!0)}),[n]),t.useEffect((()=>Fs.handoff()),[]),!e&&n}(),[n,o]=t.useState(e?()=>Fs.nextId():null);return Ms((()=>{null===n&&o(Fs.nextId())}),[n]),null!=n?""+n:void 0};function Us(e){var t;if(e.type)return e.type;let r=null!=(t=e.as)?t:"button";return"string"==typeof r&&"button"===r.toLowerCase()?"button":void 0}function Hs(e,r){let[n,o]=(0,t.useState)((()=>Us(e)));return Ms((()=>{o(Us(e))}),[e.type,e.as]),Ms((()=>{n||r.current&&r.current instanceof HTMLButtonElement&&!r.current.hasAttribute("type")&&o("button")}),[n,r]),n}let $s=Symbol();function Zs(...e){let r=(0,t.useRef)(e);(0,t.useEffect)((()=>{r.current=e}),[e]);let n=Gs((e=>{for(let t of r.current)null!=t&&("function"==typeof t?t(e):t.current=e)}));return e.every((e=>null==e||(null==e?void 0:e[$s])))?void 0:n}function Ys(...e){return Array.from(new Set(e.flatMap((e=>"string"==typeof e?e.split(" "):[])))).filter(Boolean).join(" ")}function Ks(e,t,...r){if(e in t){let n=t[e];return"function"==typeof n?n(...r):n}let n=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(n,Ks),n}var Xs,Js=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Js||{}),Qs=((Xs=Qs||{})[Xs.Unmount=0]="Unmount",Xs[Xs.Hidden=1]="Hidden",Xs);function eu({ourProps:e,theirProps:t,slot:r,defaultTag:n,features:o,visible:a=!0,name:i,mergeRefs:l}){l=null!=l?l:ru;let c=nu(t,e);if(a)return tu(c,r,n,i,l);let s=null!=o?o:0;if(2&s){let{static:e=!1,...t}=c;if(e)return tu(t,r,n,i,l)}if(1&s){let{unmount:e=!0,...t}=c;return Ks(e?0:1,{0:()=>null,1:()=>tu({...t,hidden:!0,style:{display:"none"}},r,n,i,l)})}return tu(c,r,n,i,l)}function tu(e,r={},n,o,a){let{as:i=n,children:l,refName:c="ref",...s}=iu(e,["unmount","static"]),u=void 0!==e.ref?{[c]:e.ref}:{},m="function"==typeof l?l(r):l;"className"in s&&s.className&&"function"==typeof s.className&&(s.className=s.className(r));let p={};if(r){let e=!1,t=[];for(let[n,o]of Object.entries(r))"boolean"==typeof o&&(e=!0),!0===o&&t.push(n);e&&(p["data-headlessui-state"]=t.join(" "))}if(i===t.Fragment&&Object.keys(au(s)).length>0){if(!(0,t.isValidElement)(m)||Array.isArray(m)&&m.length>1)throw new Error(['Passing props on "Fragment"!',"",`The current component <${o} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(s).map((e=>`  - ${e}`)).join("\n"),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map((e=>`  - ${e}`)).join("\n")].join("\n"));let e=m.props,r="function"==typeof(null==e?void 0:e.className)?(...t)=>Ys(null==e?void 0:e.className(...t),s.className):Ys(null==e?void 0:e.className,s.className),n=r?{className:r}:{};return(0,t.cloneElement)(m,Object.assign({},nu(m.props,au(iu(s,["ref"]))),p,u,{ref:a(m.ref,u.ref)},n))}return(0,t.createElement)(i,Object.assign({},iu(s,["ref"]),i!==t.Fragment&&u,i!==t.Fragment&&p),m)}function ru(...e){return e.every((e=>null==e))?void 0:t=>{for(let r of e)null!=r&&("function"==typeof r?r(t):r.current=t)}}function nu(...e){if(0===e.length)return{};if(1===e.length)return e[0];let t={},r={};for(let n of e)for(let e in n)e.startsWith("on")&&"function"==typeof n[e]?(null!=r[e]||(r[e]=[]),r[e].push(n[e])):t[e]=n[e];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(r).map((e=>[e,void 0]))));for(let e in r)Object.assign(t,{[e](t,...n){let o=r[e];for(let e of o){if((t instanceof Event||(null==t?void 0:t.nativeEvent)instanceof Event)&&t.defaultPrevented)return;e(t,...n)}}});return t}function ou(e){var r;return Object.assign((0,t.forwardRef)(e),{displayName:null!=(r=e.displayName)?r:e.name})}function au(e){let t=Object.assign({},e);for(let e in t)void 0===t[e]&&delete t[e];return t}function iu(e,t=[]){let r=Object.assign({},e);for(let e of t)e in r&&delete r[e];return r}var lu=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(lu||{});let cu=ou((function(e,t){var r;let{features:n=1,...o}=e;return eu({ourProps:{ref:t,"aria-hidden":2==(2&n)||(null!=(r=o["aria-hidden"])?r:void 0),style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...4==(4&n)&&2!=(2&n)&&{display:"none"}}},theirProps:o,slot:{},defaultTag:"div",name:"Hidden"})}));function su(e){let t=e.parentElement,r=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(r=t),t=t.parentElement;let n=""===(null==t?void 0:t.getAttribute("disabled"));return(!n||!function(e){if(!e)return!1;let t=e.previousElementSibling;for(;null!==t;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}(r))&&n}function uu(e={},t=null,r=[]){for(let[n,o]of Object.entries(e))pu(r,mu(t,n),o);return r}function mu(e,t){return e?e+"["+t+"]":t}function pu(e,t,r){if(Array.isArray(r))for(let[n,o]of r.entries())pu(e,mu(t,n.toString()),o);else r instanceof Date?e.push([t,r.toISOString()]):"boolean"==typeof r?e.push([t,r?"1":"0"]):"string"==typeof r?e.push([t,r]):"number"==typeof r?e.push([t,`${r}`]):null==r?e.push([t,""]):uu(r,t,e)}function fu(e){var t,r;let n=null!=(t=null==e?void 0:e.form)?t:e.closest("form");if(n){for(let t of n.elements)if(t!==e&&("INPUT"===t.tagName&&"submit"===t.type||"BUTTON"===t.tagName&&"submit"===t.type||"INPUT"===t.nodeName&&"image"===t.type))return void t.click();null==(r=n.requestSubmit)||r.call(n)}}let du=(0,t.createContext)(null);function hu(){let e=(0,t.useContext)(du);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,hu),e}return e}function gu(){let[e,r]=(0,t.useState)([]);return[e.length>0?e.join(" "):void 0,(0,t.useMemo)((()=>function(e){let n=Gs((e=>(r((t=>[...t,e])),()=>r((t=>{let r=t.slice(),n=r.indexOf(e);return-1!==n&&r.splice(n,1),r}))))),o=(0,t.useMemo)((()=>({register:n,slot:e.slot,name:e.name,props:e.props})),[n,e.slot,e.name,e.props]);return t.createElement(du.Provider,{value:o},e.children)}),[r])]}let yu=ou((function(e,t){let r=Bs(),{id:n=`headlessui-description-${r}`,...o}=e,a=hu(),i=Zs(t);return Ms((()=>a.register(n)),[n,a.register]),eu({ourProps:{ref:i,...a.props,id:n},theirProps:o,slot:a.slot||{},defaultTag:"p",name:a.name||"Description"})})),vu=Object.assign(yu,{});var wu=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(wu||{});let bu=(0,t.createContext)(null);function xu(){let e=(0,t.useContext)(bu);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,xu),e}return e}function Eu(){let[e,r]=(0,t.useState)([]);return[e.length>0?e.join(" "):void 0,(0,t.useMemo)((()=>function(e){let n=Gs((e=>(r((t=>[...t,e])),()=>r((t=>{let r=t.slice(),n=r.indexOf(e);return-1!==n&&r.splice(n,1),r}))))),o=(0,t.useMemo)((()=>({register:n,slot:e.slot,name:e.name,props:e.props})),[n,e.slot,e.name,e.props]);return t.createElement(bu.Provider,{value:o},e.children)}),[r])]}let Su=ou((function(e,t){let r=Bs(),{id:n=`headlessui-label-${r}`,passive:o=!1,...a}=e,i=xu(),l=Zs(t);Ms((()=>i.register(n)),[n,i.register]);let c={ref:l,...i.props,id:n};return o&&("onClick"in c&&(delete c.htmlFor,delete c.onClick),"onClick"in a&&delete a.onClick),eu({ourProps:c,theirProps:a,slot:i.slot||{},defaultTag:"label",name:i.name||"Label"})})),ku=Object.assign(Su,{}),Nu=(0,t.createContext)(null);Nu.displayName="GroupContext";let Ou=t.Fragment,ju=ou((function(e,r){let n=Bs(),{id:o=`headlessui-switch-${n}`,checked:a,defaultChecked:i=!1,onChange:l,name:c,value:s,form:u,...m}=e,p=(0,t.useContext)(Nu),f=(0,t.useRef)(null),d=Zs(f,r,null===p?null:p.setSwitch),[h,g]=qs(a,l,i),y=Gs((()=>null==g?void 0:g(!h))),v=Gs((e=>{if(su(e.currentTarget))return e.preventDefault();e.preventDefault(),y()})),w=Gs((e=>{e.key===wu.Space?(e.preventDefault(),y()):e.key===wu.Enter&&fu(e.currentTarget)})),b=Gs((e=>e.preventDefault())),x=(0,t.useMemo)((()=>({checked:h})),[h]),E={id:o,ref:d,role:"switch",type:Hs(e,f),tabIndex:0,"aria-checked":h,"aria-labelledby":null==p?void 0:p.labelledby,"aria-describedby":null==p?void 0:p.describedby,onClick:v,onKeyUp:w,onKeyPress:b},S=Ws();return(0,t.useEffect)((()=>{var e;let t=null==(e=f.current)?void 0:e.closest("form");t&&void 0!==i&&S.addEventListener(t,"reset",(()=>{g(i)}))}),[f,g]),t.createElement(t.Fragment,null,null!=c&&h&&t.createElement(cu,{features:lu.Hidden,...au({as:"input",type:"checkbox",hidden:!0,readOnly:!0,form:u,checked:h,name:c,value:s})}),eu({ourProps:E,theirProps:m,slot:x,defaultTag:"button",name:"Switch"}))})),Cu=Object.assign(ju,{Group:function(e){var r;let[n,o]=(0,t.useState)(null),[a,i]=Eu(),[l,c]=gu(),s=(0,t.useMemo)((()=>({switch:n,setSwitch:o,labelledby:a,describedby:l})),[n,o,a,l]),u=e;return t.createElement(c,{name:"Switch.Description"},t.createElement(i,{name:"Switch.Label",props:{htmlFor:null==(r=s.switch)?void 0:r.id,onClick(e){n&&("LABEL"===e.currentTarget.tagName&&e.preventDefault(),n.click(),n.focus({preventScroll:!0}))}}},t.createElement(Nu.Provider,{value:s},eu({ourProps:{},theirProps:u,defaultTag:Ou,name:"Switch.Group"}))))},Label:ku,Description:vu});const Lu=function(e){return e.setSettings,e.updateSettings,e.settings,wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6 mt-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Automatically create Square products",wp.element.createElement("a",{className:"pro-badge !relative",href:"https://squaresyncforwoo.com",target:"_blank"},"PRO ONLY")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"When this feature is enabled, every time you create a new product in WooCommerce, it will automatically be exported and linked to your Square account. This ensures that your product listings are consistently updated across both platforms, saving you time and maintaining synchronization between your WooCommerce store and Square inventory."),wp.element.createElement(Cu,{checked:!1,className:"bg-gray-200 relative inline-flex h-6 w-11 items-center rounded-full"},wp.element.createElement("span",{className:"sr-only"},"Enable auto product creation"),wp.element.createElement("span",{className:"translate-x-1 inline-block h-4 w-4 transform rounded-full bg-white transition"}))))};function Pu(e){return Pu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Pu(e)}function _u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ru(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_u(Object(r),!0).forEach((function(t){Iu(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_u(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Iu(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=Pu(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=Pu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Pu(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Au(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const Tu=function(r){var n,o,a,i,l,c=r.settings,s=r.updateSettings,u=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Au(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Au(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,t.useState)(c.cron.schedule||"hourly"),2),m=u[0],p=u[1];(0,e.useEffect)((function(){c.cron&&c.cron.schedule?p(c.cron.schedule):console.log("Settings not loaded or missing cron.scheduleFrequency")}),[c]);var f=[{id:"stock",label:"Stock",checked:(null===(n=c.cron.dataToUpdate)||void 0===n?void 0:n.stock)||!1},{id:"title",label:"Title",checked:(null===(o=c.cron.dataToUpdate)||void 0===o?void 0:o.title)||!1},{id:"sku",label:"SKU",checked:(null===(a=c.cron.dataToUpdate)||void 0===a?void 0:a.sku)||!1},{id:"price",label:"Price",checked:(null===(i=c.cron.dataToUpdate)||void 0===i?void 0:i.price)||!1},{id:"description",label:"Description",checked:(null===(l=c.cron.dataToUpdate)||void 0===l?void 0:l.description)||!1}],d=function(e){var t=e.id,r=e.label,n=e.checked,o=e.cron;return wp.element.createElement("li",{className:"w-auto mb-0"},wp.element.createElement("div",{className:"flex items-center gap-1"},wp.element.createElement("input",{id:t,type:"checkbox",checked:n,onChange:function(){return s("cron",Ru(Ru({},o),{},{dataToUpdate:Ru(Ru({},o.dataToUpdate),{},Iu({},t,!n))}))},className:"!m-0 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 focus:ring-2 leading-normal"}),wp.element.createElement("label",{htmlFor:t,className:"w-full text-sm font-light text-gray-700 leading-normal"},r)))};return wp.element.createElement("div",null,wp.element.createElement("div",{className:"flex flex-col gap-2 my-2"},wp.element.createElement("fieldset",null,wp.element.createElement("legend",{className:"font-semibold text-base mb-4"},"Select schedule frequency:"),wp.element.createElement("div",{className:"space-y-2"},["hourly","twicedaily","daily","weekly"].map((function(e){return wp.element.createElement("div",{key:e,className:"flex items-center"},wp.element.createElement("input",{id:e,type:"radio",name:"scheduleFrequency",value:e,checked:m===e,onChange:function(e){s("cron",Ru(Ru({},c.cron),{},{schedule:e.target.value})),p(e.target.value)},className:"focus:ring-sky-500 h-4 w-4 text-sky-600 border-gray-300"}),wp.element.createElement("label",{htmlFor:e,className:"ml-1 block text-sm capitalize"},e," ",wp.element.createElement("span",{className:"text-gray-500 text-sm"},"twicedaily"===e||"daily"===e?"(starting midnight)":"weekly"===e?"(starting monday at midnight)":"")))})),wp.element.createElement("div",{className:"flex items-center"},wp.element.createElement("input",{id:"custom",type:"radio",name:"scheduleFrequency",disabled:!0,className:"focus:ring-sky-500 h-4 w-4 text-sky-600 border-gray-300"}),wp.element.createElement("label",{htmlFor:"custom",className:"ml-1 block text-sm capitalize"},"Custom",wp.element.createElement("span",{className:"text-gray-500 text-sm"}," (coming soon)")))))),wp.element.createElement("p",{className:"font-semibold text-base mt-4"},"Data to update:"),wp.element.createElement("ul",{className:"text-sm font-medium text-gray-900 bg-white flex flex-wrap gap-2 mt-2"},f.map((function(e){return wp.element.createElement(d,{key:e.id,id:e.id,label:e.label,checked:e.checked,cron:c.cron})}))))};function Fu(e){return Fu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Fu(e)}function Mu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Du(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Mu(Object(r),!0).forEach((function(t){Gu(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Mu(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Gu(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=Fu(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=Fu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Fu(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function qu(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Vu(t){var r=t.settings,n=t.updateSettings,o=t.setSettings,a=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return qu(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?qu(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)("square"===r.cron.source),2),i=a[0],l=a[1];return wp.element.createElement("div",{className:"blur-sm"},wp.element.createElement("p",{className:"text-base font-semibold mb-2"},"Source of truth:"),wp.element.createElement("p",{className:"text-sm text-gray-500"},"The Source of Trust setting determines the primary source for your product information. Choose Square to automatically sync and update your product details based on data from Square. This option is ideal if Square is your primary platform for inventory and sales management. Alternatively, selecting Woocommerce means your product updates will be based on the information stored within your WooCommerce system, best for those who manage their inventory directly through WooCommerce."),wp.element.createElement("div",{className:"flex gap-2 items-center my-4"},wp.element.createElement("p",{className:"font-semibold text-sm"},"Woocommerce"),wp.element.createElement(Cu,{checked:i,onChange:function(e){l(e),n("cron",Du(Du({},r.cron),{},{source:e?"square":"woocommerce"}))},className:Za(i?"bg-slate-950":"bg-purple-500","relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-sky-600 focus:ring-offset-2")},wp.element.createElement("span",{className:"sr-only"},"Source of truth"),wp.element.createElement("span",{className:Za(i?"translate-x-5":"translate-x-0","pointer-events-none relative inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out")},wp.element.createElement("span",{className:Za(i?"opacity-0 duration-100 ease-out":"opacity-100 duration-200 ease-in","absolute inset-0 flex h-full w-full items-center justify-center transition-opacity"),"aria-hidden":"true"},wp.element.createElement("span",{className:"font-semibold text-purple-500 p-0 m-0 flex items-center justify-center text-xs leading-none pb-[2px]"},"w")),wp.element.createElement("span",{className:Za(i?"opacity-100 duration-200 ease-in":"opacity-0 duration-100 ease-out","absolute inset-0 flex h-full w-full items-center justify-center transition-opacity"),"aria-hidden":"true"},wp.element.createElement("span",{className:"font-semibold text-slate-950 p-0 m-0 flex items-center justify-center text-xs leading-none pb-[3px]"},"s")))),wp.element.createElement("p",{className:"font-semibold text-sm"},"Square")),wp.element.createElement("p",{className:"text-base font-semibold mb-2"},"Build your own schedule:"),wp.element.createElement("p",{className:"text-sm text-gray-500"},"Setup your update schedule! Please be aware that updating, particularly with a large product inventory, may significantly impact server performance. To minimize potential strain, we recommend spacing your updates to the maximum extent feasible and verifying that your server infrastructure is robust enough to manage the load smoothly. This approach helps ensure a seamless operation and maintains optimal system performance."),wp.element.createElement("div",null,wp.element.createElement(Tu,{settings:r,updateSettings:n})),wp.element.createElement("p",{className:"text-base font-semibold mt-4"},"Batches:"),wp.element.createElement("p",{className:"text-sm text-gray-500"},"How many products to be updated per batch. A higher number will put greater load on the server."),wp.element.createElement("p",{className:"mt-2"},"Products will be updated in batches of:"," ",wp.element.createElement("span",{className:"text-sky-500 font-bold"},r.cron.batches)),wp.element.createElement("div",{className:"flex items-center gap-1 mt-2"},wp.element.createElement("p",null,"10"),wp.element.createElement("div",{className:"relative w-[300px]"},wp.element.createElement("input",{id:"steps-range",type:"range",min:"10",max:"100",onChange:function(e){console.log(e),o((function(t){return Du(Du({},t),{},{batches:e.target.value})})),n("cron",Du(Du({},r.cron),{},{batches:e.target.value}))},value:r.cron.batches,step:"10",className:"w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer"})),wp.element.createElement("p",null,"100")))}const Wu=function(e){var t=e.setSettings,r=e.updateSettings,n=e.settings;return wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Automatic update scheduler",wp.element.createElement("a",{className:"pro-badge !relative",href:"https://squaresyncforwoo.com",target:"_blank"},"PRO ONLY")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"The Automatic Update Scheduler allows you to set up a recurring schedule for product updates, adding another level of data accuracy, ensuring your information stays current without manual intervention. Simply select the frequency of updates—daily, weekly, or monthly—and the system will automatically apply the latest updates according to your chosen schedule."),wp.element.createElement(Cu,{checked:n.cron.enabled,className:"".concat(n.cron.enabled?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"sr-only"},"Enable notifications"),wp.element.createElement("span",{className:"".concat(n.cron.enabled?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")}))),wp.element.createElement(Vu,{settings:n,updateSettings:r,setSettings:t}))},zu=function(e){e.setSettings,e.updateSettings;var t=e.settings;return wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6 mt-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Automatically delete Square & Woo products",wp.element.createElement("a",{className:"pro-badge !relative",href:"https://squaresyncforwoo.com",target:"_blank"},"PRO ONLY")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Choose whether to automatically delete or archive products in Square or WooCommerce when they are removed from their respective catalogs. Archived products in Square will be put to 'draft' in WooCommerce, whereas deleted products will be moved to trash."),t.squareAuto.isActive?wp.element.createElement(React.Fragment,null,"  ",wp.element.createElement("div",{className:"flex items-center"},wp.element.createElement(Cu,{checked:t.wooAuto.autoDeleteProduct,className:"".concat(t.wooAuto.autoDeleteProduct?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"sr-only"},"Enable auto product deletion"),wp.element.createElement("span",{className:"".concat(t.wooAuto.autoDeleteProduct?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Woo to Square")),wp.element.createElement("div",{className:"flex items-center mt-4"},wp.element.createElement(Cu,{checked:t.squareAuto.autoDeleteProduct,className:"".concat(t.squareAuto.autoDeleteProduct?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"sr-only"},"Enable auto product deletion"),wp.element.createElement("span",{className:"".concat(t.squareAuto.autoDeleteProduct?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Square to Woo"))):wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"font-semibold"},"Square to Woo automatic syncing on product update with webhook setup must be enabled to use this feature."))))},Bu=function(e){return e.updateSettings,e.settings,wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6 mt-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Automatically create WooCommerce products",wp.element.createElement("a",{className:"pro-badge !relative",href:"https://squaresyncforwoo.com",target:"_blank"},"PRO ONLY")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"When this feature is enabled, every time you create a new product in Square, it will be imported into WooCommerce and linked automatically. This ensures that your product listings are consistently updated across both platforms, saving you time and maintaining synchronization between your WooCommerce store and Square inventory. ",wp.element.createElement("span",{className:"italic font-semibold"},"Automatic syncing on product update (Square to Woo) must be enabled."))))};function Uu(e){return Fs.isServer?null:e instanceof Node?e.ownerDocument:null!=e&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}let Hu=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map((e=>`${e}:not([tabindex='-1'])`)).join(",");var $u=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e))($u||{}),Zu=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(Zu||{}),Yu=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(Yu||{});var Ku=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Ku||{}),Xu=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(Xu||{});"undefined"!=typeof window&&"undefined"!=typeof document&&(document.addEventListener("keydown",(e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")}),!0),document.addEventListener("click",(e=>{1===e.detail?delete document.documentElement.dataset.headlessuiFocusVisible:0===e.detail&&(document.documentElement.dataset.headlessuiFocusVisible="")}),!0));let Ju=["textarea","input"].join(",");function Qu(e,t=(e=>e)){return e.slice().sort(((e,r)=>{let n=t(e),o=t(r);if(null===n||null===o)return 0;let a=n.compareDocumentPosition(o);return a&Node.DOCUMENT_POSITION_FOLLOWING?-1:a&Node.DOCUMENT_POSITION_PRECEDING?1:0}))}function em(e,t,{sorted:r=!0,relativeTo:n=null,skipElements:o=[]}={}){let a=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,i=Array.isArray(e)?r?Qu(e):e:function(e=document.body){return null==e?[]:Array.from(e.querySelectorAll(Hu)).sort(((e,t)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER))))}(e);o.length>0&&i.length>1&&(i=i.filter((e=>!o.includes(e)))),n=null!=n?n:a.activeElement;let l,c=(()=>{if(5&t)return 1;if(10&t)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),s=(()=>{if(1&t)return 0;if(2&t)return Math.max(0,i.indexOf(n))-1;if(4&t)return Math.max(0,i.indexOf(n))+1;if(8&t)return i.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),u=32&t?{preventScroll:!0}:{},m=0,p=i.length;do{if(m>=p||m+p<=0)return 0;let e=s+m;if(16&t)e=(e+p)%p;else{if(e<0)return 3;if(e>=p)return 1}l=i[e],null==l||l.focus(u),m+=c}while(l!==a.activeElement);return 6&t&&function(e){var t,r;return null!=(r=null==(t=null==e?void 0:e.matches)?void 0:t.call(e,Ju))&&r}(l)&&l.select(),2}var tm=(e=>(e[e.RegisterOption=0]="RegisterOption",e[e.UnregisterOption=1]="UnregisterOption",e))(tm||{});let rm={0(e,t){let r=[...e.options,{id:t.id,element:t.element,propsRef:t.propsRef}];return{...e,options:Qu(r,(e=>e.element.current))}},1(e,t){let r=e.options.slice(),n=e.options.findIndex((e=>e.id===t.id));return-1===n?e:(r.splice(n,1),{...e,options:r})}},nm=(0,t.createContext)(null);function om(e){let r=(0,t.useContext)(nm);if(null===r){let t=new Error(`<${e} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,om),t}return r}nm.displayName="RadioGroupDataContext";let am=(0,t.createContext)(null);function im(e){let r=(0,t.useContext)(am);if(null===r){let t=new Error(`<${e} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,im),t}return r}function lm(e,t){return Ks(t.type,rm,e,t)}am.displayName="RadioGroupActionsContext";var cm=(e=>(e[e.Empty=1]="Empty",e[e.Active=2]="Active",e))(cm||{});let sm=ou((function(e,r){let n=Bs(),{id:o=`headlessui-radiogroup-${n}`,value:a,defaultValue:i,form:l,name:c,onChange:s,by:u=((e,t)=>e===t),disabled:m=!1,...p}=e,f=Gs("string"==typeof u?(e,t)=>{let r=u;return(null==e?void 0:e[r])===(null==t?void 0:t[r])}:u),[d,h]=(0,t.useReducer)(lm,{options:[]}),g=d.options,[y,v]=Eu(),[w,b]=gu(),x=(0,t.useRef)(null),E=Zs(x,r),[S,k]=qs(a,s,i),N=(0,t.useMemo)((()=>g.find((e=>!e.propsRef.current.disabled))),[g]),O=(0,t.useMemo)((()=>g.some((e=>f(e.propsRef.current.value,S)))),[g,S]),j=Gs((e=>{var t;if(m||f(e,S))return!1;let r=null==(t=g.find((t=>f(t.propsRef.current.value,e))))?void 0:t.propsRef.current;return!(null!=r&&r.disabled||(null==k||k(e),0))}));!function({container:e,accept:r,walk:n,enabled:o=!0}){let a=(0,t.useRef)(r),i=(0,t.useRef)(n);(0,t.useEffect)((()=>{a.current=r,i.current=n}),[r,n]),Ms((()=>{if(!e||!o)return;let t=Uu(e);if(!t)return;let r=a.current,n=i.current,l=Object.assign((e=>r(e)),{acceptNode:r}),c=t.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,l,!1);for(;c.nextNode();)n(c.currentNode)}),[e,o,a,i])}({container:x.current,accept:e=>"radio"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT,walk(e){e.setAttribute("role","none")}});let C=Gs((e=>{let t=x.current;if(!t)return;let r=Uu(t),n=g.filter((e=>!1===e.propsRef.current.disabled)).map((e=>e.element.current));switch(e.key){case wu.Enter:fu(e.currentTarget);break;case wu.ArrowLeft:case wu.ArrowUp:if(e.preventDefault(),e.stopPropagation(),em(n,$u.Previous|$u.WrapAround)===Zu.Success){let e=g.find((e=>e.element.current===(null==r?void 0:r.activeElement)));e&&j(e.propsRef.current.value)}break;case wu.ArrowRight:case wu.ArrowDown:if(e.preventDefault(),e.stopPropagation(),em(n,$u.Next|$u.WrapAround)===Zu.Success){let e=g.find((e=>e.element.current===(null==r?void 0:r.activeElement)));e&&j(e.propsRef.current.value)}break;case wu.Space:{e.preventDefault(),e.stopPropagation();let t=g.find((e=>e.element.current===(null==r?void 0:r.activeElement)));t&&j(t.propsRef.current.value)}}})),L=Gs((e=>(h({type:0,...e}),()=>h({type:1,id:e.id})))),P=(0,t.useMemo)((()=>({value:S,firstOption:N,containsCheckedOption:O,disabled:m,compare:f,...d})),[S,N,O,m,f,d]),_=(0,t.useMemo)((()=>({registerOption:L,change:j})),[L,j]),R={ref:E,id:o,role:"radiogroup","aria-labelledby":y,"aria-describedby":w,onKeyDown:C},I=(0,t.useMemo)((()=>({value:S})),[S]),A=(0,t.useRef)(null),T=Ws();return(0,t.useEffect)((()=>{A.current&&void 0!==i&&T.addEventListener(A.current,"reset",(()=>{j(i)}))}),[A,j]),t.createElement(b,{name:"RadioGroup.Description"},t.createElement(v,{name:"RadioGroup.Label"},t.createElement(am.Provider,{value:_},t.createElement(nm.Provider,{value:P},null!=c&&null!=S&&uu({[c]:S}).map((([e,r],n)=>t.createElement(cu,{features:lu.Hidden,ref:0===n?e=>{var t;A.current=null!=(t=null==e?void 0:e.closest("form"))?t:null}:void 0,...au({key:e,as:"input",type:"radio",checked:null!=r,hidden:!0,readOnly:!0,form:l,name:e,value:r})}))),eu({ourProps:R,theirProps:p,slot:I,defaultTag:"div",name:"RadioGroup"})))))})),um=ou((function(e,r){var n;let o=Bs(),{id:a=`headlessui-radiogroup-option-${o}`,value:i,disabled:l=!1,...c}=e,s=(0,t.useRef)(null),u=Zs(s,r),[m,p]=Eu(),[f,d]=gu(),{addFlag:h,removeFlag:g,hasFlag:y}=function(e=0){let[r,n]=(0,t.useState)(e),o=function(){let e=(0,t.useRef)(!1);return Ms((()=>(e.current=!0,()=>{e.current=!1})),[]),e}(),a=(0,t.useCallback)((e=>{o.current&&n((t=>t|e))}),[r,o]),i=(0,t.useCallback)((e=>Boolean(r&e)),[r]),l=(0,t.useCallback)((e=>{o.current&&n((t=>t&~e))}),[n,o]),c=(0,t.useCallback)((e=>{o.current&&n((t=>t^e))}),[n]);return{flags:r,addFlag:a,hasFlag:i,removeFlag:l,toggleFlag:c}}(1),v=Ds({value:i,disabled:l}),w=om("RadioGroup.Option"),b=im("RadioGroup.Option");Ms((()=>b.registerOption({id:a,element:s,propsRef:v})),[a,b,s,v]);let x=Gs((e=>{var t;if(su(e.currentTarget))return e.preventDefault();b.change(i)&&(h(2),null==(t=s.current)||t.focus())})),E=Gs((e=>{if(su(e.currentTarget))return e.preventDefault();h(2)})),S=Gs((()=>g(2))),k=(null==(n=w.firstOption)?void 0:n.id)===a,N=w.disabled||l,O=w.compare(w.value,i),j={ref:u,id:a,role:"radio","aria-checked":O?"true":"false","aria-labelledby":m,"aria-describedby":f,"aria-disabled":!!N||void 0,tabIndex:N?-1:O||!w.containsCheckedOption&&k?0:-1,onClick:N?void 0:x,onFocus:N?void 0:E,onBlur:N?void 0:S},C=(0,t.useMemo)((()=>({checked:O,disabled:N,active:y(2)})),[O,N,y]);return t.createElement(d,{name:"RadioGroup.Description"},t.createElement(p,{name:"RadioGroup.Label"},eu({ourProps:j,theirProps:c,slot:C,defaultTag:"div",name:"RadioGroup.Option"})))})),mm=Object.assign(sm,{Option:um,Label:ku,Description:vu});function pm(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return fm(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?fm(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fm(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var dm=[{id:"square",title:"Let Square calculate",description:"Square will calculate points based on items contained in the order id. Item eligibility is determined by Square settings.",pros:["Points will be assigned to order and transaction","Easy to track point earning"],cons:["Shipping will be included in point calculation","May earn more points then desired"]},{id:"custom",title:"Custom calculation",description:"This plugin will manually calculate points based on item eligibility defined in Square and program details below.",pros:["Shipping not included in point earnings","Only give points for revenue generating items"],cons:["Points are not tied to Square order or transaction","Harder to track point earning"]}],hm=[{id:"square",title:"Square redemption",description:"We'll use Square's orders  and loyalty API to attached reward redemptions to orders and transcations.",pros:["Reward redemptions are tied to orders","Easy to track point earning"],cons:["Must use SquareSync for Woo payment gateway","Strict point redemption"]},{id:"custom",title:"Custom redemption",description:"Using a custom integration, we'll adjust a customers points manually.",pros:["Compatible with any WooCommerce payment gateway","More flexibility"],cons:["Reward redemptions are added to Square orders as discounts not rewards","Harder to track reward redemptions"]}];const gm=function(t){var r=t.settings,n=(t.updateSettings,t.getLoyaltyProgram,pm((0,e.useState)(""),2)),o=n[0],a=(n[1],pm((0,e.useState)(r.loyalty.method),2)),i=a[0],l=a[1],c=pm((0,e.useState)(r.loyalty.redemptionMethod),2),s=c[0],u=c[1];return(0,e.useEffect)((function(){l(r.loyalty.method),u(r.loyalty.redemptionMethod)}),[r]),wp.element.createElement("div",null,wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900 flex gap-2 items-center"},"Loyalty Program",wp.element.createElement(_t,null)),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Integrate Square's Loyalty program into your website, allowing customers to earn points on purchases through online orders.")),wp.element.createElement("div",{className:"flex items-center gap-2"},wp.element.createElement(Cu,{checked:!1,className:"bg-gray-200 relative inline-flex h-6 w-11 items-center rounded-full"},wp.element.createElement("span",{className:"translate-x-1 inline-block h-4 w-4 transform rounded-full bg-white transition"})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Enable or disable accrual of points on customer orders")),o&&wp.element.createElement("p",{className:"text-red-600 font-semibold text-sm mt-2"},o),r.loyalty.program&&r.loyalty.enabled&&wp.element.createElement("div",{className:"flex items-center gap-2 mt-4"},wp.element.createElement(Cu,{checked:!1,className:"".concat(r.loyalty.redeem?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"".concat(r.loyalty.redeem?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Enable or disable redeeming of points on orders")),wp.element.createElement(React.Fragment,null,wp.element.createElement("fieldset",{className:"my-12"},wp.element.createElement("legend",{className:"text-base font-semibold leading-6 text-gray-900 text-center"},"Select a point ",wp.element.createElement("span",{className:"text-sky-500"},"accumulation")," option"),wp.element.createElement("p",{className:"text-center max-w-lg mx-auto text-gray-500"},"Due to the nature of Square and their current API, we have to make a compromise. Pro's and Cons of each are defined below."),wp.element.createElement(mm,{value:i,className:"mt-6 grid grid-cols-1 gap-y-6 sm:grid-cols-2 sm:gap-x-4"},dm.map((function(e,t){return wp.element.createElement(mm.Option,{key:e.id,value:e.id,className:function(e){var t=e.active,r=e.checked;return"group relative flex cursor-pointer rounded-lg border p-4 shadow-sm focus:outline-none ".concat(r?"border-sky-600":"border-gray-300"," ").concat(t?"ring-2 ring-sky-600":"")}},(function(r){var n=r.checked;return wp.element.createElement(React.Fragment,null,wp.element.createElement("span",{className:"flex flex-1"},wp.element.createElement("span",{className:"flex flex-col justify-between"},wp.element.createElement("span",{className:"block text-sm font-medium text-gray-900"},e.title),wp.element.createElement("span",{className:"mt-1 flex items-center text-sm text-gray-500"},e.description),wp.element.createElement("div",{className:"mt-4 gap-2 flex flex-col ".concat(1===t&&"flex-col-reverse")},e.pros.map((function(e){return wp.element.createElement("div",{className:"flex gap-2 "},wp.element.createElement(Ht,{className:"min-w-5 w-5 h-5 text-green-500 min-h-5"}),wp.element.createElement("span",{className:" text-sm text-gray-900"},e))})),e.cons.map((function(e){return wp.element.createElement("div",{className:"flex gap-2 "},wp.element.createElement(ti,{className:"min-w-5 w-5 min-h-5 text-red-500"}),wp.element.createElement("span",{className:"text-sm text-gray-900"},e))}))))),wp.element.createElement(Ht,{"aria-hidden":"true",className:"h-5 w-5 ".concat(n?"text-sky-600":"invisible")}),wp.element.createElement("span",{"aria-hidden":"true",className:"pointer-events-none absolute -inset-px rounded-lg border-2 ".concat(n?"border-sky-600":"border-transparent")}))}))}))))),wp.element.createElement(React.Fragment,null,wp.element.createElement("fieldset",{className:"my-12"},wp.element.createElement("legend",{className:"text-base font-semibold leading-6 text-gray-900 text-center"},"Select a point ",wp.element.createElement("span",{className:"text-sky-500"},"redemption")," option"),wp.element.createElement("p",{className:"text-center max-w-lg mx-auto text-gray-500"},"Again, due to the nature of Square and their current API, we have to make a compromise. Pro's and Cons of each are defined below."),wp.element.createElement(mm,{value:s,className:"mt-6 grid grid-cols-1 gap-y-6 sm:grid-cols-2 sm:gap-x-4"},hm.map((function(e,t){return wp.element.createElement(mm.Option,{key:e.id,value:e.id,className:function(e){var t=e.active,r=e.checked;return"group relative flex cursor-pointer rounded-lg border p-4 shadow-sm focus:outline-none ".concat(r?"border-sky-600":"border-gray-300"," ").concat(t?"ring-2 ring-sky-600":"")}},(function(r){var n=r.checked;return wp.element.createElement(React.Fragment,null,wp.element.createElement("span",{className:"flex flex-1"},wp.element.createElement("span",{className:"flex flex-col justify-between"},wp.element.createElement("span",{className:"block text-sm font-medium text-gray-900"},e.title),wp.element.createElement("span",{className:"mt-1 flex items-center text-sm text-gray-500"},e.description),wp.element.createElement("div",{className:"mt-4 gap-2 flex flex-col ".concat(1===t&&"flex-col-reverse")},e.pros.map((function(e){return wp.element.createElement("div",{className:"flex gap-2 "},wp.element.createElement(Ht,{className:"min-w-5 w-5 h-5 text-green-500 min-h-5"}),wp.element.createElement("span",{className:" text-sm text-gray-900"},e))})),e.cons.map((function(e){return wp.element.createElement("div",{className:"flex gap-2 "},wp.element.createElement(ti,{className:"min-w-5 w-5 min-h-5 text-red-500"}),wp.element.createElement("span",{className:"text-sm text-gray-900"},e))}))))),wp.element.createElement(Ht,{"aria-hidden":"true",className:"h-5 w-5 ".concat(n?"text-sky-600":"invisible")}),wp.element.createElement("span",{"aria-hidden":"true",className:"pointer-events-none absolute -inset-px rounded-lg border-2 ".concat(n?"border-sky-600":"border-transparent")}))}))}))))))},ym=t.forwardRef((function({title:e,titleId:r,...n},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":r},n),e?t.createElement("title",{id:r},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.48 3.499a.562.562 0 0 1 1.04 0l2.125 5.111a.563.563 0 0 0 .475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 0 0-.182.557l1.285 5.385a.562.562 0 0 1-.84.61l-4.725-2.885a.562.562 0 0 0-.586 0L6.982 20.54a.562.562 0 0 1-.84-.61l1.285-5.386a.562.562 0 0 0-.182-.557l-4.204-3.602a.562.562 0 0 1 .321-.988l5.518-.442a.563.563 0 0 0 .475-.345L11.48 3.5Z"}))}));function vm(e){var t=e.program;return wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"mt-6 p-4 border rounded-lg border-gray-300"},wp.element.createElement("div",{className:"flex flex-col gap-2 items-center justify-center mb-4 border-b pb-2"},wp.element.createElement(ym,{className:"size-10"}),wp.element.createElement("h3",{className:"text-lg font-semibold leading-7 text-gray-900 flex gap-2 items-center"},"Your Loyalty Program"),wp.element.createElement("p",{className:"text-center text-gray-500 -mt-2"},"You can only edit your loyalty program on Square")),wp.element.createElement("div",{className:"mb-3"},wp.element.createElement("div",null,wp.element.createElement("h3",{className:"text-base font-semibold leading-7 text-gray-900 flex gap-2 items-center"},"Loyalty Program Terminology"),wp.element.createElement("div",{className:"max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Customize the terminology of your loyalty program to fit your brand (Examples: Star/Stars, Point/Points, Punch/Punches).")))),wp.element.createElement("dl",{className:"divide-y divide-gray-100 border border-gray-200 rounded-lg px-4"},wp.element.createElement("div",{className:"px-4 py-3 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0"},wp.element.createElement("dt",{className:"text-sm font-medium leading-6 text-gray-900"},"Singular"),wp.element.createElement("dd",{className:"mt-1 flex text-sm leading-6 text-gray-700 sm:col-span-2 sm:mt-0"},wp.element.createElement("span",{className:"flex-grow"},t.terminology.one))),wp.element.createElement("div",{className:"px-4 py-3 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0"},wp.element.createElement("dt",{className:"text-sm font-medium leading-6 text-gray-900"},"Plural"),wp.element.createElement("dd",{className:"mt-1 flex text-sm leading-6 text-gray-700 sm:col-span-2 sm:mt-0"},wp.element.createElement("span",{className:"flex-grow"},t.terminology.other)))),wp.element.createElement("div",{className:"px-4 sm:px-0 mt-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-7 text-gray-900"},"Earning Points"),wp.element.createElement("div",{className:"max-w-xl text-sm text-gray-500 mb-2"},wp.element.createElement("p",{className:""},"Allow customers to earn points on purchases made through your website."))),wp.element.createElement("dl",null,wp.element.createElement("div",{className:"-mx-4 flow-root sm:mx-0"},wp.element.createElement("table",{className:"min-w-full"},wp.element.createElement("colgroup",null,wp.element.createElement("col",{className:"sm:w-1/6"}),wp.element.createElement("col",{className:"sm:w-3/6"}),wp.element.createElement("col",{className:"sm:w-2/6"})),wp.element.createElement("thead",{className:"border-b border-gray-300 text-gray-900"},wp.element.createElement("tr",null,wp.element.createElement("th",{scope:"col",className:"py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-0"},"Rule value"),wp.element.createElement("th",{scope:"col",className:"hidden px-3 py-3.5 text-left text-sm font-semibold text-gray-900 sm:table-cell"},"Rule description"))),wp.element.createElement("tbody",null,t.accrual_rules.map((function(e,r){return wp.element.createElement("tr",{key:r,className:"border-b border-gray-200"},wp.element.createElement("td",{className:"max-w-0 py-5 pl-4 pr-3 text-sm sm:pl-0"},wp.element.createElement("div",{className:"font-medium text-gray-900"},e.points," ",1===e.points?t.terminology.one:t.terminology.other)),wp.element.createElement("td",{className:"px-3 py-5 text-left text-sm text-gray-500 sm:table-cell"},wp.element.createElement("div",{className:"mt-1 truncate text-gray-500"},"Earn ",e.points," ",1===e.points?t.terminology.one:t.terminology.other," for every $",(e.spend_data.amount_money.amount/100).toFixed(2)," spend in a single transaction")))})))))),wp.element.createElement("dl",null,wp.element.createElement("div",{className:"px-4 sm:px-0 mt-6 mb-3"},wp.element.createElement("h3",{className:"text-base font-semibold leading-7 text-gray-900"},"Redeeming rewards"),wp.element.createElement("div",{className:"max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Allow customers to redeem their points for discounts on purchases. Currently product and category specific rewards are not supported. Stay tuned for a future release."))),wp.element.createElement("div",{className:"px-4 pb-6 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0"},wp.element.createElement("dd",{className:"mt-1 text-sm leading-6 text-gray-700 sm:col-span-3 sm:mt-0"},wp.element.createElement("div",{className:"-mx-4 flow-root sm:mx-0"},wp.element.createElement("table",{className:"min-w-full"},wp.element.createElement("colgroup",null,wp.element.createElement("col",{className:"sm:w-1/6"}),wp.element.createElement("col",{className:"sm:w-3/6"})),wp.element.createElement("thead",{className:"border-b border-gray-300 text-gray-900"},wp.element.createElement("tr",null,wp.element.createElement("th",{scope:"col",className:"py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-0"},"Reward Value"),wp.element.createElement("th",{scope:"col",className:"hidden px-3 py-3.5 text-left text-sm font-semibold text-gray-900 sm:table-cell"},"Reward Description"))),wp.element.createElement("tbody",null,t.reward_tiers.map((function(e,r){var n;return wp.element.createElement("tr",{key:r,className:"border-b border-gray-200 relative select-none"},wp.element.createElement("td",{className:"max-w-0 py-5 pl-4 pr-3 text-sm sm:pl-0"},wp.element.createElement("div",{className:"font-medium text-gray-900"},e.points," ",1===e.points?t.terminology.one:t.terminology.other)),wp.element.createElement("td",{className:"px-3 py-5 text-left text-sm text-gray-500 sm:table-cell"},wp.element.createElement("div",{className:"mt-1 truncate text-gray-500"},e.name)),(null===(n=e.definition.catalog_object_ids)||void 0===n?void 0:n.length)>0&&wp.element.createElement("td",{className:"absolute left-0 w-full h-full flex justify-center items-center select-none"},wp.element.createElement("div",{className:"w-full h-full bg-red-300 opacity-30 absolute left-0 top-0 z-0"}),wp.element.createElement("div",{className:"relative z-10 text-base font-semibold bg-red-300 p-2"},"Disabled, not yet compatible with plugin")))}))))))))))}function wm(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return bm(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?bm(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function bm(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function xm(e){return xm="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},xm(e)}function Em(){Em=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var a=t&&t.prototype instanceof y?t:y,i=Object.create(a.prototype),l=new P(n||[]);return o(i,"_invoke",{value:O(e,r,l)}),i}function m(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,i,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,i)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,i,l){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==xm(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,i,l)}),(function(e){r("throw",e,i,l)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return r("throw",e,i,l)}))}l(c.arg)}var a;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,r,n){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=j(l,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=m(t,r,n);if("normal"===s.type){if(o=n.done?h:f,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=h,n.method="throw",n.arg=s.arg)}}}function j(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,j(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=m(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(xm(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,l,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},k(S),s(S,c,"Generator"),s(S,i,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=_,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return l.type="throw",l.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],l=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:_(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function Sm(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function km(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Sm(Object(r),!0).forEach((function(t){Nm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Sm(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Nm(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=xm(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=xm(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==xm(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Om(e,t,r,n,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,o)}function jm(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){Om(a,n,o,i,l,"next",e)}function l(e){Om(a,n,o,i,l,"throw",e)}i(void 0)}))}}function Cm(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Lm(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Lm(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Lm(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var Pm=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];function _m(e){return _m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_m(e)}function Rm(){Rm=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var a=t&&t.prototype instanceof y?t:y,i=Object.create(a.prototype),l=new P(n||[]);return o(i,"_invoke",{value:O(e,r,l)}),i}function m(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,i,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,i)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,i,l){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==_m(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,i,l)}),(function(e){r("throw",e,i,l)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return r("throw",e,i,l)}))}l(c.arg)}var a;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,r,n){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=j(l,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=m(t,r,n);if("normal"===s.type){if(o=n.done?h:f,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=h,n.method="throw",n.arg=s.arg)}}}function j(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,j(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=m(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(_m(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,l,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},k(S),s(S,c,"Generator"),s(S,i,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=_,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return l.type="throw",l.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],l=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:_(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function Im(e,t,r,n,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,o)}function Am(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){Im(a,n,o,i,l,"next",e)}function l(e){Im(a,n,o,i,l,"throw",e)}i(void 0)}))}}function Tm(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Fm(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Tm(Object(r),!0).forEach((function(t){Mm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Tm(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Mm(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=_m(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=_m(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==_m(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Dm(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(e,t)||Gm(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Gm(e,t){if(e){if("string"==typeof e)return qm(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?qm(e,t):void 0}}function qm(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}o(889);var Vm=[{path:"/",element:function(){return lr(),wp.element.createElement("div",{className:"dashboard-grid gap-x-6 gap-y-6"},wp.element.createElement(Gr,null),wp.element.createElement("div",{className:"flex flex-col gap-6"},wp.element.createElement(Rt,null),wp.element.createElement(Ft,null)),wp.element.createElement("div",null,wp.element.createElement(ar,null)))}},{path:"/inventory",element:function(){lr();var t=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return zl(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?zl(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(!1),2),r=(t[0],t[1]),n=Dr(),o=n.settings,a=n.updateSettings;return(0,e.useEffect)((function(){var e=function(){var e=function(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){Wl(a,n,o,i,l,"next",e)}function l(e){Wl(a,n,o,i,l,"throw",e)}i(void 0)}))}}(Vl().mark((function e(){var t;return Vl().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,zt({path:"/sws/v1/settings/access-token"});case 3:(t=e.sent).access_token&&t.access_token.length>0&&"Token not set or empty"!==t.access_token&&r(t.access_token),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),console.error(e.t0);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(){return e.apply(this,arguments)}}();e()}),[]),wp.element.createElement("div",null,wp.element.createElement("div",{className:"bg-white rounded-xl shadow-lg overflow-auto"},wp.element.createElement(jl,{settings:o,updateSettings:a})))}},{path:"/customers",element:function(){return wp.element.createElement(n().Fragment,null,wp.element.createElement("div",null,wp.element.createElement("div",{className:"bg-white p-6 rounded-xl not-prose grid grid-cols-1 gap-3 sm:grid-cols-2 w-full mb-4"},wp.element.createElement("header",{className:"col-span-full flex gap-2 items-center"},wp.element.createElement("p",{className:"text-xl font-semibold"},"Customer Syncing and Role Mapping"),wp.element.createElement(_t,null)),wp.element.createElement("div",{className:" w-full col-span-full"},wp.element.createElement("ul",{className:"grid grid-cols-2 w-full text-lg gap-x-24 gap-y-3"},wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Customer Import"),wp.element.createElement("p",{className:"text-base"},"Import and link your existing Square customers to WooCommerce")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Role & Group Mapping"),wp.element.createElement("p",{className:"text-base"},"Map Square groups to WordPress roles, perfect for role based pricing or restritced content")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Customer Export"),wp.element.createElement("p",{className:"text-base"},"Export and link your existing WordPress users to Square")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Real-time Customer Sync"),wp.element.createElement("p",{className:"text-base"},"Sync customers from Square and WordPress in real-time.")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Auto Customer Match"),wp.element.createElement("p",{className:"text-base"},"Match your existing WordPress users to Square users automatically")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Auto Customer Create"),wp.element.createElement("p",{className:"text-base"},"Create customers on Square or WordPress automatically")))),wp.element.createElement("h2",{className:"text-xl text-center col-span-full mt-4 font-bold"},"Watch Demo"))),wp.element.createElement("div",{style:{position:"relative",paddingBottom:"56.25%",height:0,overflow:"hidden"}},wp.element.createElement("iframe",{src:"https://www.youtube.com/embed/K4Ac4q7vEGg?si=mKp08JGnHBiiwd6N",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%"},frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,title:"YouTube video"})))}},{path:"/loyalty",element:function(){return wp.element.createElement(n().Fragment,null,wp.element.createElement("div",null,wp.element.createElement("div",{className:"bg-white p-6 rounded-xl not-prose grid grid-cols-1 gap-3 sm:grid-cols-2 w-full mb-4"},wp.element.createElement("header",{className:"col-span-full flex gap-2 items-center"},wp.element.createElement("p",{className:"text-xl font-semibold"},"Square Loyalty Program"),wp.element.createElement(_t,null)),wp.element.createElement("div",{className:" w-full col-span-full"},wp.element.createElement("ul",{className:"grid grid-cols-2 w-full text-lg gap-x-24 gap-y-3"},wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Point Earning"),wp.element.createElement("p",{className:"text-base"},"Customers earn points for every purchase they make, with the ability to set customizable point accrual rates based on purchase amounts.")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Reward Redemption"),wp.element.createElement("p",{className:"text-base"},"Allow customers to redeem their loyalty points for exclusive rewards, discounts, or special offers directly through your online store.")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Auto Customer Loyalty Account Creation"),wp.element.createElement("p",{className:"text-base"},"Automatically create loyalty accounts for customers upon their first purchase, streamlining the process and ensuring seamless point tracking.")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Rewards Dashboard"),wp.element.createElement("p",{className:"text-base"},"A user-friendly dashboard where customers can view their current points balance, reward tiers, and track their progress towards their next reward.")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Customizable Reward Tiers"),wp.element.createElement("p",{className:"text-base"},"Create multiple reward tiers with varying points requirements, allowing you to offer different levels of rewards to your loyal customers.")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Points Progress Tracking"),wp.element.createElement("p",{className:"text-base"},"Display a visual progress bar for customers, showing how close they are to unlocking their next reward, encouraging more purchases.")))),wp.element.createElement("h2",{className:"text-xl text-center col-span-full mt-4 font-bold"},"Watch Demo"))),wp.element.createElement("div",{style:{position:"relative",paddingBottom:"56.25%",height:0,overflow:"hidden"}},wp.element.createElement("iframe",{src:"https://www.youtube.com/embed/kQtLJesQSGI?si=QP4tGkFsKkgB68JD",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%"},frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,title:"YouTube video"})))}},{path:"/orders",element:function(){lr();var t=oe(),r=X((function(e){return e.orders})),n=r.data,o=r.loading,a=r.error;return(0,e.useEffect)((function(){t(tc())}),[t]),wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"bg-white rounded-xl overflow-hidden"},o&&wp.element.createElement(bc,null),!o&&!a&&wp.element.createElement("div",{className:"sm:px-6 px-4"},n&&n.length>0?wp.element.createElement(vc,{data:n.filter((function(e){return null!==e}))}):wp.element.createElement("div",null,"No orders found.")),!o&&a&&wp.element.createElement("div",{className:"sm:px-6 px-4 py-5"},"Unable to fetch orders: ",a)))}},{path:"/settings",element:function(){return lr(),wp.element.createElement(us,null)}},{path:"/settings/general",element:us},{path:"/settings/payments",element:function(){lr();var t=Dm((0,e.useState)({enabled:"no",title:"Credit Card",description:"Pay securely using your credit card.",accepted_credit_cards:["visa","mastercard","amex","discover","jcb","diners","union"],square_application_id_sandbox:"",square_application_id_live:"",enable_google_pay:"no",enable_apple_pay:"no"}),2),r=t[0],n=t[1],o=Dm((0,e.useState)({title:!1,description:!1,sandboxId:!1,liveId:!1}),2),a=o[0],i=o[1],l=Dm((0,e.useState)(!0),2),c=l[0],s=l[1];(0,e.useEffect)((function(){Dt()({path:"/sws/v1/settings/get-gateway-settings",method:"GET"}).then((function(e){n(e),s(!1)})).catch((function(e){s(!1),F.error("Failed to update settings: ".concat(e.message))}))}),[]);var u=function(e){var t="yes"===r[e]?"no":"yes";n((function(r){return Fm(Fm({},r),{},Mm({},e,t))})),p(e,t)},m=function(){var e=Am(Rm().mark((function e(t,n){return Rm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i((function(e){return Fm(Fm({},e),{},Mm({},n,!0))})),e.next=3,p(t,r[t]);case 3:i((function(e){return Fm(Fm({},e),{},Mm({},n,!1))}));case 4:case"end":return e.stop()}}),e)})));return function(_x,t){return e.apply(this,arguments)}}(),p=function(){var e=Am(Rm().mark((function e(t,r){var n;return Rm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Dt()({path:"/sws/v1/settings/update-gateway-settings",method:"POST",data:Mm({},t,r)});case 3:return n=e.sent,F.success("Settings updated successfully!"),e.abrupt("return",n);case 8:e.prev=8,e.t0=e.catch(0),F.error("Failed to update settings: ".concat(e.t0.message));case 11:case"end":return e.stop()}}),e,null,[[0,8]])})));return function(t,r){return e.apply(this,arguments)}}();return wp.element.createElement(rs,null,wp.element.createElement("div",{className:"px-4"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Payment Settings"),wp.element.createElement("div",null,c?wp.element.createElement(Uc,null):wp.element.createElement(React.Fragment,null,wp.element.createElement("p",{className:"mb-4"},"Modify the payment settings for your store."),wp.element.createElement("div",{className:"flex items-center gap-2 mb-4 mt-3"},wp.element.createElement(Cu,{checked:"yes"===r.enabled,onChange:function(){return u("enabled")},className:"".concat("yes"===r.enabled?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"".concat("yes"===r.enabled?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Enable Gateway")),wp.element.createElement("div",{className:"max-w-xl flex items-end mt-4"},wp.element.createElement("div",{className:"flex-grow items-end"},wp.element.createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},"Title"),wp.element.createElement("input",{type:"text",value:r.title,onChange:function(e){return n(Fm(Fm({},r),{},{title:e.target.value}))},className:"block w-full !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6"})),wp.element.createElement("button",{onClick:function(){return m("title","title")},type:"button",className:"mt-3 inline-flex w-full items-center justify-center rounded-md bg-sky-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-sky-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-600 sm:ml-3 sm:mt-0 sm:w-auto",loading:a.title},a.title?"Saving...":"Save")),wp.element.createElement("div",{className:"max-w-xl flex items-end mt-4"},wp.element.createElement("div",{className:"flex-grow items-end"},wp.element.createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},"Description"),wp.element.createElement("input",{type:"text",value:r.description,onChange:function(e){return n(Fm(Fm({},r),{},{description:e.target.value}))},className:"block w-full !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6"})),wp.element.createElement("button",{onClick:function(){return m("description","description")},type:"button",className:"mt-3 inline-flex w-full items-center justify-center rounded-md bg-sky-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-sky-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-600 sm:ml-3 sm:mt-0 sm:w-auto",loading:a.description},a.description?"Saving...":"Save")),wp.element.createElement("div",{className:"max-w-xl flex items-end mt-4"},wp.element.createElement("div",{className:"flex-grow items-end"},wp.element.createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},"Square Sandbox Application ID"),wp.element.createElement("input",{type:"text",value:r.square_application_id_sandbox,onChange:function(e){return n(Fm(Fm({},r),{},{square_application_id_sandbox:e.target.value}))},className:"block w-full !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6"})),wp.element.createElement("button",{onClick:function(){return m("square_application_id_sandbox","square_application_id_sandbox")},type:"button",className:"mt-3 inline-flex w-full items-center justify-center rounded-md bg-sky-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-sky-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-600 sm:ml-3 sm:mt-0 sm:w-auto",loading:a.square_application_id_sandbox},a.square_application_id_sandbox?"Saving...":"Save")),wp.element.createElement("div",{className:"max-w-xl flex items-end mt-4"},wp.element.createElement("div",{className:"flex-grow items-end"},wp.element.createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},"Square Live Application ID"),wp.element.createElement("input",{type:"text",value:r.square_application_id_live,onChange:function(e){return n(Fm(Fm({},r),{},{square_application_id_live:e.target.value}))},className:"block w-full !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6"})),wp.element.createElement("button",{onClick:function(){return m("square_application_id_live","square_application_id_live")},type:"button",className:"mt-3 inline-flex w-full items-center justify-center rounded-md bg-sky-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-sky-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-600 sm:ml-3 sm:mt-0 sm:w-auto",loading:a.square_application_id_live},a.square_application_id_live?"Saving...":"Save")),wp.element.createElement("div",{className:"mb-4 mt-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900 mb-3"},"Payment Methods"),wp.element.createElement("div",{className:"grid grid-cols-2 gap-4"},["visa","mastercard","amex","discover","jcb","diners","union"].map((function(e){var t=!!r.accepted_credit_cards&&r.accepted_credit_cards.includes(e);return wp.element.createElement("div",{key:e,className:"flex items-center"},wp.element.createElement("input",{type:"checkbox",checked:t,onChange:function(){return function(e){var t,o=!!r.accepted_credit_cards&&r.accepted_credit_cards.includes(e);t=o?r.accepted_credit_cards.filter((function(t){return t!==e})):[].concat(function(e){return function(e){if(Array.isArray(e))return qm(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Gm(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(r.accepted_credit_cards),[e]),n((function(e){return Fm(Fm({},e),{},{accepted_credit_cards:t})})),p("accepted_credit_cards",t)}(e)},className:"h-4 w-4 text-sky-600 border-gray-300 rounded"}),wp.element.createElement("label",{htmlFor:e,className:"ml-2 block text-sm font-medium text-gray-700"},e.charAt(0).toUpperCase()+e.slice(1)))})),".")),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900 mt-6"},"Digital Wallets"),wp.element.createElement("div",{className:"flex items-center gap-2 mb-4 mt-6"},wp.element.createElement(Cu,{checked:"yes"===r.enable_google_pay,onChange:function(){return u("enable_google_pay")},className:"".concat("yes"===r.enable_google_pay?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"".concat("yes"===r.enable_google_pay?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Enable Google Pay")),wp.element.createElement("div",{className:"flex items-center gap-2 mb-4"},wp.element.createElement(Cu,{checked:"yes"===r.enable_apple_pay,onChange:function(){return u("enable_apple_pay")},className:"".concat("yes"===r.enable_apple_pay?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"".concat("yes"===r.enable_apple_pay?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Enable Apple Pay"))))))}},{path:"/settings/inventory",element:function(){lr();var e=Dr(),t=e.settings,r=e.updateSettings,n=e.settingsLoading;return wp.element.createElement(rs,null,wp.element.createElement(React.Fragment,null,!n&&wp.element.createElement(React.Fragment,null,wp.element.createElement(js,{settings:t,updateSettings:r,settingsLoading:n}),wp.element.createElement(Is,{settings:t,updateSettings:r,settingsLoading:n}),wp.element.createElement(Wu,{settings:t,updateSettings:r}),wp.element.createElement(Lu,{settings:t,updateSettings:r}),wp.element.createElement(Bu,{settings:t,updateSettings:r}),wp.element.createElement(zu,{settings:t,updateSettings:r}))))}},{path:"/settings/customers",element:function(){lr();var e=Dr(),t=e.settings,r=e.updateSettings,n=e.settingsLoading;return wp.element.createElement(rs,null,wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6  text-black"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Filter Square Customers",wp.element.createElement("a",{className:"pro-badge !relative",href:"https://squaresyncforwoo.com",target:"_blank"},"PRO ONLY")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Select the Square customer segment or group you wish to use for WordPress syncing (if any)."))),wp.element.createElement(hs,{settings:t,updateSettings:r,settingsLoading:n}),wp.element.createElement(bs,{settings:t,updateSettings:r,settingsLoading:n}),wp.element.createElement(xs,{settings:t,updateSettings:r,settingsLoading:n}),wp.element.createElement(Es,{settings:t,updateSettings:r,settingsLoading:n})))}},{path:"/settings/orders",element:function(){lr();var t=Dr(),r=t.settings,n=t.updateSettings,o=t.settingsLoading,a=Cm((0,e.useState)([]),2),i=a[0],l=a[1],c=Cm((0,e.useState)(!0),2),s=c[0],u=c[1],m=Cm((0,e.useState)(),2),p=m[0],f=m[1],d=Cm((0,e.useState)(!0),2),h=d[0],g=d[1];(0,e.useEffect)((function(){var e=function(){var e=jm(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Dt()({path:"/sws/v1/settings/get-gateway-settings",method:"GET"}).then((function(e){f((function(t){return km(km({},t),e)})),g(!1)})).catch((function(e){g(!1),F({render:"Failed to update settings: "+e.message,type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0})}));case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();e()}),[]),(0,e.useEffect)((function(){u(!0);var e=function(){var e=jm(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Dt()({path:"/sws/v1/settings/get-shipping-methods",method:"GET"}).then((function(e){l(e),u(!1)})).catch((function(e){F({render:"Failed to get shipping methods: "+e.message,type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0}),u(!1)}));case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();e()}),[]);var y=r.orders.pickupSchedule||Pm.reduce((function(e,t){return km(km({},e),{},Nm({},t,{enabled:!1,from:"09:00",to:"17:00"}))}),{});return wp.element.createElement(rs,null,wp.element.createElement(React.Fragment,null,o&&!h?wp.element.createElement("div",null,"Loading..."):wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Automatic Order Sync"),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Streamline your business operations by synchronizing your WooCommerce orders with Square automatically."),p&&"yes"!==p.enabled?wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("div",{className:"flex items-center gap-2"},wp.element.createElement(Cu,{checked:r.orders.enabled,onChange:function(e){n("orders",km(km({},r.orders),{},{enabled:e}))},className:"".concat(r.orders.enabled?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"".concat(r.orders.enabled?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Enable or disable automatic order sync")),wp.element.createElement("div",{className:"flex items-center gap-2 mt-4"},wp.element.createElement(Cu,{checked:r.orders.transactions,onChange:function(e){n("orders",km(km({},r.orders),{},{transactions:e}))},className:"".concat(r.orders.transactions?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"".concat(r.orders.transactions?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Enable or disable transaction/receipt sync")),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900 mt-6"},"Woo Status"),wp.element.createElement("p",{className:"mb-4"},"Select the specific stage within the WooCommerce order cycle at which the order will be synchronized with Square."),wp.element.createElement("select",{className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 mt-2 !pr-10",value:r.orders.stage,onChange:function(e){n("orders",km(km({},r.orders),{},{stage:e.target.value}))}},wp.element.createElement("option",{value:"processing"},"processing"),wp.element.createElement("option",{value:"completed"},"completed")))):wp.element.createElement("div",null,wp.element.createElement("p",{className:"mb-4 text-sky-500"},"SquareSync Payment Gateway is currently enabled, and because orders and transactions are automatically generated, these settings cannot be edited. To make changes, please disable the SquareSync Payment Gateway."))))),wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6 mb-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Real-time Order Import ",wp.element.createElement(_t,null)),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Automatically import your Square orders into WooCommerce")),wp.element.createElement("div",{className:"flex items-center gap-2 mt-4"},wp.element.createElement(Cu,{checked:!1,className:"".concat(r.orders.orderImport?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"".concat(r.orders.orderImport?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Enable or disable real-time order import")),wp.element.createElement("div",{className:"flex items-center gap-2 mt-4"},wp.element.createElement(Cu,{checked:!1,className:"".concat(r.orders.orderImportAllLocations?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"".concat(r.orders.orderImportAllLocations?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Import orders from all locations ",wp.element.createElement("span",{className:"font-normal"},"(Default is the currently selected location on general settings page)"))),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 "},wp.element.createElement("p",{className:""},"Ensure your webhook has been subscribed to event ",wp.element.createElement("span",{className:"font-semibold"},"order.created")))),wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6 mb-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Real-time Order Status Sync ",wp.element.createElement(_t,null)),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Syncronize your order statuses from Square to WooCommerce.")),wp.element.createElement("div",{className:"flex items-center gap-2 mt-4"},wp.element.createElement(Cu,{checked:!1,className:"".concat(r.orders.statusSync?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"".concat(r.orders.statusSync?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Enable or disable real-time order status sync")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 "},wp.element.createElement("p",{className:""},"Ensure your webhook has been subscribed to event ",wp.element.createElement("span",{className:"font-semibold"},"order.fulfillment.updated")))),s?wp.element.createElement("div",null,"Shipping methods loading.."):wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Local Pickup Setup",wp.element.createElement(_t,null)),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Configure the linkage between WooCommerce shipping methods and Square's local pickup orders. Select which WooCommerce shipping method corresponds to local pickups at your Square locations. Additionally, set preferences for the pickup time window and specify the default Square location for pickups.")),wp.element.createElement("div",{className:"blur-sm"},wp.element.createElement("div",null,wp.element.createElement("select",{id:"pickup",name:"pickup",value:r.orders.pickupMethod||"local_pickup",className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 mt-2 !pr-10"},wp.element.createElement("option",{value:"",disabled:!0},"Select your local pickup shipping method"),i.map((function(e){return wp.element.createElement("option",{key:e.id,value:e.id},e.title)})))),wp.element.createElement("div",{className:"mt-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Preparation Time"),wp.element.createElement("p",{className:"text-sm text-gray-500 mb-4"},"Specify the time required for order preparation before it can be available for pickup. Enter the time in minutes."),wp.element.createElement("input",{type:"number",min:"0",value:r.orders.preparationTime||60,className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 mt-2"}),wp.element.createElement("p",{className:"text-sm text-gray-500 mt-1"},'Time in minutes before a pickup order can be available after being placed. For example, enter "30" for a 30-minute preparation time.')),wp.element.createElement("div",{className:"mt-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Pickup Schedule"),wp.element.createElement("p",{className:"text-sm text-gray-500 mb-4"},"Define your pickup times for each day of the week. Enable pickup on specific days and set available time ranges."),wp.element.createElement("table",{className:"min-w-full"},wp.element.createElement("thead",null,wp.element.createElement("tr",null,wp.element.createElement("th",{className:"text-left"},"Day"),wp.element.createElement("th",{className:"text-left"},"Enable Pickup"),wp.element.createElement("th",{className:"text-left"},"From"),wp.element.createElement("th",{className:"text-left"},"To"))),wp.element.createElement("tbody",null,Pm.map((function(e){var t,r,n,o,a;return wp.element.createElement("tr",{key:e},wp.element.createElement("td",null,e),wp.element.createElement("td",null,wp.element.createElement("input",{type:"checkbox",checked:(null===(t=y[e])||void 0===t?void 0:t.enabled)||!1})),wp.element.createElement("td",null,wp.element.createElement("input",{type:"time",value:(null===(r=y[e])||void 0===r?void 0:r.from)||"09:00",disabled:!(null!==(n=y[e])&&void 0!==n&&n.enabled),className:"ml-2"})),wp.element.createElement("td",null,wp.element.createElement("input",{type:"time",value:(null===(o=y[e])||void 0===o?void 0:o.to)||"17:00",disabled:!(null!==(a=y[e])&&void 0!==a&&a.enabled),className:"ml-2"})))})))))))))}},{path:"/settings/loyalty",element:function(){lr();var t=Dr(),r=t.settings,n=t.updateSettings,o=wm((0,e.useState)(!1),2),a=o[0],i=(o[1],wm((0,e.useState)(""),2)),l=i[0],c=(i[1],wm((0,e.useState)(r.loyalty.program||null),2)),s=c[0];return c[1],wp.element.createElement(rs,null,wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6 text-black"},wp.element.createElement(gm,{settings:r,updateSettings:n}),a&&wp.element.createElement("div",{className:"flex gap-2 mt-4"},wp.element.createElement("svg",{className:"animate-spin h-5 w-5 text-sky-500",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},wp.element.createElement("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),wp.element.createElement("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})),wp.element.createElement("p",null,"Loading loyalty program")),l&&wp.element.createElement("p",{className:"text-sm text-red-500 mt-2"},l),s&&!a&&wp.element.createElement(vm,{program:s}))))}}];const Wm=Vm;function zm(e){return zm="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},zm(e)}function Bm(){Bm=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var a=t&&t.prototype instanceof y?t:y,i=Object.create(a.prototype),l=new P(n||[]);return o(i,"_invoke",{value:O(e,r,l)}),i}function m(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,i,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,i)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,i,l){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==zm(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,i,l)}),(function(e){r("throw",e,i,l)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return r("throw",e,i,l)}))}l(c.arg)}var a;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,r,n){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=j(l,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=m(t,r,n);if("normal"===s.type){if(o=n.done?h:f,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=h,n.method="throw",n.arg=s.arg)}}}function j(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,j(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=m(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(zm(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,l,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},k(S),s(S,c,"Generator"),s(S,i,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=_,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return l.type="throw",l.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],l=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:_(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function Um(e,t,r,n,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,o)}function Hm(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return $m(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?$m(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $m(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var Zm=(0,e.createContext)(),Ym=function(t){var r=t.children,n=Dr().settings,o=jc().isAuthenticated,a=Hm((0,e.useState)({groups:[],segments:[]}),2),i=a[0],l=a[1],c=Hm((0,e.useState)(!1),2),s=c[0],u=c[1],m=Hm((0,e.useState)(""),2),p=m[0],f=m[1];return(0,e.useEffect)((function(){if(n.accessToken&&n.accessToken.length>1||o){var e=function(){var e=function(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){Um(a,n,o,i,l,"next",e)}function l(e){Um(a,n,o,i,l,"throw",e)}i(void 0)}))}}(Bm().mark((function e(){var t;return Bm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u(!0),e.prev=1,e.next=4,zt({path:"/sws/v1/customers/groups-segments",method:"GET"});case 4:t=e.sent,l(t),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),f("Failed to fetch groups and segments"),console.error(e.t0);case 12:return e.prev=12,u(!1),e.finish(12);case 15:case"end":return e.stop()}}),e,null,[[1,8,12,15]])})));return function(){return e.apply(this,arguments)}}();e()}}),[o,n.accessToken]),wp.element.createElement(Zm.Provider,{value:{groupsSegments:i,loading:s,error:p}},r)};const Km=function(e){var t=e.children;return wp.element.createElement(gi,null,wp.element.createElement(Mr,null,wp.element.createElement(Tc,null,wp.element.createElement(Ym,null,wp.element.createElement(Or,null,t)))))};function Xm(e){return Xm="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Xm(e)}function Jm(){Jm=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var a=t&&t.prototype instanceof y?t:y,i=Object.create(a.prototype),l=new P(n||[]);return o(i,"_invoke",{value:O(e,r,l)}),i}function m(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,i,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,i)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,i,l){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Xm(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,i,l)}),(function(e){r("throw",e,i,l)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return r("throw",e,i,l)}))}l(c.arg)}var a;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,r,n){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=j(l,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=m(t,r,n);if("normal"===s.type){if(o=n.done?h:f,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=h,n.method="throw",n.arg=s.arg)}}}function j(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,j(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=m(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(Xm(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,l,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},k(S),s(S,c,"Generator"),s(S,i,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=_,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return l.type="throw",l.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],l=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:_(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function Qm(e,t,r,n,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,o)}function ep(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){Qm(a,n,o,i,l,"next",e)}function l(e){Qm(a,n,o,i,l,"throw",e)}i(void 0)}))}}function tp(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return rp(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?rp(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function rp(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function np(t){var r=t.open,n=t.onOpenChange,o=t.mode,a=void 0===o?"loading":o,i=Fc(),l=i.locations,c=i.refetchLocations,s=Dr(),u=s.updateSettings,m=s.settings,p=s.settingsLoading,f=(0,e.useRef)(!1),d=tp((0,e.useState)(!1),2),h=d[0],g=d[1],y=tp((0,e.useState)(void 0),2),v=y[0],w=y[1],b=tp((0,e.useState)(!1),2),x=b[0],E=b[1];(0,e.useEffect)((function(){var e;p||void 0!==v||w(null!==(e=null==m?void 0:m.environment)&&void 0!==e?e:"live")}),[p,null==m?void 0:m.environment,v]);var S=p||void 0===v?"loading":a,k=(0,e.useCallback)(ep(Jm().mark((function e(){var t,r,n;return Jm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return g(!0),e.prev=1,e.next=4,fetch("https://api.squaresyncforwoo.com/wp-json/square-oauth/v1/generate-url",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:v,redirect_uri:"".concat(window.location.origin,"/wp-admin/admin.php?page=squarewoosync#/settings/general"),callback_url:"https://".concat(window.location.hostname,"/wp-json/sws/v1/square-inventory/update"),plan:"free"})});case 4:return t=e.sent,e.next=7,t.json();case 7:if(r=e.sent,n=r.oauthUrl){e.next=11;break}throw new Error("No OAuth URL returned");case 11:window.location.href=n,e.next=19;break;case 14:e.prev=14,e.t0=e.catch(1),alert("Could not open the Square permission screen. Please try again."),console.error(e.t0),g(!1);case 19:case"end":return e.stop()}}),e,null,[[1,14]])}))),[v]);(0,e.useEffect)((function(){"success"!==a||f.current||l.length||(f.current=!0,E(!0),c().finally((function(){return E(!1)})))}),[a,l.length,c]);var N=function(){var e=ep(Jm().mark((function e(t){var r;return Jm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=F.loading("Saving location…"),e.prev=1,e.next=4,u("location",t);case 4:F.update(r,{render:"Location updated!",type:"success",isLoading:!1,autoClose:2e3}),n(!1),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),F.update(r,{render:"Error: ".concat(e.t0.message),type:"error",isLoading:!1,autoClose:!1});case 11:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(_x){return e.apply(this,arguments)}}(),O="relative isolate w-full md:max-w-2xl min-h-[26rem] overflow-hidden rounded-2xl bg-white/95 p-10 lg:p-12 shadow-2xl backdrop-blur-md",j="pointer-events-none absolute -inset-40 -z-10 opacity-15 blur-3xl";return wp.element.createElement(Xa,{open:r,onClose:function(){return n(!1)}},"loading"===S&&wp.element.createElement("div",{className:"".concat(O," flex flex-col items-center justify-center gap-6")},wp.element.createElement("svg",{viewBox:"0 0 24 24",className:"size-9 animate-spin text-indigo-600",fill:"none","aria-hidden":"true"},wp.element.createElement("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),wp.element.createElement("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8H4z"})),wp.element.createElement("p",{className:"text-sm text-gray-700"},"Checking Square connection…")),"connect"===S&&wp.element.createElement("div",{className:O},wp.element.createElement("div",{className:"".concat(j," ").concat("bg-gradient-to-br from-slate-300 via-slate-200 to-white")}),wp.element.createElement("header",{className:"mb-6 flex flex-col items-center gap-3"},wp.element.createElement("div",{className:"flex size-16 items-center justify-center rounded-full bg-indigo-600/90 text-white shadow-lg ring-4 ring-indigo-400/30"},wp.element.createElement("svg",{width:"28",height:"28",viewBox:"0 0 24 24",className:"fill-current"},wp.element.createElement("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3"}))),wp.element.createElement("h2",{className:"text-2xl font-semibold text-gray-900"},"Connect Square"),wp.element.createElement("p",{className:"max-w-sm text-center text-sm text-gray-600"},"Authorise access so we can sync products, orders and inventory.")),wp.element.createElement("fieldset",{className:"mb-8"},wp.element.createElement("legend",{className:"sr-only"},"Square environment"),wp.element.createElement("div",{className:"grid grid-cols-1 gap-y-6 sm:grid-cols-2 sm:gap-x-4"},["live","sandbox"].map((function(e){var t=v===e,r="live"===e?"Production (Live)":"Sandbox (Test)",n="live"===e?"Real payments & inventory":"Safe test mode with fake money";return wp.element.createElement("label",{key:e,className:"\n                      relative flex cursor-pointer rounded-lg border bg-white p-4 shadow-sm\n                      focus:outline-none transition\n                      ".concat(t?"border-indigo-600 ring-2 ring-indigo-600":"border-gray-300 hover:border-gray-400","\n                    ")},wp.element.createElement("input",{type:"radio",name:"square-environment",value:e,checked:t,onChange:function(){return w(e)},className:"sr-only"}),wp.element.createElement("span",{className:"flex flex-1"},wp.element.createElement("span",{className:"flex flex-col"},wp.element.createElement("span",{className:"block text-sm font-medium text-gray-900"},r),wp.element.createElement("span",{className:"mt-1 text-sm text-gray-500"},n))),wp.element.createElement("svg",{viewBox:"0 0 20 20",className:"size-5 text-indigo-600 transition ".concat(t?"":"invisible"),fill:"currentColor","aria-hidden":"true"},wp.element.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16Zm3.857-9.809a.75.75 0 0 0-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 1 0-1.06 1.061l2.5 2.5a.75.75 0 0 0 1.137-.089l4-5.5Z",clipRule:"evenodd"})),wp.element.createElement("span",{className:"\n                        pointer-events-none absolute -inset-px rounded-lg border-2\n                        ".concat(t?"border-indigo-600":"border-transparent","\n                      "),"aria-hidden":"true"}))})))),wp.element.createElement("div",{className:"flex flex-col gap-4 sm:flex-row sm:justify-center"},wp.element.createElement("button",{onClick:k,disabled:h,className:"inline-flex items-center justify-center rounded-lg bg-indigo-600 px-8 py-3 text-sm font-medium tracking-wide text-white shadow-sm transition hover:bg-indigo-700 focus-visible:ring-4 focus-visible:ring-indigo-300 disabled:cursor-progress"},h?"Redirecting…":"Authorise with Square"),wp.element.createElement("button",{onClick:function(){return n(!1)},className:"text-sm font-medium text-gray-500 transition hover:text-gray-700"},"Cancel"))),"success"===S&&wp.element.createElement("div",{className:O},wp.element.createElement("div",{className:"".concat(j," ").concat("bg-gradient-to-br from-emerald-200 via-emerald-100 to-white")}),wp.element.createElement("header",{className:"mb-6 flex flex-col items-center gap-3"},wp.element.createElement("div",{className:"flex size-16 items-center justify-center rounded-full bg-emerald-500/90 text-white shadow-lg ring-4 ring-emerald-400/30"},wp.element.createElement("svg",{width:"30",height:"30",viewBox:"0 0 24 24",className:"fill-current"},wp.element.createElement("path",{d:"M9.8 16.4 5.3 12l1.5-1.5 3 3 8-8L19.1 6l-9.3 10.4Z"}))),wp.element.createElement("h2",{className:"text-2xl font-semibold text-emerald-800"},"Connected!"),wp.element.createElement("p",{className:"max-w-sm text-center text-sm text-emerald-700"},"Pick the default Square location.")),x?wp.element.createElement("p",{className:"mb-6 text-center text-sm text-gray-600"},"Loading locations…"):wp.element.createElement("div",{className:"flex flex-col items-center"},wp.element.createElement("select",{className:"block w-full rounded-lg border-0 px-4 py-1.5 pr-10 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-sky-600 sm:text-sm",defaultValue:"",onChange:function(e){return e.target.value&&N(e.target.value)}},wp.element.createElement("option",{value:"",disabled:!0},"Select location"),l.map((function(e){return wp.element.createElement("option",{key:e.id,value:e.id},e.name)}))),wp.element.createElement("button",{onClick:function(){n(!1),requestAnimationFrame((function(){var e,t=document.querySelector("#location");t&&(t.scrollIntoView({behavior:"smooth",block:"center"}),null===(e=t.focus)||void 0===e||e.call(t))}))},className:"mt-4 rounded-xl bg-emerald-600 px-8 py-3 text-sm font-medium text-white shadow-md transition hover:bg-emerald-700 focus-visible:ring-4 focus-visible:ring-emerald-300"},"I'll choose later"))))}function op(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ap(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ap(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ap(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function ip(e){var r=e.children,n=jc(),o=n.loading,a=n.isAuthenticated,i=n.justConnected,l=n.autoPrompt,c=op((0,t.useState)(!1),2),s=c[0],u=c[1],m=op((0,t.useState)("loading"),2),p=m[0],f=m[1];return(0,t.useEffect)((function(){if(o)return f("loading"),void u(!0);i?(f("success"),u(!0)):!a&&l?(f("connect"),u(!0)):u(!1)}),[o,a,l,i]),wp.element.createElement(React.Fragment,null,r,wp.element.createElement(np,{open:s,onOpenChange:u,mode:p}))}const lp=o.p+"images/logo.4a5282be.png";function cp(e){var t=e.to,r=e.children;return wp.element.createElement(Ct,{to:t,className:function(e){return e.isActive?"text-sky-400 focus:!shadow-none active:text-sky-400 focus:text-sky-400 hover:!text-sky-400":"focus:!shadow-none active:text-sky-400 focus:text-sky-400 hover:!text-sky-400"}},r)}const sp=function(e){var t=e.children,r="h-full flex items-center justify-center mb-0";return wp.element.createElement("div",{className:"relative"},wp.element.createElement("header",{className:"bg-white px-6 items-stretch justify-between h-14 hidden md:flex"},wp.element.createElement("div",{className:"flex items-center gap-px py-4 "},wp.element.createElement("img",{className:"h-10 w-auto",src:lp,alt:"SquareWooSync"}),wp.element.createElement("nav",{className:"h-full ml-2"},wp.element.createElement("ul",{className:"flex items-center h-full gap-4 justify-center divide-x divide-gray-200 font-semibold "},wp.element.createElement("li",{className:r},wp.element.createElement(cp,{to:"/"},"Dashboard")),wp.element.createElement("li",{className:"".concat(r," pl-4")},wp.element.createElement(cp,{to:"/inventory"},"Products")),wp.element.createElement("li",{className:"".concat(r," pl-4")},wp.element.createElement(cp,{to:"/customers"},"Customers")),wp.element.createElement("li",{className:"".concat(r," pl-4")},wp.element.createElement(cp,{to:"/loyalty"},"Loyalty")),wp.element.createElement("li",{className:"".concat(r," pl-4")},wp.element.createElement(cp,{to:"/orders"},"Orders")),wp.element.createElement("li",{className:"".concat(r," pl-4")},wp.element.createElement(cp,{to:"/settings/general"},"Settings")),wp.element.createElement("li",{className:"".concat(r," pl-4")},wp.element.createElement("a",{target:"_blank",href:"https://squaresyncforwoo.com/documentation",className:function(e){return e.isActive?"text-sky-400 focus:!shadow-none active:text-sky-400 focus:text-sky-400 hover:!text-sky-400":"focus:!shadow-none active:text-sky-400 focus:text-sky-400 hover:!text-sky-400"}},"Documentation")),wp.element.createElement("li",{className:"".concat(r," pl-4")},wp.element.createElement("a",{target:"_blank",href:"https://squaresyncforwoo.com",className:"text-green-500 font-bold"},"GO PRO")))))),wp.element.createElement("main",{className:" mx-auto pb-20 mt-6 px-6"},t))};var up="persist:",mp="persist/FLUSH",pp="persist/REHYDRATE",fp="persist/PAUSE",dp="persist/PERSIST",hp="persist/PURGE",gp="persist/REGISTER";function yp(e){return yp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},yp(e)}function vp(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function bp(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xp(e){return JSON.stringify(e)}function Ep(e){return JSON.parse(e)}function Sp(e){}function kp(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Np(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?kp(r,!0).forEach((function(t){Op(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):kp(r).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Op(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function jp(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function Cp(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Lp(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Cp(r,!0).forEach((function(t){Pp(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Cp(r).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Pp(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var _p={registry:[],bootstrapped:!1},Rp=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:_p,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case gp:return Lp({},e,{registry:[].concat(jp(e.registry),[t.key])});case pp:var r=e.registry.indexOf(t.key),n=jp(e.registry);return n.splice(r,1),Lp({},e,{registry:n,bootstrapped:0===n.length});default:return e}},Ip=o(181);function Ap(e){return Ap="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ap(e)}function Tp(){Tp=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var a=t&&t.prototype instanceof y?t:y,i=Object.create(a.prototype),l=new P(n||[]);return o(i,"_invoke",{value:O(e,r,l)}),i}function m(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,i,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,i)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,i,l){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Ap(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,i,l)}),(function(e){r("throw",e,i,l)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return r("throw",e,i,l)}))}l(c.arg)}var a;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,r,n){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=j(l,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=m(t,r,n);if("normal"===s.type){if(o=n.done?h:f,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=h,n.method="throw",n.arg=s.arg)}}}function j(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,j(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=m(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(Ap(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,l,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},k(S),s(S,c,"Generator"),s(S,i,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=_,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return l.type="throw",l.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],l=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:_(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function Fp(e,t,r,n,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,o)}function Mp(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){Fp(a,n,o,i,l,"next",e)}function l(e){Fp(a,n,o,i,l,"throw",e)}i(void 0)}))}}function Dp(){return Gp.apply(this,arguments)}function Gp(){return(Gp=Mp(Tp().mark((function e(){var t;return Tp().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,zt({path:"/sws/v1/customers/get-groups"});case 3:if(t=e.sent,console.log("API Response:",t),!(t&&t.square_groups&&t.wp_user_roles)){e.next=9;break}return e.abrupt("return",{groups:t.square_groups,roles:t.wp_user_roles,roleMappings:t.roleMappings||[]});case 9:throw new Error("Invalid API response format");case 10:e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(0),console.error("API Fetch Error:",e.t0),e.t0;case 16:case"end":return e.stop()}}),e,null,[[0,12]])})))).apply(this,arguments)}var qp=function(){var e=Mp(Tp().mark((function e(){var t,r;return Tp().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("Fetching Customer Groups and Roles"),t=F.loading("Retrieving Customer Groups and Roles"),e.prev=2,e.next=5,Dp();case 5:return r=e.sent,F.update(t,{render:"Groups and Roles Received",type:"success",isLoading:!1,autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),e.abrupt("return",{status:"success",data:r});case 10:return e.prev=10,e.t0=e.catch(2),F.update(t,{render:"Error fetching groups and roles: ".concat(e.t0),type:"error",isLoading:!1,closeOnClick:!0,autoClose:5e3}),console.error(e.t0),e.abrupt("return",{status:"error",error:e.t0});case 15:case"end":return e.stop()}}),e,null,[[2,10]])})));return function(){return e.apply(this,arguments)}}(),Vp=function(){var e=Mp(Tp().mark((function e(t){var r,n;return Tp().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("Saving Role Mappings"),r=F.loading("Saving Role Mappings"),e.prev=2,e.next=5,zt({path:"/sws/v1/customers/role-mappings",method:"POST",data:{roleMappings:t}});case 5:if(n=e.sent,console.log("Save Response:",n),!n||"success"!==n.status){e.next=12;break}return F.update(r,{render:"Role Mappings Saved",type:"success",isLoading:!1,autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),e.abrupt("return",{status:"success",roleMappings:n.roleMappings});case 12:throw new Error("Invalid API response format");case 13:e.next=20;break;case 15:return e.prev=15,e.t0=e.catch(2),F.update(r,{render:"Error saving role mappings: ".concat(e.t0.message||"Server error"),type:"error",isLoading:!1,closeOnClick:!0,autoClose:5e3}),console.error("Error saving role mappings:",e.t0),e.abrupt("return",{status:"error",error:e.t0.message||"Server error"});case 20:case"end":return e.stop()}}),e,null,[[2,15]])})));return function(_x){return e.apply(this,arguments)}}(),Wp=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5e3;return new Promise((function(r,n){var o=function(){var a=Mp(Tp().mark((function a(i){var l,c;return Tp().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if(a.prev=0,l=null,e)try{localStorage.removeItem("customersData")}catch(e){console.warn("Failed to remove data from local storage:",e)}else{try{l=localStorage.getItem("customersData")}catch(e){console.warn("Failed to retrieve data from local storage:",e)}l&&setTimeout((function(){var e=JSON.parse(l);return r({status:"success",data:e})}),100)}return a.next=5,zt({path:"/sws/v1/customers".concat(i&&e?"?force=true":"")});case 5:if(c=a.sent,console.log(c),c.loading)i&&F.info("Fetching data, please wait...",{autoClose:2e3,hideProgressBar:!1,closeOnClick:!1}),setTimeout((function(){return o(!1)}),t);else if(0===c.data.length)F.info("No data available",{autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),r({status:"success",data:[]});else{try{localStorage.setItem("customersData",JSON.stringify(c.data))}catch(e){console.warn("Failed to store data in local storage:",e)}F.success("Customers Retrieved",{autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),r({status:"success",data:c.data})}a.next=14;break;case 10:a.prev=10,a.t0=a.catch(0),F.error("Error fetching customers: ".concat(a.t0.message||"Server error"),{autoClose:5e3,closeOnClick:!0}),n({status:"error",error:a.t0.message||"Server error"});case 14:case"end":return a.stop()}}),a,null,[[0,10]])})));return function(e){return a.apply(this,arguments)}}();o(!0)}))};function zp(e){return zp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},zp(e)}function Bp(){Bp=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var a=t&&t.prototype instanceof y?t:y,i=Object.create(a.prototype),l=new P(n||[]);return o(i,"_invoke",{value:O(e,r,l)}),i}function m(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,i,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,i)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,i,l){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==zp(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,i,l)}),(function(e){r("throw",e,i,l)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return r("throw",e,i,l)}))}l(c.arg)}var a;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,r,n){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=j(l,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=m(t,r,n);if("normal"===s.type){if(o=n.done?h:f,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=h,n.method="throw",n.arg=s.arg)}}}function j(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,j(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=m(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(zp(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,l,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},k(S),s(S,c,"Generator"),s(S,i,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=_,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return l.type="throw",l.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],l=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:_(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function Up(e,t,r,n,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,o)}function Hp(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){Up(a,n,o,i,l,"next",e)}function l(e){Up(a,n,o,i,l,"throw",e)}i(void 0)}))}}var $p=No("customerGroupsAndRoles/fetchIfNeeded",Hp(Bp().mark((function e(){var t,r,n,o,a,i,l,c,s=arguments;return Bp().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=s.length>0&&void 0!==s[0]&&s[0],n=(r=s.length>1?s[1]:void 0).getState,o=r.rejectWithValue,a=n(),i=a.customerGroupsAndRoles,l=0,c=function(){var e=Hp(Bp().mark((function e(){var r;return Bp().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!t&&(i.data.groups.length||i.data.roles.length)){e.next=12;break}return e.next=4,qp();case 4:if("success"!==(r=e.sent).status){e.next=9;break}return e.abrupt("return",r.data);case 9:throw new Error(r.error);case 10:e.next=13;break;case 12:return e.abrupt("return",i.data);case 13:e.next=27;break;case 15:if(e.prev=15,e.t0=e.catch(0),!(l<1)){e.next=25;break}return l++,console.warn("Retrying fetch groups and roles (".concat(l,"/").concat(1,")...")),e.next=22,c();case 22:return e.abrupt("return",e.sent);case 25:return console.error("Max retries reached. Unable to fetch groups and roles."),e.abrupt("return",o(e.t0.message));case 27:case"end":return e.stop()}}),e,null,[[0,15]])})));return function(){return e.apply(this,arguments)}}(),e.next=8,c();case 8:return e.abrupt("return",e.sent);case 9:case"end":return e.stop()}}),e)})))),Zp=No("customerGroupsAndRoles/saveMappings",function(){var e=Hp(Bp().mark((function e(t,r){var n,o,a,i;return Bp().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=r.rejectWithValue,e.prev=1,o=Object.values(t).map((function(e){return e.priority})),a=new Set(o),o.length===a.size){e.next=6;break}throw new Error("Each mapping must have a unique priority.");case 6:return e.next=8,Vp(t);case 8:if("success"!==(i=e.sent).status){e.next=13;break}return e.abrupt("return",{roleMappings:i.roleMappings});case 13:throw new Error(i.error);case 14:e.next=19;break;case 16:return e.prev=16,e.t0=e.catch(1),e.abrupt("return",n(e.t0.message));case 19:case"end":return e.stop()}}),e,null,[[1,16]])})));return function(_x,t){return e.apply(this,arguments)}}());const Yp=bo({name:"customerGroupsAndRoles",initialState:{data:{groups:[],roles:{},roleMappings:{}},loading:!1,error:null},reducers:{},extraReducers:function(e){e.addCase($p.pending,(function(e){e.loading=!0})).addCase($p.fulfilled,(function(e,t){e.loading=!1,e.data=t.payload,e.error=null})).addCase($p.rejected,(function(e,t){e.loading=!1,e.data={groups:[],roles:{},roleMappings:{}},e.error=t.payload})).addCase(Zp.pending,(function(e){e.loading=!0})).addCase(Zp.fulfilled,(function(e,t){e.loading=!1,e.data.roleMappings=t.payload.roleMappings,e.error=null})).addCase(Zp.rejected,(function(e,t){e.loading=!1,e.error=t.payload}))}}).reducer;function Kp(e){return Kp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Kp(e)}function Xp(){Xp=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var a=t&&t.prototype instanceof y?t:y,i=Object.create(a.prototype),l=new P(n||[]);return o(i,"_invoke",{value:O(e,r,l)}),i}function m(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,i,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,i)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,i,l){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Kp(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,i,l)}),(function(e){r("throw",e,i,l)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return r("throw",e,i,l)}))}l(c.arg)}var a;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,r,n){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=j(l,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=m(t,r,n);if("normal"===s.type){if(o=n.done?h:f,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=h,n.method="throw",n.arg=s.arg)}}}function j(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,j(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=m(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(Kp(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,l,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},k(S),s(S,c,"Generator"),s(S,i,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=_,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return l.type="throw",l.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],l=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:_(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function Jp(e,t,r,n,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,o)}function Qp(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){Jp(a,n,o,i,l,"next",e)}function l(e){Jp(a,n,o,i,l,"throw",e)}i(void 0)}))}}var ef,tf,rf,nf,of,af,lf,cf,sf,uf,mf=No("customers/fetchIfNeeded",Qp(Xp().mark((function e(){var t,r,n,o,a,i,l,c,s=arguments;return Xp().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=s.length>0&&void 0!==s[0]&&s[0],n=(r=s.length>1?s[1]:void 0).getState,o=r.rejectWithValue,a=n(),i=a.customers,!t&&null!==i.data){e.next=24;break}return e.prev=4,e.next=7,Wp(t);case 7:if("success"!==(l=e.sent).status){e.next=12;break}return e.abrupt("return",l.data);case 12:if("loading"!==l.status){e.next=16;break}return e.abrupt("return",o("Data is being fetched, please wait..."));case 16:throw new Error(l.error);case 17:e.next=22;break;case 19:return e.prev=19,e.t0=e.catch(4),e.abrupt("return",o(e.t0.message));case 22:e.next=44;break;case 24:if(!i.loading){e.next=43;break}return e.prev=25,e.next=28,Wp(!1);case 28:if("success"!==(c=e.sent).status){e.next=33;break}return e.abrupt("return",c.data);case 33:if("loading"!==c.status){e.next=37;break}return e.abrupt("return",o("Data is being fetched, please wait..."));case 37:throw new Error(c.error);case 38:e.next=43;break;case 40:return e.prev=40,e.t1=e.catch(25),e.abrupt("return",o(e.t1.message));case 43:return e.abrupt("return",i.data);case 44:case"end":return e.stop()}}),e,null,[[4,19],[25,40]])})))),pf=Yn({inventory:Gl,licence:Ao,orders:oc,customerGroupsAndRoles:Yp,customers:bo({name:"customers",initialState:{data:null,loading:!1,error:null,fetchAttempted:!1},reducers:{},extraReducers:function(e){e.addCase(mf.pending,(function(e){e.loading=!0,e.fetchAttempted=!0})).addCase(mf.fulfilled,(function(e,t){e.loading=!1,e.data=t.payload,e.error=null})).addCase(mf.rejected,(function(e,t){e.loading=!1,e.data=[],e.error=t.payload}))}}).reducer}),ff={key:"root",storage:Ip.A,whitelist:["inventory","customerGroupsAndRoles","customers"]},df=(tf=pf,rf=void 0!==(ef=ff).version?ef.version:-1,nf=void 0===ef.stateReconciler?function(e,t,r,n){n.debug;var o=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?vp(r,!0).forEach((function(t){bp(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vp(r).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},r);return e&&"object"===yp(e)&&Object.keys(e).forEach((function(n){"_persist"!==n&&t[n]===r[n]&&(o[n]=e[n])})),o}:ef.stateReconciler,of=ef.getStoredState||function(e){var t,r=e.transforms||[],n="".concat(void 0!==e.keyPrefix?e.keyPrefix:up).concat(e.key),o=e.storage;return e.debug,t=!1===e.deserialize?function(e){return e}:"function"==typeof e.deserialize?e.deserialize:Ep,o.getItem(n).then((function(e){if(e)try{var n={},o=t(e);return Object.keys(o).forEach((function(e){n[e]=r.reduceRight((function(t,r){return r.out(t,e,o)}),t(o[e]))})),n}catch(e){throw e}}))},af=void 0!==ef.timeout?ef.timeout:5e3,lf=null,cf=!1,sf=!0,uf=function(e){return e._persist.rehydrated&&lf&&!sf&&lf.update(e),e},function(e,t){var r=e||{},n=r._persist,o=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(r,["_persist"]);if(t.type===dp){var a=!1,i=function(e,r){a||(t.rehydrate(ef.key,e,r),a=!0)};if(af&&setTimeout((function(){!a&&i(void 0,new Error('redux-persist: persist timed out for persist key "'.concat(ef.key,'"')))}),af),sf=!1,lf||(lf=function(e){var t,r=e.blacklist||null,n=e.whitelist||null,o=e.transforms||[],a=e.throttle||0,i="".concat(void 0!==e.keyPrefix?e.keyPrefix:up).concat(e.key),l=e.storage;t=!1===e.serialize?function(e){return e}:"function"==typeof e.serialize?e.serialize:xp;var c=e.writeFailHandler||null,s={},u={},m=[],p=null,f=null;function d(){if(0===m.length)return p&&clearInterval(p),void(p=null);var e=m.shift(),r=o.reduce((function(t,r){return r.in(t,e,s)}),s[e]);if(void 0!==r)try{u[e]=t(r)}catch(e){console.error("redux-persist/createPersistoid: error serializing state",e)}else delete u[e];0===m.length&&(Object.keys(u).forEach((function(e){void 0===s[e]&&delete u[e]})),f=l.setItem(i,t(u)).catch(g))}function h(e){return!(n&&-1===n.indexOf(e)&&"_persist"!==e||r&&-1!==r.indexOf(e))}function g(e){c&&c(e)}return{update:function(e){Object.keys(e).forEach((function(t){h(t)&&s[t]!==e[t]&&-1===m.indexOf(t)&&m.push(t)})),Object.keys(s).forEach((function(t){void 0===e[t]&&h(t)&&-1===m.indexOf(t)&&void 0!==s[t]&&m.push(t)})),null===p&&(p=setInterval(d,a)),s=e},flush:function(){for(;0!==m.length;)d();return f||Promise.resolve()}}}(ef)),n)return Np({},tf(o,t),{_persist:n});if("function"!=typeof t.rehydrate||"function"!=typeof t.register)throw new Error("redux-persist: either rehydrate or register is not a function on the PERSIST action. This can happen if the action is being replayed. This is an unexplored use case, please open an issue and we will figure out a resolution.");return t.register(ef.key),of(ef).then((function(e){var t=ef.migrate||function(e,t){return Promise.resolve(e)};t(e,rf).then((function(e){i(e)}),(function(e){i(void 0,e)}))}),(function(e){i(void 0,e)})),Np({},tf(o,t),{_persist:{version:rf,rehydrated:!1}})}if(t.type===hp)return cf=!0,t.result(function(e){var t=e.storage,r="".concat(void 0!==e.keyPrefix?e.keyPrefix:up).concat(e.key);return t.removeItem(r,Sp)}(ef)),Np({},tf(o,t),{_persist:n});if(t.type===mp)return t.result(lf&&lf.flush()),Np({},tf(o,t),{_persist:n});if(t.type===fp)sf=!0;else if(t.type===pp){if(cf)return Np({},o,{_persist:Np({},n,{rehydrated:!0})});if(t.key===ef.key){var l=tf(o,t),c=t.payload,s=Np({},!1!==nf&&void 0!==c?nf(c,e,l,ef):l,{_persist:Np({},n,{rehydrated:!0})});return uf(s)}}if(!n)return tf(e,t);var u=tf(o,t);return u===o?e:uf(Np({},u,{_persist:n}))}),hf=function(e){var t,r=function(e){return function(e){void 0===e&&(e={});var t=e.thunk,r=void 0===t||t,n=(e.immutableCheck,e.serializableCheck,e.actionCreatorCheck,new go);return r&&("boolean"!=typeof r?n.push(eo.withExtraArgument(r.extraArgument)):n.push(eo)),n}(e)},n=e||{},o=n.reducer,a=void 0===o?void 0:o,i=n.middleware,l=void 0===i?r():i,c=n.devTools,s=void 0===c||c,u=n.preloadedState,m=void 0===u?void 0:u,p=n.enhancers,f=void 0===p?void 0:p;if("function"==typeof a)t=a;else{if(!function(e){if("object"!=typeof e||null===e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var r=t;null!==Object.getPrototypeOf(r);)r=Object.getPrototypeOf(r);return t===r}(a))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=Yn(a)}var d=l;"function"==typeof d&&(d=d(r));var h=Xn.apply(void 0,d),g=Kn;s&&(g=fo(mo({trace:!1},"object"==typeof s&&s)));var y=new yo(h),v=y;return Array.isArray(f)?v=no([h],f):"function"==typeof f&&(v=f(y)),Zn(t,m,g.apply(void 0,v))}({reducer:df,middleware:function(e){return e({serializableCheck:!1})}}),gf=function(e,t,r){var n=!1,o=Zn(Rp,_p,void 0),a=function(e){o.dispatch({type:gp,key:e})},i=function(t,r,a){var i={type:pp,payload:r,err:a,key:t};e.dispatch(i),o.dispatch(i),n&&l.getState().bootstrapped&&(n(),n=!1)},l=Lp({},o,{purge:function(){var t=[];return e.dispatch({type:hp,result:function(e){t.push(e)}}),Promise.all(t)},flush:function(){var t=[];return e.dispatch({type:mp,result:function(e){t.push(e)}}),Promise.all(t)},pause:function(){e.dispatch({type:fp})},persist:function(){e.dispatch({type:dp,register:a,rehydrate:i})}});return l.persist(),l}(hf),yf=document.getElementById("square-woo-sync");null!=yf&&(0,e.createRoot)(yf).render(wp.element.createElement(React.Fragment,null,wp.element.createElement(O,{className:"toast-position",position:"top-right",autoClose:500,hideProgressBar:!0,newestOnTop:!1,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"light"}),wp.element.createElement((function({store:e,context:r,children:n,serverState:o,stabilityCheck:a="once",noopCheck:i="once"}){const l=t.useMemo((()=>{const t=function(e,t){let r,n=J,o=0,a=!1;function i(){s.onStateChange&&s.onStateChange()}function l(){o++,r||(r=t?t.addNestedSub(i):e.subscribe(i),n=function(){const e=V();let t=null,r=null;return{clear(){t=null,r=null},notify(){e((()=>{let e=t;for(;e;)e.callback(),e=e.next}))},get(){let e=[],r=t;for(;r;)e.push(r),r=r.next;return e},subscribe(e){let n=!0,o=r={callback:e,next:null,prev:r};return o.prev?o.prev.next=o:t=o,function(){n&&null!==t&&(n=!1,o.next?o.next.prev=o.prev:r=o.prev,o.prev?o.prev.next=o.next:t=o.next)}}}}())}function c(){o--,r&&0===o&&(r(),r=void 0,n.clear(),n=J)}const s={addNestedSub:function(e){l();const t=n.subscribe(e);let r=!1;return()=>{r||(r=!0,t(),c())}},notifyNestedSubs:function(){n.notify()},handleChangeWrapper:i,isSubscribed:function(){return a},trySubscribe:function(){a||(a=!0,l())},tryUnsubscribe:function(){a&&(a=!1,c())},getListeners:()=>n};return s}(e);return{store:e,subscription:t,getServerState:o?()=>o:void 0,stabilityCheck:a,noopCheck:i}}),[e,o,a,i]),c=t.useMemo((()=>e.getState()),[e]);Q((()=>{const{subscription:t}=l;return t.onStateChange=t.notifyNestedSubs,t.trySubscribe(),c!==e.getState()&&t.notifyNestedSubs(),()=>{t.tryUnsubscribe(),t.onStateChange=void 0}}),[l,c]);const s=r||U;return t.createElement(s.Provider,{value:l},n)}),{store:hf},wp.element.createElement(fe,{loading:null,persistor:gf},wp.element.createElement((function(){return wp.element.createElement(kt,null,wp.element.createElement(sp,null,wp.element.createElement(Km,null,wp.element.createElement(ip,null,wp.element.createElement(gt,null,Wm.map((function(e,t){return wp.element.createElement(dt,{key:t,path:e.path,element:wp.element.createElement(e.element,null)})})))))))}),null)))))})()})();
  • squarewoosync/trunk/languages/square-woo-sync.pot

    r3312562 r3360322  
    22msgid ""
    33msgstr ""
    4 "Project-Id-Version: Square Sync for Woocommerce 6.0.1\n"
     4"Project-Id-Version: Square Sync for Woocommerce 6.0.3\n"
    55"Report-Msgid-Bugs-To: https://github.com/LiamHillier/square-woo-sync/issues\n"
    66"Last-Translator: liam@pixeldev.com.au\n"
     
    99"Content-Type: text/plain; charset=UTF-8\n"
    1010"Content-Transfer-Encoding: 8bit\n"
    11 "POT-Creation-Date: 2025-06-16T23:11:11+10:00\n"
     11"POT-Creation-Date: 2025-09-12T07:56:50+00:00\n"
    1212"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    13 "X-Generator: WP-CLI 2.10.0\n"
     13"X-Generator: WP-CLI 2.12.0\n"
    1414"X-Domain: squarewoosync\n"
    1515
    1616#. Plugin Name of the plugin
    17 #: squarewoosync.php
    1817msgid "Square Sync for Woocommerce"
    1918msgstr ""
     
    2120#. Plugin URI of the plugin
    2221#. Author URI of the plugin
    23 #: squarewoosync.php
    2422msgid "https://squaresyncforwoo.com"
    2523msgstr ""
    2624
    2725#. Description of the plugin
    28 #: squarewoosync.php
    2926msgid "Easily Sync your WooCommerce Square data in real-time with the SquareSync for Woo. Stock, titles, descriptions, orders and more."
    3027msgstr ""
    3128
    3229#. Author of the plugin
    33 #: squarewoosync.php
    3430msgid "SquareSync for Woo"
    3531msgstr ""
     
    7066
    7167#: includes/Payments/WC_SquareSync_Gateway.php:210
     68#, php-format
    7269msgid "Subscription renewal of %1$s via Square succeeded. Transaction ID: %2$s"
    7370msgstr ""
    7471
    7572#: includes/Payments/WC_SquareSync_Gateway.php:217
     73#, php-format
    7674msgid "Square renewal failed: %s"
    7775msgstr ""
     
    9189
    9290#: includes/Payments/WC_SquareSync_Gateway.php:1723
     91#, php-format
    9392msgid "Payment of %1$s via Square successfully completed (Square Transaction ID: %2$s)"
    9493msgstr ""
     
    221220
    222221#: includes/Woo/CreateOrder.php:391
     222#, php-format
    223223msgid "Order status set to %s based on Square state: %s"
    224224msgstr ""
     
    229229
    230230#: includes/Woo/CreateOrder.php:477
     231#, php-format
    231232msgid "Shipping method with ID %s not found."
    232233msgstr ""
     
    234235#. translators: %s: WP_Error message
    235236#: includes/Woo/CreateProduct.php:856
     237#, php-format
    236238msgid "Error creating category: %s"
    237239msgstr ""
     
    241243msgstr ""
    242244
    243 #: includes/Woo/SyncProduct.php:1222
     245#: includes/Woo/SyncProduct.php:1235
    244246msgid "Unlock the full power of SquareSync for Woo with Pro:"
    245247msgstr ""
    246248
    247 #: includes/Woo/SyncProduct.php:1226
     249#: includes/Woo/SyncProduct.php:1239
    248250msgid "Real-time, two-way product & stock sync"
    249251msgstr ""
    250252
    251 #: includes/Woo/SyncProduct.php:1227
     253#: includes/Woo/SyncProduct.php:1240
    252254msgid "Location-aware inventory & taxes"
    253255msgstr ""
    254256
    255 #: includes/Woo/SyncProduct.php:1228
     257#: includes/Woo/SyncProduct.php:1241
    256258msgid "Square Loyalty earn & redeem at checkout"
    257259msgstr ""
    258260
    259 #: includes/Woo/SyncProduct.php:1229
     261#: includes/Woo/SyncProduct.php:1242
    260262msgid "Automatic POS ↔ WooCommerce order sync"
    261263msgstr ""
    262264
    263 #: includes/Woo/SyncProduct.php:1230
     265#: includes/Woo/SyncProduct.php:1243
    264266msgid "Priority support & self-healing scheduler"
    265267msgstr ""
    266268
    267 #: includes/Woo/SyncProduct.php:1236
     269#: includes/Woo/SyncProduct.php:1249
    268270msgid "Go Pro"
    269271msgstr ""
    270272
    271 #: includes/Woo/SyncProduct.php:1664
     273#: includes/Woo/SyncProduct.php:1677
    272274msgid "Sync to Square"
    273275msgstr ""
    274276
    275 #: includes/Woo/SyncProduct.php:1711
     277#: includes/Woo/SyncProduct.php:1724
    276278msgid "Sync to Square initiated."
    277279msgstr ""
    278280
    279 #: includes/Woo/SyncProduct.php:1716
     281#: includes/Woo/SyncProduct.php:1729
    280282msgid "A sync job is already running. Please wait until the current job finishes."
    281283msgstr ""
     
    349351#: templates/emails/plain/square-gift-card.php:31
    350352#: templates/emails/square-gift-card.php:35
     353#, php-format
    351354msgid "Hello %s,"
    352355msgstr ""
     
    354357#: templates/emails/plain/square-gift-card.php:37
    355358#: templates/emails/square-gift-card.php:46
     359#, php-format
    356360msgid "%s just sent you a gift card! Below are the details:"
    357361msgstr ""
     
    397401#: templates/emails/plain/square-gift-card.php:68
    398402#: templates/emails/square-gift-card.php:114
     403#, php-format
    399404msgid "Thank you for shopping with %s!"
    400405msgstr ""
  • squarewoosync/trunk/vendor/autoload.php

    r3312562 r3360322  
    1515        }
    1616    }
    17     trigger_error(
    18         $err,
    19         E_USER_ERROR
    20     );
     17    throw new RuntimeException($err);
    2118}
    2219
    2320require_once __DIR__ . '/composer/autoload_real.php';
    2421
    25 return ComposerAutoloaderInit21d8b426006b0e66bb19626536946587::getLoader();
     22return ComposerAutoloaderInit3312963fe60a80247da6d7a666f01d85::getLoader();
  • squarewoosync/trunk/vendor/composer/InstalledVersions.php

    r3045330 r3360322  
    2828{
    2929    /**
     30     * @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to
     31     * @internal
     32     */
     33    private static $selfDir = null;
     34
     35    /**
    3036     * @var mixed[]|null
    3137     * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
    3238     */
    3339    private static $installed;
     40
     41    /**
     42     * @var bool
     43     */
     44    private static $installedIsLocalDir;
    3445
    3546    /**
     
    310321        self::$installed = $data;
    311322        self::$installedByVendor = array();
     323
     324        // when using reload, we disable the duplicate protection to ensure that self::$installed data is
     325        // always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not,
     326        // so we have to assume it does not, and that may result in duplicate data being returned when listing
     327        // all installed packages for example
     328        self::$installedIsLocalDir = false;
     329    }
     330
     331    /**
     332     * @return string
     333     */
     334    private static function getSelfDir()
     335    {
     336        if (self::$selfDir === null) {
     337            self::$selfDir = strtr(__DIR__, '\\', '/');
     338        }
     339
     340        return self::$selfDir;
    312341    }
    313342
     
    323352
    324353        $installed = array();
     354        $copiedLocalDir = false;
    325355
    326356        if (self::$canGetVendors) {
     357            $selfDir = self::getSelfDir();
    327358            foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
     359                $vendorDir = strtr($vendorDir, '\\', '/');
    328360                if (isset(self::$installedByVendor[$vendorDir])) {
    329361                    $installed[] = self::$installedByVendor[$vendorDir];
     
    331363                    /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
    332364                    $required = require $vendorDir.'/composer/installed.php';
    333                     $installed[] = self::$installedByVendor[$vendorDir] = $required;
    334                     if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
    335                         self::$installed = $installed[count($installed) - 1];
     365                    self::$installedByVendor[$vendorDir] = $required;
     366                    $installed[] = $required;
     367                    if (self::$installed === null && $vendorDir.'/composer' === $selfDir) {
     368                        self::$installed = $required;
     369                        self::$installedIsLocalDir = true;
    336370                    }
     371                }
     372                if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) {
     373                    $copiedLocalDir = true;
    337374                }
    338375            }
     
    351388        }
    352389
    353         if (self::$installed !== array()) {
     390        if (self::$installed !== array() && !$copiedLocalDir) {
    354391            $installed[] = self::$installed;
    355392        }
  • squarewoosync/trunk/vendor/composer/autoload_real.php

    r3312562 r3360322  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInit21d8b426006b0e66bb19626536946587
     5class ComposerAutoloaderInit3312963fe60a80247da6d7a666f01d85
    66{
    77    private static $loader;
     
    2323        }
    2424
    25         spl_autoload_register(array('ComposerAutoloaderInit21d8b426006b0e66bb19626536946587', 'loadClassLoader'), true, true);
     25        spl_autoload_register(array('ComposerAutoloaderInit3312963fe60a80247da6d7a666f01d85', 'loadClassLoader'), true, true);
    2626        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
    27         spl_autoload_unregister(array('ComposerAutoloaderInit21d8b426006b0e66bb19626536946587', 'loadClassLoader'));
     27        spl_autoload_unregister(array('ComposerAutoloaderInit3312963fe60a80247da6d7a666f01d85', 'loadClassLoader'));
    2828
    2929        require __DIR__ . '/autoload_static.php';
    30         call_user_func(\Composer\Autoload\ComposerStaticInit21d8b426006b0e66bb19626536946587::getInitializer($loader));
     30        call_user_func(\Composer\Autoload\ComposerStaticInit3312963fe60a80247da6d7a666f01d85::getInitializer($loader));
    3131
    3232        $loader->register(true);
  • squarewoosync/trunk/vendor/composer/autoload_static.php

    r3312562 r3360322  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInit21d8b426006b0e66bb19626536946587
     7class ComposerStaticInit3312963fe60a80247da6d7a666f01d85
    88{
    99    public static $prefixLengthsPsr4 = array (
     
    3636    {
    3737        return \Closure::bind(function () use ($loader) {
    38             $loader->prefixLengthsPsr4 = ComposerStaticInit21d8b426006b0e66bb19626536946587::$prefixLengthsPsr4;
    39             $loader->prefixDirsPsr4 = ComposerStaticInit21d8b426006b0e66bb19626536946587::$prefixDirsPsr4;
    40             $loader->classMap = ComposerStaticInit21d8b426006b0e66bb19626536946587::$classMap;
     38            $loader->prefixLengthsPsr4 = ComposerStaticInit3312963fe60a80247da6d7a666f01d85::$prefixLengthsPsr4;
     39            $loader->prefixDirsPsr4 = ComposerStaticInit3312963fe60a80247da6d7a666f01d85::$prefixDirsPsr4;
     40            $loader->classMap = ComposerStaticInit3312963fe60a80247da6d7a666f01d85::$classMap;
    4141
    4242        }, null, ClassLoader::class);
  • squarewoosync/trunk/vendor/composer/installed.php

    r3319082 r3360322  
    44        'pretty_version' => 'dev-main',
    55        'version' => 'dev-main',
    6         'reference' => '1bb2f793416217c36bf7ae51bed1320662de56f0',
     6        'reference' => 'cc9665fe33995df830e7294f2b243a257ea82faa',
    77        'type' => 'project',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-main',
    1515            'version' => 'dev-main',
    16             'reference' => '1bb2f793416217c36bf7ae51bed1320662de56f0',
     16            'reference' => 'cc9665fe33995df830e7294f2b243a257ea82faa',
    1717            'type' => 'project',
    1818            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.