PageSourceSearch

https://console.quidkey.com/assets/_authenticated-BJls42A_.js

js quidkey.com collected 2026-09-24 13:40:37 UTC 59,407 bytes, 1 lines download raw bytes

1import{l as q,b as ee,m as Lt,W as pt,n as j,j as t,a as ge,r as l,k as je,o as qt,p as Tt,q as Ft,L as re,s as Dt,B as qe,C as mt,S as Ot,t as Kt,v as Qt,w as Te,x as ie,P as W,y as ht,z as ft,O as xt,D as gt,E as xe,G as bt,H as Vt,I as Qe,g as Ve,J as zt,e as yt,X as Fe,K as Bt,M as he,T as Ut,N as Gt,Q as Ht,U as Wt,V as Jt}from"./main-To_L_1y0.js";import{u as Xt}from"./useLocation-BGMbz5FF.js";import{B as be}from"./building-2-7swX2ex6.js";import{S as G,B as ze}from"./store-RYJ2sH7W.js";import{L as Ze,C as Yt,P as et}from"./percent-DdiLLGgJ.js";import{L as vt}from"./link-2-Dr2_z7VQ.js";import{K as Zt}from"./key-round-DRtVXy3a.js";import{S as De}from"./send-CS5oF63A.js";import{R as Ne}from"./receipt-D2JZGpVb.js";import{A as en}from"./activity-t_dfnK1y.js";import{U as tt}from"./users-D4X-iSzw.js";import{A as tn}from"./arrow-right-DyBKxEYb.js";import{C as nt,u as nn,f as rn,P as an,S as sn,g as on}from"./step-config-Dh2h7_HY.js";import{C as cn}from"./circle-check-pWgBZTVR.js";import{g as ln}from"./go-live-Cuh4iGgh.js";import{S as Se}from"./search-DPk_MPSb.js";import{U as dn}from"./user-CblyegEb.js";import{L as un}from"./log-out-Ba2AQtad.js";import{E as pn}from"./eye-CK6rlTdb.js";import{h as mn}from"./hex-to-oklch-2b6xmVzW.js";import{u as hn}from"./useMutation-B7FocJ-g.js";import{F as fn}from"./file-text-z4HEmmHJ.js";import{S as xn}from"./settings-2-CA81fgUV.js";const gn=[["path",{d:"m9 6-6 6 6 6",key:"7v63n9"}],["path",{d:"M3 12h14",key:"13k4hi"}],["path",{d:"M21 19V5",key:"b4bplr"}]],bn=q("arrow-left-from-line",gn);const yn=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],vn=q("bell",yn);const kn=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],wn=q("chart-column",kn);const jn=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],Be=q("globe",jn);const Nn=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],Sn=q("layout-dashboard",Nn);const Cn=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],En=q("link",Cn);const In=[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]],we=q("map",In);const $n=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],Rn=q("menu",$n);const Mn=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],_n=q("moon",Mn);const An=[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"m19 8 3 8a5 5 0 0 1-6 0zV7",key:"zcdpyk"}],["path",{d:"M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1",key:"1yorad"}],["path",{d:"m5 8 3 8a5 5 0 0 1-6 0zV7",key:"eua70x"}],["path",{d:"M7 21h10",key:"1b0cd5"}]],rt=q("scale",An);const Pn=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],at=q("settings",Pn);const Ln=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],qn=q("sun",Ln);const Tn=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Fn=q("zap",Tn);function kt(){const{currentContext:e}=ee();return e?.branding??null}function Dn({context:e,can:n,canAny:r,hasRefundAccount:a,hasConnections:i}){const s=[{kind:"link",title:"Dashboard",href:"/dashboard",icon:Sn}];if(Lt(e)&&n("dashboard:summary")&&s.push({kind:"link",title:"Reporting",href:"/reporting",icon:wn}),e?.type==="global"&&n("partners:list")&&s.push({kind:"link",title:"Partners",href:"/partners",icon:be}),e?.type==="merchant"&&e.id){const d=e.id;n("merchants:get")&&(s.push({kind:"merchant",title:"My Business",merchantId:d,search:{tab:"business"},icon:G}),s.push({kind:"merchant",title:"Bank Accounts",merchantId:d,search:{tab:"bank-accounts"},icon:Ze})),n("merchant-connections:read")&&i&&s.push({kind:"link",title:"Connections",href:`/merchants/${d}
1/connections`,icon:Yt}),n("transactions:search")&&s.push({kind:"link",title:"Transactions",href:"/transactions",icon:ze}),r(["payment-links:read","payment-links:create"])&&s.push({kind:"link",title:"Payment Links",href:"/payment-links",icon:vt}),n("merchants:get")&&(s.push({kind:"merchant",title:"Credentials",merchantId:d,search:{tab:"credentials"},icon:Zt}),s.push({kind:"merchant",title:"Pricing",merchantId:d,search:{tab:"pricing"},icon:et})),n("payouts:list")&&s.push({kind:"link",title:"Payouts",href:"/payouts",icon:De}),n("invoices:list")&&s.push({kind:"link",title:"Invoices",href:"/invoices",icon:Ne}),n("refunds:list")&&a&&s.push({kind:"link",title:"Refund Account",href:"/refund-account",icon:pt}),r(["banks:list","banks:list-active"])&&s.push({kind:"link",title:"Coverage",href:"/coverage",icon:we})}else e?.type==="global"?(n("merchants:list")&&s.push({kind:"link",title:"Merchants",href:"/merchants",icon:G}),n("admin-activity:read")&&s.push({kind:"link",title:"Activity",href:"/activity",icon:en}),s.push({kind:"group",title:"Platform"}),n("fee-accounts:list")&&s.push({kind:"link",title:"Quidkey Accounts",href:"/quidkey-accounts",icon:Ze}),r(["banks:list","banks:list-active"])&&s.push({kind:"link",title:"Coverage",href:"/coverage",icon:we}),n("default-rates:get-active")&&s.push({kind:"link",title:"Default Rates",href:"/default-rates",icon:et})):(n("merchants:list")&&s.push({kind:"link",title:"Merchants",href:"/merchants",icon:G}),r(["banks:list","banks:list-active"])&&s.push({kind:"link",title:"Coverage",href:"/coverage",icon:we}));return s}const On={global:Be,partner:be,merchant:G},Kn={global:"bg-foreground text-background",partner:"bg-sky-500/15 text-sky-600 dark:text-sky-400 border border-sky-500/25",merchant:"bg-amber-500/15 text-amber-600 dark:text-amber-400 border border-amber-500/25"};function Qn(e){return e.type==="global"?"Global":e.name?e.name:e.id?`${e.type==="partner"?"Partner":"Merchant"} ${e.id.slice(0,8)}…`:e.type==="partner"?"Partner":"Merchant"}function Vn(e){return e.type==="global"?"All partners & merchants":e.type==="partner"?"Partner":"Merchant"}function zn({type:e,className:n}){const r=On[e];return t.jsx("span",{className:j("inline-flex items-center justify-center rounded-md shrink-0",Kn[e],n),"aria-hidden":!0,children:t.jsx(r,{className:"h-4 w-4"})})}function st({collapsed:e=!1}){const{currentContext:n}=ee();if(!n)return null;const r=Qn(n),a=j("transition-opacity duration-200",e?"opacity-0":"opacity-100");return t.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-sidebar-border bg-sidebar-accent/40 px-2 py-2",title:r,children:[t.jsx(zn,{type:n.type,className:"h-8 w-8"}),t.jsxs("div",{className:j("min-w-0 flex-1",a),children:[t.jsx("div",{className:"truncate text-sm font-semibold text-sidebar-foreground",title:r,children:r}),t.jsx("div",{className:"truncate text-xs text-sidebar-foreground/60",children:Vn(n)})]})]})}function Bn({open:e,setOpen:n}){const r=Xt(),a=ge(),{can:i,canAny:s,currentContext:d}=ee(),p=kt(),h=l.useRef(null),m=l.useRef(null),g=s(["partner-users:list","merchant-users:list"]),w=d?.type==="merchant"?d.id:void 0,I=je({...qt(w??""),enabled:!!w&&i("refunds:list")}),C=Tt(Ft.MerchantConnections),M=y=>{if(typeof y=="string")return r.pathname===y||r.pathname.startsWith(y+"/");if(y.kind==="group")return!1;const u=y.kind==="merchant"?`/merchants/${y.merchantId}`:y.href;if(!(r.pathname===u||r.pathname.startsWith(u+"/")))return!1;if(y.kind!=="merchant")return!0;const F=r.search;return Object.entries(y.search).every(([V,U])=>{const D=F[V];return V==="tab"&&!D?U==="business":D===U})},P=Dn({context:d,can:i,canAny:s,hasRefundAccount:!!I.data,hasConnections:C});l.useEffect(()=>{const y=u=>{e&&(typeof window<"u"&&window.innerWidth<1024||h.current&&!h.current.contains(u.target)&&n(!1))};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[e,n]);const T=()=>{typeof window<"u"&&window.innerWidth<1024||(m.current&&(window.clearTimeout(m.current),m.current=null),n(!0))},_=()=>{typeof window<"u"&&window.innerWidth<1024||(m.current=window.setTimeout(()=>n(!1),120))},Q=[...g?[{to:"/users",label:"Users",icon:tt}]:[],{to:"/legal",label:"Legal",icon:rt},{to:"/settings",label:"Settings",icon:at}],J=({showLabels:y})=>t.jsxs(t.Fragment,{children:[t.jsxs(re,{to:"/dashboard","aria-label":"Quidkey — go to dashboard",className:"relative h-16 border-b border-sidebar-border flex items-center px-4 transition-opacity hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:[t.jsx("img",{src:p?.logo_url??"/logo.svg",alt:p?.logo_url?"Logo":"Quidkey",className:j("h-7 max-w-[140px] object-contain transition-opacity duration-200",!p?.logo_url&&"dark:invert",y?"opacity-100":"opacity-0")}),t.jsx("img",{src:p?.icon_url??p?.logo_url??"/favicon.svg",alt:"","aria-hidden":!0,
1className:j("absolute left-4 h-8 w-8 object-contain transition-opacity duration-200",!p?.icon_url&&!p?.logo_url&&"dark:invert",y?"opacity-0":"opacity-100")})]}),t.jsx("div",{className:"px-2 pt-3",children:t.jsx(st,{collapsed:!y})}),t.jsx("nav",{className:"flex-1 py-4 space-y-1 overflow-y-auto px-2",children:P.map(u=>{if(u.kind==="group")return t.jsxs("div",{className:"relative px-3 pt-4 pb-1",children:[t.jsx("span",{className:j("block text-[11px] font-semibold uppercase tracking-wider text-sidebar-foreground/40 truncate transition-opacity duration-200",y?"opacity-100":"opacity-0"),children:u.title}),t.jsx("span",{"aria-hidden":!0,className:j("absolute inset-x-2 top-1/2 -translate-y-1/2 border-t border-sidebar-border transition-opacity duration-200",y?"opacity-0":"opacity-100")})]},`group-${u.title}`);const E=j("flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition-colors",M(u)?"bg-sidebar-accent text-sidebar-foreground":"text-sidebar-foreground/70 hover:text-sidebar-foreground hover:bg-sidebar-accent"),F=j("min-w-0 truncate transition-opacity duration-200",y?"opacity-100":"opacity-0");return t.jsx("div",{children:u.kind==="merchant"?t.jsxs(re,{to:"/merchants/$merchantId",params:{merchantId:u.merchantId},search:u.search,className:E,"aria-label":u.title,children:[t.jsx(u.icon,{className:"h-5 w-5 shrink-0"}),t.jsx("span",{className:F,children:u.title})]}):t.jsxs(re,{to:u.href,className:E,"aria-label":u.title,children:[t.jsx(u.icon,{className:"h-5 w-5 shrink-0"}),t.jsx("span",{className:F,children:u.title})]})},u.title)})}),t.jsx("div",{className:"py-4 border-t border-sidebar-border space-y-1 px-2",children:Q.map(({to:u,label:E,icon:F})=>t.jsxs(re,{to:u,className:j("flex items-center gap-3 rounded-lg px-3 py-2 text-sm transition-colors",M(u)?"bg-sidebar-accent text-sidebar-foreground font-medium":"text-sidebar-foreground/70 hover:text-sidebar-foreground hover:bg-sidebar-accent"),"aria-label":E,children:[t.jsx(F,{className:"h-5 w-5 shrink-0"}),t.jsx("span",{className:j("min-w-0 truncate transition-opacity duration-200",y?"opacity-100":"opacity-0"),children:E})]},u))})]}),B=()=>{const y=u=>{u.kind!=="group"&&(u.kind==="merchant"?a({to:"/merchants/$merchantId",params:{merchantId:u.merchantId},search:u.search}):a({to:u.href}),setTimeout(()=>n(!1),0))};return t.jsxs(t.Fragment,{children:[t.jsx(re,{to:"/dashboard","aria-label":"Quidkey — go to dashboard",onClick:()=>n(!1),className:"h-16 border-b border-sidebar-border flex items-center px-6 justify-start transition-opacity hover:opacity-80",children:t.jsx("img",{src:p?.logo_url??"/logo.svg",alt:p?.logo_url?"Logo":"Quidkey",className:j(!p?.logo_url&&"dark:invert",p?.logo_url?"h-7 max-w-[140px] object-contain":"h-7")})}),t.jsx("div",{className:"px-3 pt-3",children:t.jsx(st,{})}),t.jsx("nav",{className:"flex-1 py-4 space-y-1 overflow-y-auto px-3",children:P.map(u=>u.kind==="group"?t.jsx("div",{className:"px-3 pt-4 pb-1 text-[11px] font-semibold uppercase tracking-wider text-sidebar-foreground/40",children:u.title},`group-${u.title}`):t.jsx("div",{children:t.jsxs("button",{type:"button",onClick:()=>y(u),className:j("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium transition-colors text-left",M(u)?"bg-sidebar-accent text-sidebar-foreground":"text-sidebar-foreground/70 hover:text-sidebar-foreground hover:bg-sidebar-accent"),"aria-label":u.title,children:[t.jsx(u.icon,{className:"h-5 w-5"}),t.jsx("span",{children:u.title})]})},u.title))}),t.jsxs("div",{className:"py-4 border-t border-sidebar-border px-3 space-y-1",children:[g?t.jsxs("button",{type:"button",onClick:()=>a({to:"/users"}),className:j("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors text-left",M("/users")?"bg-sidebar-accent text-sidebar-foreground font-medium":"text-sidebar-foreground/70 hover:text-sidebar-foreground hover:bg-sidebar-accent"),"aria-label":"Users",children:[t.jsx(tt,{className:"h-5 w-5"}),t.jsx("span",{children:"Users"})]}):null,t.jsxs("button",{type:"button",onClick:()=>a({to:"/legal"}),className:j("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors text-left",M("/legal")?"bg-sidebar-accent text-sidebar-foreground font-medium":"text-sidebar-foreground
1/70 hover:text-sidebar-foreground hover:bg-sidebar-accent"),"aria-label":"Legal",children:[t.jsx(rt,{className:"h-5 w-5"}),t.jsx("span",{children:"Legal"})]}),t.jsxs("button",{type:"button",onClick:()=>a({to:"/settings"}),className:j("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors text-left",M("/settings")?"bg-sidebar-accent text-sidebar-foreground font-medium":"text-sidebar-foreground/70 hover:text-sidebar-foreground hover:bg-sidebar-accent"),"aria-label":"Settings",children:[t.jsx(at,{className:"h-5 w-5"}),t.jsx("span",{children:"Settings"})]})]})]})};return t.jsxs(t.Fragment,{children:[e?t.jsx("div",{className:"fixed inset-0 z-40 bg-black/40 lg:hidden",onClick:()=>n(!1)}):null,t.jsx("aside",{className:j("fixed inset-y-0 left-0 z-50 flex flex-col w-64 bg-sidebar border-r border-sidebar-border lg:hidden","transform transition-transform duration-200 ease-out",e?"translate-x-0":"-translate-x-full"),children:B()}),t.jsx("aside",{ref:h,onMouseEnter:T,onMouseLeave:_,className:j("hidden lg:flex lg:flex-col lg:fixed lg:inset-y-0 bg-sidebar border-r border-sidebar-border","transition-[width] duration-500 ease-in-out overflow-hidden z-50",e?"lg:w-64":"lg:w-[4.8rem]"),children:J({showLabels:e})})]})}function Un(){const{theme:e,setPreference:n}=Dt();return t.jsx(qe,{variant:"ghost",size:"icon",onClick:()=>n(e==="dark"?"light":"dark"),"aria-label":`Switch to ${e==="dark"?"light":"dark"} mode`,children:e==="dark"?t.jsx(qn,{className:"h-5 w-5"}):t.jsx(_n,{className:"h-5 w-5"})})}function Gn({status:e}){switch(e){case"done":return t.jsx(cn,{className:"h-4 w-4 text-success shrink-0"});case"incomplete":return t.jsx(nt,{className:"h-4 w-4 text-warning shrink-0"});case"warning":return t.jsx(mt,{className:"h-4 w-4 text-warning shrink-0"});default:return t.jsx(nt,{className:"h-4 w-4 text-muted-foreground shrink-0"})}}function Hn({item:e,onNavigate:n}){const r=ge(),a=()=>{e.action&&(n(),r({to:e.action.to,params:e.action.params,search:e.action.search}))},i=!!e.action&&e.status!=="done"&&e.status!=="warning";return t.jsxs("button",{type:"button",onClick:i?a:void 0,disabled:!i,className:`w-full flex items-center gap-3 px-4 py-2.5 text-left transition-colors ${i?"hover:bg-accent cursor-pointer":"cursor-default"}`,children:[t.jsx(Gn,{status:e.status}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:`text-sm leading-tight ${e.status==="done"?"text-muted-foreground":"font-medium"}`,children:e.label}),e.hint?t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 leading-tight",children:e.hint}):null]}),i?t.jsx(tn,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}):null]})}function Wn({items:e,onClose:n}){const r=new Map;for(const a of e){const i=r.get(a.group)??[];i.push(a),r.set(a.group,i)}return e.length===0?t.jsx("div",{className:"absolute top-full right-0 mt-1 w-80 bg-popover border border-border rounded-lg shadow-lg z-50 overflow-hidden",children:t.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"All caught up!"})}):t.jsx("div",{className:"absolute top-full right-0 mt-1 w-80 bg-popover border border-border rounded-lg shadow-lg z-50 overflow-hidden",children:t.jsx("div",{className:"max-h-[400px] overflow-y-auto",children:Array.from(r.entries()).map(([a,i],s)=>t.jsxs("div",{children:[s>0?t.jsx("div",{className:"border-t border-border"}):null,t.jsx("div",{className:"px-4 py-2 bg-muted/50",children:t.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:a})}),t.jsx("div",{children:i.map(d=>t.jsx(Hn,{item:d,onNavigate:n},d.id))})]},a))})})}function Jn({items:e,celebrationPending:n=!1,merchantId:r}){const[a,i]=l.useState(!1),s=l.useRef(null),d=e.filter(m=>m.status!=="done").length,{celebrating:p,fading:h}=nn(r,n);return l.useEffect(()=>{p&&!h&&rn(s.current)},[p,h]),l.useEffect(()=>{if(!a)return;const m=g=>{s.current&&!s.current.contains(g.target)&&i(!1)};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[a]),e.length===0&&!p?null:t.jsxs("div",{className:"relative",ref:s,children:[t.jsxs("button",{type:"button",onClick:()=>i(!a),className:"relative flex items-center justify-center w-9 h-9 rounded-lg hover:bg-secondary transition-colors","aria-label":`Notifications${d>0?` (${d} pending)`:""}`,children:[t.jsx("span",{className:`transition-all duration-700 ${p&&!h?"scale-110":h?"scale-75 opacity-0":""}`,children:p?t.jsx(an,{className:"h-[18px] w-[18px] text-success animate-pulse"}):t.jsx(vn,{className:"h-[18px] w-[18px] text-muted-foreground"})}),d>0&&!p?t.jsx("span",{className:"absolute -top-0.5 -right-0.5 flex items-center justify-center min-w-[18px] h-[18px] px-1 rounded-full bg-primary text-primary-foreground text-[10px] font-bold leading-none",children:d}):null]}),a?t.jsx(Wn,{items:e,onClose:()=>i(!1)}):null]})}function Xn(e){switch(e){case"complete":return"done";case"incomplete":return"incomplete";case"awaiting_verification":return"warning";default:return"pending"}}function Yn(e){const{data:n}=je({...ln(e??""),enabled:!!e});return n?n.status==="live"?{items:[],celebrationPending:n.celebration_pending}:{items:n.steps.map(a=>{const i=sn[a.key],s=on(a.key,a.status);return{id:`go-live:${a.key}`,group:"Go Live",label:a.label,hint:a.hint,status:Xn(a.status),action:i&&e&&s?{to:"/merchants/$merchantId",params:{merchantId:e},search:s}:void 0}}),celebrationPending:!1}:{items:[],celebrationPending:!1}}const Zn="qk.cmdk.recents.v1",wt=5,jt=e=>`${Zn}.${e}`;function er(e){if(typeof window>"u"||!e)return[];try{const n=window.localStorage.getItem(jt(e));if(!n)return[];const r=JSON.parse(n);return Array.isArray(r)?r.slice(0,wt):[]}catch{return[]}}function Re(e,n){if(!(typeof window>"u"||!e))try{window.localStorage.setItem(jt(e),JSON.stringify(n))}catch{}}const Me=e=>e.currentKey!==null&&e.currentKey===e.homeKey,ot=(e,n)=>[n,...e.filter(r=>!(r.type===n.type&&r.id===n.id))].slice(0,wt),O=new Ot({open:!1,query:"",scopedPath:[],homeKey:null,currentKey:null,
1scopedKey:null,persistentRecents:[],scopedRecents:[],recents:[]}),R={open(){O.setState(e=>({...e,open:!0}))},close(){O.setState(e=>({...e,open:!1,query:"",scopedPath:[]}))},toggle(){O.setState(e=>e.open?{...e,open:!1,query:"",scopedPath:[]}:{...e,open:!0})},setQuery(e){O.setState(n=>({...n,query:e}))},pushScope(e){O.setState(n=>{const r=n.scopedPath[n.scopedPath.length-1];return r&&r.type===e.type&&r.id===e.id?n:{...n,scopedPath:[...n.scopedPath,e],query:""}})},popScope(){O.setState(e=>({...e,scopedPath:e.scopedPath.slice(0,-1),query:""}))},clearScope(){O.setState(e=>({...e,scopedPath:[]}))},setContext(e,n){O.setState(r=>{const a=n!==r.homeKey?er(n):r.persistentRecents,i=e!==null&&e===n;let{scopedRecents:s,scopedKey:d}=r;return i?(s=[],d=null):e!==r.scopedKey&&(s=[],d=e),{...r,currentKey:e,homeKey:n,scopedKey:d,persistentRecents:a,scopedRecents:s,recents:i?a:s}})},pushRecent(e){O.setState(n=>{if(Me(n)){const a=ot(n.persistentRecents,e);return Re(n.homeKey,a),{...n,persistentRecents:a,recents:a}}const r=ot(n.scopedRecents,e);return{...n,scopedRecents:r,recents:r}})},removeRecent(e,n){O.setState(r=>{const a=s=>s.filter(d=>!(d.type===e&&d.id===n));if(Me(r)){const s=a(r.persistentRecents);return Re(r.homeKey,s),{...r,persistentRecents:s,recents:s}}const i=a(r.scopedRecents);return{...r,scopedRecents:i,recents:i}})},clearRecents(){O.setState(e=>Me(e)?(Re(e.homeKey,[]),{...e,persistentRecents:[],recents:[]}):{...e,scopedRecents:[],recents:[]})}};function tr(){return Kt(O)}function Nt(){const[e,n]=l.useState(!1);return l.useEffect(()=>{typeof navigator<"u"&&n(/Mac|iPhone|iPad|iPod/.test(navigator.userAgent))},[]),e}function nr({onMenuClick:e}){const n=ge(),{user:r,currentContext:a,logout:i,isAdmin:s}=ee(),[d,p]=l.useState(!1),h=l.useRef(null),m=Nt();l.useEffect(()=>{const M=P=>{h.current&&!h.current.contains(P.target)&&p(!1)};if(d)return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[d]);const g=()=>{i(),n({to:"/login",search:{returnTo:void 0}})},w=r?.first_name&&r?.last_name?`${r.first_name} ${r.last_name}`:r?.email,I=r?.first_name&&r?.last_name?`${r.first_name.charAt(0)}${r.last_name.charAt(0)}`.toUpperCase():r?.email?.charAt(0).toUpperCase()||"?",C=a?.type==="global"?"Global Admin":a?.name?`${a.type==="partner"?"Partner":"Merchant"} · ${a.name}`:a?.type?`${a.type.charAt(0).toUpperCase()+a.type.slice(1)}`:s?"Administrator":"User";return t.jsx("header",{className:"h-[72px] border-b border-border bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 sticky top-0 z-40",children:t.jsxs("div",{className:"flex lg:grid lg:grid-cols-[1fr_auto_1fr] items-center h-full px-3 sm:px-4 lg:px-8 gap-2 sm:gap-3",children:[t.jsx("div",{className:"flex items-center shrink-0",children:t.jsx(qe,{type:"button",variant:"ghost",size:"icon",className:"lg:hidden",onClick:e,"aria-label":"Open menu",children:t.jsx(Rn,{className:"h-5 w-5"})})}),t.jsxs("button",{type:"button",onClick:()=>R.open(),className:"hidden sm:flex flex-1 min-w-0 lg:flex-none lg:w-[420px] lg:mx-auto items-center gap-2 px-3.5 py-2.5 rounded-lg bg-secondary text-sm text-muted-foreground hover:bg-secondary/80 transition-colors","aria-label":"Open command palette",children:[t.jsx(Se,{className:"h-4 w-4 shrink-0"}),t.jsx("span",{className:"flex-1 text-left truncate",children:"Search dashboard…"}),t.jsxs("kbd",{className:"hidden sm:inline-flex items-center gap-1.5 px-2 py-0.5 rounded border border-border font-sans text-sm shrink-0",children:[t.jsx("span",{className:m?"inline-block scale-125 origin-center":void 0,children:m?"⌘":"Ctrl"}),t.jsx("span",{children:"K"})]})]}),t.jsx("div",{className:"flex-1 sm:hidden"}),t.jsxs("div",{className:"flex items-center gap-1 sm:gap-2 lg:gap-3 justify-end min-w-0 shrink-0",children:[t.jsx(qe,{type:"button",variant:"ghost",size:"icon",className:"sm:hidden",onClick:()=>R.open(),"aria-label":"Search dashboard",children:t.jsx(Se,{className:"h-5 w-5"})}),t.jsx(Un,{}),t.jsx(rr,{}),t.jsxs("div",{className:"relative",ref:h,children:[t.jsxs("button",{onClick:()=>p(!d),className:"flex items-center gap-3 p-2 rounded-lg hover:bg-secondary transition-colors",children:[t.jsx("div",{className:"w-8 h-8 rounded-full bg-primary/20 flex items-center justify-center",children:t.jsx("span",{className:"text-sm font-medium text-primary",children:I})}),t.jsxs("div",{className:"hidden md:block text-left max-w-[200px]",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:w}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:C})]}),t.jsx(Qt,{className:"h-4 w-4 text-muted-foreground hidden md:block"})]}),d&&t.jsxs("div",{className:"absolute top-full right-0 mt-1 w-56 bg-popover border border-border rounded-lg shadow-lg z-50 py-1",children:[t.jsxs("div",{className:"px-4 py-2 border-b border-border",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:r?.email}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:C})]}),t.jsxs(re,{to:"/settings",onClick:()=>p(!1),className:"w-full flex items-center gap-2 px-4 py-2 text-sm hover:bg-accent transition-colors",children:[t.jsx(dn,{className:"h-4 w-4"}),"Profile"]}),t.jsxs("button",{onClick:g,className:"w-full flex items-center gap-2 px-4 py-2 text-sm text-destructive hover:bg-destructive/10 transition-colors",children:[t.jsx(un,{className:"h-4 w-4"}),"Sign out"]})]})]})]})]})})}function rr(){const{currentContext:e}=ee(),n=e?.type==="merchant"?e.id:void 0,r=Yn(n),a=[...r.items];return t.jsx(Jn,{items:a,celebrationPending:r.celebrationPending,merchantId:n})}function ar(){const{currentContext:e,previousContext:n,homeContext:r,isImpersonating:a,exitImpersonation:i}=ee(),s=ge(),[d,p]=l.useState(!1);if(!a||!e)return null;const h=n??r;if(!h)return null;const m=e.type==="partner"?be:e.type==="merchant"?G:Be,g=e.type,w=Te(e),I=Te(h),C=async()=>
1{if(!d){p(!0);try{await i(),s({to:"/"})}catch{}finally{p(!1)}}};return t.jsx("div",{role:"status","aria-live":"polite",className:j("sticky top-[72px] z-30","border-b border-amber-500/30","bg-gradient-to-r from-amber-500/10 via-amber-500/15 to-amber-500/10","backdrop-blur supports-[backdrop-filter]:bg-amber-500/10","animate-in fade-in slide-in-from-top-1 duration-200"),children:t.jsxs("div",{className:"flex items-center gap-3 px-4 lg:px-8 py-2 text-sm",children:[t.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[t.jsx("span",{className:j("inline-flex items-center justify-center h-6 w-6 rounded-md shrink-0","bg-amber-500/20 text-amber-700 dark:text-amber-300"),"aria-hidden":!0,children:t.jsx(pn,{className:"h-3.5 w-3.5"})}),t.jsx("span",{className:"text-amber-900 dark:text-amber-100 font-medium shrink-0",children:"Viewing as"}),t.jsxs("span",{className:"inline-flex items-center gap-1.5 min-w-0 px-2 py-0.5 rounded-md bg-amber-500/15 text-amber-900 dark:text-amber-100 text-[13px] font-medium",children:[t.jsx(m,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),t.jsx("span",{className:"truncate",children:w})]}),t.jsxs("span",{className:"hidden sm:inline text-amber-900/70 dark:text-amber-100/70 text-xs truncate",children:["(",g,")"]})]}),t.jsxs("button",{type:"button",onClick:C,disabled:d,className:j("inline-flex items-center gap-1.5 shrink-0","px-2.5 py-1 rounded-md text-xs font-medium","text-amber-900 dark:text-amber-100","bg-amber-500/10 hover:bg-amber-500/25","border border-amber-500/30 hover:border-amber-500/50","transition-colors","focus:outline-none focus:ring-2 focus:ring-amber-500/40","disabled:opacity-60 disabled:cursor-not-allowed"),"aria-label":`Exit to ${I}`,title:`Exit to ${I}`,children:[t.jsx(bn,{className:"h-3.5 w-3.5","aria-hidden":!0}),t.jsx("span",{children:d?"Exiting…":`Exit to ${I}`})]})]})})}var it=1,sr=.9,or=.8,ir=.17,_e=.1,Ae=.999,cr=.9999,lr=.99,dr=/[\\\/_+.#"@\[\(\{&]/,ur=/[\\\/_+.#"@\[\(\{&]/g,pr=/[\s-]/,St=/[\s-]/g;function Oe(e,n,r,a,i,s,d){if(s===n.length)return i===e.length?it:lr;var p=`${i},${s}`;if(d[p]!==void 0)return d[p];for(var h=a.charAt(s),m=r.indexOf(h,i),g=0,w,I,C,M;m>=0;)w=Oe(e,n,r,a,m+1,s+1,d),w>g&&(m===i?w*=it:dr.test(e.charAt(m-1))?(w*=or,C=e.slice(i,m-1).match(ur),C&&i>0&&(w*=Math.pow(Ae,C.length))):pr.test(e.charAt(m-1))?(w*=sr,M=e.slice(i,m-1).match(St),M&&i>0&&(w*=Math.pow(Ae,M.length))):(w*=ir,i>0&&(w*=Math.pow(Ae,m-i))),e.charAt(m)!==n.charAt(s)&&(w*=cr)),(w<_e&&r.charAt(m-1)===a.charAt(s+1)||a.charAt(s+1)===a.charAt(s)&&r.charAt(m-1)!==a.charAt(s))&&(I=Oe(e,n,r,a,m+1,s+2,d),I*_e>w&&(w=I*_e)),w>g&&(g=w),m=r.indexOf(h,m+1);return d[p]=g,g}function ct(e){return e.toLowerCase().replace(St," ")}function mr(e,n,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,Oe(e,n,ct(e),ct(n),0,0,{})}var fe='[cmdk-group=""]',Pe='[cmdk-group-items=""]',hr='[cmdk-group-heading=""]',Ct='[cmdk-item=""]',lt=`${Ct}:not([aria-disabled="true"])`,Ke="cmdk-item-select",ae="data-value",fr=(e,n,r)=>mr(e,n,r),Et=l.createContext(void 0),ye=()=>l.useContext(Et),It=l.createContext(void 0),Ue=()=>l.useContext(It),$t=l.createContext(void 0),Rt=l.forwardRef((e,n)=>{let r=se(()=>{var c,x;return{search:"",value:(x=(c=e.value)!=null?c:e.defaultValue)!=null?x:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),a=se(()=>new Set),i=se(()=>new Map),s=se(()=>new Map),d=se(()=>new Set),p=Mt(e),{label:h,children:m,value:g,onValueChange:w,filter:I,shouldFilter:C,loop:M,disablePointerSelection:P=!1,vimBindings:T=!0,..._}=e,Q=ie(),J=ie(),B=ie(),y=l.useRef(null),u=Cr();Z(()=>{if(g!==void 0){let c=g.trim();r.current.value=c,E.emit()}},[g]),Z(()=>{u(6,ve)},[]);let E=l.useMemo(()=>({subscribe:c=>(d.current.add(c),()=>d.current.delete(c)),snapshot:()=>r.current,setState:(c,x,k)=>{var f,b,N,A;
1if(!Object.is(r.current[c],x)){if(r.current[c]=x,c==="search")ce(),U(),u(1,D);else if(c==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let $=document.getElementById(B);$?$.focus():(f=document.getElementById(Q))==null||f.focus()}if(u(7,()=>{var $;r.current.selectedItemId=($=L())==null?void 0:$.id,E.emit()}),k||u(5,ve),((b=p.current)==null?void 0:b.value)!==void 0){let $=x??"";(A=(N=p.current).onValueChange)==null||A.call(N,$);return}}E.emit()}},emit:()=>{d.current.forEach(c=>c())}}),[]),F=l.useMemo(()=>({value:(c,x,k)=>{var f;x!==((f=s.current.get(c))==null?void 0:f.value)&&(s.current.set(c,{value:x,keywords:k}),r.current.filtered.items.set(c,V(x,k)),u(2,()=>{U(),E.emit()}))},item:(c,x)=>(a.current.add(c),x&&(i.current.has(x)?i.current.get(x).add(c):i.current.set(x,new Set([c]))),u(3,()=>{ce(),U(),r.current.value||D(),E.emit()}),()=>{s.current.delete(c),a.current.delete(c),r.current.filtered.items.delete(c);let k=L();u(4,()=>{ce(),k?.getAttribute("id")===c&&D(),E.emit()})}),group:c=>(i.current.has(c)||i.current.set(c,new Set),()=>{s.current.delete(c),i.current.delete(c)}),filter:()=>p.current.shouldFilter,label:h||e["aria-label"],getDisablePointerSelection:()=>p.current.disablePointerSelection,listId:Q,inputId:B,labelId:J,listInnerRef:y}),[]);function V(c,x){var k,f;let b=(f=(k=p.current)==null?void 0:k.filter)!=null?f:fr;return c?b(c,r.current.search,x):0}function U(){if(!r.current.search||p.current.shouldFilter===!1)return;let c=r.current.filtered.items,x=[];r.current.filtered.groups.forEach(f=>{let b=i.current.get(f),N=0;b.forEach(A=>{let $=c.get(A);N=Math.max($,N)}),x.push([f,N])});let k=y.current;K().sort((f,b)=>{var N,A;let $=f.getAttribute("id"),z=b.getAttribute("id");return((N=c.get(z))!=null?N:0)-((A=c.get($))!=null?A:0)}).forEach(f=>{let b=f.closest(Pe);b?b.appendChild(f.parentElement===b?f:f.closest(`${Pe} > *`)):k.appendChild(f.parentElement===k?f:f.closest(`${Pe} > *`))}),x.sort((f,b)=>b[1]-f[1]).forEach(f=>{var b;let N=(b=y.current)==null?void 0:b.querySelector(`${fe}[${ae}="${encodeURIComponent(f[0])}"]`);N?.parentElement.appendChild(N)})}function D(){let c=K().find(k=>k.getAttribute("aria-disabled")!=="true"),x=c?.getAttribute(ae);E.setState("value",x||void 0)}function ce(){var c,x,k,f;if(!r.current.search||p.current.shouldFilter===!1){r.current.filtered.count=a.current.size;return}r.current.filtered.groups=new Set;let b=0;for(let N of a.current){let A=(x=(c=s.current.get(N))==null?void 0:c.value)!=null?x:"",$=(f=(k=s.current.get(N))==null?void 0:k.keywords)!=null?f:[],z=V(A,$);r.current.filtered.items.set(N,z),z>0&&b++}for(let[N,A]of i.current)for(let $ of A)if(r.current.filtered.items.get($)>0){r.current.filtered.groups.add(N);break}r.current.filtered.count=b}function ve(){var c,x,k;let f=L();f&&(((c=f.parentElement)==null?void 0:c.firstChild)===f&&((k=(x=f.closest(fe))==null?void 0:x.querySelector(hr))==null||k.scrollIntoView({block:"nearest"})),f.scrollIntoView({block:"nearest"}))}function L(){var c;return(c=y.current)==null?void 0:c.querySelector(`${Ct}[aria-selected="true"]`)}function K(){var c;return Array.from(((c=y.current)==null?void 0:c.querySelectorAll(lt))||[])}function le(c){let x=K()[c];x&&E.setState("value",x.getAttribute(ae))}function de(c){var x;let k=L(),f=K(),b=f.findIndex(A=>A===k),N=f[b+c];(x=p.current)!=null&&x.loop&&(N=b+c<0?f[f.length-1]:b+c===f.length?f[0]:f[b+c]),N&&E.setState("value",N.getAttribute(ae))}function ue(c){let x=L(),k=x?.closest(fe),f;for(;k&&!f;)k=c>0?Nr(k,fe):Sr(k,fe),f=k?.querySelector(lt);f?E.setState("value",f.getAttribute(ae)):de(c)}let X=()=>le(K().length-1),pe=c=>{c.preventDefault(),c.metaKey?X():c.altKey?ue(1):de(1)},me=c=>{c.preventDefault(),c.metaKey?le(0):c.altKey?ue(-1):de(-1)};return l.createElement(W.div,{ref:n,tabIndex:-1,..._,"cmdk-root":"",onKeyDown:c=>{var x;(x=_.onKeyDown)==null||x.call(_,c);let k=c.nativeEvent.isComposing||c.keyCode===229;if(!(c.defaultPrevented||k))switch(c.key){case"n":case"j":{T&&c.ctrlKey&&pe(c);break}case"ArrowDown":{pe(c);break}case"p":case"k":{T&&c.ctrlKey&&me(c);break}case"ArrowUp":{me(c);break}case"Home":{c.preventDefault(),le(0);break}case"End":{c.preventDefault(),X();break}case"Enter":{c.preventDefault();let f=L();if(f){let b=new Event(Ke);f.dispatchEvent(b)}}}}},l.createElement("label",{"cmdk-label":"",htmlFor:F.inputId,id:F.labelId,style:Ir},h),Ce(e,c=>l.createElement(It.Provider,{value:E},l.createElement(Et.Provider,{value:F},c))))}
vendor: 4,792 bytes, line 1
1),xr=l.forwardRef((e,n)=>{var r,a;let i=ie(),s=l.useRef(null),d=l.useContext($t),p=ye(),h=Mt(e),m=(a=(r=h.current)==null?void 0:r.forceMount)!=null?a:d?.forceMount;Z(()=>{if(!m)return p.item(i,d?.id)},[m]);let g=_t(i,s,[e.value,e.children,s],e.keywords),w=Ue(),I=H(u=>u.value&&u.value===g.current),C=H(u=>m||p.filter()===!1?!0:u.search?u.filtered.items.get(i)>0:!0);l.useEffect(()=>{let u=s.current;if(!(!u||e.disabled))return u.addEventListener(Ke,M),()=>u.removeEventListener(Ke,M)},[C,e.onSelect,e.disabled]);function M(){var u,E;P(),(E=(u=h.current).onSelect)==null||E.call(u,g.current)}function P(){w.setState("value",g.current,!0)}if(!C)return null;let{disabled:T,value:_,onSelect:Q,forceMount:J,keywords:B,...y}=e;return l.createElement(W.div,{ref:xe(s,n),...y,id:i,"cmdk-item":"",role:"option","aria-disabled":!!T,"aria-selected":!!I,"data-disabled":!!T,"data-selected":!!I,onPointerMove:T||p.getDisablePointerSelection()?void 0:P,onClick:T?void 0:M},e.children)}),gr=l.forwardRef((e,n)=>{let{heading:r,children:a,forceMount:i,...s}=e,d=ie(),p=l.useRef(null),h=l.useRef(null),m=ie(),g=ye(),w=H(C=>i||g.filter()===!1?!0:C.search?C.filtered.groups.has(d):!0);Z(()=>g.group(d),[]),_t(d,p,[e.value,e.heading,h]);let I=l.useMemo(()=>({id:d,forceMount:i}),[i]);return l.createElement(W.div,{ref:xe(p,n),...s,"cmdk-group":"",role:"presentation",hidden:w?void 0:!0},r&&l.createElement("div",{ref:h,"cmdk-group-heading":"","aria-hidden":!0,id:m},r),Ce(e,C=>l.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?m:void 0},l.createElement($t.Provider,{value:I},C))))}),br=l.forwardRef((e,n)=>{let{alwaysRender:r,...a}=e,i=l.useRef(null),s=H(d=>!d.search);return!r&&!s?null:l.createElement(W.div,{ref:xe(i,n),...a,"cmdk-separator":"",role:"separator"})}),yr=l.forwardRef((e,n)=>{let{onValueChange:r,...a}=e,i=e.value!=null,s=Ue(),d=H(m=>m.search),p=H(m=>m.selectedItemId),h=ye();return l.useEffect(()=>{e.value!=null&&s.setState("search",e.value)},[e.value]),l.createElement(W.input,{ref:n,...a,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":h.listId,"aria-labelledby":h.labelId,"aria-activedescendant":p,id:h.inputId,type:"text",value:i?e.value:d,onChange:m=>{i||s.setState("search",m.target.value),r?.(m.target.value)}})}),vr=l.forwardRef((e,n)=>{let{children:r,label:a="Suggestions",...i}=e,s=l.useRef(null),d=l.useRef(null),p=H(m=>m.selectedItemId),h=ye();return l.useEffect(()=>{if(d.current&&s.current){let m=d.current,g=s.current,w,I=new ResizeObserver(()=>{w=requestAnimationFrame(()=>{let C=m.offsetHeight;g.style.setProperty("--cmdk-list-height",C.toFixed(1)+"px")})});return I.observe(m),()=>{cancelAnimationFrame(w),I.unobserve(m)}}},[]),l.createElement(W.div,{ref:xe(s,n),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":p,"aria-label":a,id:h.listId},Ce(e,m=>l.createElement("div",{ref:xe(d,h.listInnerRef),"cmdk-list-sizer":""},m)))}),kr=l.forwardRef((e,n)=>{let{open:r,onOpenChange:a,overlayClassName:i,contentClassName:s,container:d,...p}=e;return l.createElement(ht,{open:r,onOpenChange:a},l.createElement(ft,{container:d},l.createElement(xt,{"cmdk-overlay":"",className:i}),l.createElement(gt,{"aria-label":e.label,"cmdk-dialog":"",className:s},l.createElement(Rt,{ref:n,...p}))))}),wr=l.forwardRef((e,n)=>H(r=>r.filtered.count===0)?l.createElement(W.div,{ref:n,...e,"cmdk-empty":"",role:"presentation"}):null),jr=l.forwardRef((e,n)=>{let{progress:r,children:a,label:i="Loading...",...s}=e;return l.createElement(W.div,{ref:n,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},Ce(e,d=>l.createElement("div",{"aria-hidden":!0},d)))}),oe=Object.assign(Rt,{List:vr,Item:xr,Input:yr,Group:gr,Separator:br,Dialog:kr,Empty:wr,Loading:jr});function Nr(e,n){let r=e.nextElementSibling;for(;r;){if(r.matches(n))return r;r=r.nextElementSibling}}function Sr(e,n){let r=e.previousElementSibling;for(;r;){if(r.matches(n))return r;r=r.previousElementSibling}}function Mt(e){let n=l.useRef(e);return Z(()=>{n.current=e}),n}var Z=typeof window>"u"?l.useEffect:l.useLayoutEffect;function se(e){let n=l.useRef();return n.current===void 0&&(n.current=e()),n}function H(e){let n=Ue(),r=()=>e(n.snapshot());return l.useSyncExternalStore(n.subscribe,r,r)}function _t(e,n,r,a=[]){let i=l.useRef(),s=ye();return Z(()=>{var d;let p=(()=>{var m;for(let g of r){if(typeof g=="string")return g.trim();if(typeof g=="object"&&"current"in g)return g.current?(m=g.current.textContent)==null?void 0:m.trim():i.current}})(),h=a.map(m=>m.trim());s.value(e,p,h),(d=n.current)==null||d.setAttribute(ae,p),i.current=p}),i}var Cr=()=>{let[e,n]=l.useState(),r=se(()=>new Map);return Z(()=>{r.current.forEach(a=>
1a()),r.current=new Map},[e]),(a,i)=>{r.current.set(a,i),n({})}};function Er(e){let n=e.type;return typeof n=="function"?n(e.props):"render"in n?n.render(e.props):e}function Ce({asChild:e,children:n},r){return e&&l.isValidElement(n)?l.cloneElement(Er(n),{ref:n.ref},r(n.props.children)):r(n)}var Ir={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function $r(e,n){const[r,a]=l.useState(e);return l.useEffect(()=>{const i=window.setTimeout(()=>a(e),n);return()=>window.clearTimeout(i)},[e,n]),r}function Rr(e,n){if(n)return{type:n.type,id:n.id};if(e?.type==="merchant"&&e.id)return{type:"merchant",id:e.id};if(e?.type==="partner"&&e.id)return{type:"partner",id:e.id}}const Mr=(e,n,r)=>["command-palette","search",{q:e,type:n??null,scope:r??null}],_r=(e,n,r)=>bt({queryKey:Mr(e,n,r),queryFn:()=>Ar(e,n,r),enabled:e.trim().length>0,placeholderData:Vt,staleTime:1e4});async function Ar(e,n,r){const a=await Qe.GET("/internal/command-palette/search",{params:{query:{q:e,...r?.type==="merchant"?{scope_merchant_id:r.id}:{},...r?.type==="partner"?{scope_partner_id:r.id}:{}}}});if(a.error)throw new Error(Ve(a.error,"Search failed"));return zt(a.data)}const At=["command-palette","quick-actions"],Pr=()=>bt({queryKey:At,queryFn:Lr,staleTime:6e4});async function Lr(){const e=await Qe.GET("/internal/command-palette/quick-actions");if(e.error)throw new Error(Ve(e.error,"Failed to load quick actions"));return yt(e.data).disabled_actions}async function qr(e){const n=await Qe.PUT("/internal/command-palette/quick-actions",{body:{disabled_actions:e}});if(n.error)throw new Error(Ve(n.error,"Failed to save quick actions"));return yt(n.data).disabled_actions}const Tr=[{key:"create-payout",label:"Create payout batch",hint:"Bundle the merchant’s eligible transactions into a new payout batch.",icon:De,kind:"create",permission:"admin-payouts:create",run:(e,{merchantId:n})=>e({to:"/merchants/$merchantId/payouts",params:{merchantId:n},search:{create:!0}})},{key:"create-invoice",label:"Create invoice",hint:"Bill the merchant for a period of transactions.",icon:Ne,kind:"create",permission:"admin-invoices:create",run:(e,{merchantId:n})=>e({to:"/invoices/new",search:{merchant_id:n,from:"workspace"}})},{key:"create-payment-link",label:"Create payment link",hint:"Generate a shareable payment link for the merchant.",icon:vt,kind:"create",permission:"payment-links:create",run:(e,{merchantId:n})=>e({to:"/merchants/$merchantId/payment-links",params:{merchantId:n},search:{create:!0}})},{key:"view-transactions",label:"View transactions",hint:"Jump to the merchant’s transactions.",icon:ze,kind:"view",permission:"transactions:search",run:(e,{merchantId:n,selfView:r})=>e(r?{to:"/transactions"}:{to:"/merchants/$merchantId/transactions",params:{merchantId:n}})},{key:"view-payouts",label:"View payouts",hint:"Jump to the merchant’s payout batches.",icon:De,kind:"view",permission:"payouts:list",run:(e,{merchantId:n,selfView:r})=>e(r?{to:"/payouts"}:{to:"/merchants/$merchantId/payouts",params:{merchantId:n}})},{key:"view-invoices",label:"View invoices",hint:"Jump to the merchant’s invoices.",icon:Ne,kind:"view",permission:"invoices:list",run:(e,{merchantId:n,selfView:r})=>e(r?{to:"/invoices"}:{to:"/merchants/$merchantId/invoices",params:{merchantId:n}})},{key:"view-refund-account",label:"View refund account",hint:"Jump to the merchant’s refund account.",icon:pt,kind:"view",permission:"refunds:list",run:(e,{merchantId:n,selfView:r})=>e(r?{to:"/refund-account"}:{to:"/merchants/$merchantId/refund-account",params:{merchantId:n}})}];function Ge(e){return Tr.filter(n=>e(n.permission))}function Fr(e,n){const r=new Set(e);return Ge(n).filter(a=>!r.has(a.key))}function Dr(e){return Ge(e).filter(n=>n.kind==="view")}function Or(e){const n=[];return e("merchants:list")&&n.push({key:"view-merchants",label:"View merchants",icon:G,run:r=>r({to:"/merchants"})}),(e("banks:list")||e("banks:list-active"))&&n.push({key:"view-coverage",label:"View coverage",icon:we,run:r=>r({to:"/coverage"})}),n}const Y="h-4 w-4 text-muted-foreground";function Le(e){return e?.startsWith("merchant:")&&e.slice(9)||void 0}const Ee={partner:{icon:t.jsx(be,{className:Y}),label:"Partners",order:0,navigate:(e,n)=>e({to:"/partners/$partnerId",params:{partnerId:n.id}})},merchant:{icon:t.jsx(G,{className:Y}),label:"Merchants",order:1,navigate:(e,n)=>e({to:"/merchants/$merchantId",params:{merchantId:n.id}})},"payment-link":{icon:t.jsx(En,{className:Y}),label:"Payment Links",order:2,navigate:(e,n)=>e({to:"/payment-links/$linkId",params:{linkId:n.id}})},payout:{icon:t.jsx(ze,{className:Y}),label:"Payouts",order:3,navigate:(e,n)=>e({to:"/payouts/$payoutBatchId",params:{payoutBatchId:n.id},search:{merchant_id:Le(n.context)}})},transaction:{icon:t.jsx(Ne,{className:Y}),label:"Transactions",order:4,navigate:(e,n)=>e({to:"/transactions",search:{transaction_id:n.id,merchant_id:Le(n.context)}})},invoice:{icon:t.jsx(fn,{className:Y}),label:"Invoices",order:5,navigate:(e,n)=>e({to:"/invoices/$invoiceId",params:{invoiceId:n.id},search:{merchant_id:Le(n.context)}})}},Kr=t.jsx(Se,{className:Y});function Qr(e){return Ee[e]?.icon??Kr}function Vr(e){return Ee[e]?.label??e.charAt(0).toUpperCase()+e.slice(1)+"s"}const dt=Object.entries(Ee).sort(([,e],[,n])=>e.order-n.order).map(([e])=>e);function zr(e,n){const r=Ee[n.type];return r?r.navigate(e,n):e({to:"/"})}function ut(e){const n=new Map;for(const r of e){const a=n.get(r.type)??[];a.push(r),n.set(r.type,a)}return Array.from(n.entries()).sort((r,a)=>{const i=dt.indexOf(r[0]),s=dt.indexOf(a[0]);return(i===-1?99:i)-(s===-1?99:s)})}function ne({value:e,onSelect:n,icon:r,title:a,subtitle:i,parentTitle:s,onRemove:d}){return t.jsxs(oe.Item,{value:e,onSelect:n,className:j("group flex items-center gap-3 px-3 py-2 rounded-lg cursor-pointer text-sm","transition-colors duration-150 ease-out","aria-selected:bg-foreground
1/[0.07] dark:aria-selected:bg-foreground/[0.10]"),children:[t.jsx("span",{className:"shrink-0 transition-transform duration-150 ease-out group-aria-[selected=true]:scale-105",children:r}),t.jsxs("div",{className:"flex-1 min-w-0 transition-transform duration-150 ease-out group-aria-[selected=true]:translate-x-0.5",children:[t.jsxs("div",{className:"truncate",children:[s&&t.jsxs("span",{className:"text-muted-foreground",children:[s," › "]}),t.jsx("span",{children:a})]}),i&&t.jsx("div",{className:"text-xs text-muted-foreground truncate",children:i})]}),d&&t.jsx("button",{type:"button","aria-label":"Remove from recents",onPointerDown:p=>p.stopPropagation(),onClick:p=>{p.stopPropagation(),p.preventDefault(),d()},className:j("flex items-center justify-center h-5 w-5 rounded text-muted-foreground","opacity-0 group-hover:opacity-100 aria-[selected=true]:opacity-100","hover:bg-foreground/10 hover:text-foreground transition-opacity"),children:t.jsx(Fe,{className:"h-3.5 w-3.5"})})]})}const Br=300;function Ur(){const{open:e,query:n,recents:r,scopedPath:a}=tr(),i=a[a.length-1],s=a.length>0,d=ge(),{availableContexts:p,currentContext:h,homeContext:m,can:g}=ee(),w=Bt(),I=$r(n,Br),C=n.trim()===""?"":I,M=Nt(),[P,T]=l.useState(""),[_,Q]=l.useState(!1);l.useEffect(()=>{e||Q(!1)},[e]);const J=h?he(h):null,B=m?he(m):null;l.useEffect(()=>{R.setContext(J,B)},[J,B]);const y=h?.type==="global"||h?.type==="partner",u=h?.type==="global",E=h?.type==="merchant",F=Rr(h,i),V=je({..._r(C.trim(),void 0,F)}),U=je({...Pr(),enabled:u}),D=u?U.data??[]:[],ce=hn({mutationFn:o=>qr(o),onSuccess:o=>w.setQueryData(At,o)}),ve=o=>{const v=D.includes(o)?D.filter(S=>S!==o):[...D,o];ce.mutate(v)},L=y&&i?.type==="merchant"?Fr(D,g):[],K=E&&h?.id?Dr(g).map(o=>({key:o.key,label:o.label,icon:o.icon,run:v=>o.run(v,{merchantId:h.id,selfView:!0})})):h?.type==="partner"?Or(g):[],le=(o,v)=>{R.close(),o.run(d,v)},de=o=>{R.close(),o.run(d)},ue=l.useMemo(()=>{if(i)return{input:`Search within ${i.name}`,empty:`Type to search within ${i.name}.`};switch(h?.type){case"partner":return{input:"Search merchants, transactions, payouts and more",empty:"Start typing to search merchants, transactions and more."};case"merchant":return{input:"Search your transactions, payouts and payment links",empty:"Start typing to search your transactions, payouts and payment links."};default:return{input:"Search partners, merchants, transactions, payouts and more",empty:"Start typing to search partners, merchants, transactions and more."}}},[h?.type,i]),X=p.filter(o=>!h||o.type!==h.type?!0:o.id!==h.id),pe=o=>{R.pushRecent({type:o.type,id:o.id,title:o.title,context:o.context,subtitle:o.subtitle,parent_title:o.parent_title}),R.close(),zr(d,o)},me=async o=>{R.close();try{await Ht.switchContext(he(o))}catch(v){Wt.error("Could not switch context. Please try again."),console.error("Context switch failed:",v);return}d({to:"/"})},c=l.useMemo(()=>{const o=P.split(":"),v=o[0]==="recent",S=v?o[1]:o[0],te=v?o[2]:o[1];if(S!=="merchant"&&S!=="partner"||!te)return null;const ke=(v?r:V.data??[]).find(Ye=>Ye.type===S&&Ye.id===te),Xe={type:S,id:te,title:ke?.title??te,context:ke?.context??`${S}:${te}`,subtitle:ke?.subtitle,parent_title:ke?.parent_title};return{type:S,id:te,name:Xe.title,recent:Xe}},[P,r,V.data]),x=()=>c?(R.pushRecent(c.recent),me({type:c.type,id:c.id}),!0):!1,k=()=>!y||!c?!1:(R.pushRecent(c.recent),R.pushScope({type:c.type,id:c.id,name:c.name}),!0),f=o=>o.type==="global"?t.jsx(Be,{className:"h-4 w-4 text-muted-foreground"}):o.type==="partner"?t.jsx(be,{className:"h-4 w-4 text-muted-foreground"}):t.jsx(G,{className:"h-4 w-4 text-muted-foreground"}),b=C.trim().length>0,N=V.data??[],A=b&&V.isLoading,$=r,z=!s&&X.length>0,He=!!c,Ie=l.useMemo(()=>Ge(g),[g]),$e=l.useMemo(()=>{if(_)return Ie.map(v=>`qa-setting:${v.key}`);if(b)return ut(N).flatMap(([,v])=>v.map(S=>`${S.type}:${S.id}`));const o=[];return L.length>0&&o.push(...L.map(v=>`qa:${v.key}`)),i?.type==="merchant"&&u&&o.push("qa-configure"),z&&o.push(...X.map(v=>`ctx:${he(v)}`)),s||o.push(...$.map(v=>`recent:${v.type}:${v.id}`)),K.length>0&&o.push(...K.map(v=>`qa:${v.key}`)),o},[_,Ie,b,N,K,L,i,u,z,X,$]),We=$e[0]??"";l.useEffect(()=>{T(We)},[We]);const Je=M?"⌘↵":"Ctrl↵",Pt=l.useMemo(()=>{const o=$e.length>
11?[{keys:"↑↓",label:"Navigate"}]:[];if(_)return[{keys:"↵",label:"Toggle"},...o,{keys:"esc",label:s?"Back to scope":"Back"}];const S=[{keys:"↵",label:s?P.startsWith("qa:")?"Run":P==="qa-configure"?"Configure":"Open":"Open"}];return y&&He?(S.push({keys:"⇥",label:"Scope in"}),S.push({keys:Je,label:"Switch scope"})):o.length&&S.push(o[0]),s&&S.push({keys:"esc",label:a.length>1?"Up one level":"Clear scope"}),S},[_,s,a.length,P,$e.length,y,He,Je]);return t.jsx(ht,{open:e,onOpenChange:o=>o?R.open():R.close(),children:t.jsxs(ft,{children:[t.jsx(xt,{className:"fixed inset-0 z-50 bg-black/40 backdrop-blur-[2px] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"}),t.jsxs(gt,{"aria-describedby":void 0,onEscapeKeyDown:o=>{if(_){o.preventDefault(),Q(!1);return}s&&(o.preventDefault(),R.popScope())},className:j("fixed left-1/2 top-[15%] z-50 w-[calc(100vw-2rem)] max-w-2xl -translate-x-1/2","rounded-2xl border border-border/50 bg-background dark:bg-background/70","backdrop-blur-xl backdrop-saturate-150","shadow-[inset_0_1px_0_0_rgba(255,255,255,0.08),0_20px_60px_-10px_rgba(0,0,0,0.45)]","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95"),children:[t.jsx(Ut,{className:"sr-only",children:"Command Palette"}),t.jsxs(oe,{shouldFilter:!1,loop:!0,value:P,onValueChange:T,className:"flex flex-col",children:[t.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-border/40",children:[t.jsx(Se,{className:"h-4 w-4 text-muted-foreground shrink-0"}),s?t.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1.5 rounded-md bg-foreground
1/10 py-1 pl-2 pr-1 text-xs font-medium",children:[t.jsx("span",{className:"capitalize text-muted-foreground",children:a[0].type}),a.map(o=>t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx("span",{className:"text-muted-foreground",children:"›"}),t.jsx("span",{className:"max-w-[140px] truncate",children:o.name})]},`${o.type}:${o.id}`)),t.jsx("button",{type:"button","aria-label":"Clear scope",onClick:()=>R.clearScope(),className:"ml-0.5 rounded p-0.5 text-muted-foreground hover:bg-foreground/10 hover:text-foreground",children:t.jsx(Fe,{className:"h-3 w-3"})})]}):null,t.jsx(oe.Input,{autoFocus:!0,value:n,onValueChange:R.setQuery,onKeyDown:o=>{if((o.metaKey||o.ctrlKey)&&o.key==="Enter"){x()&&o.preventDefault();return}if(o.key==="Tab"){o.preventDefault(),o.shiftKey||k();return}o.key==="Backspace"&&n.length===0&&s&&(o.preventDefault(),R.popScope())},placeholder:ue.input,className:"flex-1 bg-transparent outline-none text-sm placeholder:text-muted-foreground"}),n.length>0&&t.jsx("button",{type:"button","aria-label":"Clear search",onClick:()=>R.setQuery(""),className:"flex items-center justify-center h-5 w-5 rounded text-muted-foreground hover:bg-foreground
1/10 hover:text-foreground transition-colors shrink-0",children:t.jsx(Fe,{className:"h-3.5 w-3.5"})}),u?t.jsx("button",{type:"button","aria-label":"Configure quick actions","aria-pressed":_,onClick:()=>Q(o=>!o),className:j("flex h-6 w-6 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-foreground/10 hover:text-foreground",_&&"bg-foreground/10 text-foreground"),children:t.jsx(xn,{className:"h-4 w-4"})}):null,t.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-1 px-2 py-0.5 rounded border border-border font-mono text-xs text-muted-foreground",children:"ESC"})]}),t.jsx(oe.List,{className:j("flex max-h-[400px] flex-col overflow-y-auto p-2",E&&!b&&!_&&"min-h-[320px]"),children:_?t.jsx(Gr,{actions:Ie,disabledKeys:D,onToggle:ve}):t.jsxs(t.Fragment,{children:[!b&&i?.type==="merchant"&&y&&t.jsxs(t.Fragment,{children:[L.length>0&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"px-2 py-1.5",children:t.jsx("span",{className:"text-xs text-muted-foreground",children:"Quick actions"})}),L.map(o=>{const v=o.icon;return t.jsx(ne,{value:`qa:${o.key}`,onSelect:()=>le(o,{merchantId:i.id,selfView:!1}),icon:t.jsx(v,{className:"h-4 w-4 text-muted-foreground"}),title:o.label},`qa-${o.key}`)})]}),u&&t.jsx(ne,{value:"qa-configure",onSelect:()=>Q(!0),icon:t.jsx(Fn,{className:"h-4 w-4 text-muted-foreground"}),title:L.length===0?"Configure quick actions for this merchant":"Configure quick actions"})]}),!b&&z&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"px-2 py-1.5",children:t.jsx("span",{className:"text-xs text-muted-foreground",children:"Switch context"})}),X.map(o=>{const v=he(o);return t.jsx(ne,{value:`ctx:${v}`,onSelect:()=>me(o),icon:f(o),title:Te(o),subtitle:o.type==="global"?void 0:o.id,parentTitle:o.type==="global"?void 0:o.type.charAt(0).toUpperCase()+o.type.slice(1)},`ctx-${v}`)})]}),!b&&!i&&$.length>0&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:"Recent"}),t.jsx("button",{type:"button",onClick:()=>R.clearRecents(),className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Clear"})]}),$.map(o=>t.jsx(ne,{value:`recent:${o.type}:${o.id}`,onSelect:()=>pe(o),icon:t.jsx(mt,{className:"h-4 w-4 text-muted-foreground"}),title:o.title,subtitle:o.subtitle,parentTitle:o.parent_title,onRemove:()=>R.removeRecent(o.type,o.id)},`recent-${o.type}-${o.id}`))]}),!b&&!i&&$.length===0&&!z&&t.jsx("div",{className:"px-3 py-8 text-center text-sm text-muted-foreground",children:ue.empty}),!b&&i?.type==="partner"&&t.jsxs("div",{className:"px-3 py-8 text-center text-sm text-muted-foreground",children:["Type to search within ",i.name,"."]}),!b&&K.length>0&&t.jsxs("div",{className:"mt-auto border-t border-border/40 pt-2",children:[t.jsx("div",{className:"px-2 py-1.5",children:t.jsx("span",{className:"text-xs text-muted-foreground",children:"Quick actions"})}),K.map(o=>{const v=o.icon;return t.jsx(ne,{value:`qa:${o.key}`,onSelect:()=>de(o),icon:t.jsx(v,{className:"h-4 w-4 text-muted-foreground"}),title:o.label},`qa-${o.key}`)})]}),A&&t.jsx("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:"Searching…"}),b&&!A&&N.length===0&&t.jsxs(oe.Empty,{className:"px-3 py-8 text-center text-sm text-muted-foreground",children:['No results for "',C,'"']}),b&&N.length>0&&ut(N).map(([o,v])=>t.jsxs("div",{className:"mb-2 last:mb-0",children:[t.jsx("div",{className:"px-2 py-1.5",children:t.jsx("span",{className:"text-xs text-muted-foreground",children:Vr(o)})}),v.map(S=>t.jsx(ne,{value:`${S.type}:${S.id}`,onSelect:()=>pe(S),icon:Qr(S.type),title:S.title,subtitle:S.subtitle,parentTitle:S.parent_title},`${S.type}-${S.id}`))]},o))]})}),t.jsx("div",{className:"flex items-center gap-5 px-4 py-2.5 border-t border-border/40 text-xs font-medium text-muted-foreground",children:Pt.map(o=>{const v=/^[a-z]/.test(o.keys);return t.jsxs("span",{className:"inline-flex items-center gap-2",children:[t.jsx("kbd",{className:j("inline-flex items-center justify-center h-7 px-2 rounded-md border border-border bg-secondary font-mono leading-none",o.keys.length>1?"min-w-[40px]":"min-w-[28px]",v?"text-xs":"text-base"),children:o.keys}
1),o.label]},o.label)})})]})]})]})})}function Gr({actions:e,disabledKeys:n,onToggle:r}){return t.jsxs("div",{className:"py-1",children:[t.jsx("div",{className:"px-2 py-1.5",children:t.jsx("span",{className:"text-xs text-muted-foreground",children:"Quick actions — shown when you scope into a merchant"})}),e.length===0?t.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"No quick actions are available for your role."}):e.map(a=>{const i=a.icon,s=!n.includes(a.key);return t.jsxs(oe.Item,{value:`qa-setting:${a.key}`,role:"switch","aria-checked":s,onSelect:()=>r(a.key),className:j("flex w-full items-start gap-3 rounded-md px-2 py-2 text-left cursor-pointer","aria-selected:bg-foreground/[0.07] dark:aria-selected:bg-foreground/[0.10]"),children:[t.jsx(i,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"}),t.jsxs("span",{className:"min-w-0 flex-1",children:[t.jsx("span",{className:"block text-sm font-medium",children:a.label}),t.jsx("span",{className:"block text-xs text-muted-foreground",children:a.hint})]}),t.jsx("span",{className:j("mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded border",s?"border-foreground bg-foreground text-background":"border-border"),children:s?t.jsx(Gt,{className:"h-3 w-3"}):null})]},a.key)})]})}function Hr({children:e}){const[n,r]=l.useState(!1),a=kt();return l.useEffect(()=>{const i=document.documentElement;if(a?.primary_color){const s=mn(a.primary_color);i.style.setProperty("--color-primary",s),i.style.setProperty("--color-sidebar-primary",s)}return()=>{i.style.removeProperty("--color-primary"),i.style.removeProperty("--color-sidebar-primary")}},[a?.primary_color]),l.useEffect(()=>{const i=s=>{(s.metaKey||s.ctrlKey)&&s.key.toLowerCase()==="k"&&(s.preventDefault(),R.toggle())};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[]),t.jsxs("div",{className:"h-screen bg-background bg-gradient-radial-subtle overflow-hidden",children:[t.jsxs("div",{className:"flex min-w-0 h-full",children:[t.jsx(Bn,{open:n,setOpen:r}),t.jsxs("div",{className:j("flex-1 flex flex-col min-w-0","lg:pl-[4.8rem]"),children:[t.jsx(nr,{onMenuClick:()=>r(i=>!i)}),t.jsx(ar,{}),t.jsx("main",{className:"flex-1 min-h-0 pt-6 px-6 pb-2 lg:pt-8 lg:px-8 lg:pb-3 overflow-y-auto overflow-x-hidden min-w-0",children:e})]})]}),t.jsx(Ur,{})]})}function ya(){return t.jsx(Hr,{children:t.jsx(Jt,{})})}export{ya as component};

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.