Changeset 3360355
- Timestamp:
- 09/12/2025 08:48:09 AM (6 months ago)
- Location:
- squarewoosync
- Files:
-
- 18 edited
-
tags/6.0.4/build/blocks/gateway.asset.php (modified) (1 diff)
-
tags/6.0.4/build/blocks/gateway.js (modified) (1 diff)
-
tags/6.0.4/build/index.asset.php (modified) (1 diff)
-
tags/6.0.4/build/index.css (modified) (12 diffs)
-
tags/6.0.4/build/index.js (modified) (1 diff)
-
tags/6.0.4/languages/square-woo-sync.pot (modified) (3 diffs)
-
tags/6.0.4/readme.txt (modified) (2 diffs)
-
tags/6.0.4/squarewoosync.php (modified) (3 diffs)
-
tags/6.0.4/vendor/composer/installed.php (modified) (2 diffs)
-
trunk/build/blocks/gateway.asset.php (modified) (1 diff)
-
trunk/build/blocks/gateway.js (modified) (1 diff)
-
trunk/build/index.asset.php (modified) (1 diff)
-
trunk/build/index.css (modified) (12 diffs)
-
trunk/build/index.js (modified) (1 diff)
-
trunk/languages/square-woo-sync.pot (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/squarewoosync.php (modified) (3 diffs)
-
trunk/vendor/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
squarewoosync/tags/6.0.4/build/blocks/gateway.asset.php
r3360322 r3360355 1 <?php return array('dependencies' => array('wp-data', 'wp-element'), 'version' => ' fd90a8a6caa03a754e4e');1 <?php return array('dependencies' => array('wp-data', 'wp-element'), 'version' => 'a831b59204cd92f08125'); -
squarewoosync/tags/6.0.4/build/blocks/gateway.js
r3360322 r3360355 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)})();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 N(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",v="suspendedYield",d="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(I([])));_&&_!==r&&i.call(_,u)&&(E=_);var S=x.prototype=w.prototype=Object.create(E);function C(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===d)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=d;var l=p(e,r,n);if("normal"===l.type){if(o=n.done?m:v,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 T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function I(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(S,"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(S),t},e.awrap=function(t){return{__await:t}},C(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()}))},C(S),f(S,s,"Generator"),f(S,u,(function(){return this})),f(S,"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=I,N.prototype={constructor:N,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(T),!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),T(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;T(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:I(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,v,d,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:v=t.sent,d=v.success,m=v.data,u.token=d?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 N(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",v="suspendedYield",d="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(I([])));_&&_!==r&&n.call(_,a)&&(E=_);var S=x.prototype=w.prototype=Object.create(E);function C(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===d)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=d;var l=p(e,r,n);if("normal"===l.type){if(o=n.done?m:v,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 T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function I(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(S,"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(S),t},e.awrap=function(t){return{__await:t}},C(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()}))},C(S),l(S,u,"Generator"),l(S,a,(function(){return this})),l(S,"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=I,N.prototype={constructor:N,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(T),!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),T(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;T(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:I(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 v(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 d(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 N(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",v="completed",d={};function m(){}function b(){}function x(){}var E={};l(E,a,(function(){return this}));var L=Object.getPrototypeOf,_=L&&L(L(I([])));_&&_!==r&&n.call(_,a)&&(E=_);var S=x.prototype=m.prototype=Object.create(E);function C(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===v){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===d)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=v,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?v:p,l.arg===d)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=v,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")),d;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,d;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,d):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}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 T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function I(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(S,"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(S),t},e.awrap=function(t){return{__await:t}},C(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()}))},C(S),l(S,u,"Generator"),l(S,a,(function(){return this})),l(S,"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=I,N.prototype={constructor:N,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(T),!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,d):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),d},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),T(r),d}},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;T(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:I(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),d}},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],v=r(),d=v.applicationId,m=v.locationId;return(0,t.useEffect)((function(){if(!s){var t=function(){if(window.Square&&d&&m)try{f(window.Square.payments(d,m))}catch(t){console.error("Failed to initialize Square payments:",t)}};if(t(),!window.Square){var e=0,r=setInterval((function(){e++,window.Square?(clearInterval(r),t()):e>=20&&(clearInterval(r),console.error("Square SDK failed to load after 10 seconds"))}),500);return function(){return clearInterval(r)}}}}),[d,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 S(){S=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 N(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",v="completed",d={};function m(){}function g(){}function w(){}var b={};l(b,a,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(I([])));E&&E!==r&&n.call(E,a)&&(b=E);var L=w.prototype=m.prototype=Object.create(b);function C(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===v){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===d)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=v,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?v:p,l.arg===d)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=v,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")),d;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,d;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,d):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}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 T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function I(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}},C(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()}))},C(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=I,N.prototype={constructor:N,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(T),!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,d):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),d},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),T(r),d}},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;T(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:I(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),d}},e}function C(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,r=(0,t.useRef)(!1);return(0,t.useEffect)((function(){if(e){var t=function(){var t,n=(t=S().mark((function t(){return S().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){C(i,n,o,a,c,"next",t)}function c(t){C(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=d((0,t.useState)(!1),2),a=i[0],c=i[1],u=d((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,v(v(v(v(v(v(v(v(v(v(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",""),v(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,T=(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 N={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(T,{RenderedComponent:O}),edit:wp.element.createElement(T,{RenderedComponent:O}),ariaLabel:"Square",canMakePayment:function(){return!(!r().applicationId||!r().locationId)},supports:{features:r().supports,showSaveOption:!r().hasSubscription}},I=window.wp.data;function A(t){return A="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},A(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:C(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",v="completed",d={};function m(){}function g(){}function w(){}var b={};l(b,a,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(T([])));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 S(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"==A(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 C(e,r,n){var o=h;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===v){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===d)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=v,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?v:p,l.arg===d)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=v,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")),d;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,d;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,d):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}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 T(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(A(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.prototype),l(S.prototype,c,(function(){return this})),e.AsyncIterator=S,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new S(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=T,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,d):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),d},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),d}},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:T(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),d}},e}function R(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 F(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){R(i,n,o,a,c,"next",t)}function c(t){R(i,n,o,a,c,"throw",t)}a(void 0)}))}}var H=function(t){return r().ajaxUrl.replace("%%endpoint%%","square_digital_wallet_".concat(t))},M=function(){var t=F(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)}}(),q=function(){var t=F(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,M(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)}}(),D=function(){var t=F(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,M(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=F(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 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 Y(){Y=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:C(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",v="completed",d={};function m(){}function g(){}function w(){}var b={};l(b,a,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(T([])));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 S(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 C(e,r,n){var o=h;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===v){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===d)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=v,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?v:p,l.arg===d)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=v,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")),d;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,d;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,d):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}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 T(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}},_(S.prototype),l(S.prototype,c,(function(){return this})),e.AsyncIterator=S,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new S(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=T,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,d):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),d},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),d}},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:T(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),d}},e}function U(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 z(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)?z(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 z(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 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 $(t){return 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)}))}}function J(t){return J="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},J(t)}function K(){K=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:C(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",v="completed",d={};function m(){}function g(){}function w(){}var b={};l(b,a,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(T([])));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 S(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"==J(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 C(e,r,n){var o=h;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===v){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===d)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=v,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?v:p,l.arg===d)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=v,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")),d;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,d;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,d):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}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 T(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(J(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.prototype),l(S.prototype,c,(function(){return this})),e.AsyncIterator=S,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new S(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=T,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,d):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),d},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),d}},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:T(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),d}},e}function W(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,e,r){return(e=function(t){var e=function(t,e){if("object"!=J(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=J(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==J(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}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 tt(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)?tt(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 tt(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 et=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"}))},rt=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 nt={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=X((0,t.useState)(!1),2),y=p[0],v=p[1],d=o.needsShipping;(0,t.useEffect)((function(){var t=(0,I.subscribe)((function(){wp.data.select("wc/store/cart").isApplyingCoupon()||v((function(t){return!t}))}));return function(){t()}}),[]);var m=function(){var e=U((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=U((0,t.useState)(null),2),c=a[0],u=a[1];return(0,t.useEffect)((function(){if(e){var t=function(){var t=$(Y().mark((function t(){var o,a,c,l,s;return Y().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,d,y),w=function(e,n){var o=U((0,t.useState)(null),2),i=o[0],a=o[1],c=(0,t.useRef)(null);return(0,t.useEffect)((function(){e&&n&&$(Y().mark((function t(){var o;return Y().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=X(w,2),x=b[0],E=b[1],L=function(e,n){var o=U((0,t.useState)(null),2),i=o[0],a=o[1],c=(0,t.useRef)(null);return(0,t.useEffect)((function(){e&&n&&$(Y().mark((function t(){var r;return Y().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),_=X(L,2),S=_[0],C=_[1],k=function(e,r){var n=U((0,t.useState)(null),2),o=n[0],i=n[1],a=(0,t.useRef)(null);return(0,t.useEffect)((function(){e&&r&&$(Y().mark((function t(){var n;return Y().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=X(k,2),j=O[0],P=O[1],T=X((0,t.useState)(!1),2),N=T[0],A=T[1],G=X((0,t.useState)(null),2),R=G[0],F=G[1];!function(e){(0,t.useEffect)((function(){null==e||e.addEventListener("shippingcontactchanged",(function(t){return D(t)})),null==e||e.addEventListener("afterpay_shippingaddresschanged",(function(t){return D(t)}))}),[e])}(g),function(e){(0,t.useEffect)((function(){null==e||e.addEventListener("shippingoptionchanged",(function(t){return q(t)})),null==e||e.addEventListener("afterpay_shippingoptionchanged",(function(t){return q(t)}))}),[e])}(g);var M=function(t){var e=t||N;if(!e||!e.token)return{type:l.responseTypes.ERROR,message:"Payment token is missing. Please try again."};var r=e.details,o=e.token,i=r||{},a=i.method,c=void 0===a?"":a,u=i.card,s=void 0===u?{}:u,f=i.billing,h=void 0===f?{}:f,p=i.shipping,y=(((void 0===p?{}:p)||{}).contact,{intent:"CHARGE",amount:(n.cartTotal.value/100).toString(),currencyCode:n.currency.code,billingContact:{familyName:h.familyName||n.billingData.last_name||"",givenName:h.givenName||n.billingData.first_name||"",email:h.email||n.billingData.email||"",country:h.countryCode||n.billingData.country||"",region:h.state||n.billingData.state||"",city:h.city||n.billingData.city||"",postalCode:h.postalCode||n.billingData.postcode||"",phone:h.phone||n.billingData.phone||"",addressLines:h.addressLines||[n.billingData.address_1,n.billingData.address_2].filter(Boolean)}});return m.verifyBuyer(o,y).then((function(t){var e,r,n="wc-squaresync_credit";return{type:l.responseTypes.SUCCESS,meta:{paymentMethodData:Q(Q(Q(Q(Q(Q(Q({},"".concat(n,"-card-type"),c||""),"".concat(n,"-last-four"),(null==s?void 0:s.last4)||""),"".concat(n,"-exp-month"),(null==s||null===(e=s.expMonth)||void 0===e?void 0:e.toString())||""),"".concat(n,"-exp-year"),(null==s||null===(r=s.expYear)||void 0===r?void 0:r.toString())||""),"".concat(n,"-payment-postcode"),(null==s?void 0:s.postalCode)||""),"".concat(n,"-payment-nonce"),o||""),"".concat(n,"-buyer-verification-token"),(null==t?void 0:t.token)||"")}}})).catch((function(t){return{type:l.responseTypes.ERROR,message:t.message||"Payment processing failed"}}))};(0,t.useEffect)((function(){return function(){R&&R()}}),[R]),(0,t.useEffect)((function(){return h((function(){return R&&(R(),F(null)),a(),!0}))}),[h,R]);var Z=r().googlePay.includes("no"),z=r().applePay.includes("no"),B=r().afterPay.includes("no");function J(t){var e;t&&(u(""),i(),(e=K().mark((function e(){var r,n,o,i,u,l,s,h;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,V(t);case 2:if(r=e.sent){e.next=7;break}a(),e.next=31;break;case 7:if(!r||!r.token){e.next=24;break}return i=(null==r||null===(n=r.details)||void 0===n?void 0:n.billing)||{},u=(null==r||null===(o=r.details)||void 0===o||null===(o=o.shipping)||void 0===o?void 0:o.contact)||{},l={email:i.email||"",first_name:i.givenName||"",last_name:i.familyName||"",company:"",address_1:i.addressLines&&i.addressLines[0]||"",address_2:i.addressLines&&i.addressLines[1]||"",city:i.city||"",state:i.state||"",postcode:i.postalCode||"",country:i.countryCode||"",phone:i.phone||""},s={first_name:u.givenName||i.givenName||"",last_name:u.familyName||i.familyName||"",company:"",address_1:u.addressLines&&u.addressLines[0]||i.addressLines&&i.addressLines[0]||"",address_2:u.addressLines&&u.addressLines[1]||i.addressLines&&i.addressLines[1]||"",city:u.city||i.city||"",state:u.state||i.state||"",postcode:u.postalCode||i.postalCode||"",country:u.countryCode||i.countryCode||"",phone:u.phone||i.phone||""},e.prev=12,e.next=15,wp.data.dispatch("wc/store/cart").setBillingAddress(l);case 15:if(!d){e.next=18;break}return e.next=18,wp.data.dispatch("wc/store/cart").setShippingAddress(s);case 18:return e.next=20,new Promise((function(t){return setTimeout(t,100)}));case 20:e.next=24;break;case 22:e.prev=22,e.t0=e.catch(12);case 24:return A(r),R&&R(),h=f((function(){return M(r)})),F((function(){return h})),e.next=30,new Promise((function(t){return setTimeout(t,50)}));case 30:c();case 31:case"end":return e.stop()}}),e,null,[[12,22]])})),function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(t){W(i,n,o,a,c,"next",t)}function c(t){W(i,n,o,a,c,"throw",t)}a(void 0)}))})())}var tt=!Z&&wp.element.createElement("div",{tabIndex:0,role:"button",ref:E,onClick:function(){return J(x)}}),et=!B&&wp.element.createElement("div",{tabIndex:0,role:"button",ref:P,onClick:function(){return J(j)}}),rt=!z&&wp.element.createElement("div",{tabIndex:0,role:"button",ref:C,onClick:function(){return J(S)},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,rt,tt,et)}),null),edit:wp.element.createElement((function(){return wp.element.createElement(React.Fragment,null,wp.element.createElement(et,null),wp.element.createElement(rt,null))}),null),canMakePayment:function(){var t=!(!r().applicationId||!r().locationId),e=r().isDigitalWalletsEnabled;return t&&e},supports:{features:r().supports}};function ot(t){return ot="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},ot(t)}function it(){it=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:C(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",v="completed",d={};function m(){}function g(){}function w(){}var b={};l(b,a,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(T([])));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 S(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"==ot(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 C(e,r,n){var o=h;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===v){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===d)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=v,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?v:p,l.arg===d)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=v,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")),d;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,d;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,d):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}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 T(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(ot(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.prototype),l(S.prototype,c,(function(){return this})),e.AsyncIterator=S,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new S(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=T,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,d):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),d},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),d}},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:T(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),d}},e}function at(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 ct(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){at(i,n,o,a,c,"next",t)}function c(t){at(i,n,o,a,c,"throw",t)}a(void 0)}))}}var ut=function(){var t=ct(it().mark((function t(e,r,n){var o;return it().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)}}(),lt=function(){var t=ct(it().mark((function t(e){var r;return it().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 st(t){return st="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},st(t)}function ft(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=mt(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 ht(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=st(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=st(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==st(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function pt(){pt=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:C(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",v="completed",d={};function m(){}function g(){}function w(){}var b={};l(b,a,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(T([])));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 S(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"==st(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 C(e,r,n){var o=h;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===v){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===d)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=v,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?v:p,l.arg===d)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=v,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")),d;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,d;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,d):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}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 T(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(st(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.prototype),l(S.prototype,c,(function(){return this})),e.AsyncIterator=S,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new S(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=T,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,d):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),d},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),d}},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:T(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),d}},e}function yt(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 vt(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){yt(i,n,o,a,c,"next",t)}function c(t){yt(i,n,o,a,c,"throw",t)}a(void 0)}))}}function dt(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)||mt(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 mt(t,e){if(t){if("string"==typeof t)return gt(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)?gt(t,e):void 0}}function gt(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 wt(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 bt(){return xt.apply(this,arguments)}function xt(){return(xt=vt(pt().mark((function t(){var e,r,n,o,i,a,c,u,l,s,f,h,p,y,v,d,m,g,w;return pt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((n=(0,I.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,I.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=ft(o.shipping_rates),t.prev=11,l.s();case 13:if((s=l.n()).done){t.next=25;break}return v=s.value,(0,I.dispatch)("wc/store/cart").selectShippingRate(v.rate_id,0),t.next=18,new Promise((function(t){return setTimeout(t,300)}));case 18:d=(0,I.select)("wc/store/cart").getCartTotals()||{},m=wt(null!==(f=d.total_price)&&void 0!==f?f:"0",a),g=wt(null!==(h=d.total_tax)&&void 0!==h?h:"0",a),w=wt(null!==(p=v.price)&&void 0!==p?p:"0",a),u.push({id:v.rate_id,label:v.name,amount:w,taxLineItems:[{id:"taxItem1",label:"Taxes",amount:g}],total:{label:null!==(y=d.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,I.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 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 Lt(){Lt=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:C(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",v="completed",d={};function m(){}function g(){}function w(){}var b={};l(b,a,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(T([])));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 S(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 C(e,r,n){var o=h;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===v){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===d)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=v,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?v:p,l.arg===d)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=v,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")),d;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,d;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,d):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}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 T(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}},_(S.prototype),l(S.prototype,c,(function(){return this})),e.AsyncIterator=S,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new S(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=T,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,d):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),d},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),d}},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:T(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),d}},e}function _t(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 St(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 Ct(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)?Ct(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 Ct(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=St((0,t.useState)(!1),2),y=p[0],v=p[1],d=i.needsShipping;(0,t.useEffect)((function(){var t=(0,I.subscribe)((function(){wp.data.select("wc/store/cart").isApplyingCoupon()||v((function(t){return!t}))}));return function(){t()}}),[]);var m,g=function(){var e=dt((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=dt((0,t.useState)(null),2),c=a[0],u=a[1];return(0,t.useEffect)((function(){function t(){return(t=vt(pt().mark((function t(){var o,a,c,l,s;return pt().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,d,y),b=St(w,1)[0],x=function(e,r){var n=dt((0,t.useState)(null),2),o=n[0],i=n[1],a=(0,t.useRef)(null);return(0,t.useEffect)((function(){e&&r?vt(pt().mark((function t(){var n;return pt().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=St(x,2),L=E[0],_=E[1],S=St((0,t.useState)(!1),2),C=S[0],k=S[1];return m=b,(0,t.useRef)(!1),(0,t.useEffect)((function(){if(m&&"function"==typeof m.addEventListener){var t=function(){var t=vt(pt().mark((function t(e){var r,n,o;return pt().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,bt();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=vt(pt().mark((function t(){var r,i,c,u,l,s,f,h,p,y,v,d,m,g,w,b,x,E,L,_,S,C,k,O,j,P,T,N,I,A,G,R,F,H,M,q,D,V,Z,Y;return pt().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,T=j.method,N=n.token,t.next=9,ut(e,N,a);case 9:if(I=t.sent,console.log(I),A=I.token,G="wc-squaresync_credit",R=(null==n||null===(r=n.details)||void 0===r?void 0:r.billing)||{},F=(null==n||null===(i=n.details)||void 0===i?void 0:i.shipping)||{},H=F.contact,M=void 0===H?{}:H,q=F.option,D=void 0===q?{}:q,V=null!==(c=null!==(u=null==R?void 0:R.email)&&void 0!==u?u:null==M?void 0:M.email)&&void 0!==c?c:"",Z=null!==(l=null!==(s=null==R?void 0:R.phone)&&void 0!==s?s:null==M?void 0:M.phone)&&void 0!==l?l:"",Y=null!==(f=null!==(h=null==M?void 0:M.phone)&&void 0!==h?h:null==R?void 0:R.phone)&&void 0!==f?f:"",O.meta={paymentMethodData:ht(ht(ht(ht(ht(ht(ht(ht({},"".concat(G,"-card-type"),T||""),"".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"),N||""),"".concat(G,"-buyer-verification-token"),A||""),"shipping_method",null!==(v=D.id)&&void 0!==v&&v),billingAddress:{email:V,first_name:null!==(d=R.givenName)&&void 0!==d?d:"",last_name:null!==(m=R.familyName)&&void 0!==m?m:"",company:"",address_1:R.addressLines?R.addressLines[0]:"",address_2:R.addressLines?R.addressLines[1]:"",city:null!==(g=R.city)&&void 0!==g?g:"",state:null!==(w=R.state)&&void 0!==w?w:"",postcode:null!==(b=R.postalCode)&&void 0!==b?b:"",country:null!==(x=R.countryCode)&&void 0!==x?x:"",phone:Z},shippingAddress:{first_name:null!==(E=M.givenName)&&void 0!==E?E:"",last_name:null!==(L=M.familyName)&&void 0!==L?L:"",company:"",address_1:M.addressLines?M.addressLines[0]:"",address_2:M.addressLines?M.addressLines[1]:"",city:null!==(_=M.city)&&void 0!==_?_:"",state:null!==(S=M.state)&&void 0!==S?S:"",postcode:null!==(C=M.postalCode)&&void 0!==C?C:"",country:null!==(k=M.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,C,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=Lt().mark((function e(){var r;return Lt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,lt(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){_t(i,n,o,a,c,"next",t)}function c(t){_t(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 kt=window.wc.wcBlocksRegistry,Ot=kt.registerPaymentMethod;(0,kt.registerExpressPaymentMethod)(nt),Ot(N)})(); -
squarewoosync/tags/6.0.4/build/index.asset.php
r3360322 r3360355 1 <?php return array('dependencies' => array('lodash', 'moment', 'react', 'react-dom', 'wp-api-fetch', 'wp-element'), 'version' => ' f2226b1c74a3c0dda3a6');1 <?php return array('dependencies' => array('lodash', 'moment', 'react', 'react-dom', 'wp-api-fetch', 'wp-element'), 'version' => '1ac55004bebe425a484c'); -
squarewoosync/tags/6.0.4/build/index.css
r3360322 r3360355 1347 1347 margin-right: 0.75rem; 1348 1348 } 1349 .mr-4 {1350 margin-right: 1rem;1351 }1352 1349 .ms-3 { 1353 1350 margin-inline-start: 0.75rem; … … 1431 1428 height: 1.25rem; 1432 1429 } 1433 .size-6 {1434 width: 1.5rem;1435 height: 1.5rem;1436 }1437 1430 .size-9 { 1438 1431 width: 2.25rem; … … 1620 1613 .flex-1 { 1621 1614 flex: 1 1 0%; 1622 }1623 .flex-auto {1624 flex: 1 1 auto;1625 1615 } 1626 1616 .flex-none { … … 1829 1819 margin-left: calc(1.25rem * calc(1 - var(--tw-space-x-reverse))); 1830 1820 } 1821 .space-y-1 > :not([hidden]) ~ :not([hidden]) { 1822 --tw-space-y-reverse: 0; 1823 margin-top: calc(0.25rem * calc(1 - var(--tw-space-y-reverse))); 1824 margin-bottom: calc(0.25rem * var(--tw-space-y-reverse)); 1825 } 1831 1826 .space-y-10 > :not([hidden]) ~ :not([hidden]) { 1832 1827 --tw-space-y-reverse: 0; … … 1839 1834 margin-bottom: calc(0.5rem * var(--tw-space-y-reverse)); 1840 1835 } 1836 .space-y-3 > :not([hidden]) ~ :not([hidden]) { 1837 --tw-space-y-reverse: 0; 1838 margin-top: calc(0.75rem * calc(1 - var(--tw-space-y-reverse))); 1839 margin-bottom: calc(0.75rem * var(--tw-space-y-reverse)); 1840 } 1841 1841 .space-y-4 > :not([hidden]) ~ :not([hidden]) { 1842 1842 --tw-space-y-reverse: 0; … … 1844 1844 margin-bottom: calc(1rem * var(--tw-space-y-reverse)); 1845 1845 } 1846 .space-y-6 > :not([hidden]) ~ :not([hidden]) { 1847 --tw-space-y-reverse: 0; 1848 margin-top: calc(1.5rem * calc(1 - var(--tw-space-y-reverse))); 1849 margin-bottom: calc(1.5rem * var(--tw-space-y-reverse)); 1850 } 1846 1851 .divide-x > :not([hidden]) ~ :not([hidden]) { 1847 1852 --tw-divide-x-reverse: 0; … … 2463 2468 line-height: 1.5rem !important; 2464 2469 } 2470 .leading-4 { 2471 line-height: 1rem; 2472 } 2473 .leading-5 { 2474 line-height: 1.25rem; 2475 } 2465 2476 .leading-6 { 2466 2477 line-height: 1.5rem; … … 2666 2677 .opacity-30 { 2667 2678 opacity: 0.3; 2679 } 2680 .opacity-50 { 2681 opacity: 0.5; 2668 2682 } 2669 2683 .opacity-75 { … … 3006 3020 background-color: rgb(14 165 233 / var(--tw-bg-opacity)); 3007 3021 } 3008 .hover\:bg-sky- 600:hover {3009 --tw-bg-opacity: 1; 3010 background-color: rgb( 2 132 199/ var(--tw-bg-opacity));3022 .hover\:bg-sky-700:hover { 3023 --tw-bg-opacity: 1; 3024 background-color: rgb(3 105 161 / var(--tw-bg-opacity)); 3011 3025 } 3012 3026 .hover\:bg-sky-900:hover { … … 3033 3047 --tw-text-opacity: 1; 3034 3048 color: rgb(255 255 255 / var(--tw-text-opacity)); 3035 }3036 .hover\:underline:hover {3037 text-decoration-line: underline;3038 3049 } 3039 3050 .focus\:text-sky-400:focus { … … 3088 3099 outline-color: #ef4444; 3089 3100 } 3090 .focus-visible\:outline-red-600:focus-visible {3091 outline-color: #dc2626;3092 }3093 3101 .focus-visible\:outline-sky-600:focus-visible { 3094 3102 outline-color: #0284c7; … … 3272 3280 } 3273 3281 3282 .sm\:rounded-md { 3283 border-radius: calc(var(--radius) - 2px); 3284 } 3285 3274 3286 .sm\:p-6 { 3275 3287 padding: 1.5rem; -
squarewoosync/tags/6.0.4/build/index.js
r3360322 r3360355 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§ion=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)))))})()})();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,l,i,c,s,u=!1;t||(t={}),r=t.debug||!1;try{if(l=n(),i=document.createRange(),c=document.getSelection(),(s=document.createElement("span")).textContent=e,s.ariaHidden="true",s.style.all="unset",s.style.position="fixed",s.style.top=0,s.style.clip="rect(0, 0, 0, 0)",s.style.whiteSpace="pre",s.style.webkitUserSelect="text",s.style.MozUserSelect="text",s.style.msUserSelect="text",s.style.userSelect="text",s.addEventListener("copy",(function(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),i.selectNodeContents(s),c.addRange(i),!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(i):c.removeAllRanges()),s&&document.body.removeChild(s),l()}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},l={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},i={};function c(e){return n.isMemo(e)?l:i[e.$$typeof]||o}i[n.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},i[n.Memo]=l;var s=Object.defineProperty,u=Object.getOwnPropertyNames,m=Object.getOwnPropertySymbols,p=Object.getOwnPropertyDescriptor,f=Object.getPrototypeOf,d=Object.prototype;e.exports=function e(t,r,n){if("string"!=typeof r){if(d){var o=f(r);o&&o!==d&&e(t,o,n)}var l=u(r);m&&(l=l.concat(m(r)));for(var i=c(t),h=c(r),g=0;g<l.length;++g){var y=l[g];if(!(a[y]||n&&n[y]||h&&h[y]||i&&i[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,l=/^0o[0-7]+$/i,i=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||l.test(e)?i(e.slice(2),r?2:8):o.test(e)?NaN:+e}e.exports=function(e,t,r){var n,o,a,l,i,c,s=0,u=!1,m=!1,y=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function v(t){var r=n,a=o;return n=o=void 0,s=t,l=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);i=setTimeout(b,function(e){var r=t-(e-c);return m?f(r,a-(e-s)):r}(e))}function x(e){return i=void 0,y&&n?v(e):(n=o=void 0,l)}function E(){var e=d(),r=w(e);if(n=arguments,o=this,c=e,r){if(void 0===i)return function(e){return s=e,i=setTimeout(b,t),u?v(e):l}(c);if(m)return i=setTimeout(b,t),v(c)}return void 0===i&&(i=setTimeout(b,t)),l}return t=g(t)||0,h(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!==i&&clearTimeout(i),s=0,n=c=o=i=void 0},E.flush=function(){return void 0===i?l: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,l=r?Symbol.for("react.strict_mode"):60108,i=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 i:case l:case f:return e;default:switch(e=e&&e.$$typeof){case s:case p:case g:case h:case c:return e;default:return t}}case o:return t}}}function E(e){return x(e)===m}t.AsyncMode=u,t.ConcurrentMode=m,t.ContextConsumer=s,t.ContextProvider=c,t.Element=n,t.ForwardRef=p,t.Fragment=a,t.Lazy=g,t.Memo=h,t.Portal=o,t.Profiler=i,t.StrictMode=l,t.Suspense=f,t.isAsyncMode=function(e){return E(e)||x(e)===u},t.isConcurrentMode=E,t.isContextConsumer=function(e){return x(e)===s},t.isContextProvider=function(e){return x(e)===c},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===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)===i},t.isStrictMode=function(e){return x(e)===l},t.isSuspense=function(e){return x(e)===f},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===m||e===i||e===l||e===f||e===d||"object"==typeof e&&null!==e&&(e.$$typeof===g||e.$$typeof===h||e.$$typeof===c||e.$$typeof===s||e.$$typeof===p||e.$$typeof===v||e.$$typeof===w||e.$$typeof===b||e.$$typeof===y)},t.typeOf=x},959:(e,t,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,l=n.useEffect,i=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 i((function(){o.value=r,o.getSnapshot=t,s(o)&&u({inst:o})}),[e,r,t]),l((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},l=o.useSyncExternalStore,i=n.useRef,c=n.useEffect,s=n.useMemo,u=n.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,r,n,o){var m=i(null);if(null===m.current){var p={hasValue:!1,value:null};m.current=p}else p=m.current;m=s((function(){function e(e){if(!c){if(c=!0,l=e,e=n(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 r=n(e);return void 0!==o&&o(t,r)?t:(l=e,i=r)}var l,i,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=l(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 l={};e=e||[null,t({}),t([]),t(t)];for(var i=2&n&&r;"object"==typeof i&&!~e.indexOf(i);i=t(i))Object.getOwnPropertyNames(i).forEach((e=>l[e]=()=>r[e]));return l.default=()=>r,o.d(a,l),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 l=function(){for(var e,t,r=0,n="";r<arguments.length;)(e=arguments[r++])&&(t=a(e))&&(n&&(n+=" "),n+=t);return n},i=e=>"number"==typeof e&&!isNaN(e),c=e=>"string"==typeof e,s=e=>"function"==typeof e,u=e=>c(e)||s(e)?e:null,m=e=>(0,t.isValidElement)(e)||c(e)||s(e)||i(e);function p(e){let{enter:r,exit:n,appendPosition:o=!1,collapse:a=!0,collapseDuration:l=300}=e;return function(e){let{children:i,position:c,preventExitTransition:s,done:u,nodeRef:m,isIn:p}=e;const f=o?`${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,l):u()};p||(s?t():(h.current=1,e.className+=` ${d}`,e.addEventListener("animationend",t)))}),[p]),t.createElement(t.Fragment,null,i)}}function f(e,t){return null!=e?{content:e.content,containerId:e.props.containerId,id:e.props.toastId,theme:e.props.theme,type:e.props.type,data:e.props.data||{},isLoading:e.props.isLoading,icon:e.props.icon,status:t}:{}}const d={list:new Map,emitQueue:new Map,on(e,t){return this.list.has(e)||this.list.set(e,[]),this.list.get(e).push(t),this},off(e,t){if(t){const 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),l=(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=>l.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||l.has(e.toastId)&&null==e.updateId}(y))return;const{toastId:b,updateId:E,data:S}=y,{props:k}=h,N=()=>v(b),O=null==E;O&&h.count++;const 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&&(L=y.autoClose,C=k.autoClose,!1===L||i(L)&&L>0?L:C),deleteToast(){const e=f(l.get(b),"removed");l.delete(b),d.emit(4,e);const t=h.queue.length;if(h.count=null==b?h.count-h.displayedToast:h.count-1,h.count<0&&(h.count=0),t>0){const e=null==b?h.props.limit:1;if(1===t||1===e)h.displayedToast++,w();else{const r=e>t?t:e;h.displayedToast=r;for(let e=0;e<r;e++)w()}}else r()}};var L,C;j.iconOut=function(e){let{theme:r,type:n,isLoading:o,icon:a}=e,l=null;const u={theme:r,type:n};return!1===a||(s(a)?l=a(u):(0,t.isValidElement)(a)?l=(0,t.cloneElement)(a,u):c(a)||i(a)?l=a:o?l=g.spinner():(e=>e in g)(n)&&(l=g[n](u))),l}(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}):i(o)?setTimeout((()=>{x(P,j,p)}),o):x(P,j,p)}function x(e,t,r){const{toastId:n}=t;r&&l.delete(r);const a={content:e,props:t};l.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),()=>{l.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(l.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),l=(0,t.useRef)(null),i=(0,t.useRef)({start:0,x:0,y:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,boundingRect:null,didMove:!1}).current,c=(0,t.useRef)(e),{autoClose:u,pauseOnHover:m,closeToast:p,onClick:f,closeOnClick:d}=e;function h(t){if(e.draggable){"touchstart"===t.nativeEvent.type&&t.nativeEvent.preventDefault(),i.didMove=!1,document.addEventListener("mousemove",x),document.addEventListener("mouseup",E),document.addEventListener("touchmove",x),document.addEventListener("touchend",E);const r=l.current;i.canCloseOnClick=!0,i.canDrag=!0,i.boundingRect=r.getBoundingClientRect(),r.style.transition="",i.x=v(t.nativeEvent),i.y=w(t.nativeEvent),"x"===e.draggableDirection?(i.start=i.x,i.removalDistance=r.offsetWidth*(e.draggablePercent/100)):(i.start=i.y,i.removalDistance=r.offsetHeight*(80===e.draggablePercent?1.5*e.draggablePercent:e.draggablePercent/100))}}function g(t){if(i.boundingRect){const{top:r,bottom:n,left:o,right:a}=i.boundingRect;"touchend"!==t.nativeEvent.type&&e.pauseOnHover&&i.x>=o&&i.x<=a&&i.y>=r&&i.y<=n?b():y()}}function y(){n(!0)}function b(){n(!1)}function x(t){const n=l.current;i.canDrag&&n&&(i.didMove=!0,r&&b(),i.x=v(t),i.y=w(t),i.delta="x"===e.draggableDirection?i.x-i.start:i.y-i.start,i.start!==i.x&&(i.canCloseOnClick=!1),n.style.transform=`translate${e.draggableDirection}(${i.delta}px)`,n.style.opacity=""+(1-Math.abs(i.delta/i.removalDistance)))}function E(){document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",E),document.removeEventListener("touchmove",x),document.removeEventListener("touchend",E);const t=l.current;if(i.canDrag&&i.didMove&&t){if(i.canDrag=!1,Math.abs(i.delta)>i.removalDistance)return a(!0),void e.closeToast();t.style.transition="transform 0.2s, opacity 0.2s",t.style.transform=`translate${e.draggableDirection}(0)`,t.style.opacity="1"}}(0,t.useEffect)((()=>{c.current=e})),(0,t.useEffect)((()=>(l.current&&l.current.addEventListener("d",y,{once:!0}),s(e.onOpen)&&e.onOpen((0,t.isValidElement)(e.children)&&e.children.props),()=>{const e=c.current;s(e.onClose)&&e.onClose((0,t.isValidElement)(e.children)&&e.children.props)})),[]),(0,t.useEffect)((()=>(e.pauseOnFocusLoss&&(document.hasFocus()||b(),window.addEventListener("focus",y),window.addEventListener("blur",b)),()=>{e.pauseOnFocusLoss&&(window.removeEventListener("focus",y),window.removeEventListener("blur",b))})),[e.pauseOnFocusLoss]);const S={onMouseDown:h,onTouchStart:h,onMouseUp:g,onTouchEnd:g};return u&&m&&(S.onMouseEnter=b,S.onMouseLeave=y),d&&(S.onClick=e=>{f&&f(e),i.canCloseOnClick&&p()}),{playToast:y,pauseToast:b,isRunning:r,preventExitTransition:o,toastRef:l,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:i,className:c,style:u,controlledProgress:m,progress:p,rtl:f,isIn:d,theme:h}=e;const g=i||m&&0===p,y={...u,animationDuration:`${r}ms`,animationPlayState:n?"running":"paused",opacity:g?0:1};m&&(y.transform=`scaleX(${p})`);const v=l("Toastify__progress-bar",m?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${h}`,`Toastify__progress-bar--${a}`,{"Toastify__progress-bar--rtl":f}),w=s(c)?c({rtl:f,type:a,defaultClassName:v}):l(v,c);return t.createElement("div",{role:"progressbar","aria-hidden":g?"true":"false","aria-label":"notification timer",className:w,style:y,[m&&p>=1?"onTransitionEnd":"onAnimationEnd"]:m&&p<1?null:()=>{d&&o()}})}const S=e=>{const{isRunning:r,preventExitTransition:n,toastRef:o,eventHandlers:a}=b(e),{closeButton:i,children:c,autoClose:u,onClick:m,type:p,hideProgressBar:f,closeToast:d,transition:h,position:g,className:y,style:v,bodyClassName:w,bodyStyle:S,progressClassName:k,progressStyle:N,updateId:O,role:j,progress:L,rtl:C,toastId:P,deleteToast:_,isIn:R,isLoading:I,iconOut:A,closeOnClick:F,theme:T}=e,M=l("Toastify__toast",`Toastify__toast-theme--${T}`,`Toastify__toast--${p}`,{"Toastify__toast--rtl":C},{"Toastify__toast--close-on-click":F}),D=s(y)?y({rtl:C,position:g,type:p,defaultClassName:M}):l(M,y),G=!!L||!u,q={closeToast:d,type:p,theme:T};let V=null;return!1===i||(V=s(i)?i(q):(0,t.isValidElement)(i)?(0,t.cloneElement)(i,q):x(q)),t.createElement(h,{isIn:R,done:_,position:g,preventExitTransition: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}):l("Toastify__toast-body",w),style:S},null!=A&&t.createElement("div",{className:l("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!I})},A),t.createElement("div",null,c)),V,t.createElement(E,{...O&&!G?{key:`pb-${O}`}:{},rtl:C,theme:T,delay:u,isRunning:r,isIn:R,closeToast:d,hide:f,type:p,style:N,className:k,controlledProgress:G,progress:L||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:i,style:c,rtl:m,containerId:p}=e;function f(e){const t=l("Toastify__toast-container",`Toastify__toast-container--${e}`,{"Toastify__toast-container--rtl":m});return s(i)?i({position:e,rtl:m,defaultClassName:t}):l(t,u(i))}return(0,t.useEffect)((()=>{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:l}=e;return t.createElement(S,{...l,isIn:a(l.toastId),style:{...l.style,"--nth":n+1,"--len":r.length},key:`toast-${l.key}`},o)})))})))})));O.displayName="ToastContainer",O.defaultProps={position:"top-right",transition:N,autoClose:5e3,closeButton:x,pauseOnHover:!0,pauseOnFocusLoss:!0,closeOnClick:!0,draggable:!0,draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};let j,L=new Map,C=[],P=1;function _(){return""+P++}function R(e){return e&&(c(e.toastId)||i(e.toastId))?e.toastId:_()}function I(e,t){return L.size>0?d.emit(0,e,t):C.push({content:e,options:t}),t.toastId}function A(e,t){return{...t,type:t&&t.type||e,toastId:R(t)}}function F(e){return(t,r)=>I(t,A(e,r))}function T(e,t){return I(e,A("default",t))}T.loading=(e,t)=>I(e,A("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...t})),T.promise=function(e,t,r){let n,{pending:o,error:a,success:l}=t;o&&(n=c(o)?T.loading(o,r):T.loading(o.render,{...r,...o}));const i={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},u=(e,t,o)=>{if(null==t)return void T.dismiss(n);const a={type:e,...i,...r,data:o},l=c(t)?{render:t}:t;return n?T.update(n,{...a,...l}):T(l.render,{...a,...l}),o},m=s(e)?e():e;return m.then((e=>u("success",l,e))).catch((e=>u("error",a,e))),m},T.success=F("success"),T.info=F("info"),T.error=F("error"),T.warning=F("warning"),T.warn=T.warning,T.dark=(e,t)=>I(e,A("default",{theme:"dark",...t})),T.dismiss=e=>{L.size>0?d.emit(1,e):C=C.filter((t=>null!=e&&t.options.toastId!==e))},T.clearWaitingQueue=function(e){return void 0===e&&(e={}),d.emit(5,e)},T.isActive=e=>{let t=!1;return L.forEach((r=>{r.isToastActive&&r.isToastActive(e)&&(t=!0)})),t},T.update=function(e,t){void 0===t&&(t={}),setTimeout((()=>{const r=function(e,t){let{containerId:r}=t;const n=L.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 l=a.render||o;delete a.render,I(l,a)}}),0)},T.done=e=>{T.update(e,{progress:1})},T.onChange=e=>(d.on(4,e),()=>{d.off(4,e)}),T.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"},T.TYPE={INFO:"info",SUCCESS:"success",WARNING:"warning",ERROR:"error",DEFAULT:"default"},d.on(2,(e=>{j=e.containerId||e,L.set(j,e),C.forEach((e=>{d.emit(0,e.content,e.options)})),C=[]})).on(3,(e=>{L.delete(e.containerId||e),0===L.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:l}="function"==typeof n?{equalityFn:n}:n,{store:i,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,i.getState,s||i.getState,p,o);return(0,t.useDebugValue)(f),f}}const X=K();o(35),o(176);const J={notify(){},get:()=>[]};const Q="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?t.useLayoutEffect:t.useEffect;let ee=null;function te(e=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 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 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"!==le(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}}])&&ie(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=Te(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 l={relativePath:void 0===a?e.path||"":a,caseSensitive:!0===e.caseSensitive,childrenIndex:o,route:e};l.relativePath.startsWith("/")&&(ge(l.relativePath.startsWith(n),'Absolute route path "'+l.relativePath+'" nested under path "'+n+'" is not valid. An absolute child route path must start with the combined path of all its parent routes.'),l.relativePath=l.relativePath.slice(n.length));let i=Ve([n,l.relativePath]),c=r.concat(l);e.children&&e.children.length>0&&(ge(!0!==e.index,'Index routes must not have child routes. Please remove all child routes from route path "'+i+'".'),ke(e.children,t,c,i)),(null!=e.path||e.index)&&t.push({path:i,score:Ie(i,e.index),routesMeta:c})};return e.forEach(((e,t)=>{var 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 l=Ne(n.join("/")),i=[];return i.push(...l.map((e=>""===e?a:[a,e].join("/")))),o&&i.push(...l),i.map((t=>e.startsWith("/")&&""===t?"/":t))}!function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"}(Ee||(Ee={})),new Set(["lazy","caseSensitive","path","id","index","children"]);const Oe=/^:[\w-]+$/,je=3,Le=2,Ce=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+=Le),r.filter((e=>!Re(e))).reduce(((e,t)=>e+(Oe.test(t)?je:""===t?Ce:Pe)),n)}function Ae(e,t){let{routesMeta:r}=e,n={},o="/",a=[];for(let e=0;e<r.length;++e){let l=r[e],i=e===r.length-1,c="/"===o?t:t.slice(o.length)||"/",s=Fe({path:l.relativePath,caseSensitive:l.caseSensitive,end:i},c);if(!s)return null;Object.assign(n,s.params);let u=l.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 Fe(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],l=a.replace(/(.)\/+$/,"$1"),i=o.slice(1),c=n.reduce(((e,t,r)=>{let{paramName:n,isOptional:o}=t;if("*"===n){let e=i[r]||"";l=a.slice(0,a.length-e.length).replace(/(.)\/+$/,"$1")}const c=i[r];return e[n]=o&&!c?void 0:(c||"").replace(/%2F/g,"/"),e}),{});return{params:c,pathname:a,pathnameBase:l,pattern:e}}function Te(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,l=""===e||""===o.pathname,i=l?"/":o.pathname;if(null==i)a=r;else{let e=t.length-1;if(!n&&i.startsWith("..")){let t=i.split("/");for(;".."===t[0];)t.shift(),e-=1;o.pathname=t.join("/")}a=e>=0?t[e]:"/"}let c=function(e,t){void 0===t&&(t="/");let{pathname: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=i&&"/"!==i&&i.endsWith("/"),u=(l||"."===i)&&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:l}=tt(),i=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(i),l,"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,i,l,e])}()}function ot(e,r){let{relative:n}=void 0===r?{}:r,{future:o}=t.useContext(Ke),{matches:a}=t.useContext(Je),{pathname:l}=tt(),i=JSON.stringify(Ge(a,o.v7_relativeSplatPath));return t.useMemo((()=>qe(e,JSON.parse(i),l,"path"===n)),[e,i,l,n])}function at(e,r,n,o){et()||ge(!1);let{navigator:a}=t.useContext(Ke),{matches:l}=t.useContext(Je),i=l[l.length-1],c=i?i.params:{},s=(i&&i.pathname,i?i.pathnameBase:"/");i&&i.route;let u,m=tt();if(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 l;if(null==(l=n)||!l.errors)return null;e=n.matches}let i=e,c=null==(a=n)?void 0:a.errors;if(null!=c){let e=i.findIndex((e=>e.route.id&&(null==c?void 0:c[e.route.id])));e>=0||ge(!1),i=i.slice(0,Math.min(i.length,e+1))}let s=!1,u=-1;if(n&&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: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,i=u>=0?i.slice(0,u+1):[i[0]];break}}}return i.reduceRight(((e,o,a)=>{let l,m=!1,p=null,f=null;var d;n&&(l=c&&o.route.id?c[o.route.id]:void 0,p=o.route.errorElement||it,s&&(u<0&&0===a?(ft[d="route-fallback"]||(ft[d]=!0),m=!0,f=null):u===a&&(m=!0,f=o.route.hydrateFallbackElement||null)));let h=r.concat(i.slice(0,a+1)),g=()=>{let r;return r=l?p:m?f:o.route.Component?t.createElement(o.route.Component,null):o.route.element?o.route.element:e,t.createElement(st,{match:o,routeContext:{outlet:e,matches:h,isDataRoute:null!=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:l,children:g(),routeContext:{outlet:null,matches:h,isDataRoute:!0}}):g()}),null)}(h&&h.map((e=>Object.assign({},e,{params:Object.assign({},c,e.params),pathname:Ve([s,a.encodeLocation?a.encodeLocation(e.pathname).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?s:Ve([s,a.encodeLocation?a.encodeLocation(e.pathnameBase).pathname:e.pathnameBase])}))),l,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 lt(){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 it=t.createElement(lt,null);class ct extends t.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||"idle"!==t.revalidation&&"idle"===e.revalidation?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:void 0!==e.error?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return void 0!==this.state.error?t.createElement(Je.Provider,{value:this.props.routeContext},t.createElement(Qe.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function st(e){let{routeContext: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:l,static:i=!1,future:c}=e;et()&&ge(!1);let s=r.replace(/^\/*/,"/"),u=t.useMemo((()=>({basename:s,navigator:l,static:i,future:$e({v7_relativeSplatPath:!1},c)})),[s,c,l,i]);"string"==typeof o&&(o=xe(o));let{pathname:m="/",search:p="",hash:f="",state:d=null,key:h="default"}=o,g=t.useMemo((()=>{let e=Me(m,s);return null==e?null:{location:{pathname:e,search:p,hash:f,state:d,key:h},navigationType:a}}),[s,m,p,f,d,h,a]);return null==g?null:t.createElement(Ke.Provider,{value:u},t.createElement(Xe.Provider,{children: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 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)),n.push(l)})),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,l=t.useRef();var i;null==l.current&&(l.current=(void 0===(i={window:a,v5Compat:!0})&&(i={}),function(e,t,r,n){void 0===n&&(n={});let{window:o=document.defaultView,v5Compat:a=!1}=n,l=o.history,i=pe.Pop,c=null,s=u();function u(){return(l.state||{idx:null}).idx}function m(){i=pe.Pop;let e=u(),t=null==e?null:e-s;s=e,c&&c({action:i,location:f.location,delta:t})}function p(e){let t="null"!==o.location.origin?o.location.origin:o.location.href,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,l.replaceState(de({},l.state,{idx:s}),""));let f={get action(){return i},get location(){return e(o,l)},listen(e){if(c)throw new Error("A history only accepts one active listener");return o.addEventListener(he,m),c=e,()=>{o.removeEventListener(he,m),c=null}},createHref:e=>t(o,e),createURL:p,encodeLocation(e){let t=p(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(e,t){i=pe.Push;let n=we(f.location,e,t);r&&r(n,e),s=u()+1;let m=ve(n,s),p=f.createHref(n);try{l.pushState(m,"",p)}catch(e){if(e instanceof DOMException&&"DataCloneError"===e.name)throw e;o.location.assign(p)}a&&c&&c({action:i,location:f.location,delta:1})},replace:function(e,t){i=pe.Replace;let n=we(f.location,e,t);r&&r(n,e),s=u();let o=ve(n,s),m=f.createHref(n);l.replaceState(o,"",m),a&&c&&c({action:i,location:f.location,delta:0})},go:e=>l.go(e)};return f}((function(e,t){let{pathname: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)+")")}),i)));let c=l.current,[s,u]=t.useState({action:c.action,location:c.location}),{v7_startTransition:m}=o||{},p=t.useCallback((e=>{m&&St?St((()=>u(e))):u(e)}),[u,m]);return t.useLayoutEffect((()=>c.listen(p)),[c,p]),t.createElement(ht,{basename: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:l,replace:i,state:c,target:s,to:u,preventScrollReset:m,unstable_viewTransition:p}=e,f=wt(e,bt),{basename:d}=t.useContext(Ke),h=!1;if("string"==typeof u&&Ot.test(u)&&(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:l,pathname:i,search:c}=ot(e,{relative:n}),s=i;return"/"!==o&&(s="/"===i?o:Ve([o,i])),a.createHref({pathname:s,search:c,hash:l})}(u,{relative:a}),y=function(e,r){let{target:n,replace:o,state:a,preventScrollReset:l,relative:i,unstable_viewTransition:c}=void 0===r?{}:r,s=nt(),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,n)){t.preventDefault();let r=void 0!==o?o:be(u)===be(m);s(e,{replace:r,state:a,preventScrollReset:l,relative:i,unstable_viewTransition:c})}}),[u,s,m,o,a,n,e,l,i,c])}(u,{replace:i,state:c,target:s,preventScrollReset:m,relative:a,unstable_viewTransition:p});return t.createElement("a",vt({},f,{href:n||g,onClick:h||l?o:function(e){o&&o(e),e.defaultPrevented||y(e)},ref:r,target:s}))})),Lt=t.forwardRef((function(e,r){let{"aria-current":n="page",caseSensitive:o=!1,className:a="",end:l=!1,style:i,to:c,unstable_viewTransition:s,children:u}=e,m=wt(e,xt),p=ot(c,{relative:m.relative}),f=tt(),d=t.useContext(Ye),{navigator:h,basename:g}=t.useContext(Ke),y=null!=d&&function(e,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}(Ct.useViewTransitionState),a=ot(e,{relative:r.relative});if(!n.isTransitioning)return!1;let l=Me(n.currentLocation.pathname,o)||n.currentLocation.pathname,i=Me(n.nextLocation.pathname,o)||n.nextLocation.pathname;return null!=Fe(a.pathname,i)||null!=Fe(a.pathname,l)}(p)&&!0===s,v=h.encodeLocation?h.encodeLocation(p).pathname:p.pathname,w=f.pathname,b=d&&d.navigation&&d.navigation.location?d.navigation.location.pathname:null;o||(w=w.toLowerCase(),b=b?b.toLowerCase():null,v=v.toLowerCase()),b&&g&&(b=Me(b,g)||b);const x="/"!==v&&v.endsWith("/")?v.length-1:v.length;let E,S=w===v||!l&&w.startsWith(v)&&"/"===w.charAt(x),k=null!=b&&(b===v||!l&&b.startsWith(v)&&"/"===b.charAt(v.length)),N={isActive:S,isPending:k,isTransitioning:y},O=S?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 i?i(N):i;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 Ct,Pt;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Ct||(Ct={})),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"}))})),Ft=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 Tt(){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(Ft,{className:"h-6 w-6 text-white","aria-hidden":"true"})),wp.element.createElement("div",null,wp.element.createElement("h3",{className:"text-sm font-semibold text-gray-900"},"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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Xt(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(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 l(e){rr(a,n,o,l,i,"next",e)}function i(e){rr(a,n,o,l,i,"throw",e)}l(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 l=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(l,{log:e,isChild:!1,isSummary:!0})),e.children.map((function(e){return wp.element.createElement(l,{key:e.id,log:e,isChild:!0})}))):wp.element.createElement(l,{log:e,isChild:!1}))}))))};var lr="squarewoosync";function ir(){var t=tt();return(0,e.useEffect)((function(){!function(){var e=jQuery,t=e("#toplevel_page_"+lr),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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==vr(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(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 l(e){Sr(a,n,o,l,i,"next",e)}function i(e){Sr(a,n,o,l,i,"throw",e)}l(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 Lr(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 Cr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Lr(Object(r),!0).forEach((function(t){Pr(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Lr(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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==jr(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.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 l(e){Rr(a,n,o,l,i,"next",e)}function i(e){Rr(a,n,o,l,i,"throw",e)}l(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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Fr(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)?Fr(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 Fr(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 Tr=(0,t.createContext)(),Mr=function(e){var r=e.children,n=Ar((0,t.useState)([]),2),o=n[0],a=n[1],l=Ar((0,t.useState)(!0),2),i=l[0],c=l[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),T.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 Cr(Cr({},e),t)})),m(!1),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(0),m(!1),T({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=T.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)&&(T.update(n,{render:"".concat(t," updated successfully"),type:"success",isLoading:!1,autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),d((function(e){return Cr(Cr({},e),o)}))),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),T.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 Cr(Cr({},e),{},{accessToken:t.access_token})})),e.next=12;break;case 8:throw e.prev=8,e.t0=e.catch(1),T.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=T.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 Cr(Cr({},e),{},{accessToken:t})})),T.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),T.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=T.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 Cr(Cr({},e),{},{accessToken:null})})),T.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),T.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=T.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 Cr(Cr({},e),{},{sandboxToken:t})})),T.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),T.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=T.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 Cr(Cr({},e),{},{sandboxToken:null})})),T.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),T.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 Cr(Cr({},t),e)})),O(!1)})).catch((function(e){O(!1),T({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),L=j[0],C=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){C(e),R(!1)})).catch((function(e){T({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(Tr.Provider,{value:{settings:f,updateSettings:h,settingsLoading:u,getAccessToken:g,updateSandboxToken:w,removeSandboxToken:b,updateAccessToken:y,removeAccessToken:v,gatewaySettings:E,gatewayLoading:N,shippingMethods:L,shippingMethodsLoading:_,orderableLocations:o,orderableLocationsLoading:i}},r)},Dr=function(){return(0,t.useContext)(Tr)};const Gr=function(){var e,t,r,n,o=Dr(),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(pr,{orders:a.orders,gatewaySettings:l,gatewayLoading:i}),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[Ln]}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)===Cn}(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[Ln];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[Ln];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[Ln];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[Ln].P&&(on(t),qr(4)),Wr(e)&&(e=un(t,e),t.l||pn(t,e)),t.u&&tn("Patches").M(r[Ln].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[Ln];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,l=!1;3===n.i&&(a=new Set(o),o.clear(),l=!0),zr(a,(function(t,a){return mn(e,n,o,t,a,r,l)})),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,l){if(Vr(o)){var i=un(e,o,a&&t&&3!==t.i&&!Ur(t.R,n)?a.concat(n):void 0);if(Hr(r,n,i),!Vr(i))return;e.m=!1}else l&&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[Ln];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=Fn);var l=Proxy.revocable(o,a),i=l.revoke,c=l.proxy;return n.k=c,n.j=i,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[Ln],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",Ln=En?Symbol.for("immer-state"):"__$immer_state",Cn=("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===Ln)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[Ln];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)}},Fn={};zr(An,(function(e,t){Fn[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Fn.deleteProperty=function(e,t){return Fn.set.call(this,e,t,void 0)},Fn.set=function(e,t,r){return An.set.call(this,e[0],t,r,e[0])};var Tn=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,l=Array(n>1?n-1:0),i=1;i<n;i++)l[i-1]=arguments[i];return a.produce(e,(function(e){var n;return(n=r).call.apply(n,[t,e].concat(l))}))}}var l;if("function"!=typeof r&&qr(6),void 0!==n&&"function"!=typeof n&&qr(7),Wr(e)){var i=ln(t),c=yn(t,e,void 0),s=!0;try{l=r(c),s=!1}finally{s?on(i):an(i)}return"undefined"!=typeof Promise&&l instanceof Promise?l.then((function(e){return nn(i,n),sn(e,i)}),(function(e){throw on(i),e})):(nn(i,n),sn(l,i))}if(!e||"object"!=typeof e){if(void 0===(l=r(e))&&(l=e),l===On&&(l=void 0),t.D&&Jr(l,!0),n){var u=[],m=[];tn("Patches").M(e,l,u,m),n(u,m)}return l}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[Ln].C=!0,an(t),r},t.finishDraft=function(e,t){var r=(e&&e[Ln]).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 Tn,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,l=[],i=l,c=!1;function s(){i===l&&(i=l.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(),i.push(e),function(){if(t){if(c)throw new Error(Bn(6));t=!1,s();var r=i.indexOf(e);i.splice(r,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(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=l=i,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,l=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={},i=0;i<l.length;i++){var c=l[i],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||l.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,lo=Object.getOwnPropertyDescriptors,io=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(io)for(var n=0,o=io(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,lo(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),l={},i={},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],l=void 0===a?[]:a,c=t[2],s=void 0===c?void 0:c,u=mo(mo({},o),i);return function(e,t,r,n){void 0===r&&(r=[]);var o,a=wo(t),l=a[0],i=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([l[t.type]],i.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=l;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,l[e]=r,i[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:l,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)})}})),l="undefined"!=typeof AbortController?AbortController:function(){function e(){this.signal={aborted:!1,addEventListener:function(){},dispatchEvent:function(){return!1},onabort:function(){},removeEventListener:function(){},reason:void 0,throwIfAborted:function(){}}}return e.prototype.abort=function(){},e}();return Object.assign((function(e){return function(i,c,s){var u,m=(null==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 l;function f(e){u=e,p.abort()}var d=function(){return l=this,d=null,h=function(){var l,d,h,g,y,v;return function(e,t){var r,n,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(r)throw new TypeError("Generator is already executing.");for(;l;)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 l.label++,{value:a[1],done:!1};case 5:l.label++,n=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],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,i])}}}(this,(function(w){switch(w.label){case 0:return w.trys.push([0,4,,5]),null===(b=g=null==(l=null==r?void 0:r.condition)?void 0:l.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"})}))})),i(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:i,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||i(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(l,d)).next())}));var l,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 Lo(e){return Lo="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},Lo(e)}function Co(){Co=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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Lo(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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(Lo(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.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 l(e){Po(a,n,o,l,i,"next",e)}function i(e){Po(a,n,o,l,i,"throw",e)}l(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[Ln];return An.get(t,e)},set:function(t){var r=this[Ln];An.set(r,e,t)}},r}function t(e){for(var t=e.length-1;t>=0;t--){var o=e[t][Ln];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!==Ln){var l=t[a];if(void 0===l&&!Ur(t,a))return!0;var i=r[a],c=i&&i[Ln];if(c?c.t!==l:!$r(i,l))return!0}}var s=!!t[Ln];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[Ln];for(var l=Pn(a),i=0;i<l.length;i++){var c=l[i];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,Ln,{value:a,writable:!0}),o},S:function(e,r,o){o?Vr(r)&&r[Ln].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var r=t[Ln];if(r){var o=r.t,a=r.k,l=r.R,i=r.i;if(4===i)zr(a,(function(t){t!==Ln&&(void 0!==o[t]||Ur(o,t)?l[t]||e(a[t]):(l[t]=!0,hn(r)))})),zr(o,(function(e){void 0!==a[e]||Ur(a,e)||(l[e]=!1,hn(r))}));else if(5===i){if(n(r)&&(hn(r),l.length=!0),a.length<o.length)for(var c=a.length;c<o.length;c++)l[c]=!1;else for(var s=o.length;s<a.length;s++)l[s]=!0;for(var u=Math.min(a.length,o.length),m=0;m<u;m++)a.hasOwnProperty(m)||(l[m]=!0),void 0===l[m]&&e(a[m])}}}}(e.p[0]),t(e.p))},K:function(e){return 4===e.i?r(e):n(e)}})}();var Ro=No("license/fetchLicense",_o(Co().mark((function e(){var t;return Co().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 Fo(e,t){return"function"==typeof e?e(t):e}function To(e,t){return r=>{t.setState((t=>({...t,[e]:Fo(r,t[e])})))}}function Mo(e){return e instanceof Function}function Do(e,t,r){let n,o=[];return a=>{let l;r.key&&r.debug&&(l=Date.now());const i=e(a);if(i.length===o.length&&!i.some(((e,t)=>o[t]!==e)))return n;let c;if(o=i,r.key&&r.debug&&(c=Date.now()),n=t(...i),null==r||null==r.onChange||r.onChange(n),r.key&&r.debug&&null!=r&&r.debug()){const e=Math.round(100*(Date.now()-l))/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,l;const i=null!=(a=null==n?void 0:n.map((e=>r.find((t=>t.id===e)))).filter(Boolean))?a:[],c=null!=(l=null==o?void 0:o.map((e=>r.find((t=>t.id===e)))).filter(Boolean))?l:[];return zo(t,[...i,...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,l,i,c;return[...null!=(n=null==(o=e[0])?void 0:o.headers)?n:[],...null!=(a=null==(l=t[0])?void 0:l.headers)?a:[],...null!=(i=null==(c=r[0])?void 0:c.headers)?i:[]].map((e=>e.getLeafHeaders())).flat()}),Go(e.options,qo))}};function zo(e,t,r,n){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 r;null!=(r=e.columns)&&r.length&&i(e.columns,t+1)}),0)};i(e);let c=[];const s=(e,t)=>{const o={depth:t,id:[n,`${t}`].filter(Boolean).join("_"),headers:[]},a=[];e.forEach((e=>{const l=[...a].reverse()[0];let i,c=!1;if(e.column.depth===o.depth&&e.column.parent?i=e.column.parent:(i=e.column,c=!0),l&&(null==l?void 0:l.column)===i)l.subHeaders.push(e);else{const o=Vo(r,i,{id:[n,t,i.id,null==e?void 0:e.id].filter(Boolean).join("_"),isPlaceholder:c,placeholderId:c?`${a.filter((e=>e.column===i)).length}`:void 0,depth:t,index:a.length});o.subHeaders.push(e),a.push(o)}o.headers.push(e),e.headerGroup=o})),c.push(o),t>0&&s(a,t-1)},u=t.map(((e,t)=>Vo(r,e,{depth:l,index:t})));s(u,l-1),c.reverse();const m=e=>e.filter((e=>e.column.getIsVisible())).map((e=>{let t=0,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:To("columnSizing",e),onColumnSizingInfoChange:To("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 l=e.getSize(),i=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,l=(r-(null!=(n=null==e?void 0:e.startOffset)?n:0))*a,i=Math.max(l/(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*i,0))/100})),{...e,deltaOffset:l,deltaPercentage:i}})),"onChange"!==t.options.columnResizeMode&&"end"!==e||t.setColumnSizing((e=>({...e,...s}))))},m=e=>u("move",e),p=e=>{u("end",e),t.setColumnSizingInfo((e=>({...e,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]})))},f=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:l,deltaOffset:0,deltaPercentage:0,columnSizingStart:i,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:To("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 l={};if(!0===n?Object.keys(t.getRowModel().rowsById).forEach((e=>{l[e]=!0})):l=n,r=null!=(o=r)?o:!a,!a&&r)return{...l,[e.id]:!0};if(a&&!r){const{[e.id]:t,...r}=l;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,l=null===r||Number.isNaN(o)?1/0:o;if(a>l){const e=a;a=l,l=e}return[a,l]},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 la={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],globalFilter:void 0,...e}),getDefaultOptions:e=>({onColumnFiltersChange:To("columnFilters",e),onGlobalFilterChange:To("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=Fo(r,o?o.value:void 0);var l;if(ia(n,a,e))return null!=(l=null==t?void 0:t.filter((t=>t.id!==e.id)))?l:[];const i={id:e.id,value:a};var c;return o?null!=(c=null==t?void 0:t.map((t=>t.id===e.id?i:t)))?c:[]:null!=t&&t.length?[...t,i]:[i]}))},e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.getGlobalAutoFilterFn=()=>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=Fo(t,e))?void 0:n.filter((e=>{const t=r.find((t=>t.id===e.id));return!t||!ia(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 ia(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:To("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:To("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:To("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=>Fo(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=Fo(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,Fo(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=Fo(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:To("columnPinning",e),onRowPinningChange:To("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,l,i,c;return"right"===r?{left:(null!=(a=null==e?void 0:e.left)?a:[]).filter((e=>!(null!=n&&n.includes(e)))),right:[...(null!=(l=null==e?void 0:e.right)?l:[]).filter((e=>!(null!=n&&n.includes(e)))),...n]}:"left"===r?{left:[...(null!=(i=null==e?void 0:e.left)?i:[]).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))),l=r.some((e=>null==o?void 0:o.includes(e)));return a?"left":!!l&&"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})):[],l=o?e.getParentRows().map((e=>{let{id:t}=e;return t})):[],i=new Set([...l,e.id,...a]);t.setRowPinning((e=>{var t,n,o,a,l,c;return"bottom"===r?{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"===r?{top:[...(null!=(l=null==e?void 0:e.top)?l:[]).filter((e=>!(null!=i&&i.has(e)))),...Array.from(i)],bottom:(null!=(c=null==e?void 0:e.bottom)?c:[]).filter((e=>!(null!=i&&i.has(e))))}:{top:(null!=(t=null==e?void 0:e.top)?t:[]).filter((e=>!(null!=i&&i.has(e)))),bottom:(null!=(n=null==e?void 0:e.bottom)?n:[]).filter((e=>!(null!=i&&i.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))),l=r.some((e=>null==o?void 0:o.includes(e)));return a?"top":!!l&&"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:To("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 l;if(r=void 0!==r?r:!o,e.getCanSelect()&&o===r)return a;const i={...a};return da(i,e.id,r,null==(l=null==n?void 0:n.selectChildren)||l,t),i}))},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 l=o.getRow(t,!0);r?(l.getCanMultiSelect()||Object.keys(e).forEach((t=>delete e[t])),l.getCanSelect()&&(e[t]=!0)):delete e[t],n&&null!=(a=l.subRows)&&a.length&&l.getCanSelectSubRows()&&l.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 l=ga(e,r);if(l&&(n.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: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),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 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:To("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((l=>{const i=null==l?void 0:l.find((t=>t.id===e.id)),c=null==l?void 0:l.findIndex((t=>t.id===e.id));let s,u=[],m=a?r:"desc"===o;var p;return s=null!=l&&l.length&&e.getCanMultiSort()&&n?i?"toggle":"add":null!=l&&l.length&&c!==l.length-1?"replace":i?"toggle":"replace","toggle"===s&&(a||o||(s="remove")),"add"===s?(u=[...l,{id:e.id,desc:m}],u.splice(0,u.length-(null!=(p=t.options.maxMultiSortColCount)?p:Number.MAX_SAFE_INTEGER))):u="toggle"===s?l.map((t=>t.id===e.id?{...t,desc:m}:t)):"remove"===s?l.filter((t=>t.id!==e.id)):[{id:e.id,desc:m}],u}))},e.getFirstSortDir=()=>{var 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(),l=e.getIsSorted();return l?!!(l===a||null!=(n=t.options.enableSortingRemoval)&&!n||r&&null!=(o=t.options.enableMultiRemove)&&!o)&&("desc"===l?"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:To("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,la,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 l=!1;const i={_features:Oa,options:{...n,...e},initialState:o,_queue:e=>{a.push(e),l||(l=!0,Promise.resolve().then((()=>{for(;a.length;)a.shift()();l=!1})).catch((e=>setTimeout((()=>{throw e})))))},reset:()=>{r.setState(r.initialState)},setOptions:e=>{const t=Fo(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 l={...e._getDefaultColumnDef(),...t},i=l.accessorKey;let c,s=null!=(o=null!=(a=l.id)?a:i?i.replace(".","_"):void 0)?o:"string"==typeof l.header?l.header:void 0;if(l.accessorFn?c=l.accessorFn:i&&(c=i.includes(".")?e=>{let t=e;for(const e of i.split(".")){var r;t=null==(r=t)?void 0:r[e]}return t}:e=>e[l.accessorKey]),!s)throw new Error;let u={id:`${String(s)}`,accessorFn:c,parent:n,depth:r,columnDef:l,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),l=e;return a.columns=l.columns?t(l.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,i);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 La=(e,t,r,n,o,a,l)=>{let i={id:t,index:n,original:r,depth:o,parentId:l,_valuesCache:{},_uniqueValuesCache:{},getValue:t=>{if(i._valuesCache.hasOwnProperty(t))return i._valuesCache[t];const r=e.getColumn(t);return null!=r&&r.accessorFn?(i._valuesCache[t]=r.accessorFn(i.original,n),i._valuesCache[t]):void 0},getUniqueValues:t=>{if(i._uniqueValuesCache.hasOwnProperty(t))return i._uniqueValuesCache[t];const r=e.getColumn(t);return null!=r&&r.accessorFn?r.columnDef.getUniqueValues?(i._uniqueValuesCache[t]=r.columnDef.getUniqueValues(i.original,n),i._uniqueValuesCache[t]):(i._uniqueValuesCache[t]=[i.getValue(t)],i._uniqueValuesCache[t]):void 0},renderValue:t=>{var r;return null!=(r=i.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}(i.subRows,(e=>e.subRows)),getParentRow:()=>i.parentId?e.getRow(i.parentId,!0):void 0,getParentRows:()=>{let e=[],t=i;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,i,t,t.id)))),Go(e.options,"debugRows")),_getAllCellsByColumnId:Do((()=>[i.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(i,e)}return i};function Ca(){return e=>Do((()=>[e.options.data]),(t=>{const r={rows:[],flatRows:[],rowsById:{}},n=function(t,o,a){void 0===o&&(o=0);const l=[];for(let c=0;c<t.length;c++){const s=La(e,e._getRowId(t[c],c,a),t[c],c,o,void 0,null==a?void 0:a.id);var i;r.flatRows.push(s),r.rowsById[s.id]=s,l.push(s),e.options.getSubRows&&(s.originalSubRows=e.options.getSubRows(t[c],c),null!=(i=s.originalSubRows)&&i.length&&(s.subRows=n(s.originalSubRows,o+1,s)))}return l};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 l=r.map((e=>e.id)),i=e.getGlobalFilterFn(),c=e.getAllLeafColumns().filter((e=>e.getCanGlobalFilter()));let s,u;n&&i&&c.length&&(l.push("__global__"),c.forEach((e=>{var t;a.push({id:e.id,filterFn:i,resolvedValue:null!=(t=null==i.resolveFilterValue?void 0:i.resolveFilterValue(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={},l=null!=(n=r.options.maxLeafRowFilterDepth)?n:100,i=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=La(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<l){if(p.subRows=i(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:i(e),flatRows:o,rowsById:a}}(e,t,r):function(e,t,r){var n;const o=[],a={},l=null!=(n=r.options.maxLeafRowFilterDepth)?n:100,i=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<l){const e=La(r,m.id,m.original,m.index,m.depth,void 0,m.parentId);e.subRows=i(m.subRows,n+1),m=e}c.push(m),o.push(m),a[m.id]=m}}return c};return{rows:i(e),flatRows:o,rowsById:a}}(e,t,r)}(t.rows,(e=>{for(let t=0;t<l.length;t++)if(!1===e.columnFilters[l[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()})),l={};a.forEach((t=>{const r=e.getColumn(t.id);r&&(l[t.id]={sortUndefined:r.columnDef.sortUndefined,invertSorting:r.columnDef.invertSorting,sortingFn:r.getSortingFn()})}));const i=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],i=l[o.id],c=null!=(r=null==o?void 0:o.desc)&&r;let s=0;if(i.sortUndefined){const r=void 0===e.getValue(o.id),n=void 0===t.getValue(o.id);(r||n)&&(s=r&&n?0:r?i.sortUndefined:-i.sortUndefined)}if(0===s&&(s=i.sortingFn(e,t,o.id)),0!==s)return c&&(s*=-1),i.invertSorting&&(s*=-1),s}return e.index-t.index})),t.forEach((e=>{var t;o.push(e),null!=(t=e.subRows)&&t.length&&(e.subRows=i(e.subRows))})),t};return{rows:i(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:l,rowsById:i}=r;const c=n*o,s=c+n;let u;a=a.slice(c,s),u=e.options.paginateExpandedRows?{rows:a,flatRows:l,rowsById:i}:Ia({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}),Go(e.options,"debugTable"))}function Fa(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 Ta(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,l=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),i=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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(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=i[0],s=i[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({},l,{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"},Fa(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,l="variable"===o,i=t.original.id===r,c=t.getIsExpanded(),s=Za(a?"bg-sky-50":"",i?"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,i="actions"===e.column.id;return o&&(l||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||i||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":"")},i&&l?wp.element.createElement(_t,{variant:"secondary"},"Pro only"):Fa(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,l=void 0===a||a,i=(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"}},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: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 el=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 tl=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 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 nl(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 ol(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=rl(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=rl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==rl(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var al=function(t){var r=t.progress,n=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)}),[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: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"},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?nl(Object(r),!0).forEach((function(t){ol(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):nl(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),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(tl,{className:"mr-1.5 h-4 w-4 text-white","aria-hidden":"true"}),wp.element.createElement("span",null,"Close"))))};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 il(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 cl(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?il(Object(r),!0).forEach((function(t){sl(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):il(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function sl(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}var ul=function(e){var t=e.dataToImport,r=e.setDataToImport,n=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 r(cl(cl({},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(cl(cl({},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(cl(cl({},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(cl(cl({},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(){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(tl,{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"}))))},ml=function(e){var t=e.currentStep,r=e.rangeValue,n=e.dataToImport,o=e.handleStepChange,a=e.setCurrentStep,l=e.handleRangeChange,i=e.setDataToImport,c=e.importProduct,s=e.importCount,u=e.productsToImport,m=e.isImporting,p=e.setIsDialogOpen,f=e.progress;switch(t){case 0:return wp.element.createElement(ul,{dataToImport:n,setDataToImport:i,rangeValue:r,handleRangeChange:l,handleStepChange:o,setCurrentStep:a,setIsDialogOpen:p});case 1:return wp.element.createElement(el,{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(al,{progress:f,importCount:s,handleStepChange:o,setCurrentStep:a,isImporting:m,setIsDialogOpen:p});default:return wp.element.createElement("div",null,"Invalid step")}};function pl(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 fl=function(t){var r=t.isDialogOpen,n=t.setIsDialogOpen,o=t.progress,a=t.rangeValue,l=t.setRangeValue,i=t.setDataToImport,c=t.dataToImport,s=t.importProduct,u=t.productsToImport,m=t.importCount,p=t.isImporting,f=[{name:"Step 1",href:"#",status:"current"},{name:"Step 2",href:"#",status:"upcoming"},{name:"Step 3",href:"#",status:"upcoming"}],d=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return pl(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)?pl(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(ml,{currentStep:h,rangeValue:a,dataToImport:c,handleStepChange:function(e){g((function(t){return"forward"===e&&t<f.length-1?t+1:"backward"===e&&t>0?t-1:t}))},setCurrentStep:g,handleRangeChange:function(e){l(Number(e.target.value))},importCount:m,productsToImport:u,setDataToImport:i,importProduct:s,isImporting:p,setIsDialogOpen: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 dl(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 hl=(0,e.createContext)({blockNavigation:!1,setBlockNavigation:function(){}}),gl=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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return dl(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)?dl(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(hl.Provider,{value:{blockNavigation:o,setBlockNavigation:a}},r)};function yl(e){return yl="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},yl(e)}function vl(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 wl(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?vl(Object(r),!0).forEach((function(t){bl(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vl(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function bl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=yl(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=yl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==yl(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xl(e){return function(e){if(Array.isArray(e))return El(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 El(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)?El(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 El(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 Sl=["BIF","CLP","DJF","GNF","JPY","KMF","KRW","MGA","PYG","RWF","UGX","VND","VUV","XAF","XOF","XPF"];var kl=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)},Nl=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"}))},Ol=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,l=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"})),l)},jl=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]")})})))},Ll=["indeterminate","className"];function Cl(){return Cl=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},Cl.apply(null,arguments)}const Pl=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,Ll),l=(0,t.useRef)(null);return(0,t.useEffect)((function(){"boolean"==typeof r&&(l.current.indeterminate=!a.checked&&r)}),[r,a.checked]),wp.element.createElement("input",Cl({type:"checkbox",ref:l,className:o+" cursor-pointer"},a))};var _l=function(e,t,r,n,o){var a=!o||e.original.present_at_location_ids&&e.original.present_at_location_ids.includes(n),l=!!e.getValue(t)&&e.getValue(t).toString().toLowerCase().includes(r.toLowerCase()),i=!!e.subRows&&e.subRows.some((function(e){var n=e.getValue(t);return!!n&&n.toString().toLowerCase().includes(r.toLowerCase())}));l&&e.subRows&&e.subRows.forEach((function(e){e.isMatch=!0}));var c=l||i;return!(!l||!e.subRows)||c&&a},Rl=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)},Il=function(e,t,r){return!r||(!(n=e)||!0!==n.getValue(t));var n},Al=function(e,t,r){return!r||(!(n=e)||!0!==n.getValue(t));var n},Fl=function(e,t,r){if(!r&&!1!==r)return!0;var n="true"===r||"false"!==r&&r;return e.getValue(t)===n};const Tl=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))},Ml=(...e)=>e.filter(((e,t,r)=>Boolean(e)&&""!==e.trim()&&r.indexOf(e)===t)).join(" ").trim();var Dl={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 Gl=(0,t.forwardRef)((({color:e="currentColor",size:r=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:a="",children:l,iconNode:i,...c},s)=>(0,t.createElement)("svg",{ref:s,...Dl,width:r,height:r,stroke:e,strokeWidth:o?24*Number(n)/Number(r):n,className:Ml("lucide",a),...c},[...i.map((([e,r])=>(0,t.createElement)(e,r))),...Array.isArray(l)?l:[l]]))),ql=((e,r)=>{const n=(0,t.forwardRef)((({className:n,...o},a)=>{return(0,t.createElement)(Gl,{ref:a,iconNode:r,className:Ml(`lucide-${l=e,l.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,n),...o});var l}));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 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,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 zl(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Wl(Object(r),!0).forEach((function(t){Bl(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Wl(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Bl(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}var Ul=function(t,r,n,o,a,l){var i=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,l,i,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 Sl.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 Sl.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,xl(w)),g=Math.max.apply(Math,xl(w))):h=g=0;var x=b.length?Math.min.apply(Math,xl(b)):0,E=b.length?Math.max.apply(Math,xl(b)):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===(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(kl,{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(jl,{value:t}):wp.element.createElement(Nl,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(Ol,{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=zl(zl({},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(Tl,{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(ql,{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(Pl,{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(Pl,{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 zl(zl({},t),{},Bl({},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 zl(zl({},r),{},Bl({},t.id,e.target.checked))}))}))}else if(0!==r.depth||e.target.checked)n.setRowSelection((function(t){return zl(zl({},t),{},Bl({},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 zl(zl({},r),{},Bl({},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 Rl(e,t,r)}}),[n,o,a,l]),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:i,sorting:s,columnVisibility:{id:!1,present_at_location_ids:!1,is_archived:!1,visibility:!1},globalFilter:m,rowSelection:g},filterFns:{visibilityFilter:Il,archivedFilter:Al,statusFilter:Fl,includesCategoryFilter:S,searchFilterFn:function(e,t,r){return!!Array.isArray(t)&&Rl(e,t,r)}},globalFilterFn:Rl,getSubRows:function(e){return e.subRows||[]},getCoreRowModel:Ca(),getFilteredRowModel:Pa(),getSortedRowModel:_a(),getExpandedRowModel:Ra(),getPaginationRowModel:Aa(),onExpandedChange:c,onGlobalFilterChange:p,autoResetPageIndex:!1,enableRowSelection:!0,getRowId:function(e){return e.id}}}),[w,x,i,s,m,c,u,p,g,y,E,n,o,a,l])};function Hl(e){return Hl="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},Hl(e)}function $l(){$l=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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Hl(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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(Hl(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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 Zl(e,t,r,n,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.done?t(c):Promise.resolve(c).then(n,o)}function Yl(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function l(e){Zl(a,n,o,l,i,"next",e)}function i(e){Zl(a,n,o,l,i,"throw",e)}l(void 0)}))}}function Kl(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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Xl(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)?Xl(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 Xl(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 Jl(e){return Jl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Jl(e)}function Ql(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=oi(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,l=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){l=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw o}}}}function ei(){ei=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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Jl(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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(Jl(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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 ti(e,t,r,n,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.done?t(c):Promise.resolve(c).then(n,o)}function ri(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function l(e){ti(a,n,o,l,i,"next",e)}function i(e){ti(a,n,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 r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||oi(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 oi(e,t){if(e){if("string"==typeof e)return ai(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)?ai(e,t):void 0}}function ai(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 li=function(t){var r=t.setIsAutoMatchOpen,n=t.inventory,o=ni((0,e.useState)("sku"),2),a=o[0],l=o[1],i=ni((0,e.useState)(!1),2),c=i[0],s=i[1],u=ni((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=ri(ei().mark((function e(t,r){return ei().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=ri(ei().mark((function e(){var t,r,o,l;return ei().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:s(!0),t=f(n,100),r=Ql(t),e.prev=4,r.s();case 6:if((o=r.n()).done){e.next=12;break}return l=o.value,e.next=10,d(l,a);case 10:e.next=6;break;case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(4),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 l(e.target.value)}},wp.element.createElement("option",{value:"sku"},"SKU")),m&&wp.element.createElement("p",{className:"text-sky-500 mt-4"},m),c?wp.element.createElement("div",{className:"flex items-center mt-10 justify-end gap-2"},wp.element.createElement("button",{type:"button",className:"relative inline-flex items-center rounded-md bg-sky-500 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400",disabled:""},wp.element.createElement("svg",{className:"animate-spin -ml-1 mr-3 h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},wp.element.createElement("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),wp.element.createElement("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})),"Processing...")):wp.element.createElement("div",{className:"flex items-center mt-10 justify-end gap-2"},wp.element.createElement("button",{type:"button",onClick:function(){return 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(tl,{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 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 ci(){ci=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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==ii(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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(ii(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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 si(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 ui(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?si(Object(r),!0).forEach((function(t){mi(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):si(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function mi(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}function pi(e,t,r,n,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.done?t(c):Promise.resolve(c).then(n,o)}function fi(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function l(e){pi(a,n,o,l,i,"next",e)}function i(e){pi(a,n,o,l,i,"throw",e)}l(void 0)}))}}function di(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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||hi(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 hi(e,t){if(e){if("string"==typeof e)return gi(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)?gi(e,t):void 0}}function gi(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 yi=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,r=di((0,t.useState)(null),2),n=r[0],o=r[1],a=di((0,t.useState)(!0),2),l=a[0],i=a[1],c=di((0,t.useState)(!1),2),s=c[0],u=c[1],m=di((0,t.useState)(""),2),p=m[0],f=m[1],d=di((0,t.useState)(""),2),h=d[0],g=d[1],y=di((0,t.useState)(""),2),v=y[0],w=y[1],b=di((0,t.useState)(""),2),x=b[0],E=b[1],S=di((0,t.useState)(""),2),k=S[0],N=S[1],O=di((0,t.useState)(""),2),j=O[0],L=O[1],C=di((0,t.useState)([]),2),P=C[0],_=C[1],R=di((0,t.useState)({pageIndex:0,pageSize:e,total:0,totalPages:0,importable:0}),2),I=R[0],A=R[1],F=di((0,t.useState)([]),2),M=F[0],D=F[1],G=(0,t.useRef)(!0),q=(0,t.useCallback)(fi(ci().mark((function e(){var t,r,n,a,l,c,u,m,d,y,b,S,O,C,P,_,R,F,D,G,q,V,W,z,B,U,H,$,Z,Y,K,X,J,Q=arguments;return ci().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,l=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,C=t.status,P=void 0===C?v:C,_=t.ecom,R=void 0===_?k:_,F=t.archive,D=void 0===F?j:F,G=t.location,q=void 0===G?x:G,!s){e.next=3;break}return e.abrupt("return");case 3:return i(!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:l.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/l),f(u),g(O),w(P),L(D),E(q),N(R),A((function(e){return ui(ui({},e),{},{pageIndex:n,pageSize:l,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),T.error("Error fetching inventory. See console for details.");case 42:return e.prev=42,i(!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 ui(ui({},e),{},{pageIndex:0})})),q({pageIndex:0,pageSize:I.pageSize,search:e})}),[q,I.pageSize]),W=(0,t.useCallback)(fi(ci().mark((function e(){var t,r,n,a,l,c,s,m,p=arguments;return ci().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=p.length>0&&void 0!==p[0]&&p[0],u(!0),i(!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),i(!0)):(o(n.data),a=r.headers.get("X-WP-Total"),l=r.headers.get("X-WP-TotalPages"),c=parseInt(a||"0",10),s=parseInt(l||"0",10),A((function(e){return ui(ui({},e),{},{pageIndex:0,pageSize:I.pageSize,total:c,totalPages:s})})),u(!1),i(!1));case 12:m=function(){var e=fi(ci().mark((function e(){var t,r,n,a;return ci().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=0,r=100,n=ci().mark((function e(){var r,n,a,l,c;return ci().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),i(!1),o(n.inventory||[]),a=r.headers.get("X-WP-Total"),l=parseInt(a||"0",10),c=Math.ceil(l/I.pageSize),f(""),A((function(e){return ui(ui({},e),{},{pageIndex:0,total:l,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:T.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),T.error("Error triggering inventory update."),u(!1),i(!1);case 22:case"end":return e.stop()}}),e,null,[[3,16]])}))),[]),z=(0,t.useCallback)((function(e){g(e),A((function(e){return ui(ui({},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 ui(ui({},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 ui(ui({},e),{},{pageIndex:0})})),q({pageIndex:0,category:h,status:v,location:e,archive:j,ecom:k})}),[q,x]),H=(0,t.useCallback)((function(e){L(e),A((function(e){return ui(ui({},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 ui(ui({},e),{},{pageIndex:0})})),q({pageIndex:0,category:h,status:v,location:x,archive:j,ecom:e})}),[q,k]),Z=(0,t.useCallback)(fi(ci().mark((function e(){var t,r;return ci().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),T.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 gi(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||hi(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:l,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:L,setLocationFilter:E,setEcomFilter:N,fetchInventory:q,handleSearch:V,changeCategory:z,changeStatus:B,changeLocation:U,changeEcom:$,changeArchive:H,triggerAndPollInventory:W,fetchCategories:Z}};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){return function(e){if(Array.isArray(e))return Ni(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 bi(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 xi(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?bi(Object(r),!0).forEach((function(t){Ei(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):bi(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Ei(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}function Si(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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)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 Ni(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)?Ni(e,t):void 0}}function Ni(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 Oi="undefined"==typeof AbortController?void 0:new AbortController;const ji=function(r){var o=r.settings,a=r.updateSettings,l=yi(10),i=l.inventoryLoading,c=(l.polling,l.inventory),s=l.triggerAndPollInventory,u=l.fetchInventory,m=l.handleSearch,p=l.searchTerm,f=l.setPagination,d=l.pagination,h=l.sorting,g=l.setSorting,y=l.categoryFilter,v=l.statusFilter,w=l.changeCategory,b=l.changeStatus,x=l.categoryOptions,E=l.locationFilter,S=l.changeLocation,k=l.archiveFilter,N=l.changeArchive,O=l.ecomFilter,j=l.changeEcom,L=Si((0,t.useState)({}),2),C=L[0],P=L[1],_=Si((0,t.useState)({}),2),R=_[0],I=_[1],A=Si((0,t.useState)(!1),2),F=A[0],M=A[1],D=Si((0,t.useState)(!1),2),G=D[0],q=D[1],V=Si((0,t.useState)(15),2),W=V[0],z=V[1],B=function(t,r,n,o){var a=Kl((0,e.useState)(!1),2),l=a[0],i=a[1],c=Kl((0,e.useState)(null),2),s=c[0],u=c[1],m=(0,e.useRef)(null),p=(0,e.useRef)(l);(0,e.useEffect)((function(){p.current=l}),[l]);var f=(0,e.useCallback)(Yl($l().mark((function e(){var t,r,n,o,a,l,c,s,m;return $l().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,l=n.total,c=void 0===l?0:l,s=n.error,m=void 0===s?"":s,(a>0||c>0||m)&&u(r.progress)),r.isImporting&&(i(!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=Yl($l().mark((function o(){var a,l,c;return $l().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 l=o.sent,o.next=6,l.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 i(!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):i(!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=Yl($l().mark((function e(t,r,n,a,l,c){var s,m;return $l().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 i(!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:l,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 T.error("Import error: ".concat(m.error)),i(!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?T.info("Import request aborted."):T.error("Import request failed: ".concat(e.t0.message)),i(!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=Yl($l().mark((function e(){var t,r;return $l().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?(i(!1),T.info("Import was stopped.")):T.warn(r.message),e.next=14;break;case 10:e.prev=10,e.t0=e.catch(0),console.error("Error stopping import:",e.t0),T.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(){i(!1),u(null),n("inventory",{})}),[]);return(0,e.useEffect)((function(){return function(){m.current&&clearTimeout(m.current)}}),[]),{isImporting:l,progress:s,importProduct:h,clearImportProgress:y,setIsImporting:i,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=Si((0,t.useState)([]),2),X=K[0],J=K[1],Q=Si((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=Si((0,t.useState)({}),2),ne=re[0],oe=re[1],ae=Si((0,t.useState)(""),2),le=ae[0],ie=ae[1],ce=Si((0,t.useState)([]),2),se=(ce[0],ce[1],Si((0,t.useState)([]),2)),ue=se[0],me=(se[1],Si((0,t.useState)(!0),2)),pe=me[0],fe=(me[1],Si((0,t.useState)(!1),2)),de=fe[0],he=(fe[1],Si((0,t.useState)(!1),2)),ge=he[0],ye=(he[1],Ul(c||[],{expanded:ne,setExpanded:oe,sorting:h,setSorting:g,globalFilter:le,setGlobalFilter:ie,isImporting:U,setProductsToImport:J,setIsDialogOpen:M},o.location,pe,de,ge));console.log(c);var ve,we,be,xe=Ta(xi(xi({},ye),{},{manualPagination:!0,manualSorting:!0,pageCount:d.totalPages||1,state:xi(xi({},ye.state),{},{pagination:d,sorting:h,rowSelection:C}),onPaginationChange:f,onSortingChange:function(e){g(e),f((function(e){return xi(xi({},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=xi({},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 l=e.getParentRow(),i=l.original.id;if(n[i]?Array.isArray(n[i].subRows)||(n[i].subRows=[]):n[i]=xi(xi({},l.original),{},{subRows:[]}),o)n[i].subRows.find((function(e){return e.id===a}))||n[i].subRows.push(e.original);else{n[i].subRows=n[i].subRows.filter((function(e){return e.id!==a}));var c=r[l.id];0!==n[i].subRows.length||c||delete n[i]}}else o?n[a]=xi(xi({},e.original),{},{subRows:e.original.subRows?wi(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(),l=null==a||null===(o=a.original)||void 0===o?void 0:o.id;if(!l)return;var i=R[l];i&&Array.isArray(i.subRows)&&i.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,l=void 0===a?"":a;return"Import stopped by user"===l?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,").")):l&&l.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,l),". 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]",l=e.message||"Item #".concat(t+1," complete");return wp.element.createElement("div",{key:t,className:"whitespace-pre-wrap mb-1 ".concat(n)},a," ",l)})))),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(li,{setIsAutoMatchOpen:q,inventory:c})),wp.element.createElement(fl,{dataToImport:ee,setDataToImport:te,importCount:0===X.length?d.importable:X.length,importProduct:function(){$(X,c,Oi,ee,y,v,p)},controller:Oi,isImporting:U,productsToImport:X,rangeValue:W,setRangeValue:z,isDialogOpen:F,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!=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(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"))),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 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"},i?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:C,setRowSelection:P})))};function Li(e){return Li="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},Li(e)}function Ci(){Ci=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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Li(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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(Li(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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 Pi(e,t,r,n,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.done?t(c):Promise.resolve(c).then(n,o)}var _i=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 l(e){Pi(a,n,o,l,i,"next",e)}function i(e){Pi(a,n,o,l,i,"throw",e)}l(void 0)}))}}(Ci().mark((function a(l){var i,c;return Ci().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if(a.prev=0,i=null,e)try{localStorage.removeItem("inventoryData")}catch(e){console.warn("Failed to remove data from local storage:",e)}else{try{i=localStorage.getItem("inventoryData")}catch(e){console.warn("Failed to retrieve data from local storage:",e)}i&&setTimeout((function(){var e=JSON.parse(i);return r({status:"success",data:e})}),100)}return a.next=5,zt({path:"/sws/v1/square-inventory".concat(l&&e?"?force=true":"")});case 5:if((c=a.sent).loading)l&&T.info("Fetching data, please wait...",{autoClose:2e3,hideProgressBar:!1,closeOnClick:!1}),setTimeout((function(){return o(!1)}),t);else if(0===c.data.length)T.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)}T.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),T.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 Ri(e){return Ri="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ri(e)}function Ii(){Ii=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Ri(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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(Ri(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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 Ai(e,t,r,n,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.done?t(c):Promise.resolve(c).then(n,o)}function Fi(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function l(e){Ai(a,n,o,l,i,"next",e)}function i(e){Ai(a,n,o,l,i,"throw",e)}l(void 0)}))}}var Ti=No("inventory/fetchIfNeeded",Fi(Ii().mark((function e(){var t,r,n,o,a,l,i,c,s=arguments;return Ii().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(),l=a.inventory,!t&&null!==l.data){e.next=24;break}return e.prev=4,e.next=7,_i(t);case 7:if("success"!==(i=e.sent).status){e.next=12;break}return e.abrupt("return",i.data);case 12:if("loading"!==i.status){e.next=16;break}return e.abrupt("return",o("Data is being fetched, please wait..."));case 16:throw new Error(i.error);case 17:e.next=22;break;case 19:return e.prev=19,e.t0=e.catch(4),e.abrupt("return",o(e.t0.message));case 22:e.next=44;break;case 24:if(!l.loading){e.next=43;break}return e.prev=25,e.next=28,_i(!1);case 28:if("success"!==(c=e.sent).status){e.next=33;break}return e.abrupt("return",c.data);case 33:if("loading"!==c.status){e.next=37;break}return e.abrupt("return",o("Data is being fetched, please wait..."));case 37:throw new Error(c.error);case 38:e.next=43;break;case 40:return e.prev=40,e.t1=e.catch(25),e.abrupt("return",o(e.t1.message));case 43:return e.abrupt("return",l.data);case 44:case"end":return e.stop()}}),e,null,[[4,19],[25,40]])})))),Mi=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(Ti.pending,(function(e){e.loading=!0,e.fetchAttempted=!0})).addCase(Ti.fulfilled,(function(e,t){e.loading=!1,e.data=t.payload,e.error=null})).addCase(Ti.rejected,(function(e,t){e.loading=!1,e.data=[],e.error=t.payload}))}}),Di=Mi.actions;Di.setInventory,Di.addItem,Di.removeItem;const Gi=Mi.reducer;function qi(e){return qi="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},qi(e)}function Vi(){Vi=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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==qi(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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(qi(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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 Wi(e,t,r,n,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.done?t(c):Promise.resolve(c).then(n,o)}function zi(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 Bi(e){return Bi="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},Bi(e)}function Ui(){Ui=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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Bi(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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(Bi(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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 Hi(e,t,r,n,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.done?t(c):Promise.resolve(c).then(n,o)}function $i(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function l(e){Hi(a,n,o,l,i,"next",e)}function i(e){Hi(a,n,o,l,i,"throw",e)}l(void 0)}))}}function Zi(){return Yi.apply(this,arguments)}function Yi(){return Yi=$i(Ui().mark((function e(){var t,r,n,o,a,l=arguments;return Ui().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=l.length>0&&void 0!==l[0]?l[0]:0,r=l.length>1&&void 0!==l[1]?l[1]:20,n=l.length>2&&void 0!==l[2]?l[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",Zi(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]])}))),Yi.apply(this,arguments)}var Ki=function(){var e=$i(Ui().mark((function e(){var t,r,n,o=arguments;return Ui().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.length>0&&void 0!==o[0]?o[0]:99,r=T.loading("Retrieving Woo Orders"),e.prev=2,e.next=5,Zi(1,t);case 5:return n=e.sent,T.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),T.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 Xi(e){return Xi="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},Xi(e)}function Ji(){Ji=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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Xi(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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(Xi(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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 Qi(e,t,r,n,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.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 l(e){Qi(a,n,o,l,i,"next",e)}function i(e){Qi(a,n,o,l,i,"throw",e)}l(void 0)}))}}var tc=No("orders/fetchIfNeeded",ec(Ji().mark((function e(){var t,r,n,o,a,l,i,c,s,u=arguments;return Ji().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,l=o.rejectWithValue,i=a(),c=i.orders,!(n||!c.data||c.data.length<1)){e.next=16;break}return e.prev=4,e.next=7,Ki();case 7:return s=e.sent,e.abrupt("return",s.data.orders);case 11:return e.prev=11,e.t0=e.catch(4),e.abrupt("return",l(e.t0.error));case 14:e.next=17;break;case 16:return e.abrupt("return",c.data);case 17:case"end":return e.stop()}}),e,null,[[4,11]])})))),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"}))})),lc=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."))},ic=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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==uc(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return yc(e,t);var 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],l=o[1],i=gc((0,e.useState)([]),2),c=i[0],s=i[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 l(e){pc(a,n,o,l,i,"next",e)}function i(e){pc(a,n,o,l,i,"throw",e)}l(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=T.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?(T.update(r,{render:"Created successfully",type:"success",isLoading:!1,autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),n(nc(g(t,o.data)))):T.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),T.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(ic,{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=Ta(hc(hc(hc({data:r,columns:v,state:{sorting:c,globalFilter:a,expanded:m},filterFns:{custom:_l},onSortingChange:s,onExpandedChange:p,globalFilterFn:"custom",onGlobalFilterChange:l,getCoreRowModel:Ca(),getSortedRowModel:_a(),getFilteredRowModel:Pa(),getPaginationRowModel:Aa(),getExpandedRowModel:Ra()},"onSortingChange",s),"onGlobalFilterChange",l),"debugTable",!0)),b=function(e){return JSON.parse(e)};return wp.element.createElement(React.Fragment,null,wp.element.createElement(lc,{fetchOrders:function(){return n(tc({forceRefresh:!0}))},setGlobalFilter:l,globalFilter:a}),wp.element.createElement("table",{className:"w-full"},wp.element.createElement("thead",{className:"border-b border-gray-900/10 text-sm leading-6 text-gray-900"},w.getHeaderGroups().map((function(e){return wp.element.createElement("tr",{key:e.id},e.headers.map((function(e){var t;return wp.element.createElement("th",{key:e.id,colSpan:e.colSpan,className:"p-2 font-bold text-left"},e.isPlaceholder?null:wp.element.createElement("div",{className:e.column.getCanSort()?"cursor-pointer select-none":"",onClick:e.column.getToggleSortingHandler()},Fa(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(ic,{className:"w-4 h-4 text-black"}))):wp.element.createElement("td",{key:e.id,className:"py-4 px-2 text-gray-600"},Fa(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(Nl,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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==xc(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.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 l(e){Sc(a,n,o,l,i,"next",e)}function i(e){Sc(a,n,o,l,i,"throw",e)}l(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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(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),l=a[0],i=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,i(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:l,merchantName:s,merchantId:p,justConnected:h,autoPrompt:t,refreshStatus:y,disconnect:v}}function Lc(e){return Lc="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},Lc(e)}function Cc(){Cc=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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Lc(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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(Lc(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.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 l(e){Pc(a,n,o,l,i,"next",e)}function i(e){Pc(a,n,o,l,i,"throw",e)}l(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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(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)(),Fc=function(e){var r=e.children,n=Dr().settings,o=jc().isAuthenticated,a=Rc((0,t.useState)([]),2),l=a[0],i=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(Cc().mark((function e(){var t;return Cc().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,i(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"),T({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(Cc().mark((function e(){var t;return Cc().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,i(t.locations.data.locations),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),f("Failed to get locations"),T.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:l,loading:s,error:p,refetchLocations:d,setLocations:i}},r)},Tc=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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Dc(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.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 l(e){qc(a,n,o,l,i,"next",e)}function i(e){qc(a,n,o,l,i,"throw",e)}l(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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(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=Tc().setLocations,l=jc(),i=l.loading,c=l.isAuthenticated,s=l.merchantName,u=l.merchantId,m=l.refreshStatus,p=l.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),T.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:T.success("Square connection removed."),a([]),e.next=13;break;case 7:return e.prev=7,e.t0=e.catch(0),console.error(e.t0),T.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([]),T.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)"),i?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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Hc(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.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 l(e){Zc(a,n,o,l,i,"next",e)}function i(e){Zc(a,n,o,l,i,"throw",e)}l(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,children:[{name:"General",href:"/settings/inventory"},{name:"Modifiers",href:"/settings/modifiers",isPro:!0},{name:"Metafield Mapping",href:"/settings/metafield-mapping",isPro:!0},{name:"Discounts",href:"/settings/discounts",isPro:!0}]},{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 ir(),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§ion=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)):e.children?wp.element.createElement("li",{key:e.name},wp.element.createElement("div",null,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("ul",{className:"mt-1 ml-8 space-y-1"},e.children.map((function(e){return 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-600 hover:text-sky-600 hover:bg-gray-50","group flex gap-x-3 rounded-lg py-2 pl-2 pr-3 text-sm leading-5")},e.name,e.isPro&&wp.element.createElement("span",{className:"pro-badge ml-2 !relative text-xs"},"PRO")))}))))):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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==ns(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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 ls(e,t,r,n,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.done?t(c):Promise.resolve(c).then(n,o)}function is(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function l(e){ls(a,n,o,l,i,"next",e)}function i(e){ls(a,n,o,l,i,"throw",e)}l(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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return cs(e,t);var 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),l=a[0],i=a[1],c=function(){var e=is(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),T.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=is(os().mark((function e(t){var n,a,l,s;return os().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.target.value,i(!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 T.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(l=e.sent,!(s=l.oauthUrl)){e.next=21;break}return window.location.href=s,e.abrupt("return");case 21:T.success("Environment updated."),e.next=26;break;case 24:e.prev=24,e.t0=e.catch(2);case 26:return e.prev=26,i(!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:l},wp.element.createElement("option",{value:"live"},"Live"),wp.element.createElement("option",{value:"sandbox"},"Sandbox")))}function us(){ir();var e=Dr(),t=e.settings,r=e.updateSettings,n=e.settingsLoading,o=Tc(),a=o.locations,l=o.loading,i=(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:l,settings:t,refetchLocations:i})))}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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ds(e,t);var 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],l=o[1];return(0,e.useEffect)((function(){l(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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(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],l=o[1];return(0,e.useEffect)((function(){l(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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(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),l=a[0],i=a[1];(0,e.useEffect)((function(){i(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: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&&!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:l})}))))))};function Ls(e){return Ls="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},Ls(e)}function Cs(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?Cs(Object(r),!0).forEach((function(t){_s(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Cs(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"!=Ls(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=Ls(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ls(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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(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),l=a[0],i=a[1];(0,e.useEffect)((function(){i(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({},l),{},_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:l.stock||!1}];return wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6"},wp.element.createElement("div",{className:"mb-6"},wp.element.createElement("label",{className:"relative inline-flex items-center cursor-pointer"},wp.element.createElement("input",{type:"checkbox",checked:!1,className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Woo to Square")),l.isActive&&!o&&wp.element.createElement(React.Fragment,null,wp.element.createElement("p",{className:"mt-4"},"Sync stock on order processing. Stock/Inventory count is the the sole permitted auto-sync option from Woo to Square (other wise an infinite update loop is created, we don't want that). You can also manually sync from the product actions."),wp.element.createElement("ul",{className:"fit-content flex-wrap items-center justify-start text-sm font-medium text-gray-900 bg-white sm:flex"},s.map((function(e){return wp.element.createElement(c,{key:e.id,id:e.id,label:e.label,checked:e.checked,squareWoo:l})}))))))};var As=Object.defineProperty,Fs=(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 Ts=new class{constructor(){Fs(this,"current",this.detect()),Fs(this,"handoffState","pending"),Fs(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)=>{Ts.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),l=void 0!==e,i=(0,t.useRef)(l),c=(0,t.useRef)(!1),s=(0,t.useRef)(!1);return!l||i.current||c.current?!l&&i.current&&!s.current&&(s.current=!0,i.current=l,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")):(c.current=!0,i.current=l,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")),[l?e:o,Gs((e=>(l||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(Ts.isHandoffComplete);return n&&!1===Ts.isHandoffComplete&&o(!1),t.useEffect((()=>{!0!==n&&o(!0)}),[n]),t.useEffect((()=>Ts.handoff()),[]),!e&&n}(),[n,o]=t.useState(e?()=>Ts.nextId():null);return Ms((()=>{null===n&&o(Ts.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:l,mergeRefs:i}){i=null!=i?i:ru;let c=nu(t,e);if(a)return tu(c,r,n,l,i);let s=null!=o?o:0;if(2&s){let{static:e=!1,...t}=c;if(e)return tu(t,r,n,l,i)}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,l,i)})}return tu(c,r,n,l,i)}function tu(e,r={},n,o,a){let{as:l=n,children:i,refName:c="ref",...s}=lu(e,["unmount","static"]),u=void 0!==e.ref?{[c]:e.ref}:{},m="function"==typeof i?i(r):i;"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(l===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(lu(s,["ref"]))),p,u,{ref:a(m.ref,u.ref)},n))}return(0,t.createElement)(l,Object.assign({},lu(s,["ref"]),l!==t.Fragment&&u,l!==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 lu(e,t=[]){let r=Object.assign({},e);for(let e of t)e in r&&delete r[e];return r}var iu=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(iu||{});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(),l=Zs(t);return Ms((()=>a.register(n)),[n,a.register]),eu({ourProps:{ref:l,...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,l=xu(),i=Zs(t);Ms((()=>l.register(n)),[n,l.register]);let c={ref:i,...l.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:l.slot||{},defaultTag:"label",name:l.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:l=!1,onChange:i,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,i,l),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!==l&&S.addEventListener(t,"reset",(()=>{g(l)}))}),[f,g]),t.createElement(t.Fragment,null,null!=c&&h&&t.createElement(cu,{features:iu.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"}))})),Lu=Object.assign(ju,{Group:function(e){var r;let[n,o]=(0,t.useState)(null),[a,l]=Eu(),[i,c]=gu(),s=(0,t.useMemo)((()=>({switch:n,setSwitch:o,labelledby:a,describedby:i})),[n,o,a,i]),u=e;return t.createElement(c,{name:"Switch.Description"},t.createElement(l,{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 Cu=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(Lu,{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 Fu=function(r){var n,o,a,l,i,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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(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===(l=c.cron.dataToUpdate)||void 0===l?void 0:l.price)||!1},{id:"description",label:"Description",checked:(null===(i=c.cron.dataToUpdate)||void 0===i?void 0:i.description)||!1}],d=function(e){var t=e.id,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 Tu(e){return Tu="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},Tu(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"!=Tu(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=Tu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Tu(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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(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),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(Lu,{checked:l,onChange:function(e){i(e),n("cron",Du(Du({},r.cron),{},{source:e?"square":"woocommerce"}))},className:Za(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:Za(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:Za(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:Za(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(Fu,{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(Lu,{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(Lu,{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(Lu,{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 Ts.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,l=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&&l.length>1&&(l=l.filter((e=>!o.includes(e)))),n=null!=n?n:a.activeElement;let i,c=(()=>{if(5&t)return 1;if(10&t)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),s=(()=>{if(1&t)return 0;if(2&t)return Math.max(0,l.indexOf(n))-1;if(4&t)return Math.max(0,l.indexOf(n))+1;if(8&t)return l.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),u=32&t?{preventScroll:!0}:{},m=0,p=l.length;do{if(m>=p||m+p<=0)return 0;let e=s+m;if(16&t)e=(e+p)%p;else{if(e<0)return 3;if(e>=p)return 1}i=l[e],null==i||i.focus(u),m+=c}while(i!==a.activeElement);return 6&t&&function(e){var t,r;return null!=(r=null==(t=null==e?void 0:e.matches)?void 0:t.call(e,Ju))&&r}(i)&&i.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 lm(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,lm),t}return r}function im(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:l,form:i,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)(im,{options:[]}),g=d.options,[y,v]=Eu(),[w,b]=gu(),x=(0,t.useRef)(null),E=Zs(x,r),[S,k]=qs(a,s,l),N=(0,t.useMemo)((()=>g.find((e=>!e.propsRef.current.disabled))),[g]),O=(0,t.useMemo)((()=>g.some((e=>f(e.propsRef.current.value,S)))),[g,S]),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),l=(0,t.useRef)(n);(0,t.useEffect)((()=>{a.current=r,l.current=n}),[r,n]),Ms((()=>{if(!e||!o)return;let t=Uu(e);if(!t)return;let r=a.current,n=l.current,i=Object.assign((e=>r(e)),{acceptNode:r}),c=t.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,i,!1);for(;c.nextNode();)n(c.currentNode)}),[e,o,a,l])}({container:x.current,accept:e=>"radio"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT,walk(e){e.setAttribute("role","none")}});let L=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)}}})),C=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:C,change:j})),[C,j]),R={ref:E,id:o,role:"radiogroup","aria-labelledby":y,"aria-describedby":w,onKeyDown:L},I=(0,t.useMemo)((()=>({value:S})),[S]),A=(0,t.useRef)(null),F=Ws();return(0,t.useEffect)((()=>{A.current&&void 0!==l&&F.addEventListener(A.current,"reset",(()=>{j(l)}))}),[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:iu.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:i,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:l,disabled:i=!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]),l=(0,t.useCallback)((e=>Boolean(r&e)),[r]),i=(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:l,removeFlag:i,toggleFlag:c}}(1),v=Ds({value:l,disabled:i}),w=om("RadioGroup.Option"),b=lm("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(l)&&(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||i,O=w.compare(w.value,l),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},L=(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:L,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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(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)),l=a[0],i=a[1],c=pm((0,e.useState)(r.loyalty.redemptionMethod),2),s=c[0],u=c[1];return(0,e.useEffect)((function(){i(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(Lu,{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(Lu,{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:l,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(tl,{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(tl,{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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==xm(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.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 l(e){Om(a,n,o,l,i,"next",e)}function i(e){Om(a,n,o,l,i,"throw",e)}l(void 0)}))}}function Lm(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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Cm(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)?Cm(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 Cm(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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==_m(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.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 l(e){Im(a,n,o,l,i,"next",e)}function i(e){Im(a,n,o,l,i,"throw",e)}l(void 0)}))}}function Fm(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 Tm(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Fm(Object(r),!0).forEach((function(t){Mm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Fm(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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(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);const Vm=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 4.5v15m7.5-7.5h-15"}))})),Wm=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.568 3H5.25A2.25 2.25 0 0 0 3 5.25v4.318c0 .597.237 1.17.659 1.591l9.581 9.581c.699.699 1.78.872 2.607.33a18.095 18.095 0 0 0 5.223-5.223c.542-.827.369-1.908-.33-2.607L11.16 3.66A2.25 2.25 0 0 0 9.568 3Z"}),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 6h.008v.008H6V6Z"}))})),zm=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 14.25 6-6m4.5-3.493V21.75l-3.75-1.5-3.75 1.5-3.75-1.5-3.75 1.5V4.757c0-1.108.806-2.057 1.907-2.185a48.507 48.507 0 0 1 11.186 0c1.1.128 1.907 1.077 1.907 2.185ZM9.75 9h.008v.008H9.75V9Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm4.125 4.5h.008v.008h-.008V13.5Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z"}))})),Bm=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.5 6v.75m0 3v.75m0 3v.75m0 3V18m-9-5.25h5.25M7.5 15h3M3.375 5.25c-.621 0-1.125.504-1.125 1.125v3.026a2.999 2.999 0 0 1 0 5.198v3.026c0 .621.504 1.125 1.125 1.125h17.25c.621 0 1.125-.504 1.125-1.125v-3.026a2.999 2.999 0 0 1 0-5.198V6.375c0-.621-.504-1.125-1.125-1.125H3.375Z"}))}));var Um=[{path:"/",element:function(){return ir(),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(Tt,null)),wp.element.createElement("div",null,wp.element.createElement(ar,null)))}},{path:"/inventory",element:function(){ir();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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return zi(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)?zi(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 l(e){Wi(a,n,o,l,i,"next",e)}function i(e){Wi(a,n,o,l,i,"throw",e)}l(void 0)}))}}(Vi().mark((function e(){var t;return Vi().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(ji,{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(){ir();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 ir(),wp.element.createElement(us,null)}},{path:"/settings/general",element:us},{path:"/settings/payments",element:function(){ir();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],l=o[1],i=Dm((0,e.useState)(!0),2),c=i[0],s=i[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),T.error("Failed to update settings: ".concat(e.message))}))}),[]);var u=function(e){var t="yes"===r[e]?"no":"yes";n((function(r){return Tm(Tm({},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 l((function(e){return Tm(Tm({},e),{},Mm({},n,!0))})),e.next=3,p(t,r[t]);case 3:l((function(e){return Tm(Tm({},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,T.success("Settings updated successfully!"),e.abrupt("return",n);case 8:e.prev=8,e.t0=e.catch(0),T.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(Lu,{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(Tm(Tm({},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(Tm(Tm({},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(Tm(Tm({},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(Tm(Tm({},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 Tm(Tm({},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(Lu,{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(Lu,{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(){ir();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(Cu,{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(){ir();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(){ir();var t=Dr(),r=t.settings,n=t.updateSettings,o=t.settingsLoading,a=Lm((0,e.useState)([]),2),l=a[0],i=a[1],c=Lm((0,e.useState)(!0),2),s=c[0],u=c[1],m=Lm((0,e.useState)(),2),p=m[0],f=m[1],d=Lm((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),T({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){i(e),u(!1)})).catch((function(e){T({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(Lu,{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(Lu,{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(Lu,{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(Lu,{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(Lu,{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"),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: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(){ir();var t=Dr(),r=t.settings,n=t.updateSettings,o=wm((0,e.useState)(!1),2),a=o[0],l=(o[1],wm((0,e.useState)(""),2)),i=l[0],c=(l[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")),i&&wp.element.createElement("p",{className:"text-sm text-red-500 mt-2"},i),s&&!a&&wp.element.createElement(vm,{program:s}))))}},{path:"/settings/modifiers",element:function(){return ir(),wp.element.createElement(rs,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"},"Product Modifiers",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"},"Sync product modifiers between Square and WooCommerce. This feature allows you to manage product variations, add-ons, and customization options across both platforms seamlessly. Perfect for businesses offering customizable products like coffee with different sizes, pizza with toppings, or t-shirts with custom text."),wp.element.createElement("div",{className:"space-y-4"},wp.element.createElement("div",null,wp.element.createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},"Enable Modifier Sync"),wp.element.createElement(Lu,{checked:!1,className:"bg-gray-200 relative inline-flex h-6 w-11 items-center rounded-full",disabled:!0},wp.element.createElement("span",{className:"sr-only"},"Enable modifier sync"),wp.element.createElement("span",{className:"translate-x-1 inline-block h-4 w-4 transform rounded-full bg-white transition"}))),wp.element.createElement("div",null,wp.element.createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},"Auto-create Missing Modifiers"),wp.element.createElement(Lu,{checked:!1,className:"bg-gray-200 relative inline-flex h-6 w-11 items-center rounded-full",disabled:!0},wp.element.createElement("span",{className:"sr-only"},"Auto-create missing modifiers"),wp.element.createElement("span",{className:"translate-x-1 inline-block h-4 w-4 transform rounded-full bg-white transition"}))),wp.element.createElement("div",{className:"mt-6 p-4 bg-gray-50 rounded-lg"},wp.element.createElement("p",{className:"text-sm text-gray-600"},wp.element.createElement("strong",null,"Pro Feature:")," Upgrade to Square Sync Pro to unlock modifier syncing and take your product customization to the next level."),wp.element.createElement("a",{href:"https://squaresyncforwoo.com",target:"_blank",className:"mt-3 inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-sky-600 hover:bg-sky-700"},"Upgrade to Pro"))))))}},{path:"/settings/metafield-mapping",element:function(){return ir(),wp.element.createElement(rs,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"},"Metafield Mapping",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"},"Map custom fields between Square and WooCommerce to sync additional product data. This powerful feature lets you transfer custom attributes, metadata, and specialized fields between platforms, ensuring all your product information stays synchronized."),wp.element.createElement("div",{className:"space-y-4"},wp.element.createElement("div",null,wp.element.createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},"Enable Metafield Sync"),wp.element.createElement(Lu,{checked:!1,className:"bg-gray-200 relative inline-flex h-6 w-11 items-center rounded-full",disabled:!0},wp.element.createElement("span",{className:"sr-only"},"Enable metafield sync"),wp.element.createElement("span",{className:"translate-x-1 inline-block h-4 w-4 transform rounded-full bg-white transition"}))),wp.element.createElement("div",{className:"mt-6"},wp.element.createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},"Field Mappings"),wp.element.createElement("div",{className:"bg-white shadow overflow-hidden sm:rounded-md opacity-50"},wp.element.createElement("ul",{className:"divide-y divide-gray-200"},[{id:1,squareField:"item.custom_attribute_values",wooField:"meta_data.brand"},{id:2,squareField:"item.description_html",wooField:"short_description"},{id:3,squareField:"item.category_id",wooField:"categories"}].map((function(e){return wp.element.createElement("li",{key:e.id,className:"px-4 py-3"},wp.element.createElement("div",{className:"flex items-center justify-between"},wp.element.createElement("div",{className:"flex-1 grid grid-cols-2 gap-4"},wp.element.createElement("div",null,wp.element.createElement("label",{className:"block text-xs font-medium text-gray-500"},"Square Field"),wp.element.createElement("input",{type:"text",value:e.squareField,disabled:!0,className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm text-sm"})),wp.element.createElement("div",null,wp.element.createElement("label",{className:"block text-xs font-medium text-gray-500"},"WooCommerce Field"),wp.element.createElement("input",{type:"text",value:e.wooField,disabled:!0,className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm text-sm"}))),wp.element.createElement("button",{type:"button",disabled:!0,className:"ml-4 text-gray-400"},wp.element.createElement(gr,{className:"h-5 w-5"}))))})))),wp.element.createElement("button",{type:"button",disabled:!0,className:"mt-3 inline-flex items-center px-3 py-2 border border-gray-300 shadow-sm text-sm leading-4 font-medium rounded-md text-gray-400 bg-gray-100"},wp.element.createElement(Vm,{className:"h-4 w-4 mr-1"}),"Add Mapping")),wp.element.createElement("div",{className:"mt-6 p-4 bg-gray-50 rounded-lg"},wp.element.createElement("p",{className:"text-sm text-gray-600"},wp.element.createElement("strong",null,"Pro Feature:")," Upgrade to Square Sync Pro to unlock metafield mapping and sync all your custom product data seamlessly."),wp.element.createElement("a",{href:"https://squaresyncforwoo.com",target:"_blank",className:"mt-3 inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-sky-600 hover:bg-sky-700"},"Upgrade to Pro"))))))}},{path:"/settings/discounts",element:function(){return ir(),wp.element.createElement(rs,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"},"Discounts & Coupons",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"},"Synchronize discounts, coupons, and promotional codes between Square and WooCommerce. Keep your pricing strategies consistent across all sales channels and manage special offers from a single location."),wp.element.createElement("div",{className:"space-y-6"},wp.element.createElement("div",null,wp.element.createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},"Enable Discount Sync"),wp.element.createElement(Lu,{checked:!1,className:"bg-gray-200 relative inline-flex h-6 w-11 items-center rounded-full",disabled:!0},wp.element.createElement("span",{className:"sr-only"},"Enable discount sync"),wp.element.createElement("span",{className:"translate-x-1 inline-block h-4 w-4 transform rounded-full bg-white transition"}))),wp.element.createElement("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3"},wp.element.createElement("div",{className:"relative rounded-lg border border-gray-300 bg-white px-6 py-5 shadow-sm opacity-50"},wp.element.createElement("div",{className:"flex items-center space-x-3"},wp.element.createElement("div",{className:"flex-shrink-0"},wp.element.createElement(Wm,{className:"h-6 w-6 text-gray-400"})),wp.element.createElement("div",{className:"min-w-0 flex-1"},wp.element.createElement("p",{className:"text-sm font-medium text-gray-900"},"Fixed Amount"),wp.element.createElement("p",{className:"text-sm text-gray-500"},"$5, $10 off")))),wp.element.createElement("div",{className:"relative rounded-lg border border-gray-300 bg-white px-6 py-5 shadow-sm opacity-50"},wp.element.createElement("div",{className:"flex items-center space-x-3"},wp.element.createElement("div",{className:"flex-shrink-0"},wp.element.createElement(zm,{className:"h-6 w-6 text-gray-400"})),wp.element.createElement("div",{className:"min-w-0 flex-1"},wp.element.createElement("p",{className:"text-sm font-medium text-gray-900"},"Percentage"),wp.element.createElement("p",{className:"text-sm text-gray-500"},"10%, 25% off")))),wp.element.createElement("div",{className:"relative rounded-lg border border-gray-300 bg-white px-6 py-5 shadow-sm opacity-50"},wp.element.createElement("div",{className:"flex items-center space-x-3"},wp.element.createElement("div",{className:"flex-shrink-0"},wp.element.createElement(Bm,{className:"h-6 w-6 text-gray-400"})),wp.element.createElement("div",{className:"min-w-0 flex-1"},wp.element.createElement("p",{className:"text-sm font-medium text-gray-900"},"BOGO Deals"),wp.element.createElement("p",{className:"text-sm text-gray-500"},"Buy one get one"))))),wp.element.createElement("div",{className:"space-y-3"},wp.element.createElement("h4",{className:"text-sm font-medium text-gray-900"},"Sync Options"),wp.element.createElement("div",{className:"space-y-2"},wp.element.createElement("label",{className:"flex items-center"},wp.element.createElement("input",{type:"checkbox",disabled:!0,className:"h-4 w-4 rounded border-gray-300 text-sky-600"}),wp.element.createElement("span",{className:"ml-2 text-sm text-gray-600"},"Auto-sync new discounts")),wp.element.createElement("label",{className:"flex items-center"},wp.element.createElement("input",{type:"checkbox",disabled:!0,className:"h-4 w-4 rounded border-gray-300 text-sky-600"}),wp.element.createElement("span",{className:"ml-2 text-sm text-gray-600"},"Sync discount schedules")),wp.element.createElement("label",{className:"flex items-center"},wp.element.createElement("input",{type:"checkbox",disabled:!0,className:"h-4 w-4 rounded border-gray-300 text-sky-600"}),wp.element.createElement("span",{className:"ml-2 text-sm text-gray-600"},"Sync usage limits")))),wp.element.createElement("div",{className:"mt-6 p-4 bg-gray-50 rounded-lg"},wp.element.createElement("p",{className:"text-sm text-gray-600"},wp.element.createElement("strong",null,"Pro Feature:")," Upgrade to Square Sync Pro to unlock discount syncing and streamline your promotional campaigns across all channels."),wp.element.createElement("a",{href:"https://squaresyncforwoo.com",target:"_blank",className:"mt-3 inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-sky-600 hover:bg-sky-700"},"Upgrade to Pro"))))))}}];const Hm=Um;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 Zm(){Zm=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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==$m(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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 Ym(e,t,r,n,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.done?t(c):Promise.resolve(c).then(n,o)}function Km(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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Xm(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)?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 r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var Jm=(0,e.createContext)(),Qm=function(t){var r=t.children,n=Dr().settings,o=jc().isAuthenticated,a=Km((0,e.useState)({groups:[],segments:[]}),2),l=a[0],i=a[1],c=Km((0,e.useState)(!1),2),s=c[0],u=c[1],m=Km((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 l(e){Ym(a,n,o,l,i,"next",e)}function i(e){Ym(a,n,o,l,i,"throw",e)}l(void 0)}))}}(Zm().mark((function e(){var t;return Zm().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,i(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(Jm.Provider,{value:{groupsSegments:l,loading:s,error:p}},r)};const ep=function(e){var t=e.children;return wp.element.createElement(gl,null,wp.element.createElement(Mr,null,wp.element.createElement(Fc,null,wp.element.createElement(Qm,null,wp.element.createElement(Or,null,t)))))};function tp(e){return tp="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},tp(e)}function rp(){rp=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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==tp(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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(tp(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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 np(e,t,r,n,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.done?t(c):Promise.resolve(c).then(n,o)}function op(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function l(e){np(a,n,o,l,i,"next",e)}function i(e){np(a,n,o,l,i,"throw",e)}l(void 0)}))}}function ap(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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return lp(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)?lp(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 lp(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(t){var r=t.open,n=t.onOpenChange,o=t.mode,a=void 0===o?"loading":o,l=Tc(),i=l.locations,c=l.refetchLocations,s=Dr(),u=s.updateSettings,m=s.settings,p=s.settingsLoading,f=(0,e.useRef)(!1),d=ap((0,e.useState)(!1),2),h=d[0],g=d[1],y=ap((0,e.useState)(void 0),2),v=y[0],w=y[1],b=ap((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)(op(rp().mark((function e(){var t,r,n;return rp().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||i.length||(f.current=!0,E(!0),c().finally((function(){return E(!1)})))}),[a,i.length,c]);var N=function(){var e=op(rp().mark((function e(t){var r;return rp().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=T.loading("Saving location…"),e.prev=1,e.next=4,u("location",t);case 4:T.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),T.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"),i.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 cp(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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return sp(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)?sp(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 sp(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 up(e){var r=e.children,n=jc(),o=n.loading,a=n.isAuthenticated,l=n.justConnected,i=n.autoPrompt,c=cp((0,t.useState)(!1),2),s=c[0],u=c[1],m=cp((0,t.useState)("loading"),2),p=m[0],f=m[1];return(0,t.useEffect)((function(){if(o)return f("loading"),void u(!0);l?(f("success"),u(!0)):!a&&i?(f("connect"),u(!0)):u(!1)}),[o,a,i,l]),wp.element.createElement(React.Fragment,null,r,wp.element.createElement(ip,{open:s,onOpenChange:u,mode:p}))}const mp=o.p+"images/logo.4a5282be.png";function pp(e){var t=e.to,r=e.children;return wp.element.createElement(Lt,{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 fp=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:mp,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(pp,{to:"/"},"Dashboard")),wp.element.createElement("li",{className:"".concat(r," pl-4")},wp.element.createElement(pp,{to:"/inventory"},"Products")),wp.element.createElement("li",{className:"".concat(r," pl-4")},wp.element.createElement(pp,{to:"/customers"},"Customers")),wp.element.createElement("li",{className:"".concat(r," pl-4")},wp.element.createElement(pp,{to:"/loyalty"},"Loyalty")),wp.element.createElement("li",{className:"".concat(r," pl-4")},wp.element.createElement(pp,{to:"/orders"},"Orders")),wp.element.createElement("li",{className:"".concat(r," pl-4")},wp.element.createElement(pp,{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 dp="persist:",hp="persist/FLUSH",gp="persist/REHYDRATE",yp="persist/PAUSE",vp="persist/PERSIST",bp="persist/PURGE",xp="persist/REGISTER";function Ep(e){return Ep="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},Ep(e)}function Sp(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 kp(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Np(e){return JSON.stringify(e)}function Op(e){return JSON.parse(e)}function jp(e){}function Lp(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 Cp(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Lp(r,!0).forEach((function(t){Pp(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Lp(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}function _p(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 Rp(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 Ip(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Rp(r,!0).forEach((function(t){Ap(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Rp(r).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Ap(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Fp={registry:[],bootstrapped:!1},Tp=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Fp,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case xp:return Ip({},e,{registry:[].concat(_p(e.registry),[t.key])});case gp:var r=e.registry.indexOf(t.key),n=_p(e.registry);return n.splice(r,1),Ip({},e,{registry:n,bootstrapped:0===n.length});default:return e}},Mp=o(181);function Dp(e){return Dp="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},Dp(e)}function Gp(){Gp=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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Dp(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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(Dp(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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 qp(e,t,r,n,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.done?t(c):Promise.resolve(c).then(n,o)}function Vp(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function l(e){qp(a,n,o,l,i,"next",e)}function i(e){qp(a,n,o,l,i,"throw",e)}l(void 0)}))}}function Wp(){return zp.apply(this,arguments)}function zp(){return(zp=Vp(Gp().mark((function e(){var t;return Gp().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 Bp=function(){var e=Vp(Gp().mark((function e(){var t,r;return Gp().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("Fetching Customer Groups and Roles"),t=T.loading("Retrieving Customer Groups and Roles"),e.prev=2,e.next=5,Wp();case 5:return r=e.sent,T.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),T.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)}}(),Up=function(){var e=Vp(Gp().mark((function e(t){var r,n;return Gp().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("Saving Role Mappings"),r=T.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 T.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),T.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)}}(),Hp=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=Vp(Gp().mark((function a(l){var i,c;return Gp().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if(a.prev=0,i=null,e)try{localStorage.removeItem("customersData")}catch(e){console.warn("Failed to remove data from local storage:",e)}else{try{i=localStorage.getItem("customersData")}catch(e){console.warn("Failed to retrieve data from local storage:",e)}i&&setTimeout((function(){var e=JSON.parse(i);return r({status:"success",data:e})}),100)}return a.next=5,zt({path:"/sws/v1/customers".concat(l&&e?"?force=true":"")});case 5:if(c=a.sent,console.log(c),c.loading)l&&T.info("Fetching data, please wait...",{autoClose:2e3,hideProgressBar:!1,closeOnClick:!1}),setTimeout((function(){return o(!1)}),t);else if(0===c.data.length)T.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)}T.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),T.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 $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 Zp(){Zp=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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==$p(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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($p(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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 Yp(e,t,r,n,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.done?t(c):Promise.resolve(c).then(n,o)}function Kp(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function l(e){Yp(a,n,o,l,i,"next",e)}function i(e){Yp(a,n,o,l,i,"throw",e)}l(void 0)}))}}var Xp=No("customerGroupsAndRoles/fetchIfNeeded",Kp(Zp().mark((function e(){var t,r,n,o,a,l,i,c,s=arguments;return Zp().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(),l=a.customerGroupsAndRoles,i=0,c=function(){var e=Kp(Zp().mark((function e(){var r;return Zp().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!t&&(l.data.groups.length||l.data.roles.length)){e.next=12;break}return e.next=4,Bp();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",l.data);case 13:e.next=27;break;case 15:if(e.prev=15,e.t0=e.catch(0),!(i<1)){e.next=25;break}return i++,console.warn("Retrying fetch groups and roles (".concat(i,"/").concat(1,")...")),e.next=22,c();case 22:return e.abrupt("return",e.sent);case 25:return console.error("Max retries reached. Unable to fetch groups and roles."),e.abrupt("return",o(e.t0.message));case 27:case"end":return e.stop()}}),e,null,[[0,15]])})));return function(){return e.apply(this,arguments)}}(),e.next=8,c();case 8:return e.abrupt("return",e.sent);case 9:case"end":return e.stop()}}),e)})))),Jp=No("customerGroupsAndRoles/saveMappings",function(){var e=Kp(Zp().mark((function e(t,r){var n,o,a,l;return Zp().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,Up(t);case 8:if("success"!==(l=e.sent).status){e.next=13;break}return e.abrupt("return",{roleMappings:l.roleMappings});case 13:throw new Error(l.error);case 14:e.next=19;break;case 16:return e.prev=16,e.t0=e.catch(1),e.abrupt("return",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 Qp=bo({name:"customerGroupsAndRoles",initialState:{data:{groups:[],roles:{},roleMappings:{}},loading:!1,error:null},reducers:{},extraReducers:function(e){e.addCase(Xp.pending,(function(e){e.loading=!0})).addCase(Xp.fulfilled,(function(e,t){e.loading=!1,e.data=t.payload,e.error=null})).addCase(Xp.rejected,(function(e,t){e.loading=!1,e.data={groups:[],roles:{},roleMappings:{}},e.error=t.payload})).addCase(Jp.pending,(function(e){e.loading=!0})).addCase(Jp.fulfilled,(function(e,t){e.loading=!1,e.data.roleMappings=t.payload.roleMappings,e.error=null})).addCase(Jp.rejected,(function(e,t){e.loading=!1,e.error=t.payload}))}}).reducer;function ef(e){return ef="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},ef(e)}function tf(){tf=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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==ef(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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(ef(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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 rf(e,t,r,n,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.done?t(c):Promise.resolve(c).then(n,o)}function nf(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function l(e){rf(a,n,o,l,i,"next",e)}function i(e){rf(a,n,o,l,i,"throw",e)}l(void 0)}))}}var of,af,lf,cf,sf,uf,mf,pf,ff,df,hf=No("customers/fetchIfNeeded",nf(tf().mark((function e(){var t,r,n,o,a,l,i,c,s=arguments;return tf().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(),l=a.customers,!t&&null!==l.data){e.next=24;break}return e.prev=4,e.next=7,Hp(t);case 7:if("success"!==(i=e.sent).status){e.next=12;break}return e.abrupt("return",i.data);case 12:if("loading"!==i.status){e.next=16;break}return e.abrupt("return",o("Data is being fetched, please wait..."));case 16:throw new Error(i.error);case 17:e.next=22;break;case 19:return e.prev=19,e.t0=e.catch(4),e.abrupt("return",o(e.t0.message));case 22:e.next=44;break;case 24:if(!l.loading){e.next=43;break}return e.prev=25,e.next=28,Hp(!1);case 28:if("success"!==(c=e.sent).status){e.next=33;break}return e.abrupt("return",c.data);case 33:if("loading"!==c.status){e.next=37;break}return e.abrupt("return",o("Data is being fetched, please wait..."));case 37:throw new Error(c.error);case 38:e.next=43;break;case 40:return e.prev=40,e.t1=e.catch(25),e.abrupt("return",o(e.t1.message));case 43:return e.abrupt("return",l.data);case 44:case"end":return e.stop()}}),e,null,[[4,19],[25,40]])})))),gf=Yn({inventory:Gi,licence:Ao,orders:oc,customerGroupsAndRoles:Qp,customers:bo({name:"customers",initialState:{data:null,loading:!1,error:null,fetchAttempted:!1},reducers:{},extraReducers:function(e){e.addCase(hf.pending,(function(e){e.loading=!0,e.fetchAttempted=!0})).addCase(hf.fulfilled,(function(e,t){e.loading=!1,e.data=t.payload,e.error=null})).addCase(hf.rejected,(function(e,t){e.loading=!1,e.data=[],e.error=t.payload}))}}).reducer}),yf={key:"root",storage:Mp.A,whitelist:["inventory","customerGroupsAndRoles","customers"]},vf=(af=gf,lf=void 0!==(of=yf).version?of.version:-1,cf=void 0===of.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?Sp(r,!0).forEach((function(t){kp(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Sp(r).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},r);return e&&"object"===Ep(e)&&Object.keys(e).forEach((function(n){"_persist"!==n&&t[n]===r[n]&&(o[n]=e[n])})),o}:of.stateReconciler,sf=of.getStoredState||function(e){var t,r=e.transforms||[],n="".concat(void 0!==e.keyPrefix?e.keyPrefix:dp).concat(e.key),o=e.storage;return e.debug,t=!1===e.deserialize?function(e){return e}:"function"==typeof e.deserialize?e.deserialize:Op,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}}))},uf=void 0!==of.timeout?of.timeout:5e3,mf=null,pf=!1,ff=!0,df=function(e){return e._persist.rehydrated&&mf&&!ff&&mf.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===vp){var a=!1,l=function(e,r){a||(t.rehydrate(of.key,e,r),a=!0)};if(uf&&setTimeout((function(){!a&&l(void 0,new Error('redux-persist: persist timed out for persist key "'.concat(of.key,'"')))}),uf),ff=!1,mf||(mf=function(e){var t,r=e.blacklist||null,n=e.whitelist||null,o=e.transforms||[],a=e.throttle||0,l="".concat(void 0!==e.keyPrefix?e.keyPrefix:dp).concat(e.key),i=e.storage;t=!1===e.serialize?function(e){return e}:"function"==typeof e.serialize?e.serialize:Np;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=i.setItem(l,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()}}}(of)),n)return Cp({},af(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(of.key),sf(of).then((function(e){var t=of.migrate||function(e,t){return Promise.resolve(e)};t(e,lf).then((function(e){l(e)}),(function(e){l(void 0,e)}))}),(function(e){l(void 0,e)})),Cp({},af(o,t),{_persist:{version:lf,rehydrated:!1}})}if(t.type===bp)return pf=!0,t.result(function(e){var t=e.storage,r="".concat(void 0!==e.keyPrefix?e.keyPrefix:dp).concat(e.key);return t.removeItem(r,jp)}(of)),Cp({},af(o,t),{_persist:n});if(t.type===hp)return t.result(mf&&mf.flush()),Cp({},af(o,t),{_persist:n});if(t.type===yp)ff=!0;else if(t.type===gp){if(pf)return Cp({},o,{_persist:Cp({},n,{rehydrated:!0})});if(t.key===of.key){var i=af(o,t),c=t.payload,s=Cp({},!1!==cf&&void 0!==c?cf(c,e,i,of):i,{_persist:Cp({},n,{rehydrated:!0})});return df(s)}}if(!n)return af(e,t);var u=af(o,t);return u===o?e:df(Cp({},u,{_persist:n}))}),wf=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,l=n.middleware,i=void 0===l?r():l,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=i;"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:vf,middleware:function(e){return e({serializableCheck:!1})}}),bf=function(e,t,r){var n=!1,o=Zn(Tp,Fp,void 0),a=function(e){o.dispatch({type:xp,key:e})},l=function(t,r,a){var l={type:gp,payload:r,err:a,key:t};e.dispatch(l),o.dispatch(l),n&&i.getState().bootstrapped&&(n(),n=!1)},i=Ip({},o,{purge:function(){var t=[];return e.dispatch({type:bp,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:yp})},persist:function(){e.dispatch({type:vp,register:a,rehydrate:l})}});return i.persist(),i}(wf),xf=document.getElementById("square-woo-sync");null!=xf&&(0,e.createRoot)(xf).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:l="once"}){const i=t.useMemo((()=>{const t=function(e,t){let r,n=J,o=0,a=!1;function l(){s.onStateChange&&s.onStateChange()}function i(){o++,r||(r=t?t.addNestedSub(l):e.subscribe(l),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){i();const t=n.subscribe(e);let r=!1;return()=>{r||(r=!0,t(),c())}},notifyNestedSubs:function(){n.notify()},handleChangeWrapper:l,isSubscribed:function(){return a},trySubscribe:function(){a||(a=!0,i())},tryUnsubscribe:function(){a&&(a=!1,c())},getListeners:()=>n};return s}(e);return{store:e,subscription:t,getServerState:o?()=>o:void 0,stabilityCheck:a,noopCheck:l}}),[e,o,a,l]),c=t.useMemo((()=>e.getState()),[e]);Q((()=>{const{subscription:t}=i;return t.onStateChange=t.notifyNestedSubs,t.trySubscribe(),c!==e.getState()&&t.notifyNestedSubs(),()=>{t.tryUnsubscribe(),t.onStateChange=void 0}}),[i,c]);const s=r||U;return t.createElement(s.Provider,{value:i},n)}),{store:wf},wp.element.createElement(fe,{loading:null,persistor:bf},wp.element.createElement((function(){return wp.element.createElement(kt,null,wp.element.createElement(fp,null,wp.element.createElement(ep,null,wp.element.createElement(up,null,wp.element.createElement(gt,null,Hm.map((function(e,t){return wp.element.createElement(dt,{key:t,path:e.path,element:wp.element.createElement(e.element,null)})})))))))}),null)))))})()})(); -
squarewoosync/tags/6.0.4/languages/square-woo-sync.pot
r3360322 r3360355 2 2 msgid "" 3 3 msgstr "" 4 "Project-Id-Version: Square Sync for Woo commerce 6.0.3\n"4 "Project-Id-Version: Square Sync for WooCommerce 6.0.4\n" 5 5 "Report-Msgid-Bugs-To: https://github.com/LiamHillier/square-woo-sync/issues\n" 6 6 "Last-Translator: liam@pixeldev.com.au\n" … … 9 9 "Content-Type: text/plain; charset=UTF-8\n" 10 10 "Content-Transfer-Encoding: 8bit\n" 11 "POT-Creation-Date: 2025-09-12T0 7:56:50+00:00\n"11 "POT-Creation-Date: 2025-09-12T08:46:59+00:00\n" 12 12 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 13 13 "X-Generator: WP-CLI 2.12.0\n" … … 15 15 16 16 #. Plugin Name of the plugin 17 msgid "Square Sync for Woo commerce"17 msgid "Square Sync for WooCommerce" 18 18 msgstr "" 19 19 -
squarewoosync/tags/6.0.4/readme.txt
r3360322 r3360355 4 4 Tags: square,product sync,woocommerce square,payments 5 5 Requires at least: 5.4 6 Tested up to: 6. 76 Tested up to: 6.8 7 7 Requires PHP: 7.4 8 Stable tag: 6.0. 38 Stable tag: 6.0.4 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 110 110 111 111 == Changelog == 112 = 6.0.4 = 113 * Added Pro feature previews for Modifiers, Metafield Mapping, and Discounts 114 * Enhanced settings UI with expandable Products menu 115 * Improved navigation structure for Pro features 116 112 117 = 6.0.3 = 113 118 * Update 0auth url -
squarewoosync/tags/6.0.4/squarewoosync.php
r3360322 r3360355 2 2 3 3 /** 4 * Plugin Name: Square Sync for Woo commerce4 * Plugin Name: Square Sync for WooCommerce 5 5 * Requires Plugins: woocommerce 6 6 * Plugin URI: https://squaresyncforwoo.com … … 12 12 * License URI: http://www.gnu.org/licenses/gpl-2.0.html 13 13 * Domain Path: /languages 14 * Version: 6.0. 314 * Version: 6.0.4 15 15 * Requires at least: 5.4 16 16 * Requires PHP: 7.4 … … 31 31 final class SquareWooSync 32 32 { 33 const VERSION = '6.0. 3';33 const VERSION = '6.0.4'; 34 34 const SLUG = 'squarewoosync'; 35 35 -
squarewoosync/tags/6.0.4/vendor/composer/installed.php
r3360322 r3360355 4 4 'pretty_version' => 'dev-main', 5 5 'version' => 'dev-main', 6 'reference' => ' cc9665fe33995df830e7294f2b243a257ea82faa',6 'reference' => '45e3bfbe55c4bfb796abc13b322146fb13f2dcef', 7 7 'type' => 'project', 8 8 'install_path' => __DIR__ . '/../../', … … 14 14 'pretty_version' => 'dev-main', 15 15 'version' => 'dev-main', 16 'reference' => ' cc9665fe33995df830e7294f2b243a257ea82faa',16 'reference' => '45e3bfbe55c4bfb796abc13b322146fb13f2dcef', 17 17 'type' => 'project', 18 18 'install_path' => __DIR__ . '/../../', -
squarewoosync/trunk/build/blocks/gateway.asset.php
r3360322 r3360355 1 <?php return array('dependencies' => array('wp-data', 'wp-element'), 'version' => ' fd90a8a6caa03a754e4e');1 <?php return array('dependencies' => array('wp-data', 'wp-element'), 'version' => 'a831b59204cd92f08125'); -
squarewoosync/trunk/build/blocks/gateway.js
r3360322 r3360355 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)})();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 N(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",v="suspendedYield",d="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(I([])));_&&_!==r&&i.call(_,u)&&(E=_);var S=x.prototype=w.prototype=Object.create(E);function C(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===d)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=d;var l=p(e,r,n);if("normal"===l.type){if(o=n.done?m:v,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 T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function I(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(S,"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(S),t},e.awrap=function(t){return{__await:t}},C(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()}))},C(S),f(S,s,"Generator"),f(S,u,(function(){return this})),f(S,"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=I,N.prototype={constructor:N,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(T),!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),T(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;T(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:I(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,v,d,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:v=t.sent,d=v.success,m=v.data,u.token=d?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 N(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",v="suspendedYield",d="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(I([])));_&&_!==r&&n.call(_,a)&&(E=_);var S=x.prototype=w.prototype=Object.create(E);function C(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===d)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=d;var l=p(e,r,n);if("normal"===l.type){if(o=n.done?m:v,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 T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function I(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(S,"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(S),t},e.awrap=function(t){return{__await:t}},C(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()}))},C(S),l(S,u,"Generator"),l(S,a,(function(){return this})),l(S,"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=I,N.prototype={constructor:N,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(T),!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),T(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;T(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:I(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 v(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 d(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 N(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",v="completed",d={};function m(){}function b(){}function x(){}var E={};l(E,a,(function(){return this}));var L=Object.getPrototypeOf,_=L&&L(L(I([])));_&&_!==r&&n.call(_,a)&&(E=_);var S=x.prototype=m.prototype=Object.create(E);function C(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===v){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===d)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=v,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?v:p,l.arg===d)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=v,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")),d;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,d;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,d):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}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 T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function I(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(S,"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(S),t},e.awrap=function(t){return{__await:t}},C(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()}))},C(S),l(S,u,"Generator"),l(S,a,(function(){return this})),l(S,"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=I,N.prototype={constructor:N,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(T),!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,d):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),d},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),T(r),d}},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;T(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:I(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),d}},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],v=r(),d=v.applicationId,m=v.locationId;return(0,t.useEffect)((function(){if(!s){var t=function(){if(window.Square&&d&&m)try{f(window.Square.payments(d,m))}catch(t){console.error("Failed to initialize Square payments:",t)}};if(t(),!window.Square){var e=0,r=setInterval((function(){e++,window.Square?(clearInterval(r),t()):e>=20&&(clearInterval(r),console.error("Square SDK failed to load after 10 seconds"))}),500);return function(){return clearInterval(r)}}}}),[d,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 S(){S=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 N(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",v="completed",d={};function m(){}function g(){}function w(){}var b={};l(b,a,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(I([])));E&&E!==r&&n.call(E,a)&&(b=E);var L=w.prototype=m.prototype=Object.create(b);function C(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===v){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===d)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=v,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?v:p,l.arg===d)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=v,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")),d;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,d;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,d):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}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 T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function I(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}},C(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()}))},C(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=I,N.prototype={constructor:N,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(T),!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,d):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),d},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),T(r),d}},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;T(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:I(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),d}},e}function C(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,r=(0,t.useRef)(!1);return(0,t.useEffect)((function(){if(e){var t=function(){var t,n=(t=S().mark((function t(){return S().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){C(i,n,o,a,c,"next",t)}function c(t){C(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=d((0,t.useState)(!1),2),a=i[0],c=i[1],u=d((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,v(v(v(v(v(v(v(v(v(v(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",""),v(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,T=(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 N={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(T,{RenderedComponent:O}),edit:wp.element.createElement(T,{RenderedComponent:O}),ariaLabel:"Square",canMakePayment:function(){return!(!r().applicationId||!r().locationId)},supports:{features:r().supports,showSaveOption:!r().hasSubscription}},I=window.wp.data;function A(t){return A="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},A(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:C(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",v="completed",d={};function m(){}function g(){}function w(){}var b={};l(b,a,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(T([])));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 S(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"==A(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 C(e,r,n){var o=h;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===v){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===d)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=v,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?v:p,l.arg===d)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=v,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")),d;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,d;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,d):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}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 T(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(A(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.prototype),l(S.prototype,c,(function(){return this})),e.AsyncIterator=S,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new S(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=T,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,d):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),d},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),d}},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:T(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),d}},e}function R(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 F(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){R(i,n,o,a,c,"next",t)}function c(t){R(i,n,o,a,c,"throw",t)}a(void 0)}))}}var H=function(t){return r().ajaxUrl.replace("%%endpoint%%","square_digital_wallet_".concat(t))},M=function(){var t=F(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)}}(),q=function(){var t=F(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,M(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)}}(),D=function(){var t=F(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,M(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=F(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 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 Y(){Y=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:C(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",v="completed",d={};function m(){}function g(){}function w(){}var b={};l(b,a,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(T([])));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 S(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 C(e,r,n){var o=h;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===v){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===d)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=v,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?v:p,l.arg===d)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=v,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")),d;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,d;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,d):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}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 T(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}},_(S.prototype),l(S.prototype,c,(function(){return this})),e.AsyncIterator=S,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new S(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=T,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,d):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),d},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),d}},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:T(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),d}},e}function U(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 z(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)?z(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 z(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 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 $(t){return 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)}))}}function J(t){return J="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},J(t)}function K(){K=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:C(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",v="completed",d={};function m(){}function g(){}function w(){}var b={};l(b,a,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(T([])));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 S(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"==J(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 C(e,r,n){var o=h;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===v){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===d)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=v,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?v:p,l.arg===d)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=v,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")),d;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,d;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,d):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}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 T(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(J(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.prototype),l(S.prototype,c,(function(){return this})),e.AsyncIterator=S,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new S(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=T,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,d):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),d},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),d}},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:T(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),d}},e}function W(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,e,r){return(e=function(t){var e=function(t,e){if("object"!=J(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=J(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==J(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}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 tt(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)?tt(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 tt(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 et=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"}))},rt=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 nt={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=X((0,t.useState)(!1),2),y=p[0],v=p[1],d=o.needsShipping;(0,t.useEffect)((function(){var t=(0,I.subscribe)((function(){wp.data.select("wc/store/cart").isApplyingCoupon()||v((function(t){return!t}))}));return function(){t()}}),[]);var m=function(){var e=U((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=U((0,t.useState)(null),2),c=a[0],u=a[1];return(0,t.useEffect)((function(){if(e){var t=function(){var t=$(Y().mark((function t(){var o,a,c,l,s;return Y().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,d,y),w=function(e,n){var o=U((0,t.useState)(null),2),i=o[0],a=o[1],c=(0,t.useRef)(null);return(0,t.useEffect)((function(){e&&n&&$(Y().mark((function t(){var o;return Y().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=X(w,2),x=b[0],E=b[1],L=function(e,n){var o=U((0,t.useState)(null),2),i=o[0],a=o[1],c=(0,t.useRef)(null);return(0,t.useEffect)((function(){e&&n&&$(Y().mark((function t(){var r;return Y().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),_=X(L,2),S=_[0],C=_[1],k=function(e,r){var n=U((0,t.useState)(null),2),o=n[0],i=n[1],a=(0,t.useRef)(null);return(0,t.useEffect)((function(){e&&r&&$(Y().mark((function t(){var n;return Y().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=X(k,2),j=O[0],P=O[1],T=X((0,t.useState)(!1),2),N=T[0],A=T[1],G=X((0,t.useState)(null),2),R=G[0],F=G[1];!function(e){(0,t.useEffect)((function(){null==e||e.addEventListener("shippingcontactchanged",(function(t){return D(t)})),null==e||e.addEventListener("afterpay_shippingaddresschanged",(function(t){return D(t)}))}),[e])}(g),function(e){(0,t.useEffect)((function(){null==e||e.addEventListener("shippingoptionchanged",(function(t){return q(t)})),null==e||e.addEventListener("afterpay_shippingoptionchanged",(function(t){return q(t)}))}),[e])}(g);var M=function(t){var e=t||N;if(!e||!e.token)return{type:l.responseTypes.ERROR,message:"Payment token is missing. Please try again."};var r=e.details,o=e.token,i=r||{},a=i.method,c=void 0===a?"":a,u=i.card,s=void 0===u?{}:u,f=i.billing,h=void 0===f?{}:f,p=i.shipping,y=(((void 0===p?{}:p)||{}).contact,{intent:"CHARGE",amount:(n.cartTotal.value/100).toString(),currencyCode:n.currency.code,billingContact:{familyName:h.familyName||n.billingData.last_name||"",givenName:h.givenName||n.billingData.first_name||"",email:h.email||n.billingData.email||"",country:h.countryCode||n.billingData.country||"",region:h.state||n.billingData.state||"",city:h.city||n.billingData.city||"",postalCode:h.postalCode||n.billingData.postcode||"",phone:h.phone||n.billingData.phone||"",addressLines:h.addressLines||[n.billingData.address_1,n.billingData.address_2].filter(Boolean)}});return m.verifyBuyer(o,y).then((function(t){var e,r,n="wc-squaresync_credit";return{type:l.responseTypes.SUCCESS,meta:{paymentMethodData:Q(Q(Q(Q(Q(Q(Q({},"".concat(n,"-card-type"),c||""),"".concat(n,"-last-four"),(null==s?void 0:s.last4)||""),"".concat(n,"-exp-month"),(null==s||null===(e=s.expMonth)||void 0===e?void 0:e.toString())||""),"".concat(n,"-exp-year"),(null==s||null===(r=s.expYear)||void 0===r?void 0:r.toString())||""),"".concat(n,"-payment-postcode"),(null==s?void 0:s.postalCode)||""),"".concat(n,"-payment-nonce"),o||""),"".concat(n,"-buyer-verification-token"),(null==t?void 0:t.token)||"")}}})).catch((function(t){return{type:l.responseTypes.ERROR,message:t.message||"Payment processing failed"}}))};(0,t.useEffect)((function(){return function(){R&&R()}}),[R]),(0,t.useEffect)((function(){return h((function(){return R&&(R(),F(null)),a(),!0}))}),[h,R]);var Z=r().googlePay.includes("no"),z=r().applePay.includes("no"),B=r().afterPay.includes("no");function J(t){var e;t&&(u(""),i(),(e=K().mark((function e(){var r,n,o,i,u,l,s,h;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,V(t);case 2:if(r=e.sent){e.next=7;break}a(),e.next=31;break;case 7:if(!r||!r.token){e.next=24;break}return i=(null==r||null===(n=r.details)||void 0===n?void 0:n.billing)||{},u=(null==r||null===(o=r.details)||void 0===o||null===(o=o.shipping)||void 0===o?void 0:o.contact)||{},l={email:i.email||"",first_name:i.givenName||"",last_name:i.familyName||"",company:"",address_1:i.addressLines&&i.addressLines[0]||"",address_2:i.addressLines&&i.addressLines[1]||"",city:i.city||"",state:i.state||"",postcode:i.postalCode||"",country:i.countryCode||"",phone:i.phone||""},s={first_name:u.givenName||i.givenName||"",last_name:u.familyName||i.familyName||"",company:"",address_1:u.addressLines&&u.addressLines[0]||i.addressLines&&i.addressLines[0]||"",address_2:u.addressLines&&u.addressLines[1]||i.addressLines&&i.addressLines[1]||"",city:u.city||i.city||"",state:u.state||i.state||"",postcode:u.postalCode||i.postalCode||"",country:u.countryCode||i.countryCode||"",phone:u.phone||i.phone||""},e.prev=12,e.next=15,wp.data.dispatch("wc/store/cart").setBillingAddress(l);case 15:if(!d){e.next=18;break}return e.next=18,wp.data.dispatch("wc/store/cart").setShippingAddress(s);case 18:return e.next=20,new Promise((function(t){return setTimeout(t,100)}));case 20:e.next=24;break;case 22:e.prev=22,e.t0=e.catch(12);case 24:return A(r),R&&R(),h=f((function(){return M(r)})),F((function(){return h})),e.next=30,new Promise((function(t){return setTimeout(t,50)}));case 30:c();case 31:case"end":return e.stop()}}),e,null,[[12,22]])})),function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(t){W(i,n,o,a,c,"next",t)}function c(t){W(i,n,o,a,c,"throw",t)}a(void 0)}))})())}var tt=!Z&&wp.element.createElement("div",{tabIndex:0,role:"button",ref:E,onClick:function(){return J(x)}}),et=!B&&wp.element.createElement("div",{tabIndex:0,role:"button",ref:P,onClick:function(){return J(j)}}),rt=!z&&wp.element.createElement("div",{tabIndex:0,role:"button",ref:C,onClick:function(){return J(S)},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,rt,tt,et)}),null),edit:wp.element.createElement((function(){return wp.element.createElement(React.Fragment,null,wp.element.createElement(et,null),wp.element.createElement(rt,null))}),null),canMakePayment:function(){var t=!(!r().applicationId||!r().locationId),e=r().isDigitalWalletsEnabled;return t&&e},supports:{features:r().supports}};function ot(t){return ot="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},ot(t)}function it(){it=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:C(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",v="completed",d={};function m(){}function g(){}function w(){}var b={};l(b,a,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(T([])));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 S(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"==ot(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 C(e,r,n){var o=h;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===v){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===d)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=v,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?v:p,l.arg===d)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=v,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")),d;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,d;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,d):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}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 T(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(ot(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.prototype),l(S.prototype,c,(function(){return this})),e.AsyncIterator=S,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new S(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=T,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,d):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),d},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),d}},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:T(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),d}},e}function at(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 ct(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){at(i,n,o,a,c,"next",t)}function c(t){at(i,n,o,a,c,"throw",t)}a(void 0)}))}}var ut=function(){var t=ct(it().mark((function t(e,r,n){var o;return it().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)}}(),lt=function(){var t=ct(it().mark((function t(e){var r;return it().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 st(t){return st="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},st(t)}function ft(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=mt(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 ht(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=st(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=st(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==st(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function pt(){pt=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:C(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",v="completed",d={};function m(){}function g(){}function w(){}var b={};l(b,a,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(T([])));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 S(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"==st(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 C(e,r,n){var o=h;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===v){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===d)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=v,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?v:p,l.arg===d)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=v,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")),d;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,d;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,d):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}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 T(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(st(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.prototype),l(S.prototype,c,(function(){return this})),e.AsyncIterator=S,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new S(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=T,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,d):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),d},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),d}},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:T(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),d}},e}function yt(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 vt(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){yt(i,n,o,a,c,"next",t)}function c(t){yt(i,n,o,a,c,"throw",t)}a(void 0)}))}}function dt(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)||mt(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 mt(t,e){if(t){if("string"==typeof t)return gt(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)?gt(t,e):void 0}}function gt(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 wt(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 bt(){return xt.apply(this,arguments)}function xt(){return(xt=vt(pt().mark((function t(){var e,r,n,o,i,a,c,u,l,s,f,h,p,y,v,d,m,g,w;return pt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((n=(0,I.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,I.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=ft(o.shipping_rates),t.prev=11,l.s();case 13:if((s=l.n()).done){t.next=25;break}return v=s.value,(0,I.dispatch)("wc/store/cart").selectShippingRate(v.rate_id,0),t.next=18,new Promise((function(t){return setTimeout(t,300)}));case 18:d=(0,I.select)("wc/store/cart").getCartTotals()||{},m=wt(null!==(f=d.total_price)&&void 0!==f?f:"0",a),g=wt(null!==(h=d.total_tax)&&void 0!==h?h:"0",a),w=wt(null!==(p=v.price)&&void 0!==p?p:"0",a),u.push({id:v.rate_id,label:v.name,amount:w,taxLineItems:[{id:"taxItem1",label:"Taxes",amount:g}],total:{label:null!==(y=d.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,I.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 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 Lt(){Lt=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:C(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",v="completed",d={};function m(){}function g(){}function w(){}var b={};l(b,a,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(T([])));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 S(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 C(e,r,n){var o=h;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===v){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===d)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=v,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?v:p,l.arg===d)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=v,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")),d;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,d;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,d):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}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 T(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}},_(S.prototype),l(S.prototype,c,(function(){return this})),e.AsyncIterator=S,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new S(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=T,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,d):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),d},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),d}},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:T(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),d}},e}function _t(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 St(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 Ct(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)?Ct(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 Ct(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=St((0,t.useState)(!1),2),y=p[0],v=p[1],d=i.needsShipping;(0,t.useEffect)((function(){var t=(0,I.subscribe)((function(){wp.data.select("wc/store/cart").isApplyingCoupon()||v((function(t){return!t}))}));return function(){t()}}),[]);var m,g=function(){var e=dt((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=dt((0,t.useState)(null),2),c=a[0],u=a[1];return(0,t.useEffect)((function(){function t(){return(t=vt(pt().mark((function t(){var o,a,c,l,s;return pt().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,d,y),b=St(w,1)[0],x=function(e,r){var n=dt((0,t.useState)(null),2),o=n[0],i=n[1],a=(0,t.useRef)(null);return(0,t.useEffect)((function(){e&&r?vt(pt().mark((function t(){var n;return pt().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=St(x,2),L=E[0],_=E[1],S=St((0,t.useState)(!1),2),C=S[0],k=S[1];return m=b,(0,t.useRef)(!1),(0,t.useEffect)((function(){if(m&&"function"==typeof m.addEventListener){var t=function(){var t=vt(pt().mark((function t(e){var r,n,o;return pt().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,bt();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=vt(pt().mark((function t(){var r,i,c,u,l,s,f,h,p,y,v,d,m,g,w,b,x,E,L,_,S,C,k,O,j,P,T,N,I,A,G,R,F,H,M,q,D,V,Z,Y;return pt().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,T=j.method,N=n.token,t.next=9,ut(e,N,a);case 9:if(I=t.sent,console.log(I),A=I.token,G="wc-squaresync_credit",R=(null==n||null===(r=n.details)||void 0===r?void 0:r.billing)||{},F=(null==n||null===(i=n.details)||void 0===i?void 0:i.shipping)||{},H=F.contact,M=void 0===H?{}:H,q=F.option,D=void 0===q?{}:q,V=null!==(c=null!==(u=null==R?void 0:R.email)&&void 0!==u?u:null==M?void 0:M.email)&&void 0!==c?c:"",Z=null!==(l=null!==(s=null==R?void 0:R.phone)&&void 0!==s?s:null==M?void 0:M.phone)&&void 0!==l?l:"",Y=null!==(f=null!==(h=null==M?void 0:M.phone)&&void 0!==h?h:null==R?void 0:R.phone)&&void 0!==f?f:"",O.meta={paymentMethodData:ht(ht(ht(ht(ht(ht(ht(ht({},"".concat(G,"-card-type"),T||""),"".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"),N||""),"".concat(G,"-buyer-verification-token"),A||""),"shipping_method",null!==(v=D.id)&&void 0!==v&&v),billingAddress:{email:V,first_name:null!==(d=R.givenName)&&void 0!==d?d:"",last_name:null!==(m=R.familyName)&&void 0!==m?m:"",company:"",address_1:R.addressLines?R.addressLines[0]:"",address_2:R.addressLines?R.addressLines[1]:"",city:null!==(g=R.city)&&void 0!==g?g:"",state:null!==(w=R.state)&&void 0!==w?w:"",postcode:null!==(b=R.postalCode)&&void 0!==b?b:"",country:null!==(x=R.countryCode)&&void 0!==x?x:"",phone:Z},shippingAddress:{first_name:null!==(E=M.givenName)&&void 0!==E?E:"",last_name:null!==(L=M.familyName)&&void 0!==L?L:"",company:"",address_1:M.addressLines?M.addressLines[0]:"",address_2:M.addressLines?M.addressLines[1]:"",city:null!==(_=M.city)&&void 0!==_?_:"",state:null!==(S=M.state)&&void 0!==S?S:"",postcode:null!==(C=M.postalCode)&&void 0!==C?C:"",country:null!==(k=M.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,C,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=Lt().mark((function e(){var r;return Lt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,lt(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){_t(i,n,o,a,c,"next",t)}function c(t){_t(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 kt=window.wc.wcBlocksRegistry,Ot=kt.registerPaymentMethod;(0,kt.registerExpressPaymentMethod)(nt),Ot(N)})(); -
squarewoosync/trunk/build/index.asset.php
r3360322 r3360355 1 <?php return array('dependencies' => array('lodash', 'moment', 'react', 'react-dom', 'wp-api-fetch', 'wp-element'), 'version' => ' f2226b1c74a3c0dda3a6');1 <?php return array('dependencies' => array('lodash', 'moment', 'react', 'react-dom', 'wp-api-fetch', 'wp-element'), 'version' => '1ac55004bebe425a484c'); -
squarewoosync/trunk/build/index.css
r3360322 r3360355 1347 1347 margin-right: 0.75rem; 1348 1348 } 1349 .mr-4 {1350 margin-right: 1rem;1351 }1352 1349 .ms-3 { 1353 1350 margin-inline-start: 0.75rem; … … 1431 1428 height: 1.25rem; 1432 1429 } 1433 .size-6 {1434 width: 1.5rem;1435 height: 1.5rem;1436 }1437 1430 .size-9 { 1438 1431 width: 2.25rem; … … 1620 1613 .flex-1 { 1621 1614 flex: 1 1 0%; 1622 }1623 .flex-auto {1624 flex: 1 1 auto;1625 1615 } 1626 1616 .flex-none { … … 1829 1819 margin-left: calc(1.25rem * calc(1 - var(--tw-space-x-reverse))); 1830 1820 } 1821 .space-y-1 > :not([hidden]) ~ :not([hidden]) { 1822 --tw-space-y-reverse: 0; 1823 margin-top: calc(0.25rem * calc(1 - var(--tw-space-y-reverse))); 1824 margin-bottom: calc(0.25rem * var(--tw-space-y-reverse)); 1825 } 1831 1826 .space-y-10 > :not([hidden]) ~ :not([hidden]) { 1832 1827 --tw-space-y-reverse: 0; … … 1839 1834 margin-bottom: calc(0.5rem * var(--tw-space-y-reverse)); 1840 1835 } 1836 .space-y-3 > :not([hidden]) ~ :not([hidden]) { 1837 --tw-space-y-reverse: 0; 1838 margin-top: calc(0.75rem * calc(1 - var(--tw-space-y-reverse))); 1839 margin-bottom: calc(0.75rem * var(--tw-space-y-reverse)); 1840 } 1841 1841 .space-y-4 > :not([hidden]) ~ :not([hidden]) { 1842 1842 --tw-space-y-reverse: 0; … … 1844 1844 margin-bottom: calc(1rem * var(--tw-space-y-reverse)); 1845 1845 } 1846 .space-y-6 > :not([hidden]) ~ :not([hidden]) { 1847 --tw-space-y-reverse: 0; 1848 margin-top: calc(1.5rem * calc(1 - var(--tw-space-y-reverse))); 1849 margin-bottom: calc(1.5rem * var(--tw-space-y-reverse)); 1850 } 1846 1851 .divide-x > :not([hidden]) ~ :not([hidden]) { 1847 1852 --tw-divide-x-reverse: 0; … … 2463 2468 line-height: 1.5rem !important; 2464 2469 } 2470 .leading-4 { 2471 line-height: 1rem; 2472 } 2473 .leading-5 { 2474 line-height: 1.25rem; 2475 } 2465 2476 .leading-6 { 2466 2477 line-height: 1.5rem; … … 2666 2677 .opacity-30 { 2667 2678 opacity: 0.3; 2679 } 2680 .opacity-50 { 2681 opacity: 0.5; 2668 2682 } 2669 2683 .opacity-75 { … … 3006 3020 background-color: rgb(14 165 233 / var(--tw-bg-opacity)); 3007 3021 } 3008 .hover\:bg-sky- 600:hover {3009 --tw-bg-opacity: 1; 3010 background-color: rgb( 2 132 199/ var(--tw-bg-opacity));3022 .hover\:bg-sky-700:hover { 3023 --tw-bg-opacity: 1; 3024 background-color: rgb(3 105 161 / var(--tw-bg-opacity)); 3011 3025 } 3012 3026 .hover\:bg-sky-900:hover { … … 3033 3047 --tw-text-opacity: 1; 3034 3048 color: rgb(255 255 255 / var(--tw-text-opacity)); 3035 }3036 .hover\:underline:hover {3037 text-decoration-line: underline;3038 3049 } 3039 3050 .focus\:text-sky-400:focus { … … 3088 3099 outline-color: #ef4444; 3089 3100 } 3090 .focus-visible\:outline-red-600:focus-visible {3091 outline-color: #dc2626;3092 }3093 3101 .focus-visible\:outline-sky-600:focus-visible { 3094 3102 outline-color: #0284c7; … … 3272 3280 } 3273 3281 3282 .sm\:rounded-md { 3283 border-radius: calc(var(--radius) - 2px); 3284 } 3285 3274 3286 .sm\:p-6 { 3275 3287 padding: 1.5rem; -
squarewoosync/trunk/build/index.js
r3360322 r3360355 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§ion=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)))))})()})();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,l,i,c,s,u=!1;t||(t={}),r=t.debug||!1;try{if(l=n(),i=document.createRange(),c=document.getSelection(),(s=document.createElement("span")).textContent=e,s.ariaHidden="true",s.style.all="unset",s.style.position="fixed",s.style.top=0,s.style.clip="rect(0, 0, 0, 0)",s.style.whiteSpace="pre",s.style.webkitUserSelect="text",s.style.MozUserSelect="text",s.style.msUserSelect="text",s.style.userSelect="text",s.addEventListener("copy",(function(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),i.selectNodeContents(s),c.addRange(i),!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(i):c.removeAllRanges()),s&&document.body.removeChild(s),l()}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},l={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},i={};function c(e){return n.isMemo(e)?l:i[e.$$typeof]||o}i[n.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},i[n.Memo]=l;var s=Object.defineProperty,u=Object.getOwnPropertyNames,m=Object.getOwnPropertySymbols,p=Object.getOwnPropertyDescriptor,f=Object.getPrototypeOf,d=Object.prototype;e.exports=function e(t,r,n){if("string"!=typeof r){if(d){var o=f(r);o&&o!==d&&e(t,o,n)}var l=u(r);m&&(l=l.concat(m(r)));for(var i=c(t),h=c(r),g=0;g<l.length;++g){var y=l[g];if(!(a[y]||n&&n[y]||h&&h[y]||i&&i[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,l=/^0o[0-7]+$/i,i=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||l.test(e)?i(e.slice(2),r?2:8):o.test(e)?NaN:+e}e.exports=function(e,t,r){var n,o,a,l,i,c,s=0,u=!1,m=!1,y=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function v(t){var r=n,a=o;return n=o=void 0,s=t,l=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);i=setTimeout(b,function(e){var r=t-(e-c);return m?f(r,a-(e-s)):r}(e))}function x(e){return i=void 0,y&&n?v(e):(n=o=void 0,l)}function E(){var e=d(),r=w(e);if(n=arguments,o=this,c=e,r){if(void 0===i)return function(e){return s=e,i=setTimeout(b,t),u?v(e):l}(c);if(m)return i=setTimeout(b,t),v(c)}return void 0===i&&(i=setTimeout(b,t)),l}return t=g(t)||0,h(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!==i&&clearTimeout(i),s=0,n=c=o=i=void 0},E.flush=function(){return void 0===i?l: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,l=r?Symbol.for("react.strict_mode"):60108,i=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 i:case l:case f:return e;default:switch(e=e&&e.$$typeof){case s:case p:case g:case h:case c:return e;default:return t}}case o:return t}}}function E(e){return x(e)===m}t.AsyncMode=u,t.ConcurrentMode=m,t.ContextConsumer=s,t.ContextProvider=c,t.Element=n,t.ForwardRef=p,t.Fragment=a,t.Lazy=g,t.Memo=h,t.Portal=o,t.Profiler=i,t.StrictMode=l,t.Suspense=f,t.isAsyncMode=function(e){return E(e)||x(e)===u},t.isConcurrentMode=E,t.isContextConsumer=function(e){return x(e)===s},t.isContextProvider=function(e){return x(e)===c},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===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)===i},t.isStrictMode=function(e){return x(e)===l},t.isSuspense=function(e){return x(e)===f},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===m||e===i||e===l||e===f||e===d||"object"==typeof e&&null!==e&&(e.$$typeof===g||e.$$typeof===h||e.$$typeof===c||e.$$typeof===s||e.$$typeof===p||e.$$typeof===v||e.$$typeof===w||e.$$typeof===b||e.$$typeof===y)},t.typeOf=x},959:(e,t,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,l=n.useEffect,i=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 i((function(){o.value=r,o.getSnapshot=t,s(o)&&u({inst:o})}),[e,r,t]),l((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},l=o.useSyncExternalStore,i=n.useRef,c=n.useEffect,s=n.useMemo,u=n.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,r,n,o){var m=i(null);if(null===m.current){var p={hasValue:!1,value:null};m.current=p}else p=m.current;m=s((function(){function e(e){if(!c){if(c=!0,l=e,e=n(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 r=n(e);return void 0!==o&&o(t,r)?t:(l=e,i=r)}var l,i,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=l(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 l={};e=e||[null,t({}),t([]),t(t)];for(var i=2&n&&r;"object"==typeof i&&!~e.indexOf(i);i=t(i))Object.getOwnPropertyNames(i).forEach((e=>l[e]=()=>r[e]));return l.default=()=>r,o.d(a,l),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 l=function(){for(var e,t,r=0,n="";r<arguments.length;)(e=arguments[r++])&&(t=a(e))&&(n&&(n+=" "),n+=t);return n},i=e=>"number"==typeof e&&!isNaN(e),c=e=>"string"==typeof e,s=e=>"function"==typeof e,u=e=>c(e)||s(e)?e:null,m=e=>(0,t.isValidElement)(e)||c(e)||s(e)||i(e);function p(e){let{enter:r,exit:n,appendPosition:o=!1,collapse:a=!0,collapseDuration:l=300}=e;return function(e){let{children:i,position:c,preventExitTransition:s,done:u,nodeRef:m,isIn:p}=e;const f=o?`${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,l):u()};p||(s?t():(h.current=1,e.className+=` ${d}`,e.addEventListener("animationend",t)))}),[p]),t.createElement(t.Fragment,null,i)}}function f(e,t){return null!=e?{content:e.content,containerId:e.props.containerId,id:e.props.toastId,theme:e.props.theme,type:e.props.type,data:e.props.data||{},isLoading:e.props.isLoading,icon:e.props.icon,status:t}:{}}const d={list:new Map,emitQueue:new Map,on(e,t){return this.list.has(e)||this.list.set(e,[]),this.list.get(e).push(t),this},off(e,t){if(t){const 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),l=(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=>l.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||l.has(e.toastId)&&null==e.updateId}(y))return;const{toastId:b,updateId:E,data:S}=y,{props:k}=h,N=()=>v(b),O=null==E;O&&h.count++;const 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&&(L=y.autoClose,C=k.autoClose,!1===L||i(L)&&L>0?L:C),deleteToast(){const e=f(l.get(b),"removed");l.delete(b),d.emit(4,e);const t=h.queue.length;if(h.count=null==b?h.count-h.displayedToast:h.count-1,h.count<0&&(h.count=0),t>0){const e=null==b?h.props.limit:1;if(1===t||1===e)h.displayedToast++,w();else{const r=e>t?t:e;h.displayedToast=r;for(let e=0;e<r;e++)w()}}else r()}};var L,C;j.iconOut=function(e){let{theme:r,type:n,isLoading:o,icon:a}=e,l=null;const u={theme:r,type:n};return!1===a||(s(a)?l=a(u):(0,t.isValidElement)(a)?l=(0,t.cloneElement)(a,u):c(a)||i(a)?l=a:o?l=g.spinner():(e=>e in g)(n)&&(l=g[n](u))),l}(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}):i(o)?setTimeout((()=>{x(P,j,p)}),o):x(P,j,p)}function x(e,t,r){const{toastId:n}=t;r&&l.delete(r);const a={content:e,props:t};l.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),()=>{l.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(l.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),l=(0,t.useRef)(null),i=(0,t.useRef)({start:0,x:0,y:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,boundingRect:null,didMove:!1}).current,c=(0,t.useRef)(e),{autoClose:u,pauseOnHover:m,closeToast:p,onClick:f,closeOnClick:d}=e;function h(t){if(e.draggable){"touchstart"===t.nativeEvent.type&&t.nativeEvent.preventDefault(),i.didMove=!1,document.addEventListener("mousemove",x),document.addEventListener("mouseup",E),document.addEventListener("touchmove",x),document.addEventListener("touchend",E);const r=l.current;i.canCloseOnClick=!0,i.canDrag=!0,i.boundingRect=r.getBoundingClientRect(),r.style.transition="",i.x=v(t.nativeEvent),i.y=w(t.nativeEvent),"x"===e.draggableDirection?(i.start=i.x,i.removalDistance=r.offsetWidth*(e.draggablePercent/100)):(i.start=i.y,i.removalDistance=r.offsetHeight*(80===e.draggablePercent?1.5*e.draggablePercent:e.draggablePercent/100))}}function g(t){if(i.boundingRect){const{top:r,bottom:n,left:o,right:a}=i.boundingRect;"touchend"!==t.nativeEvent.type&&e.pauseOnHover&&i.x>=o&&i.x<=a&&i.y>=r&&i.y<=n?b():y()}}function y(){n(!0)}function b(){n(!1)}function x(t){const n=l.current;i.canDrag&&n&&(i.didMove=!0,r&&b(),i.x=v(t),i.y=w(t),i.delta="x"===e.draggableDirection?i.x-i.start:i.y-i.start,i.start!==i.x&&(i.canCloseOnClick=!1),n.style.transform=`translate${e.draggableDirection}(${i.delta}px)`,n.style.opacity=""+(1-Math.abs(i.delta/i.removalDistance)))}function E(){document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",E),document.removeEventListener("touchmove",x),document.removeEventListener("touchend",E);const t=l.current;if(i.canDrag&&i.didMove&&t){if(i.canDrag=!1,Math.abs(i.delta)>i.removalDistance)return a(!0),void e.closeToast();t.style.transition="transform 0.2s, opacity 0.2s",t.style.transform=`translate${e.draggableDirection}(0)`,t.style.opacity="1"}}(0,t.useEffect)((()=>{c.current=e})),(0,t.useEffect)((()=>(l.current&&l.current.addEventListener("d",y,{once:!0}),s(e.onOpen)&&e.onOpen((0,t.isValidElement)(e.children)&&e.children.props),()=>{const e=c.current;s(e.onClose)&&e.onClose((0,t.isValidElement)(e.children)&&e.children.props)})),[]),(0,t.useEffect)((()=>(e.pauseOnFocusLoss&&(document.hasFocus()||b(),window.addEventListener("focus",y),window.addEventListener("blur",b)),()=>{e.pauseOnFocusLoss&&(window.removeEventListener("focus",y),window.removeEventListener("blur",b))})),[e.pauseOnFocusLoss]);const S={onMouseDown:h,onTouchStart:h,onMouseUp:g,onTouchEnd:g};return u&&m&&(S.onMouseEnter=b,S.onMouseLeave=y),d&&(S.onClick=e=>{f&&f(e),i.canCloseOnClick&&p()}),{playToast:y,pauseToast:b,isRunning:r,preventExitTransition:o,toastRef:l,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:i,className:c,style:u,controlledProgress:m,progress:p,rtl:f,isIn:d,theme:h}=e;const g=i||m&&0===p,y={...u,animationDuration:`${r}ms`,animationPlayState:n?"running":"paused",opacity:g?0:1};m&&(y.transform=`scaleX(${p})`);const v=l("Toastify__progress-bar",m?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${h}`,`Toastify__progress-bar--${a}`,{"Toastify__progress-bar--rtl":f}),w=s(c)?c({rtl:f,type:a,defaultClassName:v}):l(v,c);return t.createElement("div",{role:"progressbar","aria-hidden":g?"true":"false","aria-label":"notification timer",className:w,style:y,[m&&p>=1?"onTransitionEnd":"onAnimationEnd"]:m&&p<1?null:()=>{d&&o()}})}const S=e=>{const{isRunning:r,preventExitTransition:n,toastRef:o,eventHandlers:a}=b(e),{closeButton:i,children:c,autoClose:u,onClick:m,type:p,hideProgressBar:f,closeToast:d,transition:h,position:g,className:y,style:v,bodyClassName:w,bodyStyle:S,progressClassName:k,progressStyle:N,updateId:O,role:j,progress:L,rtl:C,toastId:P,deleteToast:_,isIn:R,isLoading:I,iconOut:A,closeOnClick:F,theme:T}=e,M=l("Toastify__toast",`Toastify__toast-theme--${T}`,`Toastify__toast--${p}`,{"Toastify__toast--rtl":C},{"Toastify__toast--close-on-click":F}),D=s(y)?y({rtl:C,position:g,type:p,defaultClassName:M}):l(M,y),G=!!L||!u,q={closeToast:d,type:p,theme:T};let V=null;return!1===i||(V=s(i)?i(q):(0,t.isValidElement)(i)?(0,t.cloneElement)(i,q):x(q)),t.createElement(h,{isIn:R,done:_,position:g,preventExitTransition: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}):l("Toastify__toast-body",w),style:S},null!=A&&t.createElement("div",{className:l("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!I})},A),t.createElement("div",null,c)),V,t.createElement(E,{...O&&!G?{key:`pb-${O}`}:{},rtl:C,theme:T,delay:u,isRunning:r,isIn:R,closeToast:d,hide:f,type:p,style:N,className:k,controlledProgress:G,progress:L||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:i,style:c,rtl:m,containerId:p}=e;function f(e){const t=l("Toastify__toast-container",`Toastify__toast-container--${e}`,{"Toastify__toast-container--rtl":m});return s(i)?i({position:e,rtl:m,defaultClassName:t}):l(t,u(i))}return(0,t.useEffect)((()=>{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:l}=e;return t.createElement(S,{...l,isIn:a(l.toastId),style:{...l.style,"--nth":n+1,"--len":r.length},key:`toast-${l.key}`},o)})))})))})));O.displayName="ToastContainer",O.defaultProps={position:"top-right",transition:N,autoClose:5e3,closeButton:x,pauseOnHover:!0,pauseOnFocusLoss:!0,closeOnClick:!0,draggable:!0,draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};let j,L=new Map,C=[],P=1;function _(){return""+P++}function R(e){return e&&(c(e.toastId)||i(e.toastId))?e.toastId:_()}function I(e,t){return L.size>0?d.emit(0,e,t):C.push({content:e,options:t}),t.toastId}function A(e,t){return{...t,type:t&&t.type||e,toastId:R(t)}}function F(e){return(t,r)=>I(t,A(e,r))}function T(e,t){return I(e,A("default",t))}T.loading=(e,t)=>I(e,A("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...t})),T.promise=function(e,t,r){let n,{pending:o,error:a,success:l}=t;o&&(n=c(o)?T.loading(o,r):T.loading(o.render,{...r,...o}));const i={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},u=(e,t,o)=>{if(null==t)return void T.dismiss(n);const a={type:e,...i,...r,data:o},l=c(t)?{render:t}:t;return n?T.update(n,{...a,...l}):T(l.render,{...a,...l}),o},m=s(e)?e():e;return m.then((e=>u("success",l,e))).catch((e=>u("error",a,e))),m},T.success=F("success"),T.info=F("info"),T.error=F("error"),T.warning=F("warning"),T.warn=T.warning,T.dark=(e,t)=>I(e,A("default",{theme:"dark",...t})),T.dismiss=e=>{L.size>0?d.emit(1,e):C=C.filter((t=>null!=e&&t.options.toastId!==e))},T.clearWaitingQueue=function(e){return void 0===e&&(e={}),d.emit(5,e)},T.isActive=e=>{let t=!1;return L.forEach((r=>{r.isToastActive&&r.isToastActive(e)&&(t=!0)})),t},T.update=function(e,t){void 0===t&&(t={}),setTimeout((()=>{const r=function(e,t){let{containerId:r}=t;const n=L.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 l=a.render||o;delete a.render,I(l,a)}}),0)},T.done=e=>{T.update(e,{progress:1})},T.onChange=e=>(d.on(4,e),()=>{d.off(4,e)}),T.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"},T.TYPE={INFO:"info",SUCCESS:"success",WARNING:"warning",ERROR:"error",DEFAULT:"default"},d.on(2,(e=>{j=e.containerId||e,L.set(j,e),C.forEach((e=>{d.emit(0,e.content,e.options)})),C=[]})).on(3,(e=>{L.delete(e.containerId||e),0===L.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:l}="function"==typeof n?{equalityFn:n}:n,{store:i,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,i.getState,s||i.getState,p,o);return(0,t.useDebugValue)(f),f}}const X=K();o(35),o(176);const J={notify(){},get:()=>[]};const Q="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?t.useLayoutEffect:t.useEffect;let ee=null;function te(e=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 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 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"!==le(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}}])&&ie(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=Te(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 l={relativePath:void 0===a?e.path||"":a,caseSensitive:!0===e.caseSensitive,childrenIndex:o,route:e};l.relativePath.startsWith("/")&&(ge(l.relativePath.startsWith(n),'Absolute route path "'+l.relativePath+'" nested under path "'+n+'" is not valid. An absolute child route path must start with the combined path of all its parent routes.'),l.relativePath=l.relativePath.slice(n.length));let i=Ve([n,l.relativePath]),c=r.concat(l);e.children&&e.children.length>0&&(ge(!0!==e.index,'Index routes must not have child routes. Please remove all child routes from route path "'+i+'".'),ke(e.children,t,c,i)),(null!=e.path||e.index)&&t.push({path:i,score:Ie(i,e.index),routesMeta:c})};return e.forEach(((e,t)=>{var 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 l=Ne(n.join("/")),i=[];return i.push(...l.map((e=>""===e?a:[a,e].join("/")))),o&&i.push(...l),i.map((t=>e.startsWith("/")&&""===t?"/":t))}!function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"}(Ee||(Ee={})),new Set(["lazy","caseSensitive","path","id","index","children"]);const Oe=/^:[\w-]+$/,je=3,Le=2,Ce=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+=Le),r.filter((e=>!Re(e))).reduce(((e,t)=>e+(Oe.test(t)?je:""===t?Ce:Pe)),n)}function Ae(e,t){let{routesMeta:r}=e,n={},o="/",a=[];for(let e=0;e<r.length;++e){let l=r[e],i=e===r.length-1,c="/"===o?t:t.slice(o.length)||"/",s=Fe({path:l.relativePath,caseSensitive:l.caseSensitive,end:i},c);if(!s)return null;Object.assign(n,s.params);let u=l.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 Fe(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],l=a.replace(/(.)\/+$/,"$1"),i=o.slice(1),c=n.reduce(((e,t,r)=>{let{paramName:n,isOptional:o}=t;if("*"===n){let e=i[r]||"";l=a.slice(0,a.length-e.length).replace(/(.)\/+$/,"$1")}const c=i[r];return e[n]=o&&!c?void 0:(c||"").replace(/%2F/g,"/"),e}),{});return{params:c,pathname:a,pathnameBase:l,pattern:e}}function Te(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,l=""===e||""===o.pathname,i=l?"/":o.pathname;if(null==i)a=r;else{let e=t.length-1;if(!n&&i.startsWith("..")){let t=i.split("/");for(;".."===t[0];)t.shift(),e-=1;o.pathname=t.join("/")}a=e>=0?t[e]:"/"}let c=function(e,t){void 0===t&&(t="/");let{pathname: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=i&&"/"!==i&&i.endsWith("/"),u=(l||"."===i)&&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:l}=tt(),i=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(i),l,"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,i,l,e])}()}function ot(e,r){let{relative:n}=void 0===r?{}:r,{future:o}=t.useContext(Ke),{matches:a}=t.useContext(Je),{pathname:l}=tt(),i=JSON.stringify(Ge(a,o.v7_relativeSplatPath));return t.useMemo((()=>qe(e,JSON.parse(i),l,"path"===n)),[e,i,l,n])}function at(e,r,n,o){et()||ge(!1);let{navigator:a}=t.useContext(Ke),{matches:l}=t.useContext(Je),i=l[l.length-1],c=i?i.params:{},s=(i&&i.pathname,i?i.pathnameBase:"/");i&&i.route;let u,m=tt();if(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 l;if(null==(l=n)||!l.errors)return null;e=n.matches}let i=e,c=null==(a=n)?void 0:a.errors;if(null!=c){let e=i.findIndex((e=>e.route.id&&(null==c?void 0:c[e.route.id])));e>=0||ge(!1),i=i.slice(0,Math.min(i.length,e+1))}let s=!1,u=-1;if(n&&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: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,i=u>=0?i.slice(0,u+1):[i[0]];break}}}return i.reduceRight(((e,o,a)=>{let l,m=!1,p=null,f=null;var d;n&&(l=c&&o.route.id?c[o.route.id]:void 0,p=o.route.errorElement||it,s&&(u<0&&0===a?(ft[d="route-fallback"]||(ft[d]=!0),m=!0,f=null):u===a&&(m=!0,f=o.route.hydrateFallbackElement||null)));let h=r.concat(i.slice(0,a+1)),g=()=>{let r;return r=l?p:m?f:o.route.Component?t.createElement(o.route.Component,null):o.route.element?o.route.element:e,t.createElement(st,{match:o,routeContext:{outlet:e,matches:h,isDataRoute:null!=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:l,children:g(),routeContext:{outlet:null,matches:h,isDataRoute:!0}}):g()}),null)}(h&&h.map((e=>Object.assign({},e,{params:Object.assign({},c,e.params),pathname:Ve([s,a.encodeLocation?a.encodeLocation(e.pathname).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?s:Ve([s,a.encodeLocation?a.encodeLocation(e.pathnameBase).pathname:e.pathnameBase])}))),l,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 lt(){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 it=t.createElement(lt,null);class ct extends t.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||"idle"!==t.revalidation&&"idle"===e.revalidation?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:void 0!==e.error?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return void 0!==this.state.error?t.createElement(Je.Provider,{value:this.props.routeContext},t.createElement(Qe.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function st(e){let{routeContext: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:l,static:i=!1,future:c}=e;et()&&ge(!1);let s=r.replace(/^\/*/,"/"),u=t.useMemo((()=>({basename:s,navigator:l,static:i,future:$e({v7_relativeSplatPath:!1},c)})),[s,c,l,i]);"string"==typeof o&&(o=xe(o));let{pathname:m="/",search:p="",hash:f="",state:d=null,key:h="default"}=o,g=t.useMemo((()=>{let e=Me(m,s);return null==e?null:{location:{pathname:e,search:p,hash:f,state:d,key:h},navigationType:a}}),[s,m,p,f,d,h,a]);return null==g?null:t.createElement(Ke.Provider,{value:u},t.createElement(Xe.Provider,{children: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 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)),n.push(l)})),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,l=t.useRef();var i;null==l.current&&(l.current=(void 0===(i={window:a,v5Compat:!0})&&(i={}),function(e,t,r,n){void 0===n&&(n={});let{window:o=document.defaultView,v5Compat:a=!1}=n,l=o.history,i=pe.Pop,c=null,s=u();function u(){return(l.state||{idx:null}).idx}function m(){i=pe.Pop;let e=u(),t=null==e?null:e-s;s=e,c&&c({action:i,location:f.location,delta:t})}function p(e){let t="null"!==o.location.origin?o.location.origin:o.location.href,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,l.replaceState(de({},l.state,{idx:s}),""));let f={get action(){return i},get location(){return e(o,l)},listen(e){if(c)throw new Error("A history only accepts one active listener");return o.addEventListener(he,m),c=e,()=>{o.removeEventListener(he,m),c=null}},createHref:e=>t(o,e),createURL:p,encodeLocation(e){let t=p(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(e,t){i=pe.Push;let n=we(f.location,e,t);r&&r(n,e),s=u()+1;let m=ve(n,s),p=f.createHref(n);try{l.pushState(m,"",p)}catch(e){if(e instanceof DOMException&&"DataCloneError"===e.name)throw e;o.location.assign(p)}a&&c&&c({action:i,location:f.location,delta:1})},replace:function(e,t){i=pe.Replace;let n=we(f.location,e,t);r&&r(n,e),s=u();let o=ve(n,s),m=f.createHref(n);l.replaceState(o,"",m),a&&c&&c({action:i,location:f.location,delta:0})},go:e=>l.go(e)};return f}((function(e,t){let{pathname: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)+")")}),i)));let c=l.current,[s,u]=t.useState({action:c.action,location:c.location}),{v7_startTransition:m}=o||{},p=t.useCallback((e=>{m&&St?St((()=>u(e))):u(e)}),[u,m]);return t.useLayoutEffect((()=>c.listen(p)),[c,p]),t.createElement(ht,{basename: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:l,replace:i,state:c,target:s,to:u,preventScrollReset:m,unstable_viewTransition:p}=e,f=wt(e,bt),{basename:d}=t.useContext(Ke),h=!1;if("string"==typeof u&&Ot.test(u)&&(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:l,pathname:i,search:c}=ot(e,{relative:n}),s=i;return"/"!==o&&(s="/"===i?o:Ve([o,i])),a.createHref({pathname:s,search:c,hash:l})}(u,{relative:a}),y=function(e,r){let{target:n,replace:o,state:a,preventScrollReset:l,relative:i,unstable_viewTransition:c}=void 0===r?{}:r,s=nt(),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,n)){t.preventDefault();let r=void 0!==o?o:be(u)===be(m);s(e,{replace:r,state:a,preventScrollReset:l,relative:i,unstable_viewTransition:c})}}),[u,s,m,o,a,n,e,l,i,c])}(u,{replace:i,state:c,target:s,preventScrollReset:m,relative:a,unstable_viewTransition:p});return t.createElement("a",vt({},f,{href:n||g,onClick:h||l?o:function(e){o&&o(e),e.defaultPrevented||y(e)},ref:r,target:s}))})),Lt=t.forwardRef((function(e,r){let{"aria-current":n="page",caseSensitive:o=!1,className:a="",end:l=!1,style:i,to:c,unstable_viewTransition:s,children:u}=e,m=wt(e,xt),p=ot(c,{relative:m.relative}),f=tt(),d=t.useContext(Ye),{navigator:h,basename:g}=t.useContext(Ke),y=null!=d&&function(e,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}(Ct.useViewTransitionState),a=ot(e,{relative:r.relative});if(!n.isTransitioning)return!1;let l=Me(n.currentLocation.pathname,o)||n.currentLocation.pathname,i=Me(n.nextLocation.pathname,o)||n.nextLocation.pathname;return null!=Fe(a.pathname,i)||null!=Fe(a.pathname,l)}(p)&&!0===s,v=h.encodeLocation?h.encodeLocation(p).pathname:p.pathname,w=f.pathname,b=d&&d.navigation&&d.navigation.location?d.navigation.location.pathname:null;o||(w=w.toLowerCase(),b=b?b.toLowerCase():null,v=v.toLowerCase()),b&&g&&(b=Me(b,g)||b);const x="/"!==v&&v.endsWith("/")?v.length-1:v.length;let E,S=w===v||!l&&w.startsWith(v)&&"/"===w.charAt(x),k=null!=b&&(b===v||!l&&b.startsWith(v)&&"/"===b.charAt(v.length)),N={isActive:S,isPending:k,isTransitioning:y},O=S?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 i?i(N):i;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 Ct,Pt;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Ct||(Ct={})),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"}))})),Ft=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 Tt(){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(Ft,{className:"h-6 w-6 text-white","aria-hidden":"true"})),wp.element.createElement("div",null,wp.element.createElement("h3",{className:"text-sm font-semibold text-gray-900"},"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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Xt(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(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 l(e){rr(a,n,o,l,i,"next",e)}function i(e){rr(a,n,o,l,i,"throw",e)}l(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 l=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(l,{log:e,isChild:!1,isSummary:!0})),e.children.map((function(e){return wp.element.createElement(l,{key:e.id,log:e,isChild:!0})}))):wp.element.createElement(l,{log:e,isChild:!1}))}))))};var lr="squarewoosync";function ir(){var t=tt();return(0,e.useEffect)((function(){!function(){var e=jQuery,t=e("#toplevel_page_"+lr),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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==vr(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(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 l(e){Sr(a,n,o,l,i,"next",e)}function i(e){Sr(a,n,o,l,i,"throw",e)}l(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 Lr(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 Cr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Lr(Object(r),!0).forEach((function(t){Pr(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Lr(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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==jr(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.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 l(e){Rr(a,n,o,l,i,"next",e)}function i(e){Rr(a,n,o,l,i,"throw",e)}l(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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Fr(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)?Fr(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 Fr(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 Tr=(0,t.createContext)(),Mr=function(e){var r=e.children,n=Ar((0,t.useState)([]),2),o=n[0],a=n[1],l=Ar((0,t.useState)(!0),2),i=l[0],c=l[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),T.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 Cr(Cr({},e),t)})),m(!1),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(0),m(!1),T({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=T.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)&&(T.update(n,{render:"".concat(t," updated successfully"),type:"success",isLoading:!1,autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),d((function(e){return Cr(Cr({},e),o)}))),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),T.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 Cr(Cr({},e),{},{accessToken:t.access_token})})),e.next=12;break;case 8:throw e.prev=8,e.t0=e.catch(1),T.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=T.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 Cr(Cr({},e),{},{accessToken:t})})),T.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),T.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=T.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 Cr(Cr({},e),{},{accessToken:null})})),T.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),T.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=T.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 Cr(Cr({},e),{},{sandboxToken:t})})),T.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),T.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=T.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 Cr(Cr({},e),{},{sandboxToken:null})})),T.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),T.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 Cr(Cr({},t),e)})),O(!1)})).catch((function(e){O(!1),T({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),L=j[0],C=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){C(e),R(!1)})).catch((function(e){T({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(Tr.Provider,{value:{settings:f,updateSettings:h,settingsLoading:u,getAccessToken:g,updateSandboxToken:w,removeSandboxToken:b,updateAccessToken:y,removeAccessToken:v,gatewaySettings:E,gatewayLoading:N,shippingMethods:L,shippingMethodsLoading:_,orderableLocations:o,orderableLocationsLoading:i}},r)},Dr=function(){return(0,t.useContext)(Tr)};const Gr=function(){var e,t,r,n,o=Dr(),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(pr,{orders:a.orders,gatewaySettings:l,gatewayLoading:i}),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[Ln]}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)===Cn}(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[Ln];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[Ln];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[Ln];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[Ln].P&&(on(t),qr(4)),Wr(e)&&(e=un(t,e),t.l||pn(t,e)),t.u&&tn("Patches").M(r[Ln].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[Ln];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,l=!1;3===n.i&&(a=new Set(o),o.clear(),l=!0),zr(a,(function(t,a){return mn(e,n,o,t,a,r,l)})),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,l){if(Vr(o)){var i=un(e,o,a&&t&&3!==t.i&&!Ur(t.R,n)?a.concat(n):void 0);if(Hr(r,n,i),!Vr(i))return;e.m=!1}else l&&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[Ln];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=Fn);var l=Proxy.revocable(o,a),i=l.revoke,c=l.proxy;return n.k=c,n.j=i,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[Ln],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",Ln=En?Symbol.for("immer-state"):"__$immer_state",Cn=("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===Ln)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[Ln];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)}},Fn={};zr(An,(function(e,t){Fn[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Fn.deleteProperty=function(e,t){return Fn.set.call(this,e,t,void 0)},Fn.set=function(e,t,r){return An.set.call(this,e[0],t,r,e[0])};var Tn=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,l=Array(n>1?n-1:0),i=1;i<n;i++)l[i-1]=arguments[i];return a.produce(e,(function(e){var n;return(n=r).call.apply(n,[t,e].concat(l))}))}}var l;if("function"!=typeof r&&qr(6),void 0!==n&&"function"!=typeof n&&qr(7),Wr(e)){var i=ln(t),c=yn(t,e,void 0),s=!0;try{l=r(c),s=!1}finally{s?on(i):an(i)}return"undefined"!=typeof Promise&&l instanceof Promise?l.then((function(e){return nn(i,n),sn(e,i)}),(function(e){throw on(i),e})):(nn(i,n),sn(l,i))}if(!e||"object"!=typeof e){if(void 0===(l=r(e))&&(l=e),l===On&&(l=void 0),t.D&&Jr(l,!0),n){var u=[],m=[];tn("Patches").M(e,l,u,m),n(u,m)}return l}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[Ln].C=!0,an(t),r},t.finishDraft=function(e,t){var r=(e&&e[Ln]).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 Tn,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,l=[],i=l,c=!1;function s(){i===l&&(i=l.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(),i.push(e),function(){if(t){if(c)throw new Error(Bn(6));t=!1,s();var r=i.indexOf(e);i.splice(r,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(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=l=i,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,l=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={},i=0;i<l.length;i++){var c=l[i],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||l.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,lo=Object.getOwnPropertyDescriptors,io=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(io)for(var n=0,o=io(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,lo(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),l={},i={},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],l=void 0===a?[]:a,c=t[2],s=void 0===c?void 0:c,u=mo(mo({},o),i);return function(e,t,r,n){void 0===r&&(r=[]);var o,a=wo(t),l=a[0],i=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([l[t.type]],i.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=l;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,l[e]=r,i[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:l,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)})}})),l="undefined"!=typeof AbortController?AbortController:function(){function e(){this.signal={aborted:!1,addEventListener:function(){},dispatchEvent:function(){return!1},onabort:function(){},removeEventListener:function(){},reason:void 0,throwIfAborted:function(){}}}return e.prototype.abort=function(){},e}();return Object.assign((function(e){return function(i,c,s){var u,m=(null==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 l;function f(e){u=e,p.abort()}var d=function(){return l=this,d=null,h=function(){var l,d,h,g,y,v;return function(e,t){var r,n,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(r)throw new TypeError("Generator is already executing.");for(;l;)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 l.label++,{value:a[1],done:!1};case 5:l.label++,n=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],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,i])}}}(this,(function(w){switch(w.label){case 0:return w.trys.push([0,4,,5]),null===(b=g=null==(l=null==r?void 0:r.condition)?void 0:l.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"})}))})),i(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:i,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||i(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(l,d)).next())}));var l,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 Lo(e){return Lo="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},Lo(e)}function Co(){Co=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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Lo(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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(Lo(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.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 l(e){Po(a,n,o,l,i,"next",e)}function i(e){Po(a,n,o,l,i,"throw",e)}l(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[Ln];return An.get(t,e)},set:function(t){var r=this[Ln];An.set(r,e,t)}},r}function t(e){for(var t=e.length-1;t>=0;t--){var o=e[t][Ln];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!==Ln){var l=t[a];if(void 0===l&&!Ur(t,a))return!0;var i=r[a],c=i&&i[Ln];if(c?c.t!==l:!$r(i,l))return!0}}var s=!!t[Ln];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[Ln];for(var l=Pn(a),i=0;i<l.length;i++){var c=l[i];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,Ln,{value:a,writable:!0}),o},S:function(e,r,o){o?Vr(r)&&r[Ln].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var r=t[Ln];if(r){var o=r.t,a=r.k,l=r.R,i=r.i;if(4===i)zr(a,(function(t){t!==Ln&&(void 0!==o[t]||Ur(o,t)?l[t]||e(a[t]):(l[t]=!0,hn(r)))})),zr(o,(function(e){void 0!==a[e]||Ur(a,e)||(l[e]=!1,hn(r))}));else if(5===i){if(n(r)&&(hn(r),l.length=!0),a.length<o.length)for(var c=a.length;c<o.length;c++)l[c]=!1;else for(var s=o.length;s<a.length;s++)l[s]=!0;for(var u=Math.min(a.length,o.length),m=0;m<u;m++)a.hasOwnProperty(m)||(l[m]=!0),void 0===l[m]&&e(a[m])}}}}(e.p[0]),t(e.p))},K:function(e){return 4===e.i?r(e):n(e)}})}();var Ro=No("license/fetchLicense",_o(Co().mark((function e(){var t;return Co().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 Fo(e,t){return"function"==typeof e?e(t):e}function To(e,t){return r=>{t.setState((t=>({...t,[e]:Fo(r,t[e])})))}}function Mo(e){return e instanceof Function}function Do(e,t,r){let n,o=[];return a=>{let l;r.key&&r.debug&&(l=Date.now());const i=e(a);if(i.length===o.length&&!i.some(((e,t)=>o[t]!==e)))return n;let c;if(o=i,r.key&&r.debug&&(c=Date.now()),n=t(...i),null==r||null==r.onChange||r.onChange(n),r.key&&r.debug&&null!=r&&r.debug()){const e=Math.round(100*(Date.now()-l))/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,l;const i=null!=(a=null==n?void 0:n.map((e=>r.find((t=>t.id===e)))).filter(Boolean))?a:[],c=null!=(l=null==o?void 0:o.map((e=>r.find((t=>t.id===e)))).filter(Boolean))?l:[];return zo(t,[...i,...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,l,i,c;return[...null!=(n=null==(o=e[0])?void 0:o.headers)?n:[],...null!=(a=null==(l=t[0])?void 0:l.headers)?a:[],...null!=(i=null==(c=r[0])?void 0:c.headers)?i:[]].map((e=>e.getLeafHeaders())).flat()}),Go(e.options,qo))}};function zo(e,t,r,n){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 r;null!=(r=e.columns)&&r.length&&i(e.columns,t+1)}),0)};i(e);let c=[];const s=(e,t)=>{const o={depth:t,id:[n,`${t}`].filter(Boolean).join("_"),headers:[]},a=[];e.forEach((e=>{const l=[...a].reverse()[0];let i,c=!1;if(e.column.depth===o.depth&&e.column.parent?i=e.column.parent:(i=e.column,c=!0),l&&(null==l?void 0:l.column)===i)l.subHeaders.push(e);else{const o=Vo(r,i,{id:[n,t,i.id,null==e?void 0:e.id].filter(Boolean).join("_"),isPlaceholder:c,placeholderId:c?`${a.filter((e=>e.column===i)).length}`:void 0,depth:t,index:a.length});o.subHeaders.push(e),a.push(o)}o.headers.push(e),e.headerGroup=o})),c.push(o),t>0&&s(a,t-1)},u=t.map(((e,t)=>Vo(r,e,{depth:l,index:t})));s(u,l-1),c.reverse();const m=e=>e.filter((e=>e.column.getIsVisible())).map((e=>{let t=0,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:To("columnSizing",e),onColumnSizingInfoChange:To("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 l=e.getSize(),i=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,l=(r-(null!=(n=null==e?void 0:e.startOffset)?n:0))*a,i=Math.max(l/(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*i,0))/100})),{...e,deltaOffset:l,deltaPercentage:i}})),"onChange"!==t.options.columnResizeMode&&"end"!==e||t.setColumnSizing((e=>({...e,...s}))))},m=e=>u("move",e),p=e=>{u("end",e),t.setColumnSizingInfo((e=>({...e,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]})))},f=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:l,deltaOffset:0,deltaPercentage:0,columnSizingStart:i,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:To("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 l={};if(!0===n?Object.keys(t.getRowModel().rowsById).forEach((e=>{l[e]=!0})):l=n,r=null!=(o=r)?o:!a,!a&&r)return{...l,[e.id]:!0};if(a&&!r){const{[e.id]:t,...r}=l;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,l=null===r||Number.isNaN(o)?1/0:o;if(a>l){const e=a;a=l,l=e}return[a,l]},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 la={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],globalFilter:void 0,...e}),getDefaultOptions:e=>({onColumnFiltersChange:To("columnFilters",e),onGlobalFilterChange:To("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=Fo(r,o?o.value:void 0);var l;if(ia(n,a,e))return null!=(l=null==t?void 0:t.filter((t=>t.id!==e.id)))?l:[];const i={id:e.id,value:a};var c;return o?null!=(c=null==t?void 0:t.map((t=>t.id===e.id?i:t)))?c:[]:null!=t&&t.length?[...t,i]:[i]}))},e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.getGlobalAutoFilterFn=()=>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=Fo(t,e))?void 0:n.filter((e=>{const t=r.find((t=>t.id===e.id));return!t||!ia(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 ia(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:To("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:To("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:To("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=>Fo(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=Fo(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,Fo(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=Fo(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:To("columnPinning",e),onRowPinningChange:To("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,l,i,c;return"right"===r?{left:(null!=(a=null==e?void 0:e.left)?a:[]).filter((e=>!(null!=n&&n.includes(e)))),right:[...(null!=(l=null==e?void 0:e.right)?l:[]).filter((e=>!(null!=n&&n.includes(e)))),...n]}:"left"===r?{left:[...(null!=(i=null==e?void 0:e.left)?i:[]).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))),l=r.some((e=>null==o?void 0:o.includes(e)));return a?"left":!!l&&"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})):[],l=o?e.getParentRows().map((e=>{let{id:t}=e;return t})):[],i=new Set([...l,e.id,...a]);t.setRowPinning((e=>{var t,n,o,a,l,c;return"bottom"===r?{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"===r?{top:[...(null!=(l=null==e?void 0:e.top)?l:[]).filter((e=>!(null!=i&&i.has(e)))),...Array.from(i)],bottom:(null!=(c=null==e?void 0:e.bottom)?c:[]).filter((e=>!(null!=i&&i.has(e))))}:{top:(null!=(t=null==e?void 0:e.top)?t:[]).filter((e=>!(null!=i&&i.has(e)))),bottom:(null!=(n=null==e?void 0:e.bottom)?n:[]).filter((e=>!(null!=i&&i.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))),l=r.some((e=>null==o?void 0:o.includes(e)));return a?"top":!!l&&"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:To("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 l;if(r=void 0!==r?r:!o,e.getCanSelect()&&o===r)return a;const i={...a};return da(i,e.id,r,null==(l=null==n?void 0:n.selectChildren)||l,t),i}))},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 l=o.getRow(t,!0);r?(l.getCanMultiSelect()||Object.keys(e).forEach((t=>delete e[t])),l.getCanSelect()&&(e[t]=!0)):delete e[t],n&&null!=(a=l.subRows)&&a.length&&l.getCanSelectSubRows()&&l.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 l=ga(e,r);if(l&&(n.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: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),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 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:To("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((l=>{const i=null==l?void 0:l.find((t=>t.id===e.id)),c=null==l?void 0:l.findIndex((t=>t.id===e.id));let s,u=[],m=a?r:"desc"===o;var p;return s=null!=l&&l.length&&e.getCanMultiSort()&&n?i?"toggle":"add":null!=l&&l.length&&c!==l.length-1?"replace":i?"toggle":"replace","toggle"===s&&(a||o||(s="remove")),"add"===s?(u=[...l,{id:e.id,desc:m}],u.splice(0,u.length-(null!=(p=t.options.maxMultiSortColCount)?p:Number.MAX_SAFE_INTEGER))):u="toggle"===s?l.map((t=>t.id===e.id?{...t,desc:m}:t)):"remove"===s?l.filter((t=>t.id!==e.id)):[{id:e.id,desc:m}],u}))},e.getFirstSortDir=()=>{var 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(),l=e.getIsSorted();return l?!!(l===a||null!=(n=t.options.enableSortingRemoval)&&!n||r&&null!=(o=t.options.enableMultiRemove)&&!o)&&("desc"===l?"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:To("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,la,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 l=!1;const i={_features:Oa,options:{...n,...e},initialState:o,_queue:e=>{a.push(e),l||(l=!0,Promise.resolve().then((()=>{for(;a.length;)a.shift()();l=!1})).catch((e=>setTimeout((()=>{throw e})))))},reset:()=>{r.setState(r.initialState)},setOptions:e=>{const t=Fo(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 l={...e._getDefaultColumnDef(),...t},i=l.accessorKey;let c,s=null!=(o=null!=(a=l.id)?a:i?i.replace(".","_"):void 0)?o:"string"==typeof l.header?l.header:void 0;if(l.accessorFn?c=l.accessorFn:i&&(c=i.includes(".")?e=>{let t=e;for(const e of i.split(".")){var r;t=null==(r=t)?void 0:r[e]}return t}:e=>e[l.accessorKey]),!s)throw new Error;let u={id:`${String(s)}`,accessorFn:c,parent:n,depth:r,columnDef:l,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),l=e;return a.columns=l.columns?t(l.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,i);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 La=(e,t,r,n,o,a,l)=>{let i={id:t,index:n,original:r,depth:o,parentId:l,_valuesCache:{},_uniqueValuesCache:{},getValue:t=>{if(i._valuesCache.hasOwnProperty(t))return i._valuesCache[t];const r=e.getColumn(t);return null!=r&&r.accessorFn?(i._valuesCache[t]=r.accessorFn(i.original,n),i._valuesCache[t]):void 0},getUniqueValues:t=>{if(i._uniqueValuesCache.hasOwnProperty(t))return i._uniqueValuesCache[t];const r=e.getColumn(t);return null!=r&&r.accessorFn?r.columnDef.getUniqueValues?(i._uniqueValuesCache[t]=r.columnDef.getUniqueValues(i.original,n),i._uniqueValuesCache[t]):(i._uniqueValuesCache[t]=[i.getValue(t)],i._uniqueValuesCache[t]):void 0},renderValue:t=>{var r;return null!=(r=i.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}(i.subRows,(e=>e.subRows)),getParentRow:()=>i.parentId?e.getRow(i.parentId,!0):void 0,getParentRows:()=>{let e=[],t=i;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,i,t,t.id)))),Go(e.options,"debugRows")),_getAllCellsByColumnId:Do((()=>[i.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(i,e)}return i};function Ca(){return e=>Do((()=>[e.options.data]),(t=>{const r={rows:[],flatRows:[],rowsById:{}},n=function(t,o,a){void 0===o&&(o=0);const l=[];for(let c=0;c<t.length;c++){const s=La(e,e._getRowId(t[c],c,a),t[c],c,o,void 0,null==a?void 0:a.id);var i;r.flatRows.push(s),r.rowsById[s.id]=s,l.push(s),e.options.getSubRows&&(s.originalSubRows=e.options.getSubRows(t[c],c),null!=(i=s.originalSubRows)&&i.length&&(s.subRows=n(s.originalSubRows,o+1,s)))}return l};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 l=r.map((e=>e.id)),i=e.getGlobalFilterFn(),c=e.getAllLeafColumns().filter((e=>e.getCanGlobalFilter()));let s,u;n&&i&&c.length&&(l.push("__global__"),c.forEach((e=>{var t;a.push({id:e.id,filterFn:i,resolvedValue:null!=(t=null==i.resolveFilterValue?void 0:i.resolveFilterValue(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={},l=null!=(n=r.options.maxLeafRowFilterDepth)?n:100,i=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=La(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<l){if(p.subRows=i(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:i(e),flatRows:o,rowsById:a}}(e,t,r):function(e,t,r){var n;const o=[],a={},l=null!=(n=r.options.maxLeafRowFilterDepth)?n:100,i=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<l){const e=La(r,m.id,m.original,m.index,m.depth,void 0,m.parentId);e.subRows=i(m.subRows,n+1),m=e}c.push(m),o.push(m),a[m.id]=m}}return c};return{rows:i(e),flatRows:o,rowsById:a}}(e,t,r)}(t.rows,(e=>{for(let t=0;t<l.length;t++)if(!1===e.columnFilters[l[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()})),l={};a.forEach((t=>{const r=e.getColumn(t.id);r&&(l[t.id]={sortUndefined:r.columnDef.sortUndefined,invertSorting:r.columnDef.invertSorting,sortingFn:r.getSortingFn()})}));const i=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],i=l[o.id],c=null!=(r=null==o?void 0:o.desc)&&r;let s=0;if(i.sortUndefined){const r=void 0===e.getValue(o.id),n=void 0===t.getValue(o.id);(r||n)&&(s=r&&n?0:r?i.sortUndefined:-i.sortUndefined)}if(0===s&&(s=i.sortingFn(e,t,o.id)),0!==s)return c&&(s*=-1),i.invertSorting&&(s*=-1),s}return e.index-t.index})),t.forEach((e=>{var t;o.push(e),null!=(t=e.subRows)&&t.length&&(e.subRows=i(e.subRows))})),t};return{rows:i(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:l,rowsById:i}=r;const c=n*o,s=c+n;let u;a=a.slice(c,s),u=e.options.paginateExpandedRows?{rows:a,flatRows:l,rowsById:i}:Ia({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}),Go(e.options,"debugTable"))}function Fa(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 Ta(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,l=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),i=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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(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=i[0],s=i[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({},l,{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"},Fa(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,l="variable"===o,i=t.original.id===r,c=t.getIsExpanded(),s=Za(a?"bg-sky-50":"",i?"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,i="actions"===e.column.id;return o&&(l||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||i||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":"")},i&&l?wp.element.createElement(_t,{variant:"secondary"},"Pro only"):Fa(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,l=void 0===a||a,i=(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"}},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: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 el=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 tl=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 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 nl(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 ol(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=rl(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=rl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==rl(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var al=function(t){var r=t.progress,n=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)}),[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: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"},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?nl(Object(r),!0).forEach((function(t){ol(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):nl(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),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(tl,{className:"mr-1.5 h-4 w-4 text-white","aria-hidden":"true"}),wp.element.createElement("span",null,"Close"))))};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 il(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 cl(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?il(Object(r),!0).forEach((function(t){sl(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):il(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function sl(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}var ul=function(e){var t=e.dataToImport,r=e.setDataToImport,n=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 r(cl(cl({},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(cl(cl({},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(cl(cl({},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(cl(cl({},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(){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(tl,{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"}))))},ml=function(e){var t=e.currentStep,r=e.rangeValue,n=e.dataToImport,o=e.handleStepChange,a=e.setCurrentStep,l=e.handleRangeChange,i=e.setDataToImport,c=e.importProduct,s=e.importCount,u=e.productsToImport,m=e.isImporting,p=e.setIsDialogOpen,f=e.progress;switch(t){case 0:return wp.element.createElement(ul,{dataToImport:n,setDataToImport:i,rangeValue:r,handleRangeChange:l,handleStepChange:o,setCurrentStep:a,setIsDialogOpen:p});case 1:return wp.element.createElement(el,{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(al,{progress:f,importCount:s,handleStepChange:o,setCurrentStep:a,isImporting:m,setIsDialogOpen:p});default:return wp.element.createElement("div",null,"Invalid step")}};function pl(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 fl=function(t){var r=t.isDialogOpen,n=t.setIsDialogOpen,o=t.progress,a=t.rangeValue,l=t.setRangeValue,i=t.setDataToImport,c=t.dataToImport,s=t.importProduct,u=t.productsToImport,m=t.importCount,p=t.isImporting,f=[{name:"Step 1",href:"#",status:"current"},{name:"Step 2",href:"#",status:"upcoming"},{name:"Step 3",href:"#",status:"upcoming"}],d=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return pl(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)?pl(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(ml,{currentStep:h,rangeValue:a,dataToImport:c,handleStepChange:function(e){g((function(t){return"forward"===e&&t<f.length-1?t+1:"backward"===e&&t>0?t-1:t}))},setCurrentStep:g,handleRangeChange:function(e){l(Number(e.target.value))},importCount:m,productsToImport:u,setDataToImport:i,importProduct:s,isImporting:p,setIsDialogOpen: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 dl(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 hl=(0,e.createContext)({blockNavigation:!1,setBlockNavigation:function(){}}),gl=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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return dl(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)?dl(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(hl.Provider,{value:{blockNavigation:o,setBlockNavigation:a}},r)};function yl(e){return yl="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},yl(e)}function vl(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 wl(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?vl(Object(r),!0).forEach((function(t){bl(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vl(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function bl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=yl(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=yl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==yl(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xl(e){return function(e){if(Array.isArray(e))return El(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 El(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)?El(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 El(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 Sl=["BIF","CLP","DJF","GNF","JPY","KMF","KRW","MGA","PYG","RWF","UGX","VND","VUV","XAF","XOF","XPF"];var kl=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)},Nl=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"}))},Ol=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,l=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"})),l)},jl=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]")})})))},Ll=["indeterminate","className"];function Cl(){return Cl=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},Cl.apply(null,arguments)}const Pl=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,Ll),l=(0,t.useRef)(null);return(0,t.useEffect)((function(){"boolean"==typeof r&&(l.current.indeterminate=!a.checked&&r)}),[r,a.checked]),wp.element.createElement("input",Cl({type:"checkbox",ref:l,className:o+" cursor-pointer"},a))};var _l=function(e,t,r,n,o){var a=!o||e.original.present_at_location_ids&&e.original.present_at_location_ids.includes(n),l=!!e.getValue(t)&&e.getValue(t).toString().toLowerCase().includes(r.toLowerCase()),i=!!e.subRows&&e.subRows.some((function(e){var n=e.getValue(t);return!!n&&n.toString().toLowerCase().includes(r.toLowerCase())}));l&&e.subRows&&e.subRows.forEach((function(e){e.isMatch=!0}));var c=l||i;return!(!l||!e.subRows)||c&&a},Rl=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)},Il=function(e,t,r){return!r||(!(n=e)||!0!==n.getValue(t));var n},Al=function(e,t,r){return!r||(!(n=e)||!0!==n.getValue(t));var n},Fl=function(e,t,r){if(!r&&!1!==r)return!0;var n="true"===r||"false"!==r&&r;return e.getValue(t)===n};const Tl=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))},Ml=(...e)=>e.filter(((e,t,r)=>Boolean(e)&&""!==e.trim()&&r.indexOf(e)===t)).join(" ").trim();var Dl={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 Gl=(0,t.forwardRef)((({color:e="currentColor",size:r=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:a="",children:l,iconNode:i,...c},s)=>(0,t.createElement)("svg",{ref:s,...Dl,width:r,height:r,stroke:e,strokeWidth:o?24*Number(n)/Number(r):n,className:Ml("lucide",a),...c},[...i.map((([e,r])=>(0,t.createElement)(e,r))),...Array.isArray(l)?l:[l]]))),ql=((e,r)=>{const n=(0,t.forwardRef)((({className:n,...o},a)=>{return(0,t.createElement)(Gl,{ref:a,iconNode:r,className:Ml(`lucide-${l=e,l.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,n),...o});var l}));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 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,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 zl(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Wl(Object(r),!0).forEach((function(t){Bl(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Wl(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Bl(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}var Ul=function(t,r,n,o,a,l){var i=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,l,i,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 Sl.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 Sl.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,xl(w)),g=Math.max.apply(Math,xl(w))):h=g=0;var x=b.length?Math.min.apply(Math,xl(b)):0,E=b.length?Math.max.apply(Math,xl(b)):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===(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(kl,{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(jl,{value:t}):wp.element.createElement(Nl,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(Ol,{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=zl(zl({},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(Tl,{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(ql,{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(Pl,{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(Pl,{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 zl(zl({},t),{},Bl({},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 zl(zl({},r),{},Bl({},t.id,e.target.checked))}))}))}else if(0!==r.depth||e.target.checked)n.setRowSelection((function(t){return zl(zl({},t),{},Bl({},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 zl(zl({},r),{},Bl({},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 Rl(e,t,r)}}),[n,o,a,l]),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:i,sorting:s,columnVisibility:{id:!1,present_at_location_ids:!1,is_archived:!1,visibility:!1},globalFilter:m,rowSelection:g},filterFns:{visibilityFilter:Il,archivedFilter:Al,statusFilter:Fl,includesCategoryFilter:S,searchFilterFn:function(e,t,r){return!!Array.isArray(t)&&Rl(e,t,r)}},globalFilterFn:Rl,getSubRows:function(e){return e.subRows||[]},getCoreRowModel:Ca(),getFilteredRowModel:Pa(),getSortedRowModel:_a(),getExpandedRowModel:Ra(),getPaginationRowModel:Aa(),onExpandedChange:c,onGlobalFilterChange:p,autoResetPageIndex:!1,enableRowSelection:!0,getRowId:function(e){return e.id}}}),[w,x,i,s,m,c,u,p,g,y,E,n,o,a,l])};function Hl(e){return Hl="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},Hl(e)}function $l(){$l=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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Hl(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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(Hl(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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 Zl(e,t,r,n,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.done?t(c):Promise.resolve(c).then(n,o)}function Yl(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function l(e){Zl(a,n,o,l,i,"next",e)}function i(e){Zl(a,n,o,l,i,"throw",e)}l(void 0)}))}}function Kl(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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Xl(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)?Xl(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 Xl(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 Jl(e){return Jl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Jl(e)}function Ql(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=oi(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,l=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){l=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw o}}}}function ei(){ei=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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Jl(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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(Jl(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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 ti(e,t,r,n,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.done?t(c):Promise.resolve(c).then(n,o)}function ri(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function l(e){ti(a,n,o,l,i,"next",e)}function i(e){ti(a,n,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 r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||oi(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 oi(e,t){if(e){if("string"==typeof e)return ai(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)?ai(e,t):void 0}}function ai(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 li=function(t){var r=t.setIsAutoMatchOpen,n=t.inventory,o=ni((0,e.useState)("sku"),2),a=o[0],l=o[1],i=ni((0,e.useState)(!1),2),c=i[0],s=i[1],u=ni((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=ri(ei().mark((function e(t,r){return ei().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=ri(ei().mark((function e(){var t,r,o,l;return ei().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:s(!0),t=f(n,100),r=Ql(t),e.prev=4,r.s();case 6:if((o=r.n()).done){e.next=12;break}return l=o.value,e.next=10,d(l,a);case 10:e.next=6;break;case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(4),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 l(e.target.value)}},wp.element.createElement("option",{value:"sku"},"SKU")),m&&wp.element.createElement("p",{className:"text-sky-500 mt-4"},m),c?wp.element.createElement("div",{className:"flex items-center mt-10 justify-end gap-2"},wp.element.createElement("button",{type:"button",className:"relative inline-flex items-center rounded-md bg-sky-500 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400",disabled:""},wp.element.createElement("svg",{className:"animate-spin -ml-1 mr-3 h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},wp.element.createElement("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),wp.element.createElement("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})),"Processing...")):wp.element.createElement("div",{className:"flex items-center mt-10 justify-end gap-2"},wp.element.createElement("button",{type:"button",onClick:function(){return 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(tl,{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 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 ci(){ci=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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==ii(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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(ii(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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 si(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 ui(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?si(Object(r),!0).forEach((function(t){mi(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):si(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function mi(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}function pi(e,t,r,n,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.done?t(c):Promise.resolve(c).then(n,o)}function fi(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function l(e){pi(a,n,o,l,i,"next",e)}function i(e){pi(a,n,o,l,i,"throw",e)}l(void 0)}))}}function di(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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||hi(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 hi(e,t){if(e){if("string"==typeof e)return gi(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)?gi(e,t):void 0}}function gi(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 yi=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,r=di((0,t.useState)(null),2),n=r[0],o=r[1],a=di((0,t.useState)(!0),2),l=a[0],i=a[1],c=di((0,t.useState)(!1),2),s=c[0],u=c[1],m=di((0,t.useState)(""),2),p=m[0],f=m[1],d=di((0,t.useState)(""),2),h=d[0],g=d[1],y=di((0,t.useState)(""),2),v=y[0],w=y[1],b=di((0,t.useState)(""),2),x=b[0],E=b[1],S=di((0,t.useState)(""),2),k=S[0],N=S[1],O=di((0,t.useState)(""),2),j=O[0],L=O[1],C=di((0,t.useState)([]),2),P=C[0],_=C[1],R=di((0,t.useState)({pageIndex:0,pageSize:e,total:0,totalPages:0,importable:0}),2),I=R[0],A=R[1],F=di((0,t.useState)([]),2),M=F[0],D=F[1],G=(0,t.useRef)(!0),q=(0,t.useCallback)(fi(ci().mark((function e(){var t,r,n,a,l,c,u,m,d,y,b,S,O,C,P,_,R,F,D,G,q,V,W,z,B,U,H,$,Z,Y,K,X,J,Q=arguments;return ci().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,l=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,C=t.status,P=void 0===C?v:C,_=t.ecom,R=void 0===_?k:_,F=t.archive,D=void 0===F?j:F,G=t.location,q=void 0===G?x:G,!s){e.next=3;break}return e.abrupt("return");case 3:return i(!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:l.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/l),f(u),g(O),w(P),L(D),E(q),N(R),A((function(e){return ui(ui({},e),{},{pageIndex:n,pageSize:l,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),T.error("Error fetching inventory. See console for details.");case 42:return e.prev=42,i(!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 ui(ui({},e),{},{pageIndex:0})})),q({pageIndex:0,pageSize:I.pageSize,search:e})}),[q,I.pageSize]),W=(0,t.useCallback)(fi(ci().mark((function e(){var t,r,n,a,l,c,s,m,p=arguments;return ci().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=p.length>0&&void 0!==p[0]&&p[0],u(!0),i(!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),i(!0)):(o(n.data),a=r.headers.get("X-WP-Total"),l=r.headers.get("X-WP-TotalPages"),c=parseInt(a||"0",10),s=parseInt(l||"0",10),A((function(e){return ui(ui({},e),{},{pageIndex:0,pageSize:I.pageSize,total:c,totalPages:s})})),u(!1),i(!1));case 12:m=function(){var e=fi(ci().mark((function e(){var t,r,n,a;return ci().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=0,r=100,n=ci().mark((function e(){var r,n,a,l,c;return ci().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),i(!1),o(n.inventory||[]),a=r.headers.get("X-WP-Total"),l=parseInt(a||"0",10),c=Math.ceil(l/I.pageSize),f(""),A((function(e){return ui(ui({},e),{},{pageIndex:0,total:l,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:T.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),T.error("Error triggering inventory update."),u(!1),i(!1);case 22:case"end":return e.stop()}}),e,null,[[3,16]])}))),[]),z=(0,t.useCallback)((function(e){g(e),A((function(e){return ui(ui({},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 ui(ui({},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 ui(ui({},e),{},{pageIndex:0})})),q({pageIndex:0,category:h,status:v,location:e,archive:j,ecom:k})}),[q,x]),H=(0,t.useCallback)((function(e){L(e),A((function(e){return ui(ui({},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 ui(ui({},e),{},{pageIndex:0})})),q({pageIndex:0,category:h,status:v,location:x,archive:j,ecom:e})}),[q,k]),Z=(0,t.useCallback)(fi(ci().mark((function e(){var t,r;return ci().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),T.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 gi(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||hi(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:l,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:L,setLocationFilter:E,setEcomFilter:N,fetchInventory:q,handleSearch:V,changeCategory:z,changeStatus:B,changeLocation:U,changeEcom:$,changeArchive:H,triggerAndPollInventory:W,fetchCategories:Z}};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){return function(e){if(Array.isArray(e))return Ni(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 bi(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 xi(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?bi(Object(r),!0).forEach((function(t){Ei(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):bi(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Ei(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}function Si(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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)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 Ni(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)?Ni(e,t):void 0}}function Ni(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 Oi="undefined"==typeof AbortController?void 0:new AbortController;const ji=function(r){var o=r.settings,a=r.updateSettings,l=yi(10),i=l.inventoryLoading,c=(l.polling,l.inventory),s=l.triggerAndPollInventory,u=l.fetchInventory,m=l.handleSearch,p=l.searchTerm,f=l.setPagination,d=l.pagination,h=l.sorting,g=l.setSorting,y=l.categoryFilter,v=l.statusFilter,w=l.changeCategory,b=l.changeStatus,x=l.categoryOptions,E=l.locationFilter,S=l.changeLocation,k=l.archiveFilter,N=l.changeArchive,O=l.ecomFilter,j=l.changeEcom,L=Si((0,t.useState)({}),2),C=L[0],P=L[1],_=Si((0,t.useState)({}),2),R=_[0],I=_[1],A=Si((0,t.useState)(!1),2),F=A[0],M=A[1],D=Si((0,t.useState)(!1),2),G=D[0],q=D[1],V=Si((0,t.useState)(15),2),W=V[0],z=V[1],B=function(t,r,n,o){var a=Kl((0,e.useState)(!1),2),l=a[0],i=a[1],c=Kl((0,e.useState)(null),2),s=c[0],u=c[1],m=(0,e.useRef)(null),p=(0,e.useRef)(l);(0,e.useEffect)((function(){p.current=l}),[l]);var f=(0,e.useCallback)(Yl($l().mark((function e(){var t,r,n,o,a,l,c,s,m;return $l().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,l=n.total,c=void 0===l?0:l,s=n.error,m=void 0===s?"":s,(a>0||c>0||m)&&u(r.progress)),r.isImporting&&(i(!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=Yl($l().mark((function o(){var a,l,c;return $l().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 l=o.sent,o.next=6,l.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 i(!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):i(!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=Yl($l().mark((function e(t,r,n,a,l,c){var s,m;return $l().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 i(!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:l,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 T.error("Import error: ".concat(m.error)),i(!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?T.info("Import request aborted."):T.error("Import request failed: ".concat(e.t0.message)),i(!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=Yl($l().mark((function e(){var t,r;return $l().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?(i(!1),T.info("Import was stopped.")):T.warn(r.message),e.next=14;break;case 10:e.prev=10,e.t0=e.catch(0),console.error("Error stopping import:",e.t0),T.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(){i(!1),u(null),n("inventory",{})}),[]);return(0,e.useEffect)((function(){return function(){m.current&&clearTimeout(m.current)}}),[]),{isImporting:l,progress:s,importProduct:h,clearImportProgress:y,setIsImporting:i,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=Si((0,t.useState)([]),2),X=K[0],J=K[1],Q=Si((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=Si((0,t.useState)({}),2),ne=re[0],oe=re[1],ae=Si((0,t.useState)(""),2),le=ae[0],ie=ae[1],ce=Si((0,t.useState)([]),2),se=(ce[0],ce[1],Si((0,t.useState)([]),2)),ue=se[0],me=(se[1],Si((0,t.useState)(!0),2)),pe=me[0],fe=(me[1],Si((0,t.useState)(!1),2)),de=fe[0],he=(fe[1],Si((0,t.useState)(!1),2)),ge=he[0],ye=(he[1],Ul(c||[],{expanded:ne,setExpanded:oe,sorting:h,setSorting:g,globalFilter:le,setGlobalFilter:ie,isImporting:U,setProductsToImport:J,setIsDialogOpen:M},o.location,pe,de,ge));console.log(c);var ve,we,be,xe=Ta(xi(xi({},ye),{},{manualPagination:!0,manualSorting:!0,pageCount:d.totalPages||1,state:xi(xi({},ye.state),{},{pagination:d,sorting:h,rowSelection:C}),onPaginationChange:f,onSortingChange:function(e){g(e),f((function(e){return xi(xi({},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=xi({},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 l=e.getParentRow(),i=l.original.id;if(n[i]?Array.isArray(n[i].subRows)||(n[i].subRows=[]):n[i]=xi(xi({},l.original),{},{subRows:[]}),o)n[i].subRows.find((function(e){return e.id===a}))||n[i].subRows.push(e.original);else{n[i].subRows=n[i].subRows.filter((function(e){return e.id!==a}));var c=r[l.id];0!==n[i].subRows.length||c||delete n[i]}}else o?n[a]=xi(xi({},e.original),{},{subRows:e.original.subRows?wi(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(),l=null==a||null===(o=a.original)||void 0===o?void 0:o.id;if(!l)return;var i=R[l];i&&Array.isArray(i.subRows)&&i.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,l=void 0===a?"":a;return"Import stopped by user"===l?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,").")):l&&l.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,l),". 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]",l=e.message||"Item #".concat(t+1," complete");return wp.element.createElement("div",{key:t,className:"whitespace-pre-wrap mb-1 ".concat(n)},a," ",l)})))),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(li,{setIsAutoMatchOpen:q,inventory:c})),wp.element.createElement(fl,{dataToImport:ee,setDataToImport:te,importCount:0===X.length?d.importable:X.length,importProduct:function(){$(X,c,Oi,ee,y,v,p)},controller:Oi,isImporting:U,productsToImport:X,rangeValue:W,setRangeValue:z,isDialogOpen:F,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!=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(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"))),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 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"},i?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:C,setRowSelection:P})))};function Li(e){return Li="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},Li(e)}function Ci(){Ci=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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Li(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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(Li(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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 Pi(e,t,r,n,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.done?t(c):Promise.resolve(c).then(n,o)}var _i=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 l(e){Pi(a,n,o,l,i,"next",e)}function i(e){Pi(a,n,o,l,i,"throw",e)}l(void 0)}))}}(Ci().mark((function a(l){var i,c;return Ci().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if(a.prev=0,i=null,e)try{localStorage.removeItem("inventoryData")}catch(e){console.warn("Failed to remove data from local storage:",e)}else{try{i=localStorage.getItem("inventoryData")}catch(e){console.warn("Failed to retrieve data from local storage:",e)}i&&setTimeout((function(){var e=JSON.parse(i);return r({status:"success",data:e})}),100)}return a.next=5,zt({path:"/sws/v1/square-inventory".concat(l&&e?"?force=true":"")});case 5:if((c=a.sent).loading)l&&T.info("Fetching data, please wait...",{autoClose:2e3,hideProgressBar:!1,closeOnClick:!1}),setTimeout((function(){return o(!1)}),t);else if(0===c.data.length)T.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)}T.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),T.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 Ri(e){return Ri="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ri(e)}function Ii(){Ii=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Ri(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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(Ri(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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 Ai(e,t,r,n,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.done?t(c):Promise.resolve(c).then(n,o)}function Fi(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function l(e){Ai(a,n,o,l,i,"next",e)}function i(e){Ai(a,n,o,l,i,"throw",e)}l(void 0)}))}}var Ti=No("inventory/fetchIfNeeded",Fi(Ii().mark((function e(){var t,r,n,o,a,l,i,c,s=arguments;return Ii().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(),l=a.inventory,!t&&null!==l.data){e.next=24;break}return e.prev=4,e.next=7,_i(t);case 7:if("success"!==(i=e.sent).status){e.next=12;break}return e.abrupt("return",i.data);case 12:if("loading"!==i.status){e.next=16;break}return e.abrupt("return",o("Data is being fetched, please wait..."));case 16:throw new Error(i.error);case 17:e.next=22;break;case 19:return e.prev=19,e.t0=e.catch(4),e.abrupt("return",o(e.t0.message));case 22:e.next=44;break;case 24:if(!l.loading){e.next=43;break}return e.prev=25,e.next=28,_i(!1);case 28:if("success"!==(c=e.sent).status){e.next=33;break}return e.abrupt("return",c.data);case 33:if("loading"!==c.status){e.next=37;break}return e.abrupt("return",o("Data is being fetched, please wait..."));case 37:throw new Error(c.error);case 38:e.next=43;break;case 40:return e.prev=40,e.t1=e.catch(25),e.abrupt("return",o(e.t1.message));case 43:return e.abrupt("return",l.data);case 44:case"end":return e.stop()}}),e,null,[[4,19],[25,40]])})))),Mi=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(Ti.pending,(function(e){e.loading=!0,e.fetchAttempted=!0})).addCase(Ti.fulfilled,(function(e,t){e.loading=!1,e.data=t.payload,e.error=null})).addCase(Ti.rejected,(function(e,t){e.loading=!1,e.data=[],e.error=t.payload}))}}),Di=Mi.actions;Di.setInventory,Di.addItem,Di.removeItem;const Gi=Mi.reducer;function qi(e){return qi="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},qi(e)}function Vi(){Vi=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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==qi(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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(qi(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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 Wi(e,t,r,n,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.done?t(c):Promise.resolve(c).then(n,o)}function zi(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 Bi(e){return Bi="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},Bi(e)}function Ui(){Ui=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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Bi(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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(Bi(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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 Hi(e,t,r,n,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.done?t(c):Promise.resolve(c).then(n,o)}function $i(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function l(e){Hi(a,n,o,l,i,"next",e)}function i(e){Hi(a,n,o,l,i,"throw",e)}l(void 0)}))}}function Zi(){return Yi.apply(this,arguments)}function Yi(){return Yi=$i(Ui().mark((function e(){var t,r,n,o,a,l=arguments;return Ui().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=l.length>0&&void 0!==l[0]?l[0]:0,r=l.length>1&&void 0!==l[1]?l[1]:20,n=l.length>2&&void 0!==l[2]?l[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",Zi(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]])}))),Yi.apply(this,arguments)}var Ki=function(){var e=$i(Ui().mark((function e(){var t,r,n,o=arguments;return Ui().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.length>0&&void 0!==o[0]?o[0]:99,r=T.loading("Retrieving Woo Orders"),e.prev=2,e.next=5,Zi(1,t);case 5:return n=e.sent,T.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),T.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 Xi(e){return Xi="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},Xi(e)}function Ji(){Ji=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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Xi(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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(Xi(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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 Qi(e,t,r,n,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.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 l(e){Qi(a,n,o,l,i,"next",e)}function i(e){Qi(a,n,o,l,i,"throw",e)}l(void 0)}))}}var tc=No("orders/fetchIfNeeded",ec(Ji().mark((function e(){var t,r,n,o,a,l,i,c,s,u=arguments;return Ji().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,l=o.rejectWithValue,i=a(),c=i.orders,!(n||!c.data||c.data.length<1)){e.next=16;break}return e.prev=4,e.next=7,Ki();case 7:return s=e.sent,e.abrupt("return",s.data.orders);case 11:return e.prev=11,e.t0=e.catch(4),e.abrupt("return",l(e.t0.error));case 14:e.next=17;break;case 16:return e.abrupt("return",c.data);case 17:case"end":return e.stop()}}),e,null,[[4,11]])})))),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"}))})),lc=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."))},ic=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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==uc(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return yc(e,t);var 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],l=o[1],i=gc((0,e.useState)([]),2),c=i[0],s=i[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 l(e){pc(a,n,o,l,i,"next",e)}function i(e){pc(a,n,o,l,i,"throw",e)}l(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=T.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?(T.update(r,{render:"Created successfully",type:"success",isLoading:!1,autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),n(nc(g(t,o.data)))):T.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),T.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(ic,{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=Ta(hc(hc(hc({data:r,columns:v,state:{sorting:c,globalFilter:a,expanded:m},filterFns:{custom:_l},onSortingChange:s,onExpandedChange:p,globalFilterFn:"custom",onGlobalFilterChange:l,getCoreRowModel:Ca(),getSortedRowModel:_a(),getFilteredRowModel:Pa(),getPaginationRowModel:Aa(),getExpandedRowModel:Ra()},"onSortingChange",s),"onGlobalFilterChange",l),"debugTable",!0)),b=function(e){return JSON.parse(e)};return wp.element.createElement(React.Fragment,null,wp.element.createElement(lc,{fetchOrders:function(){return n(tc({forceRefresh:!0}))},setGlobalFilter:l,globalFilter:a}),wp.element.createElement("table",{className:"w-full"},wp.element.createElement("thead",{className:"border-b border-gray-900/10 text-sm leading-6 text-gray-900"},w.getHeaderGroups().map((function(e){return wp.element.createElement("tr",{key:e.id},e.headers.map((function(e){var t;return wp.element.createElement("th",{key:e.id,colSpan:e.colSpan,className:"p-2 font-bold text-left"},e.isPlaceholder?null:wp.element.createElement("div",{className:e.column.getCanSort()?"cursor-pointer select-none":"",onClick:e.column.getToggleSortingHandler()},Fa(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(ic,{className:"w-4 h-4 text-black"}))):wp.element.createElement("td",{key:e.id,className:"py-4 px-2 text-gray-600"},Fa(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(Nl,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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==xc(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.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 l(e){Sc(a,n,o,l,i,"next",e)}function i(e){Sc(a,n,o,l,i,"throw",e)}l(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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(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),l=a[0],i=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,i(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:l,merchantName:s,merchantId:p,justConnected:h,autoPrompt:t,refreshStatus:y,disconnect:v}}function Lc(e){return Lc="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},Lc(e)}function Cc(){Cc=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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Lc(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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(Lc(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.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 l(e){Pc(a,n,o,l,i,"next",e)}function i(e){Pc(a,n,o,l,i,"throw",e)}l(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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(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)(),Fc=function(e){var r=e.children,n=Dr().settings,o=jc().isAuthenticated,a=Rc((0,t.useState)([]),2),l=a[0],i=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(Cc().mark((function e(){var t;return Cc().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,i(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"),T({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(Cc().mark((function e(){var t;return Cc().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,i(t.locations.data.locations),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),f("Failed to get locations"),T.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:l,loading:s,error:p,refetchLocations:d,setLocations:i}},r)},Tc=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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Dc(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.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 l(e){qc(a,n,o,l,i,"next",e)}function i(e){qc(a,n,o,l,i,"throw",e)}l(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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(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=Tc().setLocations,l=jc(),i=l.loading,c=l.isAuthenticated,s=l.merchantName,u=l.merchantId,m=l.refreshStatus,p=l.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),T.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:T.success("Square connection removed."),a([]),e.next=13;break;case 7:return e.prev=7,e.t0=e.catch(0),console.error(e.t0),T.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([]),T.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)"),i?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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Hc(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.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 l(e){Zc(a,n,o,l,i,"next",e)}function i(e){Zc(a,n,o,l,i,"throw",e)}l(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,children:[{name:"General",href:"/settings/inventory"},{name:"Modifiers",href:"/settings/modifiers",isPro:!0},{name:"Metafield Mapping",href:"/settings/metafield-mapping",isPro:!0},{name:"Discounts",href:"/settings/discounts",isPro:!0}]},{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 ir(),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§ion=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)):e.children?wp.element.createElement("li",{key:e.name},wp.element.createElement("div",null,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("ul",{className:"mt-1 ml-8 space-y-1"},e.children.map((function(e){return 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-600 hover:text-sky-600 hover:bg-gray-50","group flex gap-x-3 rounded-lg py-2 pl-2 pr-3 text-sm leading-5")},e.name,e.isPro&&wp.element.createElement("span",{className:"pro-badge ml-2 !relative text-xs"},"PRO")))}))))):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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==ns(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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 ls(e,t,r,n,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.done?t(c):Promise.resolve(c).then(n,o)}function is(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function l(e){ls(a,n,o,l,i,"next",e)}function i(e){ls(a,n,o,l,i,"throw",e)}l(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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return cs(e,t);var 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),l=a[0],i=a[1],c=function(){var e=is(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),T.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=is(os().mark((function e(t){var n,a,l,s;return os().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.target.value,i(!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 T.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(l=e.sent,!(s=l.oauthUrl)){e.next=21;break}return window.location.href=s,e.abrupt("return");case 21:T.success("Environment updated."),e.next=26;break;case 24:e.prev=24,e.t0=e.catch(2);case 26:return e.prev=26,i(!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:l},wp.element.createElement("option",{value:"live"},"Live"),wp.element.createElement("option",{value:"sandbox"},"Sandbox")))}function us(){ir();var e=Dr(),t=e.settings,r=e.updateSettings,n=e.settingsLoading,o=Tc(),a=o.locations,l=o.loading,i=(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:l,settings:t,refetchLocations:i})))}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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ds(e,t);var 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],l=o[1];return(0,e.useEffect)((function(){l(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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(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],l=o[1];return(0,e.useEffect)((function(){l(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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(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),l=a[0],i=a[1];(0,e.useEffect)((function(){i(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: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&&!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:l})}))))))};function Ls(e){return Ls="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},Ls(e)}function Cs(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?Cs(Object(r),!0).forEach((function(t){_s(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Cs(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"!=Ls(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=Ls(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ls(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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(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),l=a[0],i=a[1];(0,e.useEffect)((function(){i(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({},l),{},_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:l.stock||!1}];return wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6"},wp.element.createElement("div",{className:"mb-6"},wp.element.createElement("label",{className:"relative inline-flex items-center cursor-pointer"},wp.element.createElement("input",{type:"checkbox",checked:!1,className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Woo to Square")),l.isActive&&!o&&wp.element.createElement(React.Fragment,null,wp.element.createElement("p",{className:"mt-4"},"Sync stock on order processing. Stock/Inventory count is the the sole permitted auto-sync option from Woo to Square (other wise an infinite update loop is created, we don't want that). You can also manually sync from the product actions."),wp.element.createElement("ul",{className:"fit-content flex-wrap items-center justify-start text-sm font-medium text-gray-900 bg-white sm:flex"},s.map((function(e){return wp.element.createElement(c,{key:e.id,id:e.id,label:e.label,checked:e.checked,squareWoo:l})}))))))};var As=Object.defineProperty,Fs=(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 Ts=new class{constructor(){Fs(this,"current",this.detect()),Fs(this,"handoffState","pending"),Fs(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)=>{Ts.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),l=void 0!==e,i=(0,t.useRef)(l),c=(0,t.useRef)(!1),s=(0,t.useRef)(!1);return!l||i.current||c.current?!l&&i.current&&!s.current&&(s.current=!0,i.current=l,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")):(c.current=!0,i.current=l,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")),[l?e:o,Gs((e=>(l||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(Ts.isHandoffComplete);return n&&!1===Ts.isHandoffComplete&&o(!1),t.useEffect((()=>{!0!==n&&o(!0)}),[n]),t.useEffect((()=>Ts.handoff()),[]),!e&&n}(),[n,o]=t.useState(e?()=>Ts.nextId():null);return Ms((()=>{null===n&&o(Ts.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:l,mergeRefs:i}){i=null!=i?i:ru;let c=nu(t,e);if(a)return tu(c,r,n,l,i);let s=null!=o?o:0;if(2&s){let{static:e=!1,...t}=c;if(e)return tu(t,r,n,l,i)}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,l,i)})}return tu(c,r,n,l,i)}function tu(e,r={},n,o,a){let{as:l=n,children:i,refName:c="ref",...s}=lu(e,["unmount","static"]),u=void 0!==e.ref?{[c]:e.ref}:{},m="function"==typeof i?i(r):i;"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(l===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(lu(s,["ref"]))),p,u,{ref:a(m.ref,u.ref)},n))}return(0,t.createElement)(l,Object.assign({},lu(s,["ref"]),l!==t.Fragment&&u,l!==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 lu(e,t=[]){let r=Object.assign({},e);for(let e of t)e in r&&delete r[e];return r}var iu=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(iu||{});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(),l=Zs(t);return Ms((()=>a.register(n)),[n,a.register]),eu({ourProps:{ref:l,...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,l=xu(),i=Zs(t);Ms((()=>l.register(n)),[n,l.register]);let c={ref:i,...l.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:l.slot||{},defaultTag:"label",name:l.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:l=!1,onChange:i,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,i,l),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!==l&&S.addEventListener(t,"reset",(()=>{g(l)}))}),[f,g]),t.createElement(t.Fragment,null,null!=c&&h&&t.createElement(cu,{features:iu.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"}))})),Lu=Object.assign(ju,{Group:function(e){var r;let[n,o]=(0,t.useState)(null),[a,l]=Eu(),[i,c]=gu(),s=(0,t.useMemo)((()=>({switch:n,setSwitch:o,labelledby:a,describedby:i})),[n,o,a,i]),u=e;return t.createElement(c,{name:"Switch.Description"},t.createElement(l,{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 Cu=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(Lu,{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 Fu=function(r){var n,o,a,l,i,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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(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===(l=c.cron.dataToUpdate)||void 0===l?void 0:l.price)||!1},{id:"description",label:"Description",checked:(null===(i=c.cron.dataToUpdate)||void 0===i?void 0:i.description)||!1}],d=function(e){var t=e.id,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 Tu(e){return Tu="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},Tu(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"!=Tu(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=Tu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Tu(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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(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),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(Lu,{checked:l,onChange:function(e){i(e),n("cron",Du(Du({},r.cron),{},{source:e?"square":"woocommerce"}))},className:Za(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:Za(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:Za(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:Za(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(Fu,{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(Lu,{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(Lu,{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(Lu,{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 Ts.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,l=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&&l.length>1&&(l=l.filter((e=>!o.includes(e)))),n=null!=n?n:a.activeElement;let i,c=(()=>{if(5&t)return 1;if(10&t)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),s=(()=>{if(1&t)return 0;if(2&t)return Math.max(0,l.indexOf(n))-1;if(4&t)return Math.max(0,l.indexOf(n))+1;if(8&t)return l.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),u=32&t?{preventScroll:!0}:{},m=0,p=l.length;do{if(m>=p||m+p<=0)return 0;let e=s+m;if(16&t)e=(e+p)%p;else{if(e<0)return 3;if(e>=p)return 1}i=l[e],null==i||i.focus(u),m+=c}while(i!==a.activeElement);return 6&t&&function(e){var t,r;return null!=(r=null==(t=null==e?void 0:e.matches)?void 0:t.call(e,Ju))&&r}(i)&&i.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 lm(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,lm),t}return r}function im(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:l,form:i,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)(im,{options:[]}),g=d.options,[y,v]=Eu(),[w,b]=gu(),x=(0,t.useRef)(null),E=Zs(x,r),[S,k]=qs(a,s,l),N=(0,t.useMemo)((()=>g.find((e=>!e.propsRef.current.disabled))),[g]),O=(0,t.useMemo)((()=>g.some((e=>f(e.propsRef.current.value,S)))),[g,S]),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),l=(0,t.useRef)(n);(0,t.useEffect)((()=>{a.current=r,l.current=n}),[r,n]),Ms((()=>{if(!e||!o)return;let t=Uu(e);if(!t)return;let r=a.current,n=l.current,i=Object.assign((e=>r(e)),{acceptNode:r}),c=t.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,i,!1);for(;c.nextNode();)n(c.currentNode)}),[e,o,a,l])}({container:x.current,accept:e=>"radio"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT,walk(e){e.setAttribute("role","none")}});let L=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)}}})),C=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:C,change:j})),[C,j]),R={ref:E,id:o,role:"radiogroup","aria-labelledby":y,"aria-describedby":w,onKeyDown:L},I=(0,t.useMemo)((()=>({value:S})),[S]),A=(0,t.useRef)(null),F=Ws();return(0,t.useEffect)((()=>{A.current&&void 0!==l&&F.addEventListener(A.current,"reset",(()=>{j(l)}))}),[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:iu.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:i,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:l,disabled:i=!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]),l=(0,t.useCallback)((e=>Boolean(r&e)),[r]),i=(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:l,removeFlag:i,toggleFlag:c}}(1),v=Ds({value:l,disabled:i}),w=om("RadioGroup.Option"),b=lm("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(l)&&(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||i,O=w.compare(w.value,l),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},L=(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:L,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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(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)),l=a[0],i=a[1],c=pm((0,e.useState)(r.loyalty.redemptionMethod),2),s=c[0],u=c[1];return(0,e.useEffect)((function(){i(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(Lu,{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(Lu,{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:l,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(tl,{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(tl,{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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==xm(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.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 l(e){Om(a,n,o,l,i,"next",e)}function i(e){Om(a,n,o,l,i,"throw",e)}l(void 0)}))}}function Lm(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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Cm(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)?Cm(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 Cm(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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==_m(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.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 l(e){Im(a,n,o,l,i,"next",e)}function i(e){Im(a,n,o,l,i,"throw",e)}l(void 0)}))}}function Fm(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 Tm(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Fm(Object(r),!0).forEach((function(t){Mm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Fm(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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(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);const Vm=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 4.5v15m7.5-7.5h-15"}))})),Wm=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.568 3H5.25A2.25 2.25 0 0 0 3 5.25v4.318c0 .597.237 1.17.659 1.591l9.581 9.581c.699.699 1.78.872 2.607.33a18.095 18.095 0 0 0 5.223-5.223c.542-.827.369-1.908-.33-2.607L11.16 3.66A2.25 2.25 0 0 0 9.568 3Z"}),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 6h.008v.008H6V6Z"}))})),zm=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 14.25 6-6m4.5-3.493V21.75l-3.75-1.5-3.75 1.5-3.75-1.5-3.75 1.5V4.757c0-1.108.806-2.057 1.907-2.185a48.507 48.507 0 0 1 11.186 0c1.1.128 1.907 1.077 1.907 2.185ZM9.75 9h.008v.008H9.75V9Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm4.125 4.5h.008v.008h-.008V13.5Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z"}))})),Bm=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.5 6v.75m0 3v.75m0 3v.75m0 3V18m-9-5.25h5.25M7.5 15h3M3.375 5.25c-.621 0-1.125.504-1.125 1.125v3.026a2.999 2.999 0 0 1 0 5.198v3.026c0 .621.504 1.125 1.125 1.125h17.25c.621 0 1.125-.504 1.125-1.125v-3.026a2.999 2.999 0 0 1 0-5.198V6.375c0-.621-.504-1.125-1.125-1.125H3.375Z"}))}));var Um=[{path:"/",element:function(){return ir(),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(Tt,null)),wp.element.createElement("div",null,wp.element.createElement(ar,null)))}},{path:"/inventory",element:function(){ir();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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return zi(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)?zi(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 l(e){Wi(a,n,o,l,i,"next",e)}function i(e){Wi(a,n,o,l,i,"throw",e)}l(void 0)}))}}(Vi().mark((function e(){var t;return Vi().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(ji,{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(){ir();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 ir(),wp.element.createElement(us,null)}},{path:"/settings/general",element:us},{path:"/settings/payments",element:function(){ir();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],l=o[1],i=Dm((0,e.useState)(!0),2),c=i[0],s=i[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),T.error("Failed to update settings: ".concat(e.message))}))}),[]);var u=function(e){var t="yes"===r[e]?"no":"yes";n((function(r){return Tm(Tm({},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 l((function(e){return Tm(Tm({},e),{},Mm({},n,!0))})),e.next=3,p(t,r[t]);case 3:l((function(e){return Tm(Tm({},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,T.success("Settings updated successfully!"),e.abrupt("return",n);case 8:e.prev=8,e.t0=e.catch(0),T.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(Lu,{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(Tm(Tm({},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(Tm(Tm({},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(Tm(Tm({},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(Tm(Tm({},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 Tm(Tm({},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(Lu,{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(Lu,{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(){ir();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(Cu,{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(){ir();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(){ir();var t=Dr(),r=t.settings,n=t.updateSettings,o=t.settingsLoading,a=Lm((0,e.useState)([]),2),l=a[0],i=a[1],c=Lm((0,e.useState)(!0),2),s=c[0],u=c[1],m=Lm((0,e.useState)(),2),p=m[0],f=m[1],d=Lm((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),T({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){i(e),u(!1)})).catch((function(e){T({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(Lu,{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(Lu,{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(Lu,{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(Lu,{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(Lu,{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"),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: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(){ir();var t=Dr(),r=t.settings,n=t.updateSettings,o=wm((0,e.useState)(!1),2),a=o[0],l=(o[1],wm((0,e.useState)(""),2)),i=l[0],c=(l[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")),i&&wp.element.createElement("p",{className:"text-sm text-red-500 mt-2"},i),s&&!a&&wp.element.createElement(vm,{program:s}))))}},{path:"/settings/modifiers",element:function(){return ir(),wp.element.createElement(rs,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"},"Product Modifiers",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"},"Sync product modifiers between Square and WooCommerce. This feature allows you to manage product variations, add-ons, and customization options across both platforms seamlessly. Perfect for businesses offering customizable products like coffee with different sizes, pizza with toppings, or t-shirts with custom text."),wp.element.createElement("div",{className:"space-y-4"},wp.element.createElement("div",null,wp.element.createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},"Enable Modifier Sync"),wp.element.createElement(Lu,{checked:!1,className:"bg-gray-200 relative inline-flex h-6 w-11 items-center rounded-full",disabled:!0},wp.element.createElement("span",{className:"sr-only"},"Enable modifier sync"),wp.element.createElement("span",{className:"translate-x-1 inline-block h-4 w-4 transform rounded-full bg-white transition"}))),wp.element.createElement("div",null,wp.element.createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},"Auto-create Missing Modifiers"),wp.element.createElement(Lu,{checked:!1,className:"bg-gray-200 relative inline-flex h-6 w-11 items-center rounded-full",disabled:!0},wp.element.createElement("span",{className:"sr-only"},"Auto-create missing modifiers"),wp.element.createElement("span",{className:"translate-x-1 inline-block h-4 w-4 transform rounded-full bg-white transition"}))),wp.element.createElement("div",{className:"mt-6 p-4 bg-gray-50 rounded-lg"},wp.element.createElement("p",{className:"text-sm text-gray-600"},wp.element.createElement("strong",null,"Pro Feature:")," Upgrade to Square Sync Pro to unlock modifier syncing and take your product customization to the next level."),wp.element.createElement("a",{href:"https://squaresyncforwoo.com",target:"_blank",className:"mt-3 inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-sky-600 hover:bg-sky-700"},"Upgrade to Pro"))))))}},{path:"/settings/metafield-mapping",element:function(){return ir(),wp.element.createElement(rs,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"},"Metafield Mapping",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"},"Map custom fields between Square and WooCommerce to sync additional product data. This powerful feature lets you transfer custom attributes, metadata, and specialized fields between platforms, ensuring all your product information stays synchronized."),wp.element.createElement("div",{className:"space-y-4"},wp.element.createElement("div",null,wp.element.createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},"Enable Metafield Sync"),wp.element.createElement(Lu,{checked:!1,className:"bg-gray-200 relative inline-flex h-6 w-11 items-center rounded-full",disabled:!0},wp.element.createElement("span",{className:"sr-only"},"Enable metafield sync"),wp.element.createElement("span",{className:"translate-x-1 inline-block h-4 w-4 transform rounded-full bg-white transition"}))),wp.element.createElement("div",{className:"mt-6"},wp.element.createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},"Field Mappings"),wp.element.createElement("div",{className:"bg-white shadow overflow-hidden sm:rounded-md opacity-50"},wp.element.createElement("ul",{className:"divide-y divide-gray-200"},[{id:1,squareField:"item.custom_attribute_values",wooField:"meta_data.brand"},{id:2,squareField:"item.description_html",wooField:"short_description"},{id:3,squareField:"item.category_id",wooField:"categories"}].map((function(e){return wp.element.createElement("li",{key:e.id,className:"px-4 py-3"},wp.element.createElement("div",{className:"flex items-center justify-between"},wp.element.createElement("div",{className:"flex-1 grid grid-cols-2 gap-4"},wp.element.createElement("div",null,wp.element.createElement("label",{className:"block text-xs font-medium text-gray-500"},"Square Field"),wp.element.createElement("input",{type:"text",value:e.squareField,disabled:!0,className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm text-sm"})),wp.element.createElement("div",null,wp.element.createElement("label",{className:"block text-xs font-medium text-gray-500"},"WooCommerce Field"),wp.element.createElement("input",{type:"text",value:e.wooField,disabled:!0,className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm text-sm"}))),wp.element.createElement("button",{type:"button",disabled:!0,className:"ml-4 text-gray-400"},wp.element.createElement(gr,{className:"h-5 w-5"}))))})))),wp.element.createElement("button",{type:"button",disabled:!0,className:"mt-3 inline-flex items-center px-3 py-2 border border-gray-300 shadow-sm text-sm leading-4 font-medium rounded-md text-gray-400 bg-gray-100"},wp.element.createElement(Vm,{className:"h-4 w-4 mr-1"}),"Add Mapping")),wp.element.createElement("div",{className:"mt-6 p-4 bg-gray-50 rounded-lg"},wp.element.createElement("p",{className:"text-sm text-gray-600"},wp.element.createElement("strong",null,"Pro Feature:")," Upgrade to Square Sync Pro to unlock metafield mapping and sync all your custom product data seamlessly."),wp.element.createElement("a",{href:"https://squaresyncforwoo.com",target:"_blank",className:"mt-3 inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-sky-600 hover:bg-sky-700"},"Upgrade to Pro"))))))}},{path:"/settings/discounts",element:function(){return ir(),wp.element.createElement(rs,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"},"Discounts & Coupons",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"},"Synchronize discounts, coupons, and promotional codes between Square and WooCommerce. Keep your pricing strategies consistent across all sales channels and manage special offers from a single location."),wp.element.createElement("div",{className:"space-y-6"},wp.element.createElement("div",null,wp.element.createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},"Enable Discount Sync"),wp.element.createElement(Lu,{checked:!1,className:"bg-gray-200 relative inline-flex h-6 w-11 items-center rounded-full",disabled:!0},wp.element.createElement("span",{className:"sr-only"},"Enable discount sync"),wp.element.createElement("span",{className:"translate-x-1 inline-block h-4 w-4 transform rounded-full bg-white transition"}))),wp.element.createElement("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3"},wp.element.createElement("div",{className:"relative rounded-lg border border-gray-300 bg-white px-6 py-5 shadow-sm opacity-50"},wp.element.createElement("div",{className:"flex items-center space-x-3"},wp.element.createElement("div",{className:"flex-shrink-0"},wp.element.createElement(Wm,{className:"h-6 w-6 text-gray-400"})),wp.element.createElement("div",{className:"min-w-0 flex-1"},wp.element.createElement("p",{className:"text-sm font-medium text-gray-900"},"Fixed Amount"),wp.element.createElement("p",{className:"text-sm text-gray-500"},"$5, $10 off")))),wp.element.createElement("div",{className:"relative rounded-lg border border-gray-300 bg-white px-6 py-5 shadow-sm opacity-50"},wp.element.createElement("div",{className:"flex items-center space-x-3"},wp.element.createElement("div",{className:"flex-shrink-0"},wp.element.createElement(zm,{className:"h-6 w-6 text-gray-400"})),wp.element.createElement("div",{className:"min-w-0 flex-1"},wp.element.createElement("p",{className:"text-sm font-medium text-gray-900"},"Percentage"),wp.element.createElement("p",{className:"text-sm text-gray-500"},"10%, 25% off")))),wp.element.createElement("div",{className:"relative rounded-lg border border-gray-300 bg-white px-6 py-5 shadow-sm opacity-50"},wp.element.createElement("div",{className:"flex items-center space-x-3"},wp.element.createElement("div",{className:"flex-shrink-0"},wp.element.createElement(Bm,{className:"h-6 w-6 text-gray-400"})),wp.element.createElement("div",{className:"min-w-0 flex-1"},wp.element.createElement("p",{className:"text-sm font-medium text-gray-900"},"BOGO Deals"),wp.element.createElement("p",{className:"text-sm text-gray-500"},"Buy one get one"))))),wp.element.createElement("div",{className:"space-y-3"},wp.element.createElement("h4",{className:"text-sm font-medium text-gray-900"},"Sync Options"),wp.element.createElement("div",{className:"space-y-2"},wp.element.createElement("label",{className:"flex items-center"},wp.element.createElement("input",{type:"checkbox",disabled:!0,className:"h-4 w-4 rounded border-gray-300 text-sky-600"}),wp.element.createElement("span",{className:"ml-2 text-sm text-gray-600"},"Auto-sync new discounts")),wp.element.createElement("label",{className:"flex items-center"},wp.element.createElement("input",{type:"checkbox",disabled:!0,className:"h-4 w-4 rounded border-gray-300 text-sky-600"}),wp.element.createElement("span",{className:"ml-2 text-sm text-gray-600"},"Sync discount schedules")),wp.element.createElement("label",{className:"flex items-center"},wp.element.createElement("input",{type:"checkbox",disabled:!0,className:"h-4 w-4 rounded border-gray-300 text-sky-600"}),wp.element.createElement("span",{className:"ml-2 text-sm text-gray-600"},"Sync usage limits")))),wp.element.createElement("div",{className:"mt-6 p-4 bg-gray-50 rounded-lg"},wp.element.createElement("p",{className:"text-sm text-gray-600"},wp.element.createElement("strong",null,"Pro Feature:")," Upgrade to Square Sync Pro to unlock discount syncing and streamline your promotional campaigns across all channels."),wp.element.createElement("a",{href:"https://squaresyncforwoo.com",target:"_blank",className:"mt-3 inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-sky-600 hover:bg-sky-700"},"Upgrade to Pro"))))))}}];const Hm=Um;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 Zm(){Zm=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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==$m(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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 Ym(e,t,r,n,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.done?t(c):Promise.resolve(c).then(n,o)}function Km(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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Xm(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)?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 r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var Jm=(0,e.createContext)(),Qm=function(t){var r=t.children,n=Dr().settings,o=jc().isAuthenticated,a=Km((0,e.useState)({groups:[],segments:[]}),2),l=a[0],i=a[1],c=Km((0,e.useState)(!1),2),s=c[0],u=c[1],m=Km((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 l(e){Ym(a,n,o,l,i,"next",e)}function i(e){Ym(a,n,o,l,i,"throw",e)}l(void 0)}))}}(Zm().mark((function e(){var t;return Zm().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,i(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(Jm.Provider,{value:{groupsSegments:l,loading:s,error:p}},r)};const ep=function(e){var t=e.children;return wp.element.createElement(gl,null,wp.element.createElement(Mr,null,wp.element.createElement(Fc,null,wp.element.createElement(Qm,null,wp.element.createElement(Or,null,t)))))};function tp(e){return tp="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},tp(e)}function rp(){rp=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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==tp(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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(tp(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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 np(e,t,r,n,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.done?t(c):Promise.resolve(c).then(n,o)}function op(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function l(e){np(a,n,o,l,i,"next",e)}function i(e){np(a,n,o,l,i,"throw",e)}l(void 0)}))}}function ap(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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return lp(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)?lp(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 lp(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(t){var r=t.open,n=t.onOpenChange,o=t.mode,a=void 0===o?"loading":o,l=Tc(),i=l.locations,c=l.refetchLocations,s=Dr(),u=s.updateSettings,m=s.settings,p=s.settingsLoading,f=(0,e.useRef)(!1),d=ap((0,e.useState)(!1),2),h=d[0],g=d[1],y=ap((0,e.useState)(void 0),2),v=y[0],w=y[1],b=ap((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)(op(rp().mark((function e(){var t,r,n;return rp().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||i.length||(f.current=!0,E(!0),c().finally((function(){return E(!1)})))}),[a,i.length,c]);var N=function(){var e=op(rp().mark((function e(t){var r;return rp().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=T.loading("Saving location…"),e.prev=1,e.next=4,u("location",t);case 4:T.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),T.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"),i.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 cp(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,l,i=[],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)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return sp(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)?sp(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 sp(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 up(e){var r=e.children,n=jc(),o=n.loading,a=n.isAuthenticated,l=n.justConnected,i=n.autoPrompt,c=cp((0,t.useState)(!1),2),s=c[0],u=c[1],m=cp((0,t.useState)("loading"),2),p=m[0],f=m[1];return(0,t.useEffect)((function(){if(o)return f("loading"),void u(!0);l?(f("success"),u(!0)):!a&&i?(f("connect"),u(!0)):u(!1)}),[o,a,i,l]),wp.element.createElement(React.Fragment,null,r,wp.element.createElement(ip,{open:s,onOpenChange:u,mode:p}))}const mp=o.p+"images/logo.4a5282be.png";function pp(e){var t=e.to,r=e.children;return wp.element.createElement(Lt,{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 fp=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:mp,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(pp,{to:"/"},"Dashboard")),wp.element.createElement("li",{className:"".concat(r," pl-4")},wp.element.createElement(pp,{to:"/inventory"},"Products")),wp.element.createElement("li",{className:"".concat(r," pl-4")},wp.element.createElement(pp,{to:"/customers"},"Customers")),wp.element.createElement("li",{className:"".concat(r," pl-4")},wp.element.createElement(pp,{to:"/loyalty"},"Loyalty")),wp.element.createElement("li",{className:"".concat(r," pl-4")},wp.element.createElement(pp,{to:"/orders"},"Orders")),wp.element.createElement("li",{className:"".concat(r," pl-4")},wp.element.createElement(pp,{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 dp="persist:",hp="persist/FLUSH",gp="persist/REHYDRATE",yp="persist/PAUSE",vp="persist/PERSIST",bp="persist/PURGE",xp="persist/REGISTER";function Ep(e){return Ep="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},Ep(e)}function Sp(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 kp(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Np(e){return JSON.stringify(e)}function Op(e){return JSON.parse(e)}function jp(e){}function Lp(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 Cp(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Lp(r,!0).forEach((function(t){Pp(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Lp(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}function _p(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 Rp(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 Ip(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Rp(r,!0).forEach((function(t){Ap(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Rp(r).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Ap(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Fp={registry:[],bootstrapped:!1},Tp=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Fp,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case xp:return Ip({},e,{registry:[].concat(_p(e.registry),[t.key])});case gp:var r=e.registry.indexOf(t.key),n=_p(e.registry);return n.splice(r,1),Ip({},e,{registry:n,bootstrapped:0===n.length});default:return e}},Mp=o(181);function Dp(e){return Dp="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},Dp(e)}function Gp(){Gp=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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Dp(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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(Dp(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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 qp(e,t,r,n,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.done?t(c):Promise.resolve(c).then(n,o)}function Vp(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function l(e){qp(a,n,o,l,i,"next",e)}function i(e){qp(a,n,o,l,i,"throw",e)}l(void 0)}))}}function Wp(){return zp.apply(this,arguments)}function zp(){return(zp=Vp(Gp().mark((function e(){var t;return Gp().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 Bp=function(){var e=Vp(Gp().mark((function e(){var t,r;return Gp().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("Fetching Customer Groups and Roles"),t=T.loading("Retrieving Customer Groups and Roles"),e.prev=2,e.next=5,Wp();case 5:return r=e.sent,T.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),T.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)}}(),Up=function(){var e=Vp(Gp().mark((function e(t){var r,n;return Gp().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("Saving Role Mappings"),r=T.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 T.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),T.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)}}(),Hp=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=Vp(Gp().mark((function a(l){var i,c;return Gp().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if(a.prev=0,i=null,e)try{localStorage.removeItem("customersData")}catch(e){console.warn("Failed to remove data from local storage:",e)}else{try{i=localStorage.getItem("customersData")}catch(e){console.warn("Failed to retrieve data from local storage:",e)}i&&setTimeout((function(){var e=JSON.parse(i);return r({status:"success",data:e})}),100)}return a.next=5,zt({path:"/sws/v1/customers".concat(l&&e?"?force=true":"")});case 5:if(c=a.sent,console.log(c),c.loading)l&&T.info("Fetching data, please wait...",{autoClose:2e3,hideProgressBar:!1,closeOnClick:!1}),setTimeout((function(){return o(!1)}),t);else if(0===c.data.length)T.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)}T.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),T.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 $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 Zp(){Zp=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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==$p(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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($p(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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 Yp(e,t,r,n,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.done?t(c):Promise.resolve(c).then(n,o)}function Kp(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function l(e){Yp(a,n,o,l,i,"next",e)}function i(e){Yp(a,n,o,l,i,"throw",e)}l(void 0)}))}}var Xp=No("customerGroupsAndRoles/fetchIfNeeded",Kp(Zp().mark((function e(){var t,r,n,o,a,l,i,c,s=arguments;return Zp().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(),l=a.customerGroupsAndRoles,i=0,c=function(){var e=Kp(Zp().mark((function e(){var r;return Zp().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!t&&(l.data.groups.length||l.data.roles.length)){e.next=12;break}return e.next=4,Bp();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",l.data);case 13:e.next=27;break;case 15:if(e.prev=15,e.t0=e.catch(0),!(i<1)){e.next=25;break}return i++,console.warn("Retrying fetch groups and roles (".concat(i,"/").concat(1,")...")),e.next=22,c();case 22:return e.abrupt("return",e.sent);case 25:return console.error("Max retries reached. Unable to fetch groups and roles."),e.abrupt("return",o(e.t0.message));case 27:case"end":return e.stop()}}),e,null,[[0,15]])})));return function(){return e.apply(this,arguments)}}(),e.next=8,c();case 8:return e.abrupt("return",e.sent);case 9:case"end":return e.stop()}}),e)})))),Jp=No("customerGroupsAndRoles/saveMappings",function(){var e=Kp(Zp().mark((function e(t,r){var n,o,a,l;return Zp().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,Up(t);case 8:if("success"!==(l=e.sent).status){e.next=13;break}return e.abrupt("return",{roleMappings:l.roleMappings});case 13:throw new Error(l.error);case 14:e.next=19;break;case 16:return e.prev=16,e.t0=e.catch(1),e.abrupt("return",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 Qp=bo({name:"customerGroupsAndRoles",initialState:{data:{groups:[],roles:{},roleMappings:{}},loading:!1,error:null},reducers:{},extraReducers:function(e){e.addCase(Xp.pending,(function(e){e.loading=!0})).addCase(Xp.fulfilled,(function(e,t){e.loading=!1,e.data=t.payload,e.error=null})).addCase(Xp.rejected,(function(e,t){e.loading=!1,e.data={groups:[],roles:{},roleMappings:{}},e.error=t.payload})).addCase(Jp.pending,(function(e){e.loading=!0})).addCase(Jp.fulfilled,(function(e,t){e.loading=!1,e.data.roleMappings=t.payload.roleMappings,e.error=null})).addCase(Jp.rejected,(function(e,t){e.loading=!1,e.error=t.payload}))}}).reducer;function ef(e){return ef="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},ef(e)}function tf(){tf=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:{},l=a.iterator||"@@iterator",i=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,l=Object.create(a.prototype),i=new P(n||[]);return o(l,"_invoke",{value:O(e,r,i)}),l}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,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==r&&n.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function r(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==ef(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,l,i)}),(function(e){r("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,i)}))}i(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,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(n.method=a,n.arg=l;;){var i=n.delegate;if(i){var c=j(i,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 l=a.arg;return l?l.done?(r[t.resultName]=l.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):l:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[l];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(ef(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var l=new N(u(e,r,n,o),a);return t.isGeneratorFunction(r)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),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(C),!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 i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var 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 l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(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;C(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 rf(e,t,r,n,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void r(e)}i.done?t(c):Promise.resolve(c).then(n,o)}function nf(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function l(e){rf(a,n,o,l,i,"next",e)}function i(e){rf(a,n,o,l,i,"throw",e)}l(void 0)}))}}var of,af,lf,cf,sf,uf,mf,pf,ff,df,hf=No("customers/fetchIfNeeded",nf(tf().mark((function e(){var t,r,n,o,a,l,i,c,s=arguments;return tf().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(),l=a.customers,!t&&null!==l.data){e.next=24;break}return e.prev=4,e.next=7,Hp(t);case 7:if("success"!==(i=e.sent).status){e.next=12;break}return e.abrupt("return",i.data);case 12:if("loading"!==i.status){e.next=16;break}return e.abrupt("return",o("Data is being fetched, please wait..."));case 16:throw new Error(i.error);case 17:e.next=22;break;case 19:return e.prev=19,e.t0=e.catch(4),e.abrupt("return",o(e.t0.message));case 22:e.next=44;break;case 24:if(!l.loading){e.next=43;break}return e.prev=25,e.next=28,Hp(!1);case 28:if("success"!==(c=e.sent).status){e.next=33;break}return e.abrupt("return",c.data);case 33:if("loading"!==c.status){e.next=37;break}return e.abrupt("return",o("Data is being fetched, please wait..."));case 37:throw new Error(c.error);case 38:e.next=43;break;case 40:return e.prev=40,e.t1=e.catch(25),e.abrupt("return",o(e.t1.message));case 43:return e.abrupt("return",l.data);case 44:case"end":return e.stop()}}),e,null,[[4,19],[25,40]])})))),gf=Yn({inventory:Gi,licence:Ao,orders:oc,customerGroupsAndRoles:Qp,customers:bo({name:"customers",initialState:{data:null,loading:!1,error:null,fetchAttempted:!1},reducers:{},extraReducers:function(e){e.addCase(hf.pending,(function(e){e.loading=!0,e.fetchAttempted=!0})).addCase(hf.fulfilled,(function(e,t){e.loading=!1,e.data=t.payload,e.error=null})).addCase(hf.rejected,(function(e,t){e.loading=!1,e.data=[],e.error=t.payload}))}}).reducer}),yf={key:"root",storage:Mp.A,whitelist:["inventory","customerGroupsAndRoles","customers"]},vf=(af=gf,lf=void 0!==(of=yf).version?of.version:-1,cf=void 0===of.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?Sp(r,!0).forEach((function(t){kp(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Sp(r).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},r);return e&&"object"===Ep(e)&&Object.keys(e).forEach((function(n){"_persist"!==n&&t[n]===r[n]&&(o[n]=e[n])})),o}:of.stateReconciler,sf=of.getStoredState||function(e){var t,r=e.transforms||[],n="".concat(void 0!==e.keyPrefix?e.keyPrefix:dp).concat(e.key),o=e.storage;return e.debug,t=!1===e.deserialize?function(e){return e}:"function"==typeof e.deserialize?e.deserialize:Op,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}}))},uf=void 0!==of.timeout?of.timeout:5e3,mf=null,pf=!1,ff=!0,df=function(e){return e._persist.rehydrated&&mf&&!ff&&mf.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===vp){var a=!1,l=function(e,r){a||(t.rehydrate(of.key,e,r),a=!0)};if(uf&&setTimeout((function(){!a&&l(void 0,new Error('redux-persist: persist timed out for persist key "'.concat(of.key,'"')))}),uf),ff=!1,mf||(mf=function(e){var t,r=e.blacklist||null,n=e.whitelist||null,o=e.transforms||[],a=e.throttle||0,l="".concat(void 0!==e.keyPrefix?e.keyPrefix:dp).concat(e.key),i=e.storage;t=!1===e.serialize?function(e){return e}:"function"==typeof e.serialize?e.serialize:Np;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=i.setItem(l,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()}}}(of)),n)return Cp({},af(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(of.key),sf(of).then((function(e){var t=of.migrate||function(e,t){return Promise.resolve(e)};t(e,lf).then((function(e){l(e)}),(function(e){l(void 0,e)}))}),(function(e){l(void 0,e)})),Cp({},af(o,t),{_persist:{version:lf,rehydrated:!1}})}if(t.type===bp)return pf=!0,t.result(function(e){var t=e.storage,r="".concat(void 0!==e.keyPrefix?e.keyPrefix:dp).concat(e.key);return t.removeItem(r,jp)}(of)),Cp({},af(o,t),{_persist:n});if(t.type===hp)return t.result(mf&&mf.flush()),Cp({},af(o,t),{_persist:n});if(t.type===yp)ff=!0;else if(t.type===gp){if(pf)return Cp({},o,{_persist:Cp({},n,{rehydrated:!0})});if(t.key===of.key){var i=af(o,t),c=t.payload,s=Cp({},!1!==cf&&void 0!==c?cf(c,e,i,of):i,{_persist:Cp({},n,{rehydrated:!0})});return df(s)}}if(!n)return af(e,t);var u=af(o,t);return u===o?e:df(Cp({},u,{_persist:n}))}),wf=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,l=n.middleware,i=void 0===l?r():l,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=i;"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:vf,middleware:function(e){return e({serializableCheck:!1})}}),bf=function(e,t,r){var n=!1,o=Zn(Tp,Fp,void 0),a=function(e){o.dispatch({type:xp,key:e})},l=function(t,r,a){var l={type:gp,payload:r,err:a,key:t};e.dispatch(l),o.dispatch(l),n&&i.getState().bootstrapped&&(n(),n=!1)},i=Ip({},o,{purge:function(){var t=[];return e.dispatch({type:bp,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:yp})},persist:function(){e.dispatch({type:vp,register:a,rehydrate:l})}});return i.persist(),i}(wf),xf=document.getElementById("square-woo-sync");null!=xf&&(0,e.createRoot)(xf).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:l="once"}){const i=t.useMemo((()=>{const t=function(e,t){let r,n=J,o=0,a=!1;function l(){s.onStateChange&&s.onStateChange()}function i(){o++,r||(r=t?t.addNestedSub(l):e.subscribe(l),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){i();const t=n.subscribe(e);let r=!1;return()=>{r||(r=!0,t(),c())}},notifyNestedSubs:function(){n.notify()},handleChangeWrapper:l,isSubscribed:function(){return a},trySubscribe:function(){a||(a=!0,i())},tryUnsubscribe:function(){a&&(a=!1,c())},getListeners:()=>n};return s}(e);return{store:e,subscription:t,getServerState:o?()=>o:void 0,stabilityCheck:a,noopCheck:l}}),[e,o,a,l]),c=t.useMemo((()=>e.getState()),[e]);Q((()=>{const{subscription:t}=i;return t.onStateChange=t.notifyNestedSubs,t.trySubscribe(),c!==e.getState()&&t.notifyNestedSubs(),()=>{t.tryUnsubscribe(),t.onStateChange=void 0}}),[i,c]);const s=r||U;return t.createElement(s.Provider,{value:i},n)}),{store:wf},wp.element.createElement(fe,{loading:null,persistor:bf},wp.element.createElement((function(){return wp.element.createElement(kt,null,wp.element.createElement(fp,null,wp.element.createElement(ep,null,wp.element.createElement(up,null,wp.element.createElement(gt,null,Hm.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
r3360322 r3360355 2 2 msgid "" 3 3 msgstr "" 4 "Project-Id-Version: Square Sync for Woo commerce 6.0.3\n"4 "Project-Id-Version: Square Sync for WooCommerce 6.0.4\n" 5 5 "Report-Msgid-Bugs-To: https://github.com/LiamHillier/square-woo-sync/issues\n" 6 6 "Last-Translator: liam@pixeldev.com.au\n" … … 9 9 "Content-Type: text/plain; charset=UTF-8\n" 10 10 "Content-Transfer-Encoding: 8bit\n" 11 "POT-Creation-Date: 2025-09-12T0 7:56:50+00:00\n"11 "POT-Creation-Date: 2025-09-12T08:46:59+00:00\n" 12 12 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 13 13 "X-Generator: WP-CLI 2.12.0\n" … … 15 15 16 16 #. Plugin Name of the plugin 17 msgid "Square Sync for Woo commerce"17 msgid "Square Sync for WooCommerce" 18 18 msgstr "" 19 19 -
squarewoosync/trunk/readme.txt
r3319082 r3360355 4 4 Tags: square,product sync,woocommerce square,payments 5 5 Requires at least: 5.4 6 Tested up to: 6. 76 Tested up to: 6.8 7 7 Requires PHP: 7.4 8 Stable tag: 6.0. 38 Stable tag: 6.0.4 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 110 110 111 111 == Changelog == 112 = 6.0.4 = 113 * Added Pro feature previews for Modifiers, Metafield Mapping, and Discounts 114 * Enhanced settings UI with expandable Products menu 115 * Improved navigation structure for Pro features 116 112 117 = 6.0.3 = 113 118 * Update 0auth url -
squarewoosync/trunk/squarewoosync.php
r3319082 r3360355 2 2 3 3 /** 4 * Plugin Name: Square Sync for Woo commerce4 * Plugin Name: Square Sync for WooCommerce 5 5 * Requires Plugins: woocommerce 6 6 * Plugin URI: https://squaresyncforwoo.com … … 12 12 * License URI: http://www.gnu.org/licenses/gpl-2.0.html 13 13 * Domain Path: /languages 14 * Version: 6.0. 314 * Version: 6.0.4 15 15 * Requires at least: 5.4 16 16 * Requires PHP: 7.4 … … 31 31 final class SquareWooSync 32 32 { 33 const VERSION = '6.0. 3';33 const VERSION = '6.0.4'; 34 34 const SLUG = 'squarewoosync'; 35 35 -
squarewoosync/trunk/vendor/composer/installed.php
r3360322 r3360355 4 4 'pretty_version' => 'dev-main', 5 5 'version' => 'dev-main', 6 'reference' => ' cc9665fe33995df830e7294f2b243a257ea82faa',6 'reference' => '45e3bfbe55c4bfb796abc13b322146fb13f2dcef', 7 7 'type' => 'project', 8 8 'install_path' => __DIR__ . '/../../', … … 14 14 'pretty_version' => 'dev-main', 15 15 'version' => 'dev-main', 16 'reference' => ' cc9665fe33995df830e7294f2b243a257ea82faa',16 'reference' => '45e3bfbe55c4bfb796abc13b322146fb13f2dcef', 17 17 'type' => 'project', 18 18 'install_path' => __DIR__ . '/../../',
Note: See TracChangeset
for help on using the changeset viewer.