Files
boc/landvex-site/assets/dropdown-menu-CFWQzY9-.js
T

3 lines
22 KiB
JavaScript
Raw Normal View History

import{r as a,j as s,P as D,i as y,o as Sn,ao as we,az as xe,e as In,aA as Nn,aB as Pn,g as Ce,aC as _e,au as X,aD as Tn,O as F,d as w,aE as An,aF as jn,aG as On,aH as kn,aI as Ln,aJ as Fn,aK as Gn,aL as Kn,aM as $n,aN as Un,aO as Re,c as Bn,at as Me}from"./index-CZD3_4lD.js";import{c as ye,I as zn,R as Vn}from"./index-C6sfL5Wv.js";import{C as Yn}from"./chevron-right-Dvw0FPw3.js";import{C as Wn}from"./check-CCL32zXH.js";import{C as Xn}from"./circle-CNf9xg3I.js";var Hn="Separator",he="horizontal",Jn=["horizontal","vertical"],Ee=a.forwardRef((e,t)=>{const{decorative:n,orientation:o=he,...r}=e,c=Zn(o)?o:he,d=n?{role:"none"}:{"aria-orientation":c==="vertical"?c:void 0,role:"separator"};return s.jsx(D.div,{"data-orientation":c,...d,...r,ref:t})});Ee.displayName=Hn;function Zn(e){return Jn.includes(e)}var be=Ee;const qn=a.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...o},r)=>s.jsx(be,{ref:r,decorative:n,orientation:t,className:y("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...o}));qn.displayName=be.displayName;function Ro(){const{user:e}=Sn(),[t,n]=a.useState(null),[o,r]=a.useState([]),[c,i]=a.useState(!0),[d,p]=a.useState(null);return a.useEffect(()=>{if(!e){i(!1);return}async function v(){i(!0),p(null);try{const m=await we("/auth/wallet");if(!m){n(null),r([]),i(!1);return}n(m);const u=await we("/auth/wallet/transactions");r(Array.isArray(u)?u:[])}catch(m){p(m instanceof Error?m.message:"Kunde inte hämta wallet-data")}finally{i(!1)}}v()},[e]),{wallet:t,transactions:o,isLoading:c,error:d}}const Qn=.15,De=1,yo=100;function Eo(e){return Math.floor((typeof e=="number"?e:0)*De*100)/100}function bo(e){return Math.floor((typeof e=="number"?e:0)*De*(1-Qn)*100)/100}function Do(e){const t=typeof e=="number"?e:0;return`${t.toLocaleString("sv-SE")} ${t===1?"kredit":"krediter"}`}function So(e){return`${(typeof e=="number"?e:0).toLocaleString("sv-SE",{minimumFractionDigits:2,maximumFractionDigits:2})} €`}function Io(e){return e!=null&&e.toLowerCase().includes("utbetalning")||e!=null&&e.toLowerCase().includes("payout")?"cash":e!=null&&e.toLowerCase().includes("kupong")||e!=null&&e.toLowerCase().includes("voucher")?"voucher":"credits"}var te=["Enter"," "],et=["ArrowDown","PageUp","Home"],Se=["ArrowUp","PageDown","End"],nt=[...et,...Se],tt={ltr:[...te,"ArrowRight"],rtl:[...te,"ArrowLeft"]},ot={ltr:["ArrowLeft"],rtl:["ArrowRight"]},G="Menu",[k,rt,at]=An(G),[S,Ie]=Ce(G,[at,_e,ye]),H=_e(),Ne=ye(),[st,I]=S(G),[ct,K]=S(G),Pe=e=>{const{__scopeMenu:t,open:n=!1,children:o,dir:r,onOpenChange:c,modal:i=!0}=e,d=H(t),[p,v]=a.useState(null),m=a.useRef(!1),u=xe(c),f=In(r);return a.useEffect(()=>{const h=()=>{m.current=!0,document.addEventListener("pointerdown",M,{capture:!0,once:!0}),document.addEventListener("pointermove",M,{capture:!0,once:!0})},M=()=>m.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",M,{capture:!0}),document.removeEventListener("pointermove",M,{capture:!0})}},[]),a.useEffect(()=>{if(!n)return;const h=()=>u(!1);return window.addEventListener("blur",h),()=>window.removeEventListener("blur",h)},[n,u]),s.jsx(Nn,{...d,children:s.jsx(st,{scope:t,open:n,onOpenChange:u,content:p,onContentChange:v,children:s.jsx(ct,{scope:t,onClose:a.useCallback(()=>u(!1),[u]),isUsingKeyboardRef:m,dir:f,modal:i,children:o})})})};Pe.displayName=G;var ut="MenuAnchor",oe=a.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e,r=H(n);return s.jsx(Pn,{...r,...o,ref:t})});oe.displayName=ut;var re="MenuPortal",[it,Te]=S(re,{forceMount:void 0}),Ae=e=>{const{__scopeMenu:t,forceMount:n,children:o,container:r}=e,c=I(re,t);return s.jsx(it,{scope:t,forceMount:n,children:s.jsx(X,{present:n||c.open,children:s.jsx(Tn,{asChild:!0,container:r,children:o})})})};Ae.displayName=re;var C="MenuContent",[dt,ae]=S(C),je=a.forwardRef((e,t)=>{const n=Te(C,e.__scopeMenu),{forceMount:o=n.forceMount,...r}=e,c=I(C,e.__scopeMenu),i=K(C,e.__scopeMenu);return s.jsx(k.Provider,{scope:e.__scopeMenu,children:s.jsx(X,{present:o
//# sourceMappingURL=dropdown-menu-CFWQzY9-.js.map