const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./D3n9Vtz8.js","./entry.jP7vtIDQ.css"])))=>i.map(i=>d[i]); import{a0 as je,E as ne,r as g,s as L,a1 as V,f as Be,e as Oe,j as ge,a2 as Le,c as d,a as e,b as $,w as C,Z as ce,k as s,m as P,t as x,$ as se,n as Y,v as oe,p as W,F as H,l as me,_ as xe,o as i,d as M,I as pe,a3 as re,O as z,P as D,Q as F,R as Ae,S as Ue,y as ze,z as we,A as Ke,h as qe,q as fe,H as Fe,a4 as He}from"./D3n9Vtz8.js";import{_ as ke}from"./B1u-MKiH.js";const X="gamma-market-cart-v1",Is=je("cart",()=>{const t=g([]),n=g({name:"",addressLine1:"",addressLine2:"",city:"",postalCode:"",country:"",email:"",phone:"",notes:""}),a=g(""),m=g(null),f=g({orderId:"",status:"idle",submittedEventId:"",invoice:"",invoiceAmount:"",invoiceExpiration:""});(()=>{const p=localStorage.getItem(X);if(p)try{const v=JSON.parse(p);t.value=v.items||[],n.value={...n.value,...v.shippingInfo||{}},a.value=v.shippingReference||"",m.value=v.guestKeys||null,f.value={...f.value,...v.orderState||{}}}catch{localStorage.removeItem(X)}})(),ne([t,n,a,m,f],()=>{const p={items:t.value,shippingInfo:n.value,shippingReference:a.value,guestKeys:m.value,orderState:f.value};localStorage.setItem(X,JSON.stringify(p))},{deep:!0});const u=L(()=>t.value.reduce((p,v)=>{const R=Number(v.price?.amount||0);return p+R*v.quantity},0)),c=L(()=>t.value.reduce((p,v)=>p+v.quantity,0)),r=(p,v=1)=>{const R=t.value.find(E=>E.reference===p.reference);if(R){R.quantity+=v;return}t.value.push({reference:p.reference,d:p.d,title:p.title,image:p.image,price:p.price,quantity:v})},h=p=>{t.value=t.value.filter(v=>v.reference!==p)},k=(p,v)=>{const R=t.value.find(E=>E.reference===p);R&&(R.quantity=Math.max(1,Number(v)||1))},w=p=>{n.value={...n.value,...p}},_=p=>{m.value=p},T=p=>{f.value={...f.value,...p}},j=()=>{a.value="",f.value={orderId:"",status:"idle",submittedEventId:"",invoice:"",invoiceAmount:"",invoiceExpiration:""}};return{items:t,shippingInfo:n,shippingReference:a,guestKeys:m,orderState:f,subtotal:u,totalItems:c,addToCart:r,removeFromCart:h,updateQuantity:k,setShippingInfo:w,setGuestKeys:_,setOrderState:T,clearCheckout:j,clearCart:()=>{t.value=[],j()}}}),he="gamma-market-theme",ee=t=>t==="light"?"light":"dark",De=()=>{const t=V("theme-mode",()=>"dark"),n=V("shop-bootstrap-state",()=>({merchantTheme:null,merchantThemeMode:""})),a=L(()=>!!n.value?.merchantTheme);ne(()=>[a.value,n.value?.merchantThemeMode],()=>{if(!a.value)return;const u=ee(n.value?.merchantThemeMode||"dark");t.value=u,document.documentElement.setAttribute("data-theme",u)},{immediate:!0});const m=u=>{if(a.value){const r=n.value?.merchantThemeMode||"dark";t.value=ee(r),document.documentElement.setAttribute("data-theme",t.value);return}const c=ee(u);t.value=c,document.documentElement.setAttribute("data-theme",c),localStorage.setItem(he,c)};return{theme:t,hasMerchantTheme:a,initializeTheme:()=>{if(a.value){m(n.value?.merchantThemeMode||"dark");return}const u=localStorage.getItem(he);m(u||"dark")},applyTheme:m,toggleTheme:()=>{a.value||m(t.value==="dark"?"light":"dark")}}},Ve={class:"sticky top-0 z-10 border-b border-[var(--line)] bg-[color:var(--surface)]/95 backdrop-blur"},Ye={class:"mx-auto flex max-w-6xl items-center px-4 py-3 sm:px-6 lg:px-8"},We={class:"flex flex-1 justify-start"},Ge=["src"],Je={key:1,class:"flex h-9 w-9 items-center justify-center rounded-full border border-[var(--line)] bg-stone-100 text-xs font-bold text-[var(--muted)]"},Qe={class:"hidden items-center gap-4 text-sm font-medium sm:gap-6 md:flex"},Ze={class:"flex flex-1 items-center justify-end gap-4 text-sm font-medium"},Xe={class:"text-xs font-semibold"},et=["href"],tt={class:"sr-only"},st={key:0,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.7",class:"h-5 w-5","aria-hidden":"true"},ot={key:1,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.7",class:"h-5 w-5","aria-hidden":"true"},nt={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8",class:"h-5 w-5","aria-hidden":"true"},rt={key:0,d:"M4 7h16M4 12h16M4 17h16"},at={key:1,d:"M6 6l12 12M18 6 6 18"},lt={class:"mx-auto w-full max-w-6xl px-4 pb-3 md:hidden sm:px-6 lg:px-8"},it={key:0,class:"mt-2 text-sm text-[var(--muted)]"},dt={key:1,class:"mt-2 rounded-lg border border-red-200 bg-red-50 p-2 text-sm text-red-800"},ut={key:2,class:"mt-2 space-y-2"},ct={class:"min-w-0 truncate text-sm font-medium"},mt={class:"shrink-0 text-xs text-[var(--muted)]"},pt={key:3,class:"mt-2 text-sm text-[var(--muted)]"},ft={key:0,class:"border-b border-[var(--line)] bg-[var(--surface)] md:hidden"},ht={class:"mx-auto flex max-w-6xl flex-col gap-1 px-4 py-3 text-sm font-medium sm:px-6 lg:px-8"},bt={class:"mt-1 flex items-center gap-2 px-3 py-2"},yt=["href"],vt={class:"sr-only"},gt={key:0,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.7",class:"h-5 w-5","aria-hidden":"true"},xt={key:1,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.7",class:"h-5 w-5","aria-hidden":"true"},wt={class:"w-full max-w-2xl rounded-2xl border border-[var(--line)] bg-[var(--surface)] p-5 shadow-2xl"},kt={class:"flex items-center justify-between gap-3"},_t={key:0,class:"mt-3 text-sm text-[var(--muted)]"},St={key:1,class:"mt-3 rounded-lg border border-red-200 bg-red-50 p-2 text-sm text-red-800"},Nt={key:2,class:"mt-3 text-sm text-[var(--muted)]"},Ct={key:3,class:"mt-3 text-sm text-[var(--muted)]"},Pt={key:4,class:"mt-3 space-y-2"},Et={class:"min-w-0 truncate text-sm font-medium"},$t={class:"shrink-0 text-xs text-[var(--muted)]"},be="/nostr-assets/nostr-logo-black.svg",Mt={__name:"ShopHeader",props:{itemCount:{type:Number,default:0},merchantProfile:{type:Object,default:null},merchantNpub:{type:String,default:""}},setup(t){const{theme:n,hasMerchantTheme:a,initializeTheme:m,toggleTheme:f}=De(),{ensureBootstrap:y}=Be(),u=Oe(),c=g(!1),r=g(!1),h=g(""),k=g(!1),w=g(""),_=V("shop-search-inventory",()=>[]),T=V("shop-search-loaded",()=>!1),j=async()=>{if(!(k.value||T.value)){k.value=!0,w.value="";try{const E=await y();_.value=E.products||[],T.value=!0}catch(E){w.value=E.message||"Could not load products for search."}finally{k.value=!1}}},B=async()=>{T.value||await j()},p=async()=>{c.value=!0,r.value=!1,T.value||await j()},v=L(()=>{const E=h.value.trim().toLowerCase();return E?_.value.filter(o=>{const S=(o.categories||[]).map(Q=>String(Q||"").trim()).filter(Boolean);return[o.title,o.summary,o.description,...S,S.length?"":"uncategorized"].join(" ").toLowerCase().includes(E)}).slice(0,5):[]}),R=E=>`/product/${encodeURIComponent(E.d)}`;return ne(()=>u.fullPath,()=>{c.value=!1,r.value=!1}),ge(()=>{m(),window.addEventListener("shop:open-search",p)}),Le(()=>{window.removeEventListener("shop:open-search",p)}),(E,o)=>{const S=ke;return i(),d(H,null,[e("header",Ve,[e("div",Ye,[e("div",We,[$(S,{to:"/",class:"flex items-center gap-3 text-lg font-semibold tracking-tight"},{default:C(()=>[t.merchantProfile?.picture?(i(),d("img",{key:0,src:t.merchantProfile.picture,alt:"Merchant profile",class:"h-9 w-9 rounded-full border border-[var(--line)] object-cover"},null,8,Ge)):(i(),d("div",Je," M ")),e("span",null,x(t.merchantProfile?.name||"loading"),1)]),_:1})]),e("nav",Qe,[$(S,{to:"/"},{default:C(()=>[...o[7]||(o[7]=[M("Home",-1)])]),_:1}),$(S,{to:"/products"},{default:C(()=>[...o[8]||(o[8]=[M("Products",-1)])]),_:1}),$(S,{to:"/categories"},{default:C(()=>[...o[9]||(o[9]=[M("Categories",-1)])]),_:1}),$(S,{to:"/contact"},{default:C(()=>[...o[10]||(o[10]=[M("About",-1)])]),_:1})]),e("nav",Ze,[$(S,{to:"/cart",class:"inline-flex items-center gap-2 rounded-full border border-[var(--line)] px-2 py-1.5"},{default:C(()=>[o[11]||(o[11]=e("span",{class:"sr-only"},"Open cart",-1)),o[12]||(o[12]=e("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8",class:"h-5 w-5","aria-hidden":"true"},[e("circle",{cx:"9",cy:"20",r:"1.5"}),e("circle",{cx:"18",cy:"20",r:"1.5"}),e("path",{d:"M3 4h2l2.2 10.2a2 2 0 0 0 2 1.6h7.8a2 2 0 0 0 2-1.5L21 7H7.5"})],-1)),e("span",Xe,x(t.itemCount),1)]),_:1}),e("button",{class:"hidden h-9 w-9 items-center justify-center rounded-full border border-[var(--line)] md:inline-flex",onClick:p},[...o[13]||(o[13]=[e("span",{class:"sr-only"},"Search products",-1),e("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8",class:"h-5 w-5","aria-hidden":"true"},[e("circle",{cx:"11",cy:"11",r:"7"}),e("path",{d:"m20 20-3.5-3.5"})],-1)])]),t.merchantNpub?(i(),d("a",{key:0,href:`https://njump.me/${t.merchantNpub}`,target:"_blank",rel:"noopener noreferrer",class:"hidden h-9 w-9 items-center justify-center rounded-full border border-[var(--line)] md:inline-flex"},[o[14]||(o[14]=e("span",{class:"sr-only"},"Open merchant npub",-1)),e("img",{src:be,alt:"",class:"h-5 w-5 object-contain",style:ce({filter:s(n)==="dark"?"invert(1)":"none"}),"aria-hidden":"true"},null,4)],8,et)):P("",!0),s(a)?P("",!0):(i(),d("button",{key:1,class:"hidden h-9 w-9 items-center justify-center rounded-full border border-[var(--line)] md:inline-flex",onClick:o[0]||(o[0]=(...b)=>s(f)&&s(f)(...b))},[e("span",tt,x(s(n)==="dark"?"Switch to light mode":"Switch to dark mode"),1),s(n)==="dark"?(i(),d("svg",st,[...o[15]||(o[15]=[se('',9)])])):(i(),d("svg",ot,[...o[16]||(o[16]=[e("path",{d:"M12 3a7 7 0 1 0 9 9 9 9 0 1 1-9-9z"},null,-1)])]))])),e("button",{class:"inline-flex h-9 w-9 items-center justify-center rounded-full border border-[var(--line)] md:hidden",onClick:o[1]||(o[1]=b=>r.value=!s(r))},[o[17]||(o[17]=e("span",{class:"sr-only"},"Toggle menu",-1)),(i(),d("svg",nt,[s(r)?(i(),d("path",at)):(i(),d("path",rt))]))])])]),e("div",lt,[Y(e("input",{"onUpdate:modelValue":o[2]||(o[2]=b=>W(h)?h.value=b:null),type:"search",placeholder:"Search products",class:"w-full rounded-lg border border-[var(--line)] bg-white px-3 py-2 text-sm text-black",onFocus:B},null,544),[[oe,s(h)]]),s(k)?(i(),d("p",it,"Loading inventory…")):s(w)?(i(),d("p",dt,x(s(w)),1)):s(h).trim()&&s(v).length>0?(i(),d("div",ut,[(i(!0),d(H,null,me(s(v),b=>(i(),pe(S,{key:b.id,to:R(b),class:"flex items-center justify-between gap-3 rounded-lg border border-[var(--line)] bg-[var(--surface)] px-3 py-2"},{default:C(()=>[e("span",ct,x(b.title),1),e("span",mt,x(b.price.display),1)]),_:2},1032,["to"]))),128))])):s(h).trim()?(i(),d("p",pt,"No matching products.")):P("",!0)])]),s(r)?(i(),d("div",ft,[e("nav",ht,[$(S,{to:"/",class:"rounded-lg px-3 py-2"},{default:C(()=>[...o[18]||(o[18]=[M("Home",-1)])]),_:1}),$(S,{to:"/products",class:"rounded-lg px-3 py-2"},{default:C(()=>[...o[19]||(o[19]=[M("Products",-1)])]),_:1}),$(S,{to:"/categories",class:"rounded-lg px-3 py-2"},{default:C(()=>[...o[20]||(o[20]=[M("Categories",-1)])]),_:1}),$(S,{to:"/contact",class:"rounded-lg px-3 py-2"},{default:C(()=>[...o[21]||(o[21]=[M("About",-1)])]),_:1}),e("div",bt,[t.merchantNpub?(i(),d("a",{key:0,href:`https://njump.me/${t.merchantNpub}`,target:"_blank",rel:"noopener noreferrer",class:"inline-flex h-9 w-9 items-center justify-center rounded-full border border-[var(--line)]"},[o[22]||(o[22]=e("span",{class:"sr-only"},"Open merchant npub",-1)),e("img",{src:be,alt:"",class:"h-5 w-5 object-contain",style:ce({filter:s(n)==="dark"?"invert(1)":"none"}),"aria-hidden":"true"},null,4)],8,yt)):P("",!0),s(a)?P("",!0):(i(),d("button",{key:1,class:"inline-flex h-9 w-9 items-center justify-center rounded-full border border-[var(--line)]",onClick:o[3]||(o[3]=(...b)=>s(f)&&s(f)(...b))},[e("span",vt,x(s(n)==="dark"?"Switch to light mode":"Switch to dark mode"),1),s(n)==="dark"?(i(),d("svg",gt,[...o[23]||(o[23]=[se('',9)])])):(i(),d("svg",xt,[...o[24]||(o[24]=[e("path",{d:"M12 3a7 7 0 1 0 9 9 9 9 0 1 1-9-9z"},null,-1)])]))]))])])])):P("",!0),s(c)?(i(),d("div",{key:1,class:"fixed inset-0 z-50 flex items-start justify-center bg-black/60 px-4 pt-20",onClick:o[6]||(o[6]=xe(b=>c.value=!1,["self"]))},[e("div",wt,[e("div",kt,[o[25]||(o[25]=e("h2",{class:"text-lg font-semibold"},"Search Products",-1)),e("button",{class:"rounded border border-[var(--line)] px-2 py-1 text-xs",onClick:o[4]||(o[4]=b=>c.value=!1)},"Close")]),Y(e("input",{"onUpdate:modelValue":o[5]||(o[5]=b=>W(h)?h.value=b:null),type:"search",placeholder:"Type to search products",class:"mt-4 w-full rounded-lg border border-[var(--line)] bg-white px-3 py-2 text-sm text-black"},null,512),[[oe,s(h)]]),s(k)?(i(),d("p",_t,"Loading inventory…")):s(w)?(i(),d("p",St,x(s(w)),1)):s(h).trim()?s(v).length===0?(i(),d("p",Ct,"No matching products.")):(i(),d("div",Pt,[(i(!0),d(H,null,me(s(v),b=>(i(),pe(S,{key:b.id,to:R(b),class:"flex items-center justify-between gap-3 rounded-lg border border-[var(--line)] px-3 py-2 hover:bg-black/5"},{default:C(()=>[e("span",Et,x(b.title),1),e("span",$t,x(b.price.display),1)]),_:2},1032,["to"]))),128))])):(i(),d("p",Nt,"Start typing to see up to 5 matching products."))])])):P("",!0)],64)}}},Ts=Object.assign(Mt,{__name:"ShopHeader"}),It=re("/btc-button.png"),Tt=re("/paypal-button.png"),Rt=re("/Logo.png");var U=Symbol("verified"),jt=t=>t instanceof Object;function Bt(t){if(!jt(t)||typeof t.kind!="number"||typeof t.content!="string"||typeof t.created_at!="number"||typeof t.pubkey!="string"||!t.pubkey.match(/^[a-f0-9]{64}$/)||!Array.isArray(t.tags))return!1;for(let n=0;n{if(typeof t!="string")return"";const n=t.trim();return n.startsWith("wss://")?n:""},G=t=>Array.from(new Set(t.map(Kt).filter(Boolean))),qt=t=>{const a=String(t||"").toLowerCase().split(".")[0]||"";return a.startsWith("npub1")?a:a.startsWith("npubs1")?`npub1${a.slice(6)}`:""},Ft=t=>{const n=Ke(t);if(n.type!=="npub")throw new Error("Invalid npub format.");return n.data},Se=t=>{const n=[];for(const a of t?.tags||[])(a[0]==="relay"||a[0]==="r")&&a[1]&&n.push(a[1]);return G(n)},Ht=t=>t.filter(n=>n[0]!=="d"&&n[0]!=="name"),Ne=({sourceManifest:t,sourcePubkey:n,relays:a})=>{const m=Ht((t?.tags||[]).map(u=>[...u])),f=G([...Se(t),...a||[]]).map(u=>["relay",u]),y=m.filter(u=>u[0]!=="relay"&&u[0]!=="r");return{kind:15128,created_at:Math.floor(Date.now()/1e3),tags:[...y,...f,["muse",_e,...G(a||[]).slice(0,3)]],content:t?.content||""}},Dt=()=>{const t=new Ue;return{uniq:G,generateIdentity:()=>{const u=Ut(),c=zt(u);return{secretKey:u,pubkey:c,npub:we(c),nsec:ze(u)}},resolveSourceNpub:({hostname:u,fallbackNpub:c=""})=>qt(u)||String(c||""),fetchSourceManifest:async({sourceNpub:u,relays:c})=>{const r=Ft(u),k=[...await t.querySync(c,{kinds:[15128,35128],authors:[r],limit:30})].sort((_,T)=>T.created_at-_.created_at)[0];if(!k)throw new Error("No source nsite manifest found on selected relays.");const w=Se(k);return{sourcePubkey:r,manifest:k,manifestRelays:w}},publishProfile:async({identity:u,name:c,relays:r})=>{const h={name:c,display_name:c,about:"Owner of a sovereign Nsite webshop"},k=ye({kind:0,created_at:Math.floor(Date.now()/1e3),tags:[],content:JSON.stringify(h)},u.secretKey),w=t.publish(r,k);return await Promise.any(w),k},publishClonedManifest:async({identity:u,sourceManifest:c,sourcePubkey:r,relays:h})=>{const k=Ne({sourceManifest:c,sourcePubkey:r,relays:h}),w=ye(k,u.secretKey),_=t.publish(h,w);return await Promise.any(_),w},TEMPLATE_MUSE_PUBKEY:_e}},Vt={key:0},Yt={class:"w-full max-w-xl rounded-2xl border border-violet-300/50 bg-[var(--surface)] p-6 shadow-2xl"},Wt={key:0,class:"mt-5 grid gap-2"},Gt={key:1,class:"mt-5 rounded-xl border border-violet-300/40 bg-violet-500/10 p-4"},Jt={key:0,class:"mt-4 rounded-lg border border-amber-300 bg-amber-50 p-3 text-sm text-amber-900"},Qt={class:"mt-3 text-xs"},Zt={class:"font-mono break-all"},Xt={class:"mt-1 text-xs"},es={class:"font-mono break-all"},ts={class:"mt-2 flex gap-2"},ss={class:"mt-3 flex items-center gap-2 text-xs"},os=["disabled"],ns={key:0,class:"mt-3 inline-flex items-center gap-2 rounded-full border border-violet-300/50 bg-violet-500/20 px-3 py-1 text-xs text-violet-100"},rs={key:2,class:"mt-5 rounded-xl border border-emerald-300/50 bg-emerald-500/10 p-4"},as={class:"mt-2 text-xs text-[var(--muted)]"},ls={class:"font-mono break-all"},is={class:"mt-1 text-xs text-[var(--muted)]"},ds=["href"],us={key:3,class:"mt-5 rounded-xl border border-violet-300/40 bg-violet-500/10 p-4"},cs=["disabled"],ms=["href"],ps={key:1,class:"mt-2 text-xs text-red-500"},fs={key:4,class:"mt-3 rounded-lg border border-red-300 bg-red-50 p-3 text-sm text-red-700"},hs={class:"mt-5 flex justify-end gap-2"},ve="/nostr-assets/nostr-ostrich-running.gif",bs={__name:"ShopNsiteCloneFab",props:{embedded:{type:Boolean,default:!1}},setup(t){const n=g(!1),a=g(""),m=g("choice"),f=g(""),y=g(null),u=g(!1),c=g(!1),r=g(""),h=g(""),k=g([]),w=g(!1),_=g(""),T=g(""),{debugState:j,setShopDebug:B}=qe(),{uniq:p,generateIdentity:v,resolveSourceNpub:R,fetchSourceManifest:E,publishProfile:o,publishClonedManifest:S}=Dt(),b=t,Q=()=>{m.value="choice",f.value="",y.value=null,u.value=!1,c.value=!1,r.value="",h.value="",k.value=[],w.value=!1,_.value="",T.value=""},ae=()=>{n.value=!1,Q()},le=()=>p([...j.value.merchantOutbox||[],...j.value.merchantInbox||[],...j.value.orderPublishRelays||[],...j.value.paymentListenRelays||[],"wss://relay.ditto.pub","wss://relay.damus.io","wss://relay.primal.net","wss://nos.lol"]),ie=async I=>{I&&await navigator.clipboard.writeText(I)},Ce=async()=>{m.value="existing",_.value=""},Pe=()=>{m.value="new",r.value=""},Ee=()=>{y.value=v(),u.value=!1,r.value="",console.log("[nsite-clone] newcomer keys generated",{npub:y.value.npub,pubkey:y.value.pubkey}),B({details:{cloneNewcomerGenerated:!0,cloneNewcomerNpub:y.value.npub}})},$e=async()=>{if(r.value="",!f.value.trim()){r.value="Please enter a display name.";return}if(!y.value){r.value="Please generate your keys first.";return}if(!u.value){r.value="Please confirm that you safely backed up your keys.";return}try{c.value=!0;const I=le(),l=R({hostname:window.location.hostname,fallbackNpub:j.value.merchantNpub});if(!l)throw new Error("Could not resolve source nsite npub for cloning.");const N=await E({sourceNpub:l,relays:I}),O=N.manifestRelays.length>0?N.manifestRelays:I;k.value=O;const K=await o({identity:y.value,name:f.value.trim(),relays:O}),q=await S({identity:y.value,sourceManifest:N.manifest,sourcePubkey:N.sourcePubkey,relays:O}),A=`https://${y.value.npub}.nsite.lol/`;h.value=A,console.log("[nsite-clone] newcomer clone published",{sourceNpub:l,publishRelays:O,profileEventId:K.id,cloneEventId:q.id,siteUrl:A}),B({details:{cloneNewcomerPublished:!0,cloneNewcomerProfileEventId:K.id,cloneNewcomerManifestEventId:q.id,cloneNewcomerSiteUrl:A}}),window.open(A,"_blank","noopener,noreferrer")||(r.value="Clone published, but your browser blocked opening the new site tab. Use the link below."),m.value="new-success"}catch(I){r.value=I.message||"Failed to publish profile and clone this nsite.",console.error("[nsite-clone] newcomer clone failed",I),B({details:{cloneNewcomerPublished:!1,cloneNewcomerError:r.value}})}finally{c.value=!1}},Me=async()=>{if(_.value="",!window.nostr?.getPublicKey||!window.nostr?.signEvent){_.value="No Nostr browser signer found. Please install a NIP-07 extension first.";return}try{w.value=!0;const I=le(),l=R({hostname:window.location.hostname,fallbackNpub:j.value.merchantNpub});if(!l)throw new Error("Could not resolve source nsite npub for cloning.");const N=await E({sourceNpub:l,relays:I}),O=N.manifestRelays.length>0?N.manifestRelays:I,K=await window.nostr.getPublicKey(),q=Ne({sourceManifest:N.manifest,sourcePubkey:N.sourcePubkey,relays:O}),A=await window.nostr.signEvent(q),{SimplePool:de}=await He(async()=>{const{SimplePool:Te}=await import("./D3n9Vtz8.js").then(Re=>Re.ao);return{SimplePool:Te}},__vite__mapDeps([0,1]),import.meta.url),ue=new de,Ie=ue.publish(O,A);await Promise.any(Ie),ue.close(O);const Z=`https://${we(K)}.nsite.lol/`;T.value=Z,B({details:{cloneExistingPublished:!0,cloneExistingManifestEventId:A.id,cloneExistingSiteUrl:Z}}),window.open(Z,"_blank","noopener,noreferrer")||(_.value="Clone published, but your browser blocked opening the new site tab. Use the link below.")}catch(I){_.value=I.message||"Failed to clone this nsite with your existing signer.",console.error("[nsite-clone] existing-user clone failed",I),B({details:{cloneExistingPublished:!1,cloneExistingError:_.value}})}finally{w.value=!1}};return ge(()=>{a.value=window.location.href,console.log("[nsite-clone] current deployment URL",a.value),B({details:{deploymentSource:a.value}})}),(I,l)=>(i(),d(H,null,[e("button",{class:fe(["inline-flex items-center justify-center border border-violet-300 bg-gradient-to-br from-violet-500 via-fuchsia-500 to-purple-700 text-white shadow-[0_12px_30px_rgba(168,85,247,0.45)] transition hover:scale-[1.02] hover:shadow-[0_16px_34px_rgba(168,85,247,0.6)]",b.embedded?"h-9 gap-1.5 rounded-full px-3 py-2 text-xs font-semibold":"fixed bottom-6 right-6 z-40 h-14 w-14 rounded-full"]),onClick:l[0]||(l[0]=N=>n.value=!0)},[l[6]||(l[6]=e("span",{class:"sr-only"},"Open Nostr clone dialog",-1)),e("img",{src:ve,alt:"",class:fe(b.embedded?"h-5 w-5 object-contain":"h-10 w-10 object-contain"),"aria-hidden":"true"},null,2),b.embedded?(i(),d("span",Vt,"Clone This Nsite")):P("",!0)],2),s(n)?(i(),d("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/55 px-4",onClick:xe(ae,["self"])},[e("div",Yt,[l[19]||(l[19]=se('Nostr Boutique logo

Congratulations you found something cool!

Did you know you can have your own sovereign shop like this?

If you knew this, congratulations, you're quite the nerd 🤓. If you didn’t, there is a short write-up on how this works at https://nostr.boutique/explain.

If you already have a key, you can clone by clicking I'm already on Nostr. If you are new, follow the I'm new here path and have your own store in under 15 seconds.

',6)),s(m)==="choice"?(i(),d("div",Wt,[e("button",{class:"rounded-lg border border-violet-300 bg-violet-600 px-4 py-2 text-sm font-semibold text-white",onClick:Pe}," I’m new here "),e("button",{class:"rounded-lg border border-[var(--line)] px-4 py-2 text-sm font-semibold",onClick:Ce}," I’m already on Nostr ")])):s(m)==="new"?(i(),d("div",Gt,[l[15]||(l[15]=e("label",{class:"text-xs font-semibold uppercase tracking-[0.1em] text-[var(--muted)]"},"Your display name",-1)),Y(e("input",{"onUpdate:modelValue":l[1]||(l[1]=N=>W(f)?f.value=N:null),type:"text",placeholder:"Sovereign Shop Owner",class:"mt-2 w-full rounded-lg border border-[var(--line)] bg-white/95 px-3 py-2 text-sm text-black"},null,512),[[oe,s(f)]]),e("button",{class:"mt-3 rounded-lg border border-violet-300 bg-violet-600 px-4 py-2 text-sm font-semibold text-white",onClick:Ee}," Generate my keys "),s(y)?(i(),d("div",Jt,[l[13]||(l[13]=e("p",{class:"font-semibold"},"Important: We do not store these keys.",-1)),l[14]||(l[14]=e("p",{class:"mt-1"},"If you lose them, you can’t access this site anymore. You can always create a new one.",-1)),e("p",Qt,[l[7]||(l[7]=e("span",{class:"font-semibold"},"npub:",-1)),l[8]||(l[8]=M()),e("span",Zt,x(s(y).npub),1)]),e("p",Xt,[l[9]||(l[9]=e("span",{class:"font-semibold"},"nsec:",-1)),l[10]||(l[10]=M()),e("span",es,x(s(y).nsec),1)]),e("div",ts,[e("button",{class:"rounded border border-amber-300 bg-white px-2 py-1 text-xs",onClick:l[2]||(l[2]=N=>ie(s(y).npub))},"Copy npub"),e("button",{class:"rounded border border-amber-300 bg-white px-2 py-1 text-xs",onClick:l[3]||(l[3]=N=>ie(s(y).nsec))},"Copy nsec")]),e("label",ss,[Y(e("input",{"onUpdate:modelValue":l[4]||(l[4]=N=>W(u)?u.value=N:null),type:"checkbox"},null,512),[[Fe,s(u)]]),l[11]||(l[11]=e("span",null,"I saved these keys securely.",-1))]),e("button",{class:"mt-3 rounded-lg border border-violet-300 bg-violet-700 px-4 py-2 text-sm font-semibold text-white disabled:cursor-not-allowed disabled:opacity-60",disabled:s(c),onClick:$e},x(s(c)?"Publishing and cloning...":"Publish profile and clone now"),9,os),s(c)?(i(),d("div",ns,[e("img",{src:ve,alt:"",class:"h-5 w-5 object-contain","aria-hidden":"true"}),l[12]||(l[12]=e("span",null,"Deploying and running on Nostr...",-1))])):P("",!0)])):P("",!0)])):s(m)==="new-success"?(i(),d("div",rs,[l[17]||(l[17]=e("p",{class:"font-semibold text-emerald-200"},"Your sovereign shop clone is live.",-1)),e("p",as,[l[16]||(l[16]=M("New npub: ",-1)),e("span",ls,x(s(y)?.npub),1)]),e("p",is,"Published relays: "+x(s(k).join(", ")),1),e("a",{href:s(h),target:"_blank",rel:"noopener noreferrer",class:"mt-3 inline-flex rounded-lg border border-emerald-300 bg-emerald-600 px-4 py-2 text-sm font-semibold text-white"}," Open my new Nsite ",8,ds)])):(i(),d("div",us,[e("button",{class:"rounded-lg border border-violet-300 bg-violet-500 px-4 py-2 text-sm font-semibold text-white",disabled:s(w),onClick:Me},x(s(w)?"Cloning with your signer...":"Clone this Nsite to my own Npub !"),9,cs),l[18]||(l[18]=e("p",{class:"mt-2 text-xs text-[var(--muted)]"}," This uses your Nostr browser signer and always publishes the clone as your root site with the template `muse` tag. ",-1)),s(T)?(i(),d("a",{key:0,href:s(T),target:"_blank",rel:"noopener noreferrer",class:"mt-3 inline-flex rounded-lg border border-emerald-300 bg-emerald-600 px-4 py-2 text-sm font-semibold text-white"}," Open my cloned Nsite ",8,ms)):P("",!0),s(_)?(i(),d("p",ps,x(s(_)),1)):P("",!0)])),s(r)?(i(),d("p",fs,x(s(r)),1)):P("",!0),e("div",hs,[s(m)!=="choice"?(i(),d("button",{key:0,class:"rounded-lg border border-[var(--line)] px-4 py-2 text-sm",onClick:l[5]||(l[5]=N=>m.value="choice")}," Back ")):P("",!0),e("button",{class:"rounded-lg border border-[var(--line)] px-4 py-2 text-sm",onClick:ae}," Close ")])])])):P("",!0)],64))}},ys={class:"mt-12 border-t border-[var(--line)] bg-[var(--surface)]/70"},vs={class:"mx-auto grid max-w-6xl gap-8 px-4 py-8 sm:px-6 lg:grid-cols-[1.5fr_0.7fr_0.9fr] lg:px-8"},gs={class:"mt-2 text-xl font-semibold tracking-tight"},xs=["href"],ws={class:"flex flex-col items-start justify-center gap-2 place-self-start sm:items-center sm:place-self-center"},ks={key:0,class:"inline-flex items-center","aria-label":"PayPal payment option"},_s={class:"mt-3 grid grid-cols-2 gap-x-6 gap-y-2 text-sm font-medium md:grid-cols-3"},Ss={class:"border-t border-[var(--line)]"},Ns={class:"mx-auto flex max-w-6xl flex-col gap-3 px-4 py-4 text-xs text-[var(--muted)] sm:px-6 md:flex-row md:items-center md:justify-between lg:px-8"},Cs={class:"md:ml-auto"},Rs={__name:"ShopFooter",props:{merchantProfile:{type:Object,default:null},merchantNpub:{type:String,default:""}},setup(t){const n=t,a=new Date().getFullYear(),m=L(()=>n.merchantProfile?.name||"Nostr Boutique"),f=L(()=>{const c=String(n.merchantProfile?.website||n.merchantProfile?.url||"").trim();return c?c.startsWith("http://")||c.startsWith("https://")?c:`https://${c}`:""}),y=L(()=>f.value?f.value.replace(/^https?:\/\//,""):""),u=L(()=>String(n.merchantProfile?.paypal||"").trim().length>0);return(c,r)=>{const h=ke;return i(),d("footer",ys,[e("div",vs,[e("div",null,[r[0]||(r[0]=e("p",{class:"text-xs font-semibold uppercase tracking-[0.18em] text-[var(--muted)]"},"Nostr Boutique",-1)),e("h2",gs,x(s(m)),1),s(f)?(i(),d("a",{key:0,href:s(f),target:"_blank",rel:"noopener noreferrer",class:"mt-3 inline-flex text-sm font-medium underline underline-offset-4 hover:text-[var(--text)]"},x(s(y)),9,xs)):P("",!0)]),e("div",ws,[r[2]||(r[2]=e("div",{class:"inline-flex items-center","aria-label":"Bitcoin payment option"},[e("img",{src:It,alt:"Pay with Bitcoin",class:"h-9 w-auto"})],-1)),s(u)?(i(),d("div",ks,[...r[1]||(r[1]=[e("img",{src:Tt,alt:"Pay with PayPal",class:"h-8 w-auto"},null,-1)])])):P("",!0)]),e("div",null,[r[8]||(r[8]=e("p",{class:"text-xs font-semibold uppercase tracking-[0.18em] text-[var(--muted)]"},"Browse",-1)),e("div",_s,[$(h,{to:"/"},{default:C(()=>[...r[3]||(r[3]=[M("Home",-1)])]),_:1}),$(h,{to:"/products"},{default:C(()=>[...r[4]||(r[4]=[M("Products",-1)])]),_:1}),$(h,{to:"/categories"},{default:C(()=>[...r[5]||(r[5]=[M("Categories",-1)])]),_:1}),$(h,{to:"/contact"},{default:C(()=>[...r[6]||(r[6]=[M("About",-1)])]),_:1}),$(h,{to:"/cart"},{default:C(()=>[...r[7]||(r[7]=[M("Cart",-1)])]),_:1})])])]),e("div",Ss,[e("div",Ns,[e("div",null,[e("p",null,x(s(a))+" "+x(s(m))+". Powered by Nostr.",1),r[9]||(r[9]=e("p",{class:"mt-1"},"Decentralized products, merchant-owned identity.",-1))]),e("div",Cs,[$(bs,{embedded:""})])])])])}}};export{Ts as S,Rs as _,zt as a,ye as f,Ut as g,Is as u};