1(globalThis.webpackChunkwoocommerce_product_options=globalThis.webpackChunkwoocommerce_product_options||[]).push([[0],{1089:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>n});var i=s(7723),l=s(8359),o=s.n(l);const n={init:function(){Array.from(document.querySelectorAll(".wpo-field-dropdown select:not(.initialized)")).forEach(e=>{new(o())(e,{placeholder:e.placeholder||(0,i.__)("Select an option","woocommerce-product-options"),searchable:"true"===e.dataset.searchable||e.querySelectorAll("option").length>20,searchtext:(0,i.__)("Search","woocommerce-product-options"),selectedtext:(0,i.__)("selected","woocommerce-product-options")}),e.classList.add("initialized")})}}},8359:e=>{var t;self,t=()=>(()=>{"use strict";var e={d:(t,s)=>{for(var i in s)e.o(s,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:s[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{bind:()=>m,default:()=>u});const s=(e,t,s={})=>{let i;i="click"===t?MouseEvent:"change"===t?Event:t.includes("focus")?FocusEvent:UIEvent;const l=new i(t,{bubbles:!0,cancelable:!1,...s});e.dispatchEvent(l)},i=e=>s(e,"click"),l=e=>s(e,"change"),o=e=>s(e,"modalclose"),n=(e,t)=>void 0!==e[t]?e[t]:e.getAttribute(t),d=(e,t)=>e?.classList.contains(t),c=(e,t)=>e?.classList.add(t),r=(e,t)=>e?.classList.remove(t),a=(e,t,s)=>e?.classList.toggle(t,s),h={data:null,searchable:!0,showSelectedItems:!0,placeholder:"Select an option",searchtext:"Search",selectedtext:"selected",hideSelect:!0,clearIcon:'<svg xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 -960 960 960" width="20px" fill="currentColor"><path d="m353.83-285.74-68.09-68.09L410.35-480 285.74-605.17l68.09-68.09L480-548.65l125.17-124.61 68.09 68.09L548.65-480l124.61 126.17-68.09 68.09L480-410.35 353.83-285.74Z"/></svg>'};class p{constructor(e,t={}){if(!e)throw new Error("No element provided to NiceSelect");if(!(e instanceof Element))throw new Error("Invalid element provided to NiceSelect - must be a valid DOM element");this.el=e,this.el._niceSelect=this,this.config={...h,...t},this.data=this.config.data,this.selectedOptions=[],this.placeholder=this.sanitizeHtml(n(this.el,"placeholder")||this.config.placeholder),this.searchtext=this.sanitizeHtml(n(this.el,"searchtext")||this.config.searchtext),this.selectedtext=this.sanitizeHtml(n(this.el,"selectedtext")||this.config.selectedtext),this.dropdown=null,this.selectionList=null,this.multiple=n(this.el,"multiple"),this.disabled=n(this.el,"disabled"),this.create(),this.bindElementEvents()}create(e=!0){this.data?this.processData(this.data):this.extractData(e),this.el.classList.remove("hidden-select"),this.renderDropdown(),this.config.hideSelect&&this.el.classList.add("hidden-select"),this.bindDropdownEvents(),e&&this._call("onCreate")}processData(e){this.options=e.map(e=>({data:e,attributes:{selected:!!e.selected,disabled:!!e.disabled,optgroup:"optgroup"===e.value}}))}extractData(e){const t=Array.from(this.el.querySelectorAll("option,optgroup")),s=[],i=[];this.data=t.map(t=>{var l;let o,n=t.selected;e&&t.selected&&!t.defaultSelected&&(n=!1),o="OPTGROUP"===t.tagName?{text:t.label,value:"optgroup"}:{text:null!==(l=t.dataset.display)&&void 0!==l?l:t.innerText,value:t.value,extra:t.dataset.extra,selected:n,disabled:t.disabled},o.text=this.sanitizeHtml(o.text);const d={selected:n,disabled:t.disabled,optgroup:"OPTGROUP"===t.tagName},c={data:o,attributes:d,element:null};return s.push(c),d.selected&&i.push(c),o}),this.options=s,this.selectedOptions=i,a(this.dropdown,"has-selection",i.length>0)}sanitizeHtml(e){return["script","iframe","object","embed","applet"].forEach(t=>{e=e.trim().replace(new RegExp(`<${t}[^>]*>([\\S\\s]*?)</${t}>`,"gim"),"").replace(new RegExp(`</?\\s*${t}\\s*>`,"gim"),"")}),e=e.replace(/ on\w+="[^"]*"/gim,"").replace(/ on\w+='[^']*'/gim,"").replace(/ on\w+=[^ ]*[ \/>]/gim,"")}renderDropdown(){const e=["nice-select",n(this.el,"class")||"",this.disabled?"disabled":"",this.multiple?"has-multiple":"",this.el.selectedIndex>
1=0?"has-selection":""].filter(Boolean),t=this.config.searchable?`\n <div class="nice-select-search-box">\n <input type="text" class="nice-select-search" placeholder="${this.searchtext}..." title="search"/>\n </div>\n `:"",s=`\n <div class="${e.join(" ")}" tabindex="${this.disabled?"":0}">\n <span class="${this.multiple?"multiple-options":"current"}"></span>\n <div class="nice-select-dropdown">\n ${t}\n <ul class="list"></ul>\n </div>\n <button class="clear-button">\n ${this.config.clearIcon}\n </button>\n </div>\n `;this.el.insertAdjacentHTML("afterend",s),this.dropdown=this.el.nextElementSibling,this._renderItems(),this._renderSelectedItems(),this._call("onRenderDropdown")}_renderSelectedItems(){if(this.multiple)this.selectedOptions.length>0?this.config.showSelectedItems?(this.dropdown.querySelector(".multiple-options").innerHTML="",this.options.forEach(e=>{this.multipleListAdd(e)})):this.dropdown.querySelector(".multiple-options").innerHTML=`${this.selectedOptions.length} ${this.selectedtext}`:this.dropdown.querySelector(".multiple-options").innerHTML=this.placeholder;else{const e=this.selectedOptions.length>0?this.selectedOptions[0].data.text:this.placeholder;this.dropdown.querySelector(".current").innerHTML=e}a(this.dropdown,"has-selection",this.selectedOptions.length>0)}_renderItems(){const e=this.dropdown.querySelector("ul");this.options.forEach(t=>{e.appendChild(this.renderItem(t))})}renderItem(e){const t=document.createElement("li");if(t.innerHTML=e.data.text,void 0!==e.data.extra&&t.appendChild(this.renderItemExtra(e.data.extra)),e.attributes.optgroup)c(t,"optgroup");else{t.setAttribute("data-value",e.data.value);const s=["option"];e.attributes.selected&&s.push("selected"),e.attributes.disabled&&s.push("disabled"),t.classList.add(...s),t.addEventListener("click",t=>this.onDropdownItemClicked(e,t))}return e.element=t,t}renderItemExtra(e){const t=document.createElement("span");return t.innerHTML=e,c(t,"extra"),t}update(e=""){let t=this;""!=e&&(t=e.target._niceSelect),t.syncDropdown(),t._call("onUpdate")}disable(){this.disabled=!0,a(this.dropdown,"disabled",!0)}enable(){this.disabled=!1,a(this.dropdown,"disabled",!1)}clear(){this.resetSelectValue();const e=this.selectedOptions.slice();this.selectedOptions=[],this._renderSelectedItems(),this.update(),r(this.dropdown,"open"),r(this.dropdown,"has-selection"),this._call("onClear",e),l(this.el)}destroy(){this.selectionList&&this.removeSelectionList(),this.dropdown&&(this.dropdown.remove(),this.el.classList.remove("hidden-select")),this._call("onDestroy")}focus(e=""){const t=d(this.dropdown,"open");var i;if(a(this.dropdown,"open",!t),t?this.multiple?e===this.dropdown.querySelector(".multiple-options")&&o(this.el):o(this.el):(i=this.el,s(i,"modalopen")),d(this.dropdown,"open")){const e=this.dropdown.querySelector(".nice-select-search");e&&(e.value="",e.focus());const t=this.dropdown.querySelector(".focus");t&&r(t,"focus");const s=this.dropdown.querySelector(".selected");s&&c(s,"focus"),this.dropdown.querySelectorAll("ul li").forEach(e=>e.style.display="")}else this.dropdown.focus();this._call("onFocus")}bindElementEvents(){this.el.addEventListener("invalid",()=>this._triggerValidationMessage("invalid")),window.addEventListener("click",e=>this._onClickedOutside(e)),this.el.addEventListener("change",this.update)}bindDropdownEvents(){this.dropdown.addEventListener("click",e=>this._onClicked(e)),this.dropdown.addEventListener("keydown",e=>this._onKeyPressed(e)),this.dropdown.addEventListener("focusin",()=>{return e=this.el,s(e,"focusin");var e}),this.dropdown.addEventListener("focusout",()=>{return e=this.el,s(e,"focusout");var e}),this.dropdown.querySelector(".clear-button").addEventListener("click",e=>{e.stopPropagation(),this.clear()}),this.config.searchable&&this.bindSearchEvent()}bindSearchEvent(){const e=this.dropdown.querySelector(".nice-select-search");e&&(e.addEventListener("click",e=>e.stopPropagation()),e.addEventListener("input",e=>this.onSearchChanged(e)))}_onClicked(e){e.preventDefault(),this.focus(e.target)}onDropdownItemClicked(e,t){const s=t.target;if(!d(s,"disabled")){if(this.multiple){let t;d(s,"selected")?(t=!1,this.selectedOptions=this.selectedOptions.filter(t=>t.data!==e.data)):(t=!0,this.selectedOptions.push(e)),e.data.selected=t,e.attributes.selected=t,a(s,"selected",t)}
1else{this.dropdown.querySelectorAll("li.selected").forEach(e=>r(e,"selected")),c(s,"selected"),this.selectedOptions=[e];let t=this.options.find(e=>e.attributes.selected);t&&(t.data.selected=!1,t.attributes.selected=!1),e.data.selected=!0,e.attributes.selected=!0}this._renderSelectedItems(),this.syncSelectValue(),this.syncSelectionList(),a(this.dropdown,"has-selection",this.selectedOptions.length>0),this._call("onDropdownItemClicked",s,this.selectedOptions.slice())}}syncSelectValue(){const e=this.el;this.selectedOptions.length>0?e.value=this.selectedOptions[0].data.value:(e.value="",e.selectedIndex=-1),this.options.forEach(t=>{let s=Array.from(e.options).find(e=>String(e.dataset.display||e.textContent).trim().toLowerCase()===String(t.data.text).trim().toLowerCase());null==s&&(s=Array.from(e.options).find(e=>String(e.value).trim().toLowerCase()===String(t.data.value).trim().toLowerCase())),null!=s?t.attributes.selected?s.selected=!0:s.selected=!1:console.warn(`No matching option found for value: "${t.data.value}" in select element`,e)}),e.removeEventListener("change",this.update),l(e),e.addEventListener("change",this.update),a(this.dropdown,"has-selection",this.selectedOptions.length>0),this._call("onSyncSelectValue")}resetSelectValue(){if(this.multiple){const e=this.el;this.selectedOptions.forEach(t=>{const s=e.querySelector(`option[value="${t.data.value}"]`);s&&(s.selected=!1)})}else this.selectedOptions.length>0&&(this.el.selectedIndex=-1);l(this.el),r(this.dropdown,"has-selection"),this._call("onResetSelectValue")}syncDropdown(){if(this.dropdown){const e=d(this.dropdown,"open");this.removeSelectionList(),this.dropdown.remove(),this.data=null,this.create(!1),e&&i(this.dropdown)}n(this.el,"disabled")?this.disable():this.enable(),this._call("onSyncDropdown")}syncSelectionList(){this.config.showSelectedItems&&(this.removeSelectionList(),this.selectedOptions.forEach(e=>{this.multipleListAdd(e)}))}_onClickedOutside(e){this.dropdown.contains(e.target)||(r(this.dropdown,"open"),o(this.el))}_onKeyPressed(e){const t=this.dropdown.querySelector(".focus"),s=d(this.dropdown,"open");if(13===e.keyCode)i(s?t:this.dropdown);else if(40===e.keyCode){if(s){const e=this.findNext(t);e&&(t&&r(t,"focus"),c(e,"focus"))}else i(this.dropdown);e.preventDefault()}else if(38===e.keyCode){if(s){const e=this.findPrev(t);e&&(t&&r(t,"focus"),c(e,"focus"))}else i(this.dropdown);e.preventDefault()}else if(27===e.keyCode&&s)i(this.dropdown);else if(32===e.keyCode&&s)return!1;const l=this.dropdown.querySelector(".focus");return l&&l.scrollIntoView({block:"center"}),!1}findNext(e){let t=e?e.nextElementSibling:this.dropdown.querySelector(".list .option");for(;t;){if(!d(t,"disabled")&&"none"!==t.style.display)return t;t=t.nextElementSibling}return null}findPrev(e){let t=e?e.previousElementSibling:this.dropdown.querySelector(".list .option:last-child");for(;t;){if(!d(t,"disabled")&&"none"!==t.style.display)return t;t=t.previousElementSibling}return null}onSearchChanged(e){const t=e.target.value.toLowerCase();if(""===t)this.options.forEach(e=>e.element.style.display="");else if(d(this.dropdown,"open")){const e=new RegExp(t);this.options.forEach(t=>{t.element.style.display=e.test(t.data.text.toLowerCase())?"":"none"})}this.dropdown.querySelectorAll(".focus").forEach(e=>r(e,"focus"));const s=this.findNext(null);s&&c(s,"focus")}_triggerValidationMessage(e){a(this.dropdown,"valid","invalid"!==e),a(this.dropdown,"invalid","invalid"===e)}removeSelectionList(){null!=this.selectionList&&(this.selectionList.remove(),this.selectionList=null)}multipleListAdd(e){if(!this.multiple||e.data.disabled||""==e.data.value||!e.attributes.selected)return;if(null==this.selectionList&&(this.selectionList=document.createElement("ul"),this.selectionList.classList.add("select-selection-list"),this.dropdown.querySelector(".multiple-options").appendChild(this.selectionList)),null!=this.selectionList.querySelector(`[data-value="${e.data.value}"]`))return;const t=document.createElement("li");t.classList.add("select-selection"),t.dataset.value=e.data.value;const s=document.createElement("button");s.classList.add("remove-select-selection"),s.innerHTML=this.config.clearIcon,t.appendChild(s);const i=document.createElement("span");i.classList.add("selected-name"),i.innerHTML=e.data.text,t.appendChild(i),this.selectionList.appendChild(t),t.querySelectorAll("button.remove-select-selection").forEach(e
1=>e.addEventListener("click",this.multipleListRemove.bind(this)))}multipleListRemove(e){e.stopPropagation();const t=e.currentTarget.closest("li"),s=t.dataset.value,i=this.options.find(e=>e.data.value===s);null!=i&&(this.selectedOptions=this.selectedOptions.filter(e=>e.data.value!==i.data.value),i.data.selected=!1,i.attributes.selected=!1,a(i.element,"selected",!1),t.remove(),0===this.selectionList.children.length&&(this.removeSelectionList(),this.dropdown.querySelector(".multiple-options").innerHTML=this.placeholder),this._renderSelectedItems(),this.syncSelectValue(),this.syncSelectionList(),a(this.dropdown,"has-selection",this.selectedOptions.length>0),this._call("onMultipleListRemove",i,this.selectedOptions.slice()),l(this.el))}_call(e,...t){const s=this.config[e];"function"==typeof s&&s.apply(this,[this.el,this.dropdown,...t])}}const u=p;function m(e,t){return new p(e,t)}return t})(),e.exports=t()}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.