(()=>{var e={106:(e,t)=>{!function(){var e={814:function(e,t,n){var o;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(){"use strict";var a={}.hasOwnProperty;function i(){for(var e=[],t=0;t0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,r,a){"string"==typeof e&&(e=[[null,e,void 0]]);var i={};if(o)for(var l=0;l0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=a),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),r&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=r):u[4]="".concat(r)),t.push(u))}},t}},499:function(e){"use strict";e.exports=function(e){return e[1]}},245:function(e,t,n){"use strict";var o=n(499),r=n.n(o),a=n(922),i=n.n(a)()(r());i.push([e.id,':root{--wp-admin-theme-color: #007cba;--wp-admin-theme-color--rgb: 0,124,186;--wp-admin-theme-color-darker-10: #006ba1;--wp-admin-theme-color-darker-10--rgb: 0,107,160.5;--wp-admin-theme-color-darker-20: #005a87;--wp-admin-theme-color-darker-20--rgb: 0,90,135;--wp-admin-border-width-focus: 2px}@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi){:root{--wp-admin-border-width-focus: 1.5px}}.codeamp-components-multi-select-control__input-container{font-size:13px;line-height:normal}.codeamp-components-multi-select-control__input-container{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;padding:6px 8px;box-shadow:0 0 0 transparent;transition:box-shadow 0.1s linear;border-radius:2px;border:1px solid #757575;font-size:16px;line-height:normal;width:100%;margin:0 0 8px 0;padding:0;cursor:text}@media (prefers-reduced-motion: reduce){.codeamp-components-multi-select-control__input-container{transition-duration:0s;transition-delay:0s}}@media (min-width: 600px){.codeamp-components-multi-select-control__input-container{font-size:13px;line-height:normal}}.codeamp-components-multi-select-control__input-container:focus{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color);outline:2px solid transparent}.codeamp-components-multi-select-control__input-container::-webkit-input-placeholder{color:rgba(30,30,30,0.62)}.codeamp-components-multi-select-control__input-container::-moz-placeholder{opacity:1;color:rgba(30,30,30,0.62)}.codeamp-components-multi-select-control__input-container:-ms-input-placeholder{color:rgba(30,30,30,0.62)}.codeamp-components-multi-select-control__input-container.is-disabled{background:#ddd;border-color:#ddd}.codeamp-components-multi-select-control__input-container.is-active{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color);outline:2px solid transparent}.codeamp-components-multi-select-control__input-container input[type="text"].codeamp-components-multi-select-control__input{display:inline-block;flex:1;font-family:inherit;font-size:16px;width:100%;max-width:100%;margin-left:4px;padding:0;min-height:24px;min-width:50px;background:inherit;border:0;color:#1e1e1e;box-shadow:none}@media (min-width: 600px){.codeamp-components-multi-select-control__input-container input[type="text"].codeamp-components-multi-select-control__input{font-size:13px}}.codeamp-components-multi-select-control__input-container input[type="text"].codeamp-components-multi-select-control__input:focus,.codeamp-components-multi-select-control.is-active .codeamp-components-multi-select-control__input-container input[type="text"].codeamp-components-multi-select-control__input{outline:none;box-shadow:none}.codeamp-components-multi-select-control__input-container .codeamp-components-multi-select-control__token+input[type="text"].codeamp-components-multi-select-control__input{width:auto}.codeamp-components-multi-select-control__help{font-size:12px;font-style:normal;color:#757575}.codeamp-components-multi-select-control__tokens-container{padding:4px}.codeamp-components-multi-select-control__token{font-size:13px;display:flex;color:#1e1e1e;max-width:100%}.codeamp-components-multi-select-control__token.is-borderless{position:relative;padding:0 24px 0 0}.codeamp-components-multi-select-control__token.is-borderless .codeamp-components-multi-select-control__token-text{background:transparent;color:var(--wp-admin-theme-color)}.codeamp-components-multi-select-control__token.is-borderless .codeamp-components-multi-select-control__remove-token{background:transparent;color:#757575;position:absolute;top:1px;right:0;padding:0}.codeamp-components-multi-select-control__token.is-borderless.is-success .codeamp-components-multi-select-control__token-text{color:#4ab866}.codeamp-components-multi-select-control__token.is-borderless.is-error .codeamp-components-multi-select-control__token-text{color:#cc1818;border-radius:4px 0 0 4px;padding:0 4px 0 6px}.codeamp-components-multi-select-control__token.is-borderless.is-validating .codeamp-components-multi-select-control__token-text{color:#1e1e1e}.codeamp-components-multi-select-control__token.is-disabled .codeamp-components-multi-select-control__remove-token{cursor:default}.codeamp-components-multi-select-control__token-text,.codeamp-components-multi-select-control__remove-token.components-button{display:inline-block;line-height:24px;height:auto;background:#ddd;min-width:unset;transition:all 0.2s cubic-bezier(0.4, 1, 0.4, 1)}@media (prefers-reduced-motion: reduce){.codeamp-components-multi-select-control__token-text,.codeamp-components-multi-select-control__remove-token.components-button{transition-duration:0s;transition-delay:0s;animation-duration:1ms;animation-delay:0s}}.codeamp-components-multi-select-control__token-text{border-radius:2px 0 0 2px;padding:0 0 0 8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.codeamp-components-multi-select-control__remove-token.components-button{cursor:pointer;border-radius:0 2px 2px 0;padding:0 2px;color:#1e1e1e;line-height:10px;overflow:initial}.codeamp-components-multi-select-control__remove-token.components-button:hover{color:#1e1e1e}.codeamp-components-multi-select-control__suggestions-list{flex:1 0 100%;min-width:100%;max-height:9em;overflow-y:auto;transition:all 0.15s ease-in-out;list-style:none;border-top:1px solid #757575;margin:0;padding:0}@media (prefers-reduced-motion: reduce){.codeamp-components-multi-select-control__suggestions-list{transition-duration:0s;transition-delay:0s}}.codeamp-components-multi-select-control__no-suggestions{color:#757575;font-size:13px;margin:0;display:block;padding:4px 8px}.codeamp-components-multi-select-control__suggestion{color:#757575;display:block;font-size:13px;padding:4px 8px;margin:0;cursor:pointer}.codeamp-components-multi-select-control__suggestion.is-selected{background:var(--wp-admin-theme-color);color:#fff}.codeamp-components-multi-select-control__suggestion-match{text-decoration:underline}\n',""]),t.Z=i},313:function(e,t,n){"use strict";var o=n(499),r=n.n(o),a=n(922),i=n.n(a)()(r());i.push([e.id,".codeamp-components-resource-select-control>.components-base-control__field{position:relative;display:flex;flex-wrap:wrap}.codeamp-components-resource-select-control>.components-base-control__field>.components-base-control__label{flex:2}.codeamp-components-resource-select-control__label{margin-bottom:8px}.codeamp-components-resource-select-control__add_button{padding:0;margin:0;min-height:revert;height:auto;color:var(--wp-admin-theme-color);align-self:center;justify-content:right;margin-bottom:8px}.codeamp-components-resource-select-control__add_button:hover{text-decoration:underline}.codeamp-components-resource-select-control__edit_button.components-button.is-secondary{height:auto;margin-bottom:0}.codeamp-components-resource-select-control__select{width:auto;flex:1}.codeamp-components-resource-select-control .components-base-control{margin-bottom:0}.codeamp-components-resource-select-control .components-base-control__field{margin-bottom:0}.codeamp-components-resource-select-control .components-base-control{flex:1}\n",""]),t.Z=i},379:function(e){"use strict";var t=[];function n(e){for(var n=-1,o=0;o0?" ".concat(n.layer):""," {")),o+=n.css,r&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var a=n.sourceMap;a&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},589:function(e){"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}}},n={};function o(t){var r=n[t];if(void 0!==r)return r.exports;var a=n[t]={id:t,exports:{}};return e[t](a,a.exports,o),a.exports}o.amdO={},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,{a:t}),t},o.d=function(e,t){for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.nc=void 0;var r={};!function(){"use strict";o.r(r),o.d(r,{MultiSelectControl:function(){return ve},ResourceSelectControl:function(){return x}});var e=window.wp.i18n,t=window.wp.components,n=window.wp.compose,a=o(379),i=o.n(a),l=o(795),s=o.n(l),c=o(569),u=o.n(c),d=o(565),p=o.n(d),m=o(216),f=o.n(m),g=o(589),_=o.n(g),h=o(313),y={};y.styleTagTransform=_(),y.setAttributes=p(),y.insert=u().bind(null,"head"),y.domAPI=s(),y.insertStyleElement=f(),i()(h.Z,y),h.Z&&h.Z.locals&&h.Z.locals;var b=o(814),v=o.n(b);function w(){return w=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,o=new Array(t);ne.length)&&(t=e.length);for(var n=0,o=new Array(t);n=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,I),d=function(e){return function(e){if(Array.isArray(e))return e}(e)||function(e){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,r=[],a=!0,i=!1;try{for(t=t.call(e);!(a=(n=t.next()).done)&&(r.push(n.value),2!==r.length);a=!0);}catch(e){i=!0,o=e}finally{try{a||null==t.return||t.return()}finally{if(i)throw o}}return r}}(e)||function(e){if(e){if("string"==typeof e)return R(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?R(e,2):void 0}}(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,C.useState)(!1)),p=d[0],m=d[1],f=n?n.length+1:0;return React.createElement("input",N({ref:t,id:r,type:"text"},u,{value:n||"",onChange:function(e){l&&l({value:e.target.value})},onFocus:function(e){m(!0),null==s||s(e)},onBlur:function(e){m(!1),null==c||c(e)},size:f,className:v()(i,"codeamp-components-multi-select-control__input"),autoComplete:"off",role:"combobox","aria-expanded":o,"aria-autocomplete":"list","aria-owns":o?"".concat(r,"-suggestions"):void 0,"aria-activedescendant":p&&-1!==a&&o?"".concat(r,"-suggestions-").concat(a):void 0,"aria-describedby":"".concat(r,"-howto"),"data-lpignore":"true"}))}));function L(e){return L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},L(e)}function j(e){return j="function"==typeof Symbol&&"symbol"===L(Symbol.iterator)?function(e){return L(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":L(e)},j(e)}function B(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function F(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function z(e,t){var n=e["page".concat(t?"Y":"X","Offset")],o="scroll".concat(t?"Top":"Left");if("number"!=typeof n){var r=e.document;"number"!=typeof(n=r.documentElement[o])&&(n=r.body[o])}return n}function G(e){return z(e)}function W(e){return z(e,!0)}function H(e){var t=function(e){var t,n,o,r=e.ownerDocument,a=r.body,i=r&&r.documentElement;return n=(t=e.getBoundingClientRect()).left,o=t.top,{left:n-=i.clientLeft||a.clientLeft||0,top:o-=i.clientTop||a.clientTop||0}}(e),n=e.ownerDocument,o=n.defaultView||n.parentWindow;return t.left+=G(o),t.top+=W(o),t}var U,V=new RegExp("^(".concat(/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,")(?!px)[a-z%]+$"),"i"),$=/^(top|right|bottom|left)$/;function X(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,o=new Array(t);n-1&&r&&e.children[o]&&(f(!0),function(e,t,n){n=n||{},9===t.nodeType&&(t=re.getWindow(t));var o=n.allowHorizontalScroll,r=n.onlyScrollIfNeeded,a=n.alignWithTop,i=n.alignWithLeft,l=n.offsetTop||0,s=n.offsetLeft||0,c=n.offsetBottom||0,u=n.offsetRight||0;o=void 0===o||o;var d,p,m,f,g,_,h,y,b,v,w=re.isWindow(t),S=re.offset(e),E=re.outerHeight(e),x=re.outerWidth(e);w?(h=t,v=re.height(h),b=re.width(h),y={left:re.scrollLeft(h),top:re.scrollTop(h)},g={left:S.left-y.left-s,top:S.top-y.top-l},_={left:S.left+x-(y.left+b)+u,top:S.top+E-(y.top+v)+c},f=y):(d=re.offset(t),p=t.clientHeight,m=t.clientWidth,f={left:t.scrollLeft,top:t.scrollTop},g={left:S.left-(d.left+(parseFloat(re.css(t,"borderLeftWidth"))||0))-s,top:S.top-(d.top+(parseFloat(re.css(t,"borderTopWidth"))||0))-l},_={left:S.left+x-(d.left+m+(parseFloat(re.css(t,"borderRightWidth"))||0))+u,top:S.top+E-(d.top+p+(parseFloat(re.css(t,"borderBottomWidth"))||0))+c}),g.top<0||_.top>0?!0===a?re.scrollTop(t,f.top+g.top):!1===a?re.scrollTop(t,f.top+_.top):g.top<0?re.scrollTop(t,f.top+g.top):re.scrollTop(t,f.top+_.top):r||((a=void 0===a||!!a)?re.scrollTop(t,f.top+g.top):re.scrollTop(t,f.top+_.top)),o&&(g.left<0||_.left>0?!0===i?re.scrollLeft(t,f.left+g.left):!1===i?re.scrollLeft(t,f.left+_.left):g.left<0?re.scrollLeft(t,f.left+g.left):re.scrollLeft(t,f.left+_.left):r||((i=void 0===i||!!i)?re.scrollLeft(t,f.left+g.left):re.scrollLeft(t,f.left+_.left)))}(e.children[o],e,{onlyScrollIfNeeded:!0}),t=requestAnimationFrame((function(){f(!1)}))),function(){void 0!==t&&cancelAnimationFrame(t)}}),[o,r]),_=function(e){return function(){m||null==i||i(e)}},h=function(e){return function(){null==l||l(e)}};return React.createElement("ul",{ref:g,className:"codeamp-components-multi-select-control__suggestions-list",id:"".concat(u,"-suggestions"),role:"listbox"},0===c.length&&React.createElement("li",{className:"codeamp-components-multi-select-control__no-suggestions",role:"option"},(0,e.__)("No results found.","codeamp-block-components")),c.map((function(e,t){var n,r=function(e){var t=e.label.toLocaleLowerCase().indexOf(a);return{suggestionBeforeMatch:e.label.substring(0,t),suggestionMatch:e.label.substring(t,t+a.length),suggestionAfterMatch:e.label.substring(t+a.length)}}(e),i=v()("codeamp-components-multi-select-control__suggestion",{"is-selected":t===o});return n="function"==typeof d?d({item:e}):r?React.createElement("span",{"aria-label":e.label},r.suggestionBeforeMatch,React.createElement("strong",{className:"codeamp-components-multi-select-control__suggestion-match"},r.suggestionMatch),r.suggestionAfterMatch):e.label,React.createElement("li",{id:"".concat(u,"-suggestions-").concat(t),role:"option",className:i,key:e.value,onMouseDown:ie,onClick:h(e),onMouseEnter:_(e),"aria-selected":t===o},n)})))},se=o(245),ce={};function ue(){return ue=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,o=new Array(t);n1&&void 0!==arguments[1]?arguments[1]:[]).find((function(e){return-1!==e.label.toLocaleLowerCase().indexOf(t.trim().toLocaleLowerCase())}));return n}ce.styleTagTransform=_(),ce.setAttributes=p(),ce.insert=u().bind(null,"head"),ce.domAPI=s(),ce.insertStyleElement=f(),i()(se.Z,ce),se.Z&&se.Z.locals&&se.Z.locals;var be=function(){};function ve(o){var r=o.autoCapitalize,a=o.autoComplete,i=o.maxLength,l=o.placeholder,s=o.label,c=void 0===s?(0,e.__)("Add item"):s,u=o.help,d=o.className,p=o.suggestions,m=void 0===p?[]:p,f=o.options,g=void 0===f?[]:f,_=o.maxSuggestions,h=void 0===_?100:_,y=o.value,b=void 0===y?[]:y,w=o.onChange,S=void 0===w?function(){}:w,E=o.onInputChange,x=void 0===E?function(){}:E,T=o.onFocus,A=void 0===T?void 0:T,P=(o.isBorderless,o.id),O=o.disabled,I=void 0!==O&&O,N=o.messages,R=void 0===N?{added:(0,e.__)("Item added."),removed:(0,e.__)("Item removed."),remove:(0,e.__)("Remove item"),__experimentalInvalid:(0,e.__)("Invalid item")}:N,L=o.__experimentalRenderItem,j=o.__experimentalAutoSelectFirstMatch,B=void 0===j||j,F=o.__experimentalValidateInput,z=void 0===F?function(){return!0}:F,G=o.__experimentalCloseSuggestionsOnSelect,W=void 0===G||G,H=o.__next36pxDefaultSize,U=void 0!==H&&H,V=(0,n.useInstanceId)(ve,"codeamp-components-multi-select-control");P&&(V=P);var $=ge((0,C.useState)(""),2),X=$[0],Z=$[1],Y=ge((0,C.useState)(0),2),K=Y[0],J=Y[1],Q=ge((0,C.useState)(!1),2),ee=Q[0],te=Q[1],ne=ge((0,C.useState)(!1),2),oe=ne[0],re=ne[1],ae=ge((0,C.useState)(-1),2),ie=ae[0],se=ae[1],ce=ge((0,C.useState)(!1),2),_e=ce[0],he=ce[1],we=(0,n.usePrevious)(m),Se=(0,n.usePrevious)(b),Ee=(0,C.useRef)(null),xe=(0,C.useRef)(null),Ce=(0,n.useDebounce)(k.speak,500);function ke(){var e;null===(e=Ee.current)||void 0===e||e.focus()}function Te(){var e;return Ee.current===(null===(e=Ee.current)||void 0===e?void 0:e.ownerDocument.activeElement)}function qe(e){Te()||e.target===xe.current?(te(!0),re(!0)):te(!1),"function"==typeof A&&A(e)}function Ae(e){e.target===xe.current&&ee&&e.preventDefault()}function Pe(e){Re(e.value),ke()}function Oe(e){var t=!1;return Te()&&Fe()&&(e(),t=!0),t}function De(){var e=Be()-1;e>-1&&Re(b[e])}function Ie(){var e=Be();e0){var t=fe(b);t.splice.apply(t,[Be(),0].concat(fe(e))),S(t)}}([e.value]),(0,k.speak)(R.added,"assertive"),Z(""),he(!1),se(-1),W&&re(!1),ee&&ke()):(0,k.speak)(R.__experimentalInvalid,"assertive")}function Re(e){var t=b.filter((function(t){return Me(t)!==Me(e)}));S(t),(0,k.speak)(R.removed,"assertive")}function Me(e){return"object"===me(e)?e.value:e}function Le(){return g.filter((function(e){return-1===b.indexOf(e.value)}))}function je(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:X,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Le(),n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:h;if(""!==e.trim()){var o=[],r=[];t.forEach((function(t){var n=t.label.toLocaleLowerCase().indexOf(e.trim().toLocaleLowerCase());0===n?o.push(t):n>0&&r.push(t)})),t=o.concat(r)}return t.slice(0,n)}function Be(){return b.length-K}function Fe(){return 0===X.length}function ze(){var e,t;return(null===(e=ye(X))||void 0===e||null===(t=e.label)||void 0===t?void 0:t.length)>0}function Ge(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=je(X),o=n.length>0;t&&(B&&o?(se(0),he(!0)):(se(-1),he(!1))),se(0);var r=o?(0,e.sprintf)((0,e._n)("%d result found, use up and down arrow keys to navigate.","%d results found, use up and down arrow keys to navigate.",n.length),n.length):(0,e.__)("No results.");Ce(r,"assertive")}(0,C.useEffect)((function(){ee&&!Te()&&ke()}),[ee]),(0,C.useEffect)((function(){var e=!q()(m,we||[]);(e||b!==Se)&&Ge(e)}),[m,we,b,Se]),(0,C.useEffect)((function(){Ge()}),[X]),I&&ee&&(te(!1),Z(""));var We,He,Ue=v()(d,"codeamp-components-multi-select-control__input-container",{"is-active":ee,"is-disabled":I}),Ve={className:"components-base-control codeamp-components-multi-select-control",tabIndex:-1},$e=je();return I||(Ve=Object.assign({},Ve,{onKeyDown:function(e){var t=!1;if(!e.defaultPrevented){switch(e.code){case"Backspace":t=Oe(De);break;case"Enter":case"Space":t=function(){var e=!1,t=function(){if(-1!==ie)return je()[ie]}();return t&&oe?(Ne(t),e=!0):ze()&&""!==X.trim()&&(Ne(X),e=!0),e}();break;case"ArrowLeft":t=function(){var e=!1;return Fe()&&(J((function(e){return Math.min(e+1,b.length)})),e=!0),e}();break;case"ArrowUp":t=oe?(se((function(e){return(0===e?je(X,Le(),b,h).length:e)-1})),he(!0),!0):(re(!0),se(0),he(!0),!0);break;case"ArrowRight":t=function(){var e=!1;return Fe()&&(J((function(e){return Math.max(e-1,0)})),e=!0),e}();break;case"ArrowDown":t=oe?(se((function(e){return(e+1)%je(X,Le(),b,h).length})),he(!0),!0):(re(!0),se(0),he(!0),!0);break;case"Delete":t=Oe(Ie);break;case"Escape":t=function(e){return e.target instanceof HTMLInputElement&&(Z(e.target.value),re(!1),se(-1),he(!1)),!0}(e)}t&&e.preventDefault()}},onKeyPress:function(e){var t=!1;44===e.charCode&&(ze()&&Ne(X),t=!0),t&&e.preventDefault()},onFocus:qe})),React.createElement(t.BaseControl,{id:V,label:c,help:u},React.createElement("div",Ve,React.createElement("div",{ref:xe,className:Ue,tabIndex:-1,onMouseDown:Ae,onTouchStart:Ae},React.createElement(t.Flex,{className:"codeamp-components-multi-select-control__tokens-container",justify:"flex-start",align:"flex-start",gap:"4px",wrap:!0,__next36pxDefaultSize:U,hasTokens:!!b.length},(He=b.map((function(e){return g.find((function(t){return t.value===e}))||null})).map((function(e,n){return function(e,n){var o=e.value,r=e.label,a=e.onMouseEnter,i=void 0===a?be:a,l=e.onMouseLeave,s=void 0===l?be:l,c=e.isBorderless,u=void 0!==c&&c,d=o,p=n+1;return React.createElement(t.FlexItem,{key:"token-"+d},React.createElement(D,{value:d,label:r,title:"string"!=typeof token?r:void 0,onClickRemove:Pe,isBorderless:u,onMouseEnter:i,onMouseLeave:s,disabled:I,messages:R,termPosition:p,termsCount:b.length}))}(function(e){for(var t=1;t=i?void 0:function(e){var t=e.value;Z(t),re(!0),x(t)},ref:Ee})))),He)),oe&&React.createElement(le,{instanceId:V,match:ye(X,g),searchValue:X.trim(),suggestions:$e,selectedIndex:ie,scrollIntoView:_e,onHover:function(e){var t=je().indexOf(e);t>=0&&(se(t),he(!1))},onSelect:function(e){Ne(e)},__experimentalRenderItem:L}))))}}();var a=t;for(var i in r)a[i]=r[i];r.__esModule&&Object.defineProperty(a,"__esModule",{value:!0})}()},418:(e,t,n)=>{"use strict";var o=n(609),r=Symbol.for("react.element"),a=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),i=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};t.jsx=function(e,t,n){var o,s={},c=null,u=null;for(o in void 0!==n&&(c=""+n),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(u=t.ref),t)a.call(t,o)&&!l.hasOwnProperty(o)&&(s[o]=t[o]);if(e&&e.defaultProps)for(o in t=e.defaultProps)void 0===s[o]&&(s[o]=t[o]);return{$$typeof:r,type:e,key:c,ref:u,props:s,_owner:i.current}}},706:(e,t,n)=>{"use strict";e.exports=n(418)},413:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.Doctype=t.CDATA=t.Tag=t.Style=t.Script=t.Comment=t.Directive=t.Text=t.Root=t.isTag=t.ElementType=void 0,function(e){e.Root="root",e.Text="text",e.Directive="directive",e.Comment="comment",e.Script="script",e.Style="style",e.Tag="tag",e.CDATA="cdata",e.Doctype="doctype"}(n=t.ElementType||(t.ElementType={})),t.isTag=function(e){return e.type===n.Tag||e.type===n.Script||e.type===n.Style},t.Root=n.Root,t.Text=n.Text,t.Directive=n.Directive,t.Comment=n.Comment,t.Script=n.Script,t.Style=n.Style,t.Tag=n.Tag,t.CDATA=n.CDATA,t.Doctype=n.Doctype},141:function(e,t,n){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,n,o){void 0===o&&(o=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,o,r)}:function(e,t,n,o){void 0===o&&(o=n),e[o]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||o(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.DomHandler=void 0;var a=n(413),i=n(957);r(n(957),t);var l={withStartIndices:!1,withEndIndices:!1,xmlMode:!1},s=function(){function e(e,t,n){this.dom=[],this.root=new i.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null,"function"==typeof t&&(n=t,t=l),"object"==typeof e&&(t=e,e=void 0),this.callback=null!=e?e:null,this.options=null!=t?t:l,this.elementCB=null!=n?n:null}return e.prototype.onparserinit=function(e){this.parser=e},e.prototype.onreset=function(){this.dom=[],this.root=new i.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null},e.prototype.onend=function(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))},e.prototype.onerror=function(e){this.handleCallback(e)},e.prototype.onclosetag=function(){this.lastNode=null;var e=this.tagStack.pop();this.options.withEndIndices&&(e.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(e)},e.prototype.onopentag=function(e,t){var n=this.options.xmlMode?a.ElementType.Tag:void 0,o=new i.Element(e,t,void 0,n);this.addNode(o),this.tagStack.push(o)},e.prototype.ontext=function(e){var t=this.lastNode;if(t&&t.type===a.ElementType.Text)t.data+=e,this.options.withEndIndices&&(t.endIndex=this.parser.endIndex);else{var n=new i.Text(e);this.addNode(n),this.lastNode=n}},e.prototype.oncomment=function(e){if(this.lastNode&&this.lastNode.type===a.ElementType.Comment)this.lastNode.data+=e;else{var t=new i.Comment(e);this.addNode(t),this.lastNode=t}},e.prototype.oncommentend=function(){this.lastNode=null},e.prototype.oncdatastart=function(){var e=new i.Text(""),t=new i.CDATA([e]);this.addNode(t),e.parent=t,this.lastNode=e},e.prototype.oncdataend=function(){this.lastNode=null},e.prototype.onprocessinginstruction=function(e,t){var n=new i.ProcessingInstruction(e,t);this.addNode(n)},e.prototype.handleCallback=function(e){if("function"==typeof this.callback)this.callback(e,this.dom);else if(e)throw e},e.prototype.addNode=function(e){var t=this.tagStack[this.tagStack.length-1],n=t.children[t.children.length-1];this.options.withStartIndices&&(e.startIndex=this.parser.startIndex),this.options.withEndIndices&&(e.endIndex=this.parser.endIndex),t.children.push(e),n&&(e.prev=n,n.next=e),e.parent=t,this.lastNode=null},e}();t.DomHandler=s,t.default=s},957:function(e,t,n){"use strict";var o,r=this&&this.__extends||(o=function(e,t){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},o(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}o(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}),a=this&&this.__assign||function(){return a=Object.assign||function(e){for(var t,n=1,o=arguments.length;n0?this.children[this.children.length-1]:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"childNodes",{get:function(){return this.children},set:function(e){this.children=e},enumerable:!1,configurable:!0}),t}(l);t.NodeWithChildren=p;var m=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=i.ElementType.CDATA,t}return r(t,e),Object.defineProperty(t.prototype,"nodeType",{get:function(){return 4},enumerable:!1,configurable:!0}),t}(p);t.CDATA=m;var f=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=i.ElementType.Root,t}return r(t,e),Object.defineProperty(t.prototype,"nodeType",{get:function(){return 9},enumerable:!1,configurable:!0}),t}(p);t.Document=f;var g=function(e){function t(t,n,o,r){void 0===o&&(o=[]),void 0===r&&(r="script"===t?i.ElementType.Script:"style"===t?i.ElementType.Style:i.ElementType.Tag);var a=e.call(this,o)||this;return a.name=t,a.attribs=n,a.type=r,a}return r(t,e),Object.defineProperty(t.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tagName",{get:function(){return this.name},set:function(e){this.name=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attributes",{get:function(){var e=this;return Object.keys(this.attribs).map((function(t){var n,o;return{name:t,value:e.attribs[t],namespace:null===(n=e["x-attribsNamespace"])||void 0===n?void 0:n[t],prefix:null===(o=e["x-attribsPrefix"])||void 0===o?void 0:o[t]}}))},enumerable:!1,configurable:!0}),t}(p);function _(e){return(0,i.isTag)(e)}function h(e){return e.type===i.ElementType.CDATA}function y(e){return e.type===i.ElementType.Text}function b(e){return e.type===i.ElementType.Comment}function v(e){return e.type===i.ElementType.Directive}function w(e){return e.type===i.ElementType.Root}function S(e,t){var n;if(void 0===t&&(t=!1),y(e))n=new c(e.data);else if(b(e))n=new u(e.data);else if(_(e)){var o=t?E(e.children):[],r=new g(e.name,a({},e.attribs),o);o.forEach((function(e){return e.parent=r})),null!=e.namespace&&(r.namespace=e.namespace),e["x-attribsNamespace"]&&(r["x-attribsNamespace"]=a({},e["x-attribsNamespace"])),e["x-attribsPrefix"]&&(r["x-attribsPrefix"]=a({},e["x-attribsPrefix"])),n=r}else if(h(e)){o=t?E(e.children):[];var i=new m(o);o.forEach((function(e){return e.parent=i})),n=i}else if(w(e)){o=t?E(e.children):[];var l=new f(o);o.forEach((function(e){return e.parent=l})),e["x-mode"]&&(l["x-mode"]=e["x-mode"]),n=l}else{if(!v(e))throw new Error("Not implemented yet: ".concat(e.type));var s=new d(e.name,e.data);null!=e["x-name"]&&(s["x-name"]=e["x-name"],s["x-publicId"]=e["x-publicId"],s["x-systemId"]=e["x-systemId"]),n=s}return n.startIndex=e.startIndex,n.endIndex=e.endIndex,null!=e.sourceCodeLocation&&(n.sourceCodeLocation=e.sourceCodeLocation),n}function E(e){for(var t=e.map((function(e){return S(e,!0)})),n=1;n{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CASE_SENSITIVE_TAG_NAMES_MAP=t.CASE_SENSITIVE_TAG_NAMES=void 0,t.CASE_SENSITIVE_TAG_NAMES=["animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","linearGradient","radialGradient","textPath"],t.CASE_SENSITIVE_TAG_NAMES_MAP=t.CASE_SENSITIVE_TAG_NAMES.reduce((function(e,t){return e[t.toLowerCase()]=t,e}),{})},496:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t,u,d=e.match(a),p=d&&d[1]?d[1].toLowerCase():"";switch(p){case n:var f=c(e);return i.test(e)||null===(t=null==(_=f.querySelector(o))?void 0:_.parentNode)||void 0===t||t.removeChild(_),l.test(e)||null===(u=null==(_=f.querySelector(r))?void 0:_.parentNode)||void 0===u||u.removeChild(_),f.querySelectorAll(n);case o:case r:var g=s(e).querySelectorAll(p);return l.test(e)&&i.test(e)?g[0].parentNode.childNodes:g;default:return m?m(e):(_=s(e,r).querySelector(r)).childNodes;var _}};var n="html",o="head",r="body",a=/<([a-zA-Z]+[0-9]?)/,i=//i,l=//i,s=function(e,t){throw new Error("This browser does not support `document.implementation.createHTMLDocument`")},c=function(e,t){throw new Error("This browser does not support `DOMParser.prototype.parseFromString`")},u="object"==typeof window&&window.DOMParser;if("function"==typeof u){var d=new u;s=c=function(e,t){return t&&(e="<".concat(t,">").concat(e,"")),d.parseFromString(e,"text/html")}}if("object"==typeof document&&document.implementation){var p=document.implementation.createHTMLDocument();s=function(e,t){if(t){var n=p.documentElement.querySelector(t);return n&&(n.innerHTML=e),p}return p.documentElement.innerHTML=e,p}}var m,f="object"==typeof document&&document.createElement("template");f&&f.content&&(m=function(e){return f.innerHTML=e,f.content.childNodes})},471:function(e,t,n){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){if("string"!=typeof e)throw new TypeError("First argument must be a string");if(!e)return[];var t=e.match(i),n=t?t[1]:void 0;return(0,a.formatDOM)((0,r.default)(e),null,n)};var r=o(n(496)),a=n(731),i=/<(![a-zA-Z\s]+)>/},731:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.formatAttributes=a,t.formatDOM=function e(t,n,r){void 0===n&&(n=null);for(var l,s=[],c=0,u=t.length;c{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){void 0===e&&(e={});var n={},c=Boolean(e.type&&l[e.type]);for(var u in e){var d=e[u];if((0,o.isCustomAttribute)(u))n[u]=d;else{var p=u.toLowerCase(),m=s(p);if(m){var f=(0,o.getPropertyInfo)(m);switch(a.includes(m)&&i.includes(t)&&!c&&(m=s("default"+p)),n[m]=d,f&&f.type){case o.BOOLEAN:n[m]=!0;break;case o.OVERLOADED_BOOLEAN:""===d&&(n[m]=!0)}}else r.PRESERVE_CUSTOM_ATTRIBUTES&&(n[u]=d)}}return(0,r.setStyleProp)(e.style,n),n};var o=n(210),r=n(958),a=["checked","value"],i=["input","select","textarea"],l={reset:!0,submit:!0};function s(e){return o.possibleStandardNames[e]}},308:function(e,t,n){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.default=function e(t,n){void 0===n&&(n={});for(var o=[],r="function"==typeof n.replace,c=n.transform||i.returnFirstArg,u=n.library||l,d=u.cloneElement,p=u.createElement,m=u.isValidElement,f=t.length,g=0;g1&&(h=d(h,{key:h.key||g})),o.push(c(h,_,g));continue}}if("text"!==_.type){var y=_,b={};s(y)?((0,i.setStyleProp)(y.attribs.style,y.attribs),b=y.attribs):y.attribs&&(b=(0,a.default)(y.attribs,y.name));var v=void 0;switch(_.type){case"script":case"style":_.children[0]&&(b.dangerouslySetInnerHTML={__html:_.children[0].data});break;case"tag":"textarea"===_.name&&_.children[0]?b.defaultValue=_.children[0].data:_.children&&_.children.length&&(v=e(_.children,n));break;default:continue}f>1&&(b.key=g),o.push(c(p(_.name,b,v),_,g))}else{var w=!_.data.trim().length;if(w&&_.parent&&!(0,i.canTextBeChildOfNode)(_.parent))continue;if(n.trim&&w)continue;o.push(c(_.data,_,g))}}return 1===o.length?o[0]:o};var r=n(609),a=o(n(840)),i=n(958),l={cloneElement:r.cloneElement,createElement:r.createElement,isValidElement:r.isValidElement};function s(e){return i.PRESERVE_CUSTOM_ATTRIBUTES&&"tag"===e.type&&(0,i.isCustomComponent)(e.name,e.attribs)}},442:function(e,t,n){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.htmlToDOM=t.domToReact=t.attributesToProps=t.Text=t.ProcessingInstruction=t.Element=t.Comment=void 0,t.default=function(e,t){if("string"!=typeof e)throw new TypeError("First argument must be a string");return e?(0,i.default)((0,r.default)(e,(null==t?void 0:t.htmlparser2)||s),t):[]};var r=o(n(471));t.htmlToDOM=r.default;var a=o(n(840));t.attributesToProps=a.default;var i=o(n(308));t.domToReact=i.default;var l=n(141);Object.defineProperty(t,"Comment",{enumerable:!0,get:function(){return l.Comment}}),Object.defineProperty(t,"Element",{enumerable:!0,get:function(){return l.Element}}),Object.defineProperty(t,"ProcessingInstruction",{enumerable:!0,get:function(){return l.ProcessingInstruction}}),Object.defineProperty(t,"Text",{enumerable:!0,get:function(){return l.Text}});var s={lowerCaseAttributeNames:!1}},958:function(e,t,n){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.returnFirstArg=t.canTextBeChildOfNode=t.ELEMENTS_WITH_NO_TEXT_CHILDREN=t.PRESERVE_CUSTOM_ATTRIBUTES=void 0,t.isCustomComponent=function(e,t){return e.includes("-")?!i.has(e):Boolean(t&&"string"==typeof t.is)},t.setStyleProp=function(e,t){if("string"==typeof e)if(e.trim())try{t.style=(0,a.default)(e,l)}catch(e){t.style={}}else t.style={}};var r=n(609),a=o(n(229)),i=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]),l={reactCompat:!0};t.PRESERVE_CUSTOM_ATTRIBUTES=Number(r.version.split(".")[0])>=16,t.ELEMENTS_WITH_NO_TEXT_CHILDREN=new Set(["tr","tbody","thead","tfoot","colgroup","table","head","html","frameset"]),t.canTextBeChildOfNode=function(e){return!t.ELEMENTS_WITH_NO_TEXT_CHILDREN.has(e.name)},t.returnFirstArg=function(e){return e}},788:e=>{var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,o=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,s=/^\s+|\s+$/g,c="";function u(e){return e?e.replace(s,c):c}e.exports=function(e,s){if("string"!=typeof e)throw new TypeError("First argument must be a string");if(!e)return[];s=s||{};var d=1,p=1;function m(e){var t=e.match(n);t&&(d+=t.length);var o=e.lastIndexOf("\n");p=~o?e.length-o:p+e.length}function f(){var e={line:d,column:p};return function(t){return t.position=new g(e),b(),t}}function g(e){this.start=e,this.end={line:d,column:p},this.source=s.source}g.prototype.content=e;var _=[];function h(t){var n=new Error(s.source+":"+d+":"+p+": "+t);if(n.reason=t,n.filename=s.source,n.line=d,n.column=p,n.source=e,!s.silent)throw n;_.push(n)}function y(t){var n=t.exec(e);if(n){var o=n[0];return m(o),e=e.slice(o.length),n}}function b(){y(o)}function v(e){var t;for(e=e||[];t=w();)!1!==t&&e.push(t);return e}function w(){var t=f();if("/"==e.charAt(0)&&"*"==e.charAt(1)){for(var n=2;c!=e.charAt(n)&&("*"!=e.charAt(n)||"/"!=e.charAt(n+1));)++n;if(n+=2,c===e.charAt(n-1))return h("End of comment missing");var o=e.slice(2,n-2);return p+=2,m(o),e=e.slice(n),p+=2,t({type:"comment",comment:o})}}function S(){var e=f(),n=y(r);if(n){if(w(),!y(a))return h("property missing ':'");var o=y(i),s=e({type:"declaration",property:u(n[0].replace(t,c)),value:o?u(o[0].replace(t,c)):c});return y(l),s}}return b(),function(){var e,t=[];for(v(t);e=S();)!1!==e&&(t.push(e),v(t));return t}()}},210:(e,t,n)=>{"use strict";function o(e,t,n,o,r,a,i){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=o,this.attributeNamespace=r,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=i}const r={};["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"].forEach((e=>{r[e]=new o(e,0,!1,e,null,!1,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((([e,t])=>{r[e]=new o(e,1,!1,t,null,!1,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((e=>{r[e]=new o(e,2,!1,e.toLowerCase(),null,!1,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((e=>{r[e]=new o(e,2,!1,e,null,!1,!1)})),["allowFullScreen","async","autoFocus","autoPlay","controls","default","defer","disabled","disablePictureInPicture","disableRemotePlayback","formNoValidate","hidden","loop","noModule","noValidate","open","playsInline","readOnly","required","reversed","scoped","seamless","itemScope"].forEach((e=>{r[e]=new o(e,3,!1,e.toLowerCase(),null,!1,!1)})),["checked","multiple","muted","selected"].forEach((e=>{r[e]=new o(e,3,!0,e,null,!1,!1)})),["capture","download"].forEach((e=>{r[e]=new o(e,4,!1,e,null,!1,!1)})),["cols","rows","size","span"].forEach((e=>{r[e]=new o(e,6,!1,e,null,!1,!1)})),["rowSpan","start"].forEach((e=>{r[e]=new o(e,5,!1,e.toLowerCase(),null,!1,!1)}));const a=/[\-\:]([a-z])/g,i=e=>e[1].toUpperCase();["accent-height","alignment-baseline","arabic-form","baseline-shift","cap-height","clip-path","clip-rule","color-interpolation","color-interpolation-filters","color-profile","color-rendering","dominant-baseline","enable-background","fill-opacity","fill-rule","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","glyph-name","glyph-orientation-horizontal","glyph-orientation-vertical","horiz-adv-x","horiz-origin-x","image-rendering","letter-spacing","lighting-color","marker-end","marker-mid","marker-start","overline-position","overline-thickness","paint-order","panose-1","pointer-events","rendering-intent","shape-rendering","stop-color","stop-opacity","strikethrough-position","strikethrough-thickness","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-decoration","text-rendering","underline-position","underline-thickness","unicode-bidi","unicode-range","units-per-em","v-alphabetic","v-hanging","v-ideographic","v-mathematical","vector-effect","vert-adv-y","vert-origin-x","vert-origin-y","word-spacing","writing-mode","xmlns:xlink","x-height"].forEach((e=>{const t=e.replace(a,i);r[t]=new o(t,1,!1,e,null,!1,!1)})),["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach((e=>{const t=e.replace(a,i);r[t]=new o(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)})),["xml:base","xml:lang","xml:space"].forEach((e=>{const t=e.replace(a,i);r[t]=new o(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)})),["tabIndex","crossOrigin"].forEach((e=>{r[e]=new o(e,1,!1,e.toLowerCase(),null,!1,!1)})),r.xlinkHref=new o("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach((e=>{r[e]=new o(e,1,!1,e.toLowerCase(),null,!0,!0)}));const{CAMELCASE:l,SAME:s,possibleStandardNames:c}=n(811),u=RegExp.prototype.test.bind(new RegExp("^(data|aria)-[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$")),d=Object.keys(c).reduce(((e,t)=>{const n=c[t];return n===s?e[t]=t:n===l?e[t.toLowerCase()]=t:e[t]=n,e}),{});t.BOOLEAN=3,t.BOOLEANISH_STRING=2,t.NUMERIC=5,t.OVERLOADED_BOOLEAN=4,t.POSITIVE_NUMERIC=6,t.RESERVED=0,t.STRING=1,t.getPropertyInfo=function(e){return r.hasOwnProperty(e)?r[e]:null},t.isCustomAttribute=u,t.possibleStandardNames=d},811:(e,t)=>{t.SAME=0,t.CAMELCASE=1,t.possibleStandardNames={accept:0,acceptCharset:1,"accept-charset":"acceptCharset",accessKey:1,action:0,allowFullScreen:1,alt:0,as:0,async:0,autoCapitalize:1,autoComplete:1,autoCorrect:1,autoFocus:1,autoPlay:1,autoSave:1,capture:0,cellPadding:1,cellSpacing:1,challenge:0,charSet:1,checked:0,children:0,cite:0,class:"className",classID:1,className:1,cols:0,colSpan:1,content:0,contentEditable:1,contextMenu:1,controls:0,controlsList:1,coords:0,crossOrigin:1,dangerouslySetInnerHTML:1,data:0,dateTime:1,default:0,defaultChecked:1,defaultValue:1,defer:0,dir:0,disabled:0,disablePictureInPicture:1,disableRemotePlayback:1,download:0,draggable:0,encType:1,enterKeyHint:1,for:"htmlFor",form:0,formMethod:1,formAction:1,formEncType:1,formNoValidate:1,formTarget:1,frameBorder:1,headers:0,height:0,hidden:0,high:0,href:0,hrefLang:1,htmlFor:1,httpEquiv:1,"http-equiv":"httpEquiv",icon:0,id:0,innerHTML:1,inputMode:1,integrity:0,is:0,itemID:1,itemProp:1,itemRef:1,itemScope:1,itemType:1,keyParams:1,keyType:1,kind:0,label:0,lang:0,list:0,loop:0,low:0,manifest:0,marginWidth:1,marginHeight:1,max:0,maxLength:1,media:0,mediaGroup:1,method:0,min:0,minLength:1,multiple:0,muted:0,name:0,noModule:1,nonce:0,noValidate:1,open:0,optimum:0,pattern:0,placeholder:0,playsInline:1,poster:0,preload:0,profile:0,radioGroup:1,readOnly:1,referrerPolicy:1,rel:0,required:0,reversed:0,role:0,rows:0,rowSpan:1,sandbox:0,scope:0,scoped:0,scrolling:0,seamless:0,selected:0,shape:0,size:0,sizes:0,span:0,spellCheck:1,src:0,srcDoc:1,srcLang:1,srcSet:1,start:0,step:0,style:0,summary:0,tabIndex:1,target:0,title:0,type:0,useMap:1,value:0,width:0,wmode:0,wrap:0,about:0,accentHeight:1,"accent-height":"accentHeight",accumulate:0,additive:0,alignmentBaseline:1,"alignment-baseline":"alignmentBaseline",allowReorder:1,alphabetic:0,amplitude:0,arabicForm:1,"arabic-form":"arabicForm",ascent:0,attributeName:1,attributeType:1,autoReverse:1,azimuth:0,baseFrequency:1,baselineShift:1,"baseline-shift":"baselineShift",baseProfile:1,bbox:0,begin:0,bias:0,by:0,calcMode:1,capHeight:1,"cap-height":"capHeight",clip:0,clipPath:1,"clip-path":"clipPath",clipPathUnits:1,clipRule:1,"clip-rule":"clipRule",color:0,colorInterpolation:1,"color-interpolation":"colorInterpolation",colorInterpolationFilters:1,"color-interpolation-filters":"colorInterpolationFilters",colorProfile:1,"color-profile":"colorProfile",colorRendering:1,"color-rendering":"colorRendering",contentScriptType:1,contentStyleType:1,cursor:0,cx:0,cy:0,d:0,datatype:0,decelerate:0,descent:0,diffuseConstant:1,direction:0,display:0,divisor:0,dominantBaseline:1,"dominant-baseline":"dominantBaseline",dur:0,dx:0,dy:0,edgeMode:1,elevation:0,enableBackground:1,"enable-background":"enableBackground",end:0,exponent:0,externalResourcesRequired:1,fill:0,fillOpacity:1,"fill-opacity":"fillOpacity",fillRule:1,"fill-rule":"fillRule",filter:0,filterRes:1,filterUnits:1,floodOpacity:1,"flood-opacity":"floodOpacity",floodColor:1,"flood-color":"floodColor",focusable:0,fontFamily:1,"font-family":"fontFamily",fontSize:1,"font-size":"fontSize",fontSizeAdjust:1,"font-size-adjust":"fontSizeAdjust",fontStretch:1,"font-stretch":"fontStretch",fontStyle:1,"font-style":"fontStyle",fontVariant:1,"font-variant":"fontVariant",fontWeight:1,"font-weight":"fontWeight",format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:1,"glyph-name":"glyphName",glyphOrientationHorizontal:1,"glyph-orientation-horizontal":"glyphOrientationHorizontal",glyphOrientationVertical:1,"glyph-orientation-vertical":"glyphOrientationVertical",glyphRef:1,gradientTransform:1,gradientUnits:1,hanging:0,horizAdvX:1,"horiz-adv-x":"horizAdvX",horizOriginX:1,"horiz-origin-x":"horizOriginX",ideographic:0,imageRendering:1,"image-rendering":"imageRendering",in2:0,in:0,inlist:0,intercept:0,k1:0,k2:0,k3:0,k4:0,k:0,kernelMatrix:1,kernelUnitLength:1,kerning:0,keyPoints:1,keySplines:1,keyTimes:1,lengthAdjust:1,letterSpacing:1,"letter-spacing":"letterSpacing",lightingColor:1,"lighting-color":"lightingColor",limitingConeAngle:1,local:0,markerEnd:1,"marker-end":"markerEnd",markerHeight:1,markerMid:1,"marker-mid":"markerMid",markerStart:1,"marker-start":"markerStart",markerUnits:1,markerWidth:1,mask:0,maskContentUnits:1,maskUnits:1,mathematical:0,mode:0,numOctaves:1,offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:1,"overline-position":"overlinePosition",overlineThickness:1,"overline-thickness":"overlineThickness",paintOrder:1,"paint-order":"paintOrder",panose1:0,"panose-1":"panose1",pathLength:1,patternContentUnits:1,patternTransform:1,patternUnits:1,pointerEvents:1,"pointer-events":"pointerEvents",points:0,pointsAtX:1,pointsAtY:1,pointsAtZ:1,prefix:0,preserveAlpha:1,preserveAspectRatio:1,primitiveUnits:1,property:0,r:0,radius:0,refX:1,refY:1,renderingIntent:1,"rendering-intent":"renderingIntent",repeatCount:1,repeatDur:1,requiredExtensions:1,requiredFeatures:1,resource:0,restart:0,result:0,results:0,rotate:0,rx:0,ry:0,scale:0,security:0,seed:0,shapeRendering:1,"shape-rendering":"shapeRendering",slope:0,spacing:0,specularConstant:1,specularExponent:1,speed:0,spreadMethod:1,startOffset:1,stdDeviation:1,stemh:0,stemv:0,stitchTiles:1,stopColor:1,"stop-color":"stopColor",stopOpacity:1,"stop-opacity":"stopOpacity",strikethroughPosition:1,"strikethrough-position":"strikethroughPosition",strikethroughThickness:1,"strikethrough-thickness":"strikethroughThickness",string:0,stroke:0,strokeDasharray:1,"stroke-dasharray":"strokeDasharray",strokeDashoffset:1,"stroke-dashoffset":"strokeDashoffset",strokeLinecap:1,"stroke-linecap":"strokeLinecap",strokeLinejoin:1,"stroke-linejoin":"strokeLinejoin",strokeMiterlimit:1,"stroke-miterlimit":"strokeMiterlimit",strokeWidth:1,"stroke-width":"strokeWidth",strokeOpacity:1,"stroke-opacity":"strokeOpacity",suppressContentEditableWarning:1,suppressHydrationWarning:1,surfaceScale:1,systemLanguage:1,tableValues:1,targetX:1,targetY:1,textAnchor:1,"text-anchor":"textAnchor",textDecoration:1,"text-decoration":"textDecoration",textLength:1,textRendering:1,"text-rendering":"textRendering",to:0,transform:0,typeof:0,u1:0,u2:0,underlinePosition:1,"underline-position":"underlinePosition",underlineThickness:1,"underline-thickness":"underlineThickness",unicode:0,unicodeBidi:1,"unicode-bidi":"unicodeBidi",unicodeRange:1,"unicode-range":"unicodeRange",unitsPerEm:1,"units-per-em":"unitsPerEm",unselectable:0,vAlphabetic:1,"v-alphabetic":"vAlphabetic",values:0,vectorEffect:1,"vector-effect":"vectorEffect",version:0,vertAdvY:1,"vert-adv-y":"vertAdvY",vertOriginX:1,"vert-origin-x":"vertOriginX",vertOriginY:1,"vert-origin-y":"vertOriginY",vHanging:1,"v-hanging":"vHanging",vIdeographic:1,"v-ideographic":"vIdeographic",viewBox:1,viewTarget:1,visibility:0,vMathematical:1,"v-mathematical":"vMathematical",vocab:0,widths:0,wordSpacing:1,"word-spacing":"wordSpacing",writingMode:1,"writing-mode":"writingMode",x1:0,x2:0,x:0,xChannelSelector:1,xHeight:1,"x-height":"xHeight",xlinkActuate:1,"xlink:actuate":"xlinkActuate",xlinkArcrole:1,"xlink:arcrole":"xlinkArcrole",xlinkHref:1,"xlink:href":"xlinkHref",xlinkRole:1,"xlink:role":"xlinkRole",xlinkShow:1,"xlink:show":"xlinkShow",xlinkTitle:1,"xlink:title":"xlinkTitle",xlinkType:1,"xlink:type":"xlinkType",xmlBase:1,"xml:base":"xmlBase",xmlLang:1,"xml:lang":"xmlLang",xmlns:0,"xml:space":"xmlSpace",xmlnsXlink:1,"xmlns:xlink":"xmlnsXlink",xmlSpace:1,y1:0,y2:0,y:0,yChannelSelector:1,z:0,zoomAndPan:1}},229:function(e,t,n){"use strict";var o=(this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(n(133)),r=n(917);function a(e,t){var n={};return e&&"string"==typeof e?((0,o.default)(e,(function(e,o){e&&o&&(n[(0,r.camelCase)(e,t)]=o)})),n):n}a.default=a,e.exports=a},917:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.camelCase=void 0;var n=/^--[a-zA-Z0-9-]+$/,o=/-([a-z])/g,r=/^[^-]+$/,a=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,l=function(e,t){return t.toUpperCase()},s=function(e,t){return"".concat(t,"-")};t.camelCase=function(e,t){return void 0===t&&(t={}),function(e){return!e||r.test(e)||n.test(e)}(e)?e:(e=e.toLowerCase(),(e=t.reactCompat?e.replace(i,s):e.replace(a,s)).replace(o,l))}},133:function(e,t,n){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var r=o(n(788));t.default=function(e,t){var n=null;if(!e||"string"!=typeof e)return n;var o=(0,r.default)(e),a="function"==typeof t;return o.forEach((function(e){if("declaration"===e.type){var o=e.property,r=e.value;a?t(o,r,e):r&&((n=n||{})[o]=r)}})),n}},609:e=>{"use strict";e.exports=window.React}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var a=t[o]={exports:{}};return e[o].call(a.exports,a,a.exports,n),a.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";var e=n(609);const t=window.wp.domReady;var o=n.n(t);const r=window.wp.element,a=window.wp.data,i=window.wp.i18n;var l=n(442);const s=l.default||l,c=window.wp.components,u=window.wp.apiFetch;var d=n.n(u);const p={enabled:"yes",title:(0,i.__)("Credit Card","woocommerce-square"),description:(0,i.__)("Pay securely using your credit card.","woocommerce-square"),transaction_type:"charge",charge_virtual_orders:"no",enable_paid_capture:"no",card_types:["VISA","MC","AMEX","DISC","DINERS","JCB","UNIONPAY"],tokenization:"no"},m={enable_digital_wallets:"yes",digital_wallets_button_type:"buy",digital_wallets_apple_pay_button_color:"black",digital_wallets_google_pay_button_color:"black",digital_wallets_hide_button_options:[]},f={enabled:"no",title:(0,i.__)("Square Gift Cards","woocommerce-square"),is_default_placeholder:"no",placeholder_id:0,description:(0,i.__)("Allow customers to purchase and redeem gift cards during checkout.","woocommerce-square")},g={enabled:"no",title:(0,i.__)("Cash App Pay","woocommerce-square"),description:(0,i.__)("Pay securely using Cash App Pay.","woocommerce-square"),transaction_type:"charge",charge_virtual_orders:"no",enable_paid_capture:"no",button_theme:"dark",button_shape:"semiround"},_={enable_sandbox:"no",sandbox_application_id:"",sandbox_token:"",sandbox_location_id:"",production_location_id:"",system_of_record:"disabled",enable_inventory_sync:"no",override_product_images:"no",hide_missing_products:"no",sync_interval:"0.25",is_connected:!1,disconnection_url:"",access_tokens:[],connection_url:"",connection_url_wizard:"",connection_url_sandbox:"",locations:[],enable_customer_decline_messages:"no",debug_mode:"off",debug_logging_enabled:"no"},h={squareSettingsIsSaving:!1,creditCardSettingsIsSaving:!1,cashAppSettingsIsSaving:!1,giftCardsSettingsIsSaving:!1},y={step:"connect-square",backStep:""},b={creditCard:(e=p,t)=>"SET_CREDIT_CARD_DATA"===t.type?{...e,...t.payload}:e,digitalWallet:(e=m,t)=>"SET_DIGITAL_WALLETS_DATA"===t.type?{...e,...t.payload}:e,giftCard:(e=f,t)=>"SET_GIFT_CARD_DATA"===t.type?{...e,...t.payload}:e,cashApp:(e=g,t)=>"SET_CASH_APP_DATA"===t.type?{...e,...t.payload}:e,squareSettings:(e=_,t)=>"SET_SQUARE_SETTING_DATA"===t.type?{...e,...t.payload}:e,savingProcessStatus:(e=h,t)=>{switch(t.type){case"SET_SQUARE_SETTING_PROCESS_STATUS":return{...e,squareSettingsIsSaving:t.payload};case"SET_CREDIT_CARD_SETTING_PROCESS_STATUS":return{...e,creditCardSettingsIsSaving:t.payload};case"SET_CASH_APP_PROCESS_STATUS":return{...e,cashAppSettingsIsSaving:t.payload};case"SET_GIFT_CARDS_PROCESS_STATUS":return{...e,giftCardsSettingsIsSaving:t.payload};default:return e}},step:(e=y,t)=>{switch(t.type){case"SET_STEP":return{...e,step:t.payload};case"SET_BACK_STEP":return{...e,backStep:t.payload};default:return e}}},v=(0,a.createReduxStore)("woo-square/onboarding",{reducer:(0,a.combineReducers)(b),actions:{setCreditCardData:e=>({type:"SET_CREDIT_CARD_DATA",payload:e}),setDigitalWalletData:e=>({type:"SET_DIGITAL_WALLETS_DATA",payload:e}),setGiftCardData:e=>({type:"SET_GIFT_CARD_DATA",payload:e}),setCashAppData:e=>({type:"SET_CASH_APP_DATA",payload:e}),setSquareSettings:e=>({type:"SET_SQUARE_SETTING_DATA",payload:e}),setSquareSettingsSavingProcess:e=>({type:"SET_SQUARE_SETTING_PROCESS_STATUS",payload:e}),setCreditCardSettingsSavingProcess:e=>({type:"SET_CREDIT_CARD_SETTING_PROCESS_STATUS",payload:e}),setCashAppSettingsSavingProcess:e=>({type:"SET_CASH_APP_PROCESS_STATUS",payload:e}),setGiftCardsSettingsSavingProcess:e=>({type:"SET_GIFT_CARDS_PROCESS_STATUS",payload:e}),setStep:e=>({type:"SET_STEP",payload:e}),setBackStep:e=>({type:"SET_BACK_STEP",payload:e})},selectors:{getCreditCardData:(e,t)=>t&&e.creditCard[t]||e.creditCard,getDigitalWalletData:(e,t)=>t&&e.digitalWallet[t]||e.digitalWallet,getGiftCardData:(e,t)=>t&&e.giftCard[t]||e.giftCard,getCashAppData:(e,t)=>t&&e.cashApp[t]||e.cashApp,getSquareSettings:(e,t)=>t&&e.squareSettings[t]||e.squareSettings,getSquareSettingsSavingProcess:e=>e.savingProcessStatus.squareSettingsIsSaving,getCreditCardSettingsSavingProcess:e=>e.savingProcessStatus.creditCardSettingsIsSaving,getCashAppSettingsSavingProcess:e=>e.savingProcessStatus.cashAppSettingsIsSaving,getGiftCardsSettingsSavingProcess:e=>e.savingProcessStatus.giftCardsSettingsIsSaving,getStep:e=>e.step.step,getBackStep:e=>e.step.backStep}}),w=(e=[])=>e.filter((e=>"ACTIVE"===e.status)).map((e=>({label:e.name,value:e.id}))),S=(e=!1)=>{const t=(0,a.useDispatch)(),[n,o]=(0,r.useState)(!1),[i,l]=(0,r.useState)(!1),[s,c]=(0,r.useState)(!1),u=e=>(0,a.useSelect)((t=>t(v).getCreditCardData(e))),_=e=>(0,a.useSelect)((t=>t(v).getDigitalWalletData(e))),h=e=>(0,a.useSelect)((t=>t(v).getGiftCardData(e))),y=e=>(0,a.useSelect)((t=>t(v).getCashAppData(e))),b=e=>t(v).setCreditCardData(e),w=e=>t(v).setDigitalWalletData(e),S=e=>t(v).setGiftCardData(e),E=e=>t(v).setCashAppData(e),x=e=>t(v).setCreditCardSettingsSavingProcess(e),C=e=>t(v).setCashAppSettingsSavingProcess(e),k=e=>t(v).setGiftCardsSettingsSavingProcess(e),T=(0,a.useSelect)((e=>e(v).getCreditCardSettingsSavingProcess(undefined)));const q=(0,a.useSelect)((e=>e(v).getCashAppSettingsSavingProcess(void 0))),A=(0,a.useSelect)((e=>e(v).getGiftCardsSettingsSavingProcess(void 0))),P={...u(),..._()},O={...h()},D={...y()};return(0,r.useEffect)((()=>{if(!e)return o(!0),c(!0),void l(!0);(async()=>{if(!n){const{creditCard:e,digitalWallet:t}=await(async()=>{const e=await d()({path:"/wc/v3/wc_square/payment_settings"});return{creditCard:{enabled:e.enabled||p.enabled,title:e.title||p.title,description:e.description||p.description,transaction_type:e.transaction_type||p.transaction_type,charge_virtual_orders:e.charge_virtual_orders||p.charge_virtual_orders,enable_paid_capture:e.enable_paid_capture||p.enable_paid_capture,card_types:e.card_types||p.card_types,tokenization:e.tokenization||p.tokenization},digitalWallet:{enable_digital_wallets:e.enable_digital_wallets||m.enable_digital_wallets,digital_wallets_button_type:e.digital_wallets_button_type||m.digital_wallets_button_type,digital_wallets_apple_pay_button_color:e.digital_wallets_apple_pay_button_color||m.digital_wallets_apple_pay_button_color,digital_wallets_google_pay_button_color:e.digital_wallets_google_pay_button_color||m.digital_wallets_google_pay_button_color,digital_wallets_hide_button_options:e.digital_wallets_hide_button_options||m.digital_wallets_hide_button_options}}})();b(e),w(t),o(!0)}if(!s){const{giftCard:e}=await(async()=>{const e=await d()({path:"/wc/v3/wc_square/gift_cards_settings"});return{giftCard:{enabled:e.enabled||f.enabled,is_default_placeholder:e.is_default_placeholder||f.is_default_placeholder,placeholder_id:e.placeholder_id||f.placeholder_id}}})();S(e),c(!0)}})()}),[e]),(0,r.useEffect)((()=>{e?(async()=>{const{cashApp:e}=await(async()=>{const e=await d()({path:"/wc/v3/wc_square/cash_app_settings"});return{cashApp:{enabled:e.enabled||g.enabled,title:e.title||g.title,description:e.description||g.description,transaction_type:e.transaction_type||g.transaction_type,charge_virtual_orders:e.charge_virtual_orders||g.charge_virtual_orders,enable_paid_capture:e.enable_paid_capture||g.enable_paid_capture,button_theme:e.button_theme||g.button_theme,button_shape:e.button_shape||g.button_shape}}})();i||(E(e),l(!0))})():l(!0)}),[e]),{isPaymentGatewaySettingsSaving:T,isCashAppGatewaySettingsSaving:q,isGiftCardsGatewaySettingsSaving:A,paymentGatewaySettings:P,cashAppGatewaySettings:D,giftCardsGatewaySettings:O,paymentGatewaySettingsLoaded:n,cashAppGatewaySettingsLoaded:i,giftCardsGatewaySettingsLoaded:s,getCreditCardData:u,getDigitalWalletData:_,getGiftCardData:h,getCashAppData:y,setCreditCardData:b,setDigitalWalletData:w,setGiftCardData:S,setCashAppData:E,savePaymentGatewaySettings:async()=>{x(!0);const e=await d()({path:"/wc/v3/wc_square/payment_settings",method:"POST",data:P});return x(null),await new Promise((e=>setTimeout(e,1e3))),x(!1),e},saveGiftCardsSettings:async()=>{k(!0);const e=await d()({path:"/wc/v3/wc_square/gift_cards_settings",method:"POST",data:O});return k(null),await new Promise((e=>setTimeout(e,1e3))),k(!1),e},saveCashAppSettings:async()=>{C(!0);const e=await d()({path:"/wc/v3/wc_square/cash_app_settings",method:"POST",data:D});return C(null),await new Promise((e=>setTimeout(e,1e3))),C(!1),e}}},E=window.wc.tracks,x=({children:t})=>(0,e.createElement)("div",{className:"woo-square-setting__section"},t),C=({title:t})=>(0,e.createElement)("div",{className:"woo-square-setting__section-title heading_1"},t),k=({children:t})=>(0,e.createElement)("div",{className:"woo-square-setting__section-description"},t),T=({label:t,children:n,description:o,variant:r,indent:a=0,className:i=""})=>{if("boxed"===r)return(0,e.createElement)("div",{className:"woo-square-setting__input-wrapper woo-square-setting__input-wrapper--boxed "+i},(0,e.createElement)("div",{className:"woo-square-setting__input-wrapper--boxed-bg"},(0,e.createElement)("div",{className:"woo-square-setting__input-label"},t),(0,e.createElement)("div",{className:"woo-square-setting__input-field"},n)),(0,e.createElement)("div",{className:"woo-square-setting__input-description"},o));const l={marginLeft:16*a+"px"};return(0,e.createElement)("div",{className:"woo-square-setting__input-wrapper "+i,style:l},t&&(0,e.createElement)("div",{className:"woo-square-setting__input-label"},t),n,o&&(0,e.createElement)("div",{className:"woo-square-setting__input-description"},o))},q=t=>{const{label:n,...o}=t;return(0,e.createElement)("div",{className:"woo-square-setting__input-field--checkbox"},(0,e.createElement)(c.CheckboxControl,{...o}),(0,e.createElement)("div",{className:"woo-square-setting__input-field--checkbox-label"},n))},A=window.wp.primitives;var P=n(706);const O=(0,P.jsx)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(A.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})}),D=(e=!1)=>{const t=(0,a.useDispatch)(),[n,o]=(0,r.useState)(!1),i=e=>(0,a.useSelect)((t=>t(v).getSquareSettings(e))),l=e=>t(v).setSquareSettings(e),s=e=>t(v).setSquareSettingsSavingProcess(e),c=(e=[])=>{l({locations:w(e)})},u=i(),p=(0,a.useSelect)((e=>e(v).getSquareSettingsSavingProcess()));return(0,r.useEffect)((()=>{e?(async()=>{if(!n){const e=await(async()=>{const e=await d()({path:"/wc/v3/wc_square/settings"});return{enable_sandbox:e.enable_sandbox||_.enable_sandbox,sandbox_application_id:e.sandbox_application_id||_.sandbox_application_id,sandbox_token:e.sandbox_token||_.sandbox_token,production_location_id:e.production_location_id||_.production_location_id,sandbox_location_id:e.sandbox_location_id||_.sandbox_location_id,system_of_record:e.system_of_record||_.system_of_record,enable_inventory_sync:e.enable_inventory_sync||_.enable_inventory_sync,override_product_images:e.override_product_images||_.override_product_images,hide_missing_products:e.hide_missing_products||_.hide_missing_products,sync_interval:e.sync_interval||_.sync_interval,is_connected:e.is_connected||_.is_connected,disconnection_url:e.disconnection_url||_.disconnection_url,access_tokens:e.access_tokens||_.access_tokens,connection_url:e.connection_url||_.connection_url,connection_url_wizard:e.connection_url_wizard||_.connection_url_wizard,connection_url_sandbox:e.connection_url_sandbox||_.connection_url_sandbox,locations:e.locations||_.locations,enable_customer_decline_messages:e.enable_customer_decline_messages||_.enable_customer_decline_messages,debug_mode:e.debug_mode||_.debug_mode,debug_logging_enabled:e.debug_logging_enabled||_.debug_logging_enabled}})();l(e),c(e.locations),o(!0)}})():o(!0)}),[e]),{settings:u,squareSettingsLoaded:n,isSquareSettingsSaving:p,getSquareSettingData:i,setSquareSettingData:l,setBusinessLocation:c,saveSquareSettings:async()=>{s(!0);const e=await d()({path:"/wc/v3/wc_square/settings",method:"POST",data:u});return s(null),await new Promise((e=>setTimeout(e,1e3))),s(!1),e}}},I=(N=c.Button,t=>{const{label:n=(0,i.__)("Apply Changes","woocommerce-square")}=t,{afterSaveLabel:o=(0,i.__)("Changes Saved!","woocommerce-square"),afterSaveCallback:r,icon:a=O,...l}=t,{isSquareSettingsSaving:s,settings:c,saveSquareSettings:u}=D();return(0,e.createElement)(N,{"data-testid":"square-settings-save-button",...null===s&&{icon:a},isBusy:s,variant:"button-primary",className:"button-primary",onClick:()=>{(async()=>{const e=document.querySelectorAll("[required]");let t=!0;e.forEach((e=>{e.value?e.classList.remove("required-error"):(e.classList.add("required-error"),t=!1)})),t&&(await u(c),r&&r())})()},...l},null===s?o:n)});var N;const R=(t=>n=>{const{label:o=(0,i.__)("Apply Changes","woocommerce-square"),afterSaveLabel:r=(0,i.__)("Changes Saved!","woocommerce-square"),onClick:a}=n,{isPaymentGatewaySettingsSaving:l,isGiftCardsGatewaySettingsSaving:s,isCashAppGatewaySettingsSaving:c}=S(),u=null===l||null===s||null===c,d=[l,s,c].some((e=>e));return(0,e.createElement)(t,{"data-testid":"payment-gateway-settings-save-button",...n,...u&&{icon:O},isBusy:d,variant:"button-primary",className:"button-primary",onClick:()=>a()},u?r:o)})(c.Button),M=()=>(0,e.createElement)("div",{className:"woo-square-loader"},(0,e.createElement)(c.Spinner,null)),L=({indent:t=0,isDirty:n=!1})=>{const{settings:o,squareSettingsLoaded:a,setSquareSettingData:l}=D(),[u,p]=(0,r.useState)(!1),[m,f]=(0,r.useState)(!1),[g,_]=(0,r.useState)(!1),[h,y]=(0,r.useState)(""),b=()=>f(!1),{system_of_record:v="disabled",enable_inventory_sync:w="no",override_product_images:S="no",hide_missing_products:A="no",sync_interval:P="0.25",is_connected:O=!1}=o,I=[{label:(0,i.__)("15 minutes","woocommerce-square"),value:"0.25"},{label:(0,i.__)("30 minutes","woocommerce-square"),value:"0.5"},{label:(0,i.__)("45 minutes","woocommerce-square"),value:"0.75"},{label:(0,i.__)("1 hour","woocommerce-square"),value:"1"},{label:(0,i.__)("2 hours","woocommerce-square"),value:"2"},{label:(0,i.__)("3 hours","woocommerce-square"),value:"3"},{label:(0,i.__)("6 hours","woocommerce-square"),value:"6"},{label:(0,i.__)("8 hours","woocommerce-square"),value:"8"},{label:(0,i.__)("12 hours","woocommerce-square"),value:"12"},{label:(0,i.__)("24 hours","woocommerce-square"),value:"24"}];return a?(0,e.createElement)(e.Fragment,null,O&&(0,e.createElement)(x,null,(0,e.createElement)(C,{title:(0,i.__)("Configure Sync Settings","woocommerce-square")}),(0,e.createElement)(k,null,(0,i.__)("Choose how you want your product data to flow between WooCommerce and Square to keep your inventory and listings perfectly aligned. Select from the options below to best match your business operations:","woocommerce-square")),(0,e.createElement)("div",{className:"woo-square-wizard__fields"},(0,e.createElement)(T,{label:(0,i.__)("Sync Settings","woocommerce-square"),description:s((0,i.sprintf)(/* translators: %1$s and %2$s are placeholders for the link to the documentation, %3$s and %4$s are placeholders for the link to the support forum */ /* translators: %1$s and %2$s are placeholders for the link to the documentation, %3$s and %4$s are placeholders for the link to the support forum */ (0,i.__)("Choose where data will be updated for synced products. Inventory in Square is always checked for adjustments when sync is enabled. %1$sLearn more%2$s about choosing a system of record or %3$screate a ticket%4$s if you're experiencing technical issues.","woocommerce-square"),'',"",'',""))},(0,e.createElement)(c.SelectControl,{"data-testid":"sync-settings-field",value:v,onChange:e=>l({system_of_record:e}),options:[{label:(0,i.__)("Disabled","woocommerce-square"),value:"disabled"},{label:(0,i.__)("Square","woocommerce-square"),value:"square"},{label:(0,i.__)("WooCommerce","woocommerce-square"),value:"woocommerce"}]})),"woocommerce"===v&&(0,e.createElement)(T,{label:(0,i.__)("Sync Inventory","woocommerce-square"),indent:t,description:s((0,i.sprintf)(/* translators: %1$s and %2$s are placeholders for the strong tag */ /* translators: %1$s and %2$s are placeholders for the strong tag */ (0,i.__)("Inventory is %1$salways fetched from Square%2$s periodically to account for sales from other channels.","woocommerce-square"),"",""))},(0,e.createElement)(q,{"data-testid":"push-inventory-field",checked:"yes"===w,onChange:e=>l({enable_inventory_sync:e?"yes":"no"}),label:(0,i.__)("Enable to push inventory changes to Square","woocommerce-square")})),"square"===v&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(T,{label:(0,i.__)("Sync Inventory","woocommerce-square"),indent:t,description:(0,i.__)("Inventory is fetched from Square periodically and updated in WooCommerce.","woocommerce-square")},(0,e.createElement)(q,{"data-testid":"pull-inventory-field",checked:"yes"===w,onChange:e=>l({enable_inventory_sync:e?"yes":"no"}),label:(0,i.__)("Enable to fetch inventory changes from Square","woocommerce-square")})),(0,e.createElement)(T,{label:(0,i.__)("Override product images","woocommerce-square"),indent:t,description:(0,i.__)("Product images that have been updated in Square will also be updated within WooCommerce during a sync.","woocommerce-square")},(0,e.createElement)(q,{"data-testid":"override-images-field",checked:"yes"===S,onChange:e=>l({override_product_images:e?"yes":"no"}),label:(0,i.__)("Enable to override Product images from Square","woocommerce-square")})),(0,e.createElement)(T,{label:(0,i.__)("Handle missing products","woocommerce-square"),indent:t,description:(0,i.__)("Products not found in Square will be hidden in the WooCommerce product catalog.","woocommerce-square")},(0,e.createElement)(q,{"data-testid":"hide-missing-products-field",checked:"yes"===A,onChange:e=>l({hide_missing_products:e?"yes":"no"}),label:(0,i.__)("Hide synced products when not found in Square","woocommerce-square")}))),("woocommerce"===v||"square"===v)&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(T,{label:(0,i.__)("Sync interval","woocommerce-square"),description:(0,i.__)("Frequency for how regularly WooCommerce will sync products with Square.","woocommerce-square"),indent:t},(0,e.createElement)(c.SelectControl,{"data-testid":"sync-interval-field",value:P,options:I,onChange:e=>l({sync_interval:e})})),(0,e.createElement)(T,{label:(0,i.__)("Import Products","woocommerce-square"),indent:t,className:"import-products-wrapper"},(0,e.createElement)(c.Button,{"data-testid":"import-products-button",variant:"secondary",className:"import-square-products-react",onClick:()=>f(!0),style:{display:h?"none":"block"},disabled:n},(0,i.__)("Import all Products from Square","woocommerce-square")),n&&(0,e.createElement)("p",null,(0,i.__)("You have made changes to the settings. Please save the changes to enable the button.","woocommerce-square")),(0,e.createElement)("div",{className:"import-notice notice notice-info is-dismissible",style:{display:h?"block":"none",padding:"10px"}},h)),m&&(0,e.createElement)(c.Modal,{title:"Import Products From Square",size:"large",onRequestClose:b},(0,e.createElement)("div",{className:"import-modal-cover"},(0,e.createElement)("div",{className:"import-modal-content"},(0,e.createElement)("p",null,(0,i.__)("You are about to import all new products, variations and categories from Square. This will create a new product in WooCommerce for every product retrieved from Square. If you have products in the trash from the previous imports, these will be ignored in the import.","woocommerce-square")," "),(0,e.createElement)("h3",null,(0,i.__)("Do you wish to import existing product updates from Square?","woocommerce-square")," "),(0,e.createElement)("p",null,s((0,i.sprintf)(/* translators: %1$s and %2$s are placeholders for the link to the documentation */ /* translators: %1$s and %2$s are placeholders for the link to the documentation */ (0,i.__)("Doing so will update existing WooCommerce products with the latest information from Square. %1$sView Documentation%2$s.","woocommerce-square"),'',""))),(0,e.createElement)(c.CheckboxControl,{"data-testid":"update-during-import-field",checked:u,onChange:e=>p(e),label:(0,i.__)("Update existing products during import.","woocommerce-square")})),(0,e.createElement)("div",{className:"import-buttons"},(0,e.createElement)(c.Button,{variant:"secondary",onClick:b},(0,i.__)("Cancel","woocommerce-square")),(0,e.createElement)(c.Button,{"data-testid":"import-products-button-confirm",variant:"button-primary",className:"button-primary",onClick:()=>{_(!0),(async()=>{const e=await d()({path:"/wc/v3/wc_square/import-products",method:"POST",data:{update_during_import:u,api_callback:!0}});b(),_(!1),y(e.data)})(),((e="",t={})=>{const{eventName:n,allProperties:o}=((e="",t={})=>({eventName:`woocommerce_square_${e}`,allProperties:{...t,plugin_version:wcSquareOnboarding.plugin_version,is_mobile:wcSquareOnboarding.is_mobile}}))(e,t);(0,E.recordEvent)(n,o)})("product_import_started")},isBusy:g},(0,i.__)("Import Products","woocommerce-square"))))))))):null},j=()=>{const{settings:t,squareSettingsLoaded:n,setSquareSettingData:o}=D(),{stepData:{step:l}}=((e=!1)=>{const t=(0,a.useDispatch)(),n=e=>(0,a.useSelect)((t=>t(v).getStep(e))),o=e=>(0,a.useSelect)((t=>t(v).getBackStep(e))),i=e=>t(v).setStep(e),l=e=>t(v).setBackStep(e),s={step:n(),backStep:o()};return(0,r.useEffect)((()=>{e&&(i(localStorage.getItem("step")||s.step),l(localStorage.getItem("backStep")||s.stepData))}),[e]),{stepData:s,getStep:n,getBackStep:o,setStep:i,setBackStep:l}})(),{enable_customer_decline_messages:u,debug_logging_enabled:d="no"}=t;return n?(0,e.createElement)(e.Fragment,null,(0,e.createElement)(x,null,(0,e.createElement)(C,{title:(0,i.__)("Advanced Settings","woocommerce-square")}),(0,e.createElement)(k,null,(0,i.__)("Adjust these options to provide your customers with additional clarity and troubleshoot any issues more effectively.","woocommerce-square"),(0,e.createElement)("br",null),"advanced-settings"===l&&s((0,i.sprintf)(/* translators: %1$s and %2$s are HTML tags for the link to the Square settings page */ /* translators: %1$s and %2$s are HTML tags for the link to the Square settings page */ (0,i.__)("%1$sClick here%2$s to further refine your settings in the traditional view.","woocommerce-square"),``,""))),(0,e.createElement)("div",{className:"woo-square-wizard__fields"},(0,e.createElement)(T,{label:(0,i.__)("Detailed Decline Messages","woocommerce-square")},(0,e.createElement)(q,{checked:"yes"===u,onChange:e=>o({enable_customer_decline_messages:e?"yes":"no"}),label:(0,i.__)("Show detailed decline messages to the customer during checkout rather than a generic decline message.","woocommerce-square")})),(0,e.createElement)(F,null),(0,e.createElement)(T,{label:(0,i.__)("Enable Logging","woocommerce-square"),variant:"boxed",description:s((0,i.sprintf)(/* translators: %1$s and %2$s are HTML tags for the link to the WooCommerce status log */ /* translators: %1$s and %2$s are HTML tags for the link to the WooCommerce status log */ (0,i.__)("Log debug messages to the %1$sWooCommerce status log%2$s","woocommerce-square"),``,""))},(0,e.createElement)(c.ToggleControl,{checked:"yes"===d,onChange:e=>o({debug_logging_enabled:e?"yes":"no"})}))))):null},B=({indent:t=0,showToggle:n=!0})=>{const{settings:o,squareSettingsLoaded:r,setSquareSettingData:a}=D(),{enable_sandbox:l="no",sandbox_application_id:u="",sandbox_token:d=""}=o;return r?(0,e.createElement)(e.Fragment,null,(0,e.createElement)(x,null,n&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(C,{title:(0,i.__)("Configure Sandbox Settings","woocommerce-square")}),(0,e.createElement)(k,null,(0,i.__)("Activate Sandbox Mode to safely simulate transactions and sync operations, ensuring your WooCommerce/Square integration functions seamlessly. Experiment with payment methods and product data syncing in a risk-free environment before going live with your store.","woocommerce-square"))),(0,e.createElement)("div",{className:"woo-square-wizard__fields"},n&&(0,e.createElement)(T,{label:(0,i.__)("Enable Sandbox Mode","woocommerce-square"),description:(0,i.__)("After enabling you'll see a new Sandbox settings section with two fields: Sandbox Application ID & Sandbox Access Token.","woocommerce-square"),variant:"boxed"},(0,e.createElement)(c.ToggleControl,{className:"enable-sandbox-mode-field",checked:"yes"===l,onChange:e=>a({enable_sandbox:e?"yes":"no"})})),"yes"===l&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(T,{label:(0,i.__)("Sandbox Application ID","woocommerce-square"),description:s((0,i.sprintf)(/* translators: %1$s: opening anchor tag, %2$s: closing anchor tag */ /* translators: %1$s: opening anchor tag, %2$s: closing anchor tag */ (0,i.__)("Application ID for the Sandbox Application, see the details in the %1$sMy Applications%2$s section.","woocommerce-square"),'',"")),indent:t},(0,e.createElement)(c.TextControl,{required:!0,"data-testid":"sandbox-application-id-field",value:u,onChange:e=>a({sandbox_application_id:e})})),(0,e.createElement)(T,{label:(0,i.__)("Sandbox Access Token","woocommerce-square"),description:s((0,i.sprintf)(/* translators: %1$s: opening anchor tag, %2$s: closing anchor tag */ /* translators: %1$s: opening anchor tag, %2$s: closing anchor tag */ (0,i.__)("Access Token for the Sandbox Test Account, see the details in the %1$sSandbox Test Account%2$s section. Make sure you use the correct Sandbox Access Token for your application. For a given Sandbox Test Account, each Authorized Application is assigned a different Access Token.","woocommerce-square"),'',"")),indent:t},(0,e.createElement)(c.TextControl,{required:!0,"data-testid":"sandbox-token-field",value:d,onChange:e=>a({sandbox_token:e})})))))):null},F=()=>{const{settings:t,setSquareSettingData:n}=D(),{debug_mode:o}=t;return(0,e.createElement)(T,{label:(0,i.__)("Debug Mode","woocommerce-square")},(0,e.createElement)(c.SelectControl,{value:o,onChange:e=>n({debug_mode:e}),options:[{label:(0,i.__)("Off","woocommerce-square"),value:"off"},{label:(0,i.__)("Show on Checkout Page","woocommerce-square"),value:"checkout"},{label:(0,i.__)("Save to Log","woocommerce-square"),value:"log"},{label:(0,i.__)("Both","woocommerce-square"),value:"both"}]}))},z=()=>{const{settings:t,isSquareSettingsSaving:n,squareSettingsLoaded:o,setSquareSettingData:a}=D(!0),[l,u]=(0,r.useState)(!1),[d,p]=(0,r.useState)(!1),{enable_sandbox:m="no",sandbox_location_id:f="",production_location_id:g="",is_connected:_=!1,connection_url:h="",disconnection_url:y="",access_tokens:b=[],locations:v=[]}=t,w="yes"===m?f:g;return(0,r.useEffect)((()=>{o&&u(t)}),[o]),(0,r.useEffect)((()=>{!1!==l&&p(!Object.keys(l).every((e=>l[e]===t[e])))}),[t]),(0,r.useEffect)((()=>{null===n&&(u(t),p(!1))}),[n]),o?(0,e.createElement)(e.Fragment,null,(0,e.createElement)(C,{title:(0,i.__)("Connect to Square","woocommerce-square")}),(0,e.createElement)(k,null,(0,i.__)("Activate Square integration to securely manage and process transactions for your WooCommerce store. Choose between connecting to a live production account for real transactions or a sandbox account for testing purposes. This setup ensures your payment processing is seamless, whether you are in a development stage or ready to go live.","woocommerce-square")),(0,e.createElement)(T,{label:(0,i.__)("Environment Selection","woocommerce-square")},(0,e.createElement)(c.SelectControl,{"data-testid":"environment-selection-field",required:!0,value:m,onChange:e=>{a({enable_sandbox:e})},options:[{label:(0,i.__)("Please choose an environment","woocommerce-square"),value:""},{label:(0,i.__)("Production","woocommerce-square"),value:"no"},{label:(0,i.__)("Sandbox","woocommerce-square"),value:"yes"}]})),"yes"===m&&(0,e.createElement)(B,{showToggle:!1}),"no"===m&&(0,e.createElement)(T,{label:(0,i.__)("Connection","woocommerce-square"),variant:"boxed",className:"square-settings__connection"},(0,e.createElement)(c.Button,{"data-testid":"connect-to-square-button",variant:"button-primary",className:"button-primary",href:b?.production?y:h,isBusy:n,disabled:!wcSquareSettings.depsCheck},b?.production?(0,i.__)("Disconnect from Square","woocommerce-square"):(0,i.__)("Connect to Square","woocommerce-square"))),_&&(0,e.createElement)(x,null,(0,e.createElement)(C,{title:(0,i.__)("Select your business location","woocommerce-square")}),(0,e.createElement)(k,null,s((0,i.sprintf)(/* translators: %1$s and %2$s are placeholders for the link to the documentation */ /* translators: %1$s and %2$s are placeholders for the link to the documentation */ (0,i.__)("Please select the location you wish to link with this WooCommerce store. Only active %1$slocations%2$s that support credit card processing in Square can be linked.","woocommerce-square"),'',""))),(0,e.createElement)(T,{label:(0,i.__)("Business location","woocommerce-square")},(0,e.createElement)(c.SelectControl,{"data-testid":"business-location-field",value:w,onChange:e=>{a("yes"===m?{sandbox_location_id:e}:{production_location_id:e})},options:[{label:(0,i.__)("Please choose a location","woocommerce-square"),value:""},...v]}))),_&&(0,e.createElement)(L,{indent:2,isDirty:d}),(0,e.createElement)(j,null),(0,e.createElement)(I,{label:(0,i.__)("Save changes","woocommerce-square"),afterSaveLabel:(0,i.__)("Changes Saved!","woocommerce-square"),afterSaveCallback:()=>document.querySelector(".woocommerce-save-button").click(),disabled:!wcSquareSettings.depsCheck})):(0,e.createElement)(M,null)};var G=n(106);const W=({origin:t=""})=>{const{paymentGatewaySettings:n,paymentGatewaySettingsLoaded:o,setCreditCardData:r}=S(),{enabled:a,title:l,description:u,charge_virtual_orders:d,enable_paid_capture:p,transaction_type:m,tokenization:f,card_types:g}=n;if(!o)return null;const _="authorization"===m&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(T,{description:(0,i.__)("If the order contains exclusively virtual items, enable this to immediately charge, rather than authorize, the transaction.","woocommerce-square"),indent:2},(0,e.createElement)(q,{"data-testid":"credit-card-gateway-virtual-order-only-field",label:(0,i.__)("Charge Virtual-Only Orders","woocommerce-square"),checked:"yes"===d,onChange:e=>r({charge_virtual_orders:e?"yes":"no"})})),(0,e.createElement)(T,{description:(0,i.__)("Automatically capture orders when they are changed to Processing or Completed.","woocommerce-square"),indent:2},(0,e.createElement)(q,{"data-testid":"credit-card-gateway-capture-paid-orders-field",label:(0,i.__)("Capture Paid Orders","woocommerce-square"),checked:"yes"===p,onChange:e=>r({enable_paid_capture:e?"yes":"no"})})));return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(x,null,(0,e.createElement)(C,{title:s((0,i.sprintf)(/* translators: %s: link to payments settings */ /* translators: %s: link to payments settings */ (0,i.__)("Manage Credit Card Payment Settings %s","woocommerce-square"),"settings"===t?``:""))}),(0,e.createElement)(k,null,(0,i.__)("Here you can fine-tune the details of how credit card payments are processed, ensuring a secure and smooth transaction for every customer.","woocommerce-square")),(0,e.createElement)("div",{className:"woo-square-wizard__fields"},(0,e.createElement)(T,{label:(0,i.__)("Enable / Disable","woocommerce-square")},(0,e.createElement)(q,{"data-testid":"credit-card-gateway-toggle-field",label:(0,i.__)("Enable this payment method.","woocommerce-square"),checked:"yes"===a,onChange:e=>r({enabled:e?"yes":"no"})})),(0,e.createElement)(T,{label:(0,i.__)("Title","woocommerce-square")},(0,e.createElement)(c.TextControl,{"data-testid":"credit-card-gateway-title-field",value:l,onChange:e=>r({title:e})})),(0,e.createElement)(T,{label:(0,i.__)("Description","woocommerce-square")},(0,e.createElement)(c.TextareaControl,{"data-testid":"credit-card-gateway-description-field",value:u,onChange:e=>r({description:e})})),(0,e.createElement)(T,{label:(0,i.__)("Transaction Type","woocommerce-square")},(0,e.createElement)(c.SelectControl,{"data-testid":"credit-card-transaction-type-field",value:m,onChange:e=>r({transaction_type:e}),options:[{label:(0,i.__)("Charge","woocommerce-square"),value:"charge"},{label:(0,i.__)("Authorization","woocommerce-square"),value:"authorization"}]})),_,(0,e.createElement)(T,{label:(0,i.__)("Accepted Card Logos","woocommerce-square")},(0,e.createElement)(G.MultiSelectControl,{className:"credit-card-gateway-card-logos-field",id:"credit-card-gateway-card-logos-field",label:"",__experimentalShowHowTo:!1,value:g,onChange:e=>r({card_types:e}),options:[{label:(0,i.__)("Visa","woocommerce-square"),value:"VISA"},{label:(0,i.__)("MasterCard","woocommerce-square"),value:"MC"},{label:(0,i.__)("American Express","woocommerce-square"),value:"AMEX"},{label:(0,i.__)("Discover","woocommerce-square"),value:"DISC"},{label:(0,i.__)("Diners","woocommerce-square"),value:"DINERS"},{label:(0,i.__)("JCB","woocommerce-square"),value:"JCB"},{label:(0,i.__)("UnionPay","woocommerce-square"),value:"UNIONPAY"}]})),(0,e.createElement)(T,{label:(0,i.__)("Customer Profiles","woocommerce-square")},(0,e.createElement)(q,{"data-testid":"credit-card-tokenization-field",label:(0,i.__)("Check to enable tokenization and allow customers to securely save their payment details for future checkout.","woocommerce-square"),checked:"yes"===f,onChange:e=>r({tokenization:e?"yes":"no"})})))))},H=()=>{const{paymentGatewaySettingsLoaded:t,paymentGatewaySettings:n,setDigitalWalletData:o}=S(),{enable_digital_wallets:r,digital_wallets_button_type:a,digital_wallets_apple_pay_button_color:l,digital_wallets_google_pay_button_color:u,digital_wallets_hide_button_options:d}=n;return t?(0,e.createElement)(e.Fragment,null,(0,e.createElement)(x,null,(0,e.createElement)(C,{title:(0,i.__)("Manage Digital Wallet Settings","woocommerce-square")}),(0,e.createElement)(k,null,(0,i.__)("Accept payments with Apple Pay and Google Pay on your store, available in select countries. Enabling digital wallets adds payment buttons to Product, Cart and Checkout pages.","woocommerce-square")),(0,e.createElement)("div",{className:"woo-square-wizard__fields"},(0,e.createElement)(T,{label:(0,i.__)("Enable / Disable","woocommerce-square"),description:s((0,i.sprintf)(/* translators: %1$s: opening link tag, %2$s: closing link tag */ /* translators: %1$s: opening link tag, %2$s: closing link tag */ (0,i.__)("Allow customers to pay with Apple Pay or Google Pay from your Product, Cart and Checkout pages. Read more about the availablity of digital wallets in our %1$sdocumentation%2$s.","woocommerce-square"),'',""))},(0,e.createElement)(q,{"data-testid":"digital-wallet-gateway-toggle-field",label:(0,i.__)("Enable digital wallets.","woocommerce-square"),checked:"yes"===r,onChange:e=>o({enable_digital_wallets:e?"yes":"no"})})),(0,e.createElement)(T,{label:(0,i.__)("Button Type","woocommerce-square")},(0,e.createElement)(c.SelectControl,{"data-testid":"digital-wallet-gatewaybutton-type-field",value:a,onChange:e=>o({digital_wallets_button_type:e}),options:[{label:(0,i.__)("Buy Now","woocommerce-square"),value:"buy"},{label:(0,i.__)("Donate","woocommerce-square"),value:"donate"},{label:(0,i.__)("No Text","woocommerce-square"),value:"plain"}]})),(0,e.createElement)(T,{label:(0,i.__)("Apple Pay Button Color","woocommerce-square")},(0,e.createElement)(c.SelectControl,{"data-testid":"digital-wallet-gatewayapple-pay-button-color-field",value:l,onChange:e=>o({digital_wallets_apple_pay_button_color:e}),options:[{label:(0,i.__)("Black","woocommerce-square"),value:"black"},{label:(0,i.__)("White","woocommerce-square"),value:"white"},{label:(0,i.__)("White with outline","woocommerce-square"),value:"white-outline"}]})),(0,e.createElement)(T,{label:(0,i.__)("Google Pay Button Color","woocommerce-square")},(0,e.createElement)(c.SelectControl,{"data-testid":"digital-wallet-gatewaygoogle-pay-button-color-field",value:u,onChange:e=>o({digital_wallets_google_pay_button_color:e}),options:[{label:(0,i.__)("Black","woocommerce-square"),value:"black"},{label:(0,i.__)("White","woocommerce-square"),value:"white"}]})),(0,e.createElement)(T,{label:(0,i.__)("Hide Digital Wallet Buttons","woocommerce-square")},(0,e.createElement)(G.MultiSelectControl,{"data-testid":"digital-wallet-gatewayhide-buttons-field",label:"",__experimentalShowHowTo:!1,value:d,onChange:e=>o({digital_wallets_hide_button_options:e}),options:[{label:(0,i.__)("Apple Pay","woocommerce-square"),value:"apple"},{label:(0,i.__)("Google Pay","woocommerce-square"),value:"google"}]}))))):null},U=({origin:t=""})=>{const{giftCardsGatewaySettingsLoaded:n,giftCardsGatewaySettings:o,setGiftCardData:a}=S(),[l,u]=(0,r.useState)(wcSquareSettings.gcPlaceholderUrl),{enabled:d,is_default_placeholder:p}=o;return n?(0,e.createElement)(e.Fragment,null,(0,e.createElement)(x,null,(0,e.createElement)(C,{title:s((0,i.sprintf)(/* translators: %s: Gift Cards */ /* translators: %s: Gift Cards */ (0,i.__)("Gift Cards %s","woocommerce-square"),"settings"===t?``:""))}),(0,e.createElement)(k,null,(0,i.__)("You can receive payments with Square Gift Cards and sell Square Gift Cards by enabling the Gift Cards option here.","woocommerce-square")),(0,e.createElement)("div",{className:"woo-square-wizard__fields"},"settings"!==t&&(0,e.createElement)(T,{label:(0,i.__)("Enable Square Gift Cards","woocommerce-square"),variant:"boxed"},(0,e.createElement)(c.ToggleControl,{className:"gift-card-gateway-toggle-field","data-testid":"gift-card-gateway-toggle-field",checked:"yes"===d,onChange:e=>a({enabled:e?"yes":"no"})})),"settings"===t&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(T,{label:(0,i.__)("Enable / Disable","woocommerce-square")},(0,e.createElement)(q,{className:"gift-card-gateway-toggle-field","data-testid":"gift-card-gateway-toggle-field",label:(0,i.__)("Enable this payment method.","woocommerce-square"),checked:"yes"===d,onChange:e=>a({enabled:e?"yes":"no"})})),(0,e.createElement)(T,{label:(0,i.__)("Gift card product placeholder image","woocommerce-square")},(0,e.createElement)(q,{className:"gift-card-gateway-product-placeholder-toggle-field","data-testid":"gift-card-gateway-product-placeholder-toggle-field",label:(0,i.__)("Enable to use the following image as the default placeholder for gift card products.","woocommerce-square"),checked:"yes"===p,onChange:e=>a({is_default_placeholder:e?"yes":"no"})}),(0,e.createElement)("img",{style:{maxWidth:"350px"},src:l,alt:(0,i.__)("Preview of the Gift card placeholder","woocommerce-square")}),(0,e.createElement)(c.Button,{variant:"link",onClick:function(){const e=wp.media({title:(0,i.__)("Select or Upload an image to use as the Gift card placeholder:","woocommerce-square"),library:{type:"image"},button:{text:"Use this image"},multiple:!1}).on("select",(function(){const t=e.state().get("selection").first().toJSON();a({placeholder_id:t.id}),u(t.url)}));e.open()},style:{width:"auto"}},(0,i.__)("Replace image","woocommerce-square"))))))):null},V=({origin:t=""})=>{const{cashAppGatewaySettings:n,setCashAppData:o}=S(),{enabled:r,title:a,description:l,transaction_type:u,button_theme:d,charge_virtual_orders:p,enable_paid_capture:m,button_shape:f}=n,g="authorization"===u&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(T,{description:(0,i.__)("If the order contains exclusively virtual items, enable this to immediately charge, rather than authorize, the transaction.","woocommerce-square"),indent:2},(0,e.createElement)(q,{"data-testid":"cash-app-gateway-virtual-order-only-field",label:(0,i.__)("Charge Virtual-Only Orders","woocommerce-square"),checked:"yes"===p,onChange:e=>o({charge_virtual_orders:e?"yes":"no"})})),(0,e.createElement)(T,{description:(0,i.__)("Automatically capture orders when they are changed to Processing or Completed.","woocommerce-square"),indent:2},(0,e.createElement)(q,{"data-testid":"cash-app-gateway-capture-paid-orders-field",label:(0,i.__)("Capture Paid Orders","woocommerce-square"),checked:"yes"===m,onChange:e=>o({enable_paid_capture:e?"yes":"no"})})));return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(x,null,(0,e.createElement)(C,{title:s((0,i.sprintf)(/* translators: %s: link to settings page */ /* translators: %s: link to settings page */ (0,i.__)("Manage Cash App Pay Settings %s","woocommerce-square"),"settings"===t?``:""))}),(0,e.createElement)(k,null,(0,i.__)("Cash App Pay is an innovative payment solution that offers your customers a quick and secure way to check out. With just a few settings, you can tailor how Cash App Pay appears and operates on your site.","woocommerce-square")),(0,e.createElement)("div",{className:"woo-square-wizard__fields"},(0,e.createElement)(T,{label:(0,i.__)("Enable / Disable","woocommerce-square")},(0,e.createElement)(q,{"data-testid":"cash-app-gateway-toggle-field",label:(0,i.__)("Enable this payment method.","woocommerce-square"),checked:"yes"===r,onChange:e=>o({enabled:e?"yes":"no"})})),(0,e.createElement)(T,{label:(0,i.__)("Title","woocommerce-square")},(0,e.createElement)(c.TextControl,{"data-testid":"cash-app-gateway-title-field",value:a,onChange:e=>o({title:e})})),(0,e.createElement)(T,{label:(0,i.__)("Description","woocommerce-square")},(0,e.createElement)(c.TextareaControl,{"data-testid":"cash-app-gateway-description-field",value:l,onChange:e=>o({description:e})})),(0,e.createElement)(T,{label:(0,i.__)("Transaction Type","woocommerce-square")},(0,e.createElement)(c.SelectControl,{"data-testid":"cash-app-gateway-transaction-type-field",value:u,onChange:e=>o({transaction_type:e}),options:[{label:(0,i.__)("Charge","woocommerce-square"),value:"charge"},{label:(0,i.__)("Authorization","woocommerce-square"),value:"authorization"}]})),g,(0,e.createElement)(T,{label:(0,i.__)("Cash App Pay Button Theme","woocommerce-square")},(0,e.createElement)(c.SelectControl,{"data-testid":"cash-app-gateway-button-theme-field",value:d,onChange:e=>o({button_theme:e}),options:[{label:(0,i.__)("Dark","woocommerce-square"),value:"dark"},{label:(0,i.__)("Light","woocommerce-square"),value:"light"}]})),(0,e.createElement)(T,{label:(0,i.__)("Cash App Pay Button Shape","woocommerce-square")},(0,e.createElement)(c.SelectControl,{"data-testid":"cash-app-gateway-button-shape-field",value:f,onChange:e=>o({button_shape:e}),options:[{label:(0,i.__)("Semiround","woocommerce-square"),value:"semiround"},{label:(0,i.__)("Round","woocommerce-square"),value:"round"}]})))))},$=()=>{const{paymentGatewaySettingsLoaded:t,savePaymentGatewaySettings:n}=S(!0);return t?(0,e.createElement)(e.Fragment,null,(0,e.createElement)(W,{origin:"settings"}),(0,e.createElement)(H,null),(0,e.createElement)(R,{onClick:()=>{n()}})):(0,e.createElement)(M,null)},X=()=>{const{cashAppGatewaySettingsLoaded:t,saveCashAppSettings:n}=S(!0);return t?(0,e.createElement)(e.Fragment,null,(0,e.createElement)(V,{origin:"settings"}),(0,e.createElement)(R,{onClick:()=>{n()}})):(0,e.createElement)(M,null)},Z=()=>{const{giftCardsGatewaySettingsLoaded:t,saveGiftCardsSettings:n}=S(!0);return t?(0,e.createElement)(e.Fragment,null,(0,e.createElement)(U,{origin:"settings"}),(0,e.createElement)(R,{onClick:()=>{n()}})):(0,e.createElement)(M,null)};(0,a.register)(v),o()((()=>{let t=document.getElementById("woocommerce-square-settings__container-general");t?(0,r.createRoot)(t).render((0,e.createElement)(z,null)):(t=document.getElementById("woocommerce-square-payment-gateway-settings__container--square_credit_card"),t&&(0,r.createRoot)(t).render((0,e.createElement)($,null)),t=document.getElementById("woocommerce-square-payment-gateway-settings__container--square_cash_app_pay"),t&&(0,r.createRoot)(t).render((0,e.createElement)(X,null)),t=document.getElementById("woocommerce-square-payment-gateway-settings__container--gift_cards_pay"),t&&(0,r.createRoot)(t).render((0,e.createElement)(Z,null)))}))})()})();