­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ (()=>{var e,t,o,r={6411:(e,t,o)=>{"use strict";const r=window.wp.blocks;var l=o(4530),i=o(1331);const n=JSON.parse('{"name":"woocommerce/add-to-cart-with-options-variation-selector-attribute-options","title":"Variation Selector: Attribute Options (Beta)","description":"Display the attribute options associated with a variable product.","category":"woocommerce-product-elements","keywords":["WooCommerce"],"ancestor":["woocommerce/add-to-cart-with-options-variation-selector-attribute"],"attributes":{"optionStyle":{"type":"string","enum":["pills","dropdown"],"default":"pills"},"autoselect":{"type":"boolean","default":false},"disabledAttributesAction":{"type":"string","enum":["disable","hide"],"default":"disable"}},"textdomain":"woocommerce","apiVersion":3,"$schema":"https://schemas.wp.org/trunk/block.json","supports":{"inserter":false,"interactivity":true},"usesContext":["woocommerce/attributeId","woocommerce/attributeName","woocommerce/attributeTerms"],"style":"file:../woocommerce/add-to-cart-with-options-variation-selector-attribute-options-style.css"}');var a=o(4921);const s=window.wc.wcBlocksSharedContext;var c=o(7723);const d=window.wp.blockEditor,u=window.wp.components;var p=o(6087),m=o(790);function b({id:e,options:t}){return(0,m.jsx)("ul",{id:e,className:"wc-block-add-to-cart-with-options-variation-selector-attribute-options__pills",children:t.map(((e,t)=>(0,m.jsx)("li",{className:(0,a.A)("wc-block-add-to-cart-with-options-variation-selector-attribute-options__pill",{"wc-block-add-to-cart-with-options-variation-selector-attribute-options__pill--selected":0===t,"wc-block-add-to-cart-with-options-variation-selector-attribute-options__pill--disabled":e.disabled}),children:e.label},e.value)))})}o(8180),(0,r.registerBlockType)(n,{edit:function(e){const{attributes:t,setAttributes:o}=e,{className:r,optionStyle:l,autoselect:i,disabledAttributesAction:n}=t,a=(0,d.useBlockProps)({className:r});((e,t)=>{const o=(0,p.useRef)(null);(0,p.useEffect)((()=>{let r=document.querySelector(".editor-styles-wrapper");if(!r){const e=document.querySelector(".edit-site-visual-editor__editor-canvas");if(!(e&&e instanceof HTMLIFrameElement))return;const t=e.contentDocument||e.contentWindow?.document;if(!t)return;r=t.querySelector(".editor-styles-wrapper")}if(!r)return;const l=window.getComputedStyle(r),i=l?.backgroundColor,n=l?.color;if(!i||!n)return;const a=`${e}-editor-theme-colors`;let s=r.querySelector(`#${a}`);s||(s=document.createElement("style"),s.id=a,r.appendChild(s)),o.current=s;const c=t({editorBackgroundColor:i,editorColor:n});s.textContent=c;const d=new MutationObserver((()=>{const e=window.getComputedStyle(r),l=e?.backgroundColor,a=e?.color;if(l!==i||a!==n){const e=t({editorBackgroundColor:l,editorColor:a});o.current&&(o.current.textContent=e)}}));return d.observe(r,{attributes:!0,attributeFilter:["class"]}),()=>{d.disconnect(),o.current&&o.current.parentNode&&o.current.parentNode.removeChild(o.current)}}),[t,e])})("add-to-cart-with-options-variation-selector-attribute-options",(({editorBackgroundColor:e,editorColor:t})=>`\n\t\t\t:where(.wc-block-add-to-cart-with-options-variation-selector-attribute-options__pill--selected) {\n\t\t\t\t--pill-color: ${e};\n\t\t\t\t--pill-background-color: ${t};\n\t\t\t}\n\t\t`));const{data:w}=(0,s.useCustomDataContext)("attribute");if(!w)return null;const _=w.terms.map(((e,t)=>({value:e.slug,label:e.name,disabled:t>1&&t===w.terms.length-1})));return(0,m.jsxs)("div",{...a,children:[(0,m.jsxs)(d.InspectorControls,{children:[(0,m.jsx)(u.__experimentalToolsPanel,{label:(0,c.__)("Style","woocommerce"),resetAll:()=>o({optionStyle:"pills"}),children:(0,m.jsx)(u.__experimentalToolsPanelItem,{hasValue:()=>"pills"!==l,label:(0,c.__)("Style","woocommerce"),onDeselect:()=>o({optionStyle:"pills"}),isShownByDefault:!0,children:(0,m.jsxs)(u.__experimentalToggleGroupControl,{label:(0,c.__)("Style","woocommerce"),value:l,onChange:e=>{"pills"!==e&&"dropdown"!==e||o({optionStyle:e})},isBlock:!0,hideLabelFromVision:!0,size:"__unstable-large",children:[(0,m.jsx)(u.__experimentalToggleGroupControlOption,{value:"pills",label:(0,c.__)("Pills","woocommerce")}),(0,m.jsx)(u.__experimentalToggleGroupControlOption,{value:"dropdown",label:(0,c.__)("Dropdown","woocommerce")})]})})}),(0,m.jsxs)(u.__experimentalToolsPanel,{label:(0,c.__)("Auto-select","woocommerce"),resetAll:()=>o({autoselect:!1,disabledAttributesAction:"disable"}),children:[(0,m.jsx)(u.__experimentalToolsPanelItem,{label:(0,c.__)("Auto-select when only one option is available","woocommerce"),hasValue:()=>i,onDeselect:()=>o({autoselect:!1}),isShownByDefault:!0,children:(0,m.jsx)(u.ToggleControl,{label:(0,c.__)("Auto-select when only one option is available","woocommerce"),help:(0,c.__)("Automatically select options on page load or after the shopper changes attributes, when only one valid choice is available.","woocommerce"),checked:i,onChange:()=>o({autoselect:!i}),__nextHasNoMarginBottom:!0})}),(0,m.jsx)(u.__experimentalToolsPanelItem,{label:(0,c.__)("Invalid options","woocommerce"),hasValue:()=>"disable"!==n,onDeselect:()=>o({disabledAttributesAction:"disable"}),isShownByDefault:!0,children:(0,m.jsxs)(u.__experimentalToggleGroupControl,{label:(0,c.__)("Invalid options","woocommerce"),help:(0,c.__)("Control the display of invalid options.","woocommerce"),value:n,onChange:e=>{"hide"!==e&&"disable"!==e||o({disabledAttributesAction:e})},isBlock:!0,size:"__unstable-large",children:[(0,m.jsx)(u.__experimentalToggleGroupControlOption,{value:"disable",label:(0,c.__)("Grayed-out","woocommerce")}),(0,m.jsx)(u.__experimentalToggleGroupControlOption,{value:"hide",label:(0,c.__)("Hidden","woocommerce")})]})})]})]}),(0,m.jsx)(u.Disabled,{children:"dropdown"===l?(0,m.jsx)("select",{id:w.taxonomy,className:"wc-block-add-to-cart-with-options-variation-selector-attribute-options__dropdown",children:_.map((e=>(0,m.jsx)("option",{value:e.value,children:e.label},e.value)))}):(0,m.jsx)(b,{id:w.taxonomy,options:_})})]})},attributes:n.attributes,icon:{src:(0,m.jsx)(l.A,{icon:i.A})},save:()=>null})},8180:()=>{},1609:e=>{"use strict";e.exports=window.React},790:e=>{"use strict";e.exports=window.ReactJSXRuntime},6087:e=>{"use strict";e.exports=window.wp.element},7723:e=>{"use strict";e.exports=window.wp.i18n},5573:e=>{"use strict";e.exports=window.wp.primitives}},l={};function i(e){var t=l[e];if(void 0!==t)return t.exports;var o=l[e]={exports:{}};return r[e](o,o.exports,i),o.exports}i.m=r,e=[],i.O=(t,o,r,l)=>{if(!o){var n=1/0;for(d=0;d=l)&&Object.keys(i.O).every((e=>i.O[e](o[s])))?o.splice(s--,1):(a=!1,l0&&e[d-1][2]>l;d--)e[d]=e[d-1];e[d]=[o,r,l]},i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},o=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(e,r){if(1&r&&(e=this(e)),8&r)return e;if("object"==typeof e&&e){if(4&r&&e.__esModule)return e;if(16&r&&"function"==typeof e.then)return e}var l=Object.create(null);i.r(l);var n={};t=t||[null,o({}),o([]),o(o)];for(var a=2&r&&e;"object"==typeof a&&!~t.indexOf(a);a=o(a))Object.getOwnPropertyNames(a).forEach((t=>n[t]=()=>e[t]));return n.default=()=>e,i.d(l,n),l},i.d=(e,t)=>{for(var o in t)i.o(t,o)&&!i.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.j=277,(()=>{var e={277:0};i.O.j=t=>0===e[t];var t=(t,o)=>{var r,l,[n,a,s]=o,c=0;if(n.some((t=>0!==e[t]))){for(r in a)i.o(a,r)&&(i.m[r]=a[r]);if(s)var d=s(i)}for(t&&t(o);ci(6411)));n=i.O(n),((this.wc=this.wc||{}).blocks=this.wc.blocks||{})["add-to-cart-with-options-variation-selector-attribute-options"]=n})();