Plugin Directory

Changeset 3377796


Ignore:
Timestamp:
10/14/2025 02:05:51 AM (4 months ago)
Author:
squarewoosync
Message:

Bug fix

Location:
squarewoosync
Files:
115 added
12 edited

Legend:

Unmodified
Added
Removed
  • squarewoosync/trunk/build/index.asset.php

    r3360355 r3377796  
    1 <?php return array('dependencies' => array('lodash', 'moment', 'react', 'react-dom', 'wp-api-fetch', 'wp-element'), 'version' => '1ac55004bebe425a484c');
     1<?php return array('dependencies' => array('lodash', 'moment', 'react', 'react-dom', 'wp-api-fetch', 'wp-element'), 'version' => '6beb243d427c1e2c88a0');
  • squarewoosync/trunk/build/index.js

    r3360355 r3377796  
    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&section=squaresync_credit",className:Za(location.hash.replace(/^#/,"")===e.href?"bg-gray-50 text-sky-600":"text-gray-700 hover:text-sky-600 hover:bg-gray-50","group flex gap-x-3 rounded-lg py-2 pl-2 pr-3 text-sm leading-6 font-semibold")},wp.element.createElement(e.icon,{className:Za(location.hash.replace(/^#/,"")===e.href?"text-sky-600":"text-gray-400 group-hover:text-sky-600","h-6 w-6 shrink-0"),"aria-hidden":"true"}),e.name)):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)))))})()})();
     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:"\r absolute \r hidden\r bottom-full \r mb-2 \r w-max\r rounded \r bg-gray-800\r px-2 \r py-1 \r text-sm \r text-white \r z-50\r right-full\r group-hover:block \r transition-opacity\r "},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\r ring-1 ring-inset ring-gray-300 placeholder:text-gray-400\r 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 \r 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&section=squaresync_credit",className:Za(location.hash.replace(/^#/,"")===e.href?"bg-gray-50 text-sky-600":"text-gray-700 hover:text-sky-600 hover:bg-gray-50","group flex gap-x-3 rounded-lg py-2 pl-2 pr-3 text-sm leading-6 font-semibold")},wp.element.createElement(e.icon,{className:Za(location.hash.replace(/^#/,"")===e.href?"text-sky-600":"text-gray-400 group-hover:text-sky-600","h-6 w-6 shrink-0"),"aria-hidden":"true"}),e.name)):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/includes/Payments/WC_SquareSync_Gateway.php

    r3312562 r3377796  
    6868
    6969    add_action('woocommerce_update_options_payment_gateways_' . $this->id, [$this, 'process_admin_options']);
    70     add_action('wp_enqueue_scripts', [$this, 'enqueue_scripts']);
     70    add_action('wp_enqueue_scripts', [$this, 'enqueue_scripts'], 9);
    7171    add_filter('woocommerce_checkout_fields', [$this, 'remove_credit_card_fields']);
    7272    // Hook for saving the options
  • squarewoosync/trunk/includes/REST/OrdersController.php

    r3225869 r3377796  
    561561      $quantity = $item->get_quantity();
    562562
    563       // Calculate the price based on whether tax is inclusive or not
    564       $price = $taxes_enabled ? wc_get_price_excluding_tax($product) : $product->get_price();
     563      // Use the actual price paid from the order item, not the current product price
     564      // This ensures that if a product was on sale at the time of purchase, we sync the sale price
     565      if ($taxes_enabled && $is_tax_inclusive) {
     566        // Get the line total excluding tax (what the customer paid before tax)
     567        $price = $item->get_subtotal() / $quantity;
     568      } else {
     569        // Get the line total (what the customer actually paid per item)
     570        $price = $item->get_total() / $quantity;
     571      }
    565572      $price_cents = round($price * $multiplier);
    566573
  • squarewoosync/trunk/languages/square-woo-sync.pot

    r3360355 r3377796  
    1 # Copyright (c) 2025 Liam Hillier. All Rights Reserved.
     1# Copyright (c) $(date +'%Y') Liam Hillier. All Rights Reserved.
    22msgid ""
    33msgstr ""
    4 "Project-Id-Version: Square Sync for WooCommerce 6.0.4\n"
    5 "Report-Msgid-Bugs-To: https://github.com/LiamHillier/square-woo-sync/issues\n"
    6 "Last-Translator: [email protected]\n"
     4"Project-Id-Version: Square Sync for WooCommerce 6.0.5\n"
     5"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/square-woo-sync\n"
     6"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
    77"Language-Team: LANGUAGE <[email protected]>\n"
    88"MIME-Version: 1.0\n"
    99"Content-Type: text/plain; charset=UTF-8\n"
    1010"Content-Transfer-Encoding: 8bit\n"
    11 "POT-Creation-Date: 2025-09-12T08:46:59+00:00\n"
     11"POT-Creation-Date: 2025-10-14T02:02:09+00:00\n"
    1212"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1313"X-Generator: WP-CLI 2.12.0\n"
    14 "X-Domain: squarewoosync\n"
     14"X-Domain: 'squarewoosync'\n"
    1515
    1616#. Plugin Name of the plugin
     17#: squarewoosync.php
    1718msgid "Square Sync for WooCommerce"
    1819msgstr ""
     
    2021#. Plugin URI of the plugin
    2122#. Author URI of the plugin
     23#: squarewoosync.php
    2224msgid "https://squaresyncforwoo.com"
    2325msgstr ""
    2426
    2527#. Description of the plugin
     28#: squarewoosync.php
    2629msgid "Easily Sync your WooCommerce Square data in real-time with the SquareSync for Woo. Stock, titles, descriptions, orders and more."
    2730msgstr ""
    2831
    2932#. Author of the plugin
     33#: squarewoosync.php
    3034msgid "SquareSync for Woo"
    3135msgstr ""
    32 
    33 #: includes/Abstracts/RESTController.php:35
    34 #: includes/Payments/WC_SquareSync_Gateway.php:1744
    35 msgid "Nonce verification failed"
    36 msgstr ""
    37 
    38 #: includes/Admin/Menu.php:43
    39 msgid "SquareSync"
    40 msgstr ""
    41 
    42 #: includes/Admin/Menu.php:46
    43 msgid "Dashboard"
    44 msgstr ""
    45 
    46 #: includes/Admin/Menu.php:47
    47 msgid "Products"
    48 msgstr ""
    49 
    50 #: includes/Admin/Menu.php:48
    51 msgid "Customers"
    52 msgstr ""
    53 
    54 #: includes/Admin/Menu.php:49
    55 msgid "Orders"
    56 msgstr ""
    57 
    58 #: includes/Admin/Menu.php:50
    59 #: squarewoosync.php:278
    60 msgid "Settings"
    61 msgstr ""
    62 
    63 #: includes/Logger/Logger.php:156
    64 msgid "Error fetching logs from the database."
    65 msgstr ""
    66 
    67 #: includes/Payments/WC_SquareSync_Gateway.php:210
    68 #, php-format
    69 msgid "Subscription renewal of %1$s via Square succeeded. Transaction ID: %2$s"
    70 msgstr ""
    71 
    72 #: includes/Payments/WC_SquareSync_Gateway.php:217
    73 #, php-format
    74 msgid "Square renewal failed: %s"
    75 msgstr ""
    76 
    77 #: includes/Payments/WC_SquareSync_Gateway.php:1461
    78 msgid "Invalid payment method. Please try again."
    79 msgstr ""
    80 
    81 #: includes/Payments/WC_SquareSync_Gateway.php:1576
    82 #: includes/Payments/WC_SquareSync_Gateway.php:1795
    83 msgid "There was a problem saving your payment method."
    84 msgstr ""
    85 
    86 #: includes/Payments/WC_SquareSync_Gateway.php:1643
    87 msgid "Payment error: "
    88 msgstr ""
    89 
    90 #: includes/Payments/WC_SquareSync_Gateway.php:1723
    91 #, php-format
    92 msgid "Payment of %1$s via Square successfully completed (Square Transaction ID: %2$s)"
    93 msgstr ""
    94 
    95 #: includes/Payments/WC_SquareSync_Gateway.php:1732
    96 msgid "Payment error: An unexpected error occurred. Please try again."
    97 msgstr ""
    98 
    99 #: includes/Payments/WC_SquareSync_Gateway.php:1752
    100 msgid "Payment token is missing."
    101 msgstr ""
    102 
    103 #: includes/Payments/WC_SquareSync_Gateway.php:1764
    104 msgid "Could not retrieve or create Square customer."
    105 msgstr ""
    106 
    107 #: includes/Payments/WC_SquareSync_Gateway.php:1773
    108 msgid "There was a problem adding your payment method: Invalid card data."
    109 msgstr ""
    110 
    111 #: includes/Payments/WC_SquareSync_Gateway.php:1793
    112 msgid "Payment method added successfully."
    113 msgstr ""
    114 
    115 #: includes/REST/LogController.php:89
    116 msgid "Unable to retrieve logs"
    117 msgstr ""
    118 
    119 #: includes/REST/LogController.php:108
    120 msgid "Invalid log parameters"
    121 msgstr ""
    122 
    123 #: includes/REST/LogController.php:110
    124 msgid "Log parameters are missing or incomplete"
    125 msgstr ""
    126 
    127 #: includes/REST/LogController.php:116
    128 msgid "success"
    129 msgstr ""
    130 
    131 #: includes/REST/LogController.php:118
    132 msgid "Invalid argument: "
    133 msgstr ""
    134 
    135 #: includes/REST/LogController.php:124
    136 msgid "Exception encountered: "
    137 msgstr ""
    138 
    139 #: includes/REST/OrdersController.php:86
    140 #: includes/REST/OrdersController.php:88
    141 msgid "Square Orders error: "
    142 msgstr ""
    143 
    144 #: includes/REST/OrdersController.php:97
    145 msgid "Square Orders API error: "
    146 msgstr ""
    147 
    148 #: includes/REST/OrdersController.php:99
    149 #: includes/REST/OrdersController.php:112
    150 msgid "Square API error: "
    151 msgstr ""
    152 
    153 #: includes/REST/OrdersController.php:110
    154 msgid "Square Payment API error: "
    155 msgstr ""
    156 
    157 #: includes/REST/OrdersController.php:128
    158 msgid "Order and Transaction created in Square, receipt: #"
    159 msgstr ""
    160 
    161 #: includes/REST/OrdersController.php:148
    162 msgid "Order created in Square"
    163 msgstr ""
    164 
    165 #: includes/REST/OrdersController.php:155
    166 msgid "Failed to create order: "
    167 msgstr ""
    168 
    169 #: includes/REST/OrdersController.php:962
    170 msgid "Woocommerce not installed or activated"
    171 msgstr ""
    172 
    173 #: includes/REST/SquareController.php:64
    174 msgid "Search query for products (name, sku, or square product id)."
    175 msgstr ""
    176 
    177 #: includes/REST/SquareController.php:69
    178 msgid "Category filter."
    179 msgstr ""
    180 
    181 #: includes/REST/SquareController.php:74
    182 msgid "Status filter."
    183 msgstr ""
    184 
    185 #: includes/REST/SquareController.php:79
    186 msgid "Page number."
    187 msgstr ""
    188 
    189 #: includes/REST/SquareController.php:85
    190 msgid "Number of items per page."
    191 msgstr ""
    192 
    193 #: includes/Square/SquareImport.php:147
    194 msgid "Deleted invalid product: "
    195 msgstr ""
    196 
    197 #: includes/Square/SquareImport.php:173
    198 msgid "Successfully synced: "
    199 msgstr ""
    200 
    201 #: includes/Square/SquareImport.php:173
    202 msgid " from Square to Woo"
    203 msgstr ""
    204 
    205 #: includes/Square/SquareInventory.php:303
    206 msgid "Unknown Option"
    207 msgstr ""
    208 
    209 #: includes/Square/SquareInventory.php:304
    210 msgid "Unknown Value"
    211 msgstr ""
    212 
    213 #: includes/Woo/CreateOrder.php:347
    214 msgid "Discount"
    215 msgstr ""
    216 
    217 #: includes/Woo/CreateOrder.php:390
    218 msgid "Order status updated based on Square order state and payment status."
    219 msgstr ""
    220 
    221 #: includes/Woo/CreateOrder.php:391
    222 #, php-format
    223 msgid "Order status set to %s based on Square state: %s"
    224 msgstr ""
    225 
    226 #: includes/Woo/CreateOrder.php:435
    227 msgid "Square Shipping"
    228 msgstr ""
    229 
    230 #: includes/Woo/CreateOrder.php:477
    231 #, php-format
    232 msgid "Shipping method with ID %s not found."
    233 msgstr ""
    234 
    235 #. translators: %s: WP_Error message
    236 #: includes/Woo/CreateProduct.php:856
    237 #, php-format
    238 msgid "Error creating category: %s"
    239 msgstr ""
    240 
    241 #: includes/Woo/CreateProduct.php:857
    242 msgid "unknown error"
    243 msgstr ""
    244 
    245 #: includes/Woo/SyncProduct.php:1235
    246 msgid "Unlock the full power of SquareSync for Woo with Pro:"
    247 msgstr ""
    248 
    249 #: includes/Woo/SyncProduct.php:1239
    250 msgid "Real-time, two-way product & stock sync"
    251 msgstr ""
    252 
    253 #: includes/Woo/SyncProduct.php:1240
    254 msgid "Location-aware inventory & taxes"
    255 msgstr ""
    256 
    257 #: includes/Woo/SyncProduct.php:1241
    258 msgid "Square Loyalty earn & redeem at checkout"
    259 msgstr ""
    260 
    261 #: includes/Woo/SyncProduct.php:1242
    262 msgid "Automatic POS ↔ WooCommerce order sync"
    263 msgstr ""
    264 
    265 #: includes/Woo/SyncProduct.php:1243
    266 msgid "Priority support & self-healing scheduler"
    267 msgstr ""
    268 
    269 #: includes/Woo/SyncProduct.php:1249
    270 msgid "Go Pro"
    271 msgstr ""
    272 
    273 #: includes/Woo/SyncProduct.php:1677
    274 msgid "Sync to Square"
    275 msgstr ""
    276 
    277 #: includes/Woo/SyncProduct.php:1724
    278 msgid "Sync to Square initiated."
    279 msgstr ""
    280 
    281 #: includes/Woo/SyncProduct.php:1729
    282 msgid "A sync job is already running. Please wait until the current job finishes."
    283 msgstr ""
    284 
    285 #: includes/Woo/WooImport.php:119
    286 msgid "Export to Square"
    287 msgstr ""
    288 
    289 #: includes/Woo/WooImport.php:122
    290 msgid "Export to Square (All Pages)"
    291 msgstr ""
    292 
    293 #: includes/Woo/WooImport.php:212
    294 msgid "Export/Sync job initiated."
    295 msgstr ""
    296 
    297 #: includes/Woo/WooImport.php:215
    298 msgid "A job is already running. Please wait until it finishes."
    299 msgstr ""
    300 
    301 #: includes/Woo/WooImport.php:515
    302 msgid "WooCommerce must be installed."
    303 msgstr ""
    304 
    305 #: includes/Woo/WooImport.php:578
    306 msgid "Failed to import products: "
    307 msgstr ""
    308 
    309 #: includes/Woo/WooImport.php:662
    310 msgid "Square batch-upsert failed: "
    311 msgstr ""
    312 
    313 #: includes/Woo/WooImport.php:676
    314 msgid "Failed to process products: "
    315 msgstr ""
    316 
    317 #: squarewoosync.php:123
    318 msgid "SquareWooSync requires WooCommerce to be installed and activated."
    319 msgstr ""
    320 
    321 #: squarewoosync.php:219
    322 msgid "SquareSync for Woo is not yet connected to your Square account. Connect now to start syncing products and accepting payments"
    323 msgstr ""
    324 
    325 #: squarewoosync.php:224
    326 msgid "Connect Square"
    327 msgstr ""
    328 
    329 #: squarewoosync.php:279
    330 msgid "Documentation"
    331 msgstr ""
    332 
    333 #: squarewoosync.php:359
    334 msgid "Additional Roles"
    335 msgstr ""
    336 
    337 #: squarewoosync.php:362
    338 msgid "Roles"
    339 msgstr ""
    340 
    341 #: templates/emails/plain/square-gift-card.php:23
    342 #: templates/emails/square-gift-card.php:27
    343 msgid "Friend"
    344 msgstr ""
    345 
    346 #: templates/emails/plain/square-gift-card.php:24
    347 #: templates/emails/square-gift-card.php:29
    348 msgid "Someone"
    349 msgstr ""
    350 
    351 #: templates/emails/plain/square-gift-card.php:31
    352 #: templates/emails/square-gift-card.php:35
    353 #, php-format
    354 msgid "Hello %s,"
    355 msgstr ""
    356 
    357 #: templates/emails/plain/square-gift-card.php:37
    358 #: templates/emails/square-gift-card.php:46
    359 #, php-format
    360 msgid "%s just sent you a gift card! Below are the details:"
    361 msgstr ""
    362 
    363 #: templates/emails/plain/square-gift-card.php:43
    364 #: templates/emails/square-gift-card.php:62
    365 msgid "Gift Card Number:"
    366 msgstr ""
    367 
    368 #: templates/emails/plain/square-gift-card.php:48
    369 msgid "Gift Card Balance:"
    370 msgstr ""
    371 
    372 #: templates/emails/plain/square-gift-card.php:53
    373 #: templates/emails/square-gift-card.php:82
    374 msgid "A Message From the Sender:"
    375 msgstr ""
    376 
    377 #: templates/emails/plain/square-gift-card.php:58
    378 msgid "HOW TO REDEEM YOUR GIFT CARD"
    379 msgstr ""
    380 
    381 #: templates/emails/plain/square-gift-card.php:60
    382 msgid "1) Visit our store and add your desired products to the cart."
    383 msgstr ""
    384 
    385 #: templates/emails/plain/square-gift-card.php:61
    386 msgid "2) Proceed to checkout and find the Gift Card or Promo Code field."
    387 msgstr ""
    388 
    389 #: templates/emails/plain/square-gift-card.php:62
    390 msgid "3) Enter your Gift Card Number (GAN) and apply it to your order."
    391 msgstr ""
    392 
    393 #: templates/emails/plain/square-gift-card.php:63
    394 msgid "Any remaining balance stays on the card for future use (per store policy)."
    395 msgstr ""
    396 
    397 #: templates/emails/plain/square-gift-card.php:65
    398 msgid "If you have any questions, please contact our support team."
    399 msgstr ""
    400 
    401 #: templates/emails/plain/square-gift-card.php:68
    402 #: templates/emails/square-gift-card.php:114
    403 #, php-format
    404 msgid "Thank you for shopping with %s!"
    405 msgstr ""
    406 
    407 #: templates/emails/square-gift-card.php:55
    408 msgid "Your new gift card details are below:"
    409 msgstr ""
    410 
    411 #: templates/emails/square-gift-card.php:72
    412 msgid "Gift card balance:"
    413 msgstr ""
    414 
    415 #: templates/emails/square-gift-card.php:89
    416 msgid "How to Redeem Your Gift Card"
    417 msgstr ""
    418 
    419 #: templates/emails/square-gift-card.php:92
    420 msgid "Visit our store and add your desired products to the cart."
    421 msgstr ""
    422 
    423 #: templates/emails/square-gift-card.php:95
    424 msgid "Proceed to checkout and locate the Gift Card field."
    425 msgstr ""
    426 
    427 #: templates/emails/square-gift-card.php:98
    428 msgid "Enter the Gift Card Number above and apply it to your order."
    429 msgstr ""
    430 
    431 #: templates/emails/square-gift-card.php:102
    432 msgid "The gift card balance will be applied to your total. Any remaining balance stays on the card for future use.."
    433 msgstr ""
    434 
    435 #: templates/emails/square-gift-card.php:107
    436 msgid "If you have any questions, feel free to contact our support team."
    437 msgstr ""
    438 
    439 #: build/blocks/giftcard.js:1
    440 msgid "Unable to apply gift card."
    441 msgstr ""
    442 
    443 #: build/blocks/giftcard.js:1
    444 msgid "Unable to remove gift card."
    445 msgstr ""
    446 
    447 #: build/blocks/giftcard.js:1
    448 msgid "Gift Card Applied:"
    449 msgstr ""
    450 
    451 #: build/blocks/giftcard.js:1
    452 msgid "Remove Gift Card"
    453 msgstr ""
    454 
    455 #: build/blocks/giftcard.js:1
    456 msgid "Redeem a gift card"
    457 msgstr ""
    458 
    459 #: build/blocks/giftcard.js:1
    460 msgid "Enter code"
    461 msgstr ""
    462 
    463 #: build/blocks/giftcard.js:1
    464 msgid "Apply"
    465 msgstr ""
  • squarewoosync/trunk/readme.txt

    r3360355 r3377796  
    66Tested up to: 6.8
    77Requires PHP: 7.4
    8 Stable tag: 6.0.4
     8Stable tag: 6.0.5
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    110110
    111111== Changelog ==
     112= 6.0.5 =
     113* Bug fix: manual order syncing to Square sale price issue
     114
    112115= 6.0.4 =
    113116* Added Pro feature previews for Modifiers, Metafield Mapping, and Discounts
  • squarewoosync/trunk/squarewoosync.php

    r3360355 r3377796  
    1212 * License URI:     http://www.gnu.org/licenses/gpl-2.0.html
    1313 * Domain Path:     /languages
    14  * Version:         6.0.4
     14 * Version:         6.0.5
    1515 * Requires at least: 5.4
    1616 * Requires PHP:      7.4
     
    3131final class SquareWooSync
    3232{
    33   const VERSION = '6.0.4';
     33  const VERSION = '6.0.5';
    3434  const SLUG = 'squarewoosync';
    3535
  • squarewoosync/trunk/vendor/autoload.php

    r3360322 r3377796  
    1515        }
    1616    }
    17     throw new RuntimeException($err);
     17    trigger_error(
     18        $err,
     19        E_USER_ERROR
     20    );
    1821}
    1922
    2023require_once __DIR__ . '/composer/autoload_real.php';
    2124
    22 return ComposerAutoloaderInit3312963fe60a80247da6d7a666f01d85::getLoader();
     25return ComposerAutoloaderInit77adc2aa9f013b4913312e8682d2c2d1::getLoader();
  • squarewoosync/trunk/vendor/composer/InstalledVersions.php

    r3360322 r3377796  
    2828{
    2929    /**
    30      * @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to
    31      * @internal
    32      */
    33     private static $selfDir = null;
    34 
    35     /**
    3630     * @var mixed[]|null
    3731     * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
    3832     */
    3933    private static $installed;
    40 
    41     /**
    42      * @var bool
    43      */
    44     private static $installedIsLocalDir;
    4534
    4635    /**
     
    321310        self::$installed = $data;
    322311        self::$installedByVendor = array();
    323 
    324         // when using reload, we disable the duplicate protection to ensure that self::$installed data is
    325         // always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not,
    326         // so we have to assume it does not, and that may result in duplicate data being returned when listing
    327         // all installed packages for example
    328         self::$installedIsLocalDir = false;
    329     }
    330 
    331     /**
    332      * @return string
    333      */
    334     private static function getSelfDir()
    335     {
    336         if (self::$selfDir === null) {
    337             self::$selfDir = strtr(__DIR__, '\\', '/');
    338         }
    339 
    340         return self::$selfDir;
    341312    }
    342313
     
    352323
    353324        $installed = array();
    354         $copiedLocalDir = false;
    355325
    356326        if (self::$canGetVendors) {
    357             $selfDir = self::getSelfDir();
    358327            foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
    359                 $vendorDir = strtr($vendorDir, '\\', '/');
    360328                if (isset(self::$installedByVendor[$vendorDir])) {
    361329                    $installed[] = self::$installedByVendor[$vendorDir];
     
    363331                    /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
    364332                    $required = require $vendorDir.'/composer/installed.php';
    365                     self::$installedByVendor[$vendorDir] = $required;
    366                     $installed[] = $required;
    367                     if (self::$installed === null && $vendorDir.'/composer' === $selfDir) {
    368                         self::$installed = $required;
    369                         self::$installedIsLocalDir = true;
     333                    $installed[] = self::$installedByVendor[$vendorDir] = $required;
     334                    if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
     335                        self::$installed = $installed[count($installed) - 1];
    370336                    }
    371                 }
    372                 if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) {
    373                     $copiedLocalDir = true;
    374337                }
    375338            }
     
    388351        }
    389352
    390         if (self::$installed !== array() && !$copiedLocalDir) {
     353        if (self::$installed !== array()) {
    391354            $installed[] = self::$installed;
    392355        }
  • squarewoosync/trunk/vendor/composer/autoload_real.php

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

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

    r3360355 r3377796  
    44        'pretty_version' => 'dev-main',
    55        'version' => 'dev-main',
    6         'reference' => '45e3bfbe55c4bfb796abc13b322146fb13f2dcef',
     6        'reference' => '98412ff28ec4320ea97258d78ec023c8e8488ab2',
    77        'type' => 'project',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-main',
    1515            'version' => 'dev-main',
    16             'reference' => '45e3bfbe55c4bfb796abc13b322146fb13f2dcef',
     16            'reference' => '98412ff28ec4320ea97258d78ec023c8e8488ab2',
    1717            'type' => 'project',
    1818            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.