D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
diafdxji
/
shihty.com
/
wp-content
/
plugins
/
surecart
/
dist
/
components
/
surecart
/
Filename :
p-e8affa66.entry.js
back
Copy
import{r as t,h as e,c as s,a as i}from"./p-e97fde0a.js";import{F as n}from"./p-8b323bfb.js";import{b as r}from"./p-93127aa7.js";const c=":host{display:block}.menu-label{font-family:var(--sc-font-sans);font-size:var(--sc-font-size-x-small);font-weight:var(--sc-font-weight-semibold);line-height:var(--sc-line-height-normal);letter-spacing:var(--sc-letter-spacing-normal);color:var(--sc-color-gray-500);padding:var(--sc-spacing-small) var(--sc-spacing-large);user-select:none;text-transform:uppercase}";const o=c;const a=class{constructor(e){t(this,e)}render(){return e("div",{key:"3155f6b714a66f72508f1d9b35879504b602ef40",part:"base",class:"menu-label"},e("slot",{key:"d2586133b2453370f714807d4413e1f9e95f527d"}))}};a.style=o;function l(t){return!Array.isArray?y(t)==="[object Array]":Array.isArray(t)}const h=1/0;function d(t){if(typeof t=="string"){return t}let e=t+"";return e=="0"&&1/t==-h?"-0":e}function u(t){return t==null?"":d(t)}function f(t){return typeof t==="string"}function g(t){return typeof t==="number"}function p(t){return t===true||t===false||m(t)&&y(t)=="[object Boolean]"}function v(t){return typeof t==="object"}function m(t){return v(t)&&t!==null}function b(t){return t!==undefined&&t!==null}function x(t){return!t.trim().length}function y(t){return t==null?t===undefined?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const w="Extended search is not available";const M="Incorrect 'index' type";const k=t=>`Invalid value for key ${t}`;const _=t=>`Pattern length exceeds max of ${t}.`;const L=t=>`Missing ${t} property in key`;const S=t=>`Property 'weight' in key '${t}' must be a positive integer`;const $=Object.prototype.hasOwnProperty;class C{constructor(t){this._keys=[];this._keyMap={};let e=0;t.forEach((t=>{let s=A(t);e+=s.weight;this._keys.push(s);this._keyMap[s.id]=s;e+=s.weight}));this._keys.forEach((t=>{t.weight/=e}))}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function A(t){let e=null;let s=null;let i=null;let n=1;let r=null;if(f(t)||l(t)){i=t;e=I(t);s=F(t)}else{if(!$.call(t,"name")){throw new Error(L("name"))}const c=t.name;i=c;if($.call(t,"weight")){n=t.weight;if(n<=0){throw new Error(S(c))}}e=I(c);s=F(c);r=t.getFn}return{path:e,id:s,weight:n,src:i,getFn:r}}function I(t){return l(t)?t:t.split(".")}function F(t){return l(t)?t.join("."):t}function N(t,e){let s=[];let i=false;const n=(t,e,r)=>{if(!b(t)){return}if(!e[r]){s.push(t)}else{let c=e[r];const o=t[c];if(!b(o)){return}if(r===e.length-1&&(f(o)||g(o)||p(o))){s.push(u(o))}else if(l(o)){i=true;for(let t=0,s=o.length;t<s;t+=1){n(o[t],e,r+1)}}else if(e.length){n(o,e,r+1)}}};n(t,f(e)?e.split("."):e,0);return i?s:s[0]}const R={includeMatches:false,findAllMatches:false,minMatchCharLength:1};const j={isCaseSensitive:false,includeScore:false,keys:[],shouldSort:true,sortFn:(t,e)=>t.score===e.score?t.idx<e.idx?-1:1:t.score<e.score?-1:1};const O={location:0,threshold:.6,distance:100};const z={useExtendedSearch:false,getFn:N,ignoreLocation:false,ignoreFieldNorm:false,fieldNormWeight:1};var E={...j,...R,...O,...z};const q=/[^ ]+/g;function W(t=1,e=3){const s=new Map;const i=Math.pow(10,e);return{get(e){const n=e.match(q).length;if(s.has(n)){return s.get(n)}const r=1/Math.pow(n,.5*t);const c=parseFloat(Math.round(r*i)/i);s.set(n,c);return c},clear(){s.clear()}}}class T{constructor({getFn:t=E.getFn,fieldNormWeight:e=E.fieldNormWeight}={}){this.norm=W(e,3);this.getFn=t;this.isCreated=false;this.setIndexRecords()}setSources(t=[]){this.docs=t}setIndexRecords(t=[]){this.records=t}setKeys(t=[]){this.keys=t;this._keysMap={};t.forEach(((t,e)=>{this._keysMap[t.id]=e}))}create(){if(this.isCreated||!this.docs.length){return}this.isCreated=true;if(f(this.docs[0])){this.docs.forEach(((t,e)=>{this._addString(t,e)}))}else{this.docs.forEach(((t,e)=>{this._addObject(t,e)}))}this.norm.clear()}add(t){const e=this.size();if(f(t)){this._addString(t,e)}else{this._addObject(t,e)}}removeAt(t){this.records.splice(t,1);for(let e=t,s=this.size();e<s;e+=1){this.records[e].i-=1}}getValueForItemAtKeyId(t,e){return t[this._keysMap[e]]}size(){return this.records.length}_addString(t,e){if(!b(t)||x(t)){return}let s={v:t,i:e,n:this.norm.get(t)};this.records.push(s)}_addObject(t,e){let s={i:e,$:{}};this.keys.forEach(((e,i)=>{let n=e.getFn?e.getFn(t):this.getFn(t,e.path);if(!b(n)){return}if(l(n)){let t=[];const e=[{nestedArrIndex:-1,value:n}];while(e.length){const{nestedArrIndex:s,value:i}=e.pop();if(!b(i)){continue}if(f(i)&&!x(i)){let e={v:i,i:s,n:this.norm.get(i)};t.push(e)}else if(l(i)){i.forEach(((t,s)=>{e.push({nestedArrIndex:s,value:t})}))}else;}s.$[i]=t}else if(f(n)&&!x(n)){let t={v:n,n:this.norm.get(n)};s.$[i]=t}}));this.records.push(s)}toJSON(){return{keys:this.keys,records:this.records}}}function D(t,e,{getFn:s=E.getFn,fieldNormWeight:i=E.fieldNormWeight}={}){const n=new T({getFn:s,fieldNormWeight:i});n.setKeys(t.map(A));n.setSources(e);n.create();return n}function V(t,{getFn:e=E.getFn,fieldNormWeight:s=E.fieldNormWeight}={}){const{keys:i,records:n}=t;const r=new T({getFn:e,fieldNormWeight:s});r.setKeys(i);r.setIndexRecords(n);return r}function B(t,{errors:e=0,currentLocation:s=0,expectedLocation:i=0,distance:n=E.distance,ignoreLocation:r=E.ignoreLocation}={}){const c=e/t.length;if(r){return c}const o=Math.abs(i-s);if(!n){return o?1:c}return c+o/n}function H(t=[],e=E.minMatchCharLength){let s=[];let i=-1;let n=-1;let r=0;for(let c=t.length;r<c;r+=1){let c=t[r];if(c&&i===-1){i=r}else if(!c&&i!==-1){n=r-1;if(n-i+1>=e){s.push([i,n])}i=-1}}if(t[r-1]&&r-i>=e){s.push([i,r-1])}return s}const K=32;function P(t,e,s,{location:i=E.location,distance:n=E.distance,threshold:r=E.threshold,findAllMatches:c=E.findAllMatches,minMatchCharLength:o=E.minMatchCharLength,includeMatches:a=E.includeMatches,ignoreLocation:l=E.ignoreLocation}={}){if(e.length>K){throw new Error(_(K))}const h=e.length;const d=t.length;const u=Math.max(0,Math.min(i,d));let f=r;let g=u;const p=o>1||a;const v=p?Array(d):[];let m;while((m=t.indexOf(e,g))>-1){let t=B(e,{currentLocation:m,expectedLocation:u,distance:n,ignoreLocation:l});f=Math.min(t,f);g=m+h;if(p){let t=0;while(t<h){v[m+t]=1;t+=1}}}g=-1;let b=[];let x=1;let y=h+d;const w=1<<h-1;for(let i=0;i<h;i+=1){let r=0;let o=y;while(r<o){const t=B(e,{errors:i,currentLocation:u+o,expectedLocation:u,distance:n,ignoreLocation:l});if(t<=f){r=o}else{y=o}o=Math.floor((y-r)/2+r)}y=o;let a=Math.max(1,u-o+1);let m=c?d:Math.min(u+o,d)+h;let M=Array(m+2);M[m+1]=(1<<i)-1;for(let r=m;r>=a;r-=1){let c=r-1;let o=s[t.charAt(c)];if(p){v[c]=+!!o}M[r]=(M[r+1]<<1|1)&o;if(i){M[r]|=(b[r+1]|b[r])<<1|1|b[r+1]}if(M[r]&w){x=B(e,{errors:i,currentLocation:c,expectedLocation:u,distance:n,ignoreLocation:l});if(x<=f){f=x;g=c;if(g<=u){break}a=Math.max(1,2*u-g)}}}const k=B(e,{errors:i+1,currentLocation:u,expectedLocation:u,distance:n,ignoreLocation:l});if(k>f){break}b=M}const M={isMatch:g>=0,score:Math.max(.001,x)};if(p){const t=H(v,o);if(!t.length){M.isMatch=false}else if(a){M.indices=t}}return M}function J(t){let e={};for(let s=0,i=t.length;s<i;s+=1){const n=t.charAt(s);e[n]=(e[n]||0)|1<<i-s-1}return e}class U{constructor(t,{location:e=E.location,threshold:s=E.threshold,distance:i=E.distance,includeMatches:n=E.includeMatches,findAllMatches:r=E.findAllMatches,minMatchCharLength:c=E.minMatchCharLength,isCaseSensitive:o=E.isCaseSensitive,ignoreLocation:a=E.ignoreLocation}={}){this.options={location:e,threshold:s,distance:i,includeMatches:n,findAllMatches:r,minMatchCharLength:c,isCaseSensitive:o,ignoreLocation:a};this.pattern=o?t:t.toLowerCase();this.chunks=[];if(!this.pattern.length){return}const l=(t,e)=>{this.chunks.push({pattern:t,alphabet:J(t),startIndex:e})};const h=this.pattern.length;if(h>K){let t=0;const e=h%K;const s=h-e;while(t<s){l(this.pattern.substr(t,K),t);t+=K}if(e){const t=h-K;l(this.pattern.substr(t),t)}}else{l(this.pattern,0)}}searchIn(t){const{isCaseSensitive:e,includeMatches:s}=this.options;if(!e){t=t.toLowerCase()}if(this.pattern===t){let e={isMatch:true,score:0};if(s){e.indices=[[0,t.length-1]]}return e}const{location:i,distance:n,threshold:r,findAllMatches:c,minMatchCharLength:o,ignoreLocation:a}=this.options;let l=[];let h=0;let d=false;this.chunks.forEach((({pattern:e,alphabet:u,startIndex:f})=>{const{isMatch:g,score:p,indices:v}=P(t,e,u,{location:i+f,distance:n,threshold:r,findAllMatches:c,minMatchCharLength:o,includeMatches:s,ignoreLocation:a});if(g){d=true}h+=p;if(g&&v){l=[...l,...v]}}));let u={isMatch:d,score:d?h/this.chunks.length:1};if(d&&s){u.indices=l}return u}}class Q{constructor(t){this.pattern=t}static isMultiMatch(t){return G(t,this.multiRegex)}static isSingleMatch(t){return G(t,this.singleRegex)}search(){}}function G(t,e){const s=t.match(e);return s?s[1]:null}class X extends Q{constructor(t){super(t)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(t){const e=t===this.pattern;return{isMatch:e,score:e?0:1,indices:[0,this.pattern.length-1]}}}class Y extends Q{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){const e=t.indexOf(this.pattern);const s=e===-1;return{isMatch:s,score:s?0:1,indices:[0,t.length-1]}}}class Z extends Q{constructor(t){super(t)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(t){const e=t.startsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,this.pattern.length-1]}}}class tt extends Q{constructor(t){super(t)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(t){const e=!t.startsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,t.length-1]}}}class et extends Q{constructor(t){super(t)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(t){const e=t.endsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[t.length-this.pattern.length,t.length-1]}}}class st extends Q{constructor(t){super(t)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(t){const e=!t.endsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,t.length-1]}}}class it extends Q{constructor(t,{location:e=E.location,threshold:s=E.threshold,distance:i=E.distance,includeMatches:n=E.includeMatches,findAllMatches:r=E.findAllMatches,minMatchCharLength:c=E.minMatchCharLength,isCaseSensitive:o=E.isCaseSensitive,ignoreLocation:a=E.ignoreLocation}={}){super(t);this._bitapSearch=new U(t,{location:e,threshold:s,distance:i,includeMatches:n,findAllMatches:r,minMatchCharLength:c,isCaseSensitive:o,ignoreLocation:a})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}class nt extends Q{constructor(t){super(t)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let e=0;let s;const i=[];const n=this.pattern.length;while((s=t.indexOf(this.pattern,e))>-1){e=s+n;i.push([s,e-1])}const r=!!i.length;return{isMatch:r,score:r?0:1,indices:i}}}const rt=[X,nt,Z,tt,st,et,Y,it];const ct=rt.length;const ot=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/;const at="|";function lt(t,e={}){return t.split(at).map((t=>{let s=t.trim().split(ot).filter((t=>t&&!!t.trim()));let i=[];for(let t=0,n=s.length;t<n;t+=1){const n=s[t];let r=false;let c=-1;while(!r&&++c<ct){const t=rt[c];let s=t.isMultiMatch(n);if(s){i.push(new t(s,e));r=true}}if(r){continue}c=-1;while(++c<ct){const t=rt[c];let s=t.isSingleMatch(n);if(s){i.push(new t(s,e));break}}}return i}))}const ht=new Set([it.type,nt.type]);class dt{constructor(t,{isCaseSensitive:e=E.isCaseSensitive,includeMatches:s=E.includeMatches,minMatchCharLength:i=E.minMatchCharLength,ignoreLocation:n=E.ignoreLocation,findAllMatches:r=E.findAllMatches,location:c=E.location,threshold:o=E.threshold,distance:a=E.distance}={}){this.query=null;this.options={isCaseSensitive:e,includeMatches:s,minMatchCharLength:i,findAllMatches:r,ignoreLocation:n,location:c,threshold:o,distance:a};this.pattern=e?t:t.toLowerCase();this.query=lt(this.pattern,this.options)}static condition(t,e){return e.useExtendedSearch}searchIn(t){const e=this.query;if(!e){return{isMatch:false,score:1}}const{includeMatches:s,isCaseSensitive:i}=this.options;t=i?t:t.toLowerCase();let n=0;let r=[];let c=0;for(let i=0,o=e.length;i<o;i+=1){const o=e[i];r.length=0;n=0;for(let e=0,i=o.length;e<i;e+=1){const i=o[e];const{isMatch:a,indices:l,score:h}=i.search(t);if(a){n+=1;c+=h;if(s){const t=i.constructor.type;if(ht.has(t)){r=[...r,...l]}else{r.push(l)}}}else{c=0;n=0;r.length=0;break}}if(n){let t={isMatch:true,score:c/n};if(s){t.indices=r}return t}}return{isMatch:false,score:1}}}const ut=[];function ft(...t){ut.push(...t)}function gt(t,e){for(let s=0,i=ut.length;s<i;s+=1){let i=ut[s];if(i.condition(t,e)){return new i(t,e)}}return new U(t,e)}const pt={AND:"$and",OR:"$or"};const vt={PATH:"$path",PATTERN:"$val"};const mt=t=>!!(t[pt.AND]||t[pt.OR]);const bt=t=>!!t[vt.PATH];const xt=t=>!l(t)&&v(t)&&!mt(t);const yt=t=>({[pt.AND]:Object.keys(t).map((e=>({[e]:t[e]})))});function wt(t,e,{auto:s=true}={}){const i=t=>{let n=Object.keys(t);const r=bt(t);if(!r&&n.length>1&&!mt(t)){return i(yt(t))}if(xt(t)){const i=r?t[vt.PATH]:n[0];const c=r?t[vt.PATTERN]:t[i];if(!f(c)){throw new Error(k(i))}const o={keyId:F(i),pattern:c};if(s){o.searcher=gt(c,e)}return o}let c={children:[],operator:n[0]};n.forEach((e=>{const s=t[e];if(l(s)){s.forEach((t=>{c.children.push(i(t))}))}}));return c};if(!mt(t)){t=yt(t)}return i(t)}function Mt(t,{ignoreFieldNorm:e=E.ignoreFieldNorm}){t.forEach((t=>{let s=1;t.matches.forEach((({key:t,norm:i,score:n})=>{const r=t?t.weight:null;s*=Math.pow(n===0&&r?Number.EPSILON:n,(r||1)*(e?1:i))}));t.score=s}))}function kt(t,e){const s=t.matches;e.matches=[];if(!b(s)){return}s.forEach((t=>{if(!b(t.indices)||!t.indices.length){return}const{indices:s,value:i}=t;let n={indices:s,value:i};if(t.key){n.key=t.key.src}if(t.idx>-1){n.refIndex=t.idx}e.matches.push(n)}))}function _t(t,e){e.score=t.score}function Lt(t,e,{includeMatches:s=E.includeMatches,includeScore:i=E.includeScore}={}){const n=[];if(s)n.push(kt);if(i)n.push(_t);return t.map((t=>{const{idx:s}=t;const i={item:e[s],refIndex:s};if(n.length){n.forEach((e=>{e(t,i)}))}return i}))}class St{constructor(t,e={},s){this.options={...E,...e};if(this.options.useExtendedSearch&&!true){throw new Error(w)}this._keyStore=new C(this.options.keys);this.setCollection(t,s)}setCollection(t,e){this._docs=t;if(e&&!(e instanceof T)){throw new Error(M)}this._myIndex=e||D(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){if(!b(t)){return}this._docs.push(t);this._myIndex.add(t)}remove(t=(()=>false)){const e=[];for(let s=0,i=this._docs.length;s<i;s+=1){const n=this._docs[s];if(t(n,s)){this.removeAt(s);s-=1;i-=1;e.push(n)}}return e}removeAt(t){this._docs.splice(t,1);this._myIndex.removeAt(t)}getIndex(){return this._myIndex}search(t,{limit:e=-1}={}){const{includeMatches:s,includeScore:i,shouldSort:n,sortFn:r,ignoreFieldNorm:c}=this.options;let o=f(t)?f(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t);Mt(o,{ignoreFieldNorm:c});if(n){o.sort(r)}if(g(e)&&e>-1){o=o.slice(0,e)}return Lt(o,this._docs,{includeMatches:s,includeScore:i})}_searchStringList(t){const e=gt(t,this.options);const{records:s}=this._myIndex;const i=[];s.forEach((({v:t,i:s,n})=>{if(!b(t)){return}const{isMatch:r,score:c,indices:o}=e.searchIn(t);if(r){i.push({item:t,idx:s,matches:[{score:c,value:t,norm:n,indices:o}]})}}));return i}_searchLogical(t){const e=wt(t,this.options);const s=(t,e,i)=>{if(!t.children){const{keyId:s,searcher:n}=t;const r=this._findMatches({key:this._keyStore.get(s),value:this._myIndex.getValueForItemAtKeyId(e,s),searcher:n});if(r&&r.length){return[{idx:i,item:e,matches:r}]}return[]}const n=[];for(let r=0,c=t.children.length;r<c;r+=1){const c=t.children[r];const o=s(c,e,i);if(o.length){n.push(...o)}else if(t.operator===pt.AND){return[]}}return n};const i=this._myIndex.records;const n={};const r=[];i.forEach((({$:t,i})=>{if(b(t)){let c=s(e,t,i);if(c.length){if(!n[i]){n[i]={idx:i,item:t,matches:[]};r.push(n[i])}c.forEach((({matches:t})=>{n[i].matches.push(...t)}))}}}));return r}_searchObjectList(t){const e=gt(t,this.options);const{keys:s,records:i}=this._myIndex;const n=[];i.forEach((({$:t,i})=>{if(!b(t)){return}let r=[];s.forEach(((s,i)=>{r.push(...this._findMatches({key:s,value:t[i],searcher:e}))}));if(r.length){n.push({idx:i,item:t,matches:r})}}));return n}_findMatches({key:t,value:e,searcher:s}){if(!b(e)){return[]}let i=[];if(l(e)){e.forEach((({v:e,i:n,n:r})=>{if(!b(e)){return}const{isMatch:c,score:o,indices:a}=s.searchIn(e);if(c){i.push({score:o,key:t,value:e,idx:n,norm:r,indices:a})}}))}else{const{v:n,n:r}=e;const{isMatch:c,score:o,indices:a}=s.searchIn(n);if(c){i.push({score:o,key:t,value:n,norm:r,indices:a})}}return i}}St.version="6.6.2";St.createIndex=D;St.parseIndex=V;St.config=E;{St.parseQuery=wt}{ft(dt)}const $t=":host{display:block;--focus-ring:0 0 0 var(--sc-focus-ring-width) var(--sc-focus-ring-color-primary)}.search{margin:var(--sc-spacing-x-small) var(--sc-spacing-x-small) 0 var(--sc-spacing-x-small)}.loading{text-align:center;margin:var(--sc-spacing-small)}.select{font-family:var(--sc-input-font-family);font-weight:var(--sc-font-weight-normal)}sc-dropdown{display:block}.trigger{overflow:hidden;box-sizing:border-box;width:100%;display:flex;align-items:center;justify-content:space-between;width:100%;border-style:solid;border-width:var(--sc-input-border-width);background-color:var(--sc-select-background-color, var(--sc-color-white));border-color:var(--sc-select-border-color, var(--sc-color-gray-300));color:var(--sc-input-color);text-decoration:none;user-select:none;white-space:nowrap;vertical-align:middle;transition:var(--sc-input-transition, var(--sc-transition-medium)) background-color, var(--sc-input-transition, var(--sc-transition-medium)) color, var(--sc-input-transition, var(--sc-transition-medium)) border, var(--sc-input-transition, var(--sc-transition-medium)) box-shadow;cursor:inherit;box-shadow:var(--sc-shadow-small);font-size:var(--sc-button-font-size-medium);min-height:var(--sc-input-height-medium);line-height:calc(var(--sc-input-height-medium) - var(--sc-input-border-width) * 2);border-radius:var(--sc-input-border-radius-medium);padding:0 var(--sc-spacing-medium)}.trigger svg{display:block;width:1em;height:1em}.select.select--focused:not(.select--disabled) .trigger{background-color:var(--sc-input-background-color-focus);border-color:var(--sc-input-border-color-focus);box-shadow:var(--focus-ring);z-index:2}.select--disabled{cursor:not-allowed}.select--disabled sc-dropdown{opacity:0.65}.select__value{overflow:hidden;text-overflow:ellipsis}.select__empty{text-align:center;margin:var(--sc-spacing-small);color:var(--sc-color-gray-400)}.select--placeholder .trigger{color:var(--sc-input-placeholder-color)}.select__hidden-input{position:absolute;opacity:0;padding:0px;margin:0px;pointer-events:none;width:0}.select__suffix-description,.select__description{font-size:var(--sc-input-help-text-font-size-medium);opacity:0.65}.select__caret{transition:transform 0.25s ease;line-height:0}.select--is-open .select__caret{transform:rotate(180deg)}.select--squared .trigger{border-radius:0}.select--squared-top .trigger{border-top-left-radius:0;border-top-right-radius:0}.select--squared-bottom .trigger{border-bottom-left-radius:0;border-bottom-right-radius:0}.select--squared-left .trigger{border-top-left-radius:0;border-bottom-left-radius:0}.select--squared-right .trigger{border-top-right-radius:0;border-bottom-right-radius:0}.choice__icon--image{width:18px;height:18px;object-fit:contain}sc-menu-item.is-unavailable{--sc-menu-item-color:var(--sc-color-gray-500)}";const Ct=$t;let At=0;let It=0;let Ft="";const Nt=class{constructor(e){t(this,e);this.scSearch=s(this,"scSearch",7);this.scOpen=s(this,"scOpen",7);this.scClose=s(this,"scClose",7);this.scBlur=s(this,"scBlur",7);this.scFocus=s(this,"scFocus",7);this.scChange=s(this,"scChange",7);this.scScrollEnd=s(this,"scScrollEnd",7);this.inputId=`select-${++At}`;this.helpId=`select-help-text-${At}`;this.labelId=`select-label-${At}`;this.autocomplete=undefined;this.placeholder="";this.searchPlaceholder="";this.value="";this.choices=[];this.unselect=true;this.required=undefined;this.loading=undefined;this.search=undefined;this.closeOnSelect=true;this.name=undefined;this.help=undefined;this.label=undefined;this.size="medium";this.position="bottom-right";this.placement="bottom-start";this.invalid=false;this.open=undefined;this.disabled=undefined;this.showParentLabel=true;this.hoist=false;this.squared=undefined;this.squaredBottom=undefined;this.squaredTop=undefined;this.squaredLeft=undefined;this.squaredRight=undefined;this.hasFocus=false;this.searchTerm="";this.filteredChoices=[]}handleShow(){this.open=true;setTimeout((()=>{this.searchInput&&this.searchInput.triggerFocus()}),50)}handleHide(){this.open=false;It=0;this.scClose.emit()}handleBlur(){this.hasFocus=false;this.scBlur.emit()}handleFocus(){this.hasFocus=true;this.el.focus();this.scFocus.emit()}displayValue(){var t;if(!this.value)return false;let e=this.choices.find((t=>t.value==this.value));let s="";if(!e){if(this.showParentLabel){s=(t=this.choices.find((t=>{var e,s;return(s=(e=t===null||t===void 0?void 0:t.choices)===null||e===void 0?void 0:e.some)===null||s===void 0?void 0:s.call(e,(t=>t.value===this.value))})))===null||t===void 0?void 0:t.label}const i=(this.choices||[]).map((t=>t.choices)).flat();e=i.find((t=>(t===null||t===void 0?void 0:t.value)==this.value))}if(e){return`${s?s+" — ":""}${e===null||e===void 0?void 0:e.label}`}return false}isChecked({value:t,checked:e=false}){if(e){return true}return!!t&&this.value===t}async setCustomValidity(t){this.input.setCustomValidity(t);this.invalid=!this.input.checkValidity()}async reportValidity(){return this.input.reportValidity()}handleQuery(t){this.searchTerm=t.target.value;this.scSearch.emit(this.searchTerm)}handleSelect(t){const{value:e}=t;if(this.value===e&&this.unselect){this.value=""}else{this.value=e}if(this.closeOnSelect){this.searchTerm=""}this.scChange.emit(t)}handleInputChange(){if(!this.input||this.input.value===this.value)return;const t=this.input.value;const e=this.choices.find((e=>e.value===t||e.label===t));if(e){this.value=e.value;this.scChange.emit(e)}}handleSearchChange(){const t=new St(this.choices,{keys:["value","label"]});if(this.searchTerm){const e=t.search(this.searchTerm);this.filteredChoices=e.map((t=>t.item))}else{this.filteredChoices=this.choices}}handleValueChange(){if(this.input){this.invalid=!this.input.checkValidity()}}handleOpenChange(){if(this.open){this.scOpen.emit();this.searchInput&&this.searchInput.triggerFocus()}else{this.scClose.emit()}}handleMenuScroll(t){const e=t.target.scrollTop;const s=t.target.scrollHeight;const i=t.target.offsetHeight;const n=s-i;if(n-e<5)this.scScrollEnd.emit()}componentWillLoad(){this.handleSearchChange()}componentDidLoad(){this.formController=new n(this.el).addFormData();if(this.open){this.searchInput&&this.searchInput.triggerFocus()}}getItems(){return[...this.el.shadowRoot.querySelectorAll("sc-menu-item")]}handleKeyDown(t){var e,s;t.stopPropagation();const i=t.target;const n=this.getItems();if(i.tagName.toLowerCase()==="sc-tag"){return}if(t.key==="Tab"){if(this.open){this.handleHide()}return}if(["ArrowDown","ArrowUp"].includes(t.key)){t.preventDefault();if(!this.open){this.handleShow()}if(t.key==="ArrowDown"){if(Ft=="up"){It=It+2}if(It>n.length-1){It=0}n[It].setFocus();Ft="down";It++;return}if(t.key==="ArrowUp"){if(Ft=="down"){It=It-2}if(It<0){It=n.length-1}n[It].setFocus();Ft="up";It--;return}}if(t.key==="Escape"){if(this.open){this.input.focus();this.handleHide()}return}if(t.key==="Enter"){if(this.open){(s=(e=n[It-1])===null||e===void 0?void 0:e.click)===null||s===void 0?void 0:s.call(e);this.handleHide();this.input.focus()}else{this.handleShow()}}if(t.ctrlKey||t.metaKey){return}if(!this.open&&this.hasFocus&&t.key.length===1){this.handleShow()}}disconnectedCallback(){var t;(t=this.formController)===null||t===void 0?void 0:t.removeFormData()}renderIcon(t){if(r(t)){return e("img",{src:t,alt:"icon",slot:"prefix",class:"choice__icon--image"})}return e("sc-icon",{name:t,slot:"prefix",class:"choice__icon"})}renderItem(t,s){var i;const n=`${(t===null||t===void 0?void 0:t.value)||(t===null||t===void 0?void 0:t.label)||"item"}-${s}`;if((i=t===null||t===void 0?void 0:t.choices)===null||i===void 0?void 0:i.length){return e("sc-menu-label",{key:n},t===null||t===void 0?void 0:t.label)}return e("sc-menu-item",{class:{"is-unavailable":t===null||t===void 0?void 0:t.unavailable},key:n,checked:this.isChecked(t),value:t===null||t===void 0?void 0:t.value,onClick:()=>!t.disabled&&this.handleSelect(t),onKeyDown:e=>{if((e.key==="Enter"||e.key===" ")&&!t.disabled){e.preventDefault();e.stopImmediatePropagation();this.handleSelect(t)}},disabled:t.disabled,"aria-label":t.label,"aria-selected":this.isChecked(t)?"true":"false",role:"option"},t.label,!!(t===null||t===void 0?void 0:t.description)&&e("div",{class:"select__description"},t===null||t===void 0?void 0:t.description),e("div",{slot:"suffix"},t===null||t===void 0?void 0:t.suffix," ",!!(t===null||t===void 0?void 0:t.suffixDescription)&&e("div",{class:"select__suffix-description"},t===null||t===void 0?void 0:t.suffixDescription)),!!(t===null||t===void 0?void 0:t.icon)&&this.renderIcon(t.icon))}render(){var t;return e("div",{key:"5181fa1d8ddde888c44f998b58bb2af467754b72",part:"base",class:{select:true,"select--placeholder":!this.value,"select--focused":this.hasFocus,"select--is-open":!!this.open,"select--disabled":this.disabled,"select--has-choices":!!((t=this===null||this===void 0?void 0:this.choices)===null||t===void 0?void 0:t.length),"select--squared":this.squared,"select--squared-bottom":this.squaredBottom,"select--squared-top":this.squaredTop,"select--squared-left":this.squaredLeft,"select--squared-right":this.squaredRight}},e("sc-form-control",{key:"c17b48a5e605814954bab399a942c7ee6388b190",exportparts:"label, help-text, form-control",size:this.size,required:this.required,label:this.label,help:this.help,inputId:this.inputId,helpId:this.helpId,labelId:this.labelId,name:this.name},e("input",{key:"edd4f01093a0ccf6172c6f26b3c069710c80833e",class:"select__hidden-input",name:this.name,ref:t=>this.input=t,value:this.value,required:this.required,disabled:this.disabled,autocomplete:this.autocomplete,tabindex:"-1","aria-label":this.displayValue()||this.label||this.placeholder,onBlur:()=>this.handleBlur(),onFocus:()=>this.handleFocus(),onChange:()=>this.handleInputChange()}),e("sc-dropdown",{key:"2b935ce8951c0f0ec9faa27632c6eb9b16782468",exportparts:"trigger, panel",disabled:this.disabled,open:this.open,closeOnSelect:this.closeOnSelect,position:this.position,placement:this.placement,hoist:this.hoist,style:{"--panel-width":"100%"},onScShow:()=>this.handleShow(),onScHide:()=>this.handleHide(),role:"select","aria-open":this.open?"true":"false"},e("slot",{key:"a93eec18b9f24592459d379bfaff789cc9bea42c",name:"trigger",slot:"trigger"},e("div",{key:"5846af7af673ed4a5099474dd9159b3ac0e85667",class:"trigger",role:"button",tabIndex:-1,onFocus:()=>this.handleFocus(),onBlur:()=>this.handleBlur()},e("div",{key:"28cf509778115c4b52a1e22e60c6257f14eb6061",class:"select__value"},e("slot",{key:"b413cce7bfaff125439c79d37be1b17d09a862b4"},this.displayValue()||this.placeholder||wp.i18n.__("Select...","surecart"))),e("sc-icon",{key:"60ce4379dbe9d3b9efff58d32a03ae251191adce",exportparts:"base:caret",class:"select__caret",name:"chevron-down"}))),this.search&&e("sc-input",{key:"d9e1c963608107158278c1c91c1fdde8d5f91213",exportparts:"base:search__base, input:search__input, form-control:search__form-control",placeholder:this.searchPlaceholder||wp.i18n.__("Search...","surecart"),onScInput:t=>this.handleQuery(t),class:"search",clearable:true,part:"search",value:this.searchTerm,ref:t=>this.searchInput=t,"aria-label":wp.i18n.__("Type to search","surecart")},this.loading&&e("sc-spinner",{key:"72113a6c190a31f152f15c90f4db82ce543705fe",exportparts:"base:spinner__base",style:{"--spinner-size":"0.5em"},slot:"suffix"})),e("sc-menu",{key:"d525dd8274dd30e617ea2d986290ade9bf908ded",style:{maxHeight:this.open?"210px":"0px",overflow:"auto"},exportparts:"base:menu__base",onScroll:t=>this.handleMenuScroll(t),"aria-multiselectable":"false"},e("slot",{key:"638d57709a40e1976587d42703270cba9e425b24",name:"prefix"}),(this.filteredChoices||[]).map(((t,e)=>[this.renderItem(t,e),(t.choices||[]).map((t=>this.renderItem(t,e)))])),this.loading&&e("div",{key:"f3f95cd6f3be5b86f3dbdf08b67c90a10054f319",class:"loading"},e("sc-spinner",{key:"674298aa399e3c291a14da5e2ffe6571100b359e",exportparts:"base:spinner__base"})),!this.loading&&!this.filteredChoices.length&&e("div",{key:"ecdde54367f2c73f9917dff3a9f379495c9fd7cf",class:"select__empty",part:"empty"},wp.i18n.__("Nothing Found","surecart")),e("slot",{key:"53a3f189574339651dc0cca8e60313ad32840af3",name:"suffix"})))))}get el(){return i(this)}static get watchers(){return{searchTerm:["handleSearchChange"],choices:["handleSearchChange"],value:["handleValueChange"],open:["handleOpenChange"]}}};Nt.style=Ct;export{a as sc_menu_label,Nt as sc_select}; //# sourceMappingURL=p-e8affa66.entry.js.map