D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
diafdxji
/
shihty.com
/
wp-content
/
plugins
/
surecart
/
dist
/
components
/
surecart
/
Filename :
p-3b33963f.entry.js
back
Copy
import{r as t,c as e,h as n,a as i}from"./p-e97fde0a.js";import{s as o}from"./p-830ab1a3.js";import{i as s}from"./p-b0d8cd6e.js";function r(t){return t.split("-")[0]}function a(t){return t.split("-")[1]}function c(t){return["top","bottom"].includes(r(t))?"x":"y"}function l(t){return t==="y"?"height":"width"}function f(t,e,n){let{reference:i,floating:o}=t;const s=i.x+i.width/2-o.width/2;const f=i.y+i.height/2-o.height/2;const u=c(e);const d=l(u);const h=i[d]/2-o[d]/2;const m=r(e);const p=u==="x";let g;switch(m){case"top":g={x:s,y:i.y-o.height};break;case"bottom":g={x:s,y:i.y+i.height};break;case"right":g={x:i.x+i.width,y:f};break;case"left":g={x:i.x-o.width,y:f};break;default:g={x:i.x,y:i.y}}switch(a(e)){case"start":g[u]-=h*(n&&p?-1:1);break;case"end":g[u]+=h*(n&&p?-1:1);break}return g}const u=async(t,e,n)=>{const{placement:i="bottom",strategy:o="absolute",middleware:s=[],platform:r}=n;const a=await(r.isRTL==null?void 0:r.isRTL(e));let c=await r.getElementRects({reference:t,floating:e,strategy:o});let{x:l,y:u}=f(c,i,a);let d=i;let h={};let m=0;for(let n=0;n<s.length;n++){const{name:p,fn:g}=s[n];const{x:b,y:w,data:y,reset:x}=await g({x:l,y:u,initialPlacement:i,placement:d,strategy:o,middlewareData:h,rects:c,platform:r,elements:{reference:t,floating:e}});l=b!=null?b:l;u=w!=null?w:u;h={...h,[p]:{...h[p],...y}};if(x&&m<=50){m++;if(typeof x==="object"){if(x.placement){d=x.placement}if(x.rects){c=x.rects===true?await r.getElementRects({reference:t,floating:e,strategy:o}):x.rects}({x:l,y:u}=f(c,d,a))}n=-1;continue}}return{x:l,y:u,placement:d,strategy:o,middlewareData:h}};function d(t){return{top:0,right:0,bottom:0,left:0,...t}}function h(t){return typeof t!=="number"?d(t):{top:t,right:t,bottom:t,left:t}}function m(t){return{...t,top:t.y,left:t.x,right:t.x+t.width,bottom:t.y+t.height}}async function p(t,e){var n;if(e===void 0){e={}}const{x:i,y:o,platform:s,rects:r,elements:a,strategy:c}=t;const{boundary:l="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:d=false,padding:p=0}=e;const g=h(p);const b=u==="floating"?"reference":"floating";const w=a[d?b:u];const y=m(await s.getClippingRect({element:((n=await(s.isElement==null?void 0:s.isElement(w)))!=null?n:true)?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:l,rootBoundary:f,strategy:c}));const x=m(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({rect:u==="floating"?{...r.floating,x:i,y:o}:r.reference,offsetParent:await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),strategy:c}):r[u]);return{top:y.top-x.top+g.top,bottom:x.bottom-y.bottom+g.bottom,left:y.left-x.left+g.left,right:x.right-y.right+g.right}}const g=Math.min;const b=Math.max;function w(t,e,n){return b(t,g(e,n))}const y={left:"right",right:"left",bottom:"top",top:"bottom"};function x(t){return t.replace(/left|right|bottom|top/g,(t=>y[t]))}function v(t,e,n){if(n===void 0){n=false}const i=a(t);const o=c(t);const s=l(o);let r=o==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";if(e.reference[s]>e.floating[s]){r=x(r)}return{main:r,cross:x(r)}}const k={start:"end",end:"start"};function _(t){return t.replace(/start|end/g,(t=>k[t]))}function A(t){const e=x(t);return[_(t),e,_(e)]}const C=function(t){if(t===void 0){t={}}return{name:"flip",options:t,async fn(e){var n;const{placement:i,middlewareData:o,rects:s,initialPlacement:a,platform:c,elements:l}=e;const{mainAxis:f=true,crossAxis:u=true,fallbackPlacements:d,fallbackStrategy:h="bestFit",flipAlignment:m=true,...g}=t;const b=r(i);const w=b===a;const y=d||(w||!m?[x(a)]:A(a));const k=[a,...y];const _=await p(e,g);const C=[];let D=((n=o.flip)==null?void 0:n.overflows)||[];if(f){C.push(_[b])}if(u){const{main:t,cross:e}=v(i,s,await(c.isRTL==null?void 0:c.isRTL(l.floating)));C.push(_[t],_[e])}D=[...D,{placement:i,overflows:C}];if(!C.every((t=>t<=0))){var z,S;const t=((z=(S=o.flip)==null?void 0:S.index)!=null?z:0)+1;const e=k[t];if(e){return{data:{index:t,overflows:D},reset:{placement:e}}}let n="bottom";switch(h){case"bestFit":{var R;const t=(R=D.map((t=>[t,t.overflows.filter((t=>t>0)).reduce(((t,e)=>t+e),0)])).sort(((t,e)=>t[1]-e[1]))[0])==null?void 0:R[0].placement;if(t){n=t}break}case"initialPlacement":n=a;break}if(i!==n){return{reset:{placement:n}}}}return{}}}};async function D(t,e){const{placement:n,platform:i,elements:o}=t;const s=await(i.isRTL==null?void 0:i.isRTL(o.floating));const l=r(n);const f=a(n);const u=c(n)==="x";const d=["left","top"].includes(l)?-1:1;const h=s&&u?-1:1;const m=typeof e==="function"?e(t):e;let{mainAxis:p,crossAxis:g,alignmentAxis:b}=typeof m==="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...m};if(f&&typeof b==="number"){g=f==="end"?b*-1:b}return u?{x:g*h,y:p*d}:{x:p*d,y:g*h}}const z=function(t){if(t===void 0){t=0}return{name:"offset",options:t,async fn(e){const{x:n,y:i}=e;const o=await D(e,t);return{x:n+o.x,y:i+o.y,data:o}}}};function S(t){return t==="x"?"y":"x"}const R=function(t){if(t===void 0){t={}}return{name:"shift",options:t,async fn(e){const{x:n,y:i,placement:o}=e;const{mainAxis:s=true,crossAxis:a=false,limiter:l={fn:t=>{let{x:e,y:n}=t;return{x:e,y:n}}},...f}=t;const u={x:n,y:i};const d=await p(e,f);const h=c(r(o));const m=S(h);let g=u[h];let b=u[m];if(s){const t=h==="y"?"top":"left";const e=h==="y"?"bottom":"right";const n=g+d[t];const i=g-d[e];g=w(n,g,i)}if(a){const t=m==="y"?"top":"left";const e=m==="y"?"bottom":"right";const n=b+d[t];const i=b-d[e];b=w(n,b,i)}const y=l.fn({...e,[h]:g,[m]:b});return{...y,data:{x:y.x-n,y:y.y-i}}}}};const M=function(t){if(t===void 0){t={}}return{name:"size",options:t,async fn(e){const{placement:n,rects:i,platform:o,elements:s}=e;const{apply:c,...l}=t;const f=await p(e,l);const u=r(n);const d=a(n);let h;let m;if(u==="top"||u==="bottom"){h=u;m=d===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"}else{m=u;h=d==="end"?"top":"bottom"}const g=b(f.left,0);const w=b(f.right,0);const y=b(f.top,0);const x=b(f.bottom,0);const v={availableHeight:i.floating.height-(["left","right"].includes(n)?2*(y!==0||x!==0?y+x:b(f.top,f.bottom)):f[h]),availableWidth:i.floating.width-(["top","bottom"].includes(n)?2*(g!==0||w!==0?g+w:b(f.left,f.right)):f[m])};const k=await o.getDimensions(s.floating);c==null?void 0:c({...e,...v});const _=await o.getDimensions(s.floating);if(k.width!==_.width||k.height!==_.height){return{reset:{rects:true}}}return{}}}};function P(t){return t&&t.document&&t.location&&t.alert&&t.setInterval}function E(t){if(t==null){return window}if(!P(t)){const e=t.ownerDocument;return e?e.defaultView||window:window}return t}function B(t){return E(t).getComputedStyle(t)}function F(t){return P(t)?"":t?(t.nodeName||"").toLowerCase():""}function L(){const t=navigator.userAgentData;if(t!=null&&t.brands){return t.brands.map((t=>t.brand+"/"+t.version)).join(" ")}return navigator.userAgent}function O(t){return t instanceof E(t).HTMLElement}function T(t){return t instanceof E(t).Element}function H(t){return t instanceof E(t).Node}function j(t){if(typeof ShadowRoot==="undefined"){return false}const e=E(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function U(t){const{overflow:e,overflowX:n,overflowY:i}=B(t);return/auto|scroll|overlay|hidden/.test(e+i+n)}function I(t){return["table","td","th"].includes(F(t))}function K(t){const e=/firefox/i.test(L());const n=B(t);return n.transform!=="none"||n.perspective!=="none"||n.contain==="paint"||["transform","perspective"].includes(n.willChange)||e&&n.willChange==="filter"||e&&(n.filter?n.filter!=="none":false)}function W(){return!/^((?!chrome|android).)*safari/i.test(L())}const $=Math.min;const q=Math.max;const V=Math.round;function X(t,e,n){var i,o,s,r;if(e===void 0){e=false}if(n===void 0){n=false}const a=t.getBoundingClientRect();let c=1;let l=1;if(e&&O(t)){c=t.offsetWidth>0?V(a.width)/t.offsetWidth||1:1;l=t.offsetHeight>0?V(a.height)/t.offsetHeight||1:1}const f=T(t)?E(t):window;const u=!W()&&n;const d=(a.left+(u?(i=(o=f.visualViewport)==null?void 0:o.offsetLeft)!=null?i:0:0))/c;const h=(a.top+(u?(s=(r=f.visualViewport)==null?void 0:r.offsetTop)!=null?s:0:0))/l;const m=a.width/c;const p=a.height/l;return{width:m,height:p,top:h,right:d+m,bottom:h+p,left:d,x:d,y:h}}function Y(t){return((H(t)?t.ownerDocument:t.document)||window.document).documentElement}function G(t){if(T(t)){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function J(t){return X(Y(t)).left+G(t).scrollLeft}function N(t){const e=X(t);return V(e.width)!==t.offsetWidth||V(e.height)!==t.offsetHeight}function Q(t,e,n){const i=O(e);const o=Y(e);const s=X(t,i&&N(e),n==="fixed");let r={scrollLeft:0,scrollTop:0};const a={x:0,y:0};if(i||!i&&n!=="fixed"){if(F(e)!=="body"||U(o)){r=G(e)}if(O(e)){const t=X(e,true);a.x=t.x+e.clientLeft;a.y=t.y+e.clientTop}else if(o){a.x=J(o)}}return{x:s.left+r.scrollLeft-a.x,y:s.top+r.scrollTop-a.y,width:s.width,height:s.height}}function Z(t){if(F(t)==="html"){return t}return t.assignedSlot||t.parentNode||(j(t)?t.host:null)||Y(t)}function tt(t){if(!O(t)||getComputedStyle(t).position==="fixed"){return null}return t.offsetParent}function et(t){let e=Z(t);if(j(e)){e=e.host}while(O(e)&&!["html","body"].includes(F(e))){if(K(e)){return e}else{e=e.parentNode}}return null}function nt(t){const e=E(t);let n=tt(t);while(n&&I(n)&&getComputedStyle(n).position==="static"){n=tt(n)}if(n&&(F(n)==="html"||F(n)==="body"&&getComputedStyle(n).position==="static"&&!K(n))){return e}return n||et(t)||e}function it(t){if(O(t)){return{width:t.offsetWidth,height:t.offsetHeight}}const e=X(t);return{width:e.width,height:e.height}}function ot(t){let{rect:e,offsetParent:n,strategy:i}=t;const o=O(n);const s=Y(n);if(n===s){return e}let r={scrollLeft:0,scrollTop:0};const a={x:0,y:0};if(o||!o&&i!=="fixed"){if(F(n)!=="body"||U(s)){r=G(n)}if(O(n)){const t=X(n,true);a.x=t.x+n.clientLeft;a.y=t.y+n.clientTop}}return{...e,x:e.x-r.scrollLeft+a.x,y:e.y-r.scrollTop+a.y}}function st(t,e){const n=E(t);const i=Y(t);const o=n.visualViewport;let s=i.clientWidth;let r=i.clientHeight;let a=0;let c=0;if(o){s=o.width;r=o.height;const t=W();if(t||!t&&e==="fixed"){a=o.offsetLeft;c=o.offsetTop}}return{width:s,height:r,x:a,y:c}}function rt(t){var e;const n=Y(t);const i=G(t);const o=(e=t.ownerDocument)==null?void 0:e.body;const s=q(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0);const r=q(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0);let a=-i.scrollLeft+J(t);const c=-i.scrollTop;if(B(o||n).direction==="rtl"){a+=q(n.clientWidth,o?o.clientWidth:0)-s}return{width:s,height:r,x:a,y:c}}function at(t){const e=Z(t);if(["html","body","#document"].includes(F(e))){return t.ownerDocument.body}if(O(e)&&U(e)){return e}return at(e)}function ct(t,e){var n;if(e===void 0){e=[]}const i=at(t);const o=i===((n=t.ownerDocument)==null?void 0:n.body);const s=E(i);const r=o?[s].concat(s.visualViewport||[],U(i)?i:[]):i;const a=e.concat(r);return o?a:a.concat(ct(r))}function lt(t,e){const n=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e)){return true}else if(n&&j(n)){let n=e;do{if(n&&t===n){return true}n=n.parentNode||n.host}while(n)}return false}function ft(t,e){const n=X(t,false,e==="fixed");const i=n.top+t.clientTop;const o=n.left+t.clientLeft;return{top:i,left:o,x:o,y:i,right:o+t.clientWidth,bottom:i+t.clientHeight,width:t.clientWidth,height:t.clientHeight}}function ut(t,e,n){if(e==="viewport"){return m(st(t,n))}if(T(e)){return ft(e,n)}return m(rt(Y(t)))}function dt(t){const e=ct(t);const n=["absolute","fixed"].includes(B(t).position);const i=n&&O(t)?nt(t):t;if(!T(i)){return[]}return e.filter((t=>T(t)&<(t,i)&&F(t)!=="body"))}function ht(t){let{element:e,boundary:n,rootBoundary:i,strategy:o}=t;const s=n==="clippingAncestors"?dt(e):[].concat(n);const r=[...s,i];const a=r[0];const c=r.reduce(((t,n)=>{const i=ut(e,n,o);t.top=q(i.top,t.top);t.right=$(i.right,t.right);t.bottom=$(i.bottom,t.bottom);t.left=q(i.left,t.left);return t}),ut(e,a,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}const mt={getClippingRect:ht,convertOffsetParentRelativeRectToViewportRelativeRect:ot,isElement:T,getDimensions:it,getOffsetParent:nt,getDocumentElement:Y,getElementRects:t=>{let{reference:e,floating:n,strategy:i}=t;return{reference:Q(e,nt(n),i),floating:{...it(n),x:0,y:0}}},getClientRects:t=>Array.from(t.getClientRects()),isRTL:t=>B(t).direction==="rtl"};function pt(t,e,n,i){if(i===void 0){i={}}const{ancestorScroll:o=true,ancestorResize:s=true,elementResize:r=true,animationFrame:a=false}=i;const c=o&&!a;const l=s&&!a;const f=c||l?[...T(t)?ct(t):[],...ct(e)]:[];f.forEach((t=>{c&&t.addEventListener("scroll",n,{passive:true});l&&t.addEventListener("resize",n)}));let u=null;if(r){let i=true;u=new ResizeObserver((()=>{if(!i){n()}i=false}));T(t)&&!a&&u.observe(t);u.observe(e)}let d;let h=a?X(t):null;if(a){m()}function m(){const e=X(t);if(h&&(e.x!==h.x||e.y!==h.y||e.width!==h.width||e.height!==h.height)){n()}h=e;d=requestAnimationFrame(m)}n();return()=>{var t;f.forEach((t=>{c&&t.removeEventListener("scroll",n);l&&t.removeEventListener("resize",n)}));(t=u)==null?void 0:t.disconnect();u=null;if(a){cancelAnimationFrame(d)}}}const gt=(t,e,n)=>u(t,e,{platform:mt,...n});const bt=":host{display:inline-block;--panel-height:75vh;--panel-width:11rem}.dropdown{position:relative}.dropdown.dropdown--open .dropdown__positioner{visibility:visible;opacity:1;transform:scale(1)}.dropdown__trigger{display:block;cursor:pointer;border-width:0;outline:none;background-color:unset}.dropdown--disabled,.dropdown--disabled .dropdown__trigger{cursor:not-allowed}.dropdown__positioner{position:absolute;right:0;width:100%;z-index:var(--sc-z-index-dropdown);opacity:0;visibility:hidden;transform:scale(0.9);min-width:var(--panel-width)}.dropdown__panel{transform-origin:top left;box-shadow:0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);max-height:var(--panel-height);font-family:var(--sc-font-sans);font-size:var(--sc-font-size-medium);font-weight:var(--sc-font-weight-normal);color:var(--color);background-color:var(--sc-panel-background-color);border:solid 1px var(--sc-panel-border-color);border-radius:var(--sc-border-radius-medium);box-shadow:var(--sc-shadow-large);overflow:auto;overscroll-behavior:none;transition:var(--sc-transition-fast) opacity, var(--sc-transition-fast) transform;z-index:5}";const wt=bt;let yt=0;let xt="";const vt=class{constructor(n){t(this,n);this.scShow=e(this,"scShow",7);this.scHide=e(this,"scHide",7);this.clickEl=undefined;this.disabled=undefined;this.open=false;this.position=undefined;this.placement="bottom-start";this.distance=10;this.skidding=0;this.hoist=false;this.closeOnSelect=true;this.isVisible=undefined}handleOpenChange(){this.open?this.show():this.hide()}handleOutsideClick(t){const e=t.composedPath();if(!e.some((t=>t===this.el))){this.open=false}}startPositioner(){this.stopPositioner();this.updatePositioner();this.positionerCleanup=pt(this.trigger,this.positioner,this.updatePositioner.bind(this))}updatePositioner(){if(!this.open||!this.trigger||!this.positioner){return}gt(this.trigger,this.positioner,{placement:this.placement,middleware:[z({mainAxis:this.distance,crossAxis:this.skidding}),C(),R(),M({apply:({availableWidth:t,availableHeight:e})=>{Object.assign(this.panel.style,{maxWidth:`${t}px`,maxHeight:`${e}px`})},padding:8})],strategy:this.hoist?"fixed":"absolute"}).then((({x:t,y:e,placement:n})=>{this.positioner.setAttribute("data-placement",n);Object.assign(this.positioner.style,{position:this.hoist?"fixed":"absolute",left:`${t}px`,top:`${e}px`,right:"auto"})}))}stopPositioner(){if(this.positionerCleanup){this.positionerCleanup();this.positionerCleanup=undefined;this.positioner.removeAttribute("data-placement")}}show(){o(wp.i18n.__("Menu Selection Dropdown opened. Press Up/Down arrow to toggle between menu items.","surecart"),"assertive");this.scShow.emit();if(this.isVisible){return}this.isVisible=true;this.open=true;this.startPositioner();this.panel.focus()}hide(){o(wp.i18n.__("Menu Selection Dropdown closed.","surecart"),"assertive");this.scHide.emit();if(!this.isVisible){return}this.stopPositioner();this.isVisible=false;this.open=false;const t=this.el.shadowRoot.querySelector('slot[name="trigger"]');const e=t.assignedElements({flatten:true})[0];e.focus()}handleClick(t){if(this.closeOnSelect){const e=t.composedPath();if(e.some((t=>t.classList&&t.classList.contains("menu-item")))){this.open=false}}}componentWillLoad(){document.addEventListener("mousedown",(t=>this.handleOutsideClick(t)))}getMenu(){let t=this.el.shadowRoot.querySelector("slot");return t.assignedNodes().find((t=>t.nodeName==="sc-menu"))}getItems(){return[...this.el.querySelectorAll("sc-menu-item")]}handleHide(){this.open=false;yt=0;this.trigger.focus()}handleKeyDown(t){const e=this.getItems();if(t.key==="Tab"){if(this.open){this.handleHide()}return}if(["ArrowDown","ArrowUp"].includes(t.key)){t.preventDefault();t.stopImmediatePropagation();if(!this.open){this.open=true}if(t.key==="ArrowDown"){if(xt=="up"){yt=yt+2}if(yt>e.length-1){yt=0}e[yt].setFocus();xt="down";yt++;return}if(t.key==="ArrowUp"){if(xt=="down"){yt=yt-2}if(yt<0){yt=e.length-1}e[yt].setFocus();xt="up";yt--;return}}if(t.key==="Escape"){if(this.open){this.handleHide()}return}if(t.key==="Enter"){if(this.open){this.handleHide()}else{t.stopImmediatePropagation();t.preventDefault();this.open=true}}if(t.ctrlKey||t.metaKey){return}}render(){return n("div",{key:"990b09ebabaf8ef8b82670058e5c445df2e90ecb",part:"base",class:{dropdown:true,"dropdown--open":this.open,"dropdown--disabled":this.disabled}},n("span",{key:"de5272081c62db268848e5142302ded24582326f",part:"trigger",class:"dropdown__trigger",ref:t=>this.trigger=t,onClick:()=>{if(this.disabled)return;if(this.open){this.hide()}else{setTimeout((()=>{this.show()}),0)}},"aria-expanded":this.open?"true":"false","aria-haspopup":"true"},n("slot",{key:"d509a5082b8b171019d351d0c332182c49d1bc72",name:"trigger"})),n("div",{key:"773c28b5b733cdd14f2d1c83132d3f2c2b9ddca3",class:"dropdown__positioner",ref:t=>this.positioner=t},n("div",{key:"0fb0ec343233622f5e8c61db6d222f948f098e48",part:"panel",class:{dropdown__panel:true,"position--top-left":this.position==="top-left","position--top-right":this.position==="top-right","position--bottom-left":this.position==="bottom-left","position--bottom-right":this.position==="bottom-right"},"aria-orientation":"vertical",tabindex:"-1",onClick:t=>this.handleClick(t),ref:t=>this.panel=t},n("slot",{key:"10ccafd428399e4f5436f6f661984e075a0596dd"}))))}get el(){return i(this)}static get watchers(){return{open:["handleOpenChange"]}}};vt.style=wt;const kt=":host{display:block}.menu{padding:var(--sc-spacing-x-small) 0}.menu:focus{outline:none}::slotted(sc-input){margin-top:-var(--sc-spacing-x-small)}::slotted(sc-divider){--spacing:var(--sc-spacing-x-small)}";const _t=kt;const At=class{constructor(n){t(this,n);this.scSelect=e(this,"scSelect",7);this.items=[];this.ariaLabel=undefined}handleClick(t){const e=t.target;const n=e.closest("sc-menu-item");if(n&&!n.disabled){this.scSelect.emit({item:n})}}handleKeyDown(t){if(t.key==="Enter"){const e=this.getCurrentItem();t.preventDefault();if(e){this.scSelect.emit({item:e})}o(wp.i18n.sprintf(wp.i18n.__("Menu %s selected","surecart"),e.textContent),"assertive")}if(t.key===" "){t.preventDefault()}if(["ArrowDown","ArrowUp","Home","End"].includes(t.key)){const e=this.getCurrentItem();let n=e?this.items.indexOf(e):0;if(this.items.length){t.preventDefault();if(t.key==="ArrowDown"){n++}else if(t.key==="ArrowUp"){n--}else if(t.key==="Home"){n=0}else if(t.key==="End"){n=this.items.length-1}if(n<0)n=0;if(n>this.items.length-1)n=this.items.length-1;this.setCurrentItem(this.items[n]);return}}}getCurrentItem(){return this.items.find((t=>t.getAttribute("tabindex")==="0"))}async setCurrentItem(t){const e=t.disabled?this.items[0]:t;this.items.forEach((t=>{t.setAttribute("tabindex",t===e?"0":"-1")}))}syncItems(){const t=this.el.shadowRoot.querySelector("slot").assignedElements({flatten:true});this.items=t.filter((t=>t.nodeName==="sc-menu-item"))}handleSlotChange(){this.syncItems()}render(){return n("div",{key:"a849154c8c683c114e5923f426c094765094d426",part:"base",class:"menu",tabindex:"0",onKeyDown:t=>this.handleKeyDown(t)},n("slot",{key:"2442f28d8463617e6403eee9d76269a6b9c12e79",onSlotchange:()=>this.handleSlotChange()}))}get el(){return i(this)}};At.style=_t;const Ct=":host{display:block}.menu-item{position:relative;display:flex;align-items:stretch;font-family:var(--sc-font-sans);font-size:var(--sc-font-size-medium);font-weight:var(--sc-font-weight-normal);line-height:var(--sc-menu-item-line-height, var(--sc-line-height-normal));letter-spacing:var(--sc-letter-spacing-normal);text-align:left;color:var(--sc-menu-item-color, var(--sc-color-gray-700));padding:var(--sc-spacing-xx-small) var(--sc-spacing-x-large);transition:var(--sc-input-transition, var(--sc-transition-medium)) fill, var(--sc-input-transition, var(--sc-transition-medium)) background-color;user-select:none;white-space:var(--sc-menu-item-white-space, nowrap);cursor:pointer;text-decoration:none}.menu-item.menu-item--focused:not(.menu-item--disabled){outline:none;background-color:var(--sc-menu-item-background-focused, var(--sc-color-primary-500));color:var(--sc-color-white)}.menu-item.menu-item--disabled{outline:none;color:var(--sc-color-gray-400);cursor:not-allowed}.menu-item .menu-item__label{flex:1 1 auto}.menu-item .menu-item__prefix{flex:0 0 auto;display:flex;align-items:center}.menu-item .menu-item__prefix ::slotted(*){display:inline-flex;margin-right:var(--sc-spacing-small)}.menu-item .menu-item__suffix{flex:0 0 auto;display:flex;align-items:center}.menu-item .menu-item__suffix ::slotted(*){margin-left:var(--sc-spacing-x-small);text-align:right}.menu-item .menu-item__check{display:flex;position:absolute;left:0.5em;top:0.6em;visibility:hidden;align-items:center;font-size:inherit}.menu-item--checked .menu-item__check{visibility:visible}.menu-item--is-rtl.menu-item{text-align:right}.menu-item--is-rtl.menu-item .menu-item__check{left:auto;right:0.5em}";const Dt=Ct;const zt=class{constructor(e){t(this,e);this.hasFocus=false;this.href=undefined;this.target=undefined;this.checked=false;this.value="";this.disabled=false}async setFocus(t){this.menuItem.focus(t)}async setBlur(){this.menuItem.blur()}handleBlur(){this.hasFocus=false}handleFocus(){this.hasFocus=true}render(){const t=this.href?"a":"div";return n(t,{key:"e9b989a15367ddaab710845fcd637470e9c2e0d2",ref:t=>this.menuItem=t,part:"base",class:{"menu-item":true,"menu-item--checked":this.checked,"menu-item--disabled":this.disabled,"menu-item--focused":this.hasFocus,"menu-item--is-rtl":s()},href:this.href,role:"menuitem","aria-disabled":this.disabled?"true":"false","aria-checked":this.checked?"true":"false",tabindex:!this.disabled?"0":undefined,onFocus:()=>this.handleFocus(),onBlur:()=>this.handleBlur(),onMouseEnter:()=>this.handleFocus(),onMouseLeave:()=>this.handleBlur(),onKeyDown:t=>{if(t.key===" "||t.key==="Spacebar"||t.key==="Enter"){this.menuItem.click()}},"aria-label":this.el.innerText,target:this.target},n("span",{key:"5d72a1fc51449cae55cfcfb907332ed6e1fb9c9f",part:"checked-icon",class:"menu-item__check"},n("svg",{key:"3884861382144ea3443ee4bdf1559806f1481b7b",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",class:"bi bi-check",viewBox:"0 0 16 16"},n("path",{key:"ed2c3f7dffffa80b43a1c9d403633395ab4eb260",d:"M10.97 4.97a.75.75 0 0 1 1.07 1.05l-3.99 4.99a.75.75 0 0 1-1.08.02L4.324 8.384a.75.75 0 1 1 1.06-1.06l2.094 2.093 3.473-4.425a.267.267 0 0 1 .02-.022z"}))),n("span",{key:"93653a945f17af76a60e25a992e56691229470a9",part:"prefix",class:"menu-item__prefix"},n("slot",{key:"694efe10cd46cd8843a61a327a75653386b6c739",name:"prefix"})),n("span",{key:"9290ce75a464aba6e831199ad74cc6284720b377",part:"label",class:"menu-item__label"},n("slot",{key:"b58d217fdc974689430c270984863dfbc95642cb"})),n("span",{key:"184495043e83eb498e4b0a0771a47801b5c25b1f",part:"suffix",class:"menu-item__suffix"},n("slot",{key:"dbda73c6eb1e63df2897717e82a65a1044339c37",name:"suffix"})))}get el(){return i(this)}};zt.style=Dt;export{vt as sc_dropdown,At as sc_menu,zt as sc_menu_item}; //# sourceMappingURL=p-3b33963f.entry.js.map