auto-patch 81-dev-dev01-2023-12-05T22_45_26 * auto-patch 81-dev-dev01-2023-12-05T22_45_26
5 lines
25 KiB
JavaScript
5 lines
25 KiB
JavaScript
(()=>{var e={184:(e,t)=>{var o;!function(){"use strict";var n={}.hasOwnProperty;function r(){for(var e=[],t=0;t<arguments.length;t++){var o=arguments[t];if(o){var a=typeof o;if("string"===a||"number"===a)e.push(o);else if(Array.isArray(o)){if(o.length){var i=r.apply(null,o);i&&e.push(i)}}else if("object"===a)if(o.toString===Object.prototype.toString)for(var s in o)n.call(o,s)&&o[s]&&e.push(s);else e.push(o.toString())}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):void 0===(o=function(){return r}.apply(t,[]))||(e.exports=o)}()},198:()=>{},550:()=>{},708:()=>{},656:()=>{},78:()=>{},26:()=>{},129:()=>{}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,o),a.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";o.r(n),o.d(n,{CheckboxList:()=>s,Chip:()=>p,FormStep:()=>u,FormattedMonetaryAmount:()=>R,Label:()=>g,RadioControl:()=>I,RadioControlAccordion:()=>$,RadioControlOption:()=>j,RadioControlOptionLayout:()=>M,RemovableChip:()=>f,Spinner:()=>L});const e=window.wp.element,t=window.wp.i18n;var r=o(184),a=o.n(r);const i=window.wc.blocksCheckout;o(550);const s=({className:o,onChange:n,options:r=[],checked:s=[],isLoading:l=!1,isDisabled:c=!1,limit:u=10})=>{const[p,m]=(0,e.useState)(!1),d=(0,e.useMemo)((()=>[...Array(5)].map(((t,o)=>(0,e.createElement)("li",{key:o,style:{width:Math.floor(75*Math.random())+25+"%"}})))),[]),h=(0,e.useMemo)((()=>{const o=r.length-u;return!p&&(0,e.createElement)("li",{key:"show-more",className:"show-more"},(0,e.createElement)("button",{onClick:()=>{m(!0)},"aria-expanded":!1,"aria-label":(0,t.sprintf)(/* translators: %s is referring the remaining count of options */
|
|
(0,t._n)("Show %s more option","Show %s more options",o,"woocommerce"),o)},(0,t.sprintf)(/* translators: %s number of options to reveal. */
|
|
(0,t._n)("Show %s more","Show %s more",o,"woocommerce"),o)))}),[r,u,p]),f=(0,e.useMemo)((()=>p&&(0,e.createElement)("li",{key:"show-less",className:"show-less"},(0,e.createElement)("button",{onClick:()=>{m(!1)},"aria-expanded":!0,"aria-label":(0,t.__)("Show less options","woocommerce")},(0,t.__)("Show less","woocommerce")))),[p]),g=(0,e.useMemo)((()=>{const t=r.length>u+5;return(0,e.createElement)(e.Fragment,null,r.map(((o,r)=>(0,e.createElement)(e.Fragment,{key:o.value},(0,e.createElement)("li",{...t&&!p&&r>=u&&{hidden:!0}},(0,e.createElement)(i.CheckboxControl,{id:o.value,className:"wc-block-checkbox-list__checkbox",label:o.label,checked:s.includes(o.value),onChange:()=>{n(o.value)},disabled:c})),t&&r===u-1&&h))),t&&f)}),[r,n,s,p,u,f,h,c]),v=a()("wc-block-checkbox-list","wc-block-components-checkbox-list",{"is-loading":l},o);return(0,e.createElement)("ul",{className:v},l?d:g)};o(198);const l=({children:t,className:o,headingLevel:n,...r})=>{const i=a()("wc-block-components-title",o),s=`h${n}`;return(0,e.createElement)(s,{className:i,...r},t)};o(656);const c=({title:t,stepHeadingContent:o})=>(0,e.createElement)("div",{className:"wc-block-components-checkout-step__heading"},(0,e.createElement)(l,{"aria-hidden":"true",className:"wc-block-components-checkout-step__title",headingLevel:"2"},t),!!o&&(0,e.createElement)("span",{className:"wc-block-components-checkout-step__heading-content"},o)),u=({id:t,className:o,title:n,legend:r,description:i,children:s,disabled:l=!1,showStepNumber:u=!0,stepHeadingContent:p=(()=>{})})=>{const m=r||n?"fieldset":"div";return(0,e.createElement)(m,{className:a()(o,"wc-block-components-checkout-step",{"wc-block-components-checkout-step--with-step-number":u,"wc-block-components-checkout-step--disabled":l}),id:t,disabled:l},!(!r&&!n)&&(0,e.createElement)("legend",{className:"screen-reader-text"},r||n),!!n&&(0,e.createElement)(c,{title:n,stepHeadingContent:p()}),(0,e.createElement)("div",{className:"wc-block-components-checkout-step__container"},!!i&&(0,e.createElement)("p",{className:"wc-block-components-checkout-step__description"},i),(0,e.createElement)("div",{className:"wc-block-components-checkout-step__content"},s)))};o(708);const p=({text:t,screenReaderText:o="",element:n="li",className:r="",radius:i="small",children:s=null,...l})=>{const c=n,u=a()(r,"wc-block-components-chip","wc-block-components-chip--radius-"+i),p=Boolean(o&&o!==t);return(0,e.createElement)(c,{className:u,...l},(0,e.createElement)("span",{"aria-hidden":p,className:"wc-block-components-chip__text"},t),p&&(0,e.createElement)("span",{className:"screen-reader-text"},o),s)},m=function(t){let{icon:o,size:n=24,...r}=t;return(0,e.cloneElement)(o,{width:n,height:n,...r})},d=window.wp.primitives,h=(0,e.createElement)(d.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(d.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"})),f=({ariaLabel:o="",className:n="",disabled:r=!1,onRemove:i=(()=>{}),removeOnAnyClick:s=!1,text:l,screenReaderText:c="",...u})=>{const d=s?"span":"button";if(!o){const e=c&&"string"==typeof c?c:l;o="string"!=typeof e?/* translators: Remove chip. */
|
|
(0,t.__)("Remove","woocommerce"):(0,t.sprintf)(/* translators: %s text of the chip to remove. */
|
|
(0,t.__)('Remove "%s"',"woocommerce"),e)}const f={"aria-label":o,disabled:r,onClick:i,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||i()}},g=s?f:{},v=s?{"aria-hidden":!0}:f;return(0,e.createElement)(p,{...u,...g,className:a()(n,"is-removable"),element:s?"button":u.element,screenReaderText:c,text:l},(0,e.createElement)(d,{className:"wc-block-components-chip__remove",...v},(0,e.createElement)(m,{className:"wc-block-components-chip__remove-icon",icon:h,size:16})))},g=({label:t,screenReaderLabel:o,wrapperElement:n,wrapperProps:r={}})=>{let i;const s=null!=t,l=null!=o;return!s&&l?(i=n||"span",r={...r,className:a()(r.className,"screen-reader-text")},(0,e.createElement)(i,{...r},o)):(i=n||e.Fragment,s&&l&&t!==o?(0,e.createElement)(i,{...r},(0,e.createElement)("span",{"aria-hidden":"true"},t),(0,e.createElement)("span",{className:"screen-reader-text"},o)):(0,e.createElement)(i,{...r},t))},v=window.React;var b=o.n(v);function y(){}function w(e){return!!(e||"").match(/\d/)}function S(e){return null==e}function x(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function N(e,t){void 0===t&&(t=!0);var o="-"===e[0],n=o&&t,r=(e=e.replace("-","")).split(".");return{beforeDecimal:r[0],afterDecimal:r[1]||"",hasNagation:o,addNegation:n}}function k(e,t,o){for(var n="",r=o?"0":"",a=0;a<=t-1;a++)n+=e[a]||r;return n}function E(e,t){return Array(t+1).join(e)}function _(e,t){if(e.value=e.value,null!==e){if(e.createTextRange){var o=e.createTextRange();return o.move("character",t),o.select(),!0}return e.selectionStart||0===e.selectionStart?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}function C(e,t,o){return Math.min(Math.max(e,t),o)}function P(e){return Math.max(e.selectionStart,e.selectionEnd)}var F={displayType:"input",decimalSeparator:".",thousandsGroupStyle:"thousand",fixedDecimalScale:!1,prefix:"",suffix:"",allowNegative:!0,allowEmptyFormatting:!1,allowLeadingZeros:!1,isNumericString:!1,type:"text",onValueChange:y,onChange:y,onKeyDown:y,onMouseUp:y,onFocus:y,onBlur:y,isAllowed:function(){return!0}},D=function(e){function t(t){e.call(this,t);var o=t.defaultValue;this.validateProps();var n=this.formatValueProp(o);this.state={value:n,numAsString:this.removeFormatting(n),mounted:!1},this.selectionBeforeInput={selectionStart:0,selectionEnd:0},this.onChange=this.onChange.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.componentDidMount=function(){this.setState({mounted:!0})},t.prototype.componentDidUpdate=function(e){this.updateValueIfRequired(e)},t.prototype.componentWillUnmount=function(){clearTimeout(this.focusTimeout),clearTimeout(this.caretPositionTimeout)},t.prototype.updateValueIfRequired=function(e){var t=this,o=t.props,n=t.state,r=t.focusedElm,a=n.value,i=n.numAsString;if(void 0===i&&(i=""),e!==o){this.validateProps();var s=this.formatNumString(i),l=S(o.value)?s:this.formatValueProp(),c=this.removeFormatting(l),u=parseFloat(c),p=parseFloat(i);(isNaN(u)&&isNaN(p)||u===p)&&s===a&&(null!==r||l===a)||this.updateValue({formattedValue:l,numAsString:c,input:r,source:"prop",event:null})}},t.prototype.getFloatString=function(e){void 0===e&&(e="");var t=this.props.decimalScale,o=this.getSeparators().decimalSeparator,n=this.getNumberRegex(!0),r="-"===e[0];r&&(e=e.replace("-","")),o&&0===t&&(e=e.split(o)[0]);var a=(e=(e.match(n)||[]).join("").replace(o,".")).indexOf(".");return-1!==a&&(e=e.substring(0,a)+"."+e.substring(a+1,e.length).replace(new RegExp(x(o),"g"),"")),r&&(e="-"+e),e},t.prototype.getNumberRegex=function(e,t){var o=this.props,n=o.format,r=o.decimalScale,a=o.customNumerals,i=this.getSeparators().decimalSeparator;return new RegExp("[0-9"+(a?a.join(""):"")+"]"+(!i||0===r||t||n?"":"|"+x(i)),e?"g":void 0)},t.prototype.getSeparators=function(){var e=this.props.decimalSeparator,t=this.props,o=t.thousandSeparator,n=t.allowedDecimalSeparators;return!0===o&&(o=","),n||(n=[e,"."]),{decimalSeparator:e,thousandSeparator:o,allowedDecimalSeparators:n}},t.prototype.getMaskAtIndex=function(e){var t=this.props.mask;return void 0===t&&(t=" "),"string"==typeof t?t:t[e]||" "},t.prototype.getValueObject=function(e,t){var o=parseFloat(t);return{formattedValue:e,value:t,floatValue:isNaN(o)?void 0:o}},t.prototype.validateProps=function(){var e=this.props.mask,t=this.getSeparators(),o=t.decimalSeparator,n=t.thousandSeparator;if(o===n)throw new Error("\n Decimal separator can't be same as thousand separator.\n thousandSeparator: "+n+' (thousandSeparator = {true} is same as thousandSeparator = ",")\n decimalSeparator: '+o+" (default value for decimalSeparator is .)\n ");if(e&&("string"===e?e:e.toString()).match(/\d/g))throw new Error("\n Mask "+e+" should not contain numeric character;\n ")},t.prototype.setPatchedCaretPosition=function(e,t,o){_(e,t),this.caretPositionTimeout=setTimeout((function(){e.value===o&&_(e,t)}),0)},t.prototype.correctCaretPosition=function(e,t,o){var n=this.props,r=n.prefix,a=n.suffix,i=n.format;if(""===e)return 0;if(t=C(t,0,e.length),!i){var s="-"===e[0];return C(t,r.length+(s?1:0),e.length-a.length)}if("function"==typeof i)return t;if("#"===i[t]&&w(e[t]))return t;if("#"===i[t-1]&&w(e[t-1]))return t;var l=i.indexOf("#");t=C(t,l,i.lastIndexOf("#")+1);for(var c=i.substring(t,i.length).indexOf("#"),u=t,p=t+(-1===c?0:c);u>l&&("#"!==i[u]||!w(e[u]));)u-=1;return!w(e[p])||"left"===o&&t!==l||t-u<p-t?w(e[u])?u+1:u:p},t.prototype.getCaretPosition=function(e,t,o){var n,r,a=this.props.format,i=this.state.value,s=this.getNumberRegex(!0),l=(e.match(s)||[]).join(""),c=(t.match(s)||[]).join("");for(n=0,r=0;r<o;r++){var u=e[r]||"",p=t[n]||"";if((u.match(s)||u===p)&&("0"!==u||!p.match(s)||"0"===p||l.length===c.length)){for(;u!==t[n]&&n<t.length;)n++;n++}}return"string"!=typeof a||i||(n=t.length),this.correctCaretPosition(t,n)},t.prototype.removePrefixAndSuffix=function(e){var t=this.props,o=t.format,n=t.prefix,r=t.suffix;if(!o&&e){var a="-"===e[0];a&&(e=e.substring(1,e.length));var i=(e=n&&0===e.indexOf(n)?e.substring(n.length,e.length):e).lastIndexOf(r);e=r&&-1!==i&&i===e.length-r.length?e.substring(0,i):e,a&&(e="-"+e)}return e},t.prototype.removePatternFormatting=function(e){for(var t=this.props.format.split("#").filter((function(e){return""!==e})),o=0,n="",r=0,a=t.length;r<=a;r++){var i=t[r]||"",s=r===a?e.length:e.indexOf(i,o);if(-1===s){n=e;break}n+=e.substring(o,s),o=s+i.length}return(n.match(this.getNumberRegex(!0))||[]).join("")},t.prototype.removeFormatting=function(e){var t=this.props,o=t.format,n=t.removeFormatting;return e?(o?e="string"==typeof o?this.removePatternFormatting(e):"function"==typeof n?n(e):(e.match(this.getNumberRegex(!0))||[]).join(""):(e=this.removePrefixAndSuffix(e),e=this.getFloatString(e)),e):e},t.prototype.formatWithPattern=function(e){for(var t=this.props.format,o=0,n=t.split(""),r=0,a=t.length;r<a;r++)"#"===t[r]&&(n[r]=e[o]||this.getMaskAtIndex(o),o+=1);return n.join("")},t.prototype.formatAsNumber=function(e){var t=this.props,o=t.decimalScale,n=t.fixedDecimalScale,r=t.prefix,a=t.suffix,i=t.allowNegative,s=t.thousandsGroupStyle,l=this.getSeparators(),c=l.thousandSeparator,u=l.decimalSeparator,p=-1!==e.indexOf(".")||o&&n,m=N(e,i),d=m.beforeDecimal,h=m.afterDecimal,f=m.addNegation;return void 0!==o&&(h=k(h,o,n)),c&&(d=function(e,t,o){var n=function(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;default:return/(\d)(?=(\d{3})+(?!\d))/g}}(o),r=e.search(/[1-9]/);return r=-1===r?e.length:r,e.substring(0,r)+e.substring(r,e.length).replace(n,"$1"+t)}(d,c,s)),r&&(d=r+d),a&&(h+=a),f&&(d="-"+d),d+(p&&u||"")+h},t.prototype.formatNumString=function(e){void 0===e&&(e="");var t=this.props,o=t.format,n=t.allowEmptyFormatting,r=t.customNumerals,a=e;if(r&&10===r.length){var i=new RegExp("["+r.join("")+"]","g");a=e.replace(i,(function(e){return r.indexOf(e).toString()}))}return""!==e||n?"-"!==e||o?"string"==typeof o?this.formatWithPattern(a):"function"==typeof o?o(a):this.formatAsNumber(a):"-":""},t.prototype.formatValueProp=function(e){var t=this.props,o=t.format,n=t.decimalScale,r=t.fixedDecimalScale,a=t.allowEmptyFormatting,i=this.props,s=i.value,l=i.isNumericString,c=!(s=S(s)?e:s)&&0!==s;return c&&a&&(s=""),c&&!a?"":("number"==typeof s&&(s=function(e){var t="-"===(e+="")[0]?"-":"";t&&(e=e.substring(1));var o=e.split(/[eE]/g),n=o[0],r=o[1];if(!(r=Number(r)))return t+n;var a=1+r,i=(n=n.replace(".","")).length;return a<0?n="0."+E("0",Math.abs(a))+n:a>=i?n+=E("0",a-i):n=(n.substring(0,a)||"0")+"."+n.substring(a),t+n}(s),l=!0),"Infinity"===s&&l&&(s=""),l&&!o&&"number"==typeof n&&(s=function(e,t,o){if(-1!==["","-"].indexOf(e))return e;var n=-1!==e.indexOf(".")&&t,r=N(e),a=r.beforeDecimal,i=r.afterDecimal,s=r.hasNagation,l=parseFloat("0."+(i||"0")),c=(i.length<=t?"0."+i:l.toFixed(t)).split(".");return(s?"-":"")+a.split("").reverse().reduce((function(e,t,o){return e.length>o?(Number(e[0])+Number(t)).toString()+e.substring(1,e.length):t+e}),c[0])+(n?".":"")+k(c[1]||"",Math.min(t,i.length),o)}(s,n,r)),l?this.formatNumString(s):this.formatInput(s))},t.prototype.formatNegation=function(e){void 0===e&&(e="");var t=this.props.allowNegative,o=new RegExp("(-)"),n=new RegExp("(-)(.)*(-)"),r=o.test(e),a=n.test(e);return e=e.replace(/-/g,""),r&&!a&&t&&(e="-"+e),e},t.prototype.formatInput=function(e){return void 0===e&&(e=""),this.props.format||(e=this.removePrefixAndSuffix(e),e=this.formatNegation(e)),e=this.removeFormatting(e),this.formatNumString(e)},t.prototype.isCharacterAFormat=function(e,t){var o=this.props,n=o.format,r=o.prefix,a=o.suffix,i=o.decimalScale,s=o.fixedDecimalScale,l=this.getSeparators().decimalSeparator;return"string"==typeof n&&"#"!==n[e]||!(n||!(e<r.length||e>=t.length-a.length||i&&s&&t[e]===l))},t.prototype.correctInputValue=function(e,t,o){var n=this,r=this.props,a=r.format,i=r.allowNegative,s=r.prefix,l=r.suffix,c=r.decimalScale,u=this.getSeparators(),p=u.allowedDecimalSeparators,m=u.decimalSeparator,d=this.state.numAsString||"",h=this.selectionBeforeInput,f=h.selectionStart,g=h.selectionEnd,v=function(e,t){for(var o=0,n=0,r=e.length,a=t.length;e[o]===t[o]&&o<r;)o++;for(;e[r-1-n]===t[a-1-n]&&a-n>o&&r-n>o;)n++;return{start:o,end:r-n}}(t,o),b=v.start,y=v.end;if(!a&&b===y&&-1!==p.indexOf(o[f])){var w=0===c?"":m;return o.substr(0,f)+w+o.substr(f+1,o.length)}var S=a?0:s.length,x=t.length-(a?0:l.length);if(o.length>t.length||!o.length||b===y||0===f&&g===t.length||0===b&&y===t.length||f===S&&g===x)return o;var k=t.substr(b,y-b);if([].concat(k).find((function(e,o){return n.isCharacterAFormat(o+b,t)}))){var E=t.substr(b),_={},C=[];[].concat(E).forEach((function(e,o){n.isCharacterAFormat(o+b,t)?_[o]=e:o>k.length-1&&C.push(e)})),Object.keys(_).forEach((function(e){C.length>e?C.splice(e,0,_[e]):C.push(_[e])})),o=t.substr(0,b)+C.join("")}if(!a){var P=this.removeFormatting(o),F=N(P,i),D=F.beforeDecimal,O=F.afterDecimal,A=F.addNegation,R=e<o.indexOf(m)+1;if(P.length<d.length&&R&&""===D&&!parseFloat(O))return A?"-":""}return o},t.prototype.updateValue=function(e){var t=e.formattedValue,o=e.input,n=e.setCaretPosition;void 0===n&&(n=!0);var r=e.source,a=e.event,i=e.numAsString,s=e.caretPos,l=this.props.onValueChange,c=this.state.value;if(o){if(void 0===s&&n){var u=e.inputValue||o.value,p=P(o);o.value=t,s=this.getCaretPosition(u,t,p)}o.value=t,n&&this.setPatchedCaretPosition(o,s,t)}void 0===i&&(i=this.removeFormatting(t)),t!==c&&(this.setState({value:t,numAsString:i}),l(this.getValueObject(t,i),{event:a,source:r}))},t.prototype.onChange=function(e){var t=e.target,o=t.value,n=this.state,r=this.props,a=r.isAllowed,i=n.value||"",s=P(t);o=this.correctInputValue(s,i,o);var l=this.formatInput(o)||"",c=this.removeFormatting(l),u=a(this.getValueObject(l,c));u||(l=i),this.updateValue({formattedValue:l,numAsString:c,inputValue:o,input:t,event:e,source:"event"}),u&&r.onChange(e)},t.prototype.onBlur=function(e){var t=this.props,o=this.state,n=t.format,r=t.onBlur,a=t.allowLeadingZeros,i=o.numAsString,s=o.value;if(this.focusedElm=null,clearTimeout(this.focusTimeout),clearTimeout(this.caretPositionTimeout),!n){isNaN(parseFloat(i))&&(i=""),a||(i=function(e){if(!e)return e;var t="-"===e[0];t&&(e=e.substring(1,e.length));var o=e.split("."),n=o[0].replace(/^0+/,"")||"0",r=o[1]||"";return(t?"-":"")+n+(r?"."+r:"")}(i));var l=this.formatNumString(i);if(l!==s)return this.updateValue({formattedValue:l,numAsString:i,input:e.target,setCaretPosition:!1,event:e,source:"event"}),void r(e)}r(e)},t.prototype.onKeyDown=function(e){var t,o=e.target,n=e.key,r=o.selectionStart,a=o.selectionEnd,i=o.value;void 0===i&&(i="");var s=this.props,l=s.decimalScale,c=s.fixedDecimalScale,u=s.prefix,p=s.suffix,m=s.format,d=s.onKeyDown,h=void 0!==l&&c,f=this.getNumberRegex(!1,h),g=new RegExp("-"),v="string"==typeof m;if(this.selectionBeforeInput={selectionStart:r,selectionEnd:a},"ArrowLeft"===n||"Backspace"===n?t=r-1:"ArrowRight"===n?t=r+1:"Delete"===n&&(t=r),void 0!==t&&r===a){var b=t,y=v?m.indexOf("#"):u.length,w=v?m.lastIndexOf("#")+1:i.length-p.length;if("ArrowLeft"===n||"ArrowRight"===n){var S="ArrowLeft"===n?"left":"right";b=this.correctCaretPosition(i,t,S)}else if("Delete"!==n||f.test(i[t])||g.test(i[t])){if("Backspace"===n&&!f.test(i[t]))if(r<=y+1&&"-"===i[0]&&void 0===m){var x=i.substring(1);this.updateValue({formattedValue:x,caretPos:b,input:o,event:e,source:"event"})}else if(!g.test(i[t])){for(;!f.test(i[b-1])&&b>y;)b--;b=this.correctCaretPosition(i,b,"left")}}else for(;!f.test(i[b])&&b<w;)b++;(b!==t||t<y||t>w)&&(e.preventDefault(),this.setPatchedCaretPosition(o,b,i)),e.isUnitTestRun&&this.setPatchedCaretPosition(o,b,i),d(e)}else d(e)},t.prototype.onMouseUp=function(e){var t=e.target,o=t.selectionStart,n=t.selectionEnd,r=t.value;if(void 0===r&&(r=""),o===n){var a=this.correctCaretPosition(r,o);a!==o&&this.setPatchedCaretPosition(t,a,r)}this.props.onMouseUp(e)},t.prototype.onFocus=function(e){var t=this;e.persist(),this.focusedElm=e.target,this.focusTimeout=setTimeout((function(){var o=e.target,n=o.selectionStart,r=o.selectionEnd,a=o.value;void 0===a&&(a="");var i=t.correctCaretPosition(a,n);i===n||0===n&&r===a.length||t.setPatchedCaretPosition(o,i,a),t.props.onFocus(e)}),0)},t.prototype.render=function(){var e=this.props,t=e.type,o=e.displayType,n=e.customInput,r=e.renderText,a=e.getInputRef,i=e.format,s=(e.thousandSeparator,e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle,e.decimalScale,e.fixedDecimalScale,e.prefix,e.suffix,e.removeFormatting,e.mask,e.defaultValue,e.isNumericString,e.allowNegative,e.allowEmptyFormatting,e.allowLeadingZeros,e.onValueChange,e.isAllowed,e.customNumerals,e.onChange,e.onKeyDown,e.onMouseUp,e.onFocus,e.onBlur,e.value,function(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&-1===t.indexOf(n)&&(o[n]=e[n]);return o}(e,["type","displayType","customInput","renderText","getInputRef","format","thousandSeparator","decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","decimalScale","fixedDecimalScale","prefix","suffix","removeFormatting","mask","defaultValue","isNumericString","allowNegative","allowEmptyFormatting","allowLeadingZeros","onValueChange","isAllowed","customNumerals","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value"])),l=this.state,c=l.value,u=l.mounted&&function(e){return e||"undefined"!=typeof navigator&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}(i)?"numeric":void 0,p=Object.assign({inputMode:u},s,{type:t,value:c,onChange:this.onChange,onKeyDown:this.onKeyDown,onMouseUp:this.onMouseUp,onFocus:this.onFocus,onBlur:this.onBlur});if("text"===o)return r?r(c,s)||null:b().createElement("span",Object.assign({},s,{ref:a}),c);if(n){var m=n;return b().createElement(m,Object.assign({},p,{ref:a}))}return b().createElement("input",Object.assign({},p,{ref:a}))},t}(b().Component);D.defaultProps=F;const O=D;o(78);const A=e=>({thousandSeparator:null==e?void 0:e.thousandSeparator,decimalSeparator:null==e?void 0:e.decimalSeparator,fixedDecimalScale:!0,prefix:null==e?void 0:e.prefix,suffix:null==e?void 0:e.suffix,isNumericString:!0}),R=({className:t,value:o,currency:n,onValueChange:r,displayType:i="text",...s})=>{var l;const c="string"==typeof o?parseInt(o,10):o;if(!Number.isFinite(c))return null;const u=c/10**n.minorUnit;if(!Number.isFinite(u))return null;const p=a()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",t),m=null!==(l=s.decimalScale)&&void 0!==l?l:null==n?void 0:n.minorUnit,d={...s,...A(n),decimalScale:m,value:void 0,currency:void 0,onValueChange:void 0},h=r?e=>{const t=+e.value*10**n.minorUnit;r(t)}:()=>{};return(0,e.createElement)(O,{className:p,displayType:i,...d,value:u,onValueChange:h})},V=window.wp.compose,M=({label:t,secondaryLabel:o,description:n,secondaryDescription:r,id:a})=>(0,e.createElement)("div",{className:"wc-block-components-radio-control__option-layout"},(0,e.createElement)("div",{className:"wc-block-components-radio-control__label-group"},t&&(0,e.createElement)("span",{id:a&&`${a}__label`,className:"wc-block-components-radio-control__label"},t),o&&(0,e.createElement)("span",{id:a&&`${a}__secondary-label`,className:"wc-block-components-radio-control__secondary-label"},o)),(n||r)&&(0,e.createElement)("div",{className:"wc-block-components-radio-control__description-group"},n&&(0,e.createElement)("span",{id:a&&`${a}__description`,className:"wc-block-components-radio-control__description"},n),r&&(0,e.createElement)("span",{id:a&&`${a}__secondary-description`,className:"wc-block-components-radio-control__secondary-description"},r))),j=({checked:t,name:o,onChange:n,option:r,disabled:i=!1})=>{const{value:s,label:l,description:c,secondaryLabel:u,secondaryDescription:p}=r;return(0,e.createElement)("label",{className:a()("wc-block-components-radio-control__option",{"wc-block-components-radio-control__option-checked":t}),htmlFor:`${o}-${s}`},(0,e.createElement)("input",{id:`${o}-${s}`,className:"wc-block-components-radio-control__input",type:"radio",name:o,value:s,onChange:e=>n(e.target.value),checked:t,"aria-describedby":a()({[`${o}-${s}__label`]:l,[`${o}-${s}__secondary-label`]:u,[`${o}-${s}__description`]:c,[`${o}-${s}__secondary-description`]:p}),disabled:i}),(0,e.createElement)(M,{id:`${o}-${s}`,label:l,secondaryLabel:u,description:c,secondaryDescription:p}))};o(26);const T=({className:t="",id:o,selected:n="",onChange:r,options:i=[],disabled:s=!1})=>{const l=(0,V.useInstanceId)(T),c=o||l;return i.length?(0,e.createElement)("div",{className:a()("wc-block-components-radio-control",t)},i.map((t=>(0,e.createElement)(j,{key:`${c}-${t.value}`,name:`radio-control-${c}`,checked:t.value===n,option:t,onChange:e=>{r(e),"function"==typeof t.onChange&&t.onChange(e)},disabled:s})))):null},I=T,$=(0,V.withInstanceId)((({className:t,instanceId:o,id:n,selected:r,onChange:i,options:s=[]})=>{const l=n||o;return s.length?(0,e.createElement)("div",{className:a()("wc-block-components-radio-control",t)},s.map((t=>{const o="object"==typeof t&&"content"in t,n=t.value===r;return(0,e.createElement)("div",{className:"wc-block-components-radio-control-accordion-option",key:t.value},(0,e.createElement)(j,{name:`radio-control-${l}`,checked:n,option:t,onChange:e=>{i(e),"function"==typeof t.onChange&&t.onChange(e)}}),o&&n&&(0,e.createElement)("div",{className:a()("wc-block-components-radio-control-accordion-content",{"wc-block-components-radio-control-accordion-content-hide":!n})},t.content))}))):null}));o(129);const L=()=>(0,e.createElement)("span",{className:"wc-block-components-spinner","aria-hidden":"true"})})(),(this.wc=this.wc||{}).blocksComponents=n})(); |