1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/admin.functions-CFDf3_0b.js","assets/chunk-QTnfLwEv.js","assets/index-BRgZ9gnQ.js","assets/preload-helper-zJ_50EbN.js","assets/client-Cvz-xvE9.js","assets/link-CBRnoXkg.js","assets/useRouter-CngwSD46.js","assets/react-xd4aoMiW.js","assets/invariant-DEEwAagU.js","assets/react-dom-CkYMPG8-.js","assets/jsx-runtime-DsKLSDJq.js","assets/not-found-i5RsCZif.js","assets/index-Cb7KG80W.css","assets/browser-DVlKlY7A.js"])))=>i.map(i=>d[i]); 2import{r as e}from"./chunk-QTnfLwEv.js";import{t}from"./react-xd4aoMiW.js";import{t as n}from"./react-dom-CkYMPG8-.js";import{t as r}from"./link-CBRnoXkg.js";import{t as i}from"./jsx-runtime-DsKLSDJq.js";import{a,i as o,n as s,r as c}from"./client-Cvz-xvE9.js";import{t as l}from"./preload-helper-zJ_50EbN.js";import{i as u,n as d,r as f,t as p}from"./x-DMLy0Qnh.js";import{_ as m,a as h,c as g,d as _,f as v,g as y,h as b,i as x,m as S,n as C,o as w,p as T,r as E,t as D,u as O}from"./extension-D8DoJwsI.js";import{a as k,c as A,d as j,f as M,i as N,l as ee,n as te,o as ne,p as re,r as ie,s as ae,t as oe,u as P}from"./users-CPgiyBPr.js";import{n as se,t as ce}from"./store-BWgVAT1l.js";import{n as le,t as ue}from"./radio-BlZ667B4.js";import{t as de}from"./save-Cqq4RROd.js";import{$ as fe,J as pe,K as F,L as me,M as he,N as I,O as ge,Q as _e,S as ve,T as ye,Tt as be,X as xe,Y as L,Z as Se,_ as Ce,at as we,b as Te,c as Ee,ct as De,d as Oe,dt as ke,et as Ae,g as je,h as Me,ht as Ne,it as Pe,l as Fe,lt as Ie,mt as R,nt as Le,ot as Re,rt as ze,st as Be,tt as Ve,u as He,v as Ue,wt as z,y as We,z as B}from"./index-BRgZ9gnQ.js";import{i as Ge}from"./admin.functions-CFDf3_0b.js";import{t as Ke}from"./useSubscription-CW1ONFLd.js";import{i as qe,n as Je,r as Ye,t as Xe}from"./voice-client-CEJRd8Cg.js";import{i as Ze,n as Qe,r as $e,t as et}from"./stores.functions-CTUGlTus.js";import{l as tt}from"./pack.functions-Cp0Lquw6.js";var nt=B(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),rt=B(`calendar-clock`,[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),it=B(`calendar-days`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M16 14h.01`,key:`1gbofw`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M16 18h.01`,key:`kzsmim`}]]),at=B(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),ot=B(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),st=B(`dollar-sign`,[[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`22`,key:`7eqyqh`}],[`path`,{d:`M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6`,key:`1b0p4s`}]]),ct=B(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),lt=B(`facebook`,[[`path`,{d:`M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z`,key:`1jg4f8`}]]),ut=B(`git-compare-arrows`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`M12 18H7a2 2 0 0 1-2-2V9`,key:`16sdep`}],[`path`,{d:`m9 15 3 3-3 3`,key:`1m3kbl`}]]),dt=B(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),ft=B(`images`,[[`path`,{d:`m22 11-1.296-1.296a2.4 2.4 0 0 0-3.408 0L11 16`,key:`9kzy35`}],[`path`,{d:`M4 8a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2`,key:`1t0f0t`}],[`circle`,{cx:`13`,cy:`7`,r:`1`,fill:`currentColor`,key:`1obus6`}],[`rect`,{x:`8`,y:`2`,width:`14`,height:`14`,rx:`2`,key:`1gvhby`}]]),pt=B(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}
2]]),mt=B(`instagram`,[[`rect`,{width:`20`,height:`20`,x:`2`,y:`2`,rx:`5`,ry:`5`,key:`2e1cvw`}],[`path`,{d:`M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z`,key:`9exkf1`}],[`line`,{x1:`17.5`,x2:`17.51`,y1:`6.5`,y2:`6.5`,key:`r4j83e`}]]),ht=B(`life-buoy`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m4.93 4.93 4.24 4.24`,key:`1ymg45`}],[`path`,{d:`m14.83 9.17 4.24-4.24`,key:`1cb5xl`}],[`path`,{d:`m14.83 14.83 4.24 4.24`,key:`q42g0n`}],[`path`,{d:`m9.17 14.83-4.24 4.24`,key:`bqpfvv`}],[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}]]),gt=B(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),_t=B(`link`,[[`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`}]]),vt=B(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),yt=B(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),bt=B(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),xt=B(`mic-vocal`,[[`path`,{d:`m11 7.601-5.994 8.19a1 1 0 0 0 .1 1.298l.817.818a1 1 0 0 0 1.314.087L15.09 12`,key:`80a601`}],[`path`,{d:`M16.5 21.174C15.5 20.5 14.372 20 13 20c-2.058 0-3.928 2.356-6 2-2.072-.356-2.775-3.369-1.5-4.5`,key:`j0ngtp`}],[`circle`,{cx:`16`,cy:`7`,r:`5`,key:`d08jfb`}]]),St=B(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Ct=B(`share-2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),wt=B(`square-check-big`,[[`path`,{d:`M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344`,key:`2acyp4`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),Tt=B(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Et=B(`twitter`,[[`path`,{d:`M22 4s-.7 2.1-2 3.4c1.6 10-9.4 17.3-18 11.6 2.2.1 4.4-.6 6-2C3 15.5.5 9.6 3 5c2.2 2.6 5.6 4.1 9 4-.9-4.2 4-6.6 7-3.8 1.1 0 3-1.2 3-1.2z`,key:`pff0z6`}]]),Dt=B(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),Ot=B(`user-round`,[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]]),kt=B(`volume-2`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]),At=B(`volume-x`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`line`,{x1:`22`,x2:`16`,y1:`9`,y2:`15`,key:`1ewh16`}],[`line`,{x1:`16`,x2:`22`,y1:`9`,y2:`15`,key:`5ykzw1`}]]),jt=B(`wand-sparkles`,[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]]),Mt=e(ke()),V=e(t(),1),Nt=e(n(),1);function Pt(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}Array(12).fill(0);var Ft=1,H=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>
2{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id?.length>0?e.id:Ft++,i=this.toasts.find(e=>e.id===r),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),i?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:a,title:t}):n):this.addToast({title:t,...n,dismissible:a,id:r}),r},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>
2this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],V.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(Lt(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,o=typeof r==`object`&&!V.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!V.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!V.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:a,...o})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!V.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=t?.id||Ft++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},It=(e,t)=>{let n=t?.id||Ft++;return H.addToast({title:e,...t,id:n}),n},Lt=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,Rt=Object.assign(It,{success:H.success,info:H.info,warning:H.warning,error:H.error,custom:H.custom,message:H.message,promise:H.promise,dismiss:H.dismiss,loading:H.loading},{getHistory:()=>H.toasts,getToasts:()=>H.getActiveToasts()});Pt(`
vendor: 14,859 bytes, line 2
2[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
2`);var zt=`pl.printqueue.v1`,Bt=6,Vt=[300,800,2e3,5e3,1e4,2e4],Ht=new Set,Ut=!1,Wt=null,Gt=0,Kt=0,qt;function Jt(){if(typeof window>`u`)return[];try{return JSON.parse(window.localStorage.getItem(zt)||`[]`)}catch{return[]}}function Yt(e){if(!(typeof window>`u`)){try{window.localStorage.setItem(zt,JSON.stringify(e.slice(-200)))}catch{}Ht.forEach(t=>{try{t(e)}catch{}})}}function Xt(e){return Ht.add(e),e(Jt()),()=>{Ht.delete(e)}}async function Zt(e){try{let t=new AbortController,n=setTimeout(()=>t.abort(),4e3),r=_.get().selectedPrinter||void 0,i=await fetch(`http://localhost:17777/print`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...e.payload,printer:r,jobId:e.id}),signal:t.signal});if(clearTimeout(n),!i.ok)return{ok:!1,error:`Bridge ${i.status}`};try{let e=await i.json();if(e&&e.ok===!1)return{ok:!1,error:e.error||`Bridge rejected`}}catch{}return{ok:!0}}catch(e){return{ok:!1,error:e?.name===`AbortError`?`Bridge timeout`:e?.message||`Bridge offline`}}}async function Qt(){if(!Ut){Ut=!0;try{let e=Jt(),t=Date.now(),n=!1;for(let r of e){if(r.status===`done`)continue;if(r.attempts>=Bt){r.status!==`failed`&&(r.status=`failed`,n=!0);continue}if(r.nextAttemptAt>t)continue;r.attempts+=1;let e=await Zt(r);e.ok?(r.status=`done`,r.lastError=void 0,r.completedAt=Date.now(),Kt=Date.now(),qt=void 0):(r.status=`pending`,r.lastError=e.error,qt=e.error,r.nextAttemptAt=t+Vt[Math.min(r.attempts-1,Vt.length-1)],r.attempts>=Bt&&(r.status=`failed`)),n=!0}n&&Yt(e),Gt=Date.now()}finally{Ut=!1}}}function $t(){typeof window>`u`||Wt||(Wt=setInterval(()=>{Qt()},1500),window.addEventListener(`focus`,()=>void Qt()),window.addEventListener(`online`,()=>void Qt()))}function en(e){let t=Jt();if(e.saleId){let n=t.find(t=>t.saleId===e.saleId&&t.mode===e.mode&&t.status!==`failed`);if(n)return n.id}let n=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,r={id:n,saleId:e.saleId,mode:e.mode,platform:e.platform,payload:e.payload,status:`pending`,attempts:0,createdAt:Date.now(),nextAttemptAt:Date.now()};return t.push(r),Yt(t),Qt(),n}function tn(e){let t=Jt(),n=t.find(t=>t.id===e);n&&(n.status=`pending`,n.attempts=0,n.nextAttemptAt=Date.now(),n.lastError=void 0,Yt(t),Qt())}function nn(){let e=Jt();for(let t of e)t.status===`failed`&&(t.status=`pending`,t.attempts=0,t.nextAttemptAt=Date.now(),t.lastError=void 0);Yt(e),Qt()}function rn(){Yt(Jt().filter(e=>e.status!==`done`))}function an(e=[`Whatnot`,`TikTok Live`,`Facebook Live`]){let t=Jt(),n=Date.now(),r=n-1440*60*1e3,i=new Set(e),a=new Map;for(let t of e)a.set(t,[]);for(let e of t){if(e.createdAt<r)continue;let t=e.platform&&e.platform.trim()?e.platform:`Manual`;a.has(t)||a.set(t,[]),a.get(t).push(e)}let o=[];for(let[e,t]of a){let n=t.filter(e=>e.status===`done`),r=n.sort((e,t)=>(t.completedAt??0)-(e.completedAt??0))[0],i=t.filter(e=>e.status===`failed`),a=t.map(e=>e.lastError).filter(Boolean).slice(-1)[0];o.push({platform:e,pending:t.filter(e=>e.status===`pending`).length,failed:i.length,done:n.length,lastSuccessSaleId:r?.saleId,lastSuccessAt:r?.completedAt,lastError:a,failedJobs:i})}return o.sort((t,n)=>{let r=e.indexOf(t.platform),i=e.indexOf(n.platform);return(r===-1?999:r)-(i===-1?999:i)}),{bridgeOnline:Kt>0&&n-Kt<1e4,lastBridgeOkAt:Kt,lastTickAt:Gt,lastBridgeError:qt,totals:{pending:t.filter(e=>e.status===`pending`).length,failed:t.filter(e=>e.status===`failed`).length,done:t.filter(e=>e.status===`done`).length},platforms:o.filter(e=>i.has(e.platform)||e.pending||e.failed||e.done)}}var U=i();function on(e){if(!e)return null;let t=new Date(e).getTime()-Date.now();return Number.isNaN(t)?null:Math.max(0,Math.ceil(t/(1e3*60*60*24)))}function sn(){let e=Ke(),[t,n]=(0,V.useState)(!1),[i,a]=(0,V.useState)(!1);if((0,V.useEffect)(()=>{if(!e.userId){a(!0);return}Ge().then(e=>{n(e?.isAdmin===!0),a(!0)}).catch(()=>{n(!1),a(!0)})},[e.userId]),e.loading||!e.userId||!i||t)return null;if(e.rows.length===0)return(0,U.jsxs)(un,{tone:`warn`,children:[(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`strong`,{children:`No active plan.`}),` Start your 14-day free trial to unlock Live Show, AI Coach, and printing.`]}
2),(0,U.jsx)(r,{to:`/onboarding`,className:`primary`,style:cn,children:`Start free trial`})]});let o=e.rows.find(e=>e.price_id===`pearshow_core`)??e.rows[0];if(o.status===`past_due`)return(0,U.jsxs)(un,{tone:`error`,children:[(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`strong`,{children:`Payment past due.`}),` Update your card to keep things running â we're retrying automatically.`]}),(0,U.jsx)(r,{to:`/billing`,className:`primary`,style:cn,children:`Fix payment`})]});if(o.status===`trialing`){let e=on(o.current_period_end);return e!==null&&e<=3?(0,U.jsxs)(un,{tone:`info`,children:[(0,U.jsxs)(`span`,{children:[(0,U.jsxs)(`strong`,{children:[`Trial ends in `,e,` day`,e===1?``:`s`,`.`]}),` Your card will be charged automatically â no action needed.`]}),(0,U.jsx)(r,{to:`/billing`,style:ln,children:`Manage billing`})]}):null}if(o.cancel_at_period_end&&o.current_period_end){let e=on(o.current_period_end);return(0,U.jsxs)(un,{tone:`warn`,children:[(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`strong`,{children:`Subscription canceled.`}),` Access ends in `,e??`â`,` day`,e===1?``:`s`,`. Resubscribe anytime.`]}),(0,U.jsx)(r,{to:`/billing`,className:`primary`,style:cn,children:`Resume`})]})}return null}var cn={textDecoration:`none`,padding:`6px 12px`,borderRadius:6,fontWeight:700,fontSize:13},ln={fontSize:13,textDecoration:`underline`};function un({tone:e,children:t}){return(0,U.jsx)(`div`,{style:{background:e===`error`?`#3a1414`:e===`warn`?`#f5e9c8`:`#1a2a1a`,color:e===`warn`?`#1a1a1a`:`#ffffff`,border:`1px solid ${e===`error`?`#7a2424`:e===`warn`?`#c8b06a`:`#3a5a3a`}`,borderRadius:8,padding:`10px 14px`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:12,flexWrap:`wrap`},children:(0,U.jsx)(`div`,{style:{fontSize:14},children:t})})}typeof window<`u`&&window.document&&window.document.createElement;function W(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function dn(e,t){let n=V.createContext(t),r=e=>{let{children:t,...r}=e,i=V.useMemo(()=>r,Object.values(r));return(0,U.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=V.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function fn(e,t=[]){let n=[];function r(t,r){let i=V.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=V.useMemo(()=>o,Object.values(o));return(0,U.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=V.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>V.createContext(e));return function(n){let r=n?.[e]||t;return V.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,pn(i,...t)]}function pn(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return V.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var mn=globalThis?.document?V.useLayoutEffect:()=>{},hn=V.useId||(()=>void 0),gn=0;function _n(e){let[t,n]=V.useState(hn());return mn(()=>{e||n(e=>e??String(gn++))},[e]),e||(t?`radix-${t}`:``)}var vn=V.useInsertionEffect||mn;function yn({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=bn({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=V.useRef(e!==void 0);V.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,V.useCallback(t=>{if(s){let n=xn(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function bn({defaultProp:e,onChange:t}){let[n,r]=V.useState(e),i=V.useRef(n),a=V.useRef(t);return vn(()=>{a.current=t},[t]),V.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function xn(e){return typeof e==`function`}
vendor: 5,532 bytes, line 2
2function Sn(e){let t=Cn(e),n=V.forwardRef((e,n)=>{let{children:r,...i}=e,a=V.Children.toArray(r),o=a.find(Tn);if(o){let e=o.props.children,r=a.map(t=>t===o?V.Children.count(e)>1?V.Children.only(null):V.isValidElement(e)?e.props.children:null:t);return(0,U.jsx)(t,{...i,ref:n,children:V.isValidElement(e)?V.cloneElement(e,void 0,r):null})}return(0,U.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Cn(e){let t=V.forwardRef((e,t)=>{let{children:n,...r}=e;if(V.isValidElement(n)){let e=Dn(n),i=En(r,n.props);return n.type!==V.Fragment&&(i.ref=t?pe(t,e):e),V.cloneElement(n,i)}return V.Children.count(n)>1?V.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var wn=Symbol(`radix.slottable`);function Tn(e){return V.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===wn}function En(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Dn(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var G=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Sn(`Primitive.${t}`),r=V.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,U.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function On(e,t){e&&Nt.flushSync(()=>e.dispatchEvent(t))}function kn(e){let t=V.useRef(e);return V.useEffect(()=>{t.current=e}),V.useMemo(()=>(...e)=>t.current?.(...e),[])}function An(e,t=globalThis?.document){let n=kn(e);V.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var jn=`DismissableLayer`,Mn=`dismissableLayer.update`,Nn=`dismissableLayer.pointerDownOutside`,Pn=`dismissableLayer.focusOutside`,Fn,In=V.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ln=V.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=V.useContext(In),[u,d]=V.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=V.useState({}),m=L(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=h.indexOf(g),v=u?h.indexOf(u):-1,y=l.layersWithOutsidePointerEventsDisabled.size>0,b=v>=_,x=Bn(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=Vn(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return An(e=>{v===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),V.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Fn=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),Hn(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Fn)}},[u,f,n,l]),V.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),Hn())},[u,l]),V.useEffect(()=>{let e=()=>p({});return document.addEventListener(Mn,e),()=>document.removeEventListener(Mn,e)},[]),(0,U.jsx)(G.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:W(e.onFocusCapture,S.onFocusCapture),onBlurCapture:W(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:W(e.onPointerDownCapture,x.onPointerDownCapture)})});Ln.displayName=jn;var Rn=`DismissableLayerBranch`,zn=V.forwardRef((e,t)=>{let n=V.useContext(In),r=V.useRef(null),i=L(t,r);return V.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,U.jsx)(G.div,{...e,ref:i})});zn.displayName=Rn;function Bn(e,t=globalThis?.document){let n=kn(e),r=V.useRef(!1),i=V.useRef(()=>{});return V.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){Un(Nn,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Vn(e,t=globalThis?.document){let n=kn(e),r=V.useRef(!1);return V.useEffect(()=>{let e=e=>{e.target&&!r.current&&Un(Pn,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Hn(){let e=new CustomEvent(Mn);document.dispatchEvent(e)}function Un(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?On(i,a):i.dispatchEvent(a)}var Wn=`focusScope.autoFocusOnMount`,Gn=`focusScope.autoFocusOnUnmount`,Kn={bubbles:!1,cancelable:!0},qn=`FocusScope`,Jn=V.forwardRef((e,t)=>
vendor: 14,027 bytes, lines 2-42
2{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=V.useState(null),l=kn(i),u=kn(a),d=V.useRef(null),f=L(t,e=>c(e)),p=V.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;V.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:tr(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||tr(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&tr(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),V.useEffect(()=>{if(s){nr.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(Wn,Kn);s.addEventListener(Wn,l),s.dispatchEvent(t),t.defaultPrevented||(Yn(ar(Zn(s)),{select:!0}),document.activeElement===e&&tr(s))}return()=>{s.removeEventListener(Wn,l),setTimeout(()=>{let t=new CustomEvent(Gn,Kn);s.addEventListener(Gn,u),s.dispatchEvent(t),t.defaultPrevented||tr(e??document.body,{select:!0}),s.removeEventListener(Gn,u),nr.remove(p)},0)}}},[s,l,u,p]);let m=V.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=Xn(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&tr(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&tr(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,U.jsx)(G.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});Jn.displayName=qn;function Yn(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(tr(r,{select:t}),document.activeElement!==n)return}function Xn(e){let t=Zn(e);return[Qn(t,e),Qn(t.reverse(),e)]}function Zn(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Qn(e,t){for(let n of e)if(!$n(n,{upTo:t}))return n}function $n(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function er(e){return e instanceof HTMLInputElement&&`select`in e}function tr(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&er(e)&&t&&e.select()}}var nr=rr();function rr(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=ir(e,t),e.unshift(t)},remove(t){e=ir(e,t),e[0]?.resume()}}}function ir(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function ar(e){return e.filter(e=>e.tagName!==`A`)}var or=`Portal`,sr=V.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=V.useState(!1);mn(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Nt.createPortal((0,U.jsx)(G.div,{...r,ref:t}),o):null});sr.displayName=or;function cr(e,t){return V.useReducer((e,n)=>t[e][n]??e,e)}var lr=e=>{let{present:t,children:n}=e,r=ur(t),i=typeof n==`function`?n({present:r.isPresent}):V.Children.only(n),a=L(r.ref,fr(i));return typeof n==`function`||r.isPresent?V.cloneElement(i,{ref:a}):null};lr.displayName=`Presence`;function ur(e){let[t,n]=V.useState(),r=V.useRef(null),i=V.useRef(e),a=V.useRef(`none`),[o,s]=cr(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return V.useEffect(()=>{let e=dr(r.current);a.current=o===`mounted`?e:`none`},[o]),mn(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=dr(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),mn(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=dr(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=dr(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:V.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function dr(e){return e?.animationName||`none`}function fr(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var pr=0;function mr(){V.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??hr()),document.body.insertAdjacentElement(`beforeend`,e[1]??hr()),pr++,()=>{pr===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),pr--}},[])}function hr(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var gr=`right-scroll-bar-position`,_r=`width-before-scroll-bar`,vr=`with-scroll-bars-hidden`,yr=`--removed-body-scroll-bar-size`;function br(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function xr(e,t){var n=(0,V.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var Sr=typeof window<`u`?V.useLayoutEffect:V.useEffect,Cr=new WeakMap;function wr(e,t){var n=xr(t||null,function(t){return e.forEach(function(e){return br(e,t)})});return Sr(function(){var t=Cr.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||br(e,null)}),i.forEach(function(e){r.has(e)||br(e,a)})}Cr.set(n,e)},[e]),n}function Tr(e){return e}function Er(e,t){t===void 0&&(t=Tr);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Dr(e){e===void 0&&(e={});var t=Er(null);return t.options=c({async:!0,ssr:!1},e),t}var Or=function(e){var t=e.sideCar,n=o(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return V.createElement(r,c({},n))};Or.isSideCarExport=!0;function kr(e,t){return e.useMedium(t),Or}var Ar=Dr(),jr=function(){},Mr=V.forwardRef(function(e,t){var n=V.useRef(null),r=V.useState({onScrollCapture:jr,onWheelCapture:jr,onTouchMoveCapture:jr}),i=r[0],a=r[1],s=e.forwardProps,l=e.children,u=e.className,d=e.removeScrollBar,f=e.enabled,p=e.shards,m=e.sideCar,h=e.noRelative,g=e.noIsolation,_=e.inert,v=e.allowPinchZoom,y=e.as,b=y===void 0?`div`:y,x=e.gapMode,S=o(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),C=m,w=wr([n,t]),T=c(c({},S),i);return V.createElement(V.Fragment,null,f&&V.createElement(C,{sideCar:Ar,removeScrollBar:d,shards:p,noRelative:h,noIsolation:g,inert:_,setCallbacks:a,allowPinchZoom:!!v,lockRef:n,gapMode:x}),s?V.cloneElement(V.Children.only(l),c(c({},T),{ref:w})):V.createElement(b,c({},T,{className:u,ref:w}),l))});Mr.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Mr.classNames={fullWidth:_r,zeroRight:gr};var Nr,Pr=function(){if(Nr)return Nr;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Fr(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Pr();return t&&e.setAttribute(`nonce`,t),e}function Ir(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Lr(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Rr=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Fr())&&(Ir(t,n),Lr(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},zr=function(){var e=Rr();return function(t,n){V.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Br=function(){var e=zr();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Vr={left:0,top:0,right:0,gap:0},Hr=function(e){return parseInt(e||``,10)||0},Ur=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[Hr(n),Hr(r),Hr(i)]},Wr=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Vr;var t=Ur(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Gr=Br(),Kr=`data-scroll-locked`,qr=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),` 3 .${vr} { 4 overflow: hidden ${r}; 5 padding-right: ${s}px ${r}; 6 } 7 body[${Kr}] { 8 overflow: hidden ${r}; 9 overscroll-behavior: contain; 10 ${[t&&`position: relative ${r};`,n===`margin`&&` 11 padding-left: ${i}px; 12 padding-top: ${a}px; 13 padding-right: ${o}px; 14 margin-left:0; 15 margin-top:0; 16 margin-right: ${s}px ${r}; 17 `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)} 18 } 19 20 .${gr} { 21 right: ${s}px ${r}; 22 } 23 24 .${_r} { 25 margin-right: ${s}px ${r}; 26 } 27 28 .${gr} .${gr} { 29 right: 0 ${r}; 30 } 31 32 .${_r} .${_r} { 33 margin-right: 0 ${r}; 34 } 35 36 body[${Kr}] { 37 ${yr}: ${s}px; 38 } 39`},Jr=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Yr=function(){V.useEffect(function(){return document.body.setAttribute(Kr,(Jr()+1).toString()),function(){var e=Jr()-1;e<=0?document.body.removeAttribute(Kr):document.body.setAttribute(Kr,e.toString())}},[])},Xr=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Yr();var a=V.useMemo(function(){return Wr(i)},[i]);return V.createElement(Gr,{styles:qr(a,!t,i,n?``:`!important`)})},Zr=!1;if(typeof window<`u`)try{var Qr=Object.defineProperty({},"passive",{get:function(){return Zr=!0,!0}});window.addEventListener(`test`,Qr,Qr),window.removeEventListener(`test`,Qr,Qr)}catch{Zr=!1}var $r=Zr?{passive:!1}:!1,ei=function(e){return e.tagName===`TEXTAREA`},ti=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!ei(e)&&n[t]===`visible`)},ni=function(e){return ti(e,`overflowY`)},ri=function(e){return ti(e,`overflowX`)},ii=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),si(e,r)){var i=ci(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},ai=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},oi=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},si=function(e,t){return e===`v`?ni(t):ri(t)},ci=function(e,t){return e===`v`?ai(t):oi(t)},li=function(e,t){return e===`h`&&t===`rtl`?-1:1},ui=function(e,t,n,r,i){var a=li(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=ci(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&si(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},di=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},fi=function(e){return[e.deltaX,e.deltaY]},pi=function(e){return e&&`current`in e?e.current:e},mi=function(e,t){return e[0]===t[0]&&e[1]===t[1]},hi=function(e){return` 40 .block-interactivity-${e} {pointer-events: none;} 41 .allow-interactivity-${e} {pointer-events: all;} 42`},gi=0,_i=[];function vi(e){var t=V.useRef([]),n=V.useRef([0,0]),r=V.useRef(),i=V.useState(gi++)[0],o=V.useState(Br)[0],s=V.useRef(e);V.useEffect(function(){s.current=e},[e]),V.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=a([e.lockRef.current],(e.shards||[]).map(pi),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var c=V.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!s.current.allowPinchZoom;var i=di(e),a=n.current,o=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(o)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=ii(d,u);if(!m)return!0;
vendor: 8,553 bytes, line 42
42if(m?l=d:(l=d===`v`?`h`:`v`,m=ii(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(o||c)&&(r.current=l),!l)return!0;var h=r.current||l;return ui(h,t,e,h===`h`?o:c,!0)},[]),l=V.useCallback(function(e){var n=e;if(!(!_i.length||_i[_i.length-1]!==o)){var r=`deltaY`in n?fi(n):di(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&mi(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var a=(s.current.shards||[]).map(pi).filter(Boolean).filter(function(e){return e.contains(n.target)});(a.length>0?c(n,a[0]):!s.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),u=V.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:yi(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),d=V.useCallback(function(e){n.current=di(e),r.current=void 0},[]),f=V.useCallback(function(t){u(t.type,fi(t),t.target,c(t,e.lockRef.current))},[]),p=V.useCallback(function(t){u(t.type,di(t),t.target,c(t,e.lockRef.current))},[]);V.useEffect(function(){return _i.push(o),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener(`wheel`,l,$r),document.addEventListener(`touchmove`,l,$r),document.addEventListener(`touchstart`,d,$r),function(){_i=_i.filter(function(e){return e!==o}),document.removeEventListener(`wheel`,l,$r),document.removeEventListener(`touchmove`,l,$r),document.removeEventListener(`touchstart`,d,$r)}},[]);var m=e.removeScrollBar,h=e.inert;return V.createElement(V.Fragment,null,h?V.createElement(o,{styles:hi(i)}):null,m?V.createElement(Xr,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function yi(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var bi=kr(Ar,vi),xi=V.forwardRef(function(e,t){return V.createElement(Mr,c({},e,{ref:t,sideCar:bi}))});xi.classNames=Mr.classNames;var Si=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Ci=new WeakMap,wi=new WeakMap,Ti={},Ei=0,Di=function(e){return e&&(e.host||Di(e.parentNode))},Oi=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Di(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},ki=function(e,t,n,r){var i=Oi(t,Array.isArray(e)?e:[e]);Ti[n]||(Ti[n]=new WeakMap);var a=Ti[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(Ci.get(e)||0)+1,l=(a.get(e)||0)+1;Ci.set(e,c),a.set(e,l),o.push(e),c===1&&i&&wi.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),Ei++,function(){o.forEach(function(e){var t=Ci.get(e)-1,i=a.get(e)-1;Ci.set(e,t),a.set(e,i),t||(wi.has(e)||e.removeAttribute(r),wi.delete(e)),i||e.removeAttribute(n)}),Ei--,Ei||(Ci=new WeakMap,Ci=new WeakMap,wi=new WeakMap,Ti={})}},Ai=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Si(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),ki(r,i,n,`aria-hidden`)):function(){return null}};function ji(e){let t=Mi(e),n=V.forwardRef((e,n)=>{let{children:r,...i}=e,a=V.Children.toArray(r),o=a.find(Pi);if(o){let e=o.props.children,r=a.map(t=>t===o?V.Children.count(e)>1?V.Children.only(null):V.isValidElement(e)?e.props.children:null:t);return(0,U.jsx)(t,{...i,ref:n,children:V.isValidElement(e)?V.cloneElement(e,void 0,r):null})}return(0,U.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Mi(e){let t=V.forwardRef((e,t)=>{let{children:n,...r}=e;if(V.isValidElement(n)){let e=Ii(n),i=Fi(r,n.props);return n.type!==V.Fragment&&(i.ref=t?pe(t,e):e),V.cloneElement(n,i)}return V.Children.count(n)>1?V.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ni=Symbol(`radix.slottable`);function Pi(e){return V.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Ni}function Fi(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Ii(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Li=`Dialog`,[Ri,zi]=fn(Li),[Bi,Vi]=Ri(Li),Hi=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=V.useRef(null),c=V.useRef(null),[l,u]=yn({prop:r,defaultProp:i??!1,onChange:a,caller:Li});return(0,U.jsx)(Bi,{scope:t,triggerRef:s,contentRef:c,contentId:_n(),titleId:_n(),descriptionId:_n(),open:l,onOpenChange:u,onOpenToggle:V.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};Hi.displayName=Li;var Ui=`DialogTrigger`,Wi=V.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Vi(Ui,n),a=L(t,i.triggerRef);return(0,U.jsx)(G.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":ua(i.open),...r,ref:a,onClick:W(e.onClick,i.onOpenToggle)})});Wi.displayName=Ui;var Gi=`DialogPortal`,[Ki,qi]=Ri(Gi,{forceMount:void 0}),Ji=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Vi(Gi,t);return(0,U.jsx)(Ki,{scope:t,forceMount:n,children:V.Children.map(r,e=>(0,U.jsx)(lr,{present:n||a.open,children:(0,U.jsx)(sr,{asChild:!0,container:i,children:e})}))})};Ji.displayName=Gi;var Yi=`DialogOverlay`,Xi=V.forwardRef((e,t)=>{let n=qi(Yi,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Vi(Yi,e.__scopeDialog);return a.modal?(0,U.jsx)(lr,{present:r||a.open,children:(0,U.jsx)(Qi,{...i,ref:t})}):null});Xi.displayName=Yi;var Zi=ji(`DialogOverlay.RemoveScroll`),Qi=V.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Vi(Yi,n);return(0,U.jsx)(xi,{as:Zi,allowPinchZoom:!0,shards:[i.contentRef],children:(0,U.jsx)(G.div,{"data-state":ua(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),$i=`DialogContent`,ea=V.forwardRef((e,t)=>{let n=qi($i,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Vi($i,e.__scopeDialog);return(0,U.jsx)(lr,{present:r||a.open,children:a.modal?(0,U.jsx)(ta,{...i,ref:t}):(0,U.jsx)(na,{...i,ref:t})})});ea.displayName=$i;var ta=V.forwardRef((e,t)=>{let n=Vi($i,e.__scopeDialog),r=V.useRef(null),i=L(t,n.contentRef,r);return V.useEffect(()=>{let e=r.current;if(e)return Ai(e)},[]),(0,U.jsx)(ra,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:W(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:W(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:W(e.onFocusOutside,e=>e.preventDefault())})}),na=V.forwardRef((e,t)=>{let n=Vi($i,e.__scopeDialog),r=V.useRef(!1),i=V.useRef(!1);return(0,U.jsx)(ra,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),ra=V.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Vi($i,n),c=V.useRef(null),l=L(t,c);return mr(),(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Jn,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,U.jsx)(Ln,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":ua(s.open),...o,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ma,{titleId:s.titleId}),(0,U.jsx)(ga,{contentRef:c,descriptionId:s.descriptionId})]})]})}),ia=`DialogTitle`,aa=V.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Vi(ia,n);return(0,U.jsx)(G.h2,{id:i.titleId,...r,ref:t})});aa.displayName=ia;var oa=`DialogDescription`,sa=V.forwardRef((e,t)=>
42{let{__scopeDialog:n,...r}=e,i=Vi(oa,n);return(0,U.jsx)(G.p,{id:i.descriptionId,...r,ref:t})});sa.displayName=oa;var ca=`DialogClose`,la=V.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Vi(ca,n);return(0,U.jsx)(G.button,{type:`button`,...r,ref:t,onClick:W(e.onClick,()=>i.onOpenChange(!1))})});la.displayName=ca;function ua(e){return e?`open`:`closed`}var da=`DialogTitleWarning`,[fa,pa]=dn(da,{contentName:$i,titleName:ia,docsSlug:`dialog`}),ma=({titleId:e})=>{let t=pa(da),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. 43 44If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. 45 46For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return V.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},ha=`DialogDescriptionWarning`,ga=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${pa(ha).contentName}}.`;return V.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},_a=Hi,va=Ji,ya=Xi,ba=ea,xa=aa,Sa=sa,Ca=la,wa=_a,Ta=va,Ea=V.forwardRef(({className:e,...t},n)=>(0,U.jsx)(ya,{ref:n,className:F(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t}));Ea.displayName=ya.displayName;var Da=V.forwardRef(({className:e,children:t,...n},r)=>(0,U.jsxs)(Ta,{children:[(0,U.jsx)(Ea,{}),(0,U.jsxs)(ba,{ref:r,className:F(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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 sm:rounded-lg`,e),...n,children:[t,(0,U.jsxs)(Ca,{className:`absolute right-4 top-4 roun
46ded-sm opacity-70 ring-offset-background cursor-pointer transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground`,children:[(0,U.jsx)(p,{className:`h-4 w-4`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));Da.displayName=ba.displayName;var Oa=({className:e,...t})=>(0,U.jsx)(`div`,{className:F(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t});Oa.displayName=`DialogHeader`;var ka=({className:e,...t})=>(0,U.jsx)(`div`,{className:F(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});ka.displayName=`DialogFooter`;var Aa=V.forwardRef(({className:e,...t},n)=>(0,U.jsx)(xa,{ref:n,className:F(`text-lg font-semibold leading-none tracking-tight`,e),...t}));Aa.displayName=xa.displayName;var ja=V.forwardRef(({className:e,...t},n)=>(0,U.jsx)(Sa,{ref:n,className:F(`text-sm text-muted-foreground`,e),...t}));ja.displayName=Sa.displayName;function Ma(e){let t=(e%24+24)%24;return t===0?`12 AM`:t===12?`12 PM`:t<12?`${t} AM`:`${t-12} PM`}function Na(e){return`${Ma(e)}â${Ma(e+1)}`}var Pa=(0,V.createContext)(null),Fa=`pl.activeStoreId.v1`;function Ia({children:e}){let t=z(Ze),n=R({queryKey:[`stores`],queryFn:()=>t({data:{}})}),r=n.data??[],[i,a]=(0,V.useState)(()=>typeof window>`u`?`all`:window.localStorage.getItem(Fa)||`all`);(0,V.useEffect)(()=>{typeof window<`u`&&window.localStorage.setItem(Fa,i)},[i]),(0,V.useEffect)(()=>{i!==`all`&&r.length&&!r.find(e=>e.id===i)&&a(`all`)},[r,i]);let o=(0,V.useMemo)(()=>i===`all`?null:r.find(e=>e.id===i)??null,[r,i]),s={stores:r,loading:n.isLoading,activeStoreId:i,setActiveStoreId:a,activeStore:o,refetch:()=>{n.refetch()}};return(0,U.jsx)(Pa.Provider,{value:s,children:e})}function La(){let e=(0,V.useContext)(Pa);if(!e)throw Error(`useStores must be used inside <StoreProvider>`);return e}function Ra(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0||1}function za(e,t){if(e&&e!==`all`&&t){let e={whatnot:.05,tiktok_live:.05,facebook_live:.05,other:.05};return e[t]=.85,e}if(!e||e===`all`)return{whatnot:.58,tiktok_live:.22,facebook_live:.14,other:.06};let n=Ra(e),r=.4+n%40/100,i=.15+(n>>3)%25/100,a=.05+(n>>7)%15/100,o=r+i+a;return{whatnot:r,tiktok_live:i,facebook_live:a,other:Math.max(0,1-o)}}function Ba(){return(Ba=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function Va(e,t){if(e==null)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(n=a[r])>=0||(i[n]=e[n]);return i}function Ha(e){var t=(0,V.useRef)(e),n=(0,V.useRef)(function(e){t.current&&t.current(e)});return t.current=e,n.current}var Ua=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e<t?t:e},Wa=function(e){return`touches`in e},Ga=function(e){return e&&e.ownerDocument.defaultView||self},Ka=function(e,t,n){var r=e.getBoundingClientRect(),i=Wa(t)?function(e,t){for(var n=0;n<e.length;n++)if(e[n].identifier===t)return e[n];return e[0]}(t.touches,n):t;return{left:Ua((i.pageX-(r.left+Ga(e).pageXOffset))/r.width),top:Ua((i.pageY-(r.top+Ga(e).pageYOffset))/r.height)}},qa=function(e){!Wa(e)&&e.preventDefault()},Ja=V.memo(function(e){var t=e.onMove,n=e.onKey,r=e.onEnd,i=Va(e,[`onMove`,`onKey`,`onEnd`]),a=(0,V.useRef)(null),o=Ha(t),s=Ha(n),c=Ha(r),l=(0,V.useRef)(null),u=(0,V.useRef)(!1),d=(0,V.useMemo)(function(){var e=function(e){qa(e),(Wa(e)?e.touches.length>0:e.buttons>0)&&a.current?o(Ka(a.current,e,l.current)):(n(!1),c())},t=function(){n(!1),c()};function n(n){var r=u.current,i=Ga(a.current),o=n?i.addEventListener:i.removeEventListener;o(r?`touchmove`:`mousemove`,e),o(r?`touchend`:`mouseup`,t)}return[function(e){var t=e.nativeEvent,r=a.current;if(r&&(qa(t),!function(e,t){return t&&!Wa(e)}(t,u.current)&&r)){if(Wa(t)){u.current=!0;var i=t.changedTouches||[];i.length&&(l.current=i[0].identifier)}r.focus(),o(Ka(r,t,l.current)),n(!0)}},function(e){var t=e.which||e.keyCode;t<37||t>40||(e.preventDefault(),s({left:t===39?.05:t===37?-.05:0,top:t===40?.05:t===38?-.05:0}))},function(e){var t=e.which||e.keyCode;t>=37&&t<=40&&c()},n]},[s,o,c]),f=d[0],p=d[1],m=d[2],h=d[3];return(0,V.useEffect)(function(){return h},[h]),V.createElement(`div`,Ba({},i,{onTouchStart:f,onMouseDown:f,className:`react-colorful__interactive`,ref:a,onKeyDown:p,onKeyUp:m,tabIndex:0,role:`slider`}))}),Ya=function(e){return e.filter(Boolean).join(` `)},Xa=function(e){var t=e.color,n=e.left,r=e.top,i=r===void 0?.5:r,a=Ya([`react-colorful__pointer`,e.className]);
46return V.createElement(`div`,{className:a,style:{top:100*i+`%`,left:100*n+`%`}},V.createElement(`div`,{className:`react-colorful__pointer-fill`,style:{backgroundColor:t}}))},K=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=10**t),Math.round(n*e)/n};360/(2*Math.PI);var Za=function(e){return ao(Qa(e))},Qa=function(e){return e[0]===`#`&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?K(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:e.length===8?K(parseInt(e.substring(6,8),16)/255,2):1}},$a=function(e){return io(no(e))},eo=function(e){var t=e.s,n=e.v,r=e.a,i=(200-t)*n/100;return{h:K(e.h),s:K(i>0&&i<200?t*n/100/(i<=100?i:200-i)*100:0),l:K(i/2),a:K(r,2)}},to=function(e){var t=eo(e);return`hsl(`+t.h+`, `+t.s+`%, `+t.l+`%)`},no=function(e){var t=e.h,n=e.s,r=e.v,i=e.a;t=t/360*6,n/=100,r/=100;var a=Math.floor(t),o=r*(1-n),s=r*(1-(t-a)*n),c=r*(1-(1-t+a)*n),l=a%6;return{r:K(255*[r,s,o,o,c,r][l]),g:K(255*[c,r,r,s,o,o][l]),b:K(255*[o,o,c,r,r,s][l]),a:K(i,2)}},ro=function(e){var t=e.toString(16);return t.length<2?`0`+t:t},io=function(e){var t=e.r,n=e.g,r=e.b,i=e.a,a=i<1?ro(K(255*i)):``;return`#`+ro(t)+ro(n)+ro(r)+a},ao=function(e){var t=e.r,n=e.g,r=e.b,i=e.a,a=Math.max(t,n,r),o=a-Math.min(t,n,r),s=o?a===t?(n-r)/o:a===n?2+(r-t)/o:4+(t-n)/o:0;return{h:K(60*(s<0?s+6:s)),s:K(a?o/a*100:0),v:K(a/255*100),a:i}},oo=V.memo(function(e){var t=e.hue,n=e.onChange,r=e.onChangeEnd,i=Ya([`react-colorful__hue`,e.className]);return V.createElement(`div`,{className:i},V.createElement(Ja,{onMove:function(e){n({h:360*e.left})},onKey:function(e){n({h:Ua(t+360*e.left,0,360)})},onEnd:r,"aria-label":`Hue`,"aria-valuenow":K(t),"aria-valuemax":`360`,"aria-valuemin":`0`},V.createElement(Xa,{className:`react-colorful__hue-pointer`,left:t/360,color:to({h:t,s:100,v:100,a:1})})))}),so=V.memo(function(e){var t=e.hsva,n=e.onChange,r=e.onChangeEnd,i={backgroundColor:to({h:t.h,s:100,v:100,a:1})};return V.createElement(`div`,{className:`react-colorful__saturation`,style:i},V.createElement(Ja,{onMove:function(e){n({s:100*e.left,v:100-100*e.top})},onKey:function(e){n({s:Ua(t.s+100*e.left,0,100),v:Ua(t.v-100*e.top,0,100)})},onEnd:r,"aria-label":`Color`,"aria-valuetext":`Saturation `+K(t.s)+`%, Brightness `+K(t.v)+`%`},V.createElement(Xa,{className:`react-colorful__saturation-pointer`,top:1-t.v/100,left:t.s/100,color:to(t)})))}),co=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0},lo=function(e,t){return e.toLowerCase()===t.toLowerCase()||co(Qa(e),Qa(t))};function uo(e,t,n,r){var i=Ha(n),a=Ha(r),o=(0,V.useState)(function(){return e.toHsva(t)}),s=o[0],c=o[1],l=(0,V.useRef)({color:t,hsva:s}),u=(0,V.useRef)(!1);return(0,V.useEffect)(function(){if(!e.equal(t,l.current.color)){var n=e.toHsva(t);l.current={hsva:n,color:t},c(n),u.current=!1}},[t,e]),(0,V.useEffect)(function(){var t;co(s,l.current.hsva)||e.equal(t=e.fromHsva(s),l.current.color)||(l.current={hsva:s,color:t},i(t),u.current=!0)},[s,e,i]),[s,(0,V.useCallback)(function(e){c(function(t){return Object.assign({},t,e)})},[]),(0,V.useCallback)(function(){u.current&&(u.current=!1,a(l.current.color))},[a])]}var fo,po=typeof window<`u`?V.useLayoutEffect:V.useEffect,mo=function(){return fo||(typeof __webpack_nonce__<`u`?__webpack_nonce__:void 0)},ho=new Map,go=function(e){po(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!ho.has(t)){var n=t.createElement(`style`);n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;
46left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,ho.set(t,n);var r=mo();r&&n.setAttribute(`nonce`,r),t.head.appendChild(n)}},[])},_o=function(e){var t=e.className,n=e.colorModel,r=e.color,i=r===void 0?n.defaultColor:r,a=e.onChange,o=e.onChangeEnd,s=Va(e,[`className`,`colorModel`,`color`,`onChange`,`onChangeEnd`]),c=(0,V.useRef)(null);go(c);var l=uo(n,i,a,o),u=l[0],d=l[1],f=l[2],p=Ya([`react-colorful`,t]);return V.createElement(`div`,Ba({},s,{ref:c,className:p}),V.createElement(so,{hsva:u,onChange:d,onChangeEnd:f}),V.createElement(oo,{hue:u.h,onChange:d,onChangeEnd:f,className:`react-colorful__last-control`}))},vo={defaultColor:`000`,toHsva:Za,fromHsva:function(e){return $a({h:e.h,s:e.s,v:e.v,a:1})},equal:lo},yo=function(e){return V.createElement(_o,Ba({},e,{colorModel:vo}))},bo=[`top`,`right`,`bottom`,`left`],xo=Math.min,q=Math.max,So=Math.round,Co=Math.floor,wo=e=>({x:e,y:e}),To={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Eo(e,t,n){return q(e,xo(t,n))}function Do(e,t){return typeof e==`function`?e(t):e}function Oo(e){return e.split(`-`)[0]}function ko(e){return e.split(`-`)[1]}function Ao(e){return e===`x`?`y`:`x`}function jo(e){return e===`y`?`height`:`width`}function Mo(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function No(e){return Ao(Mo(e))}function Po(e,t,n){n===void 0&&(n=!1);let r=ko(e),i=No(e),a=jo(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Uo(o)),[o,Uo(o)]}function Fo(e){let t=Uo(e);return[Io(e),t,Io(t)]}function Io(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Lo=[`left`,`right`],Ro=[`right`,`left`],zo=[`top`,`bottom`],Bo=[`bottom`,`top`];function Vo(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Ro:Lo:t?Lo:Ro;case`left`:case`right`:return t?zo:Bo;default:return[]}}function Ho(e,t,n,r){let i=ko(e),a=Vo(Oo(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Io)))),a}function Uo(e){let t=Oo(e);return To[t]+e.slice(t.length)}function Wo(e){return{top:0,right:0,bottom:0,left:0,...e}}function Go(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Wo(e)}function Ko(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function qo(e,t,n){let{reference:r,floating:i}=e,a=Mo(t),o=No(t),s=jo(o),c=Oo(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(ko(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function Jo(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=Do(t,e),p=Go(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Ko(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Ko(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left
vendor: 8,550 bytes, line 46
46:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Yo=50,Xo=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Jo},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=qo(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Yo&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=qo(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Zo=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=Do(e,t)||{};if(l==null)return{};let d=Go(u),f={x:n,y:r},p=No(i),m=jo(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=xo(d[_],T),D=xo(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=Eo(O,A,k),M=!c.arrow&&ko(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,N=M?A<O?A-O:A-k:0;return{[p]:f[p]+N,data:{[p]:j,centerOffset:A-j-N,...M&&{alignmentOffset:N}},reset:M}}}),Qo=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=Do(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Oo(r),_=Mo(o),v=Oo(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Uo(o)]:Fo(o)),x=p!==`none`;!d&&x&&b.push(...Ho(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Po(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==Mo(t))||T.every(e=>Mo(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Mo(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function $o(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function es(e){return bo.some(t=>e[t]>=0)}var ts=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Do(e,t);switch(i){case`referenceHidden`:{let e=$o(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:es(e)}}}case`escaped`:{let e=$o(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:es(e)}}}default:return{}}}}},ns=new Set([`left`,`top`]);async function rs(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Oo(n),s=ko(n),c=Mo(n)===`y`,l=ns.has(o)?-1:1,u=a&&c?-1:1,d=Do(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var is=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await rs(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},as=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Do(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Mo(Oo(i)),p=Ao(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=Eo(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=Eo(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},os=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Do(e,t),u={x:n,y:r},d=Mo(i),f=Ao(d),p=u[f],m=u[d],h=Do(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=ns.has(Oo(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},ss=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=Do(e,t),u=await o.detectOverflow(t,l),d=Oo(i),f=ko(i),p=Mo(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=xo(h-u[g],v),x=xo(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=q(u.left,0),t=q(u.right,0),n=q(u.top,0),r=q(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:q(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:q(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function cs(){return typeof window<`u`}function ls(e){return ds(e)?(e.nodeName||``).toLowerCase():`#document`}function J(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function us(e){return((ds(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function ds(e){return cs()?e instanceof Node||e instanceof J(e).Node:!1}function Y(e){return cs()?e instanceof Element||e instanceof J(e).Element:!1}function fs(e){return cs()?e instanceof HTMLElement||e instanceof J(e).HTMLElement:!1}function ps(e){return!cs()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof J(e).ShadowRoot}function ms(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Ts(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function hs(e){return/^(table|td|th)$/.test(ls(e))}function gs(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var _s=/transform|translate|scale|rotate|perspective|filter/,vs=/paint|layout|strict|content/,ys=e=>!!e&&e!==`none`,bs;function xs(e){let t=Y(e)?Ts(e):e;return ys(t.transform)||ys(t.translate)||ys(t.scale)||ys(t.rotate)||ys(t.perspective)||!Cs()&&(ys(t.backdropFilter)||ys(t.filter))||_s.test(t.willChange||``)||vs.test(t.contain||``)}function Ss(e){let t=Ds(e);for(;fs(t)&&!ws(t);){if(xs(t))return t;if(gs(t))return null;t=Ds(t)}return null}function Cs(){return bs??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),bs}function ws(e){return/^(html|body|#document)$/.test(ls(e))}function Ts(e){return J(e).getComputedStyle(e)}function Es(e){return Y(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ds(e){if(ls(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||ps(e)&&e.host||us(e);return ps(t)?t.host:t}function Os(e){let t=Ds(e);return ws(t)?e.ownerDocument?e.ownerDocument.body:e.body:fs(t)&&ms(t)?t:Os(t)}function ks(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Os(e),i=r===e.ownerDocument?.body,a=J(r);
vendor: 6,482 bytes, line 46
46if(i){let e=As(a);return t.concat(a,a.visualViewport||[],ms(r)?r:[],e&&n?ks(e):[])}else return t.concat(r,ks(r,[],n))}function As(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function js(e){let t=Ts(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=fs(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=So(n)!==a||So(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Ms(e){return Y(e)?e:e.contextElement}function Ns(e){let t=Ms(e);if(!fs(t))return wo(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=js(t),o=(a?So(n.width):n.width)/r,s=(a?So(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Ps=wo(0);function Fs(e){let t=J(e);return!Cs()||!t.visualViewport?Ps:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Is(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==J(e)?!1:t}function Ls(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Ms(e),o=wo(1);t&&(r?Y(r)&&(o=Ns(r)):o=Ns(e));let s=Is(a,n,r)?Fs(a):wo(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=J(a),t=r&&Y(r)?J(r):r,n=e,i=As(n);for(;i&&r&&t!==n;){let e=Ns(i),t=i.getBoundingClientRect(),r=Ts(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=J(i),i=As(n)}}return Ko({width:u,height:d,x:c,y:l})}function Rs(e,t){let n=Es(e).scrollLeft;return t?t.left+n:Ls(us(e)).left+n}function zs(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Rs(e,n),y:n.top+t.scrollTop}}function Bs(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=us(r),s=t?gs(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=wo(1),u=wo(0),d=fs(r);if((d||!d&&!a)&&((ls(r)!==`body`||ms(o))&&(c=Es(r)),d)){let e=Ls(r);l=Ns(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?zs(o,c):wo(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Vs(e){return Array.from(e.getClientRects())}function Hs(e){let t=us(e),n=Es(e),r=e.ownerDocument.body,i=q(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=q(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Rs(e),s=-n.scrollTop;return Ts(r).direction===`rtl`&&(o+=q(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Us=25;function Ws(e,t){let n=J(e),r=us(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Cs();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Rs(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=Us&&(a-=o)}else l<=Us&&(a+=l);return{width:a,height:o,x:s,y:c}}function Gs(e,t){let n=Ls(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=fs(e)?Ns(e):wo(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Ks(e,t,n){let r;if(t===`viewport`)r=Ws(e,n);else if(t===`document`)r=Hs(us(e));else if(Y(t))r=Gs(t,n);else{let n=Fs(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Ko(r)}function qs(e,t){let n=Ds(e);return n===t||!Y(n)||ws(n)?!1:Ts(n).position===`fixed`||qs(n,t)}function Js(e,t){let n=t.get(e);if(n)return n;let r=ks(e,[],!1).filter(e=>Y(e)&&ls(e)!==`body`),i=null,a=Ts(e).position===`fixed`,o=a?Ds(e):e;for(;Y(o)&&!ws(o);){let t=Ts(o),n=xs(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||ms(o)&&!n&&qs(e,o))?r=r.filter(e=>e!==o):i=t,o=Ds(o)}return t.set(e,r),r}function Ys(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?gs(t)?[]:Js(t,this._c):[].concat(n),r],o=Ks(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Ks(t,a[e],i);s=q(n.top,s),c=xo(n.right,c),l=xo(n.bottom,l),u=q(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Xs(e){let{width:t,height:n}=js(e);return{width:t,height:n}}function Zs(e,t,n){let r=fs(t),i=us(t),a=n===`fixed`,o=Ls(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=wo(0);function l(){c.x=Rs(i)}if(r||!r&&!a)if((ls(t)!==`body`||ms(i))&&(s=Es(t)),r){let e=Ls(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?zs(i,s):wo(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function Qs(e){return Ts(e).position===`static`}function $s(e,t){if(!fs(e)||Ts(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return us(e)===n&&(n=n.ownerDocument.body),n}function ec(e,t){let n=J(e);if(gs(e))return n;if(!fs(e)){let t=Ds(e);for(;t&&!ws(t);){if(Y(t)&&!Qs(t))return t;t=Ds(t)}return n}let r=$s(e,t);for(;r&&hs(r)&&Qs(r);)r=$s(r,t);return r&&ws(r)&&Qs(r)&&!xs(r)?n:r||Ss(e)||n}var tc=async function(e){let t=this.getOffsetParent||ec,n=this.getDimensions,r=await n(e.floating);return{reference:Zs(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function nc(e){return Ts(e).direction===`rtl`}var rc={convertOffsetParentRelativeRectToViewportRelativeRect:Bs,getDocumentElement:us,getClippingRect:Ys,getOffsetParent:ec,getElementRects:tc,getClientRects:Vs,getDimensions:Xs,getScale:Ns,isElement:Y,isRTL:nc};function ic(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ac(e,t){let n=null,r,i=us(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=Co(d),h=Co(i.clientWidth-(u+f)),g=Co(i.clientHeight-(d+p)),_=Co(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:q(0,xo(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!ic(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function oc(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Ms(e),u=i||a?[...l?ks(l):[],...t?ks(t):[]]:[];
vendor: 8,600 bytes, line 46
46u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?ac(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Ls(e):null;c&&g();function g(){let t=Ls(e);h&&!ic(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var sc=is,cc=as,lc=Qo,uc=ss,dc=ts,fc=Zo,pc=os,mc=(e,t,n)=>{let r=new Map,i={platform:rc,...n},a={...i.platform,_c:r};return Xo(e,t,{...i,platform:a})},hc=typeof document<`u`?V.useLayoutEffect:function(){};function gc(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!gc(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!gc(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function _c(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function vc(e,t){let n=_c(e);return Math.round(t*n)/n}function yc(e){let t=V.useRef(e);return hc(()=>{t.current=e}),t}function bc(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=V.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=V.useState(r);gc(f,r)||p(r);let[m,h]=V.useState(null),[g,_]=V.useState(null),v=V.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=V.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=V.useRef(null),C=V.useRef(null),w=V.useRef(u),T=c!=null,E=yc(c),D=yc(i),O=yc(l),k=V.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),mc(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!gc(w.current,t)&&(w.current=t,Nt.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);hc(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=V.useRef(!1);hc(()=>(A.current=!0,()=>{A.current=!1}),[]),hc(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=V.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=V.useMemo(()=>({reference:b,floating:x}),[b,x]),N=V.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=vc(M.floating,u.x),r=vc(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,..._c(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return V.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var xc=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:fc({element:r.current,padding:i}).fn(n):r?fc({element:r,padding:i}).fn(n):{}}}},Sc=(e,t)=>{let n=sc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Cc=(e,t)=>{let n=cc(e);return{name:n.name,fn:n.fn,options:[e,t]}},wc=(e,t)=>({fn:pc(e).fn,options:[e,t]}),Tc=(e,t)=>{let n=lc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ec=(e,t)=>{let n=uc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Dc=(e,t)=>{let n=dc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Oc=(e,t)=>{let n=xc(e);return{name:n.name,fn:n.fn,options:[e,t]}},kc=`Arrow`,Ac=V.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,U.jsx)(G.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,U.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Ac.displayName=kc;var jc=Ac;function Mc(e){let[t,n]=V.useState(void 0);return mn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var Nc=`Popper`,[Pc,Fc]=fn(Nc),[Ic,Lc]=Pc(Nc),Rc=e=>{let{__scopePopper:t,children:n}=e,[r,i]=V.useState(null);return(0,U.jsx)(Ic,{scope:t,anchor:r,onAnchorChange:i,children:n})};Rc.displayName=Nc;var zc=`PopperAnchor`,Bc=V.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=Lc(zc,n),o=V.useRef(null),s=L(t,o),c=V.useRef(null);return V.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,U.jsx)(G.div,{...i,ref:s})});Bc.displayName=zc;var Vc=`PopperContent`,[Hc,Uc]=Pc(Vc),Wc=V.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=Lc(Vc,n),[_,v]=V.useState(null),y=L(t,e=>v(e)),[b,x]=V.useState(null),S=Mc(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],O=D.length>0,k={padding:E,boundary:D.filter(Jc),altBoundary:O},{refs:A,floatingStyles:j,placement:M,isPositioned:N,middlewareData:ee}=bc({strategy:`fixed`,placement:T,whileElementsMounted:(...e)=>oc(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[Sc({mainAxis:i+w,alignmentAxis:o}),c&&Cc({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?wc():void 0,...k}),c&&Tc({...k}),Ec({...k,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),b&&Oc({element:b,padding:s}),Yc({arrowWidth:C,arrowHeight:w}),f&&Dc({strategy:`referenceHidden`,...k})]}),[te,ne]=Xc(M),re=kn(m);mn(()=>{N&&re?.()},[N,re]);let ie=ee.arrow?.x,ae=ee.arrow?.y,oe=ee.arrow?.centerOffset!==0,[P,se]=V.useState();return mn(()=>{_&&se(window.getComputedStyle(_).zIndex)},[_]),(0,U.jsx)(`div`,{ref:A.setFloating,"data-radix-popper-content-wrapper":``,style:{...j,transform:N?j.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:P,"--radix-popper-transform-origin":[ee.transformOrigin?.x,ee.transformOrigin?.y].join(` `),...ee.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,U.jsx)(Hc,{scope:n,placedSide:te,onArrowChange:x,arrowX:ie,arrowY:ae,shouldHideArrow:oe,children:(0,U.jsx)(G.div,{"data-side":te,"data-align":ne,...h,ref:y,style:{...h.style,animation:N?void 0:`none`}})})})});Wc.displayName=Vc;var Gc=`PopperArrow`,Kc={top:`bottom`,right:`left`,bottom:`top`,left:`right`},qc=V.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Uc(Gc,n),a=Kc[i.placedSide];return(0,U.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,U.jsx)(jc,{...r,ref:t,style:{...r.style,display:`block`}})})});qc.displayName=Gc;function Jc(e){return e!==null}var Yc=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Xc(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function Xc(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var Zc=Rc,Qc=Bc,$c=Wc,el=qc;
vendor: 4,421 bytes, line 46
46function tl(e){let t=nl(e),n=V.forwardRef((e,n)=>{let{children:r,...i}=e,a=V.Children.toArray(r),o=a.find(il);if(o){let e=o.props.children,r=a.map(t=>t===o?V.Children.count(e)>1?V.Children.only(null):V.isValidElement(e)?e.props.children:null:t);return(0,U.jsx)(t,{...i,ref:n,children:V.isValidElement(e)?V.cloneElement(e,void 0,r):null})}return(0,U.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function nl(e){let t=V.forwardRef((e,t)=>{let{children:n,...r}=e;if(V.isValidElement(n)){let e=ol(n),i=al(r,n.props);return n.type!==V.Fragment&&(i.ref=t?pe(t,e):e),V.cloneElement(n,i)}return V.Children.count(n)>1?V.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var rl=Symbol(`radix.slottable`);function il(e){return V.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===rl}function al(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function ol(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var sl=`Popover`,[cl,ll]=fn(sl,[Fc]),ul=Fc(),[dl,fl]=cl(sl),pl=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=ul(t),c=V.useRef(null),[l,u]=V.useState(!1),[d,f]=yn({prop:r,defaultProp:i??!1,onChange:a,caller:sl});return(0,U.jsx)(Zc,{...s,children:(0,U.jsx)(dl,{scope:t,contentId:_n(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:V.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:V.useCallback(()=>u(!0),[]),onCustomAnchorRemove:V.useCallback(()=>u(!1),[]),modal:o,children:n})})};pl.displayName=sl;var ml=`PopoverAnchor`,hl=V.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=fl(ml,n),a=ul(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return V.useEffect(()=>(o(),()=>s()),[o,s]),(0,U.jsx)(Qc,{...a,...r,ref:t})});hl.displayName=ml;var gl=`PopoverTrigger`,_l=V.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=fl(gl,n),a=ul(n),o=L(t,i.triggerRef),s=(0,U.jsx)(G.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Ml(i.open),...r,ref:o,onClick:W(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,U.jsx)(Qc,{asChild:!0,...a,children:s})});_l.displayName=gl;var vl=`PopoverPortal`,[yl,bl]=cl(vl,{forceMount:void 0}),xl=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=fl(vl,t);return(0,U.jsx)(yl,{scope:t,forceMount:n,children:(0,U.jsx)(lr,{present:n||a.open,children:(0,U.jsx)(sr,{asChild:!0,container:i,children:r})})})};xl.displayName=vl;var Sl=`PopoverContent`,Cl=V.forwardRef((e,t)=>{let n=bl(Sl,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=fl(Sl,e.__scopePopover);return(0,U.jsx)(lr,{present:r||a.open,children:a.modal?(0,U.jsx)(Tl,{...i,ref:t}):(0,U.jsx)(El,{...i,ref:t})})});Cl.displayName=Sl;var wl=tl(`PopoverContent.RemoveScroll`),Tl=V.forwardRef((e,t)=>{let n=fl(Sl,e.__scopePopover),r=V.useRef(null),i=L(t,r),a=V.useRef(!1);return V.useEffect(()=>{let e=r.current;if(e)return Ai(e)},[]),(0,U.jsx)(xi,{as:wl,allowPinchZoom:!0,children:(0,U.jsx)(Dl,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:W(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:W(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:W(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),El=V.forwardRef((e,t)=>{let n=fl(Sl,e.__scopePopover),r=V.useRef(!1),i=V.useRef(!1);return(0,U.jsx)(Dl,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),Dl=V.forwardRef((e,t)=>
46{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=fl(Sl,n),p=ul(n);return mr(),(0,U.jsx)(Jn,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,U.jsx)(Ln,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,U.jsx)($c,{"data-state":Ml(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),Ol=`PopoverClose`,kl=V.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=fl(Ol,n);return(0,U.jsx)(G.button,{type:`button`,...r,ref:t,onClick:W(e.onClick,()=>i.onOpenChange(!1))})});kl.displayName=Ol;var Al=`PopoverArrow`,jl=V.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=ul(n);return(0,U.jsx)(el,{...i,...r,ref:t})});jl.displayName=Al;function Ml(e){return e?`open`:`closed`}var Nl=pl,Pl=_l,Fl=xl,Il=Cl,Ll=Nl,Rl=Pl,zl=V.forwardRef(({className:e,align:t=`center`,sideOffset:n=4,...r},i)=>(0,U.jsx)(Fl,{children:(0,U.jsx)(Il,{ref:i,align:t,sideOffset:n,className:F(`z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-popover-content-transform-origin)`,e),...r})}));zl.displayName=Il.displayName;var X=`#2f6fb2`,Bl=`#244f80`,Z=`#eaf3fb`,Vl=`#5a8a2a`,Hl=`#f7f8ef`,Q=`#dfe5d2`,Ul=e=>{let t=(e||``).trim().toLowerCase();if([`#d98c3c`,`#9c6b2f`,`#e88a2f`,`#e89435`,`#df8f35`,`#d9822b`].includes(t))return!0;let n=t.match(/^#?([0-9a-f]{6})$/)?.[1];if(!n)return!1;let r=parseInt(n.slice(0,2),16),i=parseInt(n.slice(2,4),16),a=parseInt(n.slice(4,6),16);return r>=145&&i>=75&&i<=170&&a<=95&&r>i&&i>a},Wl=e=>({...e,theme_color:Ul(e.theme_color)?X:e.theme_color,accent_color:Ul(e.accent_color)?X:e.accent_color,background_color:[`#faf7f0`,`#fff4e5`].includes((e.background_color||``).toLowerCase())?`#f6f8f1`:e.background_color,secondary_color:[`#f0ebd9`,`#f5d7aa`].includes((e.secondary_color||``).toLowerCase())?`#dbe9f6`:e.secondary_color,text_color:[`#1d1c18`,`#1a1814`,`#111111`].includes((e.text_color||``).toLowerCase())?`#243047`:e.text_color});function Gl(){let[e,t]=(0,V.useState)(null),[n,r]=(0,V.useState)(null);return(0,V.useEffect)(()=>{(async()=>{let{data:e}=await s.auth.getUser();if(!e.user)return;r(e.user.id);let{data:n}=await s.from(`profiles`).select(`marketing_addon`).eq(`id`,e.user.id).maybeSingle();n?.marketing_addon||await s.from(`profiles`).update({marketing_addon:!0}).eq(`id`,e.user.id),t(!0)})()},[]),e===null?(0,U.jsx)(`div`,{className:`card`,style:{color:`var(--pl-muted)`},children:`Loadingâ¦`}):e?n?(0,U.jsx)($l,{userId:n,onDisable:async()=>{n&&confirm(`Turn off the Marketing add-on? Your page stays saved but goes offline.`)&&(await s.from(`profiles`).update({marketing_addon:!1}).eq(`id`,n),t(!1))}}):null:(0,U.jsx)(Kl,{onEnable:async()=>{n&&(await s.from(`profiles`).update({marketing_addon:!0}).eq(`id`,n),t(!0))}})}function Kl({onEnable:e}){return(0,U.jsxs)(`div`,{className:`stack`,style:{gap:32},children:[(0,U.jsxs)(`div`,{className:`card`,style:{padding:36,background:`linear-gradient(135deg, ${Z} 0%, #ffffff 52%, #edf6e8 100%)`,borderLeft:`4px solid ${X}`,position:`relative`,overflow:`hidden`},children:[(0,U.jsx)(`div`,{style:{position:`absolute`,top:-40,right:-40,fontSize:220,opacity:.06},children:`ð£`}),(0,U.jsxs)(`div`,{className:`row`,style:{gap:8,alignItems:`center`,marginBottom:14},children:[(0,U.jsx)(`span`,{style:{fontSize:11,fontWeight:700,letterSpacing:1.5,color:X,textTransform:`uppercase`},children:`PearShow Marketing · Add-on`}),(0,U.jsx)(`span`,{style:{fontSize:11,padding:`2px 8px`,borderRadius:999,background:Z,color:X},children:`New`})]}),(0,U.jsxs)(`h1`,{style:{margin:0,fontSize:38,lineHeight:1.1,maxWidth:720},children:[`Stop renting your audience. `,(0,U.jsx)(`span`,{style:{color:X},children:`Own it.`})]}),(0,U.jsxs)(`p`,{style:{fontSize:16,color:`var(--pl-muted)`,marginTop:14,maxWidth:680,lineHeight:1.55},children:[`Whatnot, TikTok, Facebook â none of them let you message your buyers in bulk. The instant the show ends, your audience is `,(0,U.jsx)(`em`,{children:`theirs`}),`, not yours. PearShow Marketing flips that. Every box you ship becomes a signup card. Every buyer becomes a fan you can actually reach.`]}),(0,U.jsxs)(`div`,{className:`row`,style:{gap:12,marginTop:22,alignItems:`center`,flexWrap:`wrap`},children:[(0,U.jsxs)(`button`,{className:`primary`,style:{padding:`12px 22px`,fontSize:14,fontWeight:700,boxShadow:`0 8px 24px rgba(47,111,178,0.26)`},onClick:e,children:[(0,U.jsx)(ge,{size:14}),` Enable for $4.99 / month`]}),(0,U.jsx)(`div`,{style:{fontSize:12,color:`var(--pl-muted)`},children:`Add-on to your $19.99 plan · cancel anytime · keeps your data if you turn it off`})]})]}),(0,U.jsxs)(`div`,{className:`grid`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(300px, 1fr))`,gap:22},children:[(0,U.jsx)(ql,{icon:`ðªª`,eyebrow:`Your storefront`,title:`A page that follows you everywhere`,body:`pearshow.com/p/your-handle. Bio, schedule, links to every platform you sell on. Printed on every label that leaves your warehouse.`,example:(0,U.jsx)(Jl,{children:(0,U.jsxs)(`div`,{style:{padding:12},children:[(0,U.jsxs)(`div`,{style:{display:`flex`,gap:10,alignItems:`center`},children:[(0,U.jsx)(`div`,{style:{width:38,height:38,borderRadius:`50%`,background:`linear-gradient(135deg,${X},${Vl})`}}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{style:{fontWeight:700,fontSize:13},children:`@vintage_vault`}
46),(0,U.jsx)(`div`,{style:{fontSize:10,color:`var(--pl-muted)`},children:`Sports cards · Live Thu/Sun 7pm`})]})]}),(0,U.jsx)(`div`,{style:{marginTop:10,padding:8,borderRadius:6,background:Z,fontSize:11},children:`ð Sign up â your next order ships with a free hit`})]})})}),(0,U.jsx)(ql,{icon:`ð¬`,eyebrow:`The list you own`,title:`Emails & phones, captured in 10 seconds`,body:`Buyers scan the QR on their box, drop their email, and you've got them forever. No algorithm, no platform between you.`,example:(0,U.jsx)(Yl,{rows:[{name:`Marcus T.`,tag:`via QR · Whatnot`,days:`2d ago`},{name:`Jenna R.`,tag:`via QR · TikTok`,days:`5d ago`},{name:`Devon K.`,tag:`manual · in-show`,days:`1w ago`}]})}),(0,U.jsx)(ql,{icon:`ð`,eyebrow:`The hook`,title:`âNext order gets a free giftâ`,body:`Set an offer once. When a signed-up fan buys again, PearShow flags the label, prints a gift slip, and tracks redemption. They feel seen â you get repeat buyers.`,example:(0,U.jsxs)(`div`,{style:{border:`2px dashed ${X}`,borderRadius:8,padding:14,background:Z,fontSize:12},children:[(0,U.jsx)(`div`,{style:{fontWeight:800,color:X,marginBottom:4},children:`ð GIFT EARNED`}),(0,U.jsx)(`div`,{style:{fontWeight:700},children:`Marcus T. · Box #14`}),(0,U.jsx)(`div`,{style:{color:`var(--pl-muted)`,marginTop:2},children:`Add: 1à Mystery Pack`})]})}),(0,U.jsx)(ql,{icon:`ð£`,eyebrow:`The megaphone`,title:`Broadcast tools, plugged into your data`,body:`Promo packs, win-back campaigns for cold buyers, an AI content calendar built from your best-selling nights. Press send. Done.`,example:(0,U.jsxs)(`div`,{className:`stack`,style:{gap:6,fontSize:11},children:[(0,U.jsxs)(`div`,{style:{padding:8,background:Z,borderRadius:6},children:[(0,U.jsx)(`strong`,{children:`Mon 6pm`}),` · Tease tonight's grail card on IG story`]}),(0,U.jsxs)(`div`,{style:{padding:8,background:Z,borderRadius:6},children:[(0,U.jsx)(`strong`,{children:`Thu`}),` · Email 42 cold buyers · âWe miss youâ + 10% code`]}),(0,U.jsxs)(`div`,{style:{padding:8,background:Z,borderRadius:6},children:[(0,U.jsx)(`strong`,{children:`Sun 5pm`}),` · SMS 128 fans â show starts in 2hr`]})]})})]}),(0,U.jsxs)(`div`,{className:`card`,style:{padding:28},children:[(0,U.jsx)(`div`,{style:{fontSize:11,fontWeight:700,letterSpacing:1.5,color:X,textTransform:`uppercase`,marginBottom:8},children:`How it works`}),(0,U.jsx)(`h2`,{style:{margin:`0 0 22px 0`},children:`Three steps. One add-on. Forever-yours audience.`}),(0,U.jsxs)(`div`,{className:`grid`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(220px,1fr))`,gap:20},children:[(0,U.jsx)(Xl,{n:1,title:`Build your page`,body:`Pick a handle, drop a photo, list your show times. Live in under two minutes.`}),(0,U.jsx)(Xl,{n:2,title:`Print it on every box`,body:`QR code auto-prints on every shipping label. Buyers scan, sign up, opt in for a gift.`}),(0,U.jsx)(Xl,{n:3,title:`Own your fan list`,body:`Export anytime to CSV. Bring your own email or SMS tool â native sending is on the roadmap.`})]})]}),(0,U.jsxs)(`div`,{className:`grid`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(260px,1fr))`,gap:18},children:[(0,U.jsx)(Zl,{big:`$4.99`,small:`/ month · cancel anytime`,sub:`Less than one extra sale pays for it.`}),(0,U.jsx)(Zl,{big:`32%`,small:`avg repeat-buyer lift`,sub:`When sellers reach out post-show with a gift offer.`}),(0,U.jsx)(Zl,{big:`â`,small:`audience you keep`,sub:`If Whatnot changes the rules tomorrow, your list still works.`})]}),(0,U.jsxs)(`div`,{className:`card`,style:{padding:24},children:[(0,U.jsx)(`h3`,{style:{marginTop:0},children:`Quick answers`}),(0,U.jsx)(Ql,{q:`Do I have to ship a free gift to everyone?`,a:`No. The gift offer is optional and only triggers for fans who signed up AND opted in. You set the offer; we flag the label when they reorder.`}),(0,U.jsx)(Ql,{q:`What if I already have an email list?`,a:`Import it. PearShow matches it back to your show buyers so you can see who's engaged and who's gone cold.`}),(0,U.jsx)(Ql,{q:`Does this work across Whatnot, TikTok Live, and Facebook Live?`,a:`Yes â your page is platform-agnostic. One QR, one list, every show you do.`}),(0,U.jsx)(Ql,{q:`What happens if I turn it off?`,a:`Your page goes offline, but every fan, email, and g
46ift redemption stays saved. Turn it back on anytime and pick up where you left off.`})]}),(0,U.jsxs)(`div`,{className:`card`,style:{padding:28,textAlign:`center`,background:`linear-gradient(135deg, ${Z}, #ffffff)`},children:[(0,U.jsx)(`h2`,{style:{margin:`0 0 6px 0`},children:`Ready to own your audience?`}),(0,U.jsx)(`div`,{style:{color:`var(--pl-muted)`,marginBottom:18},children:`One click. Live in two minutes. $4.99/mo on top of your plan.`}),(0,U.jsxs)(`button`,{className:`primary`,style:{padding:`14px 28px`,fontSize:15,fontWeight:700,boxShadow:`0 8px 28px rgba(47,111,178,0.28)`},onClick:e,children:[(0,U.jsx)(ge,{size:14}),` Enable Marketing add-on`]})]})]})}function ql({icon:e,eyebrow:t,title:n,body:r,example:i}){return(0,U.jsxs)(`div`,{className:`card`,style:{padding:22,display:`flex`,flexDirection:`column`,gap:14},children:[(0,U.jsx)(`div`,{style:{fontSize:32},children:e}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{style:{fontSize:10,fontWeight:700,letterSpacing:1.2,color:X,textTransform:`uppercase`},children:t}),(0,U.jsx)(`div`,{style:{fontWeight:800,fontSize:17,marginTop:4,lineHeight:1.3},children:n})]}),(0,U.jsx)(`div`,{style:{fontSize:13,color:`var(--pl-muted)`,lineHeight:1.55},children:r}),(0,U.jsx)(`div`,{style:{marginTop:`auto`,paddingTop:6},children:i})]})}function Jl({children:e}){return(0,U.jsxs)(`div`,{style:{borderRadius:8,overflow:`hidden`,border:`1px solid ${Q}`,background:`#fff`},children:[(0,U.jsxs)(`div`,{style:{display:`flex`,gap:4,padding:`6px 10px`,background:Z},children:[(0,U.jsx)(`span`,{style:{width:8,height:8,borderRadius:`50%`,background:`#ff5f57`}}),(0,U.jsx)(`span`,{style:{width:8,height:8,borderRadius:`50%`,background:`#febc2e`}}),(0,U.jsx)(`span`,{style:{width:8,height:8,borderRadius:`50%`,background:`#28c840`}}),(0,U.jsx)(`span`,{style:{marginLeft:8,fontSize:10,color:`var(--pl-muted)`},children:`pearshow.com/p/vintage_vault`})]}),e]})}function Yl({rows:e}){return(0,U.jsx)(`div`,{className:`stack`,style:{gap:4},children:e.map((e,t)=>(0,U.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,padding:`8px 10px`,background:Z,borderRadius:6,fontSize:11},children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{style:{fontWeight:700},children:e.name}),(0,U.jsx)(`div`,{style:{color:`var(--pl-muted)`,fontSize:10},children:e.tag})]}),(0,U.jsx)(`div`,{style:{color:`var(--pl-muted)`,fontSize:10},children:e.days})]},t))})}function Xl({n:e,title:t,body:n}){return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{style:{width:32,height:32,borderRadius:`50%`,background:`linear-gradient(135deg,${X},${Vl})`,color:`#fff`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontWeight:800,marginBottom:10},children:e}),(0,U.jsx)(`div`,{style:{fontWeight:700,marginBottom:4},children:t}),(0,U.jsx)(`div`,{style:{fontSize:12,color:`var(--pl-muted)`,lineHeight:1.5},children:n})]})}function Zl({big:e,small:t,sub:n}){return(0,U.jsxs)(`div`,{className:`card`,style:{padding:20,textAlign:`center`},children:[(0,U.jsx)(`div`,{style:{fontSize:36,fontWeight:800,color:X,lineHeight:1},children:e}),(0,U.jsx)(`div`,{style:{fontSize:12,color:`var(--pl-muted)`,marginTop:4},children:t}),(0,U.jsx)(`div`,{style:{fontSize:12,marginTop:10,lineHeight:1.5},children:n})]})}function Ql({q:e,a:t}){return(0,U.jsxs)(`details`,{style:{borderTop:`1px solid rgba(255,255,255,0.06)`,padding:`12px 0`},children:[(0,U.jsx)(`summary`,{style:{cursor:`pointer`,fontWeight:600,fontSize:14},children:e}),(0,U.jsx)(`div`,{style:{fontSize:13,color:`var(--pl-muted)`,marginTop:8,lineHeight:1.55},children:t})]})}function $l({userId:e,onDisable:t}){let[n,r]=(0,V.useState)(`page`),[i,a]=(0,V.useState)(null),[o,c]=(0,V.useState)(null);return(0,V.useEffect)(()=>{(async()=>{let{data:t}=await s.from(`stores`).select(`id,name,is_primary`).eq(`user_id`,e).order(`is_primary`,{ascending:!1}).order(`created_at`,{ascending:!0}),n=t||[];a(n),n.length>1&&c(n.find(e=>e.is_primary)?.id||n[0].id)})()},[e]),(0,U.jsxs)(`div`,{className:`stack`,style:{gap:12},children:[(i?.length||0)>1&&i&&(0,U.jsxs)(`div`,{className:`card row`,style:{padding:12,gap:12,alignItems:`center`,justifyContent:`space-between`,flexWrap:`wrap`,borderLeft:`3px solid ${X}`},children:[(0,U.jsxs)(`div`,{className:`stack`,style:{gap:2},children:[(0,U.jsx)(`div`,{style:{fontSize:10,fontWeight:700,letterSpacing:1.2,color:X,textTransform:`uppercase`},children:`Marketing for`}),(0,U.jsx)(`div`,{style:{fontSize:13,color:`var(--pl-muted)`},children:`Each brand has its own page, fan list, gifts, and redemptions.`})]}),(0,U.jsx)(`div`,{className:`row`,style:{gap:6,flexWrap:`wrap`},children:i.map(e=>(0,U.jsxs)(`button`,{className:o===e.id?`primary`:`ghost`,style:{padding:`6px 12px`,fontSize:13},onClick:()=>c(e.id),children:[e.name,e.is_primary?` â
`:``]},e.id))})]}),(0,U.jsxs)(`div`,{className:`row`,style:{gap:8,alignItems:`center`,justifyContent:`space-between`,flexWrap:`wrap`},children:[(0,U.jsx)(`div`,{className:`row`,style:{gap:6},children:[`page`,`gifts`,`fans`,`redemptions`].map(e=>(0,U.jsx)(`button`,{className:n===e?`primary`:`ghost`,style:{padding:`6px 12px`,fontSize:13},onClick:()=>r(e),children:e===`page`?`Your page`:e===`gifts`?`Gift offers`:e===`fans`?`Subscribers`:`Redemptions`},e))}),(0,U.jsxs)(`button`,{className:`ghost`,style:{fontSize:11,color:`var(--pl-muted)`},onClick:t,children:[(0,U.jsx)(vt,{size:11}),` Turn off add-on`]}
46)]}),n===`page`&&(0,U.jsx)(eu,{userId:e,storeId:o,storeName:i?.find(e=>e.id===o)?.name||null},o||`default`),n===`gifts`&&(0,U.jsx)(cu,{userId:e,storeId:o},o||`default`),n===`fans`&&(0,U.jsx)(uu,{userId:e,storeId:o},o||`default`),n===`redemptions`&&(0,U.jsx)(du,{userId:e,storeId:o},o||`default`)]})}function eu({userId:e,storeId:t,storeName:n}){let[r,i]=(0,V.useState)(null),[a,o]=(0,V.useState)(!0),[c,l]=(0,V.useState)(null),[u,d]=(0,V.useState)(null),[f,p]=(0,V.useState)(`identity`);(0,V.useEffect)(()=>{(async()=>{let r=s.from(`seller_pages`).select(`*`).eq(`user_id`,e);r=t?r.eq(`store_id`,t):r.is(`store_id`,null);let{data:a}=await r.maybeSingle();if(a){let e=a;i(Wl({...e,gallery_images:Array.isArray(e.gallery_images)?e.gallery_images:[]}))}else{let{data:r}=await s.from(`profiles`).select(`display_name,business_name`).eq(`id`,e).maybeSingle();i({user_id:e,store_id:t,slug:`${(n||r?.business_name||r?.display_name||`seller`).toString().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``).slice(0,32)||`seller`}-${t?t.slice(0,4):e.slice(0,4)}`,display_name:n||r?.display_name||`Your name`,headline:`Live shows · combined shipping · fast packing`,bio:``,photo_url:``,whatnot_url:``,tiktok_url:``,instagram_url:``,website_url:``,show_schedule:``,theme_color:X,published:!0,template:`classic`,background_color:`#f6f8f1`,accent_color:X,text_color:`#243047`,font_style:`modern`,header_image_url:``,gallery_images:[],cta_text:`Join my fan list`,secondary_color:`#dbe9f6`,button_text_color:`#ffffff`,heading_font:`fraunces`,background_style:`warm-paper`,background_image_url:``,banner_layout:`full-bleed`,button_shape:`pill`,section_divider:`hairline`,vibe_preset:null})}o(!1)})()},[e,t,n]);let m=async()=>{if(!r)return;d(null);let e={...r,slug:r.slug.toLowerCase().replace(/[^a-z0-9-]/g,`-`).replace(/^-+|-+$/g,``).slice(0,48)},n={...e,gallery_images:e.gallery_images,updated_at:new Date().toISOString()},a=t?`user_id,store_id`:void 0,{error:o}=await s.from(`seller_pages`).upsert(n,a?{onConflict:a}:void 0);if(o){d(o.message.includes(`seller_pages_slug_key`)?`That handle is taken â try another.`:o.message);return}i(e),l(Date.now())};if(a||!r)return(0,U.jsx)(`div`,{className:`card`,style:{color:`var(--pl-muted)`},children:`Loadingâ¦`});let h=`https://pearshow.com/p/${r.slug}`,g=`https://pearshow.com/${r.slug}`,_=(e,t)=>i({...r,[e]:t}),v=(e,t)=>{let n=[...r.gallery_images||[]];n[e]=t,_(`gallery_images`,n.filter((t,n)=>n<=e||t))},y=()=>_(`gallery_images`,[...r.gallery_images||[],``]),b=e=>_(`gallery_images`,(r.gallery_images||[]).filter((t,n)=>n!==e)),x=(e,t)=>{let n=[...r.gallery_images||[]];if(e<0||e>=n.length||t<0||t>=n.length||e===t)return;let[i]=n.splice(e,1);n.splice(t,0,i),_(`gallery_images`,n)},S=[{name:`Blue studio`,accent:`#2f6fb2`,secondary:`#dbe9f6`,bg:`#f6f8f1`,text:`#243047`},{name:`Clean gallery`,accent:`#244f80`,secondary:`#edf3f8`,bg:`#ffffff`,text:`#243047`},{name:`Pear market`,accent:`#5a8a2a`,secondary:`#dcebcf`,bg:`#f4f8ed`,text:`#243047`},{name:`Soft slate`,accent:`#48627c`,secondary:`#e6edf2`,bg:`#f8faf5`,text:`#263342`}],C=[{id:`space-grotesk`,label:`Modern seller`,heading:`Space Grotesk`,body:`Modern sans-serif`,fontStyle:`modern`},{id:`fraunces`,label:`Boutique booth`,heading:`Fraunces`,body:`Friendly rounded`,fontStyle:`rounded`},{id:`dm-serif`,label:`Editorial drop`,heading:`DM Serif`,body:`Modern sans-serif`,fontStyle:`modern`},{id:`bricolage`,label:`Creator clean`,heading:`Bricolage`,body:`Modern sans-serif`,fontStyle:`modern`}],w=[{id:`full-bleed`,label:`Clean banner`,desc:`Wide image, avatar below.`},{id:`framed`,label:`Card banner`,desc:`Inset and polished.`},{id:`split-avatar`,label:`Profile first`,desc:`Name and photo lead.`}],T=[{id:`identity`,label:`Identity`,accent:X,icon:(0,U.jsx)(Ot,{size:18}),hint:`Name, handle, pitch`},{id:`style`,label:`Theme & Look`,accent:`#48627c`,icon:(0,U.jsx)(St,{size:18}),hint:`Palette, type, shape`},{id:`media`,label:`Photos & Gallery`,accent:`#6f7fb5`,icon:(0,U.jsx)(ft,{size:18}),hint:`Profile, cover, products`},{id:`links`,label:`Channels & Schedule`,accent:Vl,icon:(0,U.jsx)(ue,{size:18}),hint:`Live links and times`}],E=T.find(e=>e.id===f),D=e=>i({...r,accent_color:e.accent,theme_color:e.accent,secondary_color:e.secondary,background_color:e.bg,text_color:e.text,button_text_color:`#ffffff`,background_style:`solid`}),O=e=>i({...r,heading_font:e.id,font_style:e.fontStyle});
46return(0,U.jsxs)(`div`,{className:`grid marketing-builder-grid`,style:{gap:24,alignItems:`start`},children:[(0,U.jsxs)(`div`,{className:`stack`,style:{gap:16},children:[(0,U.jsxs)(`div`,{style:{background:`#ffffff`,color:`var(--pl-ink)`,borderRadius:16,padding:`14px 16px`,display:`grid`,gridTemplateColumns:`minmax(0, 1fr) auto auto auto`,alignItems:`center`,gap:12,border:`1px solid ${Q}`,boxShadow:`0 16px 36px -28px rgba(36,48,71,.32)`},children:[(0,U.jsxs)(`div`,{style:{display:`flex`,gap:12,alignItems:`center`,minWidth:0},children:[(0,U.jsx)(`div`,{style:{width:38,height:38,borderRadius:12,background:Z,color:Bl,display:`grid`,placeItems:`center`,flexShrink:0},children:(0,U.jsx)(_t,{size:18})}),(0,U.jsxs)(`div`,{style:{minWidth:0},children:[(0,U.jsx)(`div`,{style:{fontSize:10,letterSpacing:1.4,textTransform:`uppercase`,color:`var(--pl-muted)`,fontWeight:800},children:`Public page`}),(0,U.jsx)(`a`,{href:g,target:`_blank`,rel:`noreferrer`,style:{color:X,fontSize:13,fontWeight:800,wordBreak:`break-all`,textDecoration:`none`},children:g})]})]}),(0,U.jsx)(gu,{url:g,title:r.display_name||`Check out my live shows`,headline:r.headline||``}),(0,U.jsxs)(`label`,{style:{display:`flex`,gap:7,alignItems:`center`,fontSize:12,fontWeight:700,color:`var(--pl-ink)`},children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:r.published,onChange:e=>_(`published`,e.target.checked)}),` `,r.published?`Live`:`Draft`]}),(0,U.jsxs)(`button`,{onClick:m,style:{background:Vl,color:`#fff`,border:`1px solid #4a7222`,padding:`11px 16px`,borderRadius:10,fontWeight:900,fontSize:13,cursor:`pointer`,boxShadow:`0 10px 22px rgba(90,138,42,.22)`},children:[(0,U.jsx)(de,{size:13}),` Save`]}),c&&(0,U.jsx)(`span`,{style:{gridColumn:`1 / -1`,fontSize:12,color:Vl,fontWeight:800},children:`â Saved`})]}),(0,U.jsx)(`div`,{className:`grid marketing-section-tabs`,style:{gridTemplateColumns:`repeat(4, minmax(0, 1fr))`,gap:10},children:T.map(e=>{let t=f===e.id;return(0,U.jsxs)(`button`,{onClick:()=>p(e.id),style:{display:`flex`,alignItems:`center`,gap:11,padding:`14px`,cursor:`pointer`,textAlign:`left`,background:t?`#ffffff`:`rgba(255,255,255,.72)`,border:t?`2px solid ${e.accent}`:`1px solid ${Q}`,borderRadius:14,boxShadow:t?`0 14px 30px -22px ${e.accent}`:`none`},children:[(0,U.jsx)(`span`,{style:{width:38,height:38,borderRadius:12,background:t?e.accent:Z,color:t?`#fff`:Bl,display:`grid`,placeItems:`center`,flexShrink:0},children:e.icon}),(0,U.jsxs)(`span`,{style:{minWidth:0},children:[(0,U.jsx)(`span`,{style:{display:`block`,fontWeight:900,fontSize:14,color:`var(--pl-ink)`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:e.label}),(0,U.jsx)(`span`,{style:{display:`block`,fontSize:11,color:`var(--pl-muted)`,marginTop:2},children:e.hint})]})]},e.id)})}),(0,U.jsxs)(`div`,{style:{borderRadius:18,border:`1px solid ${Q}`,background:`#ffffff`,boxShadow:`0 20px 44px -32px rgba(36,48,71,.32)`,overflow:`hidden`},children:[(0,U.jsxs)(`div`,{style:{padding:`18px 20px`,borderBottom:`1px solid ${Q}`,background:`linear-gradient(180deg, #ffffff 0%, #f8faf5 100%)`,display:`flex`,alignItems:`center`,gap:12},children:[(0,U.jsx)(`span`,{style:{width:36,height:36,borderRadius:12,background:E.accent,color:`#fff`,display:`grid`,placeItems:`center`},children:E.icon}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{style:{fontSize:18,fontWeight:950,color:`var(--pl-ink)`,lineHeight:1},children:E.label}),(0,U.jsx)(`div`,{style:{fontSize:12,color:`var(--pl-muted)`,marginTop:4},children:E.hint})]})]}),(0,U.jsxs)(`div`,{style:{padding:20},children:[f===`identity`&&(0,U.jsxs)(`div`,{className:`fresh-panel-grid`,children:[(0,U.jsxs)(`div`,{className:`fresh-panel-main`,children:[(0,U.jsxs)(tu,{kicker:`01`,title:`Page address`,subtitle:`Make it short enough to say out loud during a show.`,children:[(0,U.jsx)(nu,{label:`pearshow.com/`,children:(0,U.jsx)(`input`,{value:r.slug,onChange:e=>_(`slug`,e.target.value),placeholder:`your-shop-handle`})}),u&&(0,U.jsx)(`div`,{style:{fontSize:12,color:`#b54a3a`,fontWeight:700},children:u})]}),(0,U.jsxs)(tu,{kicker:`02`,title:`Seller card`,subtitle:`The first thing fans understand when they land on the page.`,children:[(0,U.jsxs)(`div`,{className:`grid cols2`,
46style:{gap:12},children:[(0,U.jsx)(nu,{label:`Display name`,children:(0,U.jsx)(`input`,{value:r.display_name,onChange:e=>_(`display_name`,e.target.value),placeholder:`Your shop name`})}),(0,U.jsx)(nu,{label:`Button text`,children:(0,U.jsx)(`input`,{value:r.cta_text||``,onChange:e=>_(`cta_text`,e.target.value),placeholder:`Join my fan list`})})]}),(0,U.jsx)(nu,{label:`One-line pitch`,children:(0,U.jsx)(`input`,{value:r.headline||``,onChange:e=>_(`headline`,e.target.value),placeholder:`Vintage tees, live every Friday, fast combined shipping`})})]}),(0,U.jsx)(tu,{kicker:`03`,title:`Story section`,subtitle:`A full-width intro, not a cramped note box.`,children:(0,U.jsx)(`textarea`,{rows:8,value:r.bio||``,onChange:e=>_(`bio`,e.target.value),placeholder:`Tell fans who you are, what you sell, what makes your shows worth following, and what they can expect when they join.`,style:{width:`100%`,minHeight:220,resize:`vertical`,fontSize:14,lineHeight:1.55}})})]}),(0,U.jsx)(ru,{title:`What fans should know fast`,items:[`Who you are`,`What you sell`,`Why they should follow`,`How to join`]})]}),f===`style`&&(0,U.jsxs)(`div`,{className:`fresh-panel-grid`,children:[(0,U.jsxs)(`div`,{className:`fresh-panel-main`,children:[(0,U.jsx)(tu,{kicker:`01`,title:`Color kits`,subtitle:`Pick a finished palette first, then fine tune the exact colors.`,children:(0,U.jsx)(`div`,{className:`grid`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(170px, 1fr))`,gap:10},children:S.map(e=>(0,U.jsxs)(`button`,{onClick:()=>D(e),style:{textAlign:`left`,padding:12,borderRadius:14,border:(r.accent_color||X)===e.accent?`2px solid ${e.accent}`:`1px solid ${Q}`,background:`#fff`,cursor:`pointer`},children:[(0,U.jsx)(`div`,{style:{display:`flex`,gap:5,marginBottom:10},children:[e.accent,e.secondary,e.bg,e.text].map(e=>(0,U.jsx)(`span`,{style:{width:28,height:28,borderRadius:8,background:e,border:`1px solid ${Q}`}},e))}),(0,U.jsx)(`div`,{style:{fontWeight:900,fontSize:13},children:e.name})]},e.name))})}),(0,U.jsx)(tu,{kicker:`02`,title:`Fine tune`,subtitle:`Exact brand controls without the old preset wall.`,children:(0,U.jsxs)(`div`,{className:`grid cols2`,style:{gap:12},children:[(0,U.jsx)(au,{label:`Accent`,v:r.accent_color||X,on:e=>{_(`accent_color`,e),_(`theme_color`,e)}}),(0,U.jsx)(au,{label:`Soft color`,v:r.secondary_color||`#dbe9f6`,on:e=>_(`secondary_color`,e)}),(0,U.jsx)(au,{label:`Background`,v:r.background_color||`#f6f8f1`,on:e=>{_(`background_color`,e),_(`background_style`,`solid`)}}),(0,U.jsx)(au,{label:`Text`,v:r.text_color||`#243047`,on:e=>_(`text_color`,e)})]})}),(0,U.jsxs)(tu,{kicker:`03`,title:`Type and buttons`,subtitle:`Choose the voice of the page.`,children:[(0,U.jsx)(`div`,{className:`grid`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(150px, 1fr))`,gap:10},children:C.map(e=>(0,U.jsxs)(`button`,{onClick:()=>O(e),style:{padding:12,textAlign:`left`,borderRadius:14,border:(r.heading_font||`space-grotesk`)===e.id?`2px solid ${X}`:`1px solid ${Q}`,background:`#fff`,cursor:`pointer`},children:[(0,U.jsx)(`div`,{style:{fontWeight:950,fontSize:14},children:e.label}),(0,U.jsxs)(`div`,{style:{fontSize:11,color:`var(--pl-muted)`,marginTop:3},children:[e.heading,` / `,e.body]})]},e.id))}),(0,U.jsx)(`div`,{style:{display:`flex`,gap:8,flexWrap:`wrap`},children:[`pill`,`rounded`,`square`].map(e=>(0,U.jsx)(`button`,{onClick:()=>_(`button_shape`,e),style:{padding:`9px 16px`,borderRadius:e===`pill`?999:e===`rounded`?10:3,border:(r.button_shape||`pill`)===e?`2px solid ${r.accent_color||X}`:`1px solid ${Q}`,background:`#fff`,fontWeight:800,cursor:`pointer`,textTransform:`capitalize`},children:e},e))})]})]}),(0,U.jsx)(ru,{title:`Fresh look rules`,items:[`No orange/black default`,`Readable on phone`,`Buttons match brand`,`Soft background only`]})]}),f===`media`&&(0,U.jsxs)(`div`,{className:`fresh-panel-grid`,children:[(0,U.jsxs)(`div`,{className:`fresh-panel-main`,children:[(0,U.jsxs)(tu,{kicker:`01`,title:`Profile photo`,subtitle:`Your face, logo, or store mark â this now sits below the header instead of colliding with it.`,children:[(0,U.jsx)(mu,{recommended:`800 Ã 800 px (1:1 square)`,minimum:`400 Ã 400 px`,tips:[`Center your face or logo`,`PNG or JPG, under 10MB`,`Avoid tiny text â it gets cropped to a circle`]}),(0,U.jsx)(fu,{userId:e,value:r.photo_url||``,onChange:e=>_(`photo_url`,e),label:`Drop a photo or click to upload`,aspect:`1 / 1`,maxHeight:180})]}),(0,U.jsxs)(tu,{kicker:`02`,title:`Cover image`,subtitle:`A clean banner for products, booth setup, or brand mood.`,children:[(0,U.jsx)(mu,{recommended:`1920 Ã 640 px (3:1, matches Whatnot store + TikTok)`,minimum:`1200 Ã 450 px`,tips:[`Keep important detail in the center`,`Edges may be cropped on mobile`,`PNG or JPG, under 10MB`]}),(0,U.jsx)(fu,{userId:e,value:r.header_image_url||``,onChange:e=>_(`header_image_url`,e),label:`Drop a banner image (wide works best)`,aspect:`3 / 1`,maxHeight:180}),(0,U.jsx)(`div`,{className:`grid`,style:{gridTemplateColumns:`repeat(3, 1fr)`,gap:8},children:w.map(e=>(0,U.jsxs)(`button`,{onClick:()=>_(`banner_layout`,e.id),style:{padding:12,borderRadius:14,background:`#fff`,border:(r.banner_layout||`full-bleed`)===e.id?`2px solid ${X}`:`1px solid ${Q}
46`,cursor:`pointer`,textAlign:`left`},children:[(0,U.jsx)(`div`,{style:{fontWeight:900,fontSize:13},children:e.label}),(0,U.jsx)(`div`,{style:{color:`var(--pl-muted)`,fontSize:11,marginTop:3},children:e.desc})]},e.id))})]}),(0,U.jsxs)(tu,{kicker:`03`,title:`Product gallery`,subtitle:`Add the items or booth shots that make someone want to stop scrolling. Drag tiles to reorder.`,children:[(0,U.jsx)(mu,{recommended:`1200 à 900 px (4:3 landscape)`,minimum:`800 à 600 px`,tips:[`Up to 6 images`,`Drag a tile by its handle to reorder`,`Bright, uncropped product shots win`]}),(0,U.jsx)(hu,{images:r.gallery_images||[],userId:e,onSet:v,onRemove:b,onMove:x,onAdd:y})]})]}),(0,U.jsx)(ru,{title:`Best photos`,items:[`Drag & drop straight in`,`Face or logo first`,`Products second`,`Bright, uncropped shots`]})]}),f===`links`&&(0,U.jsxs)(`div`,{className:`fresh-panel-grid`,children:[(0,U.jsxs)(`div`,{className:`fresh-panel-main`,children:[(0,U.jsxs)(tu,{kicker:`01`,title:`Live schedule`,subtitle:`Tell fans exactly when to show up.`,children:[(0,U.jsx)(nu,{label:`Schedule`,children:(0,U.jsx)(`input`,{value:r.show_schedule||``,onChange:e=>_(`show_schedule`,e.target.value),placeholder:`Tuesdays and Fridays · 7 PM CT`})}),(0,U.jsx)(pu,{onApply:e=>_(`show_schedule`,e)})]}),(0,U.jsx)(tu,{kicker:`02`,title:`Where you sell`,subtitle:`Only add the channels you actually use â they appear as clean buttons.`,children:(0,U.jsxs)(`div`,{className:`grid cols2`,style:{gap:12},children:[(0,U.jsx)(iu,{label:`Whatnot`,value:r.whatnot_url||``,on:e=>_(`whatnot_url`,e)}),(0,U.jsx)(iu,{label:`TikTok`,value:r.tiktok_url||``,on:e=>_(`tiktok_url`,e)}
46),(0,U.jsx)(iu,{label:`Instagram`,value:r.instagram_url||``,on:e=>_(`instagram_url`,e)}),(0,U.jsx)(iu,{label:`Website`,value:r.website_url||``,on:e=>_(`website_url`,e)})]})})]}),(0,U.jsx)(ru,{title:`Channel checklist`,items:[`Use full URLs`,`Keep dead channels blank`,`Schedule matches your show`,`Save before sharing`],icon:(0,U.jsx)(it,{size:18})})]})]})]})]}),(0,U.jsxs)(`div`,{className:`marketing-phone-column`,style:{position:`sticky`,top:12,alignSelf:`start`},children:[(0,U.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:10},children:[(0,U.jsx)(`div`,{style:{fontSize:11,letterSpacing:1.4,textTransform:`uppercase`,fontWeight:800,color:Bl},children:`ð± Live phone preview`}),(0,U.jsx)(`div`,{style:{fontSize:10,color:`var(--pl-muted)`},children:`Updates as you type`})]}),(0,U.jsx)(`div`,{className:`marketing-phone-frame`,style:{width:392,minHeight:846,margin:`0 auto`,background:`linear-gradient(180deg, #ffffff 0%, #edf3f8 100%)`,padding:12,borderRadius:42,border:`1px solid ${Q}`,boxShadow:`0 28px 58px -24px rgba(36,48,71,.34), inset 0 0 0 1px rgba(255,255,255,.9)`},children:(0,U.jsxs)(`div`,{style:{position:`relative`,borderRadius:32,overflow:`hidden`,background:Hl,minHeight:820,maxHeight:820,overflowY:`auto`,paddingTop:28},children:[(0,U.jsx)(`div`,{style:{position:`absolute`,top:8,left:`50%`,transform:`translateX(-50%)`,width:92,height:18,background:`#c8d2dc`,borderRadius:999,zIndex:5,boxShadow:`inset 0 1px 2px rgba(36,48,71,.16)`}}),(0,U.jsx)(su,{page:r,url:h})]})}),(0,U.jsxs)(`div`,{style:{marginTop:12,padding:12,background:Z,borderRadius:10,fontSize:12,color:Bl,lineHeight:1.55,border:`1px solid ${Q}`},children:[(0,U.jsx)(`b`,{children:`ð¡ Pro tip:`}),` Your URL prints as a QR on every shipping label. Buyers scan it, sign up, and your list grows on autopilot.`]})]})]})}function tu({kicker:e,title:t,subtitle:n,children:r}){return(0,U.jsxs)(`section`,{style:{border:`1px solid ${Q}`,borderRadius:16,background:`#ffffff`,overflow:`hidden`},children:[(0,U.jsx)(`div`,{style:{padding:`16px 18px`,borderBottom:`1px solid ${Q}`,background:`#fbfcf7`},children:(0,U.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,U.jsx)(`span`,{style:{width:30,height:30,borderRadius:10,background:Z,color:Bl,display:`grid`,placeItems:`center`,fontSize:11,fontWeight:950},children:e}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{style:{margin:0,fontSize:17,lineHeight:1.1},children:t}),(0,U.jsx)(`p`,{style:{margin:`4px 0 0`,color:`var(--pl-muted)`,fontSize:12,lineHeight:1.4},children:n})]})]})}),(0,U.jsx)(`div`,{className:`stack`,style:{gap:14,padding:18},children:r})]})}function nu({label:e,children:t}){return(0,U.jsxs)(`label`,{style:{display:`grid`,gap:6},children:[(0,U.jsx)(`span`,{className:`label`,children:e}),t]})}function ru({title:e,items:t,icon:n}){return(0,U.jsxs)(`aside`,{style:{borderRadius:16,padding:18,background:Hl,border:`1px solid ${Q}`,alignSelf:`start`},children:[(0,U.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,fontWeight:950,color:Bl,marginBottom:12},children:[n||(0,U.jsx)(me,{size:18}),` `,e]}),(0,U.jsx)(`div`,{className:`stack`,style:{gap:9},children:t.map(e=>(0,U.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:12,color:`var(--pl-ink)`,fontWeight:700},children:[(0,U.jsx)(`span`,{style:{width:7,height:7,borderRadius:999,background:Vl,flexShrink:0}}),e]},e))})]})}function iu({label:e,value:t,on:n}){return(0,U.jsx)(nu,{label:e,children:(0,U.jsx)(`input`,{value:t,onChange:e=>n(e.target.value),placeholder:`https://${e.toLowerCase()}.com/your-handle`})})}function au({label:e,v:t,on:n}){let[r,i]=(0,V.useState)(!1),a=/^#([0-9a-fA-F]{6})$/.test(t)?t:`#000000`;return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`label`,children:e}),(0,U.jsxs)(`div`,{className:`row`,style:{gap:6,alignItems:`center`},children:[(0,U.jsxs)(Ll,{open:r,onOpenChange:i,children:[(0,U.jsx)(Rl,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,"aria-label":`Pick ${e} color`,style:{width:38,height:32,padding:0,border:`1px solid var(--pl-border)`,borderRadius:6,background:a,cursor:`pointer`}})}),(0,U.jsxs)(zl,{align:`start`,side:`bottom`,sideOffset:6,className:`w-auto p-3`,children:[(0,U.jsx)(yo,{color:a,onChange:n}),(0,U.jsx)(`input`,{value:t,onChange:e=>n(e.target.value),style:{marginTop:10,width:`100%`,fontFamily:`monospace`,fontSize:12,padding:`6px 8px`,border:`1px solid var(--pl-border)`,borderRadius:6}})]})]}),(0,U.jsx)(`input`,{value:t,onChange:e=>n(e.target.value),style:{flex:1,fontFamily:`monospace`,fontSize:12}})]})]})}function ou({label:e,children:t}){return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`label`,children:e}),t]})}function su({page:e,url:t}){let n=e.background_color||`#f6f8f1`,r=e.accent_color||e.theme_color||X,i=e.button_text_color||`#ffffff`,a=e.text_color||`#243047`,o=e.secondary_color||`#dbe9f6`,s=Ee(e.font_style),c=Oe(e.heading_font),l=Fe(e.button_shape),u=He(e.background_style,n,r,e.background_image_url),d=e.header_image_url,f=a+`99`,p=a+`22`,m=(e.gallery_images||[]).filter(
46Boolean),h=[e.whatnot_url?{id:`wn`,label:`Whatnot`,color:`#ff2d55`,glyph:`W`}:null,e.tiktok_url?{id:`tt`,label:`TikTok`,color:`#243047`,glyph:`âª`}:null,e.instagram_url?{id:`ig`,label:`Instagram`,color:`#c13584`,glyph:`â`}:null,e.website_url?{id:`web`,label:`Website`,color:r,glyph:`â`}:null].filter(Boolean),g=e.display_name.split(/\s+/).slice(0,2).map(e=>e[0]||``).join(``).toUpperCase();return(0,U.jsxs)(`div`,{style:{background:u,color:a,fontFamily:s,padding:12,minHeight:792,display:`flex`,flexDirection:`column`,gap:10},children:[(0,U.jsxs)(`div`,{style:{background:`rgba(255,255,255,0.92)`,borderRadius:18,overflow:`hidden`,border:`1px solid ${p}`,boxShadow:`0 10px 24px rgba(36,48,71,.1)`},children:[(0,U.jsx)(`div`,{style:{position:`relative`,aspectRatio:`3 / 1`,background:d?`center/cover no-repeat url(${d})`:`linear-gradient(135deg, ${r}, ${o})`},children:e.show_schedule&&(0,U.jsxs)(`span`,{style:{position:`absolute`,top:8,left:8,background:`#5a8a2a`,color:`#fff`,padding:`3px 8px`,borderRadius:999,fontSize:8,fontWeight:800,letterSpacing:.8,textTransform:`uppercase`},children:[`â Live · `,e.show_schedule]})}),(0,U.jsxs)(`div`,{style:{padding:`14px 14px 16px`},children:[(0,U.jsx)(`div`,{style:{width:64,height:64,borderRadius:18,margin:`0 auto 10px`,background:o,border:`3px solid #fff`,boxShadow:`0 6px 16px ${r}33`,overflow:`hidden`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:20,fontFamily:c,fontWeight:800,color:r},children:e.photo_url?(0,U.jsx)(`img`,{src:e.photo_url,alt:``,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):g}),(0,U.jsx)(`div`,{style:{textAlign:`center`,fontFamily:c,fontWeight:800,fontSize:18,lineHeight:1.1},children:e.display_name}),e.headline&&(0,U.jsx)(`div`,{style:{textAlign:`center`,fontSize:11,color:f,marginTop:4,lineHeight:1.4},children:e.headline})]})]}),e.bio&&(0,U.jsxs)(`div`,{style:{background:`rgba(255,255,255,0.85)`,border:`1px solid ${p}`,borderRadius:12,padding:12},children:[(0,U.jsx)(`div`,{style:{fontSize:8,fontWeight:800,letterSpacing:1.4,textTransform:`uppercase`,color:r,marginBottom:5},children:`My story`}),(0,U.jsx)(`div`,{style:{whiteSpace:`pre-wrap`,fontSize:11,lineHeight:1.55},children:e.bio})]}),h.length>0&&(0,U.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6},children:h.map(e=>(0,U.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,padding:`9px 11px`,borderRadius:12,background:`rgba(255,255,255,0.85)`,border:`1px solid ${p}`},children:[(0,U.jsx)(`span`,{style:{width:28,height:28,borderRadius:8,background:e.color,color:`#fff`,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,fontWeight:800,fontSize:13},children:e.glyph}),(0,U.jsxs)(`div`,{style:{flex:1,fontWeight:700,fontSize:11},children:[`Watch on `,e.label]}),(0,U.jsx)(`span`,{style:{color:r,fontWeight:800,fontSize:14},children:`âº`})]},e.id))}),m.length>0&&(0,U.jsxs)(`div`,{style:{background:`rgba(255,255,255,0.85)`,border:`1px solid ${p}`,borderRadius:12,padding:10},children:[(0,U.jsx)(`div`,{style:{fontSize:8,fontWeight:800,letterSpacing:1.4,textTransform:`uppercase`,color:r,marginBottom:6},children:`From the booth`}),(0,U.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(3,1fr)`,gap:3},children:m.slice(0,6).map((e,t)=>(0,U.jsx)(`div`,{style:{aspectRatio:`1/1`,background:`center/cover url(${e})`,borderRadius:6}},t))})]}),(0,U.jsxs)(`div`,{style:{background:`rgba(255,255,255,0.95)`,border:`2px solid ${r}`,borderRadius:14,padding:12,boxShadow:`0 10px 22px ${r}30`},children:[(0,U.jsx)(`div`,{style:{textAlign:`center`,fontFamily:c,fontWeight:800,fontSize:14},children:e.cta_text||`Join the fan list`}),(0,U.jsx)(`div`,{style:{fontSize:9,color:f,marginTop:3,textAlign:`center`},children:`Email · phone · handles`}),(0,U.jsx)(`button`,{style:{marginTop:8,background:r,color:i,border:0,padding:`9px 12px`,borderRadius:l,fontWeight:800,width:`100%`,fontSize:12,boxShadow:`0 4px 12px ${r}55`},children:e.cta_text||`Sign me up`})]}),(0,U.jsx)(`div`,{style:{fontSize:8,opacity:.55,textAlign:`center`,wordBreak:`break-all`},children:t})]})}function cu({userId:e,storeId:t}){let[n,r]=(0,V.useState)([]),[i,a]=(0,V.useState)(``),[o,c]=(0,V.useState)(``),[l,u]=(0,V.useState)(null),d=async()=>{let n=s.from(`gift_offers`).select(`*`).eq(`user_id`,e);n=t?n.eq(`store_id`,t):n.is(`store_id`,null);let{data:i}=await n.order(`created_at`,{ascending:!1}),a=i||[];
46r(a),l===null&&u(a.some(e=>e.active))};(0,V.useEffect)(()=>{d()},[e,t]);let f=async()=>{i.trim()&&(await s.from(`gift_offers`).insert({user_id:e,store_id:t,title:i.trim(),description:o.trim()||null}),a(``),c(``),d())},p=async e=>{await s.from(`gift_offers`).update({active:!e.active}).eq(`id`,e.id),d()},m=async e=>{confirm(`Delete this offer?`)&&(await s.from(`gift_offers`).delete().eq(`id`,e.id),d())};return(0,U.jsxs)(`div`,{className:`stack`,style:{gap:12},children:[(0,U.jsxs)(`div`,{className:`card`,style:{padding:20},children:[(0,U.jsx)(`div`,{style:{fontSize:11,fontWeight:700,letterSpacing:1.5,color:X,textTransform:`uppercase`,marginBottom:6},children:`The hook`}),(0,U.jsx)(`h3`,{style:{margin:`0 0 8px 0`},children:`Do you want to offer a free gift when fans sign up?`}),(0,U.jsx)(`div`,{style:{fontSize:13,color:`var(--pl-muted)`,lineHeight:1.6,marginBottom:14,maxWidth:720},children:`When a fan signs up on your page with their Whatnot or TikTok handle, PearShow watches for their next purchase from any of your shows. The instant their order comes in, we flag the shipping label and print a "ð FREE GIFT" slip so your packer knows to drop something in the box. This is the single biggest reason buyers come back.`}),(0,U.jsxs)(`div`,{className:`row`,style:{gap:8,flexWrap:`wrap`},children:[(0,U.jsxs)(`button`,{className:l?`primary`:`ghost`,onClick:()=>u(!0),children:[(0,U.jsx)(I,{size:14}),` Yes, offer a free gift`]}),(0,U.jsx)(`button`,{className:l===!1?`primary`:`ghost`,onClick:async()=>{let n=s.from(`gift_offers`).update({active:!1}).eq(`user_id`,e);n=t?n.eq(`store_id`,t):n.is(`store_id`,null),await n,u(!1),d()},children:`No, just collect signups`})]})]}),l&&(0,U.jsxs)(`div`,{className:`card`,style:{padding:18,background:Z},children:[(0,U.jsx)(`div`,{style:{fontSize:11,fontWeight:700,letterSpacing:1.5,color:Bl,textTransform:`uppercase`,marginBottom:8},children:`How it works end-to-end`}),(0,U.jsxs)(`div`,{className:`grid`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(180px,1fr))`,gap:12},children:[(0,U.jsx)(lu,{n:1,title:`Fan signs up`,body:`They visit your page, enter their handle + email, and check the gift opt-in box.`}),(0,U.jsx)(lu,{n:2,title:`They buy again`,body:`Next time they win an item on Whatnot or TikTok, PearShow matches the handle to your fan list.`}),(0,U.jsx)(lu,{n:3,title:`Label flags the gift`,body:`Your packer sees "ð GIFT â add 1 free item" right on the shipping label.`}),(0,U.jsx)(lu,{n:4,title:`You mark it shipped`,body:`Tap shipped here once. PearShow marks it redeemed so they won't get a second one.`})]})]}),l&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsxs)(`h3`,{style:{marginTop:0},children:[(0,U.jsx)(I,{size:14}),` New gift offer`]}),(0,U.jsx)(ou,{label:`Offer title`,children:(0,U.jsx)(`input`,{value:i,onChange:e=>a(e.target.value),placeholder:`Free mystery charm with your next order`})}),(0,U.jsx)(`div`,{style:{height:8}}),(0,U.jsx)(ou,{label:`Description (optional)`,children:(0,U.jsx)(`textarea`,{rows:2,value:o,onChange:e=>c(e.target.value),placeholder:`Sign up on my page and your next order from any of my shows gets a free gift in the box.`})}),(0,U.jsxs)(`button`,{className:`primary`,style:{marginTop:10},onClick:f,children:[(0,U.jsx)(ge,{size:13}),` Add offer`]})]}),(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsx)(`h3`,{style:{marginTop:0},children:`Your offers`}),n.length===0?(0,U.jsx)(`div`,{style:{color:`var(--pl-muted)`,fontSize:13},children:`No offers yet â create one above. Active offers show on your page.`}):(0,U.jsx)(`div`,{className:`stack`,style:{gap:8},children:n.map(e=>(0,U.jsxs)(`div`,{className:`row`,style:{justifyContent:`space-between`,padding:10,border:`1px solid var(--pl-border)`,borderRadius:8},children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{style:{fontWeight:700},children:e.title}),e.description&&(0,U.jsx)(`div`,{style:{fontSize:12,color:`var(--pl-muted)`},children:e.description})]}),(0,U.jsxs)(`div`,{className:`row`,style:{gap:6},children:[(0,U.jsxs)(`button`,{className:`ghost`,style:{fontSize:12},onClick:()=>p(e),children:[e.active?(0,U.jsx)(me,{size:13,style:{color:`#3f8a3a`}}):(0,U.jsx)(at,{size:13}),` `,e.active?`Active`:`Paused`]}),(0,U.jsx)(`button`,{className:`ghost`,style:{fontSize:12,color:`#b54a3a`},onClick:()=>m(e),children:(0,U.jsx)(N,{size:13})})]})]},e.id))})]})]})]})}function lu({n:e,title:t,body:n}){return(0,U.jsxs)(`div`,{className:`stack`,style:{gap:4},children:[(0,U.jsx)(`div`,{style:{width:26,height:26,borderRadius:`50%`,background:X,color:`#fff`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontWeight:800,fontSize:13},children:e}),(0,U.jsx)(`div`,{style:{fontWeight:700,fontSize:13},children:t}),(0,U.jsx)(`div`,{style:{fontSize:12,color:`#243047`,lineHeight:1.5},children:n})]})}function uu({userId:e,storeId:t}){let[n,r]=(0,V.useState)([]);return(0,V.useEffect)(()=>{(async()=>{let n=s.from(`fan_subscribers`).select(`*`).eq(`user_id`,e);n=t?n.eq(`store_id`,t):n.is(`store_id`,null);let{data:i}=await n.order(`created_at`,{ascending:!1});r(i||[])})()},[e,t]),(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsxs)(`div`,{className:`row`,style:{justifyContent:`space-between`,alignItems:`center`},children:[(0,U.jsxs)(`h3`,{style:{margin:0},children:[`Your customer list (`,n.length,`)`]}),(0,U.jsxs)(`button`,{className:`ghost`,onClick:()=>{let e=n.map(e=>[e.name,e.email,e.phone,e.whatnot_handle,e.tiktok_handle,e.gift_opt_in,e.created_at].map(e=>`"${(e??``).toString().replace(/"/g,`""`)}"`).join(`,`)),t=new Blob([`name,email,phone,whatnot,tiktok,gift_opt_in,joined 47`+e.join(` 48`)],{type:`text/csv`}),r=document.createElement(`a`);r.href=URL.createObjectURL(t),r.download=`pearshow-subscribers.csv`,r.click()},disabled:n.length===0,children:[(0,U.jsx)(ot,{size:12}),` Export CSV`]})]}),n.length===0?(0,U.jsx)(`div`,{style:{marginTop:12,fontSize:13,color:`var(--pl-muted)`},children:`No signups yet. Share your PearShow page URL on every show and print it on every label â that's how the list grows.`}):(0,U.jsx)(`div`,{style:{overflow:`auto`,marginTop:10},children:(0,U.jsxs)(`table`,{className:`tbl`,style:{width:`100%`,fontSize:13},children:[(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`th`,{children:`N
48ame`}),(0,U.jsx)(`th`,{children:`Email`}),(0,U.jsx)(`th`,{children:`Phone`}),(0,U.jsx)(`th`,{children:`Handles`}),(0,U.jsx)(`th`,{children:`Gift opt-in`}),(0,U.jsx)(`th`,{children:`Joined`})]})}),(0,U.jsx)(`tbody`,{children:n.map(e=>(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`td`,{children:e.name||`â`}),(0,U.jsx)(`td`,{children:e.email||`â`}),(0,U.jsx)(`td`,{children:e.phone||`â`}),(0,U.jsx)(`td`,{children:[e.whatnot_handle&&`wn:${e.whatnot_handle}`,e.tiktok_handle&&`tt:${e.tiktok_handle}`].filter(Boolean).join(` · `)||`â`}),(0,U.jsx)(`td`,{children:e.gift_opt_in?`ð Yes`:`â`}),(0,U.jsx)(`td`,{style:{fontSize:11,color:`var(--pl-muted)`},children:new Date(e.created_at).toLocaleDateString()})]},e.id))})]})})]})}function du({userId:e,storeId:t}){let[n,r]=(0,V.useState)([]),i=async()=>{let n=s.from(`gift_redemptions`).select(`*`).eq(`user_id`,e);n=t?n.eq(`store_id`,t):n.is(`store_id`,null);let{data:i}=await n.order(`created_at`,{ascending:!1}),a=i||[];if(a.length===0){r([]);return}let o=[...new Set(a.map(e=>e.subscriber_id))],c=[...new Set(a.map(e=>e.offer_id).filter(Boolean))],[{data:l},{data:u}]=await Promise.all([s.from(`fan_subscribers`).select(`*`).in(`id`,o),c.length?s.from(`gift_offers`).select(`*`).in(`id`,c):Promise.resolve({data:[]})]),d=new Map((l||[]).map(e=>[e.id,e])),f=new Map((u||[]).map(e=>[e.id,e]));r(a.map(e=>({...e,subscriber:d.get(e.subscriber_id)||null,offer:e.offer_id&&f.get(e.offer_id)||null})))};(0,V.useEffect)(()=>{i()},[e,t]);let a=async e=>{await s.from(`gift_redemptions`).update({status:`shipped`,shipped_at:new Date().toISOString()}).eq(`id`,e),i()},o=n.filter(e=>e.status===`pending`);return(0,U.jsxs)(`div`,{className:`stack`,style:{gap:12},children:[o.length>0&&(0,U.jsxs)(`div`,{className:`card`,style:{borderLeft:`3px solid #e8b86a`},children:[(0,U.jsxs)(`h3`,{style:{marginTop:0},children:[`ð `,o.length,` gift`,o.length===1?``:`s`,` to ship`]}),(0,U.jsx)(`div`,{style:{fontSize:12,color:`var(--pl-muted)`},children:`When you pack their next order, drop in the free gift and mark shipped here. PearShow will also flag matching labels in the print queue.`})]}),(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsx)(`h3`,{style:{marginTop:0},children:`All redemptions`}),n.length===0?(0,U.jsx)(`div`,{style:{fontSize:13,color:`var(--pl-muted)`},children:`No gifts claimed yet. Once a fan signs up with gift opt-in checked, they'll appear here.`}):(0,U.jsxs)(`table`,{className:`tbl`,style:{width:`100%`,fontSize:13},children:[(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`th`,{children:`Fan`}),(0,U.jsx)(`th`,{children:`Offer`}),(0,U.jsx)(`th`,{children:`Status`}),(0,U.jsx)(`th`,{children:`Action`})]})}),(0,U.jsx)(`tbody`,{children:n.map(e=>(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`td`,{children:e.subscriber?.name||e.subscriber?.email||e.subscriber?.whatnot_handle||`â`}),(0,U.jsx)(`td`,{children:e.offer?.title||`Free gift`}),(0,U.jsx)(`td`,{children:e.status===`shipped`?(0,U.jsx)(`span`,{style:{color:`#3f8a3a`},children:`â Shipped`}):`Pending`}),(0,U.jsx)(`td`,{children:e.status===`pending`&&(0,U.jsx)(`button`,{className:`ghost`,style:{fontSize:12},onClick:()=>a(e.id),children:`Mark shipped`})})]},e.id))})]})]})]})}function fu({userId:e,value:t,onChange:n,label:r,aspect:i,maxHeight:a,compact:o}){let[c,l]=(0,V.useState)(!1),[u,d]=(0,V.useState)(null),[f,p]=(0,V.useState)(!1),m=async t=>{if(d(null),!t.type.startsWith(`image/`)){d(`That's not an image.`);return}if(t.size>10*1024*1024){d(`Image must be under 10MB.`);return}l(!0);try{let r=t.name.split(`.`).pop()?.toLowerCase()||`jpg`,i=`${e}/${Date.now()}-${Math.random().toString(36).slice(2,8)}.${r}`,{error:a}=await s.storage.from(`marketing-media`).upload(i,t,{cacheControl:`31536000`,upsert:!1,contentType:t.type});if(a)throw a;let{data:o,error:c}=await s.storage.from(`marketing-media`).createSignedUrl(i,3600*24*365);if(c||!o?.signedUrl)throw c||Error(`Couldn't get URL`);n(o.signedUrl)}catch(e){d(e?.message||`Upload failed`)}finally{l(!1)}},h=e=>{e&&e[0]&&m(e[0])};return(0,U.jsxs)(`div`,{className:`stack`,style:{gap:8},children:[(0,U.jsxs)(`label`,{onDragOver:e=>{e.preventDefault(),p(!0)},onDragLeave:()=>p(!1),onDrop:e=>{e.preventDefault(),p(!1),h(e.dataTransfer.files)},style:{position:`relative`,display:`block`,cursor:c?`wait`:`pointer`,border:`2px dashed ${f?X:Q}`,background:f?Z:t?`#fff`:Hl,borderRadius:12,overflow:`hidden`},children:[(0,U.jsx)(`input`,{type:`file`,accept:`image/*`,style:{position:`absolute`,inset:0,opacity:0,cursor:`pointer`},onChange:e=>h(e.target.files),disabled:c}),(0,U.jsx)(`div`,{style:{aspectRatio:i||`4 / 3`,maxHeight:a,background:t?`center/cover no-repeat url(${t})`:`transparent`,display:`grid`,placeItems:`center`,color:`var(--pl-muted)`,fontSize:12,textAlign:`center`,padding:12},children:c?(0,U.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:6},children:[(0,U.jsx)(T,{size:16,className:`spin`}),` Uploadingâ¦`]}):t?null:(0,U.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:6,fontWeight:700},children:[(0,U.jsx)(Dt,{size:16}),` `,r||`Drop an image or click to upload`]})})]}),!o&&(0,U.jsxs)(`details`,{style:{fontSize:11},children:[(0,U.jsx)(`summary`,{style:{cursor:`pointer`,color:`var(--pl-muted)`},children:`Or paste an image URL`}),(0,U.jsx)(`input`,{value:t,onChange:e=>n(e.target.value),placeholder:`https://â¦`,style:{marginTop:6,fontSize:12,width:`100%`}})]}),u&&(0,U.jsx)(`div`,{style:{fontSize:11,color:`#b54a3a`,fontWeight:700},children:u}),t&&(0,U.jsxs)(`button`,{onClick:()=>n(``),style:{alignSelf:`flex-start`,border:`1px solid ${Q}`,background:`#fff`,borderRadius:8,padding:`4px 10px`,fontSize:11,cursor:`pointer`,display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,U.jsx)(N,{size:11}),` Remove image`]})]})}function pu({onApply:e}){let[t,n]=(0,V.useState)(`idle`),[r,i]=(0,V.useState)([]);return(0,V.useEffect)(()=>{let e=e=>{let t=e.data;!t||t.source!==`pearshow-ext`||t.type===`PEARSHOW_WHATNOT_SCHEDULE`&&Array.isArray(t.shows)&&(i(t.shows),n(t.shows.length?`done`:`n
48o-shows`))};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[]),(0,U.jsxs)(`div`,{style:{marginTop:8,padding:10,borderRadius:10,background:Z,border:`1px solid ${Q}`},children:[(0,U.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:10,flexWrap:`wrap`},children:[(0,U.jsxs)(`div`,{style:{fontSize:12,color:Bl,fontWeight:700},children:[(0,U.jsx)(v,{size:12,style:{verticalAlign:`-2px`,marginRight:4}}),`Auto-import your upcoming shows from Whatnot`]}),(0,U.jsx)(`button`,{onClick:()=>{if(!document.querySelector(`meta[name="pearshow-extension"]`)){n(`no-ext`);return}n(`waiting`),i([]),window.postMessage({source:`pearshow-web`,type:`PEARSHOW_SYNC_WHATNOT`},window.location.origin)},disabled:t===`waiting`,style:{background:X,color:`#fff`,border:0,padding:`6px 12px`,borderRadius:8,fontSize:12,fontWeight:800,cursor:t===`waiting`?`wait`:`pointer`},children:t===`waiting`?`Opening Whatnotâ¦`:`Sync from Whatnot`})]}),t===`no-ext`&&(0,U.jsx)(`div`,{style:{fontSize:11,color:`#b54a3a`,marginTop:6},children:`Install the PearBridge browser extension first, then click again.`}),t===`waiting`&&(0,U.jsx)(`div`,{style:{fontSize:11,color:`var(--pl-muted)`,marginTop:6},children:`We opened your Whatnot Shows tab â click the green "Send schedule to Pear Show" button there.`}),t===`no-shows`&&(0,U.jsx)(`div`,{style:{fontSize:11,color:`var(--pl-muted)`,marginTop:6},children:`No upcoming shows found on that page.`}),t===`done`&&(0,U.jsxs)(`div`,{style:{marginTop:8},children:[(0,U.jsxs)(`div`,{style:{fontSize:11,color:`var(--pl-muted)`,marginBottom:6},children:[`Found `,r.length,` show`,r.length===1?``:`s`,`:`]}),(0,U.jsx)(`ul`,{style:{margin:0,paddingLeft:18,fontSize:12,color:`var(--pl-ink)`},children:r.slice(0,4).map((e,t)=>(0,U.jsxs)(`li`,{children:[e.title,` · `,e.whenLabel]},t))}),(0,U.jsx)(`button`,{onClick:()=>{r.length&&e(r.slice(0,4).map(e=>`${e.title} · ${e.whenLabel}`).join(` ⢠`))},style:{marginTop:8,background:Vl,color:`#fff`,border:0,padding:`6px 12px`,borderRadius:8,fontSize:12,fontWeight:800,cursor:`pointer`},children:`Use these as my schedule`})]})]})}function mu({recommended:e,minimum:t,tips:n}){return(0,U.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`auto 1fr`,gap:10,alignItems:`start`,padding:`10px 12px`,marginBottom:10,borderRadius:12,background:Z,border:`1px solid ${Q}`},children:[(0,U.jsx)(pt,{size:14,color:Bl,style:{marginTop:2}}),(0,U.jsxs)(`div`,{style:{display:`grid`,gap:4,fontSize:12,color:`var(--pl-ink)`},children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{style:{color:Bl},children:`Recommended:`}),` `,e]}),(0,U.jsxs)(`div`,{style:{color:`var(--pl-muted)`},children:[(0,U.jsx)(`strong`,{children:`Minimum:`}),` `,t]}),(0,U.jsx)(`ul`,{style:{margin:`2px 0 0`,paddingLeft:16,color:`var(--pl-muted)`},children:n.map((e,t)=>(0,U.jsx)(`li`,{children:e},t))})]})]})}function hu({images:e,userId:t,onSet:n,onRemove:r,onMove:i,onAdd:a}){let[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(null);return(0,U.jsxs)(`div`,{className:`grid`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(170px,1fr))`,gap:10},children:[e.map((e,a)=>(0,U.jsxs)(`div`,{onDragOver:e=>{o!==null&&(e.preventDefault(),l(a))},onDragLeave:()=>l(e=>e===a?null:e),onDrop:e=>{e.preventDefault(),o!==null&&i(o,a),s(null),l(null)},style:{border:c===a&&o!==null&&o!==a?`2px solid ${X}`:`1px solid ${Q}`,borderRadius:14,overflow:`hidden`,background:`#fff`,transform:o===a?`scale(0.98)`:`none`,opacity:o===a?.6:1,transition:`transform .15s ease, opacity .15s ease`},children:[(0,U.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,padding:`4px 6px 4px 4px`,background:Hl,borderBottom:`1px solid ${Q}`},children:[(0,U.jsxs)(`span`,{draggable:!0,onDragStart:e=>{s(a),e.dataTransfer.effectAllowed=`move`},onDragEnd:()=>{s(null),l(null)},title:`Drag to reorder`,style:{cursor:`grab`,display:`inline-flex`,alignItems:`center`,gap:4,color:`var(--pl-muted)`,fontSize:11,fontWeight:800,padding:`2px 6px`,userSelect:`none`},children:[(0,U.jsx)(dt,{size:12}),` #`,a+1]}),(0,U.jsxs)(`button`,{onClick:()=>r(a),style:{border:`1px solid ${Q}`,background:`#fff`,borderRadius:8,padding:`3px 8px`,fontSize:11,cursor:`pointer`,display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,U.jsx)(N,{size:11}),` Remove`]})]}
48),(0,U.jsx)(fu,{userId:t,value:e,onChange:e=>n(a,e),aspect:`4 / 3`,maxHeight:130,compact:!0})]},a)),e.length<6&&(0,U.jsxs)(`button`,{onClick:a,style:{minHeight:168,border:`2px dashed ${Q}`,borderRadius:14,background:Hl,color:`var(--pl-muted)`,fontWeight:900,cursor:`pointer`,display:`grid`,placeItems:`center`,gap:4},children:[(0,U.jsx)(f,{size:18}),` Add image`]})]})}function gu({url:e,title:t,headline:n}){let[r,i]=(0,V.useState)(!1),a=encodeURIComponent,o=n?`${t} â ${n}`:t,s=[{id:`fb`,label:`Facebook`,color:`#1877F2`,icon:(0,U.jsx)(lt,{size:14}),href:`https://www.facebook.com/sharer/sharer.php?u=${a(e)}`},{id:`tw`,label:`X / Twitter`,color:`#0f1419`,icon:(0,U.jsx)(Et,{size:14}),href:`https://twitter.com/intent/tweet?url=${a(e)}&text=${a(o)}`},{id:`ig`,label:`Instagram`,color:`#E1306C`,icon:(0,U.jsx)(mt,{size:14}),href:`https://www.instagram.com/`},{id:`wa`,label:`WhatsApp`,color:`#25D366`,icon:(0,U.jsx)(he,{size:14}),href:`https://api.whatsapp.com/send?text=${a(o+` `+e)}`},{id:`em`,label:`Email`,color:`#555`,icon:(0,U.jsx)(yt,{size:14}),href:`mailto:?subject=${a(t)}&body=${a(o+` 49 50`+e)}`}],c=async()=>{try{await navigator.clipboard?.writeText(e),i(!0),setTimeout(()=>i(!1),1500)}catch{}},l=async()=>{if(typeof navigator<`u`&&navigator.share)try{await navigator.share({title:t,text:o,url:e})}catch{}else c()},u=e=>{e.id===`ig`&&c(),window.open(e.href,`_blank`,`noopener,noreferrer,width=620,height=540`)};return(0,U.jsxs)(`div`,{style:{display:`inline-flex`,alignItems:`center`,gap:6,flexWrap:`wrap`},children:[(0,U.jsxs)(`button`,{onClick:c,title:`Copy link`,style:{background:Z,color:Bl,border:`1px solid ${Q}`,padding:`8px 12px`,borderRadius:10,fontWeight:800,fontSize:12,cursor:`pointer`,display:`inline-flex`,alignItems:`center`,gap:5},children:[(0,U.jsx)(ot,{size:12}),` `,r?`Copied`:`Copy`]}),(0,U.jsxs)(`div`,{style:{display:`inline-flex`,alignItems:`center`,gap:4,padding:`4px 6px`,borderRadius:10,border:`1px solid ${Q}`,background:`#fff`},children:[s.map(e=>(0,U.jsx)(`button`,{onClick:()=>u(e),title:`Share to ${e.label}${e.id===`ig`?` (link copied)`:``}`,style:{width:30,height:30,borderRadius:8,border:0,cursor:`pointer`,display:`grid`,placeItems:`center`,background:e.color,color:`#fff`},children:e.icon},e.id)),(0,U.jsx)(`button`,{onClick:l,title:`Moreâ¦`,style:{width:30,height:30,borderRadius:8,border:`1px solid ${Q}`,background:`#fff`,color:`var(--pl-ink)`,cursor:`pointer`,display:`grid`,placeItems:`center`},children:(0,U.jsx)(Ct,{size:14})})]})]})}function _u(e){return typeof window>`u`?e:new URL(e,window.location.origin).toString()}function vu(){let[e,t]=(0,V.useState)(!1);return(0,V.useEffect)(()=>{let e=!1;return(async()=>{let{data:n}=await s.auth.getUser(),r=n.user?.id;if(!r){e||t(!1);return}let{checkIsAdmin:i}=await l(async()=>{let{checkIsAdmin:e}=await import(`./admin.functions-CFDf3_0b.js`).then(e=>e.t);return{checkIsAdmin:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])),[a,{data:o}]=await Promise.all([i().catch(()=>({isAdmin:!1})),s.from(`profiles`).select(`marketing_addon`).eq(`id`,r).maybeSingle()]);e||t(a?.isAdmin===!0||!!o?.marketing_addon)})(),()=>{e=!0}},[]),e}var yu=[{label:`Show`,items:[{name:`Home`,icon:P},{name:`Live Show`,icon:ue},{name:`Show Coach`,icon:re}]},{label:`After the show`,items:[{name:`Orders`,icon:le},{name:`Buyers`,icon:oe}]},{label:`Grow`,items:[{name:`Show Insights`,icon:ye},{name:`Compare`,icon:ut},{name:`Marketing`,icon:A}]},{label:`Setup`,items:[{name:`Settings`,icon:d}]}];function bu(e){return e===`combined`?`Combined`:e===`printed`?`Printed`:e===`failed`?`Failed`:e===`packed`?`Packed`:`Queued`}function xu(e){return{buyer:e.buyer_username,number:e.buyer_number??0,item:e.item_title,qty:Number(e.qty??1),total:Number(e.total??e.unit_price??0),status:bu(e.status),buyer_email:e.buyer_email??void 0,shipping_address:e.shipping_address??void 0}}function Su(e=5e3){let t=z(Pe);return R({queryKey:[`recentSales`,e],queryFn:()=>t({data:{limit:e}}),refetchOnWindowFocus:!1})}function Cu(){return R({queryKey:[`show-summaries`],queryFn:async()=>{let{data:e,error:t}=await s.from(`sales`).select(`show_id,total,qty,buyer_username,sold_at,shows(id,title,started_at)`).order(`sold_at`,{ascending:!1}).limit(5e3);if(t)throw Error(t.message);let n=new Map;
50return(e??[]).forEach(e=>{let t=new Date(e.sold_at),r=Array.isArray(e.shows)?e.shows[0]:e.shows,i=e.show_id||t.toISOString().slice(0,10),a=r?.started_at??e.sold_at,o=n.get(i)||{id:i,title:r?.title||t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`}),date:new Date(a).toLocaleDateString(void 0,{month:`short`,day:`numeric`}),gross:0,items:0,buyers:new Set,repeatBuyers:new Set,when:new Date(a).getTime(),startedAt:a},s=String(e.buyer_username??``).toLowerCase();o.gross+=Number(e.total||0),o.items+=Number(e.qty||1),s&&(o.buyers.has(s)&&o.repeatBuyers.add(s),o.buyers.add(s)),n.set(i,o)}),Array.from(n.values()).sort((e,t)=>t.when-e.when).map(e=>({id:e.id,title:e.title,date:e.date,gross:Number(e.gross.toFixed(2)),buyers:e.buyers.size,items:e.items,repeatRate:e.buyers.size?e.repeatBuyers.size/e.buyers.size:0,startedAt:e.startedAt}))},staleTime:3e4})}function wu(){let[e,t]=(0,V.useState)(`Home`),n=be();(0,V.useEffect)(()=>{if(typeof window>`u`)return;let e=new URLSearchParams(window.location.search).get(`page`);e&&t(e)},[]);let[i,a]=(0,V.useState)(!1),[o,c]=(0,V.useState)(!1),[l,u]=(0,V.useState)(null),d=vu();return(0,V.useEffect)(()=>{let e=!1;s.auth.getSession().then(({data:t})=>{if(e)return;let r=t.session;c(!!r),u(r?.user?.email??null),a(!0),r||n({to:`/auth`})});let{data:t}=s.auth.onAuthStateChange((e,t)=>{c(!!t),u(t?.user?.email??null),t||n({to:`/auth`})});return()=>{e=!0,t.subscription.unsubscribe()}},[n]),(0,V.useEffect)(()=>{let e=e=>{if(e.detail?.demo)try{sessionStorage.setItem(`pl.startDemo`,`1`)}catch{}t(`Live Show`)};window.addEventListener(`pl:go-live`,e);let n=e=>{let n=e.detail;n&&t(n)};return window.addEventListener(`pl:nav`,n),()=>{window.removeEventListener(`pl:go-live`,e),window.removeEventListener(`pl:nav`,n)}},[]),!i||!o?(0,U.jsx)(`div`,{className:`pearshow`,style:{minHeight:`100vh`,display:`grid`,placeItems:`center`},children:(0,U.jsx)(`div`,{style:{color:`var(--pl-muted)`},children:`Loadingâ¦`})}):(0,U.jsx)(Ia,{children:(0,U.jsx)(`div`,{className:`pearshow`,children:(0,U.jsxs)(`div`,{className:`app`,children:[(0,U.jsxs)(`aside`,{className:`sidebar`,children:[(0,U.jsx)(`div`,{className:`brand`,style:{paddingBottom:8},children:(0,U.jsx)(`span`,{children:`Pear Show`})}),(0,U.jsxs)(`nav`,{className:`nav`,children:[(0,U.jsx)(Ed,{page:e,setPage:t}),(l??``).toLowerCase()===`[email protected]`?(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h4`,{children:`Admin`}),(0,U.jsxs)(r,{to:`/admin`,children:[(0,U.jsx)(k,{size:16}),` Admin`]})]}):null,(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h4`,{children:`Operations`}),(0,U.jsxs)(r,{to:`/catalog`,title:`Inventory and lots â pulled from Whatnot or uploaded`,children:[(0,U.jsx)(M,{size:16}),` Catalog`]}),(0,U.jsxs)(r,{to:`/pack`,title:`Scan-to-verify packing kiosk`,children:[(0,U.jsx)(ae,{size:16}),` Pack & Verify`]}),(0,U.jsxs)(r,{to:`/giveaways`,title:`Giveaway triggers`,children:[(0,U.jsx)(I,{size:16}),` Giveaways`]}),(0,U.jsxs)(r,{to:`/lost-bidders`,title:`Win back lapsed high-spenders`,children:[(0,U.jsx)(te,{size:16}),` Lost Bidders`]}),d&&(0,U.jsxs)(r,{to:`/moderator`,title:`AI Moderator settings`,children:[(0,U.jsx)(re,{size:16}),` AI Moderator`]}),d&&(0,U.jsxs)(`button`,{onClick:()=>window.open(_u(`/cockpit`),`pearshow_cockpit`,`noopener,width=1600,height=1000`),title:`Big-screen show dashboard â opens in a new window for your TV / 2nd monitor`,children:[(0,U.jsx)(ie,{size:16}),` Cockpit â`]})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h4`,{children:`Account`}),(0,U.jsxs)(r,{to:`/pricing`,children:[(0,U.jsx)(ge,{size:16}),` Pricing`]}),(0,U.jsxs)(r,{to:`/billing`,children:[(0,U.jsx)(j,{size:16}),` Billing`]})]}),(0,U.jsx)(`div`,{style:{marginTop:18,padding:`0 12px`,fontSize:11,color:`#c8d0a4`,opacity:.8,wordBreak:`break-all`},children:l}),(0,U.jsxs)(`button`,{style:{marginTop:8,opacity:.8,fontSize:12},onClick:async()=>{await s.auth.signOut(),n({to:`/auth`})},children:[(0,U.jsx)(ee,{className:`ico`}),` Sign out`]})]})]}),(0,U.jsxs)(`main`,{className:`main`,children:[(0,U.jsxs)(`div`,{className:`topbar`,children:[(0,U.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`14px`,flexWrap:`wrap`},children:[(0,U.jsxs)(`h1`,{children:[e,e===`Live Show`?(0,U.jsxs)(`span`,{className:`pill live`,children:[(0,U.jsx)(`span`,{className:`dot pulse`}),` LIVE`]}):null]}),(0,U.jsx)(`div`,{className:`sub`,style:{marginTop:0},children:Tu(e)})]}),(0,U.jsx)(`div`,{className:`row`,style:{gap:8,alignItems:`center`},children:(0,U.jsx)(wd,{})})]}),(0,U.jsxs)(`div`,{className:`grid`,style:{gap:12},children:[(0,U.jsx)(sn,{}),(0,U.jsx)(Iu,{}),(0,U.jsx)(sf,{}),(0,U.jsx)(Eu,{page:e})]})]})]})})})}function Tu(e){switch(e){case`Home`:return``;case`Live Show`:return`Auto buyer numbers, combined-shipping detection, voice callouts, and one-tap labels.`;case`Show Coach`:return`Your AI co-pilot â DMs, bundle pushes, giveaways, voice callouts, and show recaps.`;case`Orders`:return`Print queue, packer view, reprints, browser preview, and CSV imports.`;
50case`Buyers`:return`Your buyer book. Tag VIPs, see lifetime spend, and remember the regulars.`;case`Show Insights`:return`Your smart dashboard â 12-month trends, top items, best days & hours, and what to do next.`;case`Compare`:return`Side-by-side store performance, platform breakdown, and cross-store buyers.`;case`Marketing`:return`Promote your shows, win back lapsed buyers, and turn your data into posts that fill the room.`;case`Reports`:return`Show performance, archive, side-by-side comparisons, and the trends behind your numbers.`;case`Settings`:return`Your brand, stores, label sizes, printer, team, and billing.`;default:return``}}function Eu({page:e}){switch(e){case`Home`:return(0,U.jsx)(Du,{});case`Live Show`:return(0,U.jsx)(ku,{});case`Show Coach`:return(0,U.jsx)(Bu,{});case`Orders`:return(0,U.jsx)(ed,{});case`Buyers`:return(0,U.jsx)(sd,{});case`Show Insights`:return(0,U.jsx)(Bd,{});case`Compare`:return(0,U.jsx)(Od,{});case`Marketing`:return(0,U.jsx)(Id,{});case`Reports`:return(0,U.jsx)(ld,{});case`Settings`:return(0,U.jsx)(md,{});default:return(0,U.jsx)(Du,{})}}function Du(){let[e,t]=(0,V.useState)(null),n=()=>t(null),[r,i]=(0,V.useState)(()=>{try{return JSON.parse(localStorage.getItem(`pl:upcomingWhatnotShows`)||`[]`)}catch{return[]}}),[a,o]=(0,V.useState)(``),[c,l]=(0,V.useState)(!1);(0,V.useEffect)(()=>{let e=e=>{let t=e.data;!t||t.source!==`pearshow-ext`||(t.type===`PEARSHOW_EXT_READY`&&l(!0),t.type===`PEARSHOW_WHATNOT_SCHEDULE`&&Array.isArray(t.shows)&&(i(t.shows),localStorage.setItem(`pl:upcomingWhatnotShows`,JSON.stringify(t.shows)),o(`Synced ${t.shows.length} upcoming show${t.shows.length===1?``:`s`} from Whatnot.`)),t.type===`PEARSHOW_WHATNOT_SYNC_STARTED`&&o(`Opening your Whatnot dashboard â click the green 'Send to Pear Show' button on that page.`),t.type===`PEARSHOW_WHATNOT_SYNC_ERROR`&&o(t.error||`Sync failed.`))};return window.addEventListener(`message`,e),window.postMessage({source:`pearshow-web`,type:`PEARSHOW_PING`},window.location.origin),()=>window.removeEventListener(`message`,e)},[]);let u=()=>{if(!c){o(`Install the Pear Show extension first â Getting Started â Step 2.`);return}o(`Asking extension to open Whatnotâ¦`),window.postMessage({source:`pearshow-web`,type:`PEARSHOW_SYNC_WHATNOT`},window.location.origin)},{data:d}=R({queryKey:[`home-live-stats`],queryFn:async()=>{let{data:e}=await s.from(`sales`).select(`show_id,total,qty,buyer_username,sold_at`).order(`sold_at`,{ascending:!1}).limit(5e3),t=e||[],n=new Map;t.forEach(e=>{let t=new Date(e.sold_at),r=e.show_id||t.toISOString().slice(0,10),i=n.get(r)||{key:r,date:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`}),gross:0,items:0,buyers:new Set,when:t.getTime()};i.gross+=Number(e.total||0),i.items+=Number(e.qty||1),e.buyer_username&&i.buyers.add(String(e.buyer_username).toLowerCase()),t.getTime()>i.when&&(i.when=t.getTime()),n.set(r,i)});let r=Array.from(n.values()).sort((e,t)=>t.when-e.when).map((e,t)=>({id:e.key,title:`Show ${t+1}`,date:e.date,gross:Math.round(e.gross),buyers:e.buyers.size,items:e.items,repeatRate:0}));return{shows:r,lifetimeGross:r.reduce((e,t)=>e+t.gross,0),lifetimeItems:r.reduce((e,t)=>e+t.items,0)}},staleTime:3e4}),f=d?.shows??[],p=f.length>0,m=p?f[0]:{id:`empty`,title:`No shows yet`,date:`â`,gross:0,buyers:0,items:0,repeatRate:0},h=f.slice(0,6).slice().reverse().map(e=>e.gross),g=d?.lifetimeGross??0,_=d?.lifetimeItems??0,v=p?Math.round(g/f.length):0,y=p?[`Last synced show grossed $${m.gross.toLocaleString()} across ${m.buyers} buyer${m.buyers===1?``:`s`}.`,`${m.items} item${m.items===1?``:`s`} sold in the latest show.`,`Keep the extension connected while browsing Whatnot so Pear Show can keep filling this in.`]:[`No sales insights yet â connect the extension and open your Whatnot dashboard to populate this with real data.`],b=Math.max(...h,1);return(0,U.jsxs)(`div`,{className:`grid`,children:[(0,U.jsxs)(`div`,{className:`cols4`,children:[(0,U.jsx)($,{label:`Last show gross`,value:p?`$${m.gross.toLocaleString()}`:`â`,sub:p?`click to drill in`:`no sales yet`,onClick:p?()=>t(e===`gross`?null:`gross`):void 0,active:e===`gross`}),(0,U.jsx)($,{label:`Buyers`,value:p?String(m.buyers):`â`,sub:p?`drill in`:`waiting on Whatnot sync`,onClick:p?()=>t(e===`buyers`?null:`buyers`):void 0,active:e===`buyers`}),(0,U.jsx)($,{label:`Items sold`,value:p?String(m.items):`â`,sub:p&&m.items?`$${(m.gross/m.items).toFixed(2)} avg · drill in`:`waiting on Whatnot sync`,onClick:p?()=>t(e===`items`?null:`items`):void 0,active:e===`items`}),(0,U.jsx)($,{label:`Labels printed`,value:p?String(Math.max(0,m.items-7)):`â`,sub:p?`drill in`:`waiting on Whatnot sync`,onClick:p?()=>t(e===`labels`?null:`labels`):void 0,active:e===`labels`})]}),e&&p&&(0,U.jsx)(Ou,{which:e,show:m,onClose:n}),(0,U.jsxs)(`div`,{className:`cols4`,children:[(0,U.jsx)($,{label:`Lifetime gross`,value:p?`$${g.toLocaleStr
50ing()}`:`â`,sub:p?`across ${f.length} show${f.length===1?``:`s`}`:`no sales yet`}),(0,U.jsx)($,{label:`Lifetime items`,value:p?String(_):`â`,sub:p&&_?`$${(g/_).toFixed(2)} avg / item`:`no items yet`}),(0,U.jsx)($,{label:`Avg show gross`,value:p?`$${v.toLocaleString()}`:`â`,sub:p?m.gross>v?`last show beat avg by $${(m.gross-v).toLocaleString()}`:`last show $${(v-m.gross).toLocaleString()} under avg`:`no shows yet`}),(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsx)(`div`,{className:`muted`,style:{fontSize:11,textTransform:`uppercase`,letterSpacing:.6},children:`Last 6 shows`}),(0,U.jsx)(`div`,{style:{display:`flex`,alignItems:`flex-end`,gap:6,height:56,marginTop:8},children:h.length?h.map((e,t)=>(0,U.jsx)(`div`,{title:`$${e.toLocaleString()}`,style:{flex:1,background:`linear-gradient(180deg, #5d8bb8, #2f4a6b)`,opacity:.35+e/b*.65,height:`${Math.max(8,e/b*100)}%`,borderRadius:3,cursor:`pointer`}},t)):(0,U.jsx)(`div`,{className:`muted`,style:{fontSize:12},children:`No shows yet â sync from Whatnot to see your trend.`})}),(0,U.jsx)(`div`,{className:`muted`,style:{fontSize:11,marginTop:6},children:f.length?`${f[f.length-1].date} â ${f[0].date}`:`â`})]})]}),(0,U.jsx)(pf,{}),(0,U.jsxs)(`div`,{className:`cols2 grid`,children:[(0,U.jsxs)(`div`,{className:`card`,style:{borderLeft:`3px solid var(--pl-accent, #9c6b2f)`},children:[(0,U.jsxs)(`div`,{className:`between`,children:[(0,U.jsxs)(`h3`,{style:{margin:0,display:`flex`,alignItems:`center`,gap:6},children:[(0,U.jsx)(gt,{size:16}),` Coach tips`]}),(0,U.jsx)(`span`,{className:`pill`,children:`today`})]}),(0,U.jsx)(`ul`,{style:{margin:`10px 0 0 18px`,padding:0,lineHeight:1.6},children:y.map((e,t)=>(0,U.jsx)(`li`,{children:e},t))})]}),(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsxs)(`div`,{className:`between`,children:[(0,U.jsxs)(`h3`,{style:{margin:0,display:`flex`,alignItems:`center`,gap:6},children:[(0,U.jsx)(ue,{size:16}),` Next show`]}),(0,U.jsx)(`span`,{className:`pill`,children:`suggested`})]}),(0,U.jsxs)(`div`,{style:{marginTop:10,fontSize:20,fontWeight:700},children:[`Saturday · `,Ma(19),`â`,Ma(20)]}),(0,U.jsxs)(`div`,{className:`muted`,style:{fontSize:13,marginTop:4},children:[`Your peak window â Saturday 7â8 PM shows average `,(0,U.jsxs)(`b`,{children:[`$`,Math.round(v*1.18)]}),` gross.`]}),(0,U.jsxs)(`div`,{className:`actions`,style:{marginTop:12},children:[!c&&(0,U.jsxs)(`button`,{className:`primary`,onClick:u,title:`Reads your scheduled shows from whatnot.com via the Pear Show extension`,children:[(0,U.jsx)(rt,{size:14}),` Sync from Whatnot`]}),(0,U.jsxs)(`button`,{className:`ghost`,onClick:()=>window.dispatchEvent(new CustomEvent(`pl:nav`,{detail:`Marketing`})),children:[(0,U.jsx)(A,{size:14}),` Draft promo`]})]}),c?(0,U.jsx)(`div`,{className:`muted`,style:{fontSize:11,marginTop:8,lineHeight:1.4,color:`#3b6b1f`},children:`â Auto-syncing from Whatnot via the extension â nothing for you to do.`}):(0,U.jsx)(`div`,{className:`muted`,style:{fontSize:11,marginTop:8,lineHeight:1.4},children:`Whatnot, TikTok, and Facebook don't accept programmatic scheduling â Pear Show reads your Whatnot schedule via the extension and plans the rest internally.`}),a&&(0,U.jsx)(`div`,{style:{fontSize:12,marginTop:8,color:`#3b6b1f`},children:a}),r.length>0&&(0,U.jsxs)(`div`,{style:{marginTop:12,borderTop:`1px solid var(--pl-line, #e
506e2d0)`,paddingTop:10},children:[(0,U.jsx)(`div`,{className:`muted`,style:{fontSize:11,textTransform:`uppercase`,letterSpacing:.6,marginBottom:6},children:`Upcoming on Whatnot`}),r.slice(0,5).map((e,t)=>(0,U.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,gap:8,fontSize:13,padding:`4px 0`},children:[(0,U.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.title||`Untitled show`}),(0,U.jsx)(`span`,{className:`muted`,style:{whiteSpace:`nowrap`},children:e.whenLabel})]},t))]})]})]})]})}function Ou({which:e,show:t,onClose:n}){return(0,U.jsxs)(`div`,{className:`card`,style:{borderLeft:`3px solid var(--pl-accent, #9c6b2f)`},children:[(0,U.jsxs)(`div`,{className:`between`,children:[(0,U.jsx)(`h3`,{style:{margin:0},children:e===`gross`?`${t.title} â gross breakdown`:e===`buyers`?`${t.title} â buyer breakdown`:e===`items`?`${t.title} â items sold`:`${t.title} â labels printed`}),(0,U.jsxs)(`button`,{className:`ghost`,onClick:n,style:{padding:`4px 10px`},children:[(0,U.jsx)(p,{size:12}),` Close`]})]}),e===`gross`&&(0,U.jsxs)(`div`,{className:`grid cols2`,style:{marginTop:12},children:[(0,U.jsx)($,{label:`Gross`,value:`$${t.gross}`}),(0,U.jsx)($,{label:`AOV / item`,value:t.items?`$${(t.gross/t.items).toFixed(2)}`:`â`}),(0,U.jsx)($,{label:`$ per buyer`,value:t.buyers?`$${(t.gross/t.buyers).toFixed(2)}`:`â`}),(0,U.jsx)($,{label:`Repeat rate`,value:`${Math.round(t.repeatRate*100)}%`})]}),e===`buyers`&&(0,U.jsx)(`div`,{className:`note`,style:{marginTop:10},children:`Buyer-level detail appears here after individual Whatnot order rows sync.`}),(e===`items`||e===`labels`)&&(0,U.jsx)(`div`,{className:`note`,style:{marginTop:10},children:`Item-level detail appears here after Whatnot order rows sync.`})]})}function ku(){let e=Ne();vu();let t=z(we),n=z(Be),r=z(Se),{data:i}=R({queryKey:[`activeShowSales`],queryFn:()=>t(),refetchInterval:1500,refetchOnWindowFocus:!1}),a=(0,V.useMemo)(()=>(i?.sales??[]).map(e=>({buyer:e.buyer_username,number:e.buyer_number??0,item:e.item_title,qty:e.qty,total:Number(e.unit_price),status:e.status===`combined`?`Combined`:e.status===`printed`?`Printed`:e.status===`failed`?`Failed`:`Queued`,tag:void 0})),[i]),o=u({mutationFn:e=>n({data:{...e,qty:1}}),onSuccess:()=>e.invalidateQueries({queryKey:[`activeShowSales`]})}),[s,c]=(0,V.useState)(``),[l,d]=(0,V.useState)(``),[f,p]=(0,V.useState)(``),[m,h]=(0,V.useState)(!1),[v,y]=(0,V.useState)(!1),[x,S]=(0,V.useState)(null),[C,T]=(0,V.useState)(!1);(0,V.useEffect)(()=>{try{sessionStorage.getItem(`pl.startDemo`)===`1`&&(sessionStorage.removeItem(`pl.startDemo`),y(!0))}catch{}},[]);let[E,D]=(0,V.useState)(null),[O,k]=(0,V.useState)(()=>g.get()),A=e=>{k(e),g.set(e)},[j,M]=(0,V.useState)([]),[N,ee]=(0,V.useState)(!1),te=(0,V.useMemo)(()=>[],[]),ne={id:`whatnot`,platform:`Whatnot`,handle:`Not detected`,title:`Open Whatnot Live with the extension connected`},[re,ie]=(0,V.useState)(ne.id),[ae,oe]=(0,V.useState)(!1),P=te.find(e=>e.id===re)??ne;(0,V.useEffect)(()=>{$t();let e=Xt(M);return()=>{e()}},[]);let se=(0,V.useRef)(new Set),ce=(0,V.useRef)(null);(0,V.useRef)(null),(0,V.useRef)(null);let ue=(0,V.useMemo)(()=>{let e=new Map,t=1;for(let n of a)e.has(n.buyer)||e.set(n.buyer,t++);return e},[a]),de=a.reduce((e,t)=>e+t.total*t.qty,0),fe=a.length-new Set(a.map(e=>e.buyer)).size,pe=ue.size+1,F=(0,V.useRef)(new Set),me=e=>`${e.buyer}|${e.number}|${e.item}|${e.total}`,he=()=>{qe(),a.forEach(e=>F.current.add(me(e))),h(!0);let e=_.get();e.enabled||_.set({...e,enabled:!0,announceSale:!0,announceCombine:!0})},I=(e,t,n)=>{let r=_.get();if(!m&&!r.enabled||e===`sale`&&!r.announceSale||e===`combine`&&!r.announceCombine||e===`winner`&&!r.announceWinner)return;let i=(r.scenarios||[]).find(t=>t.event===e&&t.enabled);if(!i&&!n)return;let a=i?.channel??`private`;if(a===`public`&&!r.publicEnabled)return;let o=i?.line||n||``,s=t.amount==null?``:`$${t.amount.toFixed(2)}`,c=o.replace(/\{buyer\}/g,String(t.buyer??``)).replace(/\{number\}/g,String(t.number??``)).replace(/\{amount\}/g,s).replace(/\{item\}/g,String(t.item??``));if(!c.trim())return;S({text:c,at:Date.now()});let l=a===`public`?r.publicVoiceURI||`hype-coach`:r.voiceURI||`nova`;Je(c,{voice:i?.voice||l,speed:a===`public`?r.publicRate||1:r.rate||1,channel:a,sinkId:a===`public`?r.publicSinkId:r.privateSinkId}).catch(()=>{})},ge=(e,t,n,r)=>{let i=String(e||``).trim().replace(/^@/,``),a=String(t||``).trim()||`Item`,s=typeof n==`
50number`?n:parseFloat(String(n||``))||0;!i||!s||o.mutate({buyer_username:i,item_title:a,unit_price:s},{onSuccess:e=>{let t=_.get(),n=e?.status===`combined`,o=e?.buyer_username??i,c=e?.buyer_number??``,l=Number(e?.unit_price??s)||0,u=e?.item_title??a;F.current.add(`${o}|${c}|${u}|${l}`);let d=!se.current.has(`${o}`);n?I(`combine`,{buyer:o,number:c,amount:l,item:u}):l>=(t.bigSaleThreshold||50)?I(`big_sale`,{buyer:o,number:c,amount:l,item:u}):I(`sale`,{buyer:o,number:c,amount:l,item:u}),!n&&d&&I(`first_time_buyer`,{buyer:o,number:c,amount:l,item:u}),(n?`combine`:`sale`)==`combine`&&(D({buyer:e?.buyer_username??i,number:e?.buyer_number??0}),setTimeout(()=>D(null),4e3));let f=w.get(),p=String(e?.id??`${Date.now()}-${Math.random()}`),m=typeof window<`u`&&e?.id?`${window.location.origin}/tag/${e.id}`:void 0,h=`${o}`,v=!se.current.has(h),y=g.get();if(y===`every_item`||y===`both`){en({saleId:`${p}:item`,mode:`item`,platform:P.platform,payload:{buyer:o,number:Number(c)||0,item:u,design:f,tagUrl:m}});let t=String(e?.id??``).slice(0,8);t&&tt({data:{sale_id:e?.id??null,tag_code:t,matched:!1,note:`tag printed (item)`}}).catch(()=>{})}if(y===`once_per_buyer`&&v||y===`both`&&v){en({saleId:`${h}:buyer`,mode:`buyer`,platform:P.platform,payload:{buyer:o,number:Number(c)||0,item:u,design:f,tagUrl:m}});let t=String(e?.id??``).slice(0,8);t&&tt({data:{sale_id:e?.id??null,tag_code:t,matched:!1,note:`tag printed (buyer)`}}).catch(()=>{})}se.current.add(h),r?.()}})},[_e,ye]=(0,V.useState)(!1),[be,xe]=(0,V.useState)(``),[L,Ce]=(0,V.useState)(``),[Te,Ee]=(0,V.useState)(``),De=(0,V.useRef)(null),Oe=()=>{xe(``),Ce(l||``),Ee(f||``),ye(!0),setTimeout(()=>De.current?.focus(),30)},ke=()=>{!be.trim()||!parseFloat(Te)||(he(),ge(be,L||`Item`,Te),ye(!1))};(0,V.useEffect)(()=>{for(let e of a){let t=me(e);if(F.current.has(t)||(F.current.add(t),!m&&!_.get().enabled))continue;let n=e.status===`Combined`,r=Number(e.total)||0,i=_.get();n?I(`combine`,{buyer:e.buyer,number:e.number,amount:r,item:e.item}):r>=(i.bigSaleThreshold||50)?I(`big_sale`,{buyer:e.buyer,number:e.number,amount:r,item:e.item}):I(`sale`,{buyer:e.buyer,number:e.number,amount:r,item:e.item})}},[a,m]),(0,V.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.shiftKey&&e.key.toLowerCase()===`s`&&(e.preventDefault(),Oe())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[l,f]),(0,V.useEffect)(()=>{let e=e=>{let t=e.target?.tagName,n=t===`INPUT`||t===`TEXTAREA`;if(e.key===`/`&&!n&&(e.preventDefault(),ce.current?.focus()),(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`p`){e.preventDefault();let t=a[a.length-1];t&&en({mode:`item`,platform:P.platform,payload:{buyer:t.buyer,number:ue.get(t.buyer)??t.number,item:t.item,design:w.get()}})}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[a,ue]),(0,V.useEffect)(()=>{if(!v)return;he();let e=[`sneakerhead22`,`cardking`,`vintage_vinny`,`boutique_bri`,`kc_collects`],t=[`Jordan 4 retro`,`PSA 9 Pikachu`,`Vintage tee L`,`Charm bracelet`,`Funko Batman`],n=setInterval(()=>{let n=e[Math.floor(Math.random()*e.length)],r=t[Math.floor(Math.random()*t.length)],i=Math.round((Math.random()*40+8)*100)/100;o.mutate({buyer_username:n,item_title:r,unit_price:i},{onSuccess:e=>{let t=_.get(),a=e?.status===`combined`,o=e?.buyer_username??n,s=e?.buyer_number??0,c=Number(e?.unit_price??i)||0,l=e?.item_title??r;F.current.add(`${o}|${s}|${l}|${c}`),a?(D({buyer:o,number:Number(s)||0}),setTimeout(()=>D(null),4e3),I(`combine`,{buyer:o,number:s,amount:c,item:l})):c>=(t.bigSaleThreshold||50)?I(`big_sale`,{buyer:o,number:s,amount:c,item:l}):I(`sale`,{buyer:o,number:s,amount:c,item:l})}})},8500);return()=>clearInterval(n)},[v]);let Ae=(0,V.useMemo)(()=>j.filter(e=>e.payload).slice(-5).reverse().map(e=>({key:e.id,buyer:e.payload.buyer,number:e.payload.number,item:e.payload.item,design:e.payload.design,tagUrl:e.payload.tagUrl})),[j]),je=(0,V.useMemo)(()=>{let e=w.get();return a.slice(-5).reverse().map((t,n)=>({key:`feed-${n}-${t.buyer}-${t.item}`,buyer:t.buyer,number:ue.get(t.buyer)??t.number,item:t.item,design:e,tagUrl:void 0}))},[a,ue]),Me=Ae.length?Ae:je,Pe=a[a.length-1],Fe=Me[0]??null;return(0,U.jsxs)(`div`,{className:`grid`,children:[(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsxs)(`div`,{className:`between`,style:{flexWrap:`wrap`,gap:10},children:[(0,U.jsxs)(`h3`,{className:`row`,style:{margin:0,gap:10,flexWrap:`wrap`},children:[(0,U.jsx)(`span`,{className:v?`dot pulse`:`dot`,style:v?void 0:{background:`#9aa37f`,boxShadow:`none`}}),` `,v?`Current show`:`No show running`,(0,U.jsx)(`span`,{className:`pill`,style:{marginLeft:6,background:`var(--accent, #5a8f3a)`,color:`#fff`,fontWeight:700},children:`BOUND TO`}),(0,U.jsxs)(`div`,{style:{position:`relative`},children:[te.length>1?(0,U.jsxs)(`button`,{onClick:()=>oe(e=>!e),style:{display:`inline-flex`,alignItems:`center`,gap:8,background:`#fff`,color:`var(--pl-ink)`,border:`1px solid var(--pl-line-strong)`,borderRadius:8,padding:`6px 10px`,fontWeight:600,fontSize:13,cursor:`pointer`},title:`Switch which live stream PearShow is tagging sales to`,children:[(0,U.jsx)(`span`,{style:{color:`var(--pl-muted)`,fontSize:11,textTransform:`uppercase`,letterSpacing:.5},children:P.platform}),(0,U.jsx)(`strong`,{children:P.handle}),(0,U.jsxs)(`span`,{style:{color:`var(--pl-muted)`},children:[`· `,P.title]}),(0,U.jsx)(`span`,{style:{color:`var(--pl-muted)`,marginLeft:2},children:`â¾`})]}):(0,U.jsxs)(`div`,{style:{display:`inline-flex`,alignItems:`center`,gap:8,background:`#fff`,color:`var(--pl-ink)`,border:`1px solid var(--pl-line-strong)`,borderRadius:8,padding:`6px 10px`,fontWeight:600,fontSize:13},children:[(0,U.jsx)(`span`,{style:{color:`var(--pl-muted)`,fontSize:11,textTransform:`uppercase`,letterSpacing:.5},children:P.platform}),(0,U.jsx)(`strong`,{children:P.handle}),(0,U.jsxs)(`span`,{style:{color:`var(--pl-muted)`},children:[`· `,P.title]})]}),ae&&te.length>1?(0,U.jsxs)(`div`,{style:{position:`absolute`,top:`calc(100% + 6px)`,left:0,zIndex:50,background:`#fff`,color:`var(--pl-ink)`,border:`1px solid var(--pl-line-strong)`,borderRadius:10,boxShadow:`0 12px 32px rgba(0,0,0,.18)`,minWidth:320,padding:6},children:[(0,U.jsxs)(`div`,{style:{padding:`6px 10px`,fontSize:11,textTransform:`uppercase`,letterSpacing:.5,color:`var(--pl-muted)`},children:[te.length,` detected streams`]}),te.map(e=>{let t=e.id===re;return(0,U.jsxs)(`button`,{onClick:()=>{ie(e.id),oe(!1)},style:{display:`flex`,width:`100%`,alignItems:`center`,gap:10,padding:`8px 10px`,borderRadius:6,cursor:`pointer`,background:t?`var(--pl-cream)`:`transparent`,border:`none`,textAlign:`left`,color:`var(--pl-ink)`},children:[(0,U.jsx)(`span`,{style:{width:8,height:8,borderRadius:999,background:t?`var(--accent, #5a8f3a)`:`#cbd5e1`}}),(0,U.jsxs)(`div`,{style:{flex:1},children:[(0,U.jsxs)(`div`,{style:{fontWeight:700,fontSize:13},children:[e.handle,` `,(0,U.jsxs)(`span`,{style:{color:`var(--pl-muted)`,fontWeight:500},children:[`· `,e.platform]})]}),(0,U.jsx)(`div`,{style:{fontSize:12,color:`var(--pl-muted)`},children:e.title})]}),e.viewers==null?null:(0,U.jsxs)(`span`,{className:`pill`,style:{fontSize:11},children:[e.viewers,` watching`]}),t?(0,U.jsx)(`span`,{style:{fontSize:11,fontWeight:700,color:`var(--accent, #5a8f3a)`},children:`BOUND`}):null]},e.id)}),(0,U.jsx)(`div`,{style:{padding:`8px 10px`,fontSize:11,color:`var(--pl-muted)`,borderTop:`1px solid var(--pl-line)`,marginTop:4},children:`Streams come from the browser extension on any open tab. Switch tabs to add more.`})]}):null]})]}),(0,U.jsxs)(`div`,{className:`actions`,style:{flexWrap:`wrap`},children:[(0,U.jsx)(Ku,{feed:a}),(0,U.jsx)(ju,{jobs:j,onOpen:()=>ee(!0)})]})]}),(0,U.jsx)(wa,{open:C,onOpenChange:T,children:(0,U.jsxs)(Da,{className:`border border-[#e6e2d0] bg-white text-[#2a3318] shadow-xl sm:rounded-xl max-w-sm`,children:[(0,U.jsxs)(Oa,{children:[(0,U.jsxs)(Aa,{className:`flex items-center gap-2 text-[var(--pl-ink)] font-bold uppercase tracking-wide text-sm`,children:[(0,U.jsx)(Tt,{size:16,className:`text-[var(--pl-red)]`}),`End this show?`]}
50),(0,U.jsx)(ja,{className:`text-[var(--pl-muted)] text-sm leading-relaxed`,children:`This will close this show session and reset sales. Are you sure you want to end the show now?`})]}),(0,U.jsxs)(ka,{className:`flex flex-row gap-3 justify-end`,children:[(0,U.jsx)(`button`,{className:`ghost`,onClick:()=>T(!1),style:{padding:`9px 14px`,fontSize:12},children:`Keep show running`}),(0,U.jsx)(`button`,{className:`danger`,onClick:async()=>{T(!1),await r(),e.invalidateQueries({queryKey:[`activeShowSales`]})},style:{padding:`9px 14px`,fontSize:12},children:`End show`})]})]})}),(0,U.jsx)(wa,{open:_e,onOpenChange:ye,children:(0,U.jsxs)(Da,{className:`border border-[#e6e2d0] bg-white text-[#2a3318] shadow-xl sm:rounded-xl max-w-md`,children:[(0,U.jsxs)(Oa,{children:[(0,U.jsxs)(Aa,{className:`flex items-center gap-2 text-[var(--pl-ink)] font-bold uppercase tracking-wide text-sm`,children:[(0,U.jsx)(ve,{size:16,className:`text-[var(--pl-red,#fe2c55)]`}),`Capture sold · `,P.platform]}),(0,U.jsx)(ja,{className:`text-[var(--pl-muted)] text-xs leading-relaxed`,children:`Buyer is required. Item and price prefill from the quick-sale form â edit if needed, then Enter to print.`})]}),(0,U.jsxs)(`div`,{className:`form`,style:{marginTop:8,display:`grid`,gap:8},children:[(0,U.jsx)(`input`,{"aria-label":`@buyer handle`,ref:De,placeholder:`@buyer handle`,value:be,onChange:e=>xe(e.target.value),onKeyDown:e=>{e.key===`Enter`&&ke()},style:{fontSize:18,padding:`12px 12px`,fontWeight:600}}),(0,U.jsx)(`input`,{"aria-label":`Item title`,placeholder:`Item title`,value:L,onChange:e=>Ce(e.target.value),onKeyDown:e=>{e.key===`Enter`&&ke()},style:{fontSize:16,padding:`10px 12px`}}),(0,U.jsx)(`input`,{"aria-label":`Price`,placeholder:`Price`,value:Te,onChange:e=>Ee(e.target.value),onKeyDown:e=>{e.key===`Enter`&&ke()},style:{fontSize:20,padding:`10px 12px`,fontWeight:700,maxWidth:140}})]}),(0,U.jsxs)(ka,{className:`flex flex-row gap-3 justify-end`,style:{marginTop:4},children:[(0,U.jsx)(`button`,{className:`ghost`,onClick:()=>ye(!1),style:{padding:`9px 14px`,fontSize:12},children:`Cancel (Esc)`}),(0,U.jsxs)(`button`,{className:`primary`,onClick:ke,style:{padding:`9px 14px`,fontSize:12},children:[(0,U.jsx)(le,{size:12}),` Print tag`]})]})]})}),(0,U.jsxs)(`div`,{className:`cols3 grid`,style:{marginTop:14},children:[(0,U.jsx)($,{label:`Gross`,value:`$${de.toFixed(0)}`}),(0,U.jsx)($,{label:`Buyers`,value:String(ue.size)}),(0,U.jsx)($,{label:`Combined`,value:String(fe)})]}),(0,U.jsxs)(`div`,{style:{marginTop:10,fontSize:12,color:`var(--pl-muted)`},"aria-live":`polite`,children:[`Voice status: `,x?`speaking â ${x.text}`:m?`armed for the next sale`:`off`]}),(0,U.jsxs)(`div`,{className:`cols2 grid`,style:{marginTop:12},children:[(0,U.jsxs)(`div`,{className:`card`,style:{padding:`16px 18px`,display:`flex`,alignItems:`center`,gap:16,position:`relative`,overflow:`hidden`},children:[(0,U.jsx)(`div`,{style:{position:`absolute`,left:0,top:0,bottom:0,width:4,background:`var(--accent, #5a8f3a)`}}),(0,U.jsxs)(`div`,{style:{flex:1},children:[(0,U.jsx)(`div`,{className:`kicker`,children:`Next box #`}),(0,U.jsx)(`div`,{style:{fontSize:12,color:`var(--pl-muted)`,marginTop:4},children:`auto-assigned on next new buyer`})]}),(0,U.jsxs)(`div`,{style:{fontSize:56,fontWeight:800,lineHeight:1,fontVariantNumeric:`tabular-nums`,color:`var(--accent, #5a8f3a)`},children:[`#`,pe]})]}),(0,U.jsxs)(`div`,{className:`card`,style:{padding:`16px 18px`,border:E?`2px solid #e8a13d`:void 0,background:E?`rgba(232,161,61,0.12)`:void 0,transition:`all 200ms`},children:[(0,U.jsx)(`div`,{className:`kicker`,children:`Combined shipping`}),E?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{style:{fontSize:22,fontWeight:700},children:[`+ `,E.buyer,` (#`,E.number,`)`]}),(0,U.jsx)(`div`,{style:{fontSize:12,color:`var(--pl-muted)`},children:`Added to existing box â don't print a new label.`})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{style:{fontSize:22,fontWeight:700},children:`Watchingâ¦`}),(0,U.jsx)(`div`,{style:{fontSize:12,color:`var(--pl-muted)`},children:`I flash a banner here when a buyer repeats.`})]})]})]}
50),(0,U.jsxs)(`div`,{className:`grid cols2`,style:{marginTop:12},children:[(0,U.jsxs)(`div`,{className:`card`,style:{padding:`12px 14px`},children:[(0,U.jsx)(`div`,{className:`kicker`,children:`Print mode`}),(0,U.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(3, 1fr)`,gap:8,marginTop:8},children:[[`once_per_buyer`,`Once per buyer`,`1 label / buyer`],[`every_item`,`Every item`,`1 label / win`],[`both`,`Both`,`buyer + item`]].map(([e,t,n])=>{let r=O===e;return(0,U.jsxs)(`button`,{onClick:()=>A(e),className:r?`primary`:`ghost`,style:{display:`flex`,flexDirection:`column`,alignItems:`center`,gap:6,padding:`10px 6px`,fontSize:12,lineHeight:1.1,height:`auto`,whiteSpace:`normal`,textAlign:`center`},title:n,children:[(0,U.jsx)(Gu,{mode:e,active:r}),(0,U.jsx)(`span`,{style:{fontWeight:600},children:t}),(0,U.jsx)(`span`,{style:{fontSize:10,opacity:.75},children:n})]},e)})}),(0,U.jsxs)(`div`,{style:{fontSize:11,color:`var(--pl-muted)`,marginTop:6},children:[O===`once_per_buyer`&&`One label per buyer per show â same buyer wins again, same box.`,O===`every_item`&&`A label prints for every win so you can tag each item.`,O===`both`&&`Item label every win + a buyer label on the first win.`]})]}),(0,U.jsx)(Ju,{voiceOn:m,setVoiceOn:h})]})]}),(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsxs)(`div`,{style:{marginBottom:12},children:[(0,U.jsx)(`div`,{className:`kicker`,children:`Last label`}),(0,U.jsx)(`div`,{className:`muted`,style:{fontSize:14,marginTop:4},children:`The last five labels printed during this show.`})]}),(0,U.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(5, minmax(0, 1fr))`,gap:6,alignItems:`start`},children:Array.from({length:5}).map((e,t)=>{let n=Me[t];return(0,U.jsxs)(`div`,{style:{minWidth:0},children:[(0,U.jsx)(`div`,{style:{minHeight:80,display:`flex`,alignItems:`flex-end`},children:(0,U.jsx)(Yd,{buyer:n?.buyer??``,number:n?.number??0,item:n?.item??``,design:n?.design??w.get(),tagUrl:n?.tagUrl})}),(0,U.jsxs)(`button`,{className:`ghost`,disabled:!n,style:{width:`100%`,marginTop:6,justifyContent:`center`,fontSize:12,padding:`10px 12px`},onClick:()=>{n&&en({mode:`item`,platform:P.platform,payload:{buyer:n.buyer,number:n.number,item:n.item,design:n.design,tagUrl:n.tagUrl}})},children:[(0,U.jsx)(le,{size:13}),` Reprint`]})]},t)})}),(0,U.jsxs)(`div`,{style:{display:`flex`,alignItems:`stretch`,gap:8,flexWrap:`wrap`,marginTop:12},children:[(0,U.jsxs)(`button`,{className:`secondary`,onClick:()=>window.print(),children:[(0,U.jsx)(le,{size:14}),` Browser print`]}),(0,U.jsxs)(`button`,{className:`ghost`,disabled:!Fe&&!Pe,onClick:async()=>{let e=Fe;!e&&!Pe||en({mode:`item`,platform:P.platform,payload:e?{buyer:e.buyer,number:e.number,item:e.item,design:e.design,tagUrl:e.tagUrl}:{buyer:Pe.buyer,number:ue.get(Pe.buyer)??Pe.number,item:Pe.item,design:w.get()}})},children:[(0,U.jsx)(le,{size:14}),` Reprint last`]}),(0,U.jsx)(Ru,{printJobs:j,activePlatform:P.platform})]}),(0,U.jsx)(Lu,{})]}),(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsxs)(`div`,{className:`between`,children:[(0,U.jsx)(`h3`,{style:{margin:0},children:`Live sale feed`}),(0,U.jsxs)(`span`,{className:`pill`,children:[(0,U.jsx)(b,{size:10}),` `,a.length,` sales`]})]}),(0,U.jsx)($d,{feed:a,numbers:ue})]}),N&&(0,U.jsx)(zu,{jobs:j,onClose:()=>ee(!1)}),(0,U.jsx)(Au,{feedCount:a.length,isShowLive:v})]})}function Au({feedCount:e,isShowLive:t}){let n=(0,V.useMemo)(()=>[`@kc_collects is in the room â bought 4Ã this month. Shout her out.`,`Pin a bundle: 3 viewers bought pouch + strap last show. Try $19.`,`Energy's dipping â run a $5 mystery to reset the room.`,`Charm pack is your top item tonight. Restock the next drop with it.`,`@luna_finds just joined. She averages 3 items per show.`,`Pace is fast â you're 18% above your Friday average. Keep it.`,`Average order is climbing â tease your higher-tier item next.`,`3 viewers are silent watchers â call them out by name to warm the room.`,`Last 5 sales were singles. Offer a 'buy 2 get $3 off' to lift basket size.`,`Box 7 hasn't combined in 6 minutes â remind buyers shipping closes soon.`,`Repeat buyer streak: 4 in a row. Thank the room out loud.`,`Drop in chat speed â run a quick poll to re-engage.`],[]),[r,i]=(0,V.useState)(!0),[a,o]=(0,V.useState)([]),[s,c]=(0,V.useState)(0),l=(0,V.useRef)(1),u=()=>{o(e=>{let t=n[l.current%n.length];return l.current+=1,e[0]?.text===t&&(t=n[l.current%n.length],l.current+=1),[{text:t,t:Date.now()},...e].slice(0,50)}),c(0)};if((0,V.useEffect)(()=>
50{if(!t)return;a.length===0&&u();let e=setInterval(u,14e3);return()=>clearInterval(e)},[t]),(0,V.useEffect)(()=>{t&&e>0&&u()},[e,t]),!t||a.length===0)return null;if(!r)return(0,U.jsx)(`button`,{onClick:()=>i(!0),style:{position:`fixed`,bottom:18,right:18,zIndex:60,background:`#8fbf3f`,color:`#1a2110`,border:`1px solid #6fa028`,borderRadius:999,padding:`10px 14px`,fontWeight:800,fontSize:12,letterSpacing:`.06em`,textTransform:`uppercase`,cursor:`pointer`,boxShadow:`0 10px 24px -8px rgba(0,0,0,.25)`},children:`â Coach tips`});let d=a[s]??a[0],f=s===0,p=s<a.length-1,m=s>0;return(0,U.jsxs)(`div`,{style:{position:`fixed`,bottom:18,right:18,zIndex:60,width:320,background:`#1f2613`,color:`#f6f4ea`,border:`1px solid #3a4622`,borderRadius:12,padding:14,boxShadow:`0 20px 50px -12px rgba(0,0,0,.45)`,fontFamily:`Inter, ui-sans-serif, system-ui, sans-serif`},children:[(0,U.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:8},children:[(0,U.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,U.jsx)(`span`,{style:{width:8,height:8,borderRadius:999,background:f?`#8fbf3f`:`#9aa37f`,boxShadow:f?`0 0 0 4px rgba(143,191,63,.25)`:`none`,animation:f?`pearshow-pulse 1.4s ease-in-out infinite`:void 0}}),(0,U.jsxs)(`span`,{style:{fontSize:11,fontWeight:800,letterSpacing:`.12em`,textTransform:`uppercase`,color:f?`#8fbf3f`:`#c9c9b8`},children:[`Coach · `,f?`Live tip`:`Tip from ${new Date(d.t).toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`})}`]})]}),(0,U.jsx)(`button`,{onClick:()=>i(!1),"aria-label":`Hide`,style:{background:`transparent`,color:`#c9c9b8`,border:`none`,cursor:`pointer`,fontSize:16,lineHeight:1},children:`Ã`})]}),(0,U.jsx)(`div`,{style:{fontSize:13,lineHeight:1.5,color:`#f6f4ea`,minHeight:42},children:d?.text}),(0,U.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginTop:10,gap:8},children:[(0,U.jsx)(`span`,{style:{fontSize:10,color:`#9aa37f`,fontWeight:700,letterSpacing:`.08em`,textTransform:`uppercase`},children:f?`Newest`:`#${s+1} of ${a.length}`}),(0,U.jsxs)(`div`,{style:{display:`flex`,gap:6},children:[(0,U.jsx)(`button`,{disabled:!p,onClick:()=>p&&c(e=>e+1),style:{background:`transparent`,color:p?`#8fbf3f`:`#4a5530`,border:`1px solid #3a4622`,borderRadius:6,padding:`4px 10px`,fontSize:11,fontWeight:800,cursor:p?`pointer`:`not-allowed`,letterSpacing:`.06em`,textTransform:`uppercase`},children:`â Prev`}),(0,U.jsx)(`button`,{disabled:!m,onClick:()=>m&&c(e=>Math.max(0,e-1)),style:{background:`transparent`,color:m?`#8fbf3f`:`#4a5530`,border:`1px solid #3a4622`,borderRadius:6,padding:`4px 10px`,fontSize:11,fontWeight:800,cursor:m?`pointer`:`not-allowed`,letterSpacing:`.06em`,textTransform:`uppercase`},children:`Next â`}),!f&&(0,U.jsx)(`button`,{onClick:()=>c(0),style:{background:`#8fbf3f`,color:`#1a2110`,border:`1px solid #6fa028`,borderRadius:6,padding:`4px 10px`,fontSize:11,fontWeight:800,cursor:`pointer`,letterSpacing:`.06em`,textTransform:`uppercase`},children:`Live`})]})]}),(0,U.jsx)(`style`,{children:`@keyframes pearshow-pulse { 0%,100% { box-shadow: 0 0 0 4px rgba(143,191,63,.25);} 50% { box-shadow: 0 0 0 7px rgba(143,191,63,.08);} }`})]})}function ju({jobs:e,onOpen:t}){let n=e.filter(e=>e.status===`pending`).length,r=e.filter(e=>e.status===`failed`).length,i=r>0?`#c0392b`:n>0?`#e8a13d`:`#5a8f3a`,a=r>0?`${r} failed${n?` · ${n} retrying`:``}`:n>0?`${n} printingâ¦`:`All printed`;return(0,U.jsxs)(`button`,{className:`ghost`,onClick:t,title:`Print queue â auto-retries any label the printer didn't accept`,style:{borderColor:i,color:i,fontWeight:600},children:[(0,U.jsx)(le,{size:14}),` `,a]})}var Mu=`pearshow:print_setup_done`;function Nu(){let[e,t]=(0,V.useState)(()=>typeof window>`u`?!1:window.localStorage.getItem(Mu)===`1`);return(0,V.useEffect)(()=>{let e=()=>t(window.localStorage.getItem(Mu)===`1`);return window.addEventListener(`pl:print-setup-changed`,e),window.addEventListener(`storage`,e),()=>{window.removeEventListener(`pl:print-setup-changed`,e),window.removeEventListener(`storage`,e)}},[]),[e,e=>{typeof window>`u`||(e?window.localStorage.setItem(Mu,`1`):window.localStorage.removeItem(Mu),window.dispatchEvent(new CustomEvent(`pl:print-setup-changed`)))}]}function Pu(){let[e,t]=(0,V.useState)(!1),[n,r]=(0,V.useState)(null);return(0,V.useEffect)(()=>
50{if(typeof window>`u`)return;let e=e=>{let n=e.data;!n||n.source!==`pearshow-ext`||(n.type===`PEARSHOW_EXT_READY`&&(t(!0),window.postMessage({source:`pearshow-web`,type:`PEARSHOW_GET_AUTH_STATUS`},window.location.origin)),n.type===`PEARSHOW_AUTH_STATUS`&&(t(!0),r(!!n.hasToken)))};window.addEventListener(`message`,e);let n=()=>window.postMessage({source:`pearshow-web`,type:`PEARSHOW_PING`},window.location.origin),i=()=>window.postMessage({source:`pearshow-web`,type:`PEARSHOW_GET_AUTH_STATUS`},window.location.origin);n();let a=setTimeout(i,300),o=()=>{n(),i()};return window.addEventListener(`focus`,o),()=>{window.removeEventListener(`message`,e),window.removeEventListener(`focus`,o),clearTimeout(a)}},[]),{installed:e,signedIn:n}}function Fu(){let e=new Uint8Array(32);if(typeof crypto<`u`&&crypto.getRandomValues)crypto.getRandomValues(e);else for(let t=0;t<e.length;t++)e[t]=Math.floor(Math.random()*256);let t=``;for(let n of e)t+=`abcdefghijklmnopqrstuvwxyz0123456789`[n%36];return t}function Iu(){let e=z($e),t=(0,V.useRef)(!1),[n,r]=(0,V.useState)(!1),[i,a]=(0,V.useState)(null),[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(null),[u,d]=(0,V.useState)(!1),[f,p]=(0,V.useState)(null),m=()=>{window.postMessage({source:`pearshow-web`,type:`PEARSHOW_PING`},window.location.origin),window.postMessage({source:`pearshow-web`,type:`PEARSHOW_GET_AUTH_STATUS`},window.location.origin),window.postMessage({source:`pearshow-web`,type:`PEARSHOW_VALIDATE_TOKEN`},window.location.origin)};(0,V.useEffect)(()=>{if(typeof window>`u`)return;let e=e=>{let t=e.data;!t||t.source!==`pearshow-ext`||(t.type===`PEARSHOW_EXT_READY`&&(r(!0),m()),t.type===`PEARSHOW_AUTH_STATUS`&&(r(!0),a(!!t.hasToken),s(!!t.enabled)),t.type===`PEARSHOW_VALIDATE_TOKEN_RESULT`&&(r(!0),l(!!t.ok),t.ok||p(t.message||t.error||`The extension is installed but not linked to this PearShow account.`)),t.type===`PEARSHOW_AUTO_CONNECT_RESULT`&&(d(!1),t.ok?(a(!0),s(!0),l(!0),p(null),setTimeout(m,300)):p(t.message||t.error||`Auto-connect failed. Open the extension and click Connect to PearShow.`)))};window.addEventListener(`message`,e),m();let t=setInterval(m,3e4);return()=>{window.removeEventListener(`message`,e),clearInterval(t)}},[]);let h=async()=>{if(!(u||typeof window>`u`)){d(!0),p(`Linking the extension to this PearShow accountâ¦`);try{let t=Fu();await e({data:{nonce:t}}),window.postMessage({source:`pearshow-web`,type:`PEARSHOW_AUTO_CONNECT`,nonce:t,server:window.location.origin},window.location.origin),setTimeout(()=>{d(e=>(e&&p(`Still waiting on the extension. If this stays here, reload the extension once.`),e))},6e3)}catch(e){d(!1),p(e instanceof Error?e.message:`Auto-connect failed. Open the extension and click Connect to PearShow.`)}}};if((0,V.useEffect)(()=>{!(n&&(i===!1||c===!1))||t.current||(t.current=!0,h())},[n,i,c]),!n||i&&o!==!1&&c!==!1&&!u)return null;let g=o===!1&&i&&c!==!1;return(0,U.jsx)(`div`,{className:`card`,style:{borderColor:u?`#b8c9a6`:`#e0aa4f`,background:u?`#f4f7ef`:`#fff5df`},children:(0,U.jsxs)(`div`,{className:`between`,style:{alignItems:`center`,gap:12,flexWrap:`wrap`},children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{style:{fontWeight:800},children:u?`Connecting your extensionâ¦`:g?`PearShow extension is turned off`:`PearShow extension needs connection`}),(0,U.jsx)(`div`,{className:`sub`,style:{marginTop:3,fontSize:12},children:f||(g?`Open the ð extension and turn capture back on.`:`PearShow is auto-linking it now so Whatnot data can start coming in.`)})]}),g?null:(0,U.jsx)(`button`,{className:`primary`,onClick:h,disabled:u,children:u?`Linkingâ¦`:`Reconnect now`})]})})}function Lu(){let[e]=Nu(),{installed:t,signedIn:n}=Pu();if(e||t)return null;let r=()=>{window.dispatchEvent(new CustomEvent(`pl:nav`,{detail:`Settings`})),setTimeout(()=>{window.dispatchEvent(new CustomEvent(`pl:tabs-goto`,{detail:`Labels & printer`}))},50)},i=t&&n===!1;return(0,U.jsxs)(`div`,{role:`alert`,style:{marginTop:10,padding:`10px 12px`,background:`#f4f7ef`,border:`1px solid #b8c9a6`,borderRadius:8,color:`#1a2110`,fontSize:13,fontWeight:500,display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:12,flexWrap:`wrap`},children:[(0,U.jsx)(`span`,{children:i?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`strong`,{children:`One last step.`}),` The PearShow extension is installed â open the ð toolbar icon once to connect this browser.`]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`strong`,{children:`You're ready to print.`}),` Labels can print from the browser now. Add the PearShow extension for automatic printing during the show.`]})}),(0,U.jsx)(`button`,{onClick:r,style:{fontSize:12,padding:`8px 14px`,background:`#4a6b2e`,color:`#ffffff`,border:`none`,borderRadius:6,fontWeight:600,cursor:`pointer`},children:i?`Open printer settings`:`Printer settings`})]})}function Ru({printJobs:e,activePlatform:t}){let[,n]=(0,V.useState)(0);(0,V.useEffect)(()=>{let e=setInterval(()=>n(e=>e+1),1e3);return()=>clearInterval(e)},[]);let r=an(),i=t?r.platforms.filter(e=>e.platform===t):r.platforms,a=e=>{if(!e)return`â`;let t=Math.max(0,Math.round((Date.now()-e)/1e3));if(t<60)return`${t}s ago`;let n=Math.round(t/60);return n<60?`${n}m ago`:`${Math.round(n/60)}h ago`},o=r.bridgeOnline?`#5a8f3a`:r.lastBridgeOkAt?`#e8a13d`:`#7c8a72`,s=r.bridgeOnline?`Bridge online`:r.lastBridgeOkAt?`Bridge stale · ${a(r.lastBridgeOkAt)}`:`Bridge offline`;return(0,U.jsxs)(`div`,{style:{display:`flex`,alignItems:`stretch`,gap:10,flexWrap:`wrap`,marginLeft:`auto`,paddingLeft:12,borderLeft:`1px dashed var(--pl-border, #2a3a25)`,minWidth:0,flex:`1 1 480px`},children:[(0,U.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,justifyContent:`center`,gap:2,minWidth:140},children:[(0,U.jsx)(`span`,{style:{fontSize:10,textTransform:`uppercase`,letterSpacing:.6,color:`var(--pl-muted)`,fontWeight:700},children:`Print pipeline`}),(0,U.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:6,fontSize:11,fontWeight:700,color:o},title:r.lastBridgeError||s,children:[(0,U.jsx)(`span`,{style:{width:8,height:8,borderRadius:999,background:o}}),s]}
50),(0,U.jsxs)(`span`,{style:{fontSize:10,color:`var(--pl-muted)`},children:[`Watchdog `,r.lastTickAt?a(r.lastTickAt):`idle`,` · `,i.reduce((e,t)=>e+t.pending,0),`p · `,i.reduce((e,t)=>e+t.failed,0),`f`]}),i.reduce((e,t)=>e+t.failed,0)>0&&(0,U.jsxs)(`button`,{className:`ghost`,style:{fontSize:10,padding:`2px 6px`,borderColor:`#c0392b`,color:`#c0392b`,marginTop:2,width:`fit-content`},onClick:()=>nn(),children:[`â» Retry `,i.reduce((e,t)=>e+t.failed,0)]})]}),(0,U.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(150px, 1fr))`,gap:6,flex:1,minWidth:0},children:i.map(e=>{let t=e.failed>0?`#c0392b`:e.pending>0?`#e8a13d`:e.done>0?`#5a8f3a`:`#7c8a72`,n=e.failed>0?`FAILED`:e.pending>0?`RETRYING`:e.done>0?`OK`:`IDLE`,r=e.lastSuccessSaleId?e.lastSuccessSaleId.replace(/:(item|buyer)$/,``):`â`;return(0,U.jsxs)(`div`,{style:{border:`1px solid ${t}`,borderRadius:6,padding:`4px 8px`,display:`flex`,flexDirection:`column`,gap:1,background:`rgba(0,0,0,0.06)`,minWidth:0},title:e.lastError||`${e.platform} · ${n}`,children:[(0,U.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,gap:6},children:[(0,U.jsx)(`strong`,{style:{fontSize:11,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.platform}),(0,U.jsx)(`span`,{style:{fontSize:9,color:t,fontWeight:800,letterSpacing:.4},children:n})]}),(0,U.jsxs)(`div`,{style:{fontSize:10,color:`var(--pl-muted)`,display:`flex`,justifyContent:`space-between`,gap:6},children:[(0,U.jsx)(`span`,{children:`last ok`}),(0,U.jsx)(`span`,{children:a(e.lastSuccessAt)})]}),(0,U.jsxs)(`div`,{style:{fontSize:9,color:`var(--pl-muted)`,fontFamily:`ui-monospace, monospace`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},title:r,children:[`sale: `,r]}),(0,U.jsxs)(`div`,{style:{fontSize:10,display:`flex`,gap:6,color:`var(--pl-muted)`},children:[(0,U.jsxs)(`span`,{children:[e.pending,`p`]}),(0,U.jsxs)(`span`,{style:{color:e.failed>0?`#c0392b`:`var(--pl-muted)`},children:[e.failed,`f`]}),(0,U.jsxs)(`span`,{children:[e.done,`ok`]}),e.failedJobs.length>0&&(0,U.jsx)(`button`,{className:`ghost`,style:{fontSize:9,padding:`1px 5px`,borderColor:`#c0392b`,color:`#c0392b`,marginLeft:`auto`},onClick:()=>tn(e.failedJobs[e.failedJobs.length-1].id),title:e.failedJobs[e.failedJobs.length-1].lastError||`Retry last failed`,children:`â»`})]})]},e.platform)})})]})}function zu({jobs:e,onClose:t}){let n=[...e].sort((e,t)=>t.createdAt-e.createdAt).slice(0,40),r=e.filter(e=>e.status===`failed`).length;return(0,U.jsx)(`div`,{onClick:t,style:{position:`fixed`,inset:0,background:`rgba(0,0,0,0.45)`,zIndex:1e3,display:`flex`,justifyContent:`flex-end`},children:(0,U.jsxs)(`div`,{onClick:e=>e.stopPropagation(),style:{width:440,maxWidth:`100%`,height:`100%`,background:`#ffffff`,color:`#2a3318`,padding:18,overflowY:`auto`,borderLeft:`1px solid #e6e2d0`,boxShadow:`-8px 0 24px rgba(0,0,0,0.18)`},children:[(0,U.jsxs)(`div`,{className:`between`,style:{marginBottom:12},children:[(0,U.jsx)(`h3`,{style:{margin:0},children:`Print queue`}),(0,U.jsxs)(`button`,{className:`ghost`,onClick:t,children:[(0,U.jsx)(p,{size:14}),` Close`]})]}),(0,U.jsx)(`p`,{style:{fontSize:12,color:`#6b7355`,marginTop:0},children:`Every label runs through the watchdog. If the printer doesn't ack, it retries automatically with backoff. Nothing slips through.`}),(0,U.jsxs)(`div`,{className:`actions`,style:{marginBottom:12},children:[(0,U.jsxs)(`button`,{className:`primary`,disabled:r===0,onClick:()=>nn(),children:[(0,U.jsx)(v,{size:14}),` Retry all failed (`,r,`)`]}),(0,U.jsx)(`button`,{className:`ghost`,onClick:()=>rn(),children:`Clear done`})]}),n.length===0&&(0,U.jsx)(`div`,{style:{fontSize:13,color:`#6b7355`},children:`No print jobs yet.`}),n.map(e=>(0,U.jsxs)(`div`,{className:`card`,style:{padding:10,marginBottom:8,background:`#faf7ec`,border:`1px solid #e6e2d0`,borderRadius:8},children:[(0,U.jsxs)(`div`,{className:`between`,children:[(0,U.jsxs)(`strong`,{style:{fontSize:13},children:[`#`,e.payload.number,` · @`,e.payload.buyer]}),(0,U.jsxs)(`span`,{className:`pill`,style:{background:e.status===`done`?`#2b3514`:e.status===`failed`?`#5a1f1f`:`#3a3014`,color:e.status===`done`?`#9ab38a`:e.status===`failed`?`#f0a8a8`:`#f0d8a8`},children:[e.status,e.attempts?` · try ${e.attempts}`:``]})]}),(0,U.jsxs)(`div`,{style:{fontSize:12,color:`#6b7355`,margin:`4px 0`},children:[e.payload.item,` · `,e.mode===`buyer`?`buyer label`:`item label`]}),e.lastError&&(0,U.jsx)(`div`,{style:{fontSize:11,color:`#a82020`},children:e.lastError}),e.status===`failed`&&(0,U.jsxs)(`button`,{className:`ghost`,style:{fontSize:12,marginTop:6},onClick:()=>tn(e.id),children:[(0,U.jsx)(v,{size:12}),` Retry now`]})]},e.id))]})})}function Bu(){let e=[{key:`ask`,title:`Ask me anything`,blurb:`Type a question â I'll answer like a friend who runs shows for a living.`,icon:(0,U.jsx)(re,{size:22}),accent:`#d98a4a`,render:()=>(0,U.jsx)(Vu,{})},{key:`preshow`,title:`Plan tonight's show`,blurb:`A full run-of-show: start time, opener, first 3 items, and pre-show DMs.`,icon:(0,U.jsx)(it,{size:22}),accent:`#3f7fbf`,render:()=>(0,U.jsx)(Hu,{kind:`preshow_plan`})},{key:`rescue`,title:`Save my show (chat is dead)`,blurb:`Tactical rescue for slow shows â what to say, who to DM, what to drop next.`,icon:(0,U.jsx)(ht,{size:22}),accent:`#c8553d`,render:()=>(0,U.jsx)(Hu,{kind:`rescue`})},{key:`growth`,title:`7-day growth plan`,blurb:`One small action per day to build an audie
50nce. Under 30 min/day, no fluff.`,icon:(0,U.jsx)(ye,{size:22}),accent:`#5fa56b`,render:()=>(0,U.jsx)(Hu,{kind:`growth_7day`})},{key:`scripts`,title:`On-camera scripts`,blurb:`Copy-paste openers, transitions, hype lines, and closers â warm, not cringe.`,icon:(0,U.jsx)(xt,{size:22}),accent:`#7a5cc4`,render:()=>(0,U.jsx)(Hu,{kind:`scripts`})},{key:`pricing`,title:`Pricing & auction coach`,blurb:`Start price, $1 vs reserve, combine timing, when to pull an item.`,icon:(0,U.jsx)(st,{size:22}),accent:`#b8893f`,render:()=>(0,U.jsx)(Hu,{kind:`pricing`})},{key:`confidence`,title:`I'm nervous â pep talk`,blurb:`Real talk + mindset rules + 3 small wins you can hit tonight.`,icon:(0,U.jsx)(se,{size:22}),accent:`#d36b8a`,render:()=>(0,U.jsx)(Hu,{kind:`confidence`})},{key:`recap`,title:`How did my last show go?`,blurb:`A plain-English recap with what worked and what to fix next time.`,icon:(0,U.jsx)(ge,{size:22}),accent:`#8fbf3f`,render:()=>(0,U.jsx)($u,{})},{key:`push`,title:`What should I push next?`,blurb:`I watch the feed and tell you who to upsell while you're live.`,icon:(0,U.jsx)(M,{size:22}),accent:`#5b9bd5`,render:()=>(0,U.jsx)(Wu,{})},{key:`dm`,title:`Write messages to buyers`,blurb:`Pre-show pings, thank-yous, and win-backs â ready to copy & send.`,icon:(0,U.jsx)(bt,{size:22}),accent:`#c47ac0`,render:()=>(0,U.jsx)(Uu,{})},{key:`give`,title:`Pick a giveaway winner`,blurb:`Spin for a winner â fair random or weighted by spend/loyalty.`,icon:(0,U.jsx)(I,{size:22}),accent:`#e8a13d`,render:()=>(0,U.jsx)(qu,{})},{key:`voice`,title:`Hands-free announcer`,blurb:`Say buyer numbers and combines out loud so you stay on camera.`,icon:(0,U.jsx)(kt,{size:22}),accent:`#6dbf8c`,render:()=>(0,U.jsx)(Qu,{})}],[t,n]=(0,V.useState)(null),r=e.find(e=>e.key===t);return(0,U.jsxs)(`div`,{className:`grid`,children:[(0,U.jsxs)(`div`,{className:`card coach-hello`,children:[(0,U.jsx)(`div`,{className:`coach-hello-ico`,children:(0,U.jsx)(ge,{size:22})}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h2`,{style:{margin:0,fontFamily:`inherit`,fontSize:22,fontWeight:700,textTransform:`none`,letterSpacing:0},children:`Hey â what do you want help with today?`}),(0,U.jsx)(`p`,{style:{margin:`4px 0 0`,color:`var(--pl-muted)`},children:`Pick a tile below. Everything's one tap â no setup, no jargon.`})]})]}),!r&&(0,U.jsx)(`div`,{className:`coach-tiles`,children:e.map(e=>(0,U.jsxs)(`button`,{className:`coach-tile`,onClick:()=>n(e.key),children:[(0,U.jsx)(`span`,{className:`coach-tile-ico`,style:{background:e.accent},children:e.icon}),(0,U.jsx)(`span`,{className:`coach-tile-title`,children:e.title}),(0,U.jsx)(`span`,{className:`coach-tile-blurb`,children:e.blurb}),(0,U.jsx)(`span`,{className:`coach-tile-cta`,children:`Open â`})]},e.key))}),r&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`row`,style:{gap:10,alignItems:`center`},children:[(0,U.jsx)(`button`,{className:`ghost`,onClick:()=>n(null),children:`â Back to all tools`}),(0,U.jsxs)(`div`,{className:`row`,style:{gap:8},children:[(0,U.jsx)(`span`,{className:`coach-tile-ico sm`,style:{background:r.accent},children:r.icon}),(0,U.jsx)(`strong`,{style:{fontSize:16},children:r.title})]})]}),r.render()]})]})}function Vu(){let[e,t]=(0,V.useState)(``),[n,r]=(0,V.useState)([]),{data:i=[]}=Cu(),a=z(Le),{data:o=[]}=R({queryKey:[`buyers`,`coach`],queryFn:()=>a(),refetchOnWindowFocus:!1}),s=z(je),c=u({mutationFn:e=>s({data:{question:e,context:{recentShows:i.slice(0,3),buyers:o}}}),onSuccess:(e,t)=>r(n=>[{q:t,a:e.answer},...n].slice(0,8))}),l=()=>{e.trim()&&(c.mutate(e),t(``))};return(0,U.jsxs)(`div`,{className:`grid cols2`,children:[(0,U.jsxs)(`div`,{className:`card`,style:{gridColumn:`1/-1`},children:[(0,U.jsxs)(`div`,{className:`row`,style:{gap:10},children:[(0,U.jsx)(`span`,{className:`coach-ico`,children:(0,U.jsx)(re,{size:14})}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{style:{margin:0},children:`Ask the Coach anything`}),(0,U.jsx)(`div`,{style:{fontSize:12,color:`var(--pl-muted)`},children:`Trained on your show history, buyer book, and what's working across PearShow sellers.`})]})]}),(0,U.jsxs)(`div`,{className:`row`,style:{marginTop:14,gap:8},children:[(0,U.jsx)(`input`,{"aria-label":`Ask Coach about your show, buyers, pricing, timingâ¦`,placeholder:`Ask Coach about your show, buyers, pricing, timingâ¦`,value:e,onCh
50ange:e=>t(e.target.value),onKeyDown:e=>e.key===`Enter`&&l()}),(0,U.jsxs)(`button`,{className:`primary`,onClick:l,disabled:c.isPending,children:[(0,U.jsx)(ne,{size:14}),` `,c.isPending?`Thinkingâ¦`:`Ask`]})]}),(0,U.jsx)(`div`,{className:`row`,style:{marginTop:10,gap:6,flexWrap:`wrap`},children:[`When should I go live this week?`,`How do I get more repeat buyers?`,`What price band is converting best?`,`Write a hook for tonight's drop.`].map(e=>(0,U.jsx)(`button`,{className:`ghost`,style:{fontSize:11,padding:`4px 10px`},onClick:()=>{t(e)},children:e},e))})]}),n.map((e,t)=>(0,U.jsxs)(`div`,{className:`card`,style:{gridColumn:`1/-1`},children:[(0,U.jsx)(`div`,{className:`kicker`,children:`You asked`}),(0,U.jsx)(`p`,{style:{margin:`0 0 10px`,fontWeight:600,color:`var(--pl-ink)`},children:e.q}),(0,U.jsx)(`div`,{className:`kicker`,children:`Coach`}),(0,U.jsx)(`p`,{style:{margin:0,whiteSpace:`pre-wrap`},children:e.a})]},t)),c.isPending&&n.length===0&&(0,U.jsx)(`div`,{style:{gridColumn:`1/-1`},children:(0,U.jsx)(Me,{})}),n.length===0&&!c.isPending&&(0,U.jsxs)(`div`,{className:`coach-empty`,style:{gridColumn:`1/-1`},children:[(0,U.jsx)(gt,{size:16}),` Try one of the examples above, or ask anything about your live shows.`]})]})}function Hu({kind:e}){let t=z(Ue),{data:n=[]}=Cu(),r=z(Le),{data:i=[]}=R({queryKey:[`buyers`,`playbook`],queryFn:()=>r(),refetchOnWindowFocus:!1}),{data:a=[]}=Su(100),o=u({mutationFn:()=>t({data:{kind:e,context:{recentShows:n.slice(0,3),topBuyers:i.slice(0,6),recentSales:a.slice(0,8)}}})});(0,V.useEffect)(()=>{o.mutate()},[e]);let s=o.data,c=e=>{try{navigator.clipboard?.writeText(e)}catch{}};return(0,U.jsxs)(`div`,{className:`grid`,children:[(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsxs)(`div`,{className:`between`,children:[(0,U.jsxs)(`div`,{className:`row`,style:{gap:10},children:[(0,U.jsx)(`span`,{className:`coach-ico`,children:(0,U.jsx)(nt,{size:14})}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{style:{margin:0},children:s?.title??`Coach is thinkingâ¦`}),(0,U.jsx)(`div`,{style:{fontSize:12,color:`var(--pl-muted)`},children:`Built from your last shows, top buyers, and recent sales. Tap regenerate for a fresh take.`})]})]}),(0,U.jsxs)(`div`,{className:`row`,style:{gap:8},children:[s&&(0,U.jsxs)(`button`,{className:`ghost`,onClick:()=>{if(!s)return;let e=[s.title,``,s.intro,``];for(let t of s.sections){e.push(t.heading);for(let n of t.bullets)e.push(`⢠${n}`);e.push(``)}if(s.scripts?.length){e.push(`Scripts:`);for(let t of s.scripts)e.push(`[${t.label}] ${t.line}`)}c(e.join(` 51`))},children:[(0,U.jsx)(ot,{size:13}),` Copy all`]}),(0,U.jsxs)(`button`,{className:`primary`,onClick:()=>o.mutate(),disabled:o.isPending,children:[(0,U.jsx)(v,{size:14,className:o.isPending?`spin`:``}),` `,o.isPending?`Writingâ¦`:`Regenerate`]})]})]}),s?.intro&&(0,U.jsx)(`p`,{style:{marginTop:12,color:`var(--pl-ink)`},children:s.intro})]}),o.isPending&&!s&&(0,U.jsx)(Me,{message:`Putting your plan togetherâ¦`}),s?.sections?.length?(0,U.jsx)(`div`,{className:`grid cols2`,children:s.sections.map((e,t)=>(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsx)(`h3`,{style:{margin:`0 0 8px`},children:e.heading}),(0,U.jsx)(`ul`,{style:{margin:0,paddingLeft:18,display:`grid`,gap:6},children:e.bullets.map((e,t)=>(0,U.jsx)(`li`,{style:{lineHeight:1.45},children:e},t))})]},t))}
51):null,s?.scripts&&s.scripts.length>0&&(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsxs)(`div`,{className:`row`,style:{gap:10,marginBottom:10},children:[(0,U.jsx)(`span`,{className:`coach-ico`,children:(0,U.jsx)(xt,{size:14})}),(0,U.jsx)(`h3`,{style:{margin:0},children:`Read these on camera`})]}),(0,U.jsx)(`div`,{className:`grid cols2`,children:s.scripts.map((e,t)=>(0,U.jsxs)(`div`,{className:`card`,style:{padding:12},children:[(0,U.jsxs)(`div`,{className:`between`,children:[(0,U.jsx)(`div`,{className:`kicker`,children:e.label}),(0,U.jsxs)(`button`,{className:`ghost`,style:{fontSize:11,padding:`4px 10px`},onClick:()=>c(e.line),children:[(0,U.jsx)(ot,{size:12}),` Copy`]})]}),(0,U.jsxs)(`p`,{style:{margin:`6px 0 0`},children:[`"`,e.line,`"`]})]},t))})]})]})}function Uu(){let[e,t]=(0,V.useState)(`preshow`),n=z(Le),{data:r=[]}=R({queryKey:[`buyers`,`dm`],queryFn:()=>n(),refetchOnWindowFocus:!1}),i=r.map(e=>({username:e.username,tag:e.tag??`Buyer`,shows:Number(e.shows_count??0),lifetime:Number(e.lifetime_spend??0),likes:e.notes??``})),[a,o]=(0,V.useState)([]);(0,V.useEffect)(()=>{!a.length&&i.length&&o(i.slice(0,3).map(e=>e.username))},[i,a.length]);let s=z(Ce),c=u({mutationFn:()=>s({data:{kind:e,buyers:i.filter(e=>a.includes(e.username)),showInfo:{sellerName:`Pear Show seller`,title:`Next Whatnot show`,whenISO:new Date().toISOString(),teasers:[]}}})}),l=c.data?.drafts??[],d=e=>{try{navigator.clipboard?.writeText(e)}catch{}},f=e=>o(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]);return(0,U.jsxs)(`div`,{className:`grid`,children:[(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsxs)(`div`,{className:`between`,children:[(0,U.jsxs)(`div`,{className:`row`,style:{gap:10},children:[(0,U.jsx)(`span`,{className:`coach-ico`,children:(0,U.jsx)(bt,{size:14})}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{style:{margin:0},children:`DM Generator`}),(0,U.jsx)(`div`,{style:{fontSize:12,color:`var(--pl-muted)`},children:`Personalized DMs for pre-show pings, thank-yous, and win-backs.`})]})]}),(0,U.jsxs)(`select`,{value:e,onChange:e=>t(e.target.value),style:{maxWidth:200},children:[(0,U.jsx)(`option`,{value:`preshow`,children:`Pre-show ping`}),(0,U.jsx)(`option`,{value:`thankyou`,children:`Thank-you note`}),(0,U.jsx)(`option`,{value:`winback`,children:`Win-back lapsed buyer`})]})]}),(0,U.jsxs)(`div`,{className:`cols3 grid`,style:{marginTop:14},children:[i.map(e=>(0,U.jsxs)(`label`,{className:`card`,style:{padding:12,cursor:`pointer`,borderColor:a.includes(e.username)?`var(--pl-copper)`:void 0},children:[(0,U.jsxs)(`div`,{className:`row`,style:{justifyContent:`space-between`},children:[(0,U.jsxs)(`strong`,{children:[`@`,e.username]}),(0,U.jsx)(`input`,{type:`checkbox`,checked:a.includes(e.username),onChange:()=>f(e.username),style:{width:18}})]}),(0,U.jsxs)(`div`,{style:{fontSize:12,color:`var(--pl-muted)`,marginTop:4},children:[e.tag,` · $`,e.lifetime,` · likes `,e.likes]})]},e.username)),i.length===0&&(0,U.jsx)(`div`,{className:`note`,style:{gridColumn:`1/-1`},children:`No buyers yet. Sync Whatnot buyers before generating DMs.`})]}),(0,U.jsx)(`div`,{className:`actions`,style:{marginTop:14},children:(0,U.jsxs)(`button`,{className:`primary`,onClick:()=>c.mutate(),disabled:c.isPending||a.length===0,children:[(0,U.jsx)(jt,{size:14}),` `,c.isPending?`Writingâ¦`:`Generate ${a.length} DM${a.length===1?``:`s`}`]})})]}),l.length>0&&(0,U.jsx)(`div`,{className:`grid cols2`,children:l.map((e,t)=>(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsxs)(`div`,{className:`between`,children:[(0,U.jsxs)(`strong`,{children:[`@`,e.username]}),(0,U.jsxs)(`button`,{className:`ghost`,style:{fontSize:11,padding:`4px 10px`},onClick:()=>d(e.message),children:[(0,U.jsx)(ot,{size:12}),` Copy`]})]}),(0,U.jsx)(`p`,{style:{marginTop:8},children:e.message})]},t))})]})}function Wu(){let{data:e}=Su(100),t=(e??[]).map(e=>({buyer:e.buyer_username,item:e.item_title,total:Number(e.total??0)})),n=Array.from(new Set(t.map(e=>e.item).filter(Boolean))).slice(0,50),r=z(Te),i=u({mutationFn:()=>r({data:{recentSales:t,availableItems:n}})}),a=i.data?.suggestions??[],o=(0,V.useRef)(!1);return(0,V.useEffect)(()=>{o.current||!t.length||(o.current=!0,i.mutate())},[t.length]),(0,U.jsxs)(`div`,{className:`grid`,children:[(0,U.jsx)(`div`,{className:`card`,children:(0,U.jsxs)(`div`,{className:`between`,children:[(0,U.jsxs)(`div`,{className:`row`,style:{gap:10},children:[(0,U.jsx)(`span`,{className:`coach-ico`,children:(0,U.jsx)(M,{size:14})}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{style:{margin:0},children:`Bundle Suggester`}),(0,U.jsx)(`div`,{style:{fontSize:12,color:`var(--pl-muted)`},children:`AI watches the feed and recommends add-on pushes to lift each buyer's order. Refreshes automatically â tap to re-run.`})]})]}),(0,U.jsxs)(`button`,{className:`primary`,onClick:()=>i.mutate(),disabled:i.isPending||!t.length,children:[(0,U.jsx)(v,{size:14,className:i.isPending?`spin`:``}),` `,i.isPending?`Thinkingâ¦`:`Refresh`]})]})}),!t.length&&(0,U.jsx)(`div`,{className:`note`,children:`No synced sales yet. Bu
51ndle suggestions will appear after Whatnot orders populate.`}),i.isPending&&a.length===0&&(0,U.jsx)(Me,{message:`Scanning the feed and what's trending on other live showsâ¦`}),!i.isPending&&a.length===0&&i.isSuccess&&(0,U.jsx)(`div`,{className:`card`,style:{color:`var(--pl-muted)`,fontSize:13},children:`No bundle pushes yet â start a show or add a few sales and Coach will start recommending upsells.`}),a.length>0&&(0,U.jsx)(`div`,{className:`grid cols2`,children:a.map((e,t)=>(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsxs)(`div`,{className:`kicker`,children:[`@`,e.buyer]}),(0,U.jsx)(`h3`,{style:{margin:`4px 0 6px`},children:e.suggestion}),(0,U.jsx)(`p`,{style:{margin:0},children:e.reason})]},t))})]})}function Gu({mode:e,active:t}){let n=t?`currentColor`:`var(--pl-muted)`,r=t?`currentColor`:`transparent`;return e===`once_per_buyer`?(0,U.jsxs)(`svg`,{width:`48`,height:`22`,viewBox:`0 0 48 22`,fill:`none`,"aria-hidden":!0,children:[(0,U.jsx)(`rect`,{x:`1`,y:`4`,width:`14`,height:`14`,rx:`2`,stroke:n,fill:r,opacity:t?.18:1}),(0,U.jsx)(`text`,{x:`8`,y:`14`,fontSize:`8`,fontWeight:`700`,fill:n,textAnchor:`middle`,children:`#1`}),(0,U.jsx)(`text`,{x:`28`,y:`15`,fontSize:`10`,fill:n,children:`Ã1`})]}):e===`every_item`?(0,U.jsxs)(`svg`,{width:`48`,height:`22`,viewBox:`0 0 48 22`,fill:`none`,"aria-hidden":!0,children:[[0,1,2].map(e=>(0,U.jsx)(`rect`,{x:1+e*8,y:`4`,width:`13`,height:`14`,rx:`2`,stroke:n,fill:r,opacity:t?.18:1},e)),(0,U.jsx)(`text`,{x:`35`,y:`15`,fontSize:`9`,fill:n,children:`ÃN`})]}):(0,U.jsxs)(`svg`,{width:`48`,height:`22`,viewBox:`0 0 48 22`,fill:`none`,"aria-hidden":!0,children:[(0,U.jsx)(`rect`,{x:`1`,y:`4`,width:`14`,height:`14`,rx:`2`,stroke:n,fill:r,opacity:t?.18:1}),(0,U.jsx)(`text`,{x:`8`,y:`14`,fontSize:`7`,fontWeight:`700`,fill:n,textAnchor:`middle`,children:`#1`}),(0,U.jsx)(`rect`,{x:`20`,y:`4`,width:`10`,height:`14`,rx:`2`,stroke:n,fill:r,opacity:t?.18:1}),(0,U.jsx)(`rect`,{x:`32`,y:`4`,width:`10`,height:`14`,rx:`2`,stroke:n,fill:r,opacity:t?.18:1})]})}function Ku({feed:e}){let t=z(Te),n=u({mutationFn:()=>t({data:{recentSales:e.slice(-12).map(e=>({buyer:e.buyer,item:e.item,total:e.total})),availableItems:[]}})}),[r,i]=(0,V.useState)(!1),a=n.data?.suggestions??[],o=a.length;return(0,U.jsxs)(`div`,{style:{position:`relative`},children:[(0,U.jsxs)(`button`,{onClick:()=>{o||n.mutate(),i(e=>!e)},disabled:n.isPending,title:`AI scans the live feed and tells you who to upsell next`,style:{display:`inline-flex`,alignItems:`center`,gap:10,padding:`6px 12px 6px 8px`,borderRadius:999,background:`linear-gradient(135deg, #fffdf2 0%, #f3f7e6 100%)`,border:`1px solid #d9e0bb`,boxShadow:`0 1px 0 #e8edcf, 0 2px 8px rgba(74, 90, 48, 0.08)`,cursor:`pointer`,color:`#4a5a30`},children:[(0,U.jsx)(`span`,{style:{width:26,height:26,borderRadius:8,background:`linear-gradient(135deg, #8fbf3f, #c7a64a)`,color:`#fff`,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 2px 6px rgba(143,191,63,0.35)`,flex:`0 0 auto`},children:(0,U.jsx)(jt,{size:13})}),(0,U.jsxs)(`span`,{style:{textAlign:`left`,lineHeight:1.1},children:[(0,U.jsxs)(`span`,{style:{display:`block`,fontSize:12,fontWeight:700},children:[`AI bundle pushes`,o?` · ${o}`:``]}),(0,U.jsx)(`span`,{style:{display:`block`,fontSize:10.5,color:`#7a8560`},children:n.isPending?`Scanning the feedâ¦`:o?`Tap to see who to upsell`:`Who should you upsell next?`})]})]}),r&&(n.isSuccess||n.isError||n.isPending)&&(0,U.jsxs)(`div`,{className:`card`,style:{position:`absolute`,top:`calc(100% + 6px)`,left:0,zIndex:30,width:340,padding:12,maxHeight:340,overflow:`auto`,background:`linear-gradient(135deg, #fffdf2 0%, #f3f7e6 100%)`,border:`1px solid #d9e0bb`},children:[(0,U.jsxs)(`div`,{className:`between`,style:{marginBottom:8},children:[(0,U.jsx)(`strong`,{style:{fontSize:12,color:`#4a5a30`},children:`AI bundle pushes`}),(0,U.jsxs)(`button`,{className:`ghost`,style:{fontSize:11,padding:`2px 6px`},onClick:()=>n.mutate(),disabled:n.isPending,children:[(0,U.jsx)(jt,{size:11}),` Refresh`]})]}),n.isPending&&(0,U.jsx)(`div`,{style:{fontSize:12,color:`var(--pl-muted)`},children:`Scanning the feedâ¦`}),n.isError&&(0,U.jsx)(`div`,{style:{fontSize:12,color:`#c0392b`},children:`Couldn't reach the AI. Try again in a moment.`}),n.isSuccess&&o===0&&(0,U.jsx)(`div`,{style:{fontSize:12,color:`var(--pl-muted)`},children:e.length===0?`No sales yet â start the show or run the sample to get push ideas.`:`No strong bundle ideas right now. Keep selling and I'll suggest once a pattern shows up.`}),(0,U.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6},children:a.map((e,t)=>(0,U.jsxs)(`div`,{className:`coach-tip info`,style:{padding:`8px 10px`},children:[(0,U.jsxs)(`div`,{style:{fontSize:12},children:[(0,U.jsxs)(`strong`,{children:[`@`,e.buyer]}),` â `,e.suggestion]}),(0,U.jsx)(`div`,{style:{fontSize:11,color:`var(--pl-muted)`},children:e.reason})]},t))})]})]})}function qu(){let e=z(we),t=z(Le),{data:n}=R({queryKey:[`live-sales-giveaway`],queryFn:()=>e(),refetchInterval:5e3}),{data:r=[]}=R({queryKey:[`buyers`],queryFn:()=>t(),refetchOnWindowFocus:!1}),[i,a]=(0,V.useState)(`equal`),[o,s]=(0,V.useState)(`show`),[c,l]=(0,V.useState)(null),[u,d]=(0,V.useState)(!1),f=(0,V.useMemo)(()=>
51{if(o===`show`&&n?.sales?.length){let e=new Map;for(let t of n.sales){let n=e.get(t.buyer_username)??{name:t.buyer_username,spend:0,shows:1};n.spend+=Number(t.total??0),e.set(t.buyer_username,n)}return Array.from(e.values())}return r.map(e=>({name:e.username,spend:Number(e.lifetime_spend??0),shows:Number(e.shows_count??1)}))},[o,n,r]);return(0,U.jsxs)(`div`,{className:`grid`,style:{gridTemplateColumns:`minmax(0, 1.6fr) minmax(0, 1fr)`,gap:16},children:[(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsxs)(`div`,{className:`row`,style:{gap:10},children:[(0,U.jsx)(`span`,{className:`coach-ico`,children:(0,U.jsx)(I,{size:14})}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{style:{margin:0},children:`Giveaway picker`}),(0,U.jsxs)(`div`,{style:{fontSize:12,color:`var(--pl-muted)`},children:[`Pool: `,(0,U.jsx)(`strong`,{children:f.length}),` buyer`,f.length===1?``:`s`,` (`,o===`show`?`this show`:`lifetime`,`)`]})]})]}),(0,U.jsxs)(`div`,{style:{marginTop:14},children:[(0,U.jsx)(`div`,{className:`label`,children:`Pool`}),(0,U.jsxs)(`select`,{value:o,onChange:e=>s(e.target.value),children:[(0,U.jsx)(`option`,{value:`show`,children:`Buyers from active show`}),(0,U.jsx)(`option`,{value:`all`,children:`All lifetime buyers`})]})]}),(0,U.jsxs)(`div`,{style:{marginTop:14},children:[(0,U.jsx)(`div`,{className:`label`,children:`Weighting`}),(0,U.jsxs)(`select`,{value:i,onChange:e=>a(e.target.value),children:[(0,U.jsx)(`option`,{value:`equal`,children:`Equal chance`}),(0,U.jsx)(`option`,{value:`spend`,children:`Weighted by lifetime spend`}),(0,U.jsx)(`option`,{value:`repeat`,children:`Weighted by shows attended`})]})]}),(0,U.jsx)(`div`,{className:`actions`,style:{marginTop:14},children:(0,U.jsxs)(`button`,{className:`primary`,onClick:()=>{if(!f.length)return;d(!0);let e=f.map(e=>({name:e.name,w:i===`equal`?1:i===`spend`?Math.max(1,e.spend/50):Math.max(1,e.shows)})),t=e.reduce((e,t)=>e+t.w,0),n=0,r=setInterval(()=>{l(e[n%e.length].name),n++},80);setTimeout(()=>{clearInterval(r);let n=Math.random()*t,i=0;for(let t of e)if(i+=t.w,n<=i){l(t.name);break}d(!1);let a=_.get();if(a.enabled&&a.announceWinner){let t=(c??e[0]?.name??``).replace(/_/g,` `),n=(a.scenarios||[]).find(e=>e.event===`winner`&&e.enabled);Je((n?.line||`And the winner is, {buyer}!`).replace(/\{buyer\}/g,t),{voice:n?.voice||a.voiceURI||`shimmer`,speed:a.rate||1}).catch(()=>{})}},1600)},disabled:u||!f.length,children:[(0,U.jsx)(I,{size:14}),` `,u?`Spinningâ¦`:`Pick winner`]})})]}),(0,U.jsx)(`div`,{className:`card`,style:{display:`flex`,alignItems:`center`,justifyContent:`center`,minHeight:180},children:(0,U.jsxs)(`div`,{style:{textAlign:`center`},children:[(0,U.jsx)(`div`,{className:`kicker`,children:`Winner`}),(0,U.jsx)(`div`,{className:`metric`,style:{fontSize:42,marginTop:8},children:c?`@${c}`:`â`})]})})]})}function Ju({voiceOn:e,setVoiceOn:t}){let[n,r]=(0,V.useState)(()=>_.get()),[i,a]=(0,V.useState)(!1),o=e=>{let t={...n,...e};r(t),_.set(t)},s=async()=>{a(!0);try{await Je(`Box twelve. Combine for buyer seven.`,{voice:n.voiceURI||`nova`,speed:n.rate||1,channel:`private`,sinkId:n.privateSinkId})}finally{a(!1)}},c=e||n.enabled;return(0,U.jsxs)(`div`,{className:`card`,style:{padding:`12px 14px`},children:[(0,U.jsxs)(`div`,{className:`between`,style:{marginBottom:8},children:[(0,U.jsx)(`div`,{className:`kicker`,children:`Voice announcer â packer (you only)`}),(0,U.jsxs)(`button`,{onClick:()=>{t(!c),o({enabled:!c})},className:`ghost`,title:c?`Mute announcer`:`Unmute announcer`,"aria-label":c?`Mute announcer`:`Unmute announcer`,style:{padding:`4px 8px`,display:`inline-flex`,alignItems:`center`,gap:4,fontSize:12},children:[c?(0,U.jsx)(kt,{size:14}):(0,U.jsx)(At,{size:14}),c?`Mute`:`Unmute`]})]}),(0,U.jsx)(Yu,{title:`Private â packer (you only)`,subtitle:`Boxing & combine instructions on your headphones`,on:c,toggle:()=>{t(!e),o({enabled:!e})},hideToggle:!0,voiceId:n.voiceURI??`nova`,onVoice:e=>o({voiceURI:e}),rate:n.rate,onRate:e=>o({rate:e}),testing:i,onTest:s}),(0,U.jsxs)(`div`,{className:`row`,style:{gap:12,marginTop:10,fontSize:11,flexWrap:`wrap`},children:[(0,U.jsxs)(`label`,{className:`row`,style:{gap:4},children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:n.announceSale,onChange:e=>o({announceSale:e.target.checked})}),` Sales`]}),(0,U.jsxs)(`label`,{className:`row`,style:{gap:4},children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:n.announceCombine,onChange:e=>o({announceCombine:e.target.checked})}),` Combines`]}),(0,U.jsxs)(`label`,{className:`row`,style:{gap:4},children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:n.announceWinner,onChange:e=>o({announceWinner:e.target.checked})}),` Winners`]}),(0,U.jsx)(`span`,{style:{marginLeft:`auto`,color:`var(--pl-muted)`},children:`Plays on your device only â viewers don't hear this.`})]})]})}function Yu(e){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`between`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{style:{fontSize:12,fontWeight:600},children:e.title}),(0,U.jsx)(`div`,{style:{fontSize:11,color:`var(--pl-muted)`}
51,children:e.subtitle})]}),!e.hideToggle&&(0,U.jsxs)(`button`,{className:e.on?`primary`:`ghost`,onClick:e.toggle,style:{fontSize:12,padding:`4px 10px`},children:[(0,U.jsx)(kt,{size:12}),` `,e.on?`ON`:`OFF`]})]}),(0,U.jsxs)(`div`,{className:`row`,style:{gap:8,marginTop:6,flexWrap:`wrap`},children:[(0,U.jsx)(`select`,{value:e.voiceId,onChange:t=>e.onVoice(t.target.value),style:{flex:1,minWidth:160},children:Xe.filter(e=>e.group===`Standard`).map(e=>(0,U.jsxs)(`option`,{value:e.id,children:[e.label,` â `,e.desc]},e.id))}),(0,U.jsxs)(`label`,{style:{fontSize:11,color:`var(--pl-muted)`,display:`flex`,alignItems:`center`,gap:6},children:[`Speed`,(0,U.jsx)(`input`,{type:`range`,min:.7,max:1.6,step:.05,value:e.rate,onChange:t=>e.onRate(parseFloat(t.target.value)),style:{width:90}}),(0,U.jsxs)(`span`,{style:{width:28,textAlign:`right`},children:[e.rate.toFixed(2),`x`]})]}),(0,U.jsx)(`button`,{className:`secondary`,onClick:e.onTest,disabled:e.testing,style:{fontSize:12,padding:`4px 10px`},children:e.testing?`Playingâ¦`:`Test`})]})]})}var Xu={sale:`On every sale`,combine:`On combined shipping`,winner:`On giveaway winner`,big_sale:`On big sale (over threshold)`,first_time_buyer:`First-time buyer in this show`};function Zu({prefs:e,onChange:t}){let n=e.scenarios||[],[r,i]=(0,V.useState)({}),[a,o]=(0,V.useState)(!1),s=e=>a||!!r[e],c=e=>i(t=>({...t,[e]:!t[e]})),l=(e,r)=>t(n.map(t=>t.id===e?{...t,...r}:t)),u=e=>t(n.filter(t=>t.id!==e)),d=()=>t([...n,{id:`c-${Date.now().toString(36)}`,event:`sale`,enabled:!0,line:`Boom! {buyer} got it!`,voice:`nova`,channel:`private`}]),f=t=>Je(t.line.replace(/\{buyer\}/g,`threaded pear`).replace(/\{number\}/g,`12`).replace(/\{amount\}/g,`$87.00`).replace(/\{item\}/g,`mystery bundle`),{voice:t.voice,speed:(t.channel===`public`?e.publicRate:e.rate)||1,channel:t.channel??`private`,sinkId:t.channel===`public`?e.publicSinkId:e.privateSinkId});return(0,U.jsxs)(`div`,{style:{display:`grid`,gap:6},children:[(0,U.jsx)(`div`,{className:`row`,style:{gap:8,justifyContent:`flex-end`},children:(0,U.jsx)(`button`,{className:`ghost`,style:{fontSize:11,padding:`2px 8px`},onClick:()=>o(e=>!e),children:a?`Collapse all â´`:`Expand all â¾`})}),n.map(e=>{let t=s(e.id),n=Xe.find(t=>t.id===e.voice)?.label??e.voice;return(0,U.jsxs)(`div`,{style:{border:`1px solid var(--pl-line)`,borderRadius:6},children:[(0,U.jsxs)(`div`,{className:`row`,style:{gap:8,alignItems:`center`,padding:`6px 8px`,cursor:`pointer`},onClick:()=>c(e.id),children:[(0,U.jsx)(`span`,{style:{fontSize:11,width:14},children:t?`â¾`:`â¸`}),(0,U.jsx)(`input`,{type:`checkbox`,checked:e.enabled,onChange:t=>l(e.id,{enabled:t.target.checked}),onClick:e=>e.stopPropagation(),title:`Enable`}),(0,U.jsx)(`strong`,{style:{fontSize:12},children:Xu[e.event]}),(0,U.jsxs)(`span`,{style:{fontSize:11,color:`var(--pl-muted)`},children:[`· `,n]}),(0,U.jsx)(`span`,{style:{fontSize:10,padding:`1px 6px`,borderRadius:4,background:(e.channel??`private`)===`public`?`rgba(231,140,79,.18)`:`rgba(109,191,140,.18)`,color:(e.channel??`private`)===`public`?`#e78c4f`:`#6dbf8c`,fontWeight:600,textTransform:`uppercase`,letterSpacing:.4},children:(e.channel??`private`)===`public`?`Public`:`Private`}),(0,U.jsxs)(`span`,{style:{flex:1,fontSize:11,color:`var(--pl-muted)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:[`"`,e.line,`"`]}),(0,U.jsx)(`button`,{className:`ghost`,style:{fontSize:11,padding:`2px 8px`},onClick:t=>{t.stopPropagation(),f(e)},children:`Test`}),(0,U.jsx)(`button`,{className:`ghost`,style:{fontSize:11,padding:`2px 8px`,color:`#c66`},onClick:t=>{t.stopPropagation(),u(e.id)},children:`â`})]}),t&&(0,U.jsxs)(`div`,{className:`row`,style:{gap:6,alignItems:`center`,flexWrap:`wrap`,padding:`0 8px 8px 28px`},children:[(0,U.jsx)(`select`,{value:e.event,onChange:t=>l(e.id,{event:t.target.value}),style:{padding:`2px 6px`,fontSize:12,minWidth:170},children:Object.keys(Xu).map(e=>(0,U.jsx)(`option`,{value:e,children:Xu[e]},e))}),(0,U.jsxs)(`select`,{value:e.channel??`private`,onChange:t=>l(e.id,{channel:t.target.value}),style:{padding:`2px 6px`,fontSize:12},title:`Which audio channel plays this scenario`,children:[(0,U.jsx)(`option`,{value:`private`,children:`Private (packer)`}),(0,U.jsx)(`option`,{value:`public`,children:`Public (stream)`})]}),(0,U.jsx)(`select`,{value:e.voice,onChange:t=>l(e.id,{voice:t.target.value}),style:{padding:`2px 6px`,fontSize:12},children:[`Standard`,`Hype & fun`,`Characters`].map(e=>(0,U.jsx)(`optgroup`,{label:e,children:Xe.filter(t=>t.group===e).map(e=>(0,U.jsxs)(`option`,{value:e.id,children:[e.label,` â `,e.desc]},e.id))},e))}),(0,U.jsx)(`input`,{value:e.line,onChange:t=>l(e.id,{line:t.target.value}),style:{flex:1,minWidth:220,padding:`3px 8px`,fontSize:12},placeholder:`e.g. Cha-ching! {buyer} just dropped {amount}!`})]})]},e.id)}),(0,U.jsxs)(`div`,{className:`row`,style:{gap:8,justifyContent:`space-between`,marginTop:4},children:[(0,U.jsxs)(`div`,{style:{fontSize:11,color:`var(--pl-muted)`},children:[`Tokens: `,(0,U.jsx)(`code`,{children:`{buyer}`}),` `,(0,U.jsx)(`code`,{children:`{number}`}),` `,(0,U.jsx)(`code`,{children:`{amount}`}),` `,(0,U.jsx)(`code`,{children:`{item}`})]}),(0,U.jsx)(`button`,{className:`secondary`,style:{fontSize:12,padding:`3px 10px`},onClick:d,children:`+ Add scenario`})]})]})}function Qu(){let[e,t]=(0,V.useState)(()=>_.get()),[n,r]=(0,V.useState)(`Sold to buyer twelve`),[i,a]=(0,V.useState)(!1),[o,s]=(0,V.useState)([]),[c,l]=(0,V.useState)(!1);(0,V.useEffect)(()=>{let e=async()=>{try{let e=(await navigator.mediaDevices.enumerateDevices()).filter(e=>e.kind===`audiooutput`);l(e.length>0&&e.every(e=>!e.label)),s(e)}catch{}};return e(),navigator.mediaDevices?.addEventListener?.(`devicechange`,e),()=>navigator.mediaDevices?.removeEventListener?.(`devicechange`,e)},[]);let u=async()=>{try{(await navigator.mediaDevices.getUserMedia({audio:!0}
51)).getTracks().forEach(e=>e.stop()),s((await navigator.mediaDevices.enumerateDevices()).filter(e=>e.kind===`audiooutput`)),l(!1)}catch{}},d=n=>{let r={...e,...n};t(r),_.set(r)};return(0,U.jsxs)(`div`,{className:`grid`,children:[(0,U.jsxs)(`div`,{className:`grid cols2`,children:[(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsxs)(`div`,{className:`row`,style:{gap:10},children:[(0,U.jsx)(`span`,{className:`coach-ico`,children:(0,U.jsx)(kt,{size:14})}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{style:{margin:0},children:`Default voice`}),(0,U.jsx)(`div`,{style:{fontSize:12,color:`var(--pl-muted)`},children:`Used for hype callouts and any scenario that doesn't override the voice. Plays on your device only â viewers don't hear it unless you route it into OBS / a virtual audio cable.`})]})]}),(0,U.jsxs)(`div`,{className:`form`,style:{marginTop:14},children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`label`,children:`Test phrase`}),(0,U.jsx)(`input`,{value:n,onChange:e=>r(e.target.value)})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`label`,children:`Voice`}),(0,U.jsx)(`select`,{value:e.voiceURI??`nova`,onChange:e=>d({voiceURI:e.target.value||void 0}),children:[`Standard`,`Hype & fun`,`Characters`].map(e=>(0,U.jsx)(`optgroup`,{label:e,children:Xe.filter(t=>t.group===e).map(e=>(0,U.jsxs)(`option`,{value:e.id,children:[e.label,` â `,e.desc]},e.id))},e))})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:`label`,children:[`Speed: `,e.rate.toFixed(2),`Ã`]}),(0,U.jsx)(`input`,{type:`range`,min:`0.7`,max:`1.6`,step:`0.05`,value:e.rate,onChange:e=>d({rate:Number(e.target.value)})})]}),(0,U.jsxs)(`div`,{className:`row`,style:{gap:10,flexWrap:`wrap`},children:[(0,U.jsxs)(`button`,{className:`primary`,onClick:async()=>{a(!0);try{await Je(n,{voice:e.voiceURI||`nova`,speed:e.rate||1,channel:`private`,sinkId:e.privateSinkId})}finally{a(!1)}},disabled:i,children:[(0,U.jsx)(kt,{size:14}),` `,i?`Playingâ¦`:`Speak`]}),(0,U.jsxs)(`button`,{className:e.enabled?`primary`:`ghost`,onClick:()=>d({enabled:!e.enabled}),children:[(0,U.jsx)(wt,{size:14}),` Auto-announce: `,e.enabled?`ON`:`OFF`]}),(0,U.jsx)(`button`,{className:`ghost`,onClick:()=>Ye(),children:`Stop`})]})]})]}),(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsx)(`h3`,{style:{marginTop:0},children:`What to auto-announce`}),(0,U.jsxs)(`div`,{className:`form`,children:[(0,U.jsxs)(`label`,{className:`row`,style:{gap:8},children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:e.announceSale,onChange:e=>d({announceSale:e.target.checked})}),(0,U.jsxs)(`span`,{children:[`New sale â fires the `,(0,U.jsx)(`strong`,{children:`On every sale`}),` scenario`]})]}),(0,U.jsxs)(`label`,{className:`row`,style:{gap:8},children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:e.announceCombine,onChange:e=>d({announceCombine:e.target.checked})}),(0,U.jsxs)(`span`,{children:[`Combined shipping â fires the `,(0,U.jsx)(`strong`,{children:`On combined shipping`}),` scenario`]})]}),(0,U.jsxs)(`label`,{className:`row`,style:{gap:8},children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:e.announceWinner,onChange:e=>d({announceWinner:e.target.checked})}),(0,U.jsxs)(`span`,{children:[`Giveaway winner â fires the `,(0,U.jsx)(`strong`,{children:`On giveaway winner`}),` scenario`]})]}),(0,U.jsxs)(`label`,{className:`row`,style:{gap:8},title:`Sales at or above this amount fire the Big sale scenario.`,children:[(0,U.jsx)(`span`,{children:`Big sale threshold`}),(0,U.jsx)(`span`,{children:`⥠$`}),(0,U.jsx)(`input`,{type:`number`,min:0,step:5,value:e.bigSaleThreshold,onChange:e=>d({bigSaleThreshold:Number(e.target.value)||0}),style:{width:80,padding:`2px 6px`}})]})]})]})]}),(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsx)(`div`,{className:`between`,style:{marginBottom:8},children:(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{style:{margin:0},children:`Voice scenarios â say this when this happens`}),(0,U.jsxs)(`div`,{style:{fontSize:12,color:`var(--pl-muted)`,marginTop:2},children:[`Each scenario picks its own voice and line. Use tokens to fill in live data: `,(0,U.jsx)(`code`,{children:`{buyer}`}),` `,(0,U.jsx)(`code`,{children:`{number}`}),` `,(0,U.jsx)(`code`,{children:`{amount}`}),` `,(0,U.jsx)(`code`,{children:`{item}`}),`.`]})]})}),(0,U.jsx)(Zu,{prefs:e,onChange:e=>d({scenarios:e})})]}),(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsx)(`h3`,{style:{marginTop:0},children:`Output devices â route each channel`}),(0,U.jsxs)(`div`,{style:{fontSize:12,color:`var(--pl-muted)`,marginBottom:10},children:[`Send the `,(0,U.jsx)(`strong`,{children:`Private`}),` channel to your headphones and the `,(0,U.jsx)(`strong`,{children:`Public`}),` channel to a virtual audio cable (BlackHole on Mac, VB-Cable on Windows) that OBS / Whatnot uses as a mic input. Chromium-based browsers only.`]}),c&&(0,U.jsxs)(`div`,{className:`row`,style:{gap:8,marginBottom:10,fontSize:12},children:[(0,U.jsx)(`span`,{style:{color:`var(--pl-muted)`},children:`Device names are hidden until you grant audio permission once.`}),(0,U.jsx)(`button`,{className:`secondary`,onClick:u,style:{fontSize:12,padding:`2px 10px`},children:`Show device names`})]}),(0,U.jsxs)(`div`,{className:`grid cols2`,children:[(0,U.jsxs)(`label`,{style:{display:`grid`,gap:4},children:[(0,U.jsx)(`span`,{className:`label`,children:`Private (packer)`}),(0,U.jsxs)(`select`,{value:e.privateSinkId??``,onChange:e=>d({privateSinkId:e.target.value||void 0}),children:[(0,U.jsx)(`option`,{value:``,children:`System default`}),o.map(e=>(0,U.jsx)(`option`,{value:e.deviceId,children:e.label||`Output ${e.deviceId.slice(0,6)}`},e.deviceId))]})]}),(0,U.jsxs)(`label`,{style:{display:`grid`,gap:4},children:[(0,U.jsx)(`span`,{className:`label`,children:`Public (stream)`}),(0,U.jsxs)(`select`,{value:e.publicSinkId??``,onChange:e=>d({publicSinkId:e.target.value||void 0}),children:[(0,U.jsx)(`option`,{value:``,children:`System default`}),o.map(e=>(0,U.jsx)(`option`,{value:e.deviceId,children:e.label||`Output ${e.deviceId.slice(0,6)}`},e.deviceId))]})]})]}),(0,U.jsxs)(`div`,{className:`row`,style:{gap:8,marginTop:10,flexWrap:`wrap`},children:[(0,U.jsx)(`button`,{className:`ghost`,style:{fontSize:12,padding:`4px 10px`},onClick:()=>Je(`Private channel test â only you hear this.`,{voice:e.voiceURI||`nova`,speed:e.rate||1,channel:`private`,sinkId:e.privateSinkId}),children:`ð§ Test private`}),(0,U.jsx)(`button`,{className:`ghost`,style:{fontSize:12,padding:`4px 10px`},onClick:()=>Je(`Public channel test â viewers hear this!`,{voice:e.publicVoiceURI||`hype-coach`,speed:e.publicRate||1,channel:`public`,sinkId:e.publicSinkId}),children:`ð£ Test public`}),(0,U.jsx)(`span`,{style:{marginLeft:`auto`,fontSize:11,color:`var(--pl-muted)`},children:`Tip: both channels can play at the same time without overlapping each other.`})]})]})]})}function $u(){let{data:e=[]}=Cu(),[t,n]=(0,V.useState)(``);(0,V.useEffect)(()=>{!t&&e[0]&&n(e[0].id)},[t,e]);let r=e.find(e=>e.id===t)??e[0];return r?(0,U.jsxs)(`div`,{className:`grid`,children:[(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsxs)(`div`,{className:`between`,children:[(0,U.jsx)(`h3`,{style:{margin:0},children:`Recap a completed show`}),(0,U.jsxs)(`div`,{className:`row`,style:{gap:8},children:[(0,U.jsx)(`select`,{value:t,onChange:e=>n(e.target.value),style:{maxWidth:280},children:e.map(e=>(0,U.jsxs)(`option`,{value:e.id,children:[e.date,` · `,e.title]},e.id))}),(0,U.jsxs)(`button`,{className:`primary`,onClick:()=>{r&&h(`pearshow-recap-${r.id}.png`,{title:r.title,date:r.date,gross:r.gross,buyers:r.buyers,items:r.items,repeatRate:r.repeatRate,topBuyer:``})},children:[(0,U.jsx)(S,{size:14}),` Export PNG`]})]})]}),(0,U.jsxs)(`div`,{className:`cols4`,style:{marginTop:14},children:[(0,U.jsx)($,{label:`Gross`,value:`$${r.gross}`}),(0,U.jsx)($,{label:`Buyers`,value:String(r.buyers)}),(0,U.jsx)($,{label:`Items`,value:String(r.items)}),(0,U.jsx)($,{label:`Repeat rate`,value:`${Math.round(r.repeatRate*100)}%`})]}),(0,U.jsx)(`div`,{className:`note`,style:{marginTop:12,fontSize:12},children:`Tip: the PNG is sized for Instagram and easy to drop in DMs to brag about your show.`})]}),(0,U.jsx)(Zd,{surface:`show-recap`,buildContext:()=>r})]}):(0,U.jsx)(`div`,{className:`note`,children:`No completed shows yet. Sync Whatnot or run a live show to create recaps.`})}function ed(){return(0,U.jsxs)(`div`,{className:`grid`,style:{gap:16},children:[(0,U.jsx)(hf,{}),(0,U.jsx)(xd,{tabs:[{label:`Print queue`,content:(0,U.jsx)(td,{})},{label:`Packer view`,content:(0,U.jsx)(nd,{})},{label:`Reprint`,content:(0,U.jsx)(rd,{})},{label:`Print preview`,content:(0,U.jsx)(id,{})},{label:`Import CSV`,content:(0,U.jsx)(ad,{})}]})]})}function td(){let{data:e}=Su(5e3),t=(e??[]).map(xu),n=t.filter(e=>e.status===`Printed`).length,r=t.filter(e=>e.status===`Queued`).length,i=t.filter(e=>e.status===`Combined`).length;return(0,U.jsxs)(`div`,{className:`grid`,children:[(0,U.jsx)(Xd,{title:`Status`,text:`Queued, printed, combined, and failed jobs in one place. Chrome in kiosk-print mode fires labels silently to your default printer.`,children:(0,U.jsxs)(`div`,{className:`row`,children:[(0,U.jsxs)(`span`,{className:`pill new`,children:[n,` printed`]}),(0,U.jsxs)(`span`,{className:`pill`,children:[r,` queued`]}),(0,U.jsxs)(`span`,{className:`pill vip`,children:[i,` combined`]}),(0,U.jsxs)(`span`,{className:`pill`,children:[t.length,` total`]})]})}),(0,U.jsxs)(`div`,{className:`card`,style:{gridColumn:`1/-1`},children:[(0,U.jsx)(`h3`,{children:`All orders`}),(0,U.jsx)(Sd,{rows:t})]})]})}
51function nd(){let{data:e}=Su(5e3),t=(0,V.useMemo)(()=>(e??[]).map(xu),[e]),[n,r]=(0,V.useState)([]);(0,V.useEffect)(()=>r(t.map(e=>({...e,packed:!1}))),[t]);let i=e=>r(t=>t.map((t,n)=>n===e?{...t,packed:!t.packed}:t)),a=(0,V.useMemo)(()=>{let e=new Map;return n.forEach(t=>{let n=e.get(t.buyer)??[];n.push(t),e.set(t.buyer,n)}),Array.from(e.entries())},[n]),o=n.filter(e=>e.packed).length;return(0,U.jsxs)(`div`,{className:`grid`,children:[(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsxs)(`div`,{className:`between`,children:[(0,U.jsx)(`h3`,{style:{margin:0},children:`Packer view`}),(0,U.jsxs)(`span`,{className:`pill`,children:[(0,U.jsx)(wt,{size:10}),` `,o,`/`,n.length,` packed`]})]}),(0,U.jsx)(`p`,{children:`Tap each item as you pack it. Buyers are grouped automatically so you don't miss combines.`})]}),(0,U.jsxs)(`div`,{className:`grid cols2`,children:[a.length===0&&(0,U.jsx)(`div`,{className:`note`,children:`No orders yet. Whatnot sales will appear here as they sync.`}),a.map(([e,t])=>{let r=t.every(e=>e.packed);return(0,U.jsxs)(`div`,{className:`card`,style:{borderLeft:`3px solid ${r?`var(--pl-green)`:`var(--pl-gold)`}`},children:[(0,U.jsxs)(`div`,{className:`between`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:`kicker`,children:[`Buyer #`,String(t[0].number).padStart(2,`0`)]}),(0,U.jsxs)(`h3`,{style:{margin:`2px 0 0`},children:[`@`,e]})]}),(0,U.jsx)(`span`,{className:`status ${r?`ready`:`planned`}`,children:r?`Packed`:`${t.filter(e=>e.packed).length}/${t.length}`})]}),(0,U.jsx)(`div`,{style:{marginTop:10},children:t.map(e=>{let t=n.indexOf(e);return(0,U.jsxs)(`label`,{className:`row`,style:{gap:10,padding:`8px 0`,borderBottom:`1px solid var(--pl-line)`,cursor:`pointer`},children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:!!e.packed,onChange:()=>i(t),style:{width:18}}),(0,U.jsxs)(`span`,{style:{flex:1,textDecoration:e.packed?`line-through`:`none`,color:e.packed?`var(--pl-muted)`:`var(--pl-ink)`},children:[e.item,` `,(0,U.jsxs)(`span`,{style:{color:`var(--pl-muted)`},children:[`· Ã`,e.qty]})]}),(0,U.jsxs)(`span`,{style:{fontFamily:`var(--font-mono)`},children:[`$`,e.total.toFixed(2)]})]},t)})})]},e)})]})]})}function rd(){let[e,t]=(0,V.useState)(``),[n,r]=(0,V.useState)(`all`),{data:i}=Su(5e3),a=(i??[]).map(xu),o=a.filter(t=>n!==`all`&&t.status!==n?!1:e?t.buyer.includes(e.toLowerCase())||t.item.toLowerCase().includes(e.toLowerCase()):!0),s=a.some(e=>e.buyer_email),c=a.some(e=>e.shipping_address);return(0,U.jsxs)(`div`,{className:`grid`,children:[(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsx)(`h3`,{children:`Reprint labels`}),(0,U.jsxs)(`div`,{className:`row`,style:{gap:10,flexWrap:`wrap`},children:[(0,U.jsx)(`div`,{style:{flex:1,position:`relative`},children:(0,U.jsx)(`input`,{"aria-label":`Search buyer or itemâ¦`,placeholder:`Search buyer or itemâ¦`,value:e,onChange:e=>t(e.target.value)})}),(0,U.jsxs)(`select`,{value:n,onChange:e=>r(e.target.value),style:{maxWidth:180},children:[(0,U.jsx)(`option`,{value:`all`,children:`All statuses`}),(0,U.jsx)(`option`,{value:`Printed`,children:`Printed`}),(0,U.jsx)(`option`,{value:`Queued`,children:`Queued`}),(0,U.jsx)(`option`,{value:`Failed`,children:`Failed`})]}),(0,U.jsxs)(`button`,{className:`secondary`,children:[(0,U.jsx)(le,{size:14}),` Print all unprinted`]})]})]}),(0,U.jsx)(`div`,{className:`card`,children:(0,U.jsxs)(`table`,{className:`table`,children:[(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`th`,{children:`#`}),(0,U.jsx)(`th`,{children:`Buyer`}),s&&(0,U.jsx)(`th`,{children:`Email`}),c&&(0,U.jsx)(`th`,{children:`Address`}),(0,U.jsx)(`th`,{children:`Item`}),(0,U.jsx)(`th`,{children:`Qty`}),(0,U.jsx)(`th`,{children:`Total`}),(0,U.jsx)(`th`,{children:`Status`}),(0,U.jsx)(`th`,{})]})}),(0,U.jsxs)(`tbody`,{children:[o.map((e,t)=>(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`td`,{children:e.number}),(0,U.jsxs)(`td`,{children:[`@`,e.buyer]}),s&&(0,U.jsx)(`td`,{style:{fontSize:12},children:e.buyer_email||``}),c&&(0,U.jsx)(`td`,{style:{fontSize:12,maxWidth:200,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.shipping_address||``}),(0,U.jsx)(`td`,{children:e.item}),(0,U.jsx)(`td`,{children:e.qty}),(0,U.jsxs)(`td`,{children:[`$`,e.total.toFixed(2)]}),(0,U.jsx)(`td`,{children:(0,U.jsx)(`span`,{className:`status ${e.status===`Printed`?`ready`:e.status===`Failed`?`guarded`:`planned`}`,children:e.status})}),(0,U.jsx)(`td`,{children:(0,U.jsxs)(`button`,{className:`ghost`,style:{padding:`4px 10px`,fontSize:11},children:[(0,U.jsx)(le,{size:12}),` Reprint`]})})]},t)),o.length===0&&(0,U.jsx)(`tr`,{children:(0,U.jsx)(`td`,{colSpan:7+ +!!s+ +!!c,style:{color:`var(--pl-muted)`,textAlign:`center`,padding:20},children:`No orders yet.`})})]})]})})]})}function id(){let{data:e}=Su(1),t=(e??[]).map(xu)[0];return(0,U.jsxs)(`div`,{className:`grid cols2`,children:[(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsx)(`h3`,{children:`Browser print preview`}),(0,U.jsx)(`p`,{children:`Print your queued labels directly from the browser â no PearBridge needed for day one.`}),t?(0,U.jsx)(Yd,{buyer:t.buyer,number:t.number||1,item:t.item}):(0,U.jsx)(`div`,{className:`note`,children:`No synced order available for preview yet.`}),(0,U.jsxs)(`div`,{className:`actions`,style:{marginTop:12},children:[(0,U.jsxs)(`button`,{className:`primary`,onClick:()=>window.print(),children:[(0,U.jsx)(le,{size:14}),` Print this label`]}),(0,U.jsxs)(`button`,{className:`secondary`,children:[(0,U.jsx)(j,{size:14}),` Print all unprinted`]})]})]}),(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsx)(`h3`,{children:`Tips`}),(0,U.jsxs)(`ul`,{style:{paddingLeft:18,color:`var(--pl-muted)`,lineHeight:1.7},children:[(0,U.jsx)(`li`,{children:`Set paper size to your label size (4Ã6, 2Ã2, 1Ã1) in the browser print dialog.`}),(0,U.jsxs)(`li`,{children:[`For silent printing, install `,(0,U.jsx)(`strong`,{children:`PearBridge`}),` (Settings â Labels & printer).`]}),(0,U.jsx)(`li`,{children:`Browser preview is great for testing template layout before a show.`})]})]})]})}function ad(){let e=z(Ve),t=Ne(),[n,r]=(0,V.useState)(!1),[i,a]=(0,V.useState)(null),[o,s]=(0,V.useState)(null);return(0,U.jsxs)(`div`,{className:`grid cols2`,children:[(0,U.jsxs)(Xd,{title:`Drop a CSV`,text:`Upload a Whatnot, TikTok, or custom export. We clean it, number buyers, and queue labels.`,children:[(0,U.jsxs)(`label`,{className:`primary`,style:{cursor:n?`wait`:`pointer`,display:`inline-flex`,alignItems:`center`,gap:6},children:[(0,U.jsx)(Dt,{size:14}),` `,n?`Importingâ¦`:`Choose file`,(0,U.jsx)(`input`,{type:`file`,accept:`.csv,text/csv`,onChange:async n=>{let i=n.target.files?.[0];if(i){r(!0),s(null),a(null);try{let n=await i.text(),r=Mt.default.parse(n,{header:!0,skipEmptyLines:!0}),o=e=>e.toLowerCase().replace(/\s+/g,`_`).trim(),s=(e,t)=>{for(let n of t){let t=Object.keys(e).find(e=>o(e)===n);if(t&&e[t]!=null&&String(e[t]).trim()!==``)return String(e[t]).trim()}return``},c=r.data.map(e=>({buyer_username:s(e,[`buyer_username`,`buyer`,`username`,`customer`]),item_title:s(e,[`item_title`,`item`,`product`,`title`]),unit_price:parseFloat(s(e,[`unit_price`,`price`,`amount`,`gross_total`,`total`])||`0`)||0,qty:parseInt(s(e,[`quantity`,`qty`])||`1`,10)||1,category:s(e,[`category`,`type`])||void 0,sold_at:s(e,[`sold_at`,`date`,`order_date`])||void 0})).filter(e=>e.buyer_username&&e.item_title&&e.unit_price>=0);if(c.length===0)throw Error(`No valid rows found. Required: buyer_username, item_title, unit_price.`);let l=await e({data:{rows:c,showTitle:i.name.replace(/\.csv$/i,``)}});a({inserted:l.inserted,buyers:l.buyers}),t.invalidateQueries({queryKey:[`activeShowSales`]}),t.invalidateQueries({queryKey:[`buyers`]}),t.invalidateQueries({queryKey:[`recentSales`]})}catch(e){s(e instanceof Error?e.message:`Import failed`)}finally{r(!1),n.target.value=``}}},disabled:n,style:{display:`none`}})]}),i&&(0,U.jsxs)(`div`,{style:{marginTop:10,fontSize:13,color:`var(--pl-green-dark, #4a5a30)`},children:[`â Imported `,i.inserted,` sales across `,i.buyers,` buyers.`]}),o&&(0,U.jsx)(`div`,{style:{marginTop:10,fontSize:13,color:`#c0392b`},children:o})]}),(0,U.jsx)(Xd,{title:`Required columns`,text:`buyer_username, item_title, quantity, unit_price, sold_at. Optional: sku, category, gross_total.`}),(0,U.jsxs)(`div`,{className:`card`,style:{gridColumn:`1/-1`},children:[(0,U.jsx)(`h3`,{children:`What happens on import`}),(0,U.jsx)(`table`,{className:`table`,children:(0,U.jsxs)(`tbody`,{children:[(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`td`,{children:`1`}),(0,U.jsx)(`td`,{children:`Validate rows`}),(0,U.jsx)(`td`,{children:`Missing buyer, item, price, or date are flagged before import.`})]}),(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`td`,{children:`2`}),(0,U.jsx)(`td`,{children:`Detect duplicates`}),(0,U.jsx)(`td`,{children:`Similar rows are warned, never silently hidden.`})]}),(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`td`,{children:`3`}),(0,U.jsx)(`td`,{children:`Assign buyer numbers`}),(0,U.jsx)(`td`,{children:`One number per buyer per show.`})]}),(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`td`,{children:`4`}),(0,U.jsx)(`td`,{children:`Queue print jobs`}),(0,U.jsx)(`td`,{children:`Buyer or item labels based on your print mode.`})]})]})})]})]})}function od(){let[e,t]=Nu(),{installed:n,signedIn:r}=Pu(),i=n||e,a=e=>{fetch(`/${e}`).then(e=>{if(!e.ok)throw Error(`Download failed: ${e.status}`);return e.blob()}).then(t=>{let n=document.createElement(`a`);n.href=URL.createObjectURL(t),n.download=e,n.click(),URL.revokeObjectURL(n.href)}).catch(e=>alert(e.message))};return i?(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsxs)(`div`,{className:`between`,style:{alignItems:`center`,gap:12,flexWrap:`wrap`},children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`kicker`,children:`Printing`}),(0,U.jsx)(`h3`,{style:{margin:`2px 0 0`},children:`Automatic printing is on`}),(0,U.jsx)(`p`,{style:{margin:`6px 0 0`,fontSize:13,color:`var(--pl-muted)`},children:n&&r===!0?`The PearShow extension is connected. Labels print automatically as sales come in.`:`You've marked automatic printing as set up. Nothing more to do here.`})]}),(0,U.jsx)(`span`,{className:`status ready`,children:`Ready`})]}),e&&!(n&&r===!0)?(0,U.jsx)(`div`,{style:{marginTop:10},children:(0,U.jsx)(`button`,{className:`ghost`,style:{fontSize:12},onClick:()=>t(!1),children:`Reset printing setup`})}):null]}):(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsxs)(`div`,{className:`between`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`kicker`,children:`Printing`}),(0,U.jsx)(`h3`,{style:{margin:`2px 0 0`},children:`How your labels reach the printer`})]}),(0,U.jsx)(`span`,{className:`status ready`,children:`Ready to print`})]}),(0,U.jsx)(`p`,{style:{marginTop:8},children:`Labels print automatically when the PearShow extension is installed and connected. Browser print is the backup if someone is on a device without the extension.`}),(0,U.jsxs)(`div`,{style:{display:`grid`,gap:10,marginTop:10,gridTemplateColumns:`repeat(auto-fit, minmax(220px, 1fr))`},children:[(0,U.jsxs)(`div`,{style:{padding:12,borderRadius:8,border:`1px solid var(--pl-border, #2a3a25)`,background:`var(--pl-panel, #f7f8f3)`},children:[(0,U.jsxs)(`div`,{style:{fontWeight:700,marginBottom:4},children:[`1. Browser print `,(0,U.jsx)(`span`,{style:{fontSize:10,
51color:`#7c8a72`,marginLeft:4},children:`BACKUP`})]}),(0,U.jsx)(`div`,{style:{fontSize:12,color:`var(--pl-muted)`,marginBottom:8},children:`Works anywhere, but it uses the browser print dialog. Use this only if the extension is not available.`}),(0,U.jsxs)(`button`,{className:`primary`,onClick:()=>window.print(),children:[(0,U.jsx)(le,{size:14}),` Test browser print`]})]}),(0,U.jsxs)(`div`,{style:{padding:12,borderRadius:8,border:`1px solid var(--pl-border, #2a3a25)`,background:`var(--pl-panel, #f7f8f3)`},children:[(0,U.jsxs)(`div`,{style:{fontWeight:700,marginBottom:4,display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:6},children:[(0,U.jsxs)(`span`,{children:[`2. PearShow extension `,n&&r===!0?(0,U.jsx)(`span`,{style:{fontSize:10,color:`#4a6b2e`,marginLeft:4},children:`ACTIVE`}):null]}),(0,U.jsx)(`span`,{style:{fontSize:10,color:n?r?`#4a6b2e`:`#b58322`:`#7c8a72`,fontWeight:600},children:n?r?`Ready · Automatic`:r===!1?`Installed · Needs connection`:`Installed · Checking`:`Not installed`})]}),(0,U.jsxs)(`div`,{style:{fontSize:12,color:`var(--pl-muted)`,marginBottom:8},children:[`The PearShow Capture extension is the normal setup: sales come in and labels print automatically.`,n&&r===!1?` Open the ð toolbar icon once to connect this browser. After it connects, the Sign in button disappears.`:null]}),n&&r===!0?(0,U.jsx)(`div`,{style:{fontSize:12,color:`#4a6b2e`,fontWeight:700},children:`Automatic printing is on.`}):(0,U.jsx)(`button`,{className:`secondary`,onClick:()=>window.dispatchEvent(new CustomEvent(`pl:tabs-goto`,{detail:`Browser extension`})),children:n?`Connect extension`:`Install extension`})]}),(0,U.jsxs)(`div`,{style:{padding:12,borderRadius:8,border:`1px solid var(--pl-border, #2a3a25)`,background:`var(--pl-panel, #f7f8f3)`},children:[(0,U.jsxs)(`div`,{style:{fontWeight:700,marginBottom:4},children:[`3. PearBridge shortcut `,(0,U.jsx)(`span`,{style:{fontSize:10,color:`#7c8a72`,marginLeft:4},children:`ADVANCED`})]}),(0,U.jsx)(`div`,{style:{fontSize:12,color:`var(--pl-muted)`,marginBottom:8},children:`Only if the extension is not an option. Launches Chrome in kiosk mode straight to your printer.`}),(0,U.jsxs)(`div`,{className:`actions`,style:{flexWrap:`wrap`,gap:6},children:[(0,U.jsxs)(`button`,{className:`secondary`,onClick:()=>a(`pearshow-print-mac.command`),children:[(0,U.jsx)(S,{size:12}),` Mac`]}),(0,U.jsxs)(`button`,{className:`secondary`,onClick:()=>a(`pearshow-print-windows.bat`),children:[(0,U.jsx)(S,{size:12}),` Windows`]})]})]})]}),(0,U.jsxs)(`div`,{className:`row`,style:{marginTop:12,padding:`10px 12px`,borderRadius:8,background:e?`#eef5e6`:`#f4f7ef`,border:`1px solid ${e?`#5a8f3a`:`#b8c9a6`}`,alignItems:`center`,justifyContent:`space-between`,gap:12,flexWrap:`wrap`},children:[(0,U.jsx)(`span`,{style:{fontSize:13,color:`#1a2110`},children:e||n&&r===!0?`Automatic printing is on. The Live Show reminder is hidden.`:`Already printing automatically? Mark printing as set up to hide the Live Show reminder.`}),(0,U.jsx)(`button`,{className:e?`ghost`:`primary`,onClick:()=>t(!e),style:{fontSize:12,padding:`6px 10px`},children:e?`Reset`:`Mark automatic printing on`})]}),(0,U.jsx)(`div`,{className:`note`,style:{marginTop:10,fontSize:12},children:`Vendor setup: install the extension once, connect it once, then run the show. Browser print stays available as a backup.`}),(0,U.jsxs)(`details`,{style:{marginTop:10,padding:`10px 12px`,borderRadius:8,background:`var(--pl-panel, #f7f8f3)`,border:`1px solid var(--pl-border, #2a3a25)`,color:`#1a2110`,fontSize:13},children:[(0,U.jsx)(`summary`,{style:{cursor:`pointer`,fontWeight:600},children:`Mac blocked the PearBridge shortcut? (Optional â 10-second fix)`}),(0,U.jsxs)(`p`,{style:{marginTop:8},children:[`Easiest path: use `,(0,U.jsx)(`strong`,{children:`browser print`}),` or the `,(0,U.jsx)(`strong`,{children:`browser extension`}),` instead â no download, no warning.`]}),(0,U.jsxs)(`p`,{style:{marginTop:6},children:[`If you want the shortcut anyway, macOS blocks unsigned`,` `,(0,U.jsx)(`code`,{children:`.command`}),` files on first launch. Pick either fix:`]}),(0,U.jsxs)(`ol`,{style:{margin:`6px 0 0 18px`,lineHeight:1.5},children:[(0,U.jsxs)(`li`,{children:[(0,U.jsx)(`strong`,{children:`Right-click â Open`}),` on `,(0,U.jsx)(`code`,{children:`pearshow-print-mac.command`}),`in Finder, then click `,(0,U.jsx)(`strong`,{children:`Open`}),` in the warning dialog. macOS remembers the choice.`]}),(0,U.jsxs)(`li`,{children:[`Or open `,(0,U.jsx)(`strong`,{children:`System Settings â Privacy & Security`}),`, scroll to the blocked-file notice, and click `,(0,U.jsx)(`strong`,{children:`Open Anyway`}),`.`]}),(0,U.jsxs)(`li`,{children:[`Or paste this in Terminal to clear the quarantine flag, then double-click normally:`,(0,U.jsxs)(`div`,{style:{display:`flex`,gap:6,marginTop:6,alignItems:`center`,flexWrap:`wrap`},children:[(0,U.jsx)(`code`,{style:{background:`#1a1a1a`,color:`#f5f5f5`,padding:`4px 8px`,borderRadius:4},children:`xattr -d com.apple.quarantine ~/Downloads/pearshow-print-mac.command`}),(0,U.jsx)(`button`,{className:`secondary`,style:{fontSize:12,padding:`4px 10px`},onClick:()=>{navigator.clipboard?.writeText(`xattr -d com.apple.quarantine ~/Downloads/pearshow-print-mac.command`).then(()=>Rt.success(`Command copied`)).catch(()=>{})},children:`Copy`})]})]})]})]})]})}function sd(){let e=z(Le),{data:t=[]}=R({queryKey:[`buyers`],queryFn:()=>e(),refetchOnWindowFocus:!1}),[n,r]=(0,V.useState)(``),[i,a]=(0,V.useState)(null),[o,s]=(0,V.useState)(()=>O.get());(0,V.useEffect)(()=>{let e=()=>s(O.get());return typeof window<`u`&&window.addEventListener(`storage`,e),()=>{typeof window<`u`&&window.removeEventListener(`storage`,e)}},[]);let c=(0,V.useMemo)(()=>t.map(e=>({...e,derivedTag:x(e,o)}
51)),[t,o]),l=(0,V.useMemo)(()=>{let e=n.trim().toLowerCase();return e?c.filter(t=>t.username?.toLowerCase().includes(e)||(t.tag??t.derivedTag??``).toLowerCase().includes(e)||(t.notes??``).toLowerCase().includes(e)):c},[c,n]),u=c.length,d=c.filter(e=>(e.tag??e.derivedTag)===`VIP`).length,f=u?Math.round(c.reduce((e,t)=>e+Number(t.lifetime_spend??0),0)/u):0,p=c.some(e=>e.email),m=c.some(e=>e.shipping_address),h=6+ +!!p+ +!!m;return(0,U.jsxs)(`div`,{className:`grid`,children:[(0,U.jsx)(Zd,{surface:`buyers`,buildContext:()=>({lifetime:u,vips:d,avgSpend:f,topBuyers:t.slice(0,10).map(e=>({username:e.username,lifetimeSpend:Number(e.lifetime_spend??0),tag:e.tag}))})}),(0,U.jsxs)(`div`,{className:`cols3 grid`,children:[(0,U.jsx)($,{label:`Lifetime buyers`,value:String(u)}),(0,U.jsx)($,{label:`VIP buyers`,value:String(d)}),(0,U.jsx)($,{label:`Avg buyer spend`,value:`$${f}`})]}),(0,U.jsx)(mf,{}),(0,U.jsxs)(`div`,{className:`card`,style:{gridColumn:`1/-1`},children:[(0,U.jsxs)(`div`,{className:`between`,children:[(0,U.jsx)(`h3`,{style:{margin:0},children:`Buyer book`}),(0,U.jsx)(`input`,{"aria-label":`Searchâ¦`,placeholder:`Searchâ¦`,value:n,onChange:e=>r(e.target.value),style:{maxWidth:240}})]}),(0,U.jsxs)(`table`,{className:`table`,children:[(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`th`,{children:`Buyer`}),p&&(0,U.jsx)(`th`,{children:`Email`}),m&&(0,U.jsx)(`th`,{children:`Address`}),(0,U.jsx)(`th`,{children:`Tag`}),(0,U.jsx)(`th`,{children:`Last seen`}),(0,U.jsx)(`th`,{children:`Lifetime spend`}),(0,U.jsx)(`th`,{children:`Notes`}),(0,U.jsx)(`th`,{})]})}),(0,U.jsxs)(`tbody`,{children:[l.length===0&&(0,U.jsx)(`tr`,{children:(0,U.jsx)(`td`,{colSpan:h,style:{color:`var(--pl-muted)`,textAlign:`center`,padding:20},children:`No buyers yet. Start a live show or import a CSV.`})}),l.map(e=>(0,U.jsxs)(`tr`,{style:{cursor:`pointer`},onClick:()=>a({id:e.id,username:e.username}),children:[(0,U.jsxs)(`td`,{children:[`@`,e.username]}),p&&(0,U.jsx)(`td`,{style:{fontSize:12},children:e.email||``}),m&&(0,U.jsx)(`td`,{style:{fontSize:12,maxWidth:200,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.shipping_address||``}),(0,U.jsx)(`td`,{children:e.tag?(0,U.jsx)(`span`,{className:`pill ${e.tag===`VIP`?`vip`:`new`}`,children:e.tag}):e.derivedTag?(0,U.jsxs)(`span`,{className:`pill ${e.derivedTag===`VIP`?`vip`:`new`}`,title:`Auto-tagged`,children:[e.derivedTag,` â¦`]}):(0,U.jsx)(`span`,{className:`pill`,children:`â`})}),(0,U.jsx)(`td`,{children:e.last_seen_at?new Date(e.last_seen_at).toLocaleDateString():`â`}),(0,U.jsxs)(`td`,{children:[`$`,Number(e.lifetime_spend??0).toFixed(2)]}),(0,U.jsx)(`td`,{style:{color:`var(--pl-muted)`},children:e.notes??``}),(0,U.jsx)(`td`,{children:(0,U.jsxs)(`button`,{className:`ghost`,style:{fontSize:11,padding:`4px 10px`},onClick:t=>{t.stopPropagation(),a({id:e.id,username:e.username})},children:[(0,U.jsx)(ct,{size:12}),` History`]})})]},e.id))]})]})]}),i&&(0,U.jsx)(cd,{buyer:i,onClose:()=>a(null)})]})}function cd({buyer:e,onClose:t}){let n=z(_e),{data:r,isLoading:i}=R({queryKey:[`buyer-history`,e.id],queryFn:()=>n({data:{buyerId:e.id}})});return(0,U.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Buyer history`,onClick:t,style:{position:`fixed`,inset:0,background:`rgba(20,18,12,0.45)`,zIndex:50,display:`flex`,justifyContent:`flex-end`},children:(0,U.jsxs)(`div`,{onClick:e=>e.stopPropagation(),style:{width:`min(560px, 95vw)`,height:`100%`,background:`var(--pl-cream)`,borderLeft:`1px solid var(--pl-line-strong)`,overflowY:`auto`,padding:20},children:[(0,U.jsxs)(`div`,{className:`between`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`kicker`,children:`Buyer history`}),(0,U.jsxs)(`h2`,{style:{margin:`2px 0 0`},children:[`@`,e.username]})]}),(0,U.jsx)(`button`,{className:`ghost`,onClick:t,children:`Close`})]}),i&&(0,U.jsx)(`div`,{className:`note`,style:{marginTop:16},children:`Loadingâ¦`}),r&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`cols3 grid`,style:{marginTop:14},children:[(0,U.jsx)($,{label:`Lifetime spend`,value:`$${Number(r.buyer?.lifetime_spend??0).toFixed(2)}`}),(0,U.jsx)($,{label:`Shows attended`,value:String(r.shows.length)}),(0,U.jsx)($,{label:`Items`,value:String(r.sales.reduce((e,t)=>
51e+Number(t.qty??1),0))})]}),(r.buyer?.email||r.buyer?.shipping_address)&&(0,U.jsxs)(`div`,{className:`card`,style:{marginTop:14,fontSize:13},children:[(0,U.jsx)(`div`,{className:`kicker`,style:{marginBottom:6},children:`Contact info`}),r.buyer?.email&&(0,U.jsxs)(`div`,{style:{marginBottom:4},children:[(0,U.jsx)(`b`,{children:`Email:`}),` `,r.buyer.email]}),r.buyer?.shipping_address&&(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`b`,{children:`Address:`}),` `,r.buyer.shipping_address]})]}),(0,U.jsxs)(`div`,{className:`card`,style:{marginTop:14},children:[(0,U.jsx)(`h3`,{style:{margin:0},children:`Shows`}),(0,U.jsxs)(`table`,{className:`table`,children:[(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`th`,{children:`Date`}),(0,U.jsx)(`th`,{children:`Show`}),(0,U.jsx)(`th`,{children:`Items`}),(0,U.jsx)(`th`,{children:`Spend`})]})}),(0,U.jsxs)(`tbody`,{children:[r.shows.map(e=>(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`td`,{children:e.date?new Date(e.date).toLocaleDateString():`â`}),(0,U.jsx)(`td`,{children:e.title}),(0,U.jsx)(`td`,{children:e.items}),(0,U.jsxs)(`td`,{children:[`$`,e.total.toFixed(2)]})]},e.id)),!r.shows.length&&(0,U.jsx)(`tr`,{children:(0,U.jsx)(`td`,{colSpan:4,style:{color:`var(--pl-muted)`,textAlign:`center`,padding:16},children:`No purchases yet.`})})]})]})]}),(0,U.jsxs)(`div`,{className:`card`,style:{marginTop:14},children:[(0,U.jsx)(`h3`,{style:{margin:0},children:`Every purchase`}),(0,U.jsxs)(`table`,{className:`table`,children:[(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`th`,{children:`When`}),(0,U.jsx)(`th`,{children:`Item`}),(0,U.jsx)(`th`,{children:`Qty`}),(0,U.jsx)(`th`,{children:`Total`})]})}),(0,U.jsx)(`tbody`,{children:r.sales.map(e=>(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`td`,{children:e.sold_at?new Date(e.sold_at).toLocaleDateString():`â`}),(0,U.jsx)(`td`,{children:e.item_title}),(0,U.jsx)(`td`,{children:e.qty}),(0,U.jsxs)(`td`,{children:[`$`,Number(e.total??0).toFixed(2)]})]},e.id))})]})]})]})]})})}function ld(){let{data:e=[]}=Cu(),[t,n]=(0,V.useState)(``),[r,i]=(0,V.useState)(``),[a,o]=(0,V.useState)(``),[s,c]=(0,V.useState)([]),[l,u]=(0,V.useState)(`all`);(0,V.useEffect)(()=>{e.length&&(t||n(e[0].id),r||i(e[0].id),a||o((e[1]??e[0]).id),s.length||c(e.slice(0,4).map(e=>e.id)))},[r,a,s.length,t,e]);let d=e.find(e=>e.id===r)??e[0],f=e.find(e=>e.id===a)??e[1]??e[0],p=e.reduce((e,t)=>e+t.gross,0),m=e.reduce((e,t)=>e+t.items,0),h=e.length?e.reduce((e,t)=>e+t.repeatRate,0)/e.length:0;return e.length?(0,U.jsxs)(`div`,{className:`grid`,children:[(0,U.jsx)(Zd,{surface:`reports`,buildContext:()=>({last6ShowsGross:e.slice(0,6).reverse().map(e=>e.gross),gross30d:p,itemsSold:m,repeatRate:h})}),(0,U.jsxs)(`div`,{className:`grid cols2`,children:[(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsx)(`h3`,{children:`Show performance â last 6`}),(0,U.jsx)(`div`,{className:`chart`,children:e.slice(0,6).reverse().map(t=>{let n=Math.max(...e.map(e=>e.gross),1);return(0,U.jsx)(`div`,{className:`bar`,style:{height:Math.max(20,Math.round(t.gross/n*180))},title:`${t.title}: $${t.gross}`},t.id)})})]}),(0,U.jsxs)(`div`,{className:`cols2 grid`,children:[(0,U.jsx)($,{label:`Gross sales`,value:`$${p.toLocaleString()}`}),(0,U.jsx)($,{label:`Items sold`,value:String(m)}),(0,U.jsx)($,{label:`Repeat rate`,value:`${Math.round(h*100)}%`}),(0,U.jsx)($,{label:`Shows`,value:String(e.length)})]})]}),(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsxs)(`div`,{className:`between`,children:[(0,U.jsx)(`h3`,{style:{margin:0},children:`Show archive`}),(0,U.jsxs)(`span`,{className:`pill`,children:[e.length,` shows · click a row to expand`]})]}),(0,U.jsxs)(`table`,{className:`table`,children:[(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`th`,{style:{width:24}}),(0,U.jsx)(`th`,{children:`Date`}),(0,U.jsx)(`th`,{children:`Show`}),(0,U.jsx)(`th`,{children:`Gross`}),(0,U.jsx)(`th`,{children:`Buyers`}),(0,U.jsx)(`th`,{children:`Items`}),(0,U.jsx)(`th`,{children:`Repeat`})]})}),(0,U.jsx)(`tbody`,{children:e.map(e=>{let r=t===e.id;return(0,U.jsxs)(V.Fragment,{children:[(0,U.jsxs)(`tr`,{style:{background:r?`var(--pl-cream)`:void 0,cursor:`pointer`},onClick:()=>n(r?``:e.id),children:[(0,U.jsx)(`td`,{style:{color:`#9c6b2f`,fontWeight:700,textAlign:`center`},children:r?`â¾`:`â¸`}),(0,U.jsx)(`td`,{children:e.date}),(0,U.jsx)(`td`,{children:(0,U.jsx)(`strong`,{children:e.title})}),(0,U.jsxs)(`td`,{children:[`$`,e.gross]}),(0,U.jsx)(`td`,{children:e.buyers}),(0,U.jsx)(`td`,{children:e.items}),(0,U.jsxs)(`td`,{children:[Math.round(e.repeatRate*100),`%`]})]}
51),r?(0,U.jsx)(`tr`,{children:(0,U.jsx)(`td`,{colSpan:7,style:{background:`var(--pl-cream)`,padding:12},children:(0,U.jsx)(dd,{show:e})})}):null]},e.id)})})]})]}),(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsxs)(`div`,{className:`between`,children:[(0,U.jsx)(`h3`,{style:{margin:0},children:`Compare two shows`}),(0,U.jsxs)(`div`,{className:`row`,style:{gap:8},children:[(0,U.jsx)(`select`,{value:r,onChange:e=>i(e.target.value),children:e.map(e=>(0,U.jsxs)(`option`,{value:e.id,children:[e.date,` · `,e.title]},e.id))}),(0,U.jsx)(`span`,{style:{color:`var(--pl-muted)`},children:`vs`}),(0,U.jsx)(`select`,{value:a,onChange:e=>o(e.target.value),children:e.map(e=>(0,U.jsxs)(`option`,{value:e.id,children:[e.date,` · `,e.title]},e.id))})]})]}),(0,U.jsxs)(`div`,{className:`cols4`,style:{marginTop:14},children:[(0,U.jsx)(pd,{label:`Gross`,a:`$${d.gross}`,b:`$${f.gross}`,delta:fd(f.gross,d.gross)}),(0,U.jsx)(pd,{label:`Buyers`,a:String(d.buyers),b:String(f.buyers),delta:fd(f.buyers,d.buyers)}),(0,U.jsx)(pd,{label:`Items`,a:String(d.items),b:String(f.items),delta:fd(f.items,d.items)}),(0,U.jsx)(pd,{label:`Repeat`,a:`${Math.round(d.repeatRate*100)}%`,b:`${Math.round(f.repeatRate*100)}%`,delta:fd(f.repeatRate,d.repeatRate)})]}),(0,U.jsx)(`div`,{style:{marginTop:14},children:(0,U.jsx)(Zd,{surface:`compare`,buildContext:()=>({a:d,b:f})})})]}),(0,U.jsx)(ud,{shows:e,selectedIds:s,setSelectedIds:c,platform:l,setPlatform:u})]}):(0,U.jsx)(`div`,{className:`note`,children:`No show reports yet. Sync Whatnot past shows/orders to populate reports with real data.`})}function ud({shows:e,selectedIds:t,setSelectedIds:n,platform:r,setPlatform:i}){let a=e.map(e=>({...e,platform:`Whatnot`})),o=r===`all`?a:a.filter(e=>e.platform===r),s=o.filter(e=>t.includes(e.id)),c=e=>{t.includes(e)?n(t.filter(t=>t!==e)):t.length<6&&n([...t,e])};return(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsxs)(`div`,{className:`between`,style:{flexWrap:`wrap`,gap:10},children:[(0,U.jsx)(`h3`,{style:{margin:0},children:`Per-show comparison`}),(0,U.jsxs)(`div`,{className:`row`,style:{gap:8,flexWrap:`wrap`},children:[(0,U.jsx)(`span`,{style:{fontSize:12,color:`var(--pl-muted)`},children:`Platform`}),(0,U.jsxs)(`select`,{value:r,onChange:e=>i(e.target.value),children:[(0,U.jsx)(`option`,{value:`all`,children:`All platforms`}),(0,U.jsx)(`option`,{value:`Whatnot`,children:`Whatnot`}),(0,U.jsx)(`option`,{value:`TikTok Live`,children:`TikTok Live`}),(0,U.jsx)(`option`,{value:`Facebook Live`,children:`Facebook Live`})]}),(0,U.jsxs)(`span`,{className:`pill`,children:[s.length,`/`,Math.min(6,o.length),` selected · max 6`]})]})]}),(0,U.jsx)(`div`,{className:`row`,style:{gap:6,flexWrap:`wrap`,marginTop:10},children:o.map(e=>{let n=t.includes(e.id);return(0,U.jsxs)(`button`,{onClick:()=>c(e.id),className:n?`primary`:`ghost`,style:{fontSize:12,padding:`6px 10px`},title:`${e.platform} · ${e.title}`,children:[n?`â `:``,e.date,` · `,e.title]},e.id)})}),s.length===0?(0,U.jsx)(`div`,{style:{marginTop:14,padding:16,textAlign:`center`,color:`var(--pl-muted)`,fontSize:13},children:`Pick 2â6 shows above to compare side-by-side.`}):(0,U.jsxs)(`div`,{style:{marginTop:14,overflowX:`auto`},children:[(0,U.jsxs)(`table`,{className:`table`,children:[(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`th`,{style:{minWidth:110},children:`Metric`}),s.map(e=>(0,U.jsxs)(`th`,{style:{minWidth:140},children:[(0,U.jsx)(`div`,{style:{fontWeight:700},children:e.title}),(0,U.jsxs)(`div`,{style:{fontSize:11,color:`var(--pl-muted)`,fontWeight:500},children:[e.date,` · `,e.platform]})]},e.id))]})}),(0,U.jsx)(`tbody`,{children:[{label:`Gross`,get:e=>`$${e.gross}`,raw:e=>e.gross,fmt:e=>`$${Math.round(e)}`},{label:`Buyers`,get:e=>e.buyers,raw:e=>e.buyers},{label:`Items`,get:e=>e.items,raw:e=>e.items},{label:`AOV / item`,get:e=>`$${e.items?(e.gross/e.items).toFixed(2):`0`}`,raw:e=>e.items?e.gross/e.items:0,fmt:e=>`$${e.toFixed(2)}`},{label:`$ / buyer`,get:e=>`$${e.buyers?(e.gross/e.buyers).toFixed(2):`0`}`,raw:e=>e.buyers?e.gross/e.buyers:0,fmt:e=>`$${e.toFixed(2)}`},{label:`Repeat`,get:e=>`${Math.round(e.repeatRate*100)}%`,raw:e=>e.repeatRate,fmt:e=>`${Math.round(e*100)}%`}].map(e=>{let t=s.map(e.raw),n=Math.max(...t);return(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`td`,{style:{color:`var(--pl-muted)`},children:e.label}),s.map((r,i)=>{let a=t[i]===n&&s.length>1;return(0,U.jsxs)(`td`,{style:{fontFamily:`var(--font-mono)`,fontWeight:700,color:a?`var(--accent, #5a8f3a)`:void 0},children:[e.get(r),a?` â
`:``]},r.id)})]},e.label)})})]}),(0,U.jsx)(`div`,{style:{fontSize:11,color:`var(--pl-muted)`,marginTop:8},children:`â
best in row`})]})]})}function dd({show:e}){let t=e.items?Math.round(e.gross/e.items*100)/100:0,n=e.buyers?Math.round(e.gross/e.buyers*100)/100:0;return(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsxs)(`div`,{className:`between`,children:[(0,U.jsxs)(`h3`,{style:{margin:0},children:[`Show detail â `,e.title]}),(0,U.jsx)(`span`,{className:`pill`,children:e.date})]}),(0,U.jsxs)(`div`,{className:`cols4 grid`,style:{marginTop:12},children:[(0,U.jsx)($,{label:`Gross`,value:`$${e.gross}`}),(0,U.jsx)($,{label:`AOV / item`,value:`$${t}`}),(0,U.jsx)($,{label:`$ per buyer`,value:`$${n}`}),(0,U.jsx)($,{label:`Repeat`,value:`${Math.round(e.repeatRate*100)}%`})]}
51),(0,U.jsxs)(`div`,{className:`grid cols2`,style:{marginTop:14},children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`label`,children:`Top buyers this show`}),(0,U.jsxs)(`table`,{className:`table`,children:[(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`th`,{children:`Buyer`}),(0,U.jsx)(`th`,{children:`Items`}),(0,U.jsx)(`th`,{children:`Spend`})]})}),(0,U.jsx)(`tbody`,{children:(0,U.jsx)(`tr`,{children:(0,U.jsx)(`td`,{colSpan:3,style:{color:`var(--pl-muted)`,textAlign:`center`,padding:16},children:`Buyer detail appears after Whatnot order rows sync.`})})})]})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`label`,children:`Top items this show`}),(0,U.jsxs)(`table`,{className:`table`,children:[(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`th`,{children:`Item`}),(0,U.jsx)(`th`,{children:`Units`}),(0,U.jsx)(`th`,{children:`Revenue`})]})}),(0,U.jsx)(`tbody`,{children:(0,U.jsx)(`tr`,{children:(0,U.jsx)(`td`,{colSpan:3,style:{color:`var(--pl-muted)`,textAlign:`center`,padding:16},children:`Item detail appears after Whatnot order rows sync.`})})})]})]})]}),(0,U.jsxs)(`div`,{style:{marginTop:14},children:[(0,U.jsx)(`div`,{className:`label`,children:`Sales by hour`}),(0,U.jsx)(`div`,{className:`note`,children:`Hourly detail appears after timestamped Whatnot order rows sync.`})]}),(0,U.jsxs)(`div`,{style:{marginTop:14},children:[(0,U.jsx)(`div`,{className:`label`,children:`Show notes`}),(0,U.jsx)(`textarea`,{placeholder:`What worked? What to change next show?`,style:{width:`100%`,minHeight:80,border:`1px solid var(--pl-line-strong)`,borderRadius:6,padding:10,background:`#fff`,color:`var(--pl-ink)`,font:`inherit`}})]})]})}function fd(e,t){return t?Math.round((e-t)/t*100):0}function pd({label:e,a:t,b:n,delta:r}){let i=r>0;return(0,U.jsxs)(`div`,{className:`card`,style:{padding:14},children:[(0,U.jsx)(`div`,{className:`label`,children:e}),(0,U.jsxs)(`div`,{className:`row`,style:{gap:10,alignItems:`baseline`},children:[(0,U.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:22,fontWeight:700},children:t}),(0,U.jsx)(`span`,{style:{color:`var(--pl-muted)`},children:`â`}),(0,U.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:22,fontWeight:700},children:n})]}),(0,U.jsxs)(`div`,{style:{fontSize:12,marginTop:4,color:i?`var(--pl-green)`:`var(--pl-red)`,fontWeight:700},children:[i?`â²`:r<0?`â¼`:`·`,` `,Math.abs(r),`%`]})]})}function md(){return(0,U.jsx)(xd,{tabs:[{label:`Profile & brand`,content:(0,U.jsx)(hd,{})},{label:`Live channels`,content:(0,U.jsx)(_d,{})},{label:`Labels & printer`,content:(0,U.jsx)(vd,{})},{label:`Auto-tag rules`,content:(0,U.jsx)(yd,{})},{label:`Browser extension`,content:(0,U.jsx)(gd,{})},{label:`Billing`,content:(0,U.jsx)(bd,{})}]})}function hd(){let[e,t]=(0,V.useState)(``),[n,r]=(0,V.useState)(``),[i,a]=(0,V.useState)(``),[o,s]=(0,V.useState)(`America/Los_Angeles`);return(0,U.jsxs)(`div`,{className:`grid cols2`,children:[(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsx)(`h3`,{children:`Your brand`}),(0,U.jsxs)(`div`,{className:`form`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`label`,children:`Business name`}),(0,U.jsx)(`input`,{value:e,onChange:e=>t(e.target.value)})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`label`,children:`Live handle`}),(0,U.jsx)(`input`,{value:n,onChange:e=>r(e.target.value)})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`label`,children:`Tagline (shown in DMs)`}),(0,U.jsx)(`input`,{value:i,onChange:e=>a(e.target.value)})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`label`,children:`Time zone`}),(0,U.jsxs)(`select`,{value:o,onChange:e=>s(e.target.value),children:[(0,U.jsx)(`option`,{children:`America/Los_Angeles`}),(0,U.jsx)(`option`,{children:`America/Denver`}),(0,U.jsx)(`option`,{children:`America/Chicago`}),(0,U.jsx)(`option`,{children:`America/New_York`})]})]}),(0,U.jsx)(`button`,{className:`primary`,style:{marginTop:8,width:`fit-content`},children:`Save profile`})]})]}),(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsx)(`h3`,{children:`Show defaults`}),(0,U.jsxs)(`div`,{className:`form`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`label`,children:`Default show length`}),(0,U.jsxs)(`select`,{children:[(0,U.jsx)(`option`,{children:`1 hour`}),(0,U.jsx)(`option`,{children:`2 hours`}),(0,U.jsx)(`option`,{children:`3 hours`})]})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`label`,children:`Default category`}),(0,U.jsxs)(`select`,{children:[(0,U.jsx)(`option`,{children:`Apparel`}),(0,U.jsx)(`option`,{children:`Cards / collectibles`}),(0,U.jsx)(`option`,{children:`Handmade`}),(0,U.jsx)(`option`,{children:`Beauty`}),(0,U.jsx)(`option`,{children:`Other`})]})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`label`,children:`Auto-end show after no sales forâ¦`}),(0,U.jsxs)(`select`,{children:[(0,U.jsx)(`option`,{children:`10 min`}),(0,U.jsx)(`option`,{children:`20 min`}),(0,U.jsx)(`option`,{children:`30 min`}),(0,U.jsx)(`option`,{children:`Never`})]})]})]})]})]})}function gd(){let e=z(fe),t=z(De),n=z(Ie),r=z(xe),i=Ne(),{data:a,isLoading:o}=R({queryKey:[`ingest-token`],queryFn:()=>e({data:{}})}),s=typeof window>`u`?`https://pearshow.com`:window.location.origin,c=a?.token??``,[l,u]=(0,V.useState)({status:`idle`}),[d,f]=(0,V.useState)({status:`idle`}),p=async()=>{u({status:`running`});try{let e=await n({data:{}});e.ok?u({status:`ok`,ms:e.ms,msg:`Token valid, ingest endpoint reachable in ${e.ms}ms. No test data written.`}):u({status:`fail`,msg:`${e.step}: ${e.message}`})}catch(e){u({status:`fail`,msg:e instanceof Error?e.message:`unknown error`})}},m=e=>navigator.clipboard?.writeText(e);return(0,U.jsxs)(`div`,{className:`grid cols2`,children:[(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsxs)(`h3`,{children:[(0,U.jsx)(y,{size:16,style:{verticalAlign:`-3px`,marginRight:6}}),` PearShow Capture`]}),(0,U.jsxs)(`p`,{className:`muted`,style:{fontSize:13,marginTop:4},children:[`Oneâclick install from the Chrome Web Store. Auto-captures sales on`,` `,(0,U.jsx)(`strong`,{children:`Whatnot`}),`; `,(0,U.jsx)(`strong`,{children:`TikTok Live`}),` and `,(0,U.jsx)(`strong`,{children:`Facebook Live`}),` are in`,` `,(0,U.jsx)(`em`,{children:`beta`}),` â we watch chat for sale-shaped lines and queue them for one-click confirm before printing.`]}
51),(0,U.jsxs)(`div`,{className:`card`,style:{padding:16,marginTop:12,background:`linear-gradient(180deg,#f3f7e4,#ffffff)`,border:`1px solid #d8e0bd`},children:[(0,U.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,U.jsx)(`div`,{style:{width:44,height:44,borderRadius:10,background:`#fff`,border:`1px solid #e6e2d0`,display:`grid`,placeItems:`center`},children:(0,U.jsx)(y,{size:24,color:`#3a4a1d`})}),(0,U.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,U.jsx)(`strong`,{style:{fontSize:15},children:`Get PearShow Capture for Chrome`}),(0,U.jsx)(`div`,{className:`muted`,style:{fontSize:12},children:`Works in Chrome, Edge, Brave, Arc, Opera, and any Chromium browser.`})]}),(0,U.jsxs)(`a`,{href:D,target:`_blank`,rel:`noopener noreferrer`,className:`primary`,style:{display:`inline-flex`,alignItems:`center`,gap:6,textDecoration:`none`},children:[(0,U.jsx)(y,{size:14}),` Add to Chrome`]})]}),(0,U.jsxs)(`ol`,{style:{fontSize:12,lineHeight:1.7,marginTop:12,paddingLeft:18,color:`var(--pl-muted)`},children:[(0,U.jsxs)(`li`,{children:[`Click `,(0,U.jsx)(`strong`,{children:`Add to Chrome`}),` and confirm `,(0,U.jsx)(`em`,{children:`Add extension`}),`.`]}),(0,U.jsx)(`li`,{children:`Pin the ð icon to your toolbar (puzzleâpiece menu â pin).`}),(0,U.jsxs)(`li`,{children:[`Click the ð icon. If it says `,(0,U.jsx)(`strong`,{children:`Connected to PearShow`}),`, youâre done.`]})]}),(0,U.jsx)(`div`,{style:{display:`flex`,gap:8,marginTop:8,flexWrap:`wrap`},children:(0,U.jsx)(`a`,{href:C,target:`_blank`,rel:`noopener noreferrer`,className:`ghost`,style:{fontSize:12,textDecoration:`none`},children:`Microsoft Edge Addâons â`})})]}),(0,U.jsxs)(`div`,{className:`grid cols2`,style:{gap:10,marginTop:10},children:[(0,U.jsxs)(`div`,{className:`card`,style:{padding:12,opacity:.85},children:[(0,U.jsx)(`strong`,{children:`Firefox`}),(0,U.jsxs)(`div`,{className:`muted`,style:{fontSize:12,marginTop:4},children:[`In review on addons.mozilla.org. `,(0,U.jsx)(`em`,{children:`Coming soon.`})]})]}),(0,U.jsxs)(`div`,{className:`card`,style:{padding:12,opacity:.85},children:[(0,U.jsx)(`strong`,{children:`Safari (macOS / iOS)`}),(0,U.jsxs)(`div`,{className:`muted`,style:{fontSize:12,marginTop:4},children:[`Submitted to the App Store. `,(0,U.jsx)(`em`,{children:`Coming soon.`})]})]})]})]}),(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsx)(`h3`,{children:`Your connection`}),(0,U.jsxs)(`div`,{className:`form`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`label`,children:`Server URL`}),(0,U.jsxs)(`div`,{className:`row`,style:{gap:8},children:[(0,U.jsx)(`input`,{readOnly:!0,value:s,style:{flex:1}}),(0,U.jsx)(`button`,{className:`ghost`,onClick:()=>m(s),children:(0,U.jsx)(ot,{size:14})})]})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`label`,children:`Seller token (keep private)`}),(0,U.jsxs)(`div`,{className:`row`,style:{gap:8},children:[(0,U.jsx)(`input`,{readOnly:!0,value:o?`Loadingâ¦`:c,style:{flex:1,fontFamily:`ui-monospace, Menlo, monospace`}}),(0,U.jsx)(`button`,{className:`ghost`,onClick:()=>m(c),disabled:!c,children:(0,U.jsx)(ot,{size:14})})]})]}),(0,U.jsxs)(`button`,{className:`ghost`,style:{width:`fit-content`,marginTop:4},onClick:async()=>{confirm(`Rotate token? The old one will stop working immediately.`)&&(await t({data:{}}),i.invalidateQueries({queryKey:[`ingest-token`]}))},children:[(0,U.jsx)(v,{size:14}),` Rotate token`]})]}),(0,U.jsx)(_f,{}),(0,U.jsxs)(`div`,{className:`card`,style:{marginTop:12,padding:12,background:`rgba(120,150,200,0.06)`},children:[(0,U.jsxs)(`div`,{className:`between`,style:{alignItems:`flex-start`,gap:12},children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:`Extension smoke test`}),(0,U.jsx)(`div`,{className:`muted`,style:{fontSize:12,marginTop:2},children:`Sends a synthetic sale through the live ingest endpoint and verifies it round-trips. The test sale is auto-deleted so it never shows in reports.`})]}),(0,U.jsx)(`button`,{className:`primary`,onClick:p,disabled:l.status===`running`||!c,children:l.status===`running`?`Testingâ¦`:`Run test`})]}),l.status===`ok`&&(0,U.jsxs)(`div`,{style:{marginTop:10,padding:10,borderRadius:8,background:`rgba(80,180,120,0.12)`,color:`#bff5cd`,fontSize:12},children:[`â
Pipeline healthy â `,l.msg]}),l.status===`fail`&&(0,U.jsxs)(`div`,{style:{marginTop:10,padding:10,borderRadius:8,background:`rgba(220,90,90,0.14)`,color:`#ffd2d2`,fontSize:12},children:[`â `,l.msg]})]}),(0,U.jsxs)(`div`,{className:`card`,style:{marginTop:12,padding:12,background:`rgba(220,90,90,0.07)`},children:[(0,U.jsxs)(`div`,{className:`between`,style:{alignItems:`flex-start`,gap:12},children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:`Clear test buyer data`}),(0,U.jsx)(`div`,{className:`muted`,style:{fontSize:12,marginTop:2},children:`Removes extension smoke-test buyers and sales, then refreshes your insights.`})]}),(0,U.jsxs)(`button`,{className:`ghost`,onClick:async()=>
51{if(confirm(`Remove PearShow test buyer data from your account?`)){f({status:`running`});try{let e=await r({data:{}});f({status:`ok`,msg:`Removed ${e.salesRemoved} test sale${e.salesRemoved===1?``:`s`} and ${e.buyersRemoved} test buyer${e.buyersRemoved===1?``:`s`}.`}),await Promise.all([i.invalidateQueries({queryKey:[`recentSales`]}),i.invalidateQueries({queryKey:[`buyers`]}),i.invalidateQueries({queryKey:[`home-live-stats`]})])}catch(e){f({status:`fail`,msg:e instanceof Error?e.message:`Could not clear test data.`})}}},disabled:d.status===`running`,children:[(0,U.jsx)(te,{size:14}),` `,d.status===`running`?`Clearingâ¦`:`Clear tests`]})]}),d.status===`ok`&&(0,U.jsxs)(`div`,{style:{marginTop:10,fontSize:12,color:`#bff5cd`},children:[`â
`,d.msg]}),d.status===`fail`&&(0,U.jsxs)(`div`,{style:{marginTop:10,fontSize:12,color:`#ffd2d2`},children:[`â `,d.msg]})]}),(0,U.jsxs)(`div`,{className:`note`,style:{marginTop:12,fontSize:12},children:[`The extension also adds a ð `,(0,U.jsx)(`strong`,{children:`Log sale`}),` button on every Whatnot, TikTok Live, and Facebook Live page â tap it to record any sale manually if auto-capture misses one.`]})]})]})}function _d(){let{stores:e,loading:t,refetch:n}=La(),i=z(et),a=z(Qe),o=Ne(),[s,c]=(0,V.useState)(``),[l,u]=(0,V.useState)(`whatnot`),[d,f]=(0,V.useState)(``),[p,m]=(0,V.useState)(!1),h=[{id:`whatnot`,label:`Whatnot`,account:`Whatnot account`,how:`extension`,hint:`Sign in to whatnot.com in Chrome, then connect with the PearShow browser extension.`},{id:`tiktok_live`,label:`TikTok LIVE`,account:`TikTok account`,how:`extension`,hint:`Sign in to tiktok.com in Chrome, then connect with the PearShow browser extension.`},{id:`facebook_live`,label:`Facebook Live`,account:`Facebook page / profile`,how:`extension`,hint:`Sign in to facebook.com in Chrome, then connect with the PearShow browser extension.`},{id:`other`,label:`Other / Manual`,account:`Any live platform`,how:`manual`,hint:`Log sales by hand from the Live Show screen â works anywhere, nothing to install.`}],g=e=>h.find(t=>t.id===e)??h[h.length-1];async function _(){if(!s.trim()){alert(`Give this channel a nickname (e.g. 'Threaded Pear · Whatnot').`);return}m(!0);try{await i({data:{name:s.trim(),handle:d.trim()||void 0,platform:l}}),c(``),f(``),await o.invalidateQueries({queryKey:[`stores`]}),n()}catch(e){alert(e?.message??`Could not add channel.`)}finally{m(!1)}}async function v(e){if(confirm(`Remove this live channel? Past data stays.`))try{await a({data:{id:e}}),await o.invalidateQueries({queryKey:[`stores`]}),n()}catch(e){alert(e?.message??`Could not remove.`)}}return(0,U.jsxs)(`div`,{className:`grid`,style:{gap:16},children:[(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsx)(`h3`,{style:{marginTop:0},children:`Your live channels`}),(0,U.jsx)(`div`,{className:`kicker`,style:{opacity:.75,marginBottom:12},children:`A live channel is one place you sell live â your Whatnot shop, your TikTok LIVE account, your Facebook Live page, etc.`}),t?(0,U.jsx)(`div`,{style:{opacity:.7},children:`Loadingâ¦`}):e.length===0?(0,U.jsx)(`div`,{style:{opacity:.7},children:`No channels yet. Add your first one below.`}):(0,U.jsx)(`div`,{className:`grid cols2`,style:{gap:12},children:e.map(e=>{let t=g(e.platform);return(0,U.jsxs)(`div`,{className:`card`,style:{background:`var(--pl-surface-2, rgba(0,0,0,0.03))`},children:[(0,U.jsxs)(`div`,{className:`between`,style:{alignItems:`flex-start`},children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{style:{fontWeight:700,fontSize:16},children:e.name}),(0,U.jsxs)(`div`,{style:{fontSize:13,opacity:.75},children:[t.label,e.handle?` · @${e.handle.replace(/^@/,``)}`:``,e.is_primary?` · Primary`:``]})]}),(0,U.jsx)(`span`,{className:`status ready`,children:`Active`})]}),(0,U.jsx)(`div`,{style:{fontSize:12,opacity:.7,marginTop:8},children:t.hint}),(0,U.jsxs)(`div`,{className:`row`,style:{gap:8,marginTop:12},children:[t.how===`extension`?(0,U.jsx)(r,{to:`/getting-started`,className:`primary`,style:{textDecoration:`none`},children:`Connect with extension`}):(0,U.jsx)(`button`,{className:`primary`,onClick:()=>window.dispatchEvent(new CustomEvent(`pl:go-live`)),children:`Open Live Show`}),!e.is_primary&&(0,U.jsx)(`button`,{className:`ghost`,onClick:()=>v(e.id),children:`Remove`})]})]},e.id)})})]}),(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsx)(`h3`,{style:{marginTop:0},children:`Add a live channel`}),(0,U.jsxs)(`div`,{className:`grid cols3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`label`,children:`Nickname`}),(0,U.jsx)(`input`,{"aria-label":`Channel nickname`,placeholder:`My Whatnot store`,value:s,onChange:e=>c(e.target.value)})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`label`,children:`Platform`}
51),(0,U.jsx)(`select`,{value:l,onChange:e=>u(e.target.value),children:h.map(e=>(0,U.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:`label`,children:[`Your handle on that platform `,(0,U.jsx)(`span`,{style:{opacity:.6},children:`(optional)`})]}),(0,U.jsx)(`input`,{"aria-label":`Platform handle`,placeholder:`yourhandle`,value:d,onChange:e=>f(e.target.value)})]})]}),(0,U.jsxs)(`div`,{className:`row`,style:{gap:8,marginTop:12},children:[(0,U.jsx)(`button`,{className:`primary`,disabled:p,onClick:_,children:p?`Addingâ¦`:`Add channel`}),(0,U.jsxs)(`div`,{style:{fontSize:12,opacity:.7},children:[`After adding, hit `,(0,U.jsx)(`strong`,{children:`Connect with extension`}),` on the channel card.`]})]})]})]})}function vd(){let[e,t]=(0,V.useState)(()=>w.get()),n=n=>{let r={...e,...n};t(r),w.set(r)};return(0,U.jsxs)(`div`,{className:`grid cols2`,children:[(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsxs)(`div`,{className:`between`,children:[(0,U.jsx)(`h3`,{style:{margin:0},children:`Label designer`}),(0,U.jsx)(`button`,{className:`ghost`,onClick:()=>{t(E),w.set(E)},children:`Reset`})]}),(0,U.jsxs)(`div`,{className:`form`,style:{marginTop:12},children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`label`,children:`Label size preset`}),(0,U.jsxs)(`select`,{value:e.size,onChange:e=>{let t=e.target.value,r={"4x6":{w:4,h:6},"3x2":{w:3,h:2},"2.25x1.25":{w:2.25,h:1.25},"2x2":{w:2,h:2},"2x1":{w:2,h:1},"1x1":{w:1,h:1}};n(t===`custom`?{size:t}:{size:t,widthIn:r[t].w,heightIn:r[t].h})},children:[(0,U.jsx)(`option`,{value:`4x6`,children:`4 à 6 in (shipping)`}),(0,U.jsx)(`option`,{value:`3x2`,children:`3 à 2 in (Dymo)`}),(0,U.jsx)(`option`,{value:`2.25x1.25`,children:`2.25 à 1.25 in (Dymo address)`}),(0,U.jsx)(`option`,{value:`2x2`,children:`2 à 2 in (buyer sticker)`}),(0,U.jsx)(`option`,{value:`2x1`,children:`2 à 1 in (small)`}),(0,U.jsx)(`option`,{value:`1x1`,children:`1 à 1 in (mini)`}),(0,U.jsx)(`option`,{value:`custom`,children:`Custom sizeâ¦`})]})]}),(0,U.jsxs)(`div`,{className:`grid cols2`,style:{gap:8},children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`label`,children:`Width (in)`}),(0,U.jsx)(`input`,{type:`number`,min:`0.5`,max:`12`,step:`0.05`,value:e.widthIn,onChange:e=>n({size:`custom`,widthIn:Math.max(.25,Number(e.target.value)||0)})})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`label`,children:`Height (in)`}),(0,U.jsx)(`input`,{type:`number`,min:`0.5`,max:`12`,step:`0.05`,value:e.heightIn,onChange:e=>n({size:`custom`,heightIn:Math.max(.25,Number(e.target.value)||0)})})]})]}),(0,U.jsx)(`div`,{className:`kicker`,style:{opacity:.7},children:`Tip: type any width à height to match your roll (e.g. 2 à 1, 1.5 à 0.5). The preview and printed label resize automatically.`}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`label`,children:`Business name on label`}),(0,U.jsx)(`input`,{value:e.businessName,onChange:e=>n({businessName:e.target.value})})]}),(0,U.jsxs)(`div`,{className:`grid cols2`,style:{gap:8},children:[(0,U.jsxs)(`label`,{className:`row`,style:{gap:8},children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:e.showBuyerNumber,onChange:e=>n({showBuyerNumber:e.target.checked})}),` Buyer number`]}),(0,U.jsxs)(`label`,{className:`row`,style:{gap:8},children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:e.showUsername,onChange:e=>n({showUsername:e.target.checked})}),` Username`]}),(0,U.jsxs)(`label`,{className:`row`,style:{gap:8},children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:e.showItem,onChange:e=>n({showItem:e.target.checked})}),` Item title`]}),(0,U.jsxs)(`label`,{className:`row`,style:{gap:8},children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:e.showBusinessName,onChange:e=>n({showBusinessName:e.target.checked})}),` Business name`]}),(0,U.jsxs)(`label`,{className:`row`,style:{gap:8},children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:e.showBarcode,onChange:e=>n({showBarcode:e.target.checked})}),` Barcode block`]}),(0,U.jsxs)(`label`,{className:`row`,style:{gap:8},children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:e.showQR,onChange:e=>n({showQR:e.target.checked})}),` QR code (tag lookup)`]})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:`label`,children:[`Font scale: `,e.fontScale.toFixed(2),`Ã`]}),(0,U.jsx)(`input`,{type:`range`,min:`0.8`,max:`1.4`,step:`0.05`,value:e.fontScale,onChange:e=>n({fontScale:Number(e.target.value)})})]}),(0,U.jsxs)(`div`,{className:`grid cols2`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:`label`,children:[`Calibration X (mm): `,e.offsetX]}),(0,U.jsx)(`input`,{type:`range`,min:`-5`,max:`5`,step:`0.5`,value:e.offsetX,onChange:e=>n({offsetX:Number(e.target.value)})})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:`label`,children:[`Calibration Y (mm): `,e.offsetY]}),(0,U.jsx)(`input`,{type:`range`,min:`-5`,max:`5`,step:`0.5`,value:e.offsetY,onChange:e=>n({offsetY:Number(e.target.value)})})]})]})]})]}),(0,U.jsxs)(`div`,{className:`card`,style:{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:16},children:[(0,U.jsx)(`div`,{className:`kicker`,children:`Live preview`}),(0,U.jsx)(Yd,{buyer:`buyer`,number:1,item:`Item`,design:e}),(0,U.jsx)(`div`,{className:`row`,style:{gap:8},children:(0,U.jsxs)(`button`,{className:`primary`,onClick:()=>window.print(),children:[(0,U.jsx)(le,{size:14}),` Print test label`]})})]}),(0,U.jsx)(od,{})]})}function yd(){let[e,t]=(0,V.useState)(()=>O.get()),n=e=>{t(e),O.set(e)},r=(t,r)=>n(e.map(e=>e.id===t?{...e,...r}:e)),i=t=>n(e.filter(e=>e.id!==t));return(0,U.jsx)(`div`,{className:`grid`,children:(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsxs)(`div`,{className:`between`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`kicker`,children:`Auto-tagging`}),(0,U.jsx)(`h3`,{style:{margin:`2px 0 0`},children:`Rules that label buyers automatically`})]}),(0,U.jsx)(`button`,{className:`primary`,onClick:()=>n([...e,{id:`r_${Date.now().toString(36)}`,tag:`New tag`}]),children:`+ Add rule`})]}),(0,U.jsx)(`p`,{className:`muted`,style:{fontSize:13,marginTop:6},children:`A buyer matches a rule when any threshold is true. Manually-set tags always win.`}),(0,U.jsxs)(`table`,{className:`table`,style:{marginTop:8},children:[(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`th`,{children:`Tag`}),(0,U.jsx)(`th`,{children:`Min lifetime spend`}),(0,U.jsx)(`th`,{children:`Min shows attended`}),(0,U.jsx)(`th`,{})]})}),(0,U.jsxs)(`tbody`,{children:[e.map(e=>(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`td`,{children:(0,U.jsx)(`input`,{value:e.tag,onChange:t=>r(e.id,{tag:t.target.value})})}),(0,U.jsx)(`td`,{children:(0,U.jsx)(`input`,{"aria-label":`â`,type:`number`,min:`0`,step:`1`,value:e.minLifetimeSpend??``,placeholder:`â`,onChange:t=>r(e.id,{minLifetimeSpend:t.target.value===``?void 0:Number(t.target.value)})})}),(0,U.jsx)(`td`,{children:(0,U.jsx)(`input`,{"aria-label":`â`,type:`number`,min:`0`,step:`1`,value:e.minShows??``,placeholder:`â`,onChange:t=>r(e.id,{minShows:t.target.value===``?void 0:Number(t.target.value)})})}),(0,U.jsx)(`td`,{children:(0,U.jsx)(`button`,{className:`ghost`,onClick:()=>i(e.id),style:{fontSize:11},children:`Remove`})})]},e.id)),!e.length&&(0,U.jsx)(`tr`,{children:(0,U.jsx)(`td`,{colSpan:4,style:{color:`var(--pl-muted)`,textAlign:`center`,padding:16},children:`No rules yet â buyers will only show manually-set tags.`})})]})]}),(0,U.jsx)(`div`,{className:`note`,style:{marginTop:10,fontSize:12},children:`Rules apply instantly in the Buyer book â auto-tags appear with a ⦠next to them.`})]})})}function bd(){return(0,U.jsxs)(`div`,{className:`grid cols2`,children:[(0,U.jsx)(Xd,{title:`Plan`,text:`PearShow Pro â $19.99/mo. Unlimited shows, buyers, labels, and AI Coach.`,children:(0,U.jsx)(`button`,{className:`secondary`,children:`Manage billing`})}),(0,U.jsx)(Xd,{title:`Invoices`,text:`Past invoices and payment method live in your billing portal.`})]})}function xd({tabs:e}){let[t,n]=(0,V.useState)(e[0].label);(0,V.useEffect)(()=>{let t=t=>{let r=t.detail;e.some(e=>e.label===r)&&n(r)};return window.addEventListener(`pl:tabs-goto`,t),()=>window.removeEventListener(`pl:tabs-goto`,t)},[e]);let r=e.find(e=>e.label===t)??e[0];return(0,U.jsxs)(`div`,{className:`grid`,style:{gap:16},children:[(0,U.jsx)(`div`,{className:`row`,style:{gap:6,flexWrap:`wrap`,borderBottom:`1px solid var(--pl-line)`,paddingBottom:8},children:e.map(e=>(0,U.jsx)(`button`,{onClick:()=>n(e.label),className:t===e.label?`primary`:`ghost`,style:{padding:`6px 12px`,fontSize:11},children:e.label},e.label))}),r.content]}
51)}function Sd({rows:e=[]}){let t=e.some(e=>e.buyer_email),n=e.some(e=>e.shipping_address);return(0,U.jsxs)(`table`,{className:`table`,children:[(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`th`,{children:`#`}),(0,U.jsx)(`th`,{children:`Buyer`}),t&&(0,U.jsx)(`th`,{children:`Email`}),n&&(0,U.jsx)(`th`,{children:`Address`}),(0,U.jsx)(`th`,{children:`Item`}),(0,U.jsx)(`th`,{children:`Qty`}),(0,U.jsx)(`th`,{children:`Total`}),(0,U.jsx)(`th`,{children:`Label`})]})}),(0,U.jsxs)(`tbody`,{children:[e.length===0&&(0,U.jsx)(`tr`,{children:(0,U.jsx)(`td`,{colSpan:5+ +!!t+ +!!n,style:{color:`var(--pl-muted)`,textAlign:`center`,padding:20},children:`No orders yet.`})}),e.map((e,r)=>(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`td`,{children:e.number}),(0,U.jsx)(`td`,{children:e.buyer}),t&&(0,U.jsx)(`td`,{style:{fontSize:12},children:e.buyer_email||``}),n&&(0,U.jsx)(`td`,{style:{fontSize:12,maxWidth:200,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.shipping_address||``}),(0,U.jsx)(`td`,{children:e.item}),(0,U.jsx)(`td`,{children:e.qty}),(0,U.jsxs)(`td`,{children:[`$`,e.total.toFixed(2)]}),(0,U.jsx)(`td`,{children:e.status})]},r))]})]})}var Cd={whatnot:`Whatnot`,tiktok_live:`TikTok Live (Beta)`,facebook_live:`Facebook Live (Beta)`,other:`Other`};function wd(){let{stores:e,activeStoreId:t,setActiveStoreId:n,loading:r,refetch:i}=La(),[a,o]=(0,V.useState)(!1),[s,c]=(0,V.useState)(!1),[l,d]=(0,V.useState)(``),[p,m]=(0,V.useState)(`whatnot`),[h,g]=(0,V.useState)(``),_=z(et),v=u({mutationFn:()=>_({data:{name:l.trim(),handle:h.trim()||void 0,platform:p}}),onSuccess:()=>{c(!1),d(``),g(``),m(`whatnot`),i()}});if(!r&&e.length<2)return null;let y=e.find(e=>e.id===t),b=t===`all`?`All stores`:y?.name??`All stores`;return(0,U.jsxs)(`div`,{style:{position:`relative`},children:[(0,U.jsxs)(`button`,{className:`ghost`,onClick:()=>o(e=>!e),title:`Switch store / brand`,style:{display:`inline-flex`,alignItems:`center`,gap:6,fontWeight:600},children:[(0,U.jsx)(ce,{size:14}),` `,r?`Loadingâ¦`:b,` `,(0,U.jsx)(`span`,{style:{opacity:.6},children:`â¾`})]}),a&&(0,U.jsxs)(`div`,{onMouseLeave:()=>{s||o(!1)},style:{position:`absolute`,right:0,top:`calc(100% + 6px)`,zIndex:50,minWidth:280,background:`#fffdf5`,border:`1px solid #d9d1bd`,borderRadius:10,padding:8,boxShadow:`0 16px 40px rgba(40,30,10,0.18)`,color:`#2b3514`},children:[e.length>=2&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(Td,{active:t===`all`,onClick:()=>{n(`all`),o(!1)},children:[(0,U.jsx)(`span`,{style:{fontWeight:600},children:`All stores`}),(0,U.jsx)(`span`,{style:{fontSize:11,color:`#7a6f5a`},children:`combined view`})]}),(0,U.jsx)(`div`,{style:{height:1,background:`#e8e0c9`,margin:`6px 0`}})]}),e.map(e=>(0,U.jsxs)(Td,{active:t===e.id,onClick:()=>{n(e.id),o(!1)},children:[(0,U.jsxs)(`span`,{style:{fontWeight:600},children:[e.name,e.is_primary&&(0,U.jsx)(`span`,{style:{fontSize:10,marginLeft:6,padding:`2px 6px`,borderRadius:4,background:`#e8e0c9`,color:`#5b4a1f`,letterSpacing:`.06em`},children:`PRIMARY`})]}),(0,U.jsxs)(`span`,{style:{fontSize:11,color:`#7a6f5a`},children:[Cd[e.platform??`whatnot`]??e.platform,e.handle?` · @${e.handle}`:``]})]},e.id)),(0,U.jsx)(`div`,{style:{height:1,background:`#e8e0c9`,margin:`6px 0`}}),s?(0,U.jsxs)(`div`,{style:{padding:4},children:[(0,U.jsx)(`input`,{"aria-label":`Brand / store name`,className:`input`,placeholder:`Brand / store name`,value:l,onChange:e=>d(e.target.value),style:{width:`100%`,marginBottom:6}}),(0,U.jsx)(`input`,{"aria-label":`Handle (optional)`,className:`input`,placeholder:`Handle (optional)`,value:h,onChange:e=>g(e.target.value),style:{width:`100%`,marginBottom:6}}),(0,U.jsxs)(`select`,{className:`input`,value:p,onChange:e=>m(e.target.value),style:{width:`100%`,marginBottom:8},children:[(0,U.jsx)(`option`,{value:`whatnot`,children:`Whatnot`}),(0,U.jsx)(`option`,{value:`tiktok_live`,children:`TikTok Live`}),(0,U.jsx)(`option`,{value:`facebook_live`,children:`Facebook Live`}),(0,U.jsx)(`option`,{value:`other`,children:`Other`})]}),(0,U.jsxs)(`div`,{className:`row`,style:{gap:6},children:[(0,U.jsx)(`button`,{className:`primary`,disabled:!l.trim()||v.isPending,onClick:()=>v.mutate(),style:{flex:1},children:v.isPending?`Addingâ¦`:`Add store`}),(0,U.jsx)(`button`,{className:`ghost`,onClick:()=>c(!1),children:`Cancel`})]}),v.isError&&(0,U.jsx)(`div`,{style:{fontSize:11,color:`#f0a8a8`,marginTop:6},children:v.error.message})]}):(0,U.jsxs)(`button`,{className:`ghost`,style:{width:`100%`,justifyContent:`flex-start`,color:`#2b3514`,fontWeight:600},onClick:()=>c(!0),children:[(0,U.jsx)(f,{size:14}),` Add store · $4.99/mo`]})]})]})}function Td({active:e,onClick:t,children:n}){return(0,U.jsx)(`button`,{onClick:t,className:`ghost`,style:{width:`100%`,dis
51play:`flex`,justifyContent:`space-between`,alignItems:`center`,padding:`8px 10px`,borderRadius:6,background:e?`rgba(156,107,47,0.14)`:`transparent`,border:e?`1px solid #9c6b2f`:`1px solid transparent`,color:`#2b3514`},children:n})}function Ed({page:e,setPage:t}){let{stores:n}=La();return(0,U.jsx)(U.Fragment,{children:yu.map(r=>{let i=r.items.filter(e=>e.name!==`Compare`||n.length>=2);return i.length?(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h4`,{children:r.label}),i.map(n=>{let r=n.icon;return(0,U.jsxs)(`button`,{className:e===n.name?`active`:``,onClick:()=>t(n.name),children:[(0,U.jsx)(r,{size:18}),n.name]},n.name)})]},r.label):null})})}function Dd({grossNow:e}){let{activeStoreId:t,activeStore:n}=La(),r=za(t,n?.platform??null),i=[{label:`Whatnot`,value:Math.round(e*r.whatnot)},{label:`TikTok Live (Beta)`,value:Math.round(e*r.tiktok_live)},{label:`Facebook Live (Beta)`,value:Math.round(e*r.facebook_live)},{label:`Other`,value:Math.round(e*r.other)}].filter(e=>e.value>0);return(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsxs)(`div`,{className:`row`,style:{justifyContent:`space-between`,marginBottom:8},children:[(0,U.jsx)(`h3`,{style:{margin:0},children:`Platform breakdown`}),(0,U.jsx)(`div`,{style:{fontSize:12,color:`var(--pl-muted)`},children:t===`all`?`All stores · by platform`:`${n?.name??`Store`} · by platform`})]}),(0,U.jsxs)(`div`,{className:`grid`,style:{gridTemplateColumns:`minmax(0, 1fr) minmax(0, 1fr)`,gap:12,alignItems:`center`},children:[(0,U.jsx)(qd,{slices:i}),(0,U.jsxs)(`table`,{className:`table`,children:[(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`th`,{children:`Platform`}),(0,U.jsx)(`th`,{children:`Share`}),(0,U.jsx)(`th`,{children:`Revenue`})]})}),(0,U.jsx)(`tbody`,{children:i.map(t=>(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`td`,{children:t.label}),(0,U.jsxs)(`td`,{children:[Math.round(t.value/Math.max(1,e)*100),`%`]}),(0,U.jsxs)(`td`,{children:[`$`,t.value.toLocaleString()]})]},t.label))})]})]})]})}function Od(){let{stores:e,loading:t}=La(),[n,r]=(0,V.useState)(!1),[i,a]=(0,V.useState)(null),[o,s]=(0,V.useState)(null);if((0,V.useEffect)(()=>{e.length>=2?(i||a(e[0].id),o||s(e[1].id)):e.length===1&&!i&&a(e[0].id)},[e,i,o]),t)return(0,U.jsx)(`div`,{className:`card`,children:`Loading storesâ¦`});if(e.length<2)return(0,U.jsxs)(`div`,{className:`card`,style:{borderLeft:`3px solid #e8b86a`},children:[(0,U.jsxs)(`div`,{className:`row`,style:{gap:8,alignItems:`center`,marginBottom:6},children:[(0,U.jsx)(ut,{size:18,style:{color:`#e8b86a`}}),(0,U.jsx)(`h3`,{style:{margin:0},children:`Add a second store to compare`})]}),(0,U.jsxs)(`p`,{style:{marginTop:4,color:`var(--pl-muted)`},children:[`Compare gross, AOV, $/buyer, best hour, and platform mix side-by-side. Each extra store / brand login is `,(0,U.jsx)(`b`,{children:`$4.99/mo`}),`. Use the `,(0,U.jsx)(`b`,{children:`Store`}),` menu in the top bar to add one.`]})]});let c=e.find(e=>e.id===i)??e[0],l=e.find(e=>e.id===o)??e[1],u=kd(),d=kd(),f=Ad(u,d);return(0,U.jsxs)(`div`,{className:`stack`,style:{gap:16},children:[(0,U.jsx)(`div`,{className:`card`,children:(0,U.jsxs)(`div`,{className:`row`,style:{justifyContent:`space-between`,flexWrap:`wrap`,gap:8},children:[(0,U.jsxs)(`div`,{className:`row`,style:{gap:8,alignItems:`center`,flexWrap:`wrap`},children:[(0,U.jsx)(`strong`,{children:`Compare:`}),(0,U.jsx)(`select`,{className:`input`,value:c.id,onChange:e=>a(e.target.value),children:e.map(e=>(0,U.jsx)(`option`,{value:e.id,children:e.name},e.id))}),(0,U.jsx)(`span`,{style:{opacity:.6},children:`vs`}),(0,U.jsx)(`select`,{className:`input`,value:l.id,onChange:e=>s(e.target.value),children:e.map(e=>(0,U.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),(0,U.jsxs)(`button`,{className:n?`primary`:`ghost`,onClick:()=>r(e=>!e),children:[(0,U.jsx)(M,{size:14}),` `,n?`Showing combined totals`:`Show combined totals`]})]})}),n?(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsxs)(`h3`,{style:{marginTop:0},children:[c.name,` + `,l.name,` · combined`]}),(0,U.jsx)(Md,{m:f})]}):(0,U.jsxs)(`div`,{className:`grid`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(320px, 1fr))`,gap:12},children:[(0,U.jsx)(jd,{store:c,m:u,other:d}),(0,U.jsx)(jd,{store:l,m:d,other:u})]}),(0,U.jsxs)(`div`,{className:`grid`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(320px, 1fr))`,gap:12},children:[(0,U.jsx)(Nd,{store:c,gross:u.gross}),(0,U.jsx)(Nd,{store:l,gross:d.gross})]}),(0,U.jsx)(Pd,{a:c,b:l})]})}function kd(){return{gross:0,buyers:0,shows:0,aov:0,perBuyer:0,bestHour:0,repeat:0}}function Ad(e,t){let n=e.gross+t.gross,r=e.buyers+t.buyers;return{gross:n,buyers:r,shows:e.shows+t.shows,aov:Number(((e.aov+t.aov)/2).toFixed(2)),perBuyer:Number((n/Math.max(1,r)).toFixed(2)),bestHour:e.gross>=t.gross?e.bestHour:t.bestHour,repeat:Number(((e.repeat+t.repeat)/2).toFixed(2))}}
51function jd({store:e,m:t,other:n}){return(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsxs)(`div`,{className:`between`,style:{alignItems:`center`},children:[(0,U.jsx)(`h3`,{style:{margin:0},children:e.name}),(0,U.jsxs)(`span`,{className:`pill`,style:{border:`1px solid var(--pl-border)`},children:[Cd[e.platform??`whatnot`]??e.platform,e.handle?` · @${e.handle}`:``]})]}),(0,U.jsx)(Md,{m:t,compareTo:n})]})}function Md({m:e,compareTo:t}){let n=(e,t)=>{if(t===void 0||t===0)return null;let n=(e-t)/t*100;return(0,U.jsxs)(`span`,{style:{fontSize:11,marginLeft:6,color:n>=0?`#5a8a3a`:`#b15a4a`,fontWeight:600},children:[n>=0?`+`:``,n.toFixed(0),`%`]})};return(0,U.jsxs)(`div`,{className:`grid`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(140px, 1fr))`,gap:10,marginTop:10},children:[(0,U.jsx)($,{label:`Gross`,value:`$${e.gross.toLocaleString()}`,sub:t?(0,U.jsxs)(U.Fragment,{children:[`vs other`,n(e.gross,t.gross)]}):void 0}),(0,U.jsx)($,{label:`Buyers`,value:e.buyers.toLocaleString(),sub:t?(0,U.jsxs)(U.Fragment,{children:[`vs other`,n(e.buyers,t.buyers)]}):void 0}),(0,U.jsx)($,{label:`Shows`,value:String(e.shows)}),(0,U.jsx)($,{label:`AOV`,value:`$${e.aov.toFixed(2)}`,sub:t?(0,U.jsxs)(U.Fragment,{children:[`vs other`,n(e.aov,t.aov)]}):void 0}),(0,U.jsx)($,{label:`$ / buyer`,value:`$${e.perBuyer.toFixed(2)}`,sub:t?(0,U.jsxs)(U.Fragment,{children:[`vs other`,n(e.perBuyer,t.perBuyer)]}):void 0}),(0,U.jsx)($,{label:`Best hour`,value:Ma(e.bestHour)}),(0,U.jsx)($,{label:`Repeat`,value:`${Math.round(e.repeat*100)}%`})]})}function Nd({store:e,gross:t}){let n=za(e.id,e.platform??null),r=[{label:`Whatnot`,value:Math.round(t*n.whatnot)},{label:`TikTok Live (Beta)`,value:Math.round(t*n.tiktok_live)},{label:`Facebook Live (Beta)`,value:Math.round(t*n.facebook_live)},{label:`Other`,value:Math.round(t*n.other)}].filter(e=>e.value>0);return(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsx)(`div`,{className:`between`,children:(0,U.jsxs)(`h3`,{style:{margin:0},children:[e.name,` · platform mix`]})}),(0,U.jsx)(qd,{slices:r})]})}function Pd({a:e,b:t}){let n=z(ze),r=R({queryKey:[`buyers`,`cross-real`,e.id,t.id],queryFn:()=>n({data:{storeA:e.id,storeB:t.id}})}),i=r.data?.shared??[],a=r.data?.totalSharedSpend??0;return(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsxs)(`div`,{className:`between`,style:{alignItems:`center`},children:[(0,U.jsx)(`h3`,{style:{margin:0},children:`Cross-store buyers`}),(0,U.jsxs)(`div`,{className:`row`,style:{gap:8},children:[(0,U.jsxs)(`span`,{className:`pill`,style:{border:`1px solid var(--pl-border)`},children:[i.length,` shared · $`,a.toLocaleString()]}),i.length>0&&(0,U.jsxs)(`button`,{className:`ghost`,style:{fontSize:11},onClick:()=>{let n=`username,lifetime,tag,spend_at_`+e.name.replace(/[",]/g,``)+`,spend_at_`+t.name.replace(/[",]/g,``),r=i.map(e=>[e.username,e.lifetime,e.tag??``,e.spendA,e.spendB].join(`,`)),a=new Blob([n+` 52`+r.join(` 53`)],{type:`text/csv`}),o=URL.createObjectURL(a),s=document.createElement(`a`);s.href=o,s.download=`cross-store-${e.name}-${t.name}.csv`,s.click(),URL.revokeObjectURL(o)},children:[(0,U.jsx)(S,{size:11}),` CSV`]})]})]}),(0,U.jsxs)(`p`,{style:{fontSize:12,color:`var(--pl-muted)`,marginTop:4},children:[`Real overlap from sales â buyers who've bought from `,(0,U.jsx)(`b`,{children:e.name}),` `,(0,U.jsx)(`i`,{children:`and`}),` `,(0,U.jsx)(`b`,{children:t.name}),`. Combine shipping across brands or send a cross-promo DM.`]}),r.isLoading&&(0,U.jsx)(`div`,{children:`Loadingâ¦`}),!r.isLoading&&i.length===0&&(0,U.jsx)(`div`,{style:{fontSize:13,color:`var(--pl-muted)`},children:`No overlap yet. Once buyers shop both stores, they'll show up here.`}),i.length>0&&(0,U.jsxs)(`table`,{className:`table`,style:{marginTop:8},children:[(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`th`,{children:`Buyer`}),(0,U.jsxs)(`th`,{children:[`@ `,e.name]}),(0,U.jsxs)(`th`,{children:[`@ `,t.name]}),(0,U.jsx)(`th`,{children:`Lifetime`}),(0,U.jsx)(`th`,{children:`Tag`}),(0,U.jsx)(`th`,{})]})}),(0,U.jsx)(`tbody`,{children:i.slice(0,25).map(e=>(0,U.jsxs)(`tr`,{children:[(0,U.jsxs)(`td`,{children:[`@`,e.username]}),(0,U.jsxs)(`td`,{children:[`$`,e.spendA.toFixed(2)]}),(0,U.jsxs)(`td`,{children:[`$`,e.spendB.toFixed(2)]}),(0,U.jsxs)(`td`,{children:[`$`,e.lifetime.toFixed(2)]}),(0,U.jsx)(`td`,{children:e.tag?(0,U.jsx)(`span`,{className:`pill`,children:e.tag}):(0,U.jsx)(`span`,{style:{color:`var(--pl-muted)`},children:`â`})}),(0,U.jsx)(`td`,{children:(0,U.jsxs)(`button`,{className:`ghost`,style:{fontSize:11},onClick:()=>navigator.clipboard?.writeText(`@${e.username}`),children:[(0,U.jsx)(ot,{size:11}),` Copy handle`]})})]},e.id))})]})]})}var Fd=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`];function Id(){return(0,U.jsx)(Gl,{})}function Ld({data:e}){let t=z(Ae),n=z(Pe),r=z(Re),i=R({queryKey:[`refund-stats`],queryFn:()=>t({data:{}})}),a=R({queryKey:[`recent-sales-for-refund`],queryFn:()=>n({data:{limit:25}})}),o=Ne(),s=(a.data??[]).filter(e=>!e.refunded_at),[c,l]=(0,V.useState)(``),[d,f]=(0,V.useState)(``),p=u({mutationFn:e=>r({data:{id:e,reason:d||void 0}}),onSuccess:()=>{o.invalidateQueries({queryKey:[`refund-stats`]}),o.invalidateQueries({queryKey:[`recent-sales-for-refund`]}),l(``),f(``)}}),m=i.data,h={aov:32.5,repeatRate:.41,refundRate:.038,showsPerMo:6},g=e.showsNow/Math.max(1,e.months.length||1),_=m?.refundRate??0,v=[{label:`AOV`,you:`$${e.aov.toFixed(2)}`,peer:`$${h.aov.toFixed(2)}`,good:e.aov>=h.aov},{label:`Repeat buyer rate`,you:`${Math.round(e.repeatRate*100)}%`,peer:`${Math.round(h.repeatRate*100)}%`,good:e.repeatRate>=h.repeatRate},{label:`Refund rate (90d)`,you:`${(_*100).toFixed(1)}%`,peer:`${(h.refundRate*100).toFixed(1)}%`,good:_<=h.refundRate},{label:`Shows / month`,you:g.toFixed(1),peer:h.showsPerMo.toFixed(1),good:g>=h.showsPerMo}];return(0,U.jsxs)(`div`,{className:`grid`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(320px, 1fr))`,gap:12},children:[(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsxs)(`div`,{className:`between`,style:{alignItems:`center`},children:[(0,U.jsx)(`h3`,{style:{marginTop:0,marginBottom:0},children:`Refunds â last 90 days`}),(0,U.jsx)(`span`,{className:`pill`,style:{border:`1px solid var(--pl-border)`},children:i.isLoading?`â¦`:`${m?.refundCount??0} refunds`})]}),(0,U.jsxs)(`div`,{className:`grid`,style:{gridTemplateColumns:`repeat(3, 1fr)`,gap:8,marginTop:10},children:[(0,U.jsx)(Rd,{label:`Refund rate`,value:m?`${(m.refundRate*100).toFixed(1)}%`:`â`,hint:m&&m.refundRate<=.04?`Healthy`:`Watch`}),(0,U.jsx)(Rd,{label:`Refunded $`,value:m?`$${m.refundDollars.toLocaleStr
53ing()}`:`â`}),(0,U.jsx)(Rd,{label:`Net revenue`,value:m?`$${m.netRevenue.toLocaleString()}`:`â`})]}),m&&m.topRefunded.length>0&&(0,U.jsxs)(`table`,{className:`table`,style:{marginTop:10},children:[(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`th`,{children:`Most-refunded item`}),(0,U.jsx)(`th`,{children:`Count`}),(0,U.jsx)(`th`,{children:`$`})]})}),(0,U.jsx)(`tbody`,{children:m.topRefunded.map(e=>(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`td`,{children:e.item}),(0,U.jsx)(`td`,{children:e.count}),(0,U.jsxs)(`td`,{children:[`$`,e.dollars.toFixed(2)]})]},e.item))})]}),m&&m.refundCount===0&&(0,U.jsx)(`div`,{style:{fontSize:13,color:`var(--pl-muted)`,marginTop:10},children:`No refunds yet. Mark a sale refunded from the Reports tab to start tracking.`}),(0,U.jsxs)(`div`,{style:{marginTop:12,paddingTop:10,borderTop:`1px dashed var(--pl-border)`},children:[(0,U.jsx)(`div`,{className:`label`,children:`Mark a recent sale refunded`}),(0,U.jsxs)(`div`,{className:`row`,style:{gap:6,flexWrap:`wrap`,marginTop:4},children:[(0,U.jsxs)(`select`,{value:c,onChange:e=>l(e.target.value),style:{flex:`1 1 220px`,minWidth:200},children:[(0,U.jsx)(`option`,{value:``,children:s.length?`Pick a saleâ¦`:`No recent sales`}),s.map(e=>(0,U.jsxs)(`option`,{value:e.id,children:[`@`,e.buyer_username,` · `,e.item_title,` · $`,Number(e.total).toFixed(2)]},e.id))]}),(0,U.jsx)(`input`,{"aria-label":`Reason (optional)`,placeholder:`Reason (optional)`,value:d,onChange:e=>f(e.target.value),style:{flex:`1 1 160px`}}),(0,U.jsx)(`button`,{className:`secondary`,disabled:!c||p.isPending,onClick:()=>c&&p.mutate(c),children:p.isPending?`Refundingâ¦`:`Mark refunded`})]})]})]}),(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsxs)(`div`,{className:`between`,style:{alignItems:`center`},children:[(0,U.jsx)(`h3`,{style:{marginTop:0,marginBottom:0},children:`Peer benchmarks`}),(0,U.jsx)(`span`,{className:`pill`,style:{border:`1px solid var(--pl-border)`},children:`Anonymous · live-seller cohort`})]}),(0,U.jsx)(`p`,{style:{fontSize:12,color:`var(--pl-muted)`,marginTop:4},children:`You vs the median PearShow seller in your size band. Aggregated from anonymized usage; no individual sellers exposed.`}),(0,U.jsxs)(`table`,{className:`table`,style:{marginTop:6},children:[(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`th`,{children:`Metric`}),(0,U.jsx)(`th`,{children:`You`}),(0,U.jsx)(`th`,{children:`Peer median`}),(0,U.jsx)(`th`,{})]})}),(0,U.jsx)(`tbody`,{children:v.map(e=>(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`td`,{children:e.label}),(0,U.jsx)(`td`,{children:(0,U.jsx)(`b`,{children:e.you})}),(0,U.jsx)(`td`,{style:{color:`var(--pl-muted)`},children:e.peer}),(0,U.jsx)(`td`,{children:(0,U.jsx)(`span`,{className:`pill`,style:{background:e.good?`rgba(80,180,120,0.16)`:`rgba(220,150,80,0.16)`,color:e.good?`#3a7a4a`:`#a06a2a`,border:`1px solid `+(e.good?`rgba(80,180,120,0.35)`:`rgba(220,150,80,0.35)`)},children:e.good?`Above peers`:`Below peers`})})]},e.label))})]})]})]})}function Rd({label:e,value:t,hint:n}){return(0,U.jsxs)(`div`,{style:{padding:10,border:`1px solid var(--pl-border)`,borderRadius:8},children:[(0,U.jsx)(`div`,{style:{fontSize:10,textTransform:`uppercase`,letterSpacing:`.1em`,color:`var(--pl-muted)`},children:e}),(0,U.jsx)(`div`,{style:{fontSize:20,fontWeight:800,marginTop:2,fontVariantNumeric:`tabular-nums`},children:t}),n&&(0,U.jsx)(`div`,{style:{fontSize:11,color:`var(--pl-muted)`,marginTop:2},children:n})]})}function zd(e,t=[],n=[],r=[]){let i=e===`30d`?30:e===`90d`?90:365,a=e===`30d`?30:e===`90d`?13:12,o=new Date,s=new Date(o.getTime()-i*864e5),c=new Date(s.getTime()-i*864e5),l=t.filter(e=>new Date(e.sold_at).getTime()>=s.getTime()),u=t.filter(e=>{let t=new Date(e.sold_at).getTime();return t>=c.getTime()&&t<s.getTime()}),d=Array.from({length:a},(t,n)=>{let r=new Date(o);return e===`30d`?r.setDate(o.getDate()-(a-1-n)):e===`90d`?r.setDate(o.getDate()-(a-1-n)*7):r.setMonth(o.getMonth()-(a-1-n),1),{key:n,label:e===`12m`?r.toLocaleDateString(`en-US`,{month:`short`}):r.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`}),start:r,gross:0,shows:new Set,buyers:new Set,items:0}}),f=t=>e===`30d`?Math.max(0,Math.min(a-1,Math.floor((t.getTime()-d[0].start.getTime())/864e5))):e===`90d`?Math.max(0,Math.min(a-1,Math.floor((t.getTime()-d[0].start.getTime())/(
537*864e5)))):Math.max(0,Math.min(a-1,(t.getFullYear()-d[0].start.getFullYear())*12+t.getMonth()-d[0].start.getMonth()));l.forEach(e=>{let t=d[f(new Date(e.sold_at))];t.gross+=Number(e.total??0),t.items+=Number(e.qty??1),e.show_id&&t.shows.add(String(e.show_id)),e.buyer_username&&t.buyers.add(String(e.buyer_username).toLowerCase())});let p=d.map(e=>({month:e.label,gross:Number(e.gross.toFixed(2)),shows:e.shows.size,buyers:e.buyers.size,aov:e.buyers.size?Number((e.gross/e.buyers.size).toFixed(2)):0})),m=Number(l.reduce((e,t)=>e+Number(t.total??0),0).toFixed(2)),h=Number(u.reduce((e,t)=>e+Number(t.total??0),0).toFixed(2)),g=new Set(l.map(e=>String(e.buyer_username??``).toLowerCase()).filter(Boolean)).size,_=new Set(l.map(e=>e.show_id).filter(Boolean)).size||r.filter(e=>e.startedAt&&new Date(e.startedAt)>=s).length,v=l.reduce((e,t)=>e+Number(t.qty??1),0),y=v?Number((m/v).toFixed(2)):0,b=new Map;l.forEach(e=>{let t=String(e.item_title??`Untitled`).slice(0,120),n=b.get(t)??{name:t,units:0,revenue:0,margin:0};n.units+=Number(e.qty??1),n.revenue+=Number(e.total??0),b.set(t,n)});let x=Array.from(b.values()).sort((e,t)=>t.revenue-e.revenue).slice(0,8).map(e=>({...e,revenue:Number(e.revenue.toFixed(2))})),S=n.slice(0,10).map(e=>({name:e.username,spend:Number(e.lifetime_spend??0),shows:Number(e.shows_count??0),last:e.last_seen_at?new Date(e.last_seen_at).toLocaleDateString():`â`,tag:e.tag??`â`})),C=Fd.map(e=>({d:e,v:0})),w=Array.from({length:24},(e,t)=>({h:t,v:0}));l.forEach(e=>{let t=new Date(e.sold_at),n=Number(e.total??0);C[t.getDay()].v+=n,w[t.getHours()].v+=n});let T=new Map;l.forEach(e=>{let t=String(e.buyer_username??``).toLowerCase();t&&T.set(t,(T.get(t)??0)+1)});let E=Array.from(T.values()).filter(e=>e>1).length;return{months:p,grossNow:m,grossPrev:h,buyersNow:g,showsNow:_,aov:y,repeatRate:g?E/g:0,deltaGross:h?(m-h)/h:0,topItems:x,topBuyers:S,byDow:C,hours:w,showRows:r}}function Bd(){let[e,t]=(0,V.useState)(`12m`),{data:n=[]}=Su(5e3),r=z(Le),{data:i=[]}=R({queryKey:[`buyers`,`insights`],queryFn:()=>r(),refetchOnWindowFocus:!1}),{data:a=[]}=Cu(),o=(0,V.useMemo)(()=>zd(e,n,i,a),[e,n,i,a]),s=o.byDow.reduce((e,t)=>t.v>e.v?t:e),c=o.hours.reduce((e,t)=>t.v>e.v?t:e),l=e=>`${e>=0?`+`:``}${(e*100).toFixed(1)}%`,u=n.length>0,[d,f]=(0,V.useState)(null),p=()=>f(null);return(0,U.jsxs)(`div`,{className:`stack`,style:{gap:16},children:[(0,U.jsxs)(`div`,{className:`row`,style:{justifyContent:`space-between`,alignItems:`center`,flexWrap:`wrap`,gap:12},children:[(0,U.jsx)(`div`,{className:`row`,style:{gap:8,flexWrap:`wrap`},children:[`30d`,`90d`,`12m`].map(n=>(0,U.jsx)(`button`,{className:`pill ${e===n?`live`:``}`,onClick:()=>t(n),style:{cursor:`pointer`,border:`1px solid var(--pl-border)`},children:n===`30d`?`Last 30 days`:n===`90d`?`Last 90 days`:`Last 12 months`},n))}),(0,U.jsx)(`div`,{style:{fontSize:12,color:`var(--pl-muted)`},children:u?`vs prior period · click any tile to drill in`:`Waiting on Whatnot sync`})]}),(0,U.jsxs)(`div`,{className:`grid`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(180px, 1fr))`,gap:12},children:[(0,U.jsx)(Vd,{label:`Gross sales`,value:`$${o.grossNow.toLocaleString()}`,delta:l(o.deltaGross),positive:o.deltaGross>=0,onClick:()=>f({t:`kpi`,key:`gross`}),active:d?.t===`kpi`&&d.key===`gross`}),(0,U.jsx)(Vd,{label:`Buyers`,value:o.buyersNow.toLocaleString(),delta:l(.18),positive:!0,onClick:()=>f({t:`kpi`,key:`buyers`}),active:d?.t===`kpi`&&d.key===`buyers`}),(0,U.jsx)(Vd,{label:`Shows`,value:String(o.showsNow),delta:l(.09),positive:!0,onClick:()=>f({t:`kpi`,key:`shows`}),active:d?.t===`kpi`&&d.key===`shows`}),(0,U.jsx)(Vd,{label:`AOV`,value:`$${o.aov.toFixed(2)}`,delta:l(-.03),positive:!1,onClick:()=>f({t:`kpi`,key:`aov`}),active:d?.t===`kpi`&&d.key===`aov`}),(0,U.jsx)(Vd,{label:`Repeat buyer rate`,value:`${Math.round(o.repeatRate*100)}%`,delta:l(.06),positive:!0,onClick:()=>f({t:`kpi`,key:`repeat`}),active:d?.t===`kpi`&&d.key===`repeat`})]}),d?.t===`kpi`&&(0,U.jsx)(Hd,{which:d.key,data:o,onClose:p}),(0,U.jsxs)(`div`,{className:`grid`,style:{gridTemplateColumns:`minmax(0, 2fr) minmax(0, 1fr)`,gap:12},children:[(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsxs)(`div`,{className:`row`,style:{justifyContent:`space-between`,marginBottom:8},children:[(0,U.jsx)(`h3`,{style:{margin:0},children:`Sales trend`}),(0,U.jsx)(`div`,{style:{fontSize:12,color:`var(--pl-muted)`},children:e===`12m`?`Monthly · last 12 months`:e===`90d`?`Weekly · last 90 days`:`Daily · last 30 days`})]}),(0,U.jsx)(Gd,{months:o.months})]}),(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsxs)(`div`,{className:`row`,style:{justifyContent:`space-between`,marginBottom:8},children:[(0,U.jsx)(`h3`,{style:{margin:0},children:`Revenue mix`}),(0,U.jsx)(`div`,{style:{fontSize:12,color:`var(--pl-muted)`},children:`Top items · this period`})]}),(0,U.jsx)(qd,{slices:o.topItems.map(e=>({label:e.name,value:e.revenue}))})]})]}),(0,U.jsx)(Dd,{grossNow:o.grossNow}),(0,U.jsxs)(`div`,{className:`grid`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(320px, 1fr))`,gap:12},children:[(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsx)(`h3`,{style:{marginTop:0},children:`Best day of week`}),(0,U.jsx)(Kd,{data:o.byDow.map(e=>({label:e.d,value:e.v})),highlight:s.d,suffix:``}),(0,U.jsxs)(`div`,{style:{marginTop:8,fontSize:13,color:`var(--pl-muted)`},children:[`Strongest day: `,(0,U.jsx)(`b`,{style:{color:`var(--pl-ink)`},children:s.d}),` â schedule your next live here.`]})]}),(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsx)(`h3`,{style:{marginTop:0},children:`Best hour to go live`}),(0,U.jsx)(Jd,{data:o.hours}),(0,U.jsxs)(`div`,{style:{marginTop:8,fontSize:13,color:`var(--pl-muted)`},children:[`Peak window: `,(0,U.jsx)(`b`,{style:{color:`var(--pl-ink)`},children:Na(c.h)}),` local.`]})]})]}),(0,U.jsxs)(`div`,{className:`grid`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(320px, 1fr))`,gap:12},children:[(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsxs)(`h3`,{style:{marginTop:0},children:[`Top items `,(0,U.jsx)(`span`,{style:{fontSize:11,color:`var(--pl-muted)`,fontWeight:400},children:`· click to drill in`})]}),(0,U.jsxs)(`table`,{className:`table`,children:[(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`th`,{children:`Item`}),(0,U.jsx)(`th`,{children:`Units`}),(0,U.jsx)(`th`,{children:`Revenue`}),(0,U.jsx)(`th`,{children:`Margin`})]})}),(0,U.jsxs)(`tbody`,{children:[o.topItems.map(e=>(0,U.jsxs)(`tr`,{style:{cursor:`pointer`,background:d?.t===`item`&&d.name===e.name?`var(--pl-cream)`:void 0},onClick:()=>f(d?.t===`item`&&d.name===e.name?null:{t:`item`,name:e.name}),children:[(0,U.jsx)(`td`,{children:e.name}),(0,U.jsx)(`td`,{children:e.units}
53),(0,U.jsxs)(`td`,{children:[`$`,e.revenue.toLocaleString()]}),(0,U.jsxs)(`td`,{children:[Math.round(e.margin*100),`%`]})]},e.name)),o.topItems.length===0&&(0,U.jsx)(`tr`,{children:(0,U.jsx)(`td`,{colSpan:4,style:{color:`var(--pl-muted)`,textAlign:`center`,padding:20},children:`No item sales yet.`})})]})]}),d?.t===`item`&&(0,U.jsx)(Ud,{name:d.name,onClose:p})]}),(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsxs)(`h3`,{style:{marginTop:0},children:[`Top buyers `,(0,U.jsx)(`span`,{style:{fontSize:11,color:`var(--pl-muted)`,fontWeight:400},children:`· click to drill in`})]}),(0,U.jsxs)(`table`,{className:`table`,children:[(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`th`,{children:`Buyer`}),(0,U.jsx)(`th`,{children:`Spend`}),(0,U.jsx)(`th`,{children:`Shows`}),(0,U.jsx)(`th`,{children:`Last seen`}),(0,U.jsx)(`th`,{children:`Tag`})]})}),(0,U.jsxs)(`tbody`,{children:[o.topBuyers.map(e=>(0,U.jsxs)(`tr`,{style:{cursor:`pointer`,background:d?.t===`buyer`&&d.name===e.name?`var(--pl-cream)`:void 0},onClick:()=>f(d?.t===`buyer`&&d.name===e.name?null:{t:`buyer`,name:e.name}),children:[(0,U.jsxs)(`td`,{children:[`@`,e.name]}),(0,U.jsxs)(`td`,{children:[`$`,e.spend]}),(0,U.jsx)(`td`,{children:e.shows}),(0,U.jsx)(`td`,{children:e.last}),(0,U.jsx)(`td`,{children:(0,U.jsx)(`span`,{className:`pill`,style:{border:`1px solid var(--pl-border)`},children:e.tag})})]},e.name)),o.topBuyers.length===0&&(0,U.jsx)(`tr`,{children:(0,U.jsx)(`td`,{colSpan:5,style:{color:`var(--pl-muted)`,textAlign:`center`,padding:20},children:`No buyers yet.`})})]})]}),d?.t===`buyer`&&(0,U.jsx)(Wd,{name:d.name,onClose:p})]})]}),(0,U.jsxs)(`div`,{className:`card`,style:{borderLeft:`3px solid #e8b86a`},children:[(0,U.jsxs)(`div`,{className:`row`,style:{gap:8,alignItems:`center`,marginBottom:6},children:[(0,U.jsx)(ge,{size:18,style:{color:`#e8b86a`}}),(0,U.jsx)(`h3`,{style:{margin:0},children:`What to do next`})]}),u?(0,U.jsxs)(`ul`,{style:{margin:`8px 0 0 18px`,lineHeight:1.7},children:[(0,U.jsxs)(`li`,{children:[`Best real sales day so far: `,(0,U.jsx)(`b`,{children:s.d}),`.`]}),(0,U.jsxs)(`li`,{children:[`Best real sales hour so far: `,(0,U.jsx)(`b`,{children:Ma(c.h)}),`.`]}),o.topItems[0]&&(0,U.jsxs)(`li`,{children:[`Top synced item: `,(0,U.jsx)(`b`,{children:o.topItems[0].name}),` (`,o.topItems[0].units,` units).`]}),o.topBuyers.length>0&&(0,U.jsx)(`li`,{children:`Top buyer list is populated from your buyer book.`})]}):(0,U.jsx)(`div`,{className:`note`,style:{marginTop:10},children:`No sales insights yet. Keep the extension connected while viewing Whatnot orders, shows, and buyers.`})]}),(0,U.jsx)(Ld,{data:o})]})}function Vd({label:e,value:t,delta:n,positive:r,onClick:i,active:a}){return(0,U.jsxs)(`div`,{className:`card`,onClick:i,style:{padding:14,cursor:i?`pointer`:void 0,borderColor:a?`#9c6b2f`:void 0,boxShadow:a?`0 0 0 2px rgba(156,107,47,0.18)`:void 0,transition:`border-color .15s, box-shadow .15s`,position:`relative`},children:[i?(0,U.jsxs)(`div`,{style:{position:`absolute`,top:10,right:10,display:`inline-flex`,alignItems:`center`,gap:4,fontSize:10,fontWeight:700,letterSpacing:`.08em`,textTransform:`uppercase`,color:a?`#fff`:`#9c6b2f`,background:a?`#9c6b2f`:`rgba(156,107,47,0.12)`,border:`1px solid rgba(156,107,47,0.35)`,borderRadius:999,padding:`2px 8px`},children:[a?`Open`:`Drill`,` `,a?`â´`:`â¾`]}):null,(0,U.jsx)(`div`,{style:{fontSize:11,textTransform:`uppercase`,letterSpacing:`.12em`,color:`var(--pl-muted)`},children:e}),(0,U.jsx)(`div`,{style:{fontSize:26,fontWeight:800,marginTop:4,fontVariantNumeric:`tabular-nums`},children:t}),(0,U.jsx)(`div`,{style:{marginTop:4,fontSize:12,color:r?`#5a8a3a`:`#b15a4a`,fontWeight:600},children:n})]})}function Hd({which:e,data:t,onClose:n}){let r={gross:`Gross sales breakdown`,buyers:`Buyer breakdown`,shows:`Shows breakdown`,aov:`AOV breakdown`,repeat:`Repeat buyer breakdown`}[e];return(0,U.jsxs)(`div`,{className:`card`,style:{borderLeft:`3px solid #9c6b2f`},children:[(0,U.jsxs)(`div`,{className:`between`,children:[(0,U.jsx)(`h3`,{style:{margin:0},children:r}),(0,U.jsxs)(`button`,{className:`ghost`,onClick:n,style:{padding:`4px 10px`},children:[(0,U.jsx)(p,{size:12}),` Close`]})]}),e===`gross`&&(0,U.jsxs)(`table`,{className:`table`,style:{marginTop:10},children:[(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`th`,{children:`Period`}),(0,U.jsx)(`th`,{children:`Gross`}),(0,U.jsx)(`th`,{children:`Buyers`}),(0,U.jsx)(`th`,{children:`Shows`}),(0,U.jsx)(`th`,{children:`AOV`})]})}),(0,U.jsx)(`tbody`,{children:t.months.map(e=>(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`td`,{children:e.month}
53),(0,U.jsxs)(`td`,{children:[`$`,e.gross.toLocaleString()]}),(0,U.jsx)(`td`,{children:e.buyers}),(0,U.jsx)(`td`,{children:e.shows}),(0,U.jsxs)(`td`,{children:[`$`,e.aov.toFixed(2)]})]},e.month))})]}),e===`buyers`&&(0,U.jsxs)(`div`,{style:{marginTop:10},children:[(0,U.jsxs)(`div`,{className:`cols4 grid`,children:[(0,U.jsx)($,{label:`Total buyers`,value:t.buyersNow.toLocaleString()}),(0,U.jsx)($,{label:`Repeat`,value:`${Math.round(t.repeatRate*100)}%`}),(0,U.jsx)($,{label:`New / show`,value:String(Math.round(t.buyersNow*(1-t.repeatRate)/Math.max(1,t.showsNow)))}),(0,U.jsx)($,{label:`VIPs`,value:String(t.topBuyers.filter(e=>e.tag===`VIP`).length)})]}),(0,U.jsxs)(`table`,{className:`table`,style:{marginTop:10},children:[(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`th`,{children:`Buyer`}),(0,U.jsx)(`th`,{children:`Spend`}),(0,U.jsx)(`th`,{children:`Shows`}),(0,U.jsx)(`th`,{children:`Last seen`}),(0,U.jsx)(`th`,{children:`Tag`})]})}),(0,U.jsx)(`tbody`,{children:t.topBuyers.map(e=>(0,U.jsxs)(`tr`,{children:[(0,U.jsxs)(`td`,{children:[`@`,e.name]}),(0,U.jsxs)(`td`,{children:[`$`,e.spend]}),(0,U.jsx)(`td`,{children:e.shows}),(0,U.jsx)(`td`,{children:e.last}),(0,U.jsx)(`td`,{children:e.tag})]},e.name))})]})]}),e===`shows`&&(0,U.jsxs)(`table`,{className:`table`,style:{marginTop:10},children:[(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`th`,{children:`Date`}),(0,U.jsx)(`th`,{children:`Show`}),(0,U.jsx)(`th`,{children:`Gross`}),(0,U.jsx)(`th`,{children:`Buyers`}),(0,U.jsx)(`th`,{children:`Items`}),(0,U.jsx)(`th`,{children:`Repeat`})]})}),(0,U.jsxs)(`tbody`,{children:[t.showRows.map(e=>(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`td`,{children:e.date}),(0,U.jsx)(`td`,{children:e.title}),(0,U.jsxs)(`td`,{children:[`$`,e.gross]}),(0,U.jsx)(`td`,{children:e.buyers}),(0,U.jsx)(`td`,{children:e.items}),(0,U.jsxs)(`td`,{children:[Math.round(e.repeatRate*100),`%`]})]},e.id)),t.showRows.length===0&&(0,U.jsx)(`tr`,{children:(0,U.jsx)(`td`,{colSpan:6,style:{color:`var(--pl-muted)`,textAlign:`center`,padding:16},children:`No shows yet.`})})]})]}),e===`aov`&&(0,U.jsx)(`div`,{style:{marginTop:10},children:(0,U.jsxs)(`div`,{className:`cols4 grid`,children:[(0,U.jsx)($,{label:`Period AOV`,value:`$${t.aov.toFixed(2)}`}),(0,U.jsx)($,{label:`Best item AOV`,value:t.topItems[0]?.units?`$${(t.topItems[0].revenue/t.topItems[0].units).toFixed(2)}`:`â`,sub:t.topItems[0]?.name??`No items yet`}),(0,U.jsx)($,{label:`Bundle uplift`,value:`â`,sub:`needs order history`}),(0,U.jsx)($,{label:`$ / buyer`,value:`$${(t.grossNow/Math.max(1,t.buyersNow)).toFixed(2)}`})]})}),e===`repeat`&&(0,U.jsxs)(`table`,{className:`table`,style:{marginTop:10},children:[(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`th`,{children:`Cohort`}),(0,U.jsx)(`th`,{children:`Buyers`}),(0,U.jsx)(`th`,{children:`Came back`}),(0,U.jsx)(`th`,{children:`Repeat rate`})]})}),(0,U.jsx)(`tbody`,{children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`td`,{children:`Current period`}),(0,U.jsx)(`td`,{children:t.buyersNow}),(0,U.jsx)(`td`,{children:Math.round(t.buyersNow*t.repeatRate)}),(0,U.jsxs)(`td`,{children:[Math.round(t.repeatRate*100),`%`]})]})})]})]})}function Ud({name:e,onClose:t}){let{data:n}=Su(500),r=(n??[]).filter(t=>String(t.item_title??``)===e).map(e=>({show:e.show_id??`â`,date:e.sold_at?new Date(e.sold_at).toLocaleDateString():`â`,units:Number(e.qty??1),revenue:Number(e.total??0)})),i=r.reduce((e,t)=>e+t.revenue,0);return(0,U.jsxs)(`div`,{className:`card`,style:{marginTop:10,borderLeft:`3px solid #9c6b2f`},children:[(0,U.jsxs)(`div`,{className:`between`,children:[(0,U.jsxs)(`h4`,{style:{margin:0},children:[e,` â by show`]}),(0,U.jsxs)(`button`,{className:`ghost`,onClick:t,style:{padding:`4px 10px`},children:[(0,U.jsx)(p,{size:12}),` Close`]})]}),(0,U.jsxs)(`table`,{className:`table`,style:{marginTop:8},children:[(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`th`,{children:`Date`}),(0,U.jsx)(`th`,{children:`Show`}),(0,U.jsx)(`th`,{children:`Units`}),(0,U.jsx)(`th`,{children:`Revenue`})]})}),(0,U.jsxs)(`tbody`,{children:[r.map((e,t)=>(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`td`,{children:e.date}),(0,U.jsx)(`td`,{children:e.show}),(0,U.jsx)(`td`,{children:e.units}),(0,U.jsxs)(`td`,{children:[`$`,e.revenue]})]},t)),r.length===0&&(0,U.jsx)(`tr`,{children:(0,U.jsx)(`td`,{colSpan:4,style:{color:`var(--pl-muted)`,textAlign:`center`,padding:16},children:`No synced rows for this item yet.`})})]}),(0,U.jsx)(`tfoot`,{children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`td`,{colSpan:3,style:{textAlign:`right`,fontWeight:700},children:`Lifetime`}),(0,U.jsxs)(`td`,{style:{fontWeight:700}
53,children:[`$`,i.toLocaleString()]})]})})]})]})}function Wd({name:e,onClose:t}){let{data:n}=Su(500),r=(n??[]).filter(t=>String(t.buyer_username??``)===e),i=r.map(e=>({show:e.show_id??`â`,date:e.sold_at?new Date(e.sold_at).toLocaleDateString():`â`,items:Number(e.qty??1),spend:Number(e.total??0)})),a=r.map(e=>({it:e.item_title,units:Number(e.qty??1),spend:Number(e.total??0)})),o=i.reduce((e,t)=>e+t.spend,0);return(0,U.jsxs)(`div`,{className:`card`,style:{marginTop:10,borderLeft:`3px solid #9c6b2f`},children:[(0,U.jsxs)(`div`,{className:`between`,children:[(0,U.jsxs)(`h4`,{style:{margin:0},children:[`@`,e,` â buyer detail`]}),(0,U.jsxs)(`button`,{className:`ghost`,onClick:t,style:{padding:`4px 10px`},children:[(0,U.jsx)(p,{size:12}),` Close`]})]}),(0,U.jsxs)(`div`,{className:`cols4 grid`,style:{marginTop:10},children:[(0,U.jsx)($,{label:`Lifetime spend`,value:`$${o}`}),(0,U.jsx)($,{label:`Shows attended`,value:String(i.length)}),(0,U.jsx)($,{label:`Avg / show`,value:i.length?`$${Math.round(o/i.length)}`:`â`}),(0,U.jsx)($,{label:`Last seen`,value:i[0]?.date??`â`})]}),(0,U.jsxs)(`div`,{className:`grid cols2`,style:{marginTop:12},children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`label`,children:`Shows attended`}),(0,U.jsxs)(`table`,{className:`table`,children:[(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`th`,{children:`Date`}),(0,U.jsx)(`th`,{children:`Show`}),(0,U.jsx)(`th`,{children:`Items`}),(0,U.jsx)(`th`,{children:`Spend`})]})}),(0,U.jsxs)(`tbody`,{children:[i.map((e,t)=>(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`td`,{children:e.date}),(0,U.jsx)(`td`,{children:e.show}),(0,U.jsx)(`td`,{children:e.items}),(0,U.jsxs)(`td`,{children:[`$`,e.spend]})]},t)),i.length===0&&(0,U.jsx)(`tr`,{children:(0,U.jsx)(`td`,{colSpan:4,style:{color:`var(--pl-muted)`,textAlign:`center`,padding:16},children:`No purchases yet.`})})]})]})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`label`,children:`Items bought`}),(0,U.jsxs)(`table`,{className:`table`,children:[(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`th`,{children:`Item`}),(0,U.jsx)(`th`,{children:`Units`}),(0,U.jsx)(`th`,{children:`Spend`})]})}),(0,U.jsxs)(`tbody`,{children:[a.map((e,t)=>(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`td`,{children:e.it}),(0,U.jsx)(`td`,{children:e.units}),(0,U.jsxs)(`td`,{children:[`$`,e.spend]})]},t)),a.length===0&&(0,U.jsx)(`tr`,{children:(0,U.jsx)(`td`,{colSpan:3,style:{color:`var(--pl-muted)`,textAlign:`center`,padding:16},children:`No items yet.`})})]})]})]})]})]})}function Gd({months:e}){let t=Math.max(...e.map(e=>e.gross)),n=Math.min(...e.map(e=>
53e.gross)),r=Math.ceil(t*1.08/1e3)*1e3,i=Math.max(0,Math.floor(n*.92/1e3)*1e3),a=Math.max(1,r-i),o=888/Math.max(1,e.length-1),s=e=>56+e*o,c=e=>244-(e-i)/a*228,l=e.map((e,t)=>`${s(t)},${c(e.gross)}`).join(` `),u=`M ${s(0)},244 L ${l.split(` `).join(` L `)} L ${s(e.length-1)},244 Z`,d=Array.from({length:5},(e,t)=>i+a*t/4);return(0,U.jsxs)(`svg`,{viewBox:`0 0 960 280`,width:`100%`,style:{display:`block`,height:`auto`,maxHeight:320},preserveAspectRatio:`xMidYMid meet`,children:[(0,U.jsx)(`defs`,{children:(0,U.jsxs)(`linearGradient`,{id:`trendG`,x1:`0`,x2:`0`,y1:`0`,y2:`1`,children:[(0,U.jsx)(`stop`,{offset:`0%`,stopColor:`#5d8bb8`,stopOpacity:`0.55`}),(0,U.jsx)(`stop`,{offset:`100%`,stopColor:`#5d8bb8`,stopOpacity:`0`})]})}),d.map((e,t)=>(0,U.jsxs)(`g`,{children:[(0,U.jsx)(`line`,{x1:56,x2:944,y1:c(e),y2:c(e),stroke:`#e3e7ed`,strokeWidth:`1`}),(0,U.jsxs)(`text`,{x:48,y:c(e)+4,textAnchor:`end`,fontSize:`11`,fill:`#7d8a99`,children:[`$`,Math.round(e).toLocaleString()]})]},t)),(0,U.jsx)(`path`,{d:u,fill:`url(#trendG)`}),(0,U.jsx)(`polyline`,{points:l,fill:`none`,stroke:`#2f4a6b`,strokeWidth:`2.5`,strokeLinejoin:`round`,strokeLinecap:`round`}),e.map((e,t)=>(0,U.jsxs)(`g`,{children:[(0,U.jsx)(`circle`,{cx:s(t),cy:c(e.gross),r:`3.5`,fill:`#2f4a6b`}),(0,U.jsx)(`text`,{x:s(t),y:268,textAnchor:`middle`,fontSize:`11`,fill:`#7d8a99`,children:e.month})]},e.month))]})}function Kd({data:e,highlight:t}){let n=Math.max(...e.map(e=>e.value));return(0,U.jsx)(`div`,{className:`stack`,style:{gap:6},children:e.map(e=>(0,U.jsxs)(`div`,{className:`row`,style:{gap:8,alignItems:`center`},children:[(0,U.jsx)(`div`,{style:{width:40,fontSize:12,color:`var(--pl-muted)`},children:e.label}),(0,U.jsx)(`div`,{style:{flex:1,height:14,background:`#e6ecf2`,borderRadius:6,overflow:`hidden`},children:(0,U.jsx)(`div`,{style:{width:`${e.value/n*100}%`,height:`100%`,background:e.label===t?`#2f4a6b`:`#5d8bb8`}})}),(0,U.jsxs)(`div`,{style:{width:56,textAlign:`right`,fontVariantNumeric:`tabular-nums`,fontSize:12},children:[`$`,e.value]})]},e.label))})}function qd({slices:e}){let t=Math.max(1,e.reduce((e,t)=>e+t.value,0)),n=[`#2f4a6b`,`#5d8bb8`,`#8fb5d6`,`#d68a3c`,`#e6b06a`,`#6a4a8b`,`#4ea3a3`],r=2*Math.PI*90,i=0,a=e.map((e,a)=>{let o=e.value/t,s=`${o*r} ${r}`,c=-i*r;return i+=o,{...e,color:n[a%n.length],dash:s,offset:c,pct:o}}),o=a[0];return(0,U.jsxs)(`div`,{className:`row`,style:{gap:16,alignItems:`center`,flexWrap:`wrap`},children:[(0,U.jsxs)(`svg`,{width:220,height:220,viewBox:`0 0 220 220`,style:{flex:`0 0 auto`},children:[(0,U.jsx)(`circle`,{cx:110,cy:110,r:90,fill:`none`,stroke:`#e6ecf2`,strokeWidth:28}),a.map((e,t)=>(0,U.jsx)(`circle`,{cx:110,cy:110,r:90,fill:`none`,stroke:e.color,strokeWidth:28,strokeDasharray:e.dash,strokeDashoffset:e.offset,transform:`rotate(-90 110 110)`,strokeLinecap:`butt`},t)),(0,U.jsxs)(`text`,{x:110,y:106,textAnchor:`middle`,fontSize:`22`,fontWeight:`800`,fill:`#1f2d40`,children:[Math.round((o?.pct??0)*100),`%`]}),(0,U.jsx)(`text`,{x:110,y:126,textAnchor:`middle`,fontSize:`11`,fill:`#7d8a99`,style:{textTransform:`uppercase`,letterSpacing:`.1em`},children:`top item`})]}),(0,U.jsx)(`div`,{className:`stack`,style:{gap:6,flex:1,minWidth:160},children:a.map(e=>(0,U.jsxs)(`div`,{className:`row`,style:{gap:8,alignItems:`center`,fontSize:12},children:[(0,U.jsx)(`span`,{style:{width:10,height:10,borderRadius:2,background:e.color,flex:`0 0 auto`}}),(0,U.jsx)(`span`,{style:{flex:1,color:`#1f2d40`},children:e.label}),(0,U.jsxs)(`span`,{style:{color:`var(--pl-muted)`,fontVariantNumeric:`tabular-nums`},children:[Math.round(e.pct*100),`%`]})]},e.label))})]})}function Jd({data:e}){let t=Math.max(...e.map(e=>e.v));return(0,U.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(24,
531fr)`,gap:3},children:e.map(e=>{let n=e.v/t;return(0,U.jsx)(`div`,{title:`${e.h}:00 â $${e.v}`,style:{aspectRatio:`1 / 1`,background:`rgba(47, 74, 107, ${.1+n*.85})`,borderRadius:4,display:`grid`,placeItems:`center`,fontSize:9,color:n>.55?`#fff`:`#36425a`,fontWeight:600},children:e.h},e.h)})})}function Yd({buyer:t,number:n,item:r,design:i,tagUrl:a}){let o=i??E,s=o.widthIn||4,c=o.heightIn||6,u=Math.min(80,320/Math.max(s,c)),d=Math.round(s*u),f=Math.round(c*u),p=Math.min(1,Math.sqrt(s*c/24)),m=Math.max(4,Math.round(Math.min(d,f)*.06)),h=s>=c*1.4,g=Math.max(18,Math.min(f*.55,64*o.fontScale*(h?1:p))),_=Math.max(8,Math.min(f*.14,11*o.fontScale)),v=Math.max(9,Math.min(f*.18,14*o.fontScale*p)),y=Math.max(8,Math.min(f*.15,12*o.fontScale*p)),b=a??(typeof window<`u`?`${window.location.origin}/tag/DEMO1234`:``),[x,S]=(0,V.useState)(``);(0,V.useEffect)(()=>{let t=!1;if(!o.showQR||!b){S(``);return}return l(()=>import(`./browser-DVlKlY7A.js`).then(t=>e(t.default)).then(e=>e.toDataURL(b,{margin:0,width:160}).then(e=>{t||S(e)}).catch(()=>{})),__vite__mapDeps([13,1])),()=>{t=!0}},[o.showQR,b]);let C=Math.max(28,Math.min(d,f)*.28),w=o.showBusinessName?(0,U.jsxs)(`div`,{className:`ln`,style:{fontSize:_},children:[(0,U.jsx)(`span`,{children:o.businessName.toUpperCase()}),(0,U.jsx)(`span`,{children:`SHIP TO`})]}):(0,U.jsxs)(`div`,{className:`ln`,style:{fontSize:_},children:[(0,U.jsx)(`span`,{children:`BUYER #`}),(0,U.jsx)(`span`,{children:`SHIP TO`})]});return(0,U.jsxs)(`div`,{className:`label-preview`,style:{width:d,height:f,padding:m,overflow:`hidden`,boxSizing:`border-box`,display:`flex`,flexDirection:`column`,gap:Math.max(2,m/2),transform:`translate(${o.offsetX}mm, ${o.offsetY}mm)`,fontSize:`${14*o.fontScale}px`,position:`relative`},children:[w,h?(0,U.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:m,flex:1,minHeight:0},children:[o.showBuyerNumber&&(0,U.jsx)(`div`,{className:`big`,style:{fontSize:g,lineHeight:1},children:String(n).padStart(2,`0`)}),(0,U.jsxs)(`div`,{style:{flex:1,minWidth:0,overflow:`hidden`},children:[o.showUsername&&(0,U.jsxs)(`div`,{style:{fontSize:v,fontWeight:700,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:[`@`,t]}),o.showItem&&(0,U.jsx)(`div`,{style:{fontSize:y,color:`#776b64`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:r})]})]}):(0,U.jsxs)(U.Fragment,{children:[o.showBuyerNumber&&(0,U.jsx)(`div`,{className:`big`,style:{fontSize:g,lineHeight:1,margin:0},children:String(n).padStart(2,`0`)}),o.showUsername&&(0,U.jsxs)(`div`,{style:{fontSize:v,fontWeight:700},children:[`@`,t]}),o.showItem&&(0,U.jsx)(`div`,{style:{fontSize:y,color:`#776b64`,marginTop:2},children:r})]}),o.showBarcode&&(0,U.jsx)(`div`,{className:`barcode`,style:{height:Math.max(10,Math.min(f*.18,28)),marginTop:`auto`}}),o.showQR&&x&&(0,U.jsx)(`img`,{src:x,alt:`tag QR`,style:{position:`absolute`,right:m,bottom:m,width:C,height:C,background:`#fff`,padding:2,borderRadius:2}})]})}function Xd({title:e,text:t,children:n}){return(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsx)(`h3`,{children:e}),t?(0,U.jsx)(`p`,{children:t}):null,n]})}function $({label:e,value:t,sub:n,onClick:r,active:i}){let a=!!r,[o,s]=(0,V.useState)(!1);return(0,U.jsxs)(`div`,{className:`card`,onClick:r,onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),role:a?`button`:void 0,tabIndex:a?0:void 0,"aria-expanded":a?!!i:void 0,title:a?i?`Click to collapse`:`Click to expand details`:void 0,style:{cursor:a?`pointer`:void 0,borderColor:i?`var(--pl-accent, #9c6b2f)`:void 0,boxShadow:i?`0 0 0 2px rgba(156,107,47,0.22)`:o&&a?`0 4px 14px rgba(0,0,0,0.08)`:void 0,transform:o&&a&&!i?`translateY(-1px)`:void 0,transition:`border-color .15s, box-shadow .15s, transform .15s`,position:`relative`},children:[a?(0,U.jsx)(`span`,{style:{position:`absolute`,top:10,right:10,fontSize:10,fontWeight:700,letterSpacing:.4,textTransform:`uppercase`,padding:`3px 7px`,borderRadius:999,background:i?`var(--pl-accent, #9c6b2f)`:`rgba(156,107,47,0.10)`,color:i?`#fff`:`var(--pl-accent, #9c6b2f)`,border:i?`none`:`1px solid rgba(156,107,47,0.28)`,display:`inline-flex`,alignItems:`center`,gap:4,lineHeight:1},children:i?`Hide â´`:`Expand â¾`}):null,(0,U.jsx)(`div`,{className:`label`,children:e}),(0,U.jsx)(`div`,{className:`metric`,children:t}),n?(0,U.jsx)(`div`,{style:{fontSize:12,color:`var(--pl-muted)`,marginTop:4},children:n}):null,a&&!i?(0,U.jsx)(`div`,{style:{fontSize:11,color:`var(--pl-accent, #9c6b2f)`,marginTop:6,fontWeight:600},children:`Click for breakdown â`}):null]})}function Zd({surface:e,buildContext:t}){let n=z(We),r=u({mutationFn:t=>n({data:{surface:e,context:t}})}),i=r.data?.tips??[],a=()=>r.mutate(t()),o={home:`Today's Coach`,live:`Live Coach`,buyers:`Buyer Coach`,reports:`Reports Coach`,"show-recap":`Show Recap Coach`,compare:`Compare Coach`}[e],s={home:`AI recommendations to maximize your next show.`,live:`In-the-moment nudges based on your current feed.`,buyers:`Who to thank, re-engage, and grow into repeats.`,reports:`What's working â and what to change next week.`,"show-recap":`What went well, what to fix next show.`,compare:`Where you improved, where you slipped, what to do next.`}[e];return(0,U.jsxs)(`div`,{className:`card coach-card`,children:[(0,U.jsxs)(`div`,{className:`between`,children:[(0,U.jsxs)(`div`,{className:`row`,style:{gap:10},children:[(0,U.jsx)(`span`,{className:`coach-ico`,children:(0,U.jsx)(ge,{size:14})}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{style:{margin:0},children:o}),(0,U.jsx)(`div`,{style:{fontSize:12,color:`var(--pl-muted)`},children:s})]})]}),(0,U.jsxs)(`button`,{className:i.length?`ghost`:`primary`,onClick:a,disabled:r.isPending,children:[(0,U.jsx)(v,{size:13,className:r.isPending?`spin`:``}),r.isPending?`Thinkingâ¦`:i.length?`Refresh`:`Get AI tips`]}
53)]}),i.length>0?(0,U.jsx)(`div`,{className:`coach-grid`,children:i.map((e,t)=>(0,U.jsx)(Qd,{tip:e},t))}):r.isPending?null:(0,U.jsxs)(`div`,{className:`coach-empty`,children:[(0,U.jsx)(gt,{size:16}),` Tap `,(0,U.jsx)(`strong`,{children:`Get AI tips`}),` for personalized recommendations.`]}),r.isError?(0,U.jsxs)(`div`,{className:`coach-empty`,style:{color:`#b54a3a`},children:[(0,U.jsx)(Tt,{size:14}),` Coach unavailable â try again.`]}):null]})}function Qd({tip:e}){let t=e.severity===`win`?ye:e.severity===`warn`?Tt:gt;return(0,U.jsxs)(`div`,{className:`coach-tip ${e.severity===`win`?`win`:e.severity===`warn`?`warn`:`info`}`,children:[(0,U.jsxs)(`div`,{className:`row`,style:{gap:8},children:[(0,U.jsx)(t,{size:14}),(0,U.jsx)(`strong`,{children:e.title})]}),(0,U.jsx)(`p`,{style:{margin:`6px 0 0 0`,fontSize:13,lineHeight:1.4},children:e.body})]})}function $d({feed:e,numbers:t}){let n=new Set;return(0,U.jsxs)(`table`,{className:`table`,children:[(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`th`,{children:`#`}),(0,U.jsx)(`th`,{children:`Event`}),(0,U.jsx)(`th`,{children:`Buyer`}),(0,U.jsx)(`th`,{children:`Item`}),(0,U.jsx)(`th`,{children:`Qty`}),(0,U.jsx)(`th`,{children:`Total`}),(0,U.jsx)(`th`,{children:`Status`})]})}),(0,U.jsx)(`tbody`,{children:e.map((e,r)=>{let i=!n.has(e.buyer);n.add(e.buyer);let a=e.status===`Combined`,o=a?`COMBINE`:i?`NEW BUYER`:`WON`,s=a?`#e8a13d`:i?`var(--accent, #5a8f3a)`:`#3a6db2`;return(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`td`,{children:(0,U.jsx)(`strong`,{children:String(t.get(e.buyer)??0).padStart(2,`0`)})}),(0,U.jsx)(`td`,{children:(0,U.jsx)(`span`,{style:{background:s,color:`#fff`,fontWeight:700,fontSize:10,letterSpacing:.5,padding:`3px 7px`,borderRadius:4},children:o})}),(0,U.jsxs)(`td`,{children:[`@`,e.buyer,` `,e.tag===`VIP`?(0,U.jsx)(`span`,{className:`pill vip`,children:`VIP`}):e.tag===`Repeat`?(0,U.jsx)(`span`,{className:`pill new`,children:`Repeat`}):e.tag===`New`?(0,U.jsx)(`span`,{className:`pill`,children:`New`}):null]}),(0,U.jsx)(`td`,{children:e.item}),(0,U.jsx)(`td`,{children:e.qty}),(0,U.jsxs)(`td`,{children:[`$`,e.total.toFixed(2)]}),(0,U.jsx)(`td`,{children:(0,U.jsx)(`span`,{className:`status ${e.status===`Printed`?`ready`:e.status===`Combined`?`dev`:`planned`}`,children:e.status})})]},r)})})]})}var ef={health:`https://www.whatnot.com/dashboard/account-health`,buyers:`https://www.whatnot.com/dashboard/analytics/overview`,orders:`https://www.whatnot.com/dashboard/orders`,payouts:`https://www.whatnot.com/dashboard/ledger/payouts`,backfill:`https://www.whatnot.com/dashboard/lives`};function tf(){let e=Ne(),[t,n]=(0,V.useState)(!1),[r,i]=(0,V.useState)(null),[a,o]=(0,V.useState)({}),c=(0,V.useRef)({}),l=(0,V.useRef)({}),u=(e,t,n)=>{if(e===`health`){if(!t)return!1;let e=ff(t);return t.rating!=null||t.followers!=null||t.response_time_min!=null||e.strikes!=null||e.defectFree!=null||e.onTimeScan!=null}let r=n[e];return r?(r.row_count??0)>
530||!!r.summary:!1},d=async()=>{let{data:e}=await s.from(`whatnot_health`).select(`id,scraped_at,rating,rating_count,strikes,response_time_min,cancel_rate,ship_on_time_rate,followers,raw`).order(`scraped_at`,{ascending:!1}).limit(1),t=e?.[0]??null;i(t);let{data:n}=await s.from(`whatnot_sync_payloads`).select(`id,kind,scraped_at,row_count,source_url,summary`).order(`scraped_at`,{ascending:!1}).limit(40),r={};return(n??[]).forEach(e=>{let t=e;r[t.kind]||(r[t.kind]=t)}),o(r),{health:t,byKind:r}};return(0,V.useEffect)(()=>{let t=t=>{let r=t.data;if(!(!r||r.source!==`pearshow-ext`)&&(r.type===`PEARSHOW_EXT_READY`&&n(!0),r.type===`PEARSHOW_WHATNOT_SYNC_RESULT`))if(r.ok)(async()=>{let t=r.kind??null,n=await d();if(!t)return;if(t===`orders`&&e.invalidateQueries({queryKey:[`recentSales`]}),t===`buyers`&&e.invalidateQueries({queryKey:[`buyers`]}),(t===`backfill`||t===`orders`)&&e.invalidateQueries({queryKey:[`show-summaries`]}),u(t,n.health,n.byKind)){c.current[t]=0;return}let i=(c.current[t]??0)+1;if(i>2){c.current[t]=0,Rt.warning(`Sync completed but no data was found (${t})`,{description:`Open the Whatnot page and try again, or reconnect the extension.`});return}c.current[t]=i,Rt.message(`Retrying ${t} sync (${i}/2)â¦`,{description:`Whatnot may still be loading. Trying again automatically.`});let a=2500*i;l.current[t]&&clearTimeout(l.current[t]),l.current[t]=setTimeout(()=>{window.postMessage({source:`pearshow-web`,type:`PEARSHOW_OPEN_WHATNOT`,url:ef[t],kind:t},window.location.origin)},a)})();else{let e=r.body?.error,t=r.kind?` (${r.kind})`:``,n=e===`not_signed_in`||e===`missing_token`?`Pear Show extension is not connected. Open the extension in Chrome and click Connect to PearShow.`:e===`invalid_token`?`Your seller token was rejected â it may have been rotated or revoked. Open the extension and reconnect.`:e===`disabled`?`The Pear Show extension is turned off. Open it and toggle it on.`:e===`no_server`?`The extension has no Pear Show server URL. Please reinstall the extension.`:r.body?.message||`Refresh failed${t}. Please try again.`;Rt.error(`Refresh failed${t}`,{description:n})}};return window.addEventListener(`message`,t),window.postMessage({source:`pearshow-web`,type:`PEARSHOW_PING`},window.location.origin),d(),()=>{window.removeEventListener(`message`,t),Object.values(l.current).forEach(e=>e&&clearTimeout(e))}},[e]),{extReady:t,health:r,lastByKind:a,requestSync:e=>t?(c.current[e]=0,window.postMessage({source:`pearshow-web`,type:`PEARSHOW_OPEN_WHATNOT`,url:ef[e],kind:e},window.location.origin),!0):(Rt.error(`Pear Show extension not detected`,{description:`Install the Pear Show extension in Chrome, then connect it to refresh Whatnot data.`}),!1),reload:d}}var nf=`pearshow:autosync:consent`;function rf(){if(typeof window>`u`)return null;let e=localStorage.getItem(nf);return e===`granted`||e===`declined`?e:null}function af(e){try{localStorage.setItem(nf,e)}catch{}try{window.postMessage({source:`pearshow-web`,type:`PEARSHOW_SET_AUTOSYNC`,enabled:e===`granted`},window.location.origin)}catch{}window.dispatchEvent(new CustomEvent(`pl:autosync-consent`,{detail:e})),(async()=>{try{let{data:{user:t}}=await s.auth.getUser();if(!t)return;await s.from(`profiles`).update({whatnot_autosync:e}).eq(`id`,t.id)}catch{}})()}async function of(){try{let{data:{user:e}}=await s.auth.getUser();if(!e)return rf();let{data:t}=await s.from(`profiles`).select(`whatnot_autosync`).eq(`id`,e.id).maybeSingle(),n=t?.whatnot_autosync;if(n===`granted`||n===`declined`){try{localStorage.setItem(nf,n)}catch{}try{window.postMessage({source:`pearshow-web`,type:`PEARSHOW_SET_AUTOSYNC`,enabled:n===`granted`},window.location.origin)}catch{}return n}}catch{}return rf()}function sf(){let[e,t]=(0,V.useState)(()=>rf()),[n,r]=(0,V.useState)(!1);return(0,V.useEffect)(()=>{let e=e=>t(e.detail);return window.addEventListener(`pl:autosync-consent`,e),()=>window.removeEventListener(`pl:autosync-consent`,e)},[]),(0,V.useEffect)(()=>{let e=!0;return of().then(n=>{e&&(n&&t(n),r(!0))}),()=>{e=!1}},[]),e||!n?null:(0,U.jsx)(`div`,{className:`card`,style:{background:`#1c2a3a`,color:`#fff`,borderColor:`#2f4a6b`},children:(0,U.jsxs)(`div`,{className:`row`,style:{justifyContent:`space-between`,alignItems:`center`,gap:12,flexWrap:`wrap`},children:[(0,U.jsxs)(`div`,{style:{maxWidth:720},children:[(0,U.jsx)(`div`,{style:{fontWeight:700},children:`Let Pear Show keep your Whatnot data in sync automatically?`}),(0,U.jsx)(`div`,{className:`sub`,style:{marginTop:4,color:`#cfe0f5`},children:`When youâre signed in to Whatnot, the Pear Show extension can quietly refresh your account health, buyer list, payouts, and past shows every few hours. We only read what you can already see â nothing is ever written back to Whatnot. You can turn this off any time in Settings â Browser extension.`})]}),(0,U.jsxs)(`div`,{className:`row`,style:{gap:8},children:[(0,U.jsx)(`button`,{onClick:()=>af(`declined`),style:{background:`transparent`,color:`#fff`,border:`1px solid #ffffff80`,padding:`8px 14px`,borderRadius:6,fontWeight:600,cursor:`pointer`},children:`Not now`}),(0,U.jsx)(`button`,{onClick:()=>af(`granted`),style:{background:`#a8c93a`,color:`#1a1a1a`,border:`none`,padding:`8px 14px`,borderRadius:6,fontWeight:700,cursor:`pointer`},children:`Allow auto-sync`})]})]})})}
53function cf(e){return e?new Date(e).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`}):`Never synced`}function lf(e){return e==null?``:typeof e==`string`||typeof e==`number`||typeof e==`boolean`?String(e):Array.isArray(e)?e.map(lf).join(` `):typeof e==`object`?Object.values(e).map(lf).join(` `):``}function uf(e){return typeof e!=`number`||!Number.isFinite(e)?null:e>1?Number((e/100).toFixed(4)):e}function df(e,t){let n=lf(e).replace(/\s+/g,` `),r=new RegExp(t.source,t.flags.includes(`i`)?`gi`:`g`);for(let e of n.matchAll(r)){let t=e.index||0,r=n.slice(Math.max(0,t-90),t),i=n.slice(t,t+90),a=Array.from(r.matchAll(/(\d+(?:\.\d+)?)\s*%/g));if(a.length)return Number((Number(a[a.length-1][1])/100).toFixed(4));let o=i.match(/(\d+(?:\.\d+)?)\s*%/);if(o)return Number((Number(o[1])/100).toFixed(4))}return null}function ff(e){let t=e?.raw,n=t&&typeof t==`object`&&!Array.isArray(t)&&t.parsed,r=n&&typeof n==`object`&&!Array.isArray(n)?n:{},i=lf(t);return{onTimeScan:uf(e?.ship_on_time_rate)??uf(r.on_time_scan_rate)??uf(r.ship_on_time_rate)??df(i,/On[- ]Time Scan Rate/i)??df(i,/ship(?:ped|ping)?\s+on[- ]time/i)??df(i,/on[- ]time\s+ship/i),defectFree:uf(r.defect_free_order_rate)??df(i,/Defect[- ]Free Order Rate/i)??df(i,/defect[- ]free/i)??(uf(e?.cancel_rate)==null?null:Number(Math.max(0,1-(uf(e?.cancel_rate)??0)).toFixed(4))),strikes:e?.strikes??(/there'?s nothing here at the moment|no violations|no strikes|nothing here/i.test(i)?0:null)}}function pf(){let{extReady:e,health:t,requestSync:n}=tf();if(!t&&!e)return null;let r=e=>e==null||!Number.isFinite(e)?`N/A`:`${(e*100).toFixed(1)}%`,i=e=>e==null||!Number.isFinite(e)?`N/A`:String(e),a=ff(t);return(0,U.jsxs)(`div`,{className:`card`,children:[(0,U.jsxs)(`div`,{className:`row`,style:{justifyContent:`space-between`,alignItems:`center`},children:[(0,U.jsxs)(`h3`,{style:{margin:0,display:`flex`,alignItems:`center`,gap:6},children:[(0,U.jsx)(ht,{size:16}),` Whatnot account health`]}),(0,U.jsxs)(`div`,{className:`row`,style:{gap:8,alignItems:`center`},children:[(0,U.jsx)(`span`,{className:`muted`,style:{fontSize:11},children:cf(t?.scraped_at)}),(0,U.jsxs)(`button`,{className:`ghost`,style:{fontSize:11,padding:`4px 10px`},onClick:()=>n(`health`),disabled:!e,children:[(0,U.jsx)(m,{size:11}),` Refresh`]})]})]}),(0,U.jsxs)(`div`,{className:`grid`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(140px, 1fr))`,gap:10,marginTop:12},children:[(0,U.jsx)(gf,{label:`Rating`,value:t?.rating==null?`N/A`:`${t.rating}â
`,sub:t?.rating_count?`${i(t.rating_count)} ratings`:``}),(0,U.jsx)(gf,{label:`Strikes`,value:i(a.strikes),tone:a.strikes&&a.strikes>0?`warn`:`ok`}),(0,U.jsx)(gf,{label:`Response time`,value:t?.response_time_min==null?`N/A`:`${t.response_time_min}m`}),(0,U.jsx)(gf,{label:`Defect-free`,value:r(a.defectFree),tone:(a.defectFree??1)<.95?`warn`:`ok`}),(0,U.jsx)(gf,{label:`On-time scan`,value:r(a.onTimeScan),tone:(a.onTimeScan??1)<.9?`warn`:`ok`}),(0,U.jsx)(gf,{label:`Followers`,value:i(t?.followers)})]})]})}function mf(){let{extReady:e,lastByKind:t,requestSync:n}=tf(),r=t.buyers;return(0,U.jsxs)(`div`,{className:`card`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,gap:12,flexWrap:`wrap`},children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{style:{fontWeight:700},children:`Whatnot buyer enrichment`}),(0,U.jsx)(`div`,{className:`sub`,style:{marginTop:2,fontSize:12},children:r?(0,U.jsxs)(U.Fragment,{children:[`Last imported `,cf(r.scraped_at),r.row_count==null?``:` · ${r.row_count} buyers`,`.`]}):(0,U.jsx)(U.Fragment,{children:`Pull your Whatnot buyer list to enrich names with order counts & lifetime spend.`})})]}),(0,U.jsxs)(`button`,{className:`primary`,onClick:()=>n(`buyers`),disabled:!e,title:e?``:`Install the Pear Show extension first`,children:[(0,U.jsx)(m,{size:14}),` `,r?`Re-sync from Whatnot`:`Sync buyers from Whatnot`]})]})}function hf(){let{extReady:e,lastByKind:t,requestSync:n}=tf(),r=t.orders;return(0,U.jsxs)(`div`,{className:`card`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,gap:12,flexWrap:`wrap`},children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{style:{fontWeight:700},children:`Whatnot order sync`}),(0,U.jsx)(`div`,{className:`sub`,style:{marginTop:2,fontSize:12},children:r?(0,U.jsxs)(U.Fragment,{children:[`Last imported `,cf(r.scraped_at),r.row_count==null?``:` · ${r.row_count} order rows scanned`,`.`]}):(0,U.jsx)(U.Fragment,{children:`Pull the Whatnot orders page so PearShow can list every synced order here.`})})]}),(0,U.jsxs)(`button`,{className:`primary`,onClick:()=>n(`orders`),disabled:!e,title:e?``:`Install the Pear Show extension first`,children:[(0,U.jsx)(m,{size:14}),` `,r?`Re-sync orders`:`Sync orders from Whatnot`]})]})}function gf({label:e,value:t,sub:n,tone:r}){return(0,U.jsxs)(`div`,{style:{border:`1px solid ${r===`warn`?`#e6b8a8`:`var(--pl-border)`}`,borderRadius:10,padding:10,background:r===`warn`?`#fbeee6`:`#f6f1e0`,color:`#1f2a1a`},children:[(0,U.jsx)(`div`,{style:{fontSize:11,color:`#6b6452`,textTransform:`uppercase`,letterSpacing:`.08em`},children:e}),(0,U.jsx)(`div`,{style:{fontWeight:800,fontSize:18,marginTop:4,color:r===`warn`?`#8a2222`:`#1f2a1a`},children:t}),n?(0,U.jsx)(`div`,{style:{fontSize:11,color:`#6b6452`,marginTop:2},children:n}):null]})}function _f(){let[e,t]=(0,V.useState)(()=>rf());(0,V.useEffect)(()=>{let e=!0;return of().then(n=>{e&&n&&t(n)}),()=>{e=!1}},[]);let n=e=>{af(e),t(e)};return(0,U.jsx)(`div`,{className:`card`,style:{marginTop:12,padding:12},children:(0,U.jsxs)(`div`,{className:`between`,style:{alignItems:`flex-start`,gap:12},children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:`Whatnot auto-sync`}),(0,U.jsx)(`div`,{className:`muted`,style:{fontSize:12,marginTop:2,maxWidth:540},children:`When youâre signed in to Whatnot, the extension refreshes your account health, buyer list, payouts, and past shows every ~6 hours. Read-only â Pear Show never writes back to Whatnot.`})]}),(0,U.jsxs)(`div`,{className:`row`,style:{gap:6},children:[(0,U.jsx)(`button`,{className:e===`granted`?`primary`:`ghost`,onClick:()=>n(`granted`),children:`On`}),(0,U.jsx)(`button`,{className:e===`declined`?`primary`:`ghost`,onClick:()=>n(`declined`),children:`Off`})]})]})})}export{wu 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.