1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Index-DAKNIKv_.js","assets/vendor-query-Bj-7OnbJ.js","assets/vendor-react-DcVf-oLJ.js","assets/sanitize-tn7CNXzH.js","assets/purify.es-0Z5D63Xw.js","assets/vendor-carousel-qpwewCM-.js","assets/arrow-left-Dg0GB9Mo.js","assets/useHomepageCategories-LMKDEInE.js","assets/award-CofNeVka.js","assets/badge-rzXCHLFa.js","assets/useProductReviews-xSSdf_X5.js","assets/FreeShippingBadge-Yu1d4v8C.js","assets/chevron-left-Cm6OeUWp.js","assets/ShopifyErrorDisplay-CzCv1N3G.js","assets/triangle-alert-BoV6UPh_.js","assets/shield-alert-CcCZJIO7.js","assets/SaleBadge-BnTReT4z.js","assets/useFeaturedProducts-CQbe4pE1.js","assets/SEO-DDU3icjP.js","assets/upload-C-8PYkGu.js","assets/palette-CgkhOGgq.js","assets/thumbs-up-CP8tHkY8.js","assets/BlogCarousel-Vs7Se-yn.js","assets/format-16WGXwq5.js","assets/book-open-CVx75NHh.js","assets/vendor-ui-core-ChP2Vyu2.js","assets/ShopifyProductDetail-SbOUpXGi.js","assets/prerender-olkpOvDf.js","assets/dialog-Bm3VTvwf.js","assets/zoom-in-DLZP2J43.js","assets/chevron-up-7aPHT5Cr.js","assets/checkbox-DN_505K0.js","assets/index-Bx3rpGUN.js","assets/calendar-CoNHpyLA.js","assets/info-BEDoyDyi.js","assets/relatedProducts-DRtz4vcf.js","assets/useCategoryBlogPosts-CR_qeppe.js","assets/eye-7UXGjwet.js","assets/breadcrumb-BjuWWM2X.js","assets/useAppSetting-C-DzZ4bl.js","assets/use-mobile-DZzChJ49.js","assets/useBlogPosts-DcqP7qwx.js","assets/label-CIXJBlDt.js","assets/vendor-forms-CqRl1x8K.js","assets/hcaptcha-BogfxOBS.js","assets/form-m3BB_SP3.js","assets/popover-C8Z_ov1m.js","assets/circle-check-big-BTkx2VzF.js","assets/ProductsPage-CSKUv3gD.js","assets/select-Cf2Vkv9m.js","assets/dollar-sign-Ca0fNU6F.js","assets/list-B2yRQYu2.js","assets/ClearancePage-D5_lA7g5.js","assets/percent-pjUXR5U1.js","assets/CategoryPage-DQ6dPJnl.js","assets/slider-DmcXS1ca.js","assets/accordion-BNVmqdsw.js","assets/useCategoryContent-D7wS6y14.js","assets/BlogRedirect-vsob5tRm.js","assets/PageRedirect-Br2_Xmpt.js","assets/AboutPage-BBHLe1QA.js","assets/users-CbD3LBwZ.js","assets/ContactPage-B-jTzxWS.js","assets/send-BGSwurMV.js","assets/FAQPage-Dm0KXewp.js","assets/ShippingPage-BsEH2-JR.js","assets/PolicyPage-Dul0QIce.js","assets/file-text-7pMlPFXT.js","assets/ReturnsPage-DNUtzBwo.js","assets/PrivacyPage-DiYLWbLP.js","assets/TermsPage-D5qsPBpv.js","assets/Auth-CDpum3PO.js","assets/card-DroCMvGO.js","assets/tabs-CYNkp5eZ.js","assets/ResetPassword-BL2uGidw.js","assets/AdminDashboard-iPsdHPMY.js","assets/DesignTemplatesManager-EczvyoFJ.js","assets/save-DzjroVPV.js","assets/alert-dialog-FiBhoDGm.js","assets/useBlogCategories-DifhVbxh.js","assets/BlogPostContent-B58F1wsI.js","assets/underline-BJ_LM0_7.js","assets/layers-CHmbSdA_.js","assets/alert-BkNEjoCA.js","assets/BlogPage-DofvzTkm.js","assets/BlogCard-T3yE08JZ.js","assets/BlogSidebar-Cc_65r0U.js","assets/BlogPostPage-CSYd5Nis.js","assets/BlogCategoryPage-D1s9gTGS.js","assets/OrderHistoryPage-CZsFbuKK.js","assets/NotFound-BkYbugnV.js","assets/DesignerPage-BsyAm4w6.js","assets/mockupCompositor-CfsltvaH.js","assets/DesignerPage-C86a4N-E.css","assets/DesignTemplateEditorPage-DkNH-psx.js","assets/ShopifyAdminOAuthStart-Dvjj6Q6H.js"])))=>i.map(i=>d[i]); 2var e,t,r,n=Object.defineProperty,s=(e,t,r)=>((e,t,r)=>t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);import{j as a,u as o,a as i,b as l,Q as c,c as d}from"./vendor-query-Bj-7OnbJ.js";import{a as u,g as h,r as p,R as f,v as m,L as g,u as y,c as v,B as w,d as b,e as x}from"./vendor-react-DcVf-oLJ.js";import{_,a as k,c as j,u as T,b as S,B as E,P as N,d as C,e as A,f as R,g as I,V as O,R as P,h as $,i as D,j as L,C as U,k as M,T as q,l as z,S as B,O as F,m as W,n as V,o as K,p as H,D as G,q as J,r as Y,s as X,t as Q,v as Z,A as ee,w as te,x as re,F as ne,y as se,z as ae,E as oe,G as ie,H as le}from"./vendor-ui-core-ChP2Vyu2.js";!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))t(e);new MutationObserver(e=>{for(const r of e)if("childList"===r.type)for(const e of r.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&t(e)}).observe(document,{childList:!0,subtree:!0})}function t(e){if(e.ep)return;e.ep=!0;const t=function(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?t.credentials="include":"anonymous"===e.crossOrigin?t.credentials="omit":t.credentials="same-origin",t}(e);fetch(e.href,t)}}();var ce=u;r=ce.createRoot,ce.hydrateRoot;var de="undefined"!=typeof Element,ue="function"==typeof Map,he="function"==typeof Set,pe="function"==typeof ArrayBuffer&&!!ArrayBuffer.isView;function fe(e,t){if(e===t)return!0;
2if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor!==t.constructor)return!1;var r,n,s,a;if(Array.isArray(e)){if((r=e.length)!=t.length)return!1;for(n=r;0!==n--;)if(!fe(e[n],t[n]))return!1;return!0}if(ue&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(a=e.entries();!(n=a.next()).done;)if(!t.has(n.value[0]))return!1;for(a=e.entries();!(n=a.next()).done;)if(!fe(n.value[1],t.get(n.value[0])))return!1;return!0}if(he&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(a=e.entries();!(n=a.next()).done;)if(!t.has(n.value[0]))return!1;return!0}if(pe&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if((r=e.length)!=t.length)return!1;for(n=r;0!==n--;)if(e[n]!==t[n])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&"function"==typeof e.valueOf&&"function"==typeof t.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&"function"==typeof e.toString&&"function"==typeof t.toString)return e.toString()===t.toString();if((r=(s=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(n=r;0!==n--;)if(!Object.prototype.hasOwnProperty.call(t,s[n]))return!1;if(de&&e instanceof Element)return!1;for(n=r;0!==n--;)if(("_owner"!==s[n]&&"__v"!==s[n]&&"__o"!==s[n]||!e.$$typeof)&&!fe(e[s[n]],t[s[n]]))return!1;return!0}return e!=e&&t!=t}const me=h(function(e,t){try{return fe(e,t)}catch(r){if((r.message||"").match(/stack|recursion/i))return!1;throw r}});const ge=h(function(e,t,r,n,s,a,o,i){if(!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[r,n,s,a,o,i],d=0;(l=new Error(t.replace(/%s/g,function(){return c[d++]}))).name="Invariant Violation"}throw l.framesToPop=1,l}});const ye=h(function(e,t,r,n){var s=r?r.call(n,e,t):void 0;if(void 0!==s)return!!s;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var a=Object.keys(e),o=Object.keys(t);if(a.length!==o.length)return!1;for(var i=Object.prototype.hasOwnProperty.bind(t),l=0;l<a.length;l++){var c=a[l];if(!i(c))return!1;var d=e[c],u=t[c];if(!1===(s=r?r.call(n,d,u,c):void 0)||void 0===s&&d!==u)return!1}return!0});var ve=(e=>(e.BASE="base",e.BODY="body",e.HEAD="head",e.HTML="html",e.LINK="link",e.META="meta",e.NOSCRIPT="noscript",e.SCRIPT="script",e.STYLE="style",e.TITLE="title",e.FRAGMENT="Symbol(react.fragment)",e))(ve||{}),we={rel:["amphtml","canonical","alternate"]},be={type:["application/ld+json"]},xe={charset:"",name:["generator","robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]},_e=Object.values(ve),ke={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},je=Object.entries(ke).reduce((e,[t,r])=>(e[r]=t,e),{}),Te="data-rh",Se="defaultTitle",Ee="defer",Ne="encodeSpecialCharacters",Ce="onChangeClientState",Ae="titleTemplate",Re="prioritizeSeoTags",Ie=(e,t)=>{for(let r=e.length-1;r>=0;r-=1){const n=e[r];if(Object.prototype.hasOwnProperty.call(n,t))return n[t]}return null},Oe=e=>{let t=Ie(e,"title");const r=Ie(e,Ae);if(Array.isArray(t)&&(t=t.join("")),r&&t)return r.replace(/%s/g,()=>t);const n=Ie(e,Se);return t||n||void 0},Pe=e=>Ie(e,Ce)||(()=>{}),$e=(e,t)=>t.filter(t=>void 0!==t[e]).map(t=>t[e]).reduce((e,t)=>({...e,...t}),{}),De=(e,t)=>t.filter(e=>void 0!==e.base).map(e=>e.base).reverse().reduce((t,r)=>{if(!t.length){const n=Object.keys(r);for(let s=0;s<n.length;s+=1){const a=n[s].toLowerCase();if(-1!==e.indexOf(a)&&r[a])return t.concat(r)}}return t},[]),Le=(e,t,r)=>{const n={};return r.filter(t=>!!Array.isArray(t[e])||(void 0!==t[e]&&(t[e],console&&console.warn),!1)).map(t=>t[e]).reverse().reduce((e,r)=>{const s={};r.filter(e=>{let r;const a=Object.keys(e);for(let n=0;n<a.length;n+=1){const s=a[n],o=s.toLowerCase();-1===t.indexOf(o)||"rel"===r&&"canonical"===e[r].toLowerCase()||"rel"===o&&"stylesheet"===e[o].toLowerCase()||(r=o),-1===t.indexOf(s)||"innerHTML"!==s&&"cssText"!==s&&"itemprop"!==s||(r=s)}if(!r||!e[r])return!1;const o=e[r].toLowerCase();return n[r]||(n[r]={}),s[r]||(s[r]={}),!n[r][o]&&(s[r][o]=!0,!0)}
2).reverse().forEach(t=>e.push(t));const a=Object.keys(s);for(let t=0;t<a.length;t+=1){const e=a[t],r={...n[e],...s[e]};n[e]=r}return e},[]).reverse()},Ue=(e,t)=>{if(Array.isArray(e)&&e.length)for(let r=0;r<e.length;r+=1){if(e[r][t])return!0}return!1},Me=e=>Array.isArray(e)?e.join(""):e,qe=(e,t)=>Array.isArray(e)?e.reduce((e,r)=>(((e,t)=>{const r=Object.keys(e);for(let n=0;n<r.length;n+=1)if(t[r[n]]&&t[r[n]].includes(e[r[n]]))return!0;return!1})(r,t)?e.priority.push(r):e.default.push(r),e),{priority:[],default:[]}):{default:e,priority:[]},ze=(e,t)=>({...e,[t]:void 0}),Be=["noscript","script","style"],Fe=(e,t=!0)=>!1===t?String(e):String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),We=e=>Object.keys(e).reduce((t,r)=>{const n=void 0!==e[r]?`${r}="${e[r]}"`:`${r}`;return t?`${t} ${n}`:n},""),Ve=(e,t={})=>Object.keys(e).reduce((t,r)=>(t[ke[r]||r]=e[r],t),t),Ke=(e,t)=>t.map((t,r)=>{const n={key:r,[Te]:!0};return Object.keys(t).forEach(e=>{const r=ke[e]||e;if("innerHTML"===r||"cssText"===r){const e=t.innerHTML||t.cssText;n.dangerouslySetInnerHTML={__html:e}}else n[r]=t[e]}),f.createElement(e,n)}),He=(e,t,r=!0)=>{switch(e){case"title":return{toComponent:()=>((e,t,r)=>{const n=Ve(r,{key:t,[Te]:!0});return[f.createElement("title",n,t)]})(0,t.title,t.titleAttributes),toString:()=>((e,t,r,n)=>{const s=We(r),a=Me(t);return s?`<${e} ${Te}="true" ${s}>${Fe(a,n)}</${e}>`:`<${e} ${Te}="true">${Fe(a,n)}</${e}>`})(e,t.title,t.titleAttributes,r)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>Ve(t),toString:()=>We(t)};default:return{toComponent:()=>Ke(e,t),toString:()=>((e,t,r=!0)=>t.reduce((t,n)=>{const s=n,a=Object.keys(s).filter(e=>!("innerHTML"===e||"cssText"===e)).reduce((e,t)=>{const n=void 0===s[t]?t:`${t}="${Fe(s[t],r)}"`;return e?`${e} ${n}`:n},""),o=s.innerHTML||s.cssText||"",i=-1===Be.indexOf(e);return`${t}<${e} ${Te}="true" ${a}${i?"/>":`>${o}</${e}>`}`},""))(e,t,r)}}},Ge=e=>{const{baseTag:t,bodyAttributes:r,encode:n=!0,htmlAttributes:s,noscriptTags:a,styleTags:o,title:i="",titleAttributes:l,prioritizeSeoTags:c}=e;let{linkTags:d,metaTags:u,scriptTags:h}=e,p={toComponent:()=>{},toString:()=>""};return c&&({priorityMethods:p,linkTags:d,metaTags:u,scriptTags:h}=(({metaTags:e,linkTags:t,scriptTags:r,encode:n})=>{const s=qe(e,xe),a=qe(t,we),o=qe(r,be);return{priorityMethods:{toComponent:()=>[...Ke("meta",s.priority),...Ke("link",a.priority),...Ke("script",o.priority)],toString:()=>`${He("meta",s.priority,n)} ${He("link",a.priority,n)} ${He("script",o.priority,n)}`},metaTags:s.default,linkTags:a.default,scriptTags:o.default}})(e)),{priority:p,base:He("base",t,n),bodyAttributes:He("bodyAttributes",r,n),htmlAttributes:He("htmlAttributes",s,n),link:He("link",d,n),meta:He("meta",u,n),noscript:He("noscript",a,n),script:He("script",h,n),style:He("style",o,n),title:He("title",{title:i,titleAttributes:l},n)}},Je=[],Ye=!("undefined"==typeof window||!window.document||!window.document.createElement),Xe=class{constructor(e,t){s(this,"instances",[]),s(this,"canUseDOM",Ye),s(this,"context"),s(this,"value",{setHelmet:e=>{this.context.helmet=e},helmetInstances:{get:()=>this.canUseDOM?Je:this.instances,add:e=>{(this.canUseDOM?Je:this.instances).push(e)},remove:e=>{const t=(this.canUseDOM?Je:this.instances).indexOf(e);(this.canUseDOM?Je:this.instances).splice(t,1)}}}),this.context=e,this.canUseDOM=t||!1,t||(e.helmet=Ge({baseTag:[],bodyAttributes:{},htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},Qe=f.createContext({}),Ze=(e=class extends p.Component{constructor(t){super(t),s(this,"helmetData"),this.helmetData=new Xe(this.props.context||{},e.canUseDOM)}render(){return f.createElement(Qe.Provider,{value:this.helmetData.value},this.props.children)}},s(e,"canUseDOM",Ye),e),et=(e,t)=>{const r=document.head||document.querySelector("head"),n=r.querySelectorAll(`${e}[${Te}]`),s=[].slice.call(n),a=[];let o;return t&&t.length&&t.forEach(t=>{const r=document.createElement(e);for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))if("innerHTML"===e)r.innerHTML=t.innerHTML;else if("cssText"===e)r.styleSheet?r.styleSheet.cssText=t.cssText:r.appendChild(document.createTextNode(t.cssText));else{const n=e,s=void 0===t[n]?"":t[n];r.setAttribute(e,s)}r.setAttribute(Te,"true"),s.some((e,t)=>(o=t,r.isEqualNode(e)))?s.splice(o,1):a.push(r)}
2),s.forEach(e=>{var t;return null==(t=e.parentNode)?void 0:t.removeChild(e)}),a.forEach(e=>r.appendChild(e)),{oldTags:s,newTags:a}},tt=(e,t)=>{const r=document.getElementsByTagName(e)[0];if(!r)return;const n=r.getAttribute(Te),s=n?n.split(","):[],a=[...s],o=Object.keys(t);for(const i of o){const e=t[i]||"";r.getAttribute(i)!==e&&r.setAttribute(i,e),-1===s.indexOf(i)&&s.push(i);const n=a.indexOf(i);-1!==n&&a.splice(n,1)}for(let i=a.length-1;i>=0;i-=1)r.removeAttribute(a[i]);s.length===a.length?r.removeAttribute(Te):r.getAttribute(Te)!==o.join(",")&&r.setAttribute(Te,o.join(","))},rt=(e,t)=>{const{baseTag:r,bodyAttributes:n,htmlAttributes:s,linkTags:a,metaTags:o,noscriptTags:i,onChangeClientState:l,scriptTags:c,styleTags:d,title:u,titleAttributes:h}=e;tt("body",n),tt("html",s),((e,t)=>{void 0!==e&&document.title!==e&&(document.title=Me(e)),tt("title",t)})(u,h);const p={baseTag:et("base",r),linkTags:et("link",a),metaTags:et("meta",o),noscriptTags:et("noscript",i),scriptTags:et("script",c),styleTags:et("style",d)},f={},m={};Object.keys(p).forEach(e=>{const{newTags:t,oldTags:r}=p[e];t.length&&(f[e]=t),r.length&&(m[e]=p[e].oldTags)}),t&&t(),l(e,f,m)},nt=null,st=e=>{nt&&cancelAnimationFrame(nt),e.defer?nt=requestAnimationFrame(()=>{rt(e,()=>{nt=null})}):(rt(e),nt=null)},at=class extends p.Component{constructor(){super(...arguments),s(this,"rendered",!1)}shouldComponentUpdate(e){return!ye(e,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){const{helmetInstances:e}=this.props.context;e.remove(this),this.emitChange()}emitChange(){const{helmetInstances:e,setHelmet:t}=this.props.context;let r=null;const n=(s=e.get().map(e=>{const t={...e.props};return delete t.context,t}),{baseTag:De(["href"],s),bodyAttributes:$e("bodyAttributes",s),defer:Ie(s,Ee),encode:Ie(s,Ne),htmlAttributes:$e("htmlAttributes",s),linkTags:Le("link",["rel","href"],s),metaTags:Le("meta",["name","charset","http-equiv","property","itemprop"],s),noscriptTags:Le("noscript",["innerHTML"],s),onChangeClientState:Pe(s),scriptTags:Le("script",["src","innerHTML"],s),styleTags:Le("style",["cssText"],s),title:Oe(s),titleAttributes:$e("titleAttributes",s),prioritizeSeoTags:Ue(s,Re)});var s;Ze.canUseDOM?st(n):Ge&&(r=Ge(n)),t(r)}init(){if(this.rendered)return;this.rendered=!0;const{helmetInstances:e}=this.props.context;e.add(this),this.emitChange()}render(){return this.init(),null}},ot=(t=class extends p.Component{shouldComponentUpdate(e){return!me(ze(this.props,"helmetData"),ze(e,"helmetData"))}mapNestedChildrenToProps(e,t){if(!t)return null;switch(e.type){case"script":case"noscript":return{innerHTML:t};case"style":return{cssText:t};default:throw new Error(`<${e.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`)}}flattenArrayTypeChildren(e,t,r,n){return{...t,[e.type]:[...t[e.type]||[],{...r,...this.mapNestedChildrenToProps(e,n)}]}}mapObjectTypeChildren(e,t,r,n){switch(e.type){case"title":return{...t,[e.type]:n,titleAttributes:{...r}};case"body":return{...t,bodyAttributes:{...r}};case"html":return{...t,htmlAttributes:{...r}};default:return{...t,[e.type]:{...r}}}}mapArrayTypeChildrenToProps(e,t){let r={...t};return Object.keys(e).forEach(t=>{r={...r,[t]:e[t]}}),r}warnOnInvalidChildren(e,t){return ge(_e.some(t=>e.type===t),"function"==typeof e.type?"You may be attempting to nest <Helmet> components within each other, which is not allowed. Refer to our API for more information.":`Only elements types ${_e.join(", ")} are allowed. Helmet does not support rendering <${e.type}> elements. Refer to our API for more information.`),ge(!t||"string"==typeof t||Array.isArray(t)&&!t.some(e=>"string"!=typeof e),`Helmet expects a string as a child of <${e.type}>. Did you forget to wrap your children in braces? ( <${e.type}>{\`\`}</${e.type}> ) Refer to our API for more information.`),!0}mapChildrenToProps(e,t){let r={};return f.Children.forEach(e,e=>{if(!e||!e.props)return;const{children:n,...s}=e.props,a=Object.keys(s).reduce((e,t)=>(e[je[t]||t]=s[t],e),{});let{type:o}=e;
2switch("symbol"==typeof o?o=o.toString():this.warnOnInvalidChildren(e,n),o){case"Symbol(react.fragment)":t=this.mapChildrenToProps(n,t);break;case"link":case"meta":case"noscript":case"script":case"style":r=this.flattenArrayTypeChildren(e,r,a,n);break;default:t=this.mapObjectTypeChildren(e,t,a,n)}}),this.mapArrayTypeChildrenToProps(r,t)}render(){const{children:e,...t}=this.props;let r={...t},{helmetData:n}=t;if(e&&(r=this.mapChildrenToProps(e,r)),n&&!(n instanceof Xe)){n=new Xe(n.context,!0),delete r.helmetData}return n?f.createElement(at,{...r,context:n.value}):f.createElement(Qe.Consumer,null,e=>f.createElement(at,{...r,context:e}))}},s(t,"defaultProps",{defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1}),t);const it="1790861222120",lt="app-version",ct="app-reloading",dt="app-version-migration-v1";class ut extends Error{constructor(e,t="FunctionsError",r){super(e),this.name=t,this.context=r}}class ht extends ut{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class pt extends ut{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class ft extends ut{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var mt,gt;(gt=mt||(mt={})).Any="any",gt.ApNortheast1="ap-northeast-1",gt.ApNortheast2="ap-northeast-2",gt.ApSouth1="ap-south-1",gt.ApSoutheast1="ap-southeast-1",gt.ApSoutheast2="ap-southeast-2",gt.CaCentral1="ca-central-1",gt.EuCentral1="eu-central-1",gt.EuWest1="eu-west-1",gt.EuWest2="eu-west-2",gt.EuWest3="eu-west-3",gt.SaEast1="sa-east-1",gt.UsEast1="us-east-1",gt.UsWest1="us-west-1",gt.UsWest2="us-west-2";class yt{constructor(e,{headers:t={},customFetch:r,region:n=mt.Any}={}){this.url=e,this.headers=t,this.region=n,this.fetch=(e=>e?(...t)=>e(...t):(...e)=>fetch(...e))(r)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return _(this,arguments,void 0,function*(e,t={}){var r;let n,s;try{const{headers:a,method:o,body:i,signal:l,timeout:c}=t;let d={},{region:u}=t;u||(u=this.region);const h=new URL(`${this.url}/${e}`);let p;u&&"any"!==u&&(d["x-region"]=u,h.searchParams.set("forceFunctionRegion",u)),i&&(a&&!Object.prototype.hasOwnProperty.call(a,"Content-Type")||!a)?"undefined"!=typeof Blob&&i instanceof Blob||i instanceof ArrayBuffer?(d["Content-Type"]="application/octet-stream",p=i):"string"==typeof i?(d["Content-Type"]="text/plain",p=i):"undefined"!=typeof FormData&&i instanceof FormData?p=i:(d["Content-Type"]="application/json",p=JSON.stringify(i)):p=i;let f=l;c&&(s=new AbortController,n=setTimeout(()=>s.abort(),c),l?(f=s.signal,l.addEventListener("abort",()=>s.abort())):f=s.signal);const m=yield this.fetch(h.toString(),{method:o||"POST",headers:Object.assign(Object.assign(Object.assign({},d),this.headers),a),body:p,signal:f}).catch(e=>{throw new ht(e)}),g=m.headers.get("x-relay-error");if(g&&"true"===g)throw new pt(m);if(!m.ok)throw new ft(m);let y,v=(null!==(r=m.headers.get("Content-Type"))&&void 0!==r?r:"text/plain").split(";")[0].trim();return y="application/json"===v?yield m.json():"application/octet-stream"===v||"application/pdf"===v?yield m.blob():"text/event-stream"===v?m:"multipart/form-data"===v?yield m.formData():yield m.text(),{data:y,error:null,response:m}}catch(a){return{data:null,error:a,response:a instanceof ft||a instanceof pt?a.context:void 0}}finally{n&&clearTimeout(n)}})}}var vt=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.co
vendor: 8,545 bytes, line 2
2de=e.code}},wt=class{constructor(e){var t,r;this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=null!==(t=e.shouldThrowOnError)&&void 0!==t&&t,this.signal=e.signal,this.isMaybeSingle=null!==(r=e.isMaybeSingle)&&void 0!==r&&r,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}then(e,t){var r=this;void 0===this.schema||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),"GET"!==this.method&&"HEAD"!==this.method&&this.headers.set("Content-Type","application/json");let n=(0,this.fetch)(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async e=>{let t=null,n=null,s=null,a=e.status,o=e.statusText;if(e.ok){var i,l;if("HEAD"!==r.method){var c;const t=await e.text();""===t||(n="text/csv"===r.headers.get("Accept")||r.headers.get("Accept")&&(null===(c=r.headers.get("Accept"))||void 0===c?void 0:c.includes("application/vnd.pgrst.plan+text"))?t:JSON.parse(t))}const d=null===(i=r.headers.get("Prefer"))||void 0===i?void 0:i.match(/count=(exact|planned|estimated)/),u=null===(l=e.headers.get("content-range"))||void 0===l?void 0:l.split("/");d&&u&&u.length>1&&(s=parseInt(u[1])),r.isMaybeSingle&&"GET"===r.method&&Array.isArray(n)&&(n.length>1?(t={code:"PGRST116",details:`Results contain ${n.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},n=null,s=null,a=406,o="Not Acceptable"):n=1===n.length?n[0]:null)}else{var d;const s=await e.text();try{t=JSON.parse(s),Array.isArray(t)&&404===e.status&&(n=[],t=null,a=200,o="OK")}catch(u){404===e.status&&""===s?(a=204,o="No Content"):t={message:s}}if(t&&r.isMaybeSingle&&(null==t||null===(d=t.details)||void 0===d?void 0:d.includes("0 rows"))&&(t=null,a=200,o="OK"),t&&r.shouldThrowOnError)throw new vt(t)}return{error:t,data:n,count:s,status:a,statusText:o}});return this.shouldThrowOnError||(n=n.catch(e=>{var t;let r="";const n=null==e?void 0:e.cause;if(n){var s,a,o,i;const t=null!==(s=null==n?void 0:n.message)&&void 0!==s?s:"",l=null!==(a=null==n?void 0:n.code)&&void 0!==a?a:"";r=`${null!==(o=null==e?void 0:e.name)&&void 0!==o?o:"FetchError"}: ${null==e?void 0:e.message}`,r+=`\n\nCaused by: ${null!==(i=null==n?void 0:n.name)&&void 0!==i?i:"Error"}: ${t}`,l&&(r+=` (${l})`),(null==n?void 0:n.stack)&&(r+=`\n${n.stack}`)}else{var l;r=null!==(l=null==e?void 0:e.stack)&&void 0!==l?l:""}return{error:{message:`${null!==(t=null==e?void 0:e.name)&&void 0!==t?t:"FetchError"}: ${null==e?void 0:e.message}`,details:r,hint:"",code:""},data:null,count:null,status:0,statusText:""}})),n.then(e,t)}returns(){return this}overrideTypes(){return this}},bt=class extends wt{select(e){let t=!1;const r=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!t?"":('"'===e&&(t=!t),e)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:r,foreignTable:n,referencedTable:s=n}={}){const a=s?`${s}.order`:"order",o=this.url.searchParams.get(a);return this.url.searchParams.set(a,`${o?`${o},`:""}${e}.${t?"asc":"desc"}${void 0===r?"":r?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:r=t}={}){const n=void 0===r?"limit":`${r}.limit`;return this.url.searchParams.set(n,`${e}`),this}range(e,t,{foreignTable:r,referencedTable:n=r}={}){const s=void 0===n?"offset":`${n}.offset`,a=void 0===n?"limit":`${n}.limit`;return this.url.searchParams.set(s,`${e}`),this.url.searchParams.set(a,""+(t-e+1)),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return"GET"===this.method?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:t=!1,settings:r=!1,buffers:n=!1,wal:s=!1,format:a="text"}={}){var o;const i=[e?"analyze":null,t?"verbose":null,r?"settings":null,n?"buffers":null,s?"wal":null].filter(Boolean).join("|"),l=null!==(o=this.headers.get("Accept"))&&void 0!==o?o:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${a}; for="${l}"; options=${i};`),this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};const xt=new RegExp("[,()]");var _t=class extends bt{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}regexMatch(e,t){return this.url.searchParams.append(e,`match.${t}`),this}regexIMatch(e,t){return this.url.searchParams.append(e,`imatch.${t}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}isDistinct(e,t){return this.url.searchParams.append(e,`isdistinct.${t}`),this}in(e,t){const r=Array.from(new Set(t)).map(e=>"string"==typeof e&&xt.test(e)?`"${e}"`:`${e}`).join(",");return this.url.searchParams.append(e,`in.(${r})`),this}notIn(e,t){const r=Array.from(new Set(t)).map(e=>"string"==typeof e&&xt.test(e)?`"${e}"`:`${e}`).join(",");return this.url.searchParams.append(e,`not.in.(${r})`),this}contains(e,t){return"string"==typeof t?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return"string"==typeof t?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return"string"==typeof t?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:r,type:n}={}){let s="";"plain"===n?s="pl":"phrase"===n?s="ph":"websearch"===n&&(s="w");const a=void 0===r?"":`(${r})`;return this.url.searchParams.append(e,`${s}fts${a}.${t}`),this}match(e){return Object.entries(e).forEach(([e,t])=>{this.url.searchParams.append(e,`eq.${t}`)}),this}not(e,t,r){return this.url.searchParams.append(e,`not.${t}.${r}`),this}or(e,{foreignTable:t,referencedTable:r=t}={}){const n=r?`${r}.or`:"or";return this.url.searchParams.append(n,`(${e})`),this}filter(e,t,r){return this.url.searchParams.append(e,`${t}.${r}`),this}},kt=class{constructor(e,{headers:t={},schema:r,fetch:n}){this.url=e,this.headers=new Headers(t),this.schema=r,this.fetch=n}select(e,t){const{head:r=!1,count:n}=null!=t?t:{},s=r?"HEAD":"GET";let a=!1;const o=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!a?"":('"'===e&&(a=!a),e)).join("");return this.url.searchParams.set("select",o),n&&this.headers.append("Prefer",`count=${n}`),new _t({method:s,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(e,{count:t,defaultToNull:r=!0}={}){var n;if(t&&this.headers.append("Prefer",`count=${t}`),r||this.headers.append("Prefer","missing=default"),Array.isArray(e)){const t=e.reduce((e,t)=>
2e.concat(Object.keys(t)),[]);if(t.length>0){const e=[...new Set(t)].map(e=>`"${e}"`);this.url.searchParams.set("columns",e.join(","))}}return new _t({method:"POST",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:null!==(n=this.fetch)&&void 0!==n?n:fetch})}upsert(e,{onConflict:t,ignoreDuplicates:r=!1,count:n,defaultToNull:s=!0}={}){var a;if(this.headers.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),void 0!==t&&this.url.searchParams.set("on_conflict",t),n&&this.headers.append("Prefer",`count=${n}`),s||this.headers.append("Prefer","missing=default"),Array.isArray(e)){const t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){const e=[...new Set(t)].map(e=>`"${e}"`);this.url.searchParams.set("columns",e.join(","))}}return new _t({method:"POST",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:null!==(a=this.fetch)&&void 0!==a?a:fetch})}update(e,{count:t}={}){var r;return t&&this.headers.append("Prefer",`count=${t}`),new _t({method:"PATCH",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:null!==(r=this.fetch)&&void 0!==r?r:fetch})}delete({count:e}={}){var t;return e&&this.headers.append("Prefer",`count=${e}`),new _t({method:"DELETE",url:this.url,headers:this.headers,schema:this.schema,fetch:null!==(t=this.fetch)&&void 0!==t?t:fetch})}},jt=class e{constructor(e,{headers:t={},schema:r,fetch:n}={}){this.url=e,this.headers=new Headers(t),this.schemaName=r,this.fetch=n}from(e){if(!e||"string"!=typeof e||""===e.trim())throw new Error("Invalid relation name: relation must be a non-empty string.");return new kt(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(t){return new e(this.url,{headers:this.headers,schema:t,fetch:this.fetch})}rpc(e,t={},{head:r=!1,get:n=!1,count:s}={}){var a;let o;const i=new URL(`${this.url}/rpc/${e}`);let l;r||n?(o=r?"HEAD":"GET",Object.entries(t).filter(([e,t])=>void 0!==t).map(([e,t])=>[e,Array.isArray(t)?`{${t.join(",")}}`:`${t}`]).forEach(([e,t])=>{i.searchParams.append(e,t)})):(o="POST",l=t);const c=new Headers(this.headers);return s&&c.set("Prefer",`count=${s}`),new _t({method:o,url:i,headers:c,schema:this.schemaName,body:l,fetch:null!==(a=this.fetch)&&void 0!==a?a:fetch})}};class Tt{constructor(){}static detectEnvironment(){var e;if("undefined"!=typeof WebSocket)return{type:"native",constructor:WebSocket};if("undefined"!=typeof globalThis&&void 0!==globalThis.WebSocket)return{type:"native",constructor:globalThis.WebSocket};if("undefined"!=typeof global&&void 0!==global.WebSocket)return{type:"native",constructor:global.WebSocket};if("undefined"!=typeof globalThis&&void 0!==globalThis.WebSocketPair&&void 0===globalThis.WebSocket)return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if("undefined"!=typeof globalThis&&globalThis.EdgeRuntime||"undefined"!=typeof navigator&&(null===(e=navigator.userAgent)||void 0===e?void 0:e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};if("undefined"!=typeof process){const e=process.versions;if(e&&e.node){const t=e.node,r=parseInt(t.replace(/^v/,"").split(".")[0]);return r>=22?void 0!==globalThis.WebSocket?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${r} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${r} detected without native WebSocket support.`,workaround:'For Node.js < 22, install "ws" package and provide it via the transport option:\nimport ws from "ws"\nnew RealtimeClient(url, { transport: ws })'}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const e=this.detectEnvironment();if(e.constructor)return e.constructor;let t=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(t+=`\n\nSuggested solution: ${e.workaround}`),new Error(t)}static createWebSocket(e,t){return new(this.getWebSocketConstructor())(e,t)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return"native"===e.type||"ws"===e.type}catch(e){return!1}}}const St="1.0.0",Et=St,Nt=1e4;var Ct,At,Rt,It,Ot,Pt,$t,Dt,Lt,Ut,Mt;(At=Ct||(Ct={}))[At.connecting=0]="connecting",At[At.open=1]="open",At[At.closing=2]="closing",At[At.closed=3]="closed",(It=Rt||(Rt={})).closed="closed",It.errored="errored",It.joined="joined",It.joining="joining",It.leaving="leaving",(Pt=Ot||(Ot={})).close="phx_close",Pt.error="phx_error",Pt.join="phx_join",Pt.reply="phx_reply",Pt.leave="phx_leave",Pt.access_token="access_token",($t||($t={})).websocket="websocket",(Lt=Dt||(Dt={})).Connecting="connecting",Lt.Open="open",Lt.Closing="closing",Lt.Closed="closed";class qt{constructor(e){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=null!=e?e:[]}encode(e,t){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&"string"==typeof e.payload.event)return t(this._binaryEncodeUserBroadcastPush(e));let r=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(r))}_binaryEncodeUserBroadcastPush(e){var t;return this._isArrayBuffer(null===(t=e.payload)||void 0===t?void 0:t.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var t,r;const n=null!==(r=null===(t=e.payload)||void 0===t?void 0:t.payload)&&void 0!==r?r:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,n)}_encodeJsonUserBroadcastPush(e){var t,r;const n=null!==(r=null===(t=e.payload)||void 0===t?void 0:t.payload)&&void 0!==r?r:{},s=(new TextEncoder).encode(JSON.stringify(n)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,s)}_encodeUserBroadcastPush(e,t,r){var n,s;const a=e.topic,o=null!==(n=e.ref)&&void 0!==n?n:"",i=null!==(s=e.join_ref)&&void 0!==s?s:"",l=e.payload.event,c=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},d=0===Object.keys(c).length?"":JSON.stringify(c);if(i.length>255)throw new Error(`joinRef length ${i.length} exceeds maximum of 255`);if(o.length>255)throw new Error(`ref length ${o.length} exceeds maximum of 255`);if(a.length>255)throw new Error(`topic length ${a.length} exceeds maximum of 255`);if(l.length>255)throw new Error(`userEvent length ${l.length} exceeds maximum of 255`);if(d.length>255)throw new Error(`metadata length ${d.length} exceeds maximum of 255`);const u=this.USER_BROADCAST_PUSH_META_LENGTH+i.length+o.length+a.length+l.length+d.length,h=new ArrayBuffer(this.HEADER_LENGTH+u);
vendor: 34,998 bytes, line 2
2let p=new DataView(h),f=0;p.setUint8(f++,this.KINDS.userBroadcastPush),p.setUint8(f++,i.length),p.setUint8(f++,o.length),p.setUint8(f++,a.length),p.setUint8(f++,l.length),p.setUint8(f++,d.length),p.setUint8(f++,t),Array.from(i,e=>p.setUint8(f++,e.charCodeAt(0))),Array.from(o,e=>p.setUint8(f++,e.charCodeAt(0))),Array.from(a,e=>p.setUint8(f++,e.charCodeAt(0))),Array.from(l,e=>p.setUint8(f++,e.charCodeAt(0))),Array.from(d,e=>p.setUint8(f++,e.charCodeAt(0)));var m=new Uint8Array(h.byteLength+r.byteLength);return m.set(new Uint8Array(h),0),m.set(new Uint8Array(r),h.byteLength),m.buffer}decode(e,t){if(this._isArrayBuffer(e)){return t(this._binaryDecode(e))}if("string"==typeof e){const r=JSON.parse(e),[n,s,a,o,i]=r;return t({join_ref:n,ref:s,topic:a,event:o,payload:i})}return t({})}_binaryDecode(e){const t=new DataView(e),r=t.getUint8(0),n=new TextDecoder;if(r===this.KINDS.userBroadcast)return this._decodeUserBroadcast(e,t,n)}_decodeUserBroadcast(e,t,r){const n=t.getUint8(1),s=t.getUint8(2),a=t.getUint8(3),o=t.getUint8(4);let i=this.HEADER_LENGTH+4;const l=r.decode(e.slice(i,i+n));i+=n;const c=r.decode(e.slice(i,i+s));i+=s;const d=r.decode(e.slice(i,i+a));i+=a;const u=e.slice(i,e.byteLength),h=o===this.JSON_ENCODING?JSON.parse(r.decode(u)):u,p={type:this.BROADCAST_EVENT,event:c,payload:h};return a>0&&(p.meta=JSON.parse(d)),{join_ref:null,ref:null,topic:l,event:this.BROADCAST_EVENT,payload:p}}_isArrayBuffer(e){var t;return e instanceof ArrayBuffer||"ArrayBuffer"===(null===(t=null==e?void 0:e.constructor)||void 0===t?void 0:t.name)}_pick(e,t){return e&&"object"==typeof e?Object.fromEntries(Object.entries(e).filter(([e])=>t.includes(e))):{}}}class zt{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=t}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}(Mt=Ut||(Ut={})).abstime="abstime",Mt.bool="bool",Mt.date="date",Mt.daterange="daterange",Mt.float4="float4",Mt.float8="float8",Mt.int2="int2",Mt.int4="int4",Mt.int4range="int4range",Mt.int8="int8",Mt.int8range="int8range",Mt.json="json",Mt.jsonb="jsonb",Mt.money="money",Mt.numeric="numeric",Mt.oid="oid",Mt.reltime="reltime",Mt.text="text",Mt.time="time",Mt.timestamp="timestamp",Mt.timestamptz="timestamptz",Mt.timetz="timetz",Mt.tsrange="tsrange",Mt.tstzrange="tstzrange";const Bt=(e,t,r={})=>{var n;const s=null!==(n=r.skipTypes)&&void 0!==n?n:[];return t?Object.keys(t).reduce((r,n)=>(r[n]=Ft(n,e,t,s),r),{}):{}},Ft=(e,t,r,n)=>{const s=t.find(t=>t.name===e),a=null==s?void 0:s.type,o=r[e];return a&&!n.includes(a)?Wt(a,o):Vt(o)},Wt=(e,t)=>{if("_"===e.charAt(0)){const r=e.slice(1,e.length);return Jt(t,r)}switch(e){case Ut.bool:return Kt(t);case Ut.float4:case Ut.float8:case Ut.int2:case Ut.int4:case Ut.int8:case Ut.numeric:case Ut.oid:return Ht(t);case Ut.json:case Ut.jsonb:return Gt(t);case Ut.timestamp:return Yt(t);case Ut.abstime:case Ut.date:case Ut.daterange:case Ut.int4range:case Ut.int8range:case Ut.money:case Ut.reltime:case Ut.text:case Ut.time:case Ut.timestamptz:case Ut.timetz:case Ut.tsrange:case Ut.tstzrange:default:return Vt(t)}},Vt=e=>e,Kt=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},Ht=e=>{if("string"==typeof e){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},Gt=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(t){return e}return e},Jt=(e,t)=>{if("string"!=typeof e)return e;const r=e.length-1,n=e[r];if("{"===e[0]&&"}"===n){let n;const a=e.slice(1,r);try{n=JSON.parse("["+a+"]")}catch(s){n=a?a.split(","):[]}return n.map(e=>Wt(t,e))}return e},Yt=e=>"string"==typeof e?e.replace(" ","T"):e,Xt=e=>{const t=new URL(e);return t.protocol=t.protocol.replace(/^ws/i,"http"),t.pathname=t.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),""===t.pathname||"/"===t.pathname?t.pathname="/api/broadcast":t.pathname=t.pathname+"/api/broadcast",t.href};class Qt{constructor(e,t,r={},n=1e4){this.channel=e,this.event=t,this.payload=r,this.timeout=n,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,t){var r;return this._hasReceived(e)&&t(null===(r=this.receivedResp)||void 0===r?void 0:r.response),this.recHooks.push({status:e,callback:t}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);this.channel._on(this.refEvent,{},e=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=e,this._matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,t){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:t})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:t}){this.recHooks.filter(t=>t.status===e).forEach(e=>e.callback(t))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}var Zt,er,tr,rr,nr,sr,ar,or;(er=Zt||(Zt={})).SYNC="sync",er.JOIN="join",er.LEAVE="leave";class ir{constructor(e,t){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const r=(null==t?void 0:t.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(r.state,{},e=>{const{onJoin:t,onLeave:r,onSync:n}=this.caller;this.joinRef=this.channel._joinRef(),this.state=ir.syncState(this.state,e,t,r),this.pendingDiffs.forEach(e=>{this.state=ir.syncDiff(this.state,e,t,r)}),this.pendingDiffs=[],n()}),this.channel._on(r.diff,{},e=>{const{onJoin:t,onLeave:r,onSync:n}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(e):(this.state=ir.syncDiff(this.state,e,t,r),n())}),this.onJoin((e,t,r)=>{this.channel._trigger("presence",{event:"join",key:e,currentPresences:t,newPresences:r})}),this.onLeave((e,t,r)=>{this.channel._trigger("presence",{event:"leave",key:e,currentPresences:t,leftPresences:r})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,t,r,n){const s=this.cloneDeep(e),a=this.transformState(t),o={},i={};return this.map(s,(e,t)=>{a[e]||(i[e]=t)}),this.map(a,(e,t)=>{const r=s[e];if(r){const n=t.map(e=>e.presence_ref),s=r.map(e=>e.presence_ref),a=t.filter(e=>s.indexOf(e.presence_ref)<0),l=r.filter(e=>n.indexOf(e.presence_ref)<0);a.length>0&&(o[e]=a),l.length>0&&(i[e]=l)}else o[e]=t}),this.syncDiff(s,{joins:o,leaves:i},r,n)}static syncDiff(e,t,r,n){const{joins:s,leaves:a}={joins:this.transformState(t.joins),leaves:this.transformState(t.leaves)};return r||(r=()=>{}),n||(n=()=>{}),this.map(s,(t,n)=>{var s;const a=null!==(s=e[t])&&void 0!==s?s:[];if(e[t]=this.cloneDeep(n),a.length>0){const r=e[t].map(e=>e.presence_ref),n=a.filter(e=>r.indexOf(e.presence_ref)<0);e[t].unshift(...n)}r(t,a,n)}),this.map(a,(t,r)=>{let s=e[t];if(!s)return;const a=r.map(e=>e.presence_ref);s=s.filter(e=>a.indexOf(e.presence_ref)<0),e[t]=s,n(t,s,r),0===s.length&&delete e[t]}),e}static map(e,t){return Object.getOwnPropertyNames(e).map(r=>t(r,e[r]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((t,r)=>{const n=e[r];return t[r]="metas"in n?n.metas.map(e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e)):n,t},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}(rr=tr||(tr={})).ALL="*",rr.INSERT="INSERT",rr.UPDATE="UPDATE",rr.DELETE="DELETE",(sr=nr||(nr={})).BROADCAST="broadcast",sr.PRESENCE="presence",sr.POSTGRES_CHANGES="postgres_changes",sr.SYSTEM="system",(or=ar||(ar={})).SUBSCRIBED="SUBSCRIBED",or.TIMED_OUT="TIMED_OUT",or.CLOSED="CLOSED",or.CHANNEL_ERROR="CHANNEL_ERROR";class lr{constructor(e,t={config:{}},r){var n,s;if(this.topic=e,this.params=t,this.socket=r,this.bindings={},this.state=Rt.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},t.config),this.timeout=this.socket.timeout,this.joinPush=new Qt(this,Ot.join,this.params,this.timeout),this.rejoinTimer=new zt(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=Rt.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(e=>e.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=Rt.closed,this.socket._remove(this)}),this._onError(e=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,e),this.state=Rt.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=Rt.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",e=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,e),this.state=Rt.errored,this.rejoinTimer.scheduleTimeout())}),this._on(Ot.reply,{},(e,t)=>{this._trigger(this._replyEventName(t),e)}),this.presence=new ir(this),this.broadcastEndpointURL=Xt(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(null===(s=null===(n=this.params.config)||void 0===n?void 0:n.broadcast)||void 0===s?void 0:s.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(e,t=this.timeout){var r,n,s;if(this.socket.isConnected()||this.socket.connect(),this.state==Rt.closed){const{config:{broadcast:a,presence:o,private:i}}=this.params,l=null!==(n=null===(r=this.bindings.postgres_changes)||void 0===r?void 0:r.map(e=>e.filter))&&void 0!==n?n:[],c=!!this.bindings[nr.PRESENCE]&&this.bindings[nr.PRESENCE].length>0||!0===(null===(s=this.params.config.presence)||void 0===s?void 0:s.enabled),d={},u={broadcast:a,presence:Object.assign(Object.assign({},o),{enabled:c}),postgres_changes:l,private:i};this.socket.accessTokenValue&&(d.access_token=this.socket.accessTokenValue),this._onError(t=>null==e?void 0:e(ar.CHANNEL_ERROR,t)),this._onClose(()=>null==e?void 0:e(ar.CLOSED)),this.updateJoinPayload(Object.assign({config:u},d)),this.joinedOnce=!0,this._rejoin(t),this.joinPush.receive("ok",async({postgres_changes:t})=>{var r;if(this.socket._isManualToken()||this.socket.setAuth(),void 0!==t){const n=this.bindings.postgres_changes,s=null!==(r=null==n?void 0:n.length)&&void 0!==r?r:0,a=[];for(let r=0;r<s;r++){const s=n[r],{filter:{event:o,schema:i,table:l,filter:c}}=s,d=t&&t[r];if(!(d&&d.event===o&&lr.isFilterValueEqual(d.schema,i)&&lr.isFilterValueEqual(d.table,l)&&lr.isFilterValueEqual(d.filter,c)))return this.unsubscribe(),this.state=Rt.errored,void(null==e||e(ar.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes")));a.push(Object.assign(Object.assign({},s),{id:d.id}))}return this.bindings.postgres_changes=a,void(e&&e(ar.SUBSCRIBED))}null==e||e(ar.SUBSCRIBED)}).receive("error",t=>{this.state=Rt.errored,null==e||e(ar.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(t).join(", ")||"error")))}).receive("timeout",()=>{null==e||e(ar.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,t={}){return await this.send({type:"presence",event:"track",payload:e},t.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,t,r){return this.state===Rt.joined&&e===nr.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(async()=>await this.subscribe())),this._on(e,t,r)}async httpSend(e,t,r={}){var n;if(null==t)return Promise.reject("Payload is required for httpSend()");const s={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(s.Authorization=`Bearer ${this.socket.accessTokenValue}`);const a={method:"POST",headers:s,body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:t,private:this.private}]})},o=await this._fetchWithTimeout(this.broadcastEndpointURL,a,null!==(n=r.timeout)&&void 0!==n?n:this.timeout);if(202===o.status)return{success:!0};let i=o.statusText;try{const e=await o.json();i=e.error||e.message||i}catch(l){}return Promise.reject(new Error(i))}async send(e,t={}){var r,n;if(this._canPush()||"broadcast"!==e.type)return new Promise(r=>{var n,s,a;const o=this._push(e.type,e,t.timeout||this.timeout);"broadcast"!==e.type||(null===(a=null===(s=null===(n=this.params)||void 0===n?void 0:n.config)||void 0===s?void 0:s.broadcast)||void 0===a?void 0:a.ack)||r("ok"),o.receive("ok",()=>r("ok")),o.receive("error",()=>r("error")),o.receive("timeout",()=>r("timed out"))});{const{event:a,payload:o}=e,i={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(i.Authorization=`Bearer ${this.socket.accessTokenValue}`);const l={method:"POST",headers:i,body:JSON.stringify({messages:[{topic:this.subTopic,event:a,payload:o,private:this.private}]})};try{const e=await this._fetchWithTimeout(this.broadcastEndpointURL,l,null!==(r=t.timeout)&&void 0!==r?r:this.timeout);return await(null===(n=e.body)||void 0===n?void 0:n.cancel()),e.ok?"ok":"error"}catch(s){return"AbortError"===s.name?"timed out":"error"}}}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=Rt.leaving;const t=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(Ot.close,"leave",this._joinRef())};this.joinPush.destroy();let r=null;return new Promise(n=>{r=new Qt(this,Ot.leave,{},e),r.receive("ok",()=>{t(),n("ok")}).receive("timeout",()=>{t(),n("timed out")}).receive("error",()=>{n("error")}),r.send(),this._canPush()||r.trigger("ok",{})}).finally(()=>{null==r||r.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Rt.closed,this.bindings={}}async _fetchWithTimeout(e,t,r){const n=new AbortController,s=setTimeout(()=>n.abort(),r),a=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:n.signal}));return clearTimeout(s),a}_push(e,t,r=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let n=new Qt(this,e,t,r);return this._canPush()?n.send():this._addToPushBuffer(n),n}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>100){const e=this.pushBuffer.shift();e&&(e.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${e.event}`,e.payload))}}_onMessage(e,t,r){return t}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,t,r){var n,s;const a=e.toLocaleLowerCase(),{close:o,error:i,leave:l,join:c}=Ot;if(r&&[o,i,l,c].indexOf(a)>=0&&r!==this._joinRef())return;let d=this._onMessage(a,t,r);if(t&&!d)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(a)?null===(n=this.bindings.postgres_changes)||void 0===n||n.filter(e=>{var t,r,n;return"*"===(null===(t=e.filter)||void 0===t?void 0:t.event)||(null===(n=null===(r=e.filter)||void 0===r?void 0:r.event)||void 0===n?void 0:n.toLocaleLowerCase())===a}).map(e=>e.callback(d,r)):null===(s=this.bindings[a])||void 0===s||s.filter(e=>{var r,n,s,o,i,l;if(["broadcast","presence","postgres_changes"].includes(a)){if("id"in e){const a=e.id,o=null===(r=e.filter)||void 0===r?void 0:r.event;return a&&(null===(n=t.ids)||void 0===n?void 0:n.includes(a))&&("*"===o||(null==o?void 0:o.toLocaleLowerCase())===(null===(s=t.data)||void 0===s?void 0:s.type.toLocaleLowerCase()))}{const r=null===(i=null===(o=null==e?void 0:e.filter)||void 0===o?void 0:o.event)||void 0===i?void 0:i.toLocaleLowerCase();return"*"===r||r===(null===(l=null==t?void 0:t.event)||void 0===l?void 0:l.toLocaleLowerCase())}}return e.type.toLocaleLowerCase()===a}).map(e=>{if("object"==typeof d&&"ids"in d){const e=d.data,{schema:t,table:r,commit_timestamp:n,type:s,errors:a}=e,o={schema:t,table:r,commit_timestamp:n,eventType:s,new:{},old:{},errors:a};d=Object.assign(Object.assign({},o),this._getPayloadRecords(e))}e.callback(d,r)})}_isClosed(){return this.state===Rt.closed}_isJoined(){return this.state===Rt.joined}_isJoining(){return this.state===Rt.joining}_isLeaving(){return this.state===Rt.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,t,r){const n=e.toLocaleLowerCase(),s={type:n,filter:t,callback:r};return this.bindings[n]?this.bindings[n].push(s):this.bindings[n]=[s],this}_off(e,t){const r=e.toLocaleLowerCase();return this.bindings[r]&&(this.bindings[r]=this.bindings[r].filter(e=>{var n;return!((null===(n=e.type)||void 0===n?void 0:n.toLocaleLowerCase())===r&&lr.isEqual(e.filter,t))})),this}static isEqual(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}static isFilterValueEqual(e,t){return(null!=e?e:void 0)===(null!=t?t:void 0)}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(Ot.close,{},e)}_onError(e){this._on(Ot.error,{},t=>e(t))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=Rt.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const t={new:{},old:{}};return"INSERT"!==e.type&&"UPDATE"!==e.type||(t.new=Bt(e.columns,e.record)),"UPDATE"!==e.type&&"DELETE"!==e.type||(t.old=Bt(e.columns,e.old_record)),t}}const cr=()=>{},dr=25e3,ur=10,hr=100,pr=[1e3,2e3,5e3,1e4];class fr{constructor(e,t){var r;if(this.accessTokenValue=null,this.apiKey=null,this._manuallySetToken=!1,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=Nt,this.transport=null,this.heartbeatIntervalMs=dr,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=cr,this.ref=0,this.reconnectTimer=null,this.vsn=Et,this.logger=cr,this.conn=null,this.sendBuffer=[],this.serializer=new qt,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._resolveFetch=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),!(null===(r=null==t?void 0:t.params)||void 0===r?void 0:r.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=t.params.apikey,this.endPoint=`${e}/${$t.websocket}`,this.httpEndpoint=Xt(e),this._initializeOptions(t),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(null==t?void 0:t.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||null!==this.conn&&this.isConnected())){if(this._setConnectionState("connecting"),this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=Tt.createWebSocket(this.endpointURL())}catch(e){this._setConnectionState("disconnected");const t=e.message;if(t.includes("Node.js"))throw new Error(`${t}\n\nTo use Realtime in Node.js, you need to provide a WebSocket implementation:\n\nOption 1: Use Node.js 22+ which has native WebSocket support\nOption 2: Install and provide the "ws" package:\n\n npm install ws\n\n import ws from "ws"\n const client = new RealtimeClient(url, {\n ...options,\n transport: ws\n })`);throw new Error(`WebSocket not available: ${t}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:this.vsn}))}disconnect(e,t){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const r=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(r),this._setConnectionState("disconnected")},"function"==typeof this.conn.close&&(e?this.conn.close(e,null!=t?t:""):this.conn.close()),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){const t=await e.unsubscribe();return 0===this.channels.length&&this.disconnect(),t}async removeAllChannels(){const e=await Promise.all(this.channels.map(e=>e.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,t,r){this.logger(e,t,r)}connectionState(){switch(this.conn&&this.conn.readyState){case Ct.connecting:return Dt.Connecting;case Ct.open:return Dt.Open;case Ct.closing:return Dt.Closing;default:return Dt.Closed}}isConnected(){return this.connectionState()===Dt.Open}isConnecting(){return"connecting"===this._connectionState}isDisconnecting(){return"disconnecting"===this._connectionState}channel(e,t={config:{}}){const r=`realtime:${e}`,n=this.getChannels().find(e=>e.topic===r);if(n)return n;{const r=new lr(`realtime:${e}`,t,this);return this.channels.push(r),r}}push(e){const{topic:t,event:r,payload:n,ref:s}=e,a=()=>{this.encode(e,e=>{var t;null===(t=this.conn)||void 0===t||t.send(e)})};this.log("push",`${t} ${r} (${s})`,n),this.isConnected()?a():this.sendBuffer.push(a)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){var e;if(this.isConnected()){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(t){this.log("error","error in heartbeat callback",t)}return this._wasManualDisconnect=!1,null===(e=this.conn)||void 0===e||e.close(1e3,"heartbeat timeout"),void setTimeout(()=>{var e;this.isConnected()||null===(e=this.reconnectTimer)||void 0===e||e.scheduleTimeout()},hr)}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(t){this.log("error","error in heartbeat callback",t)}this._setAuthSafely("heartbeat")}else try{this.heartbeatCallback("disconnected")}catch(t){this.log("error","error in heartbeat callback",t)}}onHeartbeat(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let t=this.channels.find(t=>t.topic===e&&(t._isJoined()||t._isJoining()));t&&(this.log("transport",`leaving duplicate topic "${e}"`),t.unsubscribe())}_remove(e){this.channels=this.channels.filter(t=>t.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,e=>{if("phoenix"===e.topic&&"phx_reply"===e.event)try{this.heartbeatCallback("ok"===e.payload.status?"ok":"error")}catch(i){this.log("error","error in heartbeat callback",i)}e.ref&&e.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);const{topic:t,event:r,payload:n,ref:s}=e,a=s?`(${s})`:"",o=n.status||"";this.log("receive",`${o} ${t} ${r} ${a}`.trim(),n),this.channels.filter(e=>e._isMember(t)).forEach(e=>e._trigger(r,n,s)),this._triggerStateCallbacks("message",e)})}_clearTimer(e){var t;"heartbeat"===e&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):"reconnect"===e&&(null===(t=this.reconnectTimer)||void 0===t||t.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e),this.conn.readyState===Ct.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===Ct.open||this.conn.readyState===Ct.connecting)try{this.conn.close()}catch(e){this.log("error","Error closing connection",e)}this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null}this._clearAllTimers(),this._terminateWorker(),this.channels.forEach(e=>e.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`);(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).then(()=>{this.flushSendBuffer()}).catch(e=>{this.log("error","error waiting for auth on connect",e),this.flushSendBuffer()}),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=e=>{this.log("worker","worker error",e.message),this._terminateWorker()},this.workerRef.onmessage=e=>{"keepAlive"===e.data.event&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_onConnClose(e){var t;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||null===(t=this.reconnectTimer)||void 0===t||t.scheduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e)}_triggerChanError(){this.channels.forEach(e=>e._trigger(Ot.error))}_appendParams(e,t){if(0===Object.keys(t).length)return e;const r=e.match(/\?/)?"&":"?";return`${e}${r}${new URLSearchParams(t)}`}_workerObjectUrl(e){let t;if(e)t=e;else{const e=new Blob(['\n addEventListener("message", (e) => {\n if (e.data.event === "start") {\n setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);\n }\n });'],{type:"application/javascript"});t=URL.createObjectURL(e)}return t}_setConnectionState(e,t=!1){this._connectionState=e,"connecting"===e?this._wasManualDisconnect=!1:"disconnecting"===e&&(this._wasManualDisconnect=t)}async _performAuth(e=null){let t,r=!1;if(e)t=e,r=!0;else if(this.accessToken)try{t=await this.accessToken()}catch(n){this.log("error","Error fetching access token from callback",n),t=this.accessTokenValue}else t=this.accessTokenValue;r?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=t&&(this.accessTokenValue=t,this.channels.forEach(e=>{const r={access_token:t,version:"realtime-js/2.89.0"};t&&e.updateJoinPayload(r),e.joinedOnce&&e._isJoined()&&e._push(Ot.access_token,{access_token:t})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(t=>{this.log("error",`Error setting auth in ${e}`,t)})}_triggerStateCallbacks(e,t){try{this.stateChangeCallbacks[e].forEach(r=>{try{r(t)}catch(n){this.log("error",`error in ${e} callback`,n)}})}catch(r){this.log("error",`error triggering ${e} callbacks`,r)}}_setupReconnectionTimer(){this.reconnectTimer=new zt(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},ur)},this.reconnectAfterMs)}_initializeOptions(e){var t,r,n,s,a,o,i,l,c,d,u,h;switch(this.transport=null!==(t=null==e?void 0:e.transport)&&void 0!==t?t:null,this.timeout=null!==(r=null==e?void 0:e.timeout)&&void 0!==r?r:Nt,this.heartbeatIntervalMs=null!==(n=null==e?void 0:e.heartbeatIntervalMs)&&void 0!==n?n:dr,this.worker=null!==(s=null==e?void 0:e.worker)&&void 0!==s&&s,this.accessToken=null!==(a=null==e?void 0:e.accessToken)&&void 0!==a?a:null,this.heartbeatCallback=null!==(o=null==e?void 0:e.heartbeatCallback)&&void 0!==o?o:cr,this.vsn=null!==(i=null==e?void 0:e.vsn)&&void 0!==i?i:Et,(null==e?void 0:e.params)&&(this.params=e.params),(null==e?void 0:e.logger)&&(this.logger=e.logger),((null==e?void 0:e.logLevel)||(null==e?void 0:e.log_level))&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=null!==(l=null==e?void 0:e.reconnectAfterMs)&&void 0!==l?l:e=>pr[e-1]||1e4,this.vsn){case St:this.encode=null!==(c=null==e?void 0:e.encode)&&void 0!==c?c:(e,t)=>t(JSON.stringify(e)),this.decode=null!==(d=null==e?void 0:e.decode)&&void 0!==d?d:(e,t)=>t(JSON.parse(e));break;case"2.0.0":this.encode=null!==(u=null==e?void 0:e.encode)&&void 0!==u?u:this.serializer.encode.bind(this.serializer),this.decode=null!==(h=null==e?void 0:e.decode)&&void 0!==h?h:this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${this.vsn}`)}if(this.worker){if("undefined"!=typeof window&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=null==e?void 0:e.workerUrl}}}var mr=class extends Error{constructor(e,t){var r;super(e),this.name="IcebergError",this.status=t.status,this.icebergType=t.icebergType,this.icebergCode=t.icebergCode,this.details=t.details,this.isCommitStateUnknown="CommitStateUnknownException"===t.icebergType||[500,502,504].includes(t.status)&&!0===(null==(r=t.icebergType)?void 0:r.includes("CommitState"))}isNotFound(){return 404===this.status}isConflict(){return 409===this.status}isAuthenticationTimeout(){return 419===this.status}};function gr(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:r,path:n,query:s,body:a,headers:o}){const i=function(e,t,r){const n=new URL(t,e);if(r)for(const[s,a]of Object.entries(r))void 0!==a&&n.searchParams.set(s,a);return n.toString()}(e.baseUrl,n,s),l=await async function(e){return e&&"none"!==e.type?"bearer"===e.type?{Authorization:`Bearer ${e.token}`}:"header"===e.type?{[e.name]:e.value}:"custom"===e.type?await e.getHeaders():{}:{}}(e.auth),c=await t(i,{method:r,headers:{...a?{"Content-Type":"application/json"}:{},...l,...o},body:a?JSON.stringify(a):void 0}),d=await c.text(),u=(c.headers.get("content-type")||"").includes("application/json"),h=u&&d?JSON.parse(d):d;if(!c.ok){const e=u?h:void 0,t=null==e?void 0:e.error;throw new mr((null==t?void 0:t.message)??`Request failed with status ${c.status}`,{status:c.status,icebergType:null==t?void 0:t.type,icebergCode:null==t?void 0:t.code,details:e})}return{status:c.status,headers:c.headers,data:h}}}}function yr(e){return e.join("�")}var vr=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){const t=e?{parent:yr(e.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:t})).data.namespaces.map(e=>({namespace:e}))}async createNamespace(e,t){const r={namespace:e.namespace,properties:null==t?void 0:t.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${yr(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${yr(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${yr(e.namespace)}`}),!0}catch(t){if(t instanceof mr&&404===t.status)return!1;throw t}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(r){if(r instanceof mr&&409===r.status)return;throw r}}};function wr(e){return e.join("�")}var br=class{constructor(e,t="",r){this.client=e,this.prefix=t,this.accessDelegation=r}async listTables(e){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${wr(e.namespace)}/tables`})).data.identifiers}async createTable(e,t){const r={};this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation);return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${wr(e.namespace)}/tables`,body:t,headers:r})).data.metadata}async updateTable(e,t){const r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${wr(e.namespace)}/tables/${e.name}`,body:t});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(e,t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${wr(e.namespace)}/tables/${e.name}`,query:{purgeRequested:String((null==t?void 0:t.purge)??!1)}})}async loadTable(e){const t={};this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation);return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${wr(e.namespace)}/tables/${e.name}`,headers:t})).data.metadata}async tableExists(e){const t={};this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${wr(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(r){if(r instanceof mr&&404===r.status)return!1;throw r}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(r){if(r instanceof mr&&409===r.status)return await this.loadTable({namespace:e.namespace,name:t.name});throw r}}},xr=class{constructor(e){var t;let r="v1";e.catalogName&&(r+=`/${e.catalogName}`);const n=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=gr({baseUrl:n,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=null==(t=e.accessDelegation)?void 0:t.join(","),this.namespaceOps=new vr(this.client,r),this.tableOps=new br(this.client,r,this.accessDelegation)}async listNamespaces(e){return this.namespaceOps.listNamespaces(e)}async createNamespace(e,t){return this.namespaceOps.createNamespace(e,t)}async dropNamespace(e){await this.namespaceOps.dropNamespace(e)}async loadNamespaceMetadata(e){return this.namespaceOps.loadNamespaceMetadata(e)}async listTables(e){return this.tableOps.listTables(e)}
2async createTable(e,t){return this.tableOps.createTable(e,t)}async updateTable(e,t){return this.tableOps.updateTable(e,t)}async dropTable(e,t){await this.tableOps.dropTable(e,t)}async loadTable(e){return this.tableOps.loadTable(e)}async namespaceExists(e){return this.namespaceOps.namespaceExists(e)}async tableExists(e){return this.tableOps.tableExists(e)}async createNamespaceIfNotExists(e,t){return this.namespaceOps.createNamespaceIfNotExists(e,t)}async createTableIfNotExists(e,t){return this.tableOps.createTableIfNotExists(e,t)}},_r=class extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}};function kr(e){return"object"==typeof e&&null!==e&&"__isStorageError"in e}var jr=class extends _r{constructor(e,t,r){super(e),this.name="StorageApiError",this.status=t,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},Tr=class extends _r{constructor(e,t){super(e),this.name="StorageUnknownError",this.originalError=t}};const Sr=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),Er=e=>{if(Array.isArray(e))return e.map(e=>Er(e));if("function"==typeof e||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([e,r])=>{const n=e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(/[-_]/g,""));t[n]=Er(r)}),t};function Nr(e){return(Nr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Cr(e){var t=function(e,t){if("object"!=Nr(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!=Nr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Nr(t)?t:t+""}function Ar(e,t,r){return(t=Cr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Rr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Ir(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Rr(Object(r),!0).forEach(function(t){Ar(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Rr(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}const Or=e=>{var t;return e.msg||e.message||e.error_description||("string"==typeof e.error?e.error:null===(t=e.error)||void 0===t?void 0:t.message)||JSON.stringify(e)},Pr=async(e,t,r)=>{e instanceof await Response&&!(null==r?void 0:r.noResolveJson)?e.json().then(r=>{const n=e.status||500,s=(null==r?void 0:r.statusCode)||n+"";t(new jr(Or(r),n,s))}).catch(e=>{t(new Tr(Or(e),e))}):t(new Tr(Or(e),e))},$r=(e,t,r,n)=>{const s={method:e,headers:(null==t?void 0:t.headers)||{}};return"GET"!==e&&n?((e=>{if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)})(n)?(s.headers=Ir({"Content-Type":"application/json"},null==t?void 0:t.headers),s.body=JSON.stringify(n)):s.body=n,(null==t?void 0:t.duplex)&&(s.duplex=t.duplex),Ir(Ir({},s),r)):s};async function Dr(e,t,r,n,s,a){return new Promise((o,i)=>{e(r,$r(t,n,s,a)).then(e=>{if(!e.ok)throw e;return(null==n?void 0:n.noResolveJson)?e:e.json()}).then(e=>o(e)).catch(e=>Pr(e,i,n))})}async function Lr(e,t,r,n){return Dr(e,"GET",t,r,n)}async function Ur(e,t,r,n,s){return Dr(e,"POST",t,n,s,r)}async function Mr(e,t,r,n,s){return Dr(e,"PUT",t,n,s,r)}async function qr(e,t,r,n,s){return Dr(e,"DELETE",t,n,s,r)}var zr=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t}then(e,t){return this.execute().then(e,t)}async execute(){try{return{data:(await this.downloadFn()).body,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(kr(e))return{data:null,error:e};throw e}}};let Br;Br=Symbol.toStringTag;var Fr=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[Br]="BlobDownloadBuilder",this.promise=null}asStream(){return new zr(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){try{return{data:await(await this.downloadFn()).blob(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(kr(e))return{data:null,error:e};throw e}}};const Wr={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Vr={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var Kr=class{constructor(e,t={},r,n){this.shouldThrowOnError=!1,this.url=e,this.headers=t,this.bucketId=r,this.fetch=Sr(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async uploadOrUpdate(e,t,r,n){var s=this;try{let a;const o=Ir(Ir({},Vr),n);let i=Ir(Ir({},s.headers),"POST"===e&&{"x-upsert":String(o.upsert)});const l=o.metadata;"undefined"!=typeof Blob&&r instanceof Blob?(a=new FormData,a.append("cacheControl",o.cacheControl),l&&a.append("metadata",s.encodeMetadata(l)),a.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?(a=r,a.has("cacheControl")||a.append("cacheControl",o.cacheControl),l&&!a.has("metadata")&&a.append("metadata",s.encodeMetadata(l))):(a=r,i["cache-control"]=`max-age=${o.cacheControl}`,i["content-type"]=o.contentType,l&&(i["x-metadata"]=s.toBase64(s.encodeMetadata(l))),("undefined"!=typeof ReadableStream&&a instanceof ReadableStream||a&&"object"==typeof a&&"pipe"in a&&"function"==typeof a.pipe)&&!o.duplex&&(o.duplex="half")),(null==n?void 0:n.headers)&&(i=Ir(Ir({},i),n.headers));const c=s._removeEmptyFolders(t),d=s._getFinalPath(c),u=await("PUT"==e?Mr:Ur)(s.fetch,`${s.url}/object/${d}`,a,Ir({headers:i},(null==o?void 0:o.duplex)?{duplex:o.duplex}:{}));return{data:{path:c,id:u.Id,fullPath:u.Key},error:null}}catch(a){if(s.shouldThrowOnError)throw a;if(kr(a))return{data:null,error:a};throw a}}async upload(e,t,r){return this.uploadOrUpdate("POST",e,t,r)}async uploadToSignedUrl(e,t,r,n){var s=this;const a=s._removeEmptyFolders(e),o=s._getFinalPath(a),i=new URL(s.url+`/object/upload/sign/${o}`);i.searchParams.set("token",t);try{let e;const t=Ir({upsert:Vr.upsert},n),o=Ir(Ir({},s.headers),{"x-upsert":String(t.upsert)});return"undefined"!=typeof Blob&&r instanceof Blob?(e=new FormData,e.append("cacheControl",t.cacheControl),e.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?(e=r,e.append("cacheControl",t.cacheControl)):(e=r,o["cache-control"]=`max-age=${t.cacheControl}`,o["content-type"]=t.contentType),{data:{path:a,fullPath:(await Mr(s.fetch,i.toString(),e,{headers:o})).Key},error:null}}catch(l){if(s.shouldThrowOnError)throw l;if(kr(l))return{data:null,error:l};throw l}}async createSignedUploadUrl(e,t){var r=this;try{let n=r._getFinalPath(e);const s=Ir({},r.headers);(null==t?void 0:t.upsert)&&(s["x-upsert"]="true");const a=await Ur(r.fetch,`${r.url}/object/upload/sign/${n}`,{},{headers:s}),o=new URL(r.url+a.url),i=o.searchParams.get("token");if(!i)throw new _r("No token returned by API");return{data:{signedUrl:o.toString(),path:e,token:i},error:null}}catch(n){if(r.shouldThrowOnError)throw n;if(kr(n))return{data:null,error:n};throw n}}async update(e,t,r){return this.uploadOrUpdate("PUT",e,t,r)}async move(e,t,r){var n=this;try{return{data:await Ur(n.fetch,`${n.url}/object/move`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,de
2stinationBucket:null==r?void 0:r.destinationBucket},{headers:n.headers}),error:null}}catch(s){if(n.shouldThrowOnError)throw s;if(kr(s))return{data:null,error:s};throw s}}async copy(e,t,r){var n=this;try{return{data:{path:(await Ur(n.fetch,`${n.url}/object/copy`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==r?void 0:r.destinationBucket},{headers:n.headers})).Key},error:null}}catch(s){if(n.shouldThrowOnError)throw s;if(kr(s))return{data:null,error:s};throw s}}async createSignedUrl(e,t,r){var n=this;try{let s=n._getFinalPath(e),a=await Ur(n.fetch,`${n.url}/object/sign/${s}`,Ir({expiresIn:t},(null==r?void 0:r.transform)?{transform:r.transform}:{}),{headers:n.headers});const o=(null==r?void 0:r.download)?`&download=${!0===r.download?"":r.download}`:"";return a={signedUrl:encodeURI(`${n.url}${a.signedURL}${o}`)},{data:a,error:null}}catch(s){if(n.shouldThrowOnError)throw s;if(kr(s))return{data:null,error:s};throw s}}async createSignedUrls(e,t,r){var n=this;try{const s=await Ur(n.fetch,`${n.url}/object/sign/${n.bucketId}`,{expiresIn:t,paths:e},{headers:n.headers}),a=(null==r?void 0:r.download)?`&download=${!0===r.download?"":r.download}`:"";return{data:s.map(e=>Ir(Ir({},e),{},{signedUrl:e.signedURL?encodeURI(`${n.url}${e.signedURL}${a}`):null})),error:null}}catch(s){if(n.shouldThrowOnError)throw s;if(kr(s))return{data:null,error:s};throw s}}download(e,t){const r=void 0!==(null==t?void 0:t.transform)?"render/image/authenticated":"object",n=this.transformOptsToQueryString((null==t?void 0:t.transform)||{}),s=n?`?${n}`:"",a=this._getFinalPath(e);return new Fr(()=>Lr(this.fetch,`${this.url}/${r}/${a}${s}`,{headers:this.headers,noResolveJson:!0}),this.shouldThrowOnError)}async info(e){var t=this;const r=t._getFinalPath(e);try{return{data:Er(await Lr(t.fetch,`${t.url}/object/info/${r}`,{headers:t.headers})),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(kr(n))return{data:null,error:n};throw n}}async exists(e){var t=this;const r=t._getFinalPath(e);try{return await async function(e,t,r,n){return Dr(e,"HEAD",t,Ir(Ir({},r),{},{noResolveJson:!0}),n)}(t.fetch,`${t.url}/object/${r}`,{headers:t.headers}),{data:!0,error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(kr(n)&&n instanceof Tr){const e=n.originalError;if([400,404].includes(null==e?void 0:e.status))return{data:!1,error:n}}throw n}}getPublicUrl(e,t){const r=this._getFinalPath(e),n=[],s=(null==t?void 0:t.download)?`download=${!0===t.download?"":t.download}`:"";""!==s&&n.push(s);const a=void 0!==(null==t?void 0:t.transform)?"render/image":"object",o=this.transformOptsToQueryString((null==t?void 0:t.transform)||{});""!==o&&n.push(o);let i=n.join("&");return""!==i&&(i=`?${i}`),{data:{publicUrl:encodeURI(`${this.url}/${a}/public/${r}${i}`)}}}async remove(e){var t=this;try{return{data:await qr(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}),error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(kr(r))return{data:null,error:r};throw r}}async list(e,t,r){var n=this;try{const s=Ir(Ir(Ir({},Wr),t),{},{prefix:e||""});return{data:await Ur(n.fetch,`${n.url}/object/list/${n.bucketId}`,s,{headers:n.headers},r),error:null}}catch(s){if(n.shouldThrowOnError)throw s;if(kr(s))return{data:null,error:s};throw s}}async listV2(e,t){var r=this;try{const n=Ir({},e);return{data:await Ur(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,n,{headers:r.headers},t),error:null}}catch(n){if(r.shouldThrowOnError)throw n;if(kr(n))return{data:null,error:n};throw n}}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return"undefined"!=typeof Buffer?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){const t=[];return e.width&&t.push(`width=${e.width}`),e.height&&t.push(`height=${e.height}`),e.resize&&t.push(`resize=${e.resize}`),e.format&&t.push(`format=${e.format}`),e.quality&&t.push(`quality=${e.quality}`),t.join("&")}};const Hr="2.89.0",Gr={"X-Client-Info":`storage-js/${Hr}`};var Jr=class{constructor(e,t={},r,n){this.shouldThrowOnError=!1;const s=new URL(e);(null==n?void 0:n.useNewHostname)&&/supabase\.(co|in|red)$/.test(s.hostname)&&!s.hostname.includes("storage.supabase.")&&(s.hostname=s.hostname.replace("supabase.","storage.supabase.")),this.url=s.href.replace(/\/$/,""),this.headers=Ir(Ir({},Gr),t),this.fetch=Sr(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async listBuckets(e){var t=this;try{const r=t.listBucketOptionsToQueryString(e);return{data:await Lr(t.fetch,`${t.url}/bucket${r}`,{headers:t.headers}),error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(kr(r))return{data:null,error:r};throw r}}async getBucket(e){var t=this;try{return{data:await Lr(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}),error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(kr(r))return{data:null,error:r};throw r}}async createBucket(e,t={public:!1}){var r=this;try{return{data:await Ur(r.fetch,`${r.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}),error:null}}catch(n){if(r.shouldThrowOnError)throw n;if(kr(n))return{data:null,error:n};throw n}}async updateBucket(e,t){var r=this;try{return{data:await Mr(r.fetch,`${r.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}),error:null}}catch(n){if(r.shouldThrowOnError)throw n;if(kr(n))return{data:null,error:n};throw n}}async emptyBucket(e){var t=this;try{return{data:await Ur(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}),error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(kr(r))return{data:null,error:r};throw r}}async deleteBucket(e){var t=this;try{return{data:await qr(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}),error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(kr(r))return{data:null,error:r};throw r}}listBucketOptionsToQueryString(e){const t={};return e&&("limit"in e&&(t.limit=String(e.limit)),"offset"in e&&(t.offset=String(e.offset)),e.search&&(t.search=e.search),e.sortColumn&&(t.sortColumn=e.sortColumn),e.sortOrder&&(t.sortOrder=e.sortOrder)),Object.keys(t).length>0?"?"+new URLSearchParams(t).toString():""}},Yr=class{constructor(e,t={},r){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Ir(Ir({},Gr),t),this.fetch=Sr(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(e){var t=this;try{return{data:await Ur(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}),error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(kr(r))return{data:null,error:r};throw r}}async listBuckets(e){var t=this;
2try{const r=new URLSearchParams;void 0!==(null==e?void 0:e.limit)&&r.set("limit",e.limit.toString()),void 0!==(null==e?void 0:e.offset)&&r.set("offset",e.offset.toString()),(null==e?void 0:e.sortColumn)&&r.set("sortColumn",e.sortColumn),(null==e?void 0:e.sortOrder)&&r.set("sortOrder",e.sortOrder),(null==e?void 0:e.search)&&r.set("search",e.search);const n=r.toString(),s=n?`${t.url}/bucket?${n}`:`${t.url}/bucket`;return{data:await Lr(t.fetch,s,{headers:t.headers}),error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(kr(r))return{data:null,error:r};throw r}}async deleteBucket(e){var t=this;try{return{data:await qr(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}),error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(kr(r))return{data:null,error:r};throw r}}from(e){var t=this;if(!(e=>!(!e||"string"!=typeof e)&&!(0===e.length||e.length>100)&&e.trim()===e&&!e.includes("/")&&!e.includes("\\")&&/^[\w!.\*'() &$@=;:+,?-]+$/.test(e))(e))throw new _r("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const r=new xr({baseUrl:this.url,catalogName:e,auth:{type:"custom",getHeaders:async()=>t.headers},fetch:this.fetch}),n=this.shouldThrowOnError;return new Proxy(r,{get(e,t){const r=e[t];return"function"!=typeof r?r:async(...t)=>{try{return{data:await r.apply(e,t),error:null}}catch(s){if(n)throw s;return{data:null,error:s}}}}})}};const Xr={"X-Client-Info":`storage-js/${Hr}`,"Content-Type":"application/json"};var Qr=class extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};function Zr(e){return"object"==typeof e&&null!==e&&"__isStorageVectorsError"in e}var en=class extends Qr{constructor(e,t,r){super(e),this.name="StorageVectorsApiError",this.status=t,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},tn=class extends Qr{constructor(e,t){super(e),this.name="StorageVectorsUnknownError",this.originalError=t}};const rn=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),nn=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),sn=(e,t,r,n)=>{const s={method:e,headers:(null==t?void 0:t.headers)||{}};return n?((e=>{if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)})(n)?(s.headers=Ir({"Content-Type":"application/json"},null==t?void 0:t.headers),s.body=JSON.stringify(n)):s.body=n,Ir(Ir({},s),r)):s};async function an(e,t,r,n,s,a){return new Promise((o,i)=>{e(r,sn(t,n,s,a)).then(e=>{if(!e.ok)throw e;if(null==n?void 0:n.noResolveJson)return e;const t=e.headers.get("content-type");return t&&t.includes("application/json")?e.json():{}}).then(e=>o(e)).catch(e=>(async(e,t,r)=>{if(e&&"object"==typeof e&&"status"in e&&"ok"in e&&"number"==typeof e.status&&!(null==r?void 0:r.noResolveJson)){const r=e.status||500,n=e;if("function"==typeof n.json)n.json().then(e=>{const n=(null==e?void 0:e.statusCode)||(null==e?void 0:e.code)||r+"";t(new en(nn(e),r,n))}).catch(()=>{const e=r+"";t(new en(n.statusText||`HTTP ${r} error`,r,e))});else{const e=r+"";t(new en(n.statusText||`HTTP ${r} error`,r,e))}}else t(new tn(nn(e),e))})(e,i,n))})}async function on(e,t,r,n,s){return an(e,"POST",t,n,s,r)}var ln=class{constructor(e,t={},r){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Ir(Ir({},Xr),t),this.fetch=rn(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createIndex(e){var t=this;try{return{data:await on(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{},error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(Zr(r))return{data:null,error:r};throw r}}async getIndex(e,t){var r=this;try{return{data:await on(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers}),error:null}}catch(n){if(r.shouldThrowOnError)throw n;if(Zr(n))return{data:null,error:n};throw n}}async listIndexes(e){var t=this;try{return{data:await on(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}),error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(Zr(r))return{data:null,error:r};throw r}}async deleteIndex(e,t){var r=this;try{return{data:await on(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers})||{},error:null}}catch(n){if(r.shouldThrowOnError)throw n;if(Zr(n))return{data:null,error:n};throw n}}},cn=class{constructor(e,t={},r){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Ir(Ir({},Xr),t),this.fetch=rn(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async putVectors(e){var t=this;try{if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:await on(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{},error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(Zr(r))return{data:null,error:r};throw r}}async getVectors(e){var t=this;try{return{data:await on(t.fetch,`${t.url}/GetVectors`,e,{headers:t.headers}),error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(Zr(r))return{data:null,error:r};throw r}}async listVectors(e){var t=this;try{if(void 0!==e.segmentCount){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");
2if(void 0!==e.segmentIndex&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error("segmentIndex must be between 0 and "+(e.segmentCount-1))}return{data:await on(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}),error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(Zr(r))return{data:null,error:r};throw r}}async queryVectors(e){var t=this;try{return{data:await on(t.fetch,`${t.url}/QueryVectors`,e,{headers:t.headers}),error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(Zr(r))return{data:null,error:r};throw r}}async deleteVectors(e){var t=this;try{if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:await on(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{},error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(Zr(r))return{data:null,error:r};throw r}}},dn=class{constructor(e,t={},r){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Ir(Ir({},Xr),t),this.fetch=rn(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(e){var t=this;try{return{data:await on(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{},error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(Zr(r))return{data:null,error:r};throw r}}async getBucket(e){var t=this;try{return{data:await on(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}),error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(Zr(r))return{data:null,error:r};throw r}}async listBuckets(e={}){var t=this;try{return{data:await on(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}),error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(Zr(r))return{data:null,error:r};throw r}}async deleteBucket(e){var t=this;try{return{data:await on(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{},error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(Zr(r))return{data:null,error:r};throw r}}},un=class extends dn{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new hn(this.url,this.headers,e,this.fetch)}async createBucket(e){return(()=>super.createBucket)().call(this,e)}async getBucket(e){return(()=>super.getBucket)().call(this,e)}async listBuckets(e={}){return(()=>super.listBuckets)().call(this,e)}async deleteBucket(e){return(()=>super.deleteBucket)().call(this,e)}},hn=class extends ln{constructor(e,t,r,n){super(e,t,n),this.vectorBucketName=r}async createIndex(e){return(()=>super.createIndex)().call(this,Ir(Ir({},e),{},{vectorBucketName:this.vectorBucketName}))}async listIndexes(e={}){return(()=>super.listIndexes)().call(this,Ir(Ir({},e),{},{vectorBucketName:this.vectorBucketName}))}async getIndex(e){return(()=>super.getIndex)().call(this,this.vectorBucketName,e)}async deleteIndex(e){return(()=>super.deleteIndex)().call(this,this.vectorBucketName,e)}index(e){return new pn(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},pn=class extends cn{constructor(e,t,r,n,s){super(e,t,s),this.vectorBucketName=r,this.indexName=n}async putVectors(e){var t=this;return(()=>super.putVectors)().call(t,Ir(Ir({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async getVectors(e){var t=this;return(()=>super.getVectors)().call(t,Ir(Ir({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async listVectors(e={}){var t=this;return(()=>super.listVectors)().call(t,Ir(Ir({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async queryVectors(e){var t=this;return(()=>super.queryVectors)().call(t,Ir(Ir({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async deleteVectors(e){var t=this;return(()=>super.deleteVectors)().call(t,Ir(Ir({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}},fn=class extends Jr{constructor(e,t={},r,n){super(e,t,r,n)}from(e){return new Kr(this.url,this.headers,e,this.fetch)}get vectors(){return new un(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new Yr(this.url+"/iceberg",this.headers,this.fetch)}};const mn="2.89.0",gn=3e4,yn=9e4,vn={"X-Client-Info":`gotrue-js/${mn}`},wn="X-Supabase-Api-Version",bn={timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"},xn=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i;
vendor: 21,302 bytes, line 2
2class _n extends Error{constructor(e,t,r){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=t,this.code=r}}function kn(e){return"object"==typeof e&&null!==e&&"__isAuthError"in e}class jn extends _n{constructor(e,t,r){super(e,t,r),this.name="AuthApiError",this.status=t,this.code=r}}class Tn extends _n{constructor(e,t){super(e),this.name="AuthUnknownError",this.originalError=t}}class Sn extends _n{constructor(e,t,r,n){super(e,r,n),this.name=t,this.status=r}}class En extends Sn{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}class Nn extends Sn{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class Cn extends Sn{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class An extends Sn{constructor(e,t=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class Rn extends Sn{constructor(e,t=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class In extends Sn{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class On extends Sn{constructor(e,t){super(e,"AuthRetryableFetchError",t,void 0)}}function Pn(e){return kn(e)&&"AuthRetryableFetchError"===e.name}class $n extends Sn{constructor(e,t,r){super(e,"AuthWeakPasswordError",t,"weak_password"),this.reasons=r}}class Dn extends Sn{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const Ln="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Un=" \t\n\r=".split(""),Mn=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<Un.length;t+=1)e[Un[t].charCodeAt(0)]=-2;for(let t=0;t<Ln.length;t+=1)e[Ln[t].charCodeAt(0)]=t;return e})();function qn(e,t,r){if(null!==e)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;){const e=t.queue>>t.queuedBits-6&63;r(Ln[e]),t.queuedBits-=6}else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;){const e=t.queue>>t.queuedBits-6&63;r(Ln[e]),t.queuedBits-=6}}function zn(e,t,r){const n=Mn[e];if(!(n>-1)){if(-2===n)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}for(t.queue=t.queue<<6|n,t.queuedBits+=6;t.queuedBits>=8;)r(t.queue>>t.queuedBits-8&255),t.queuedBits-=8}function Bn(e){const t=[],r=e=>{t.push(String.fromCodePoint(e))},n={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},a=e=>{!function(e,t,r){if(0===t.utf8seq){if(e<=127)return void r(e);for(let r=1;r<6;r+=1)if(!(e>>7-r&1)){t.utf8seq=r;break}if(2===t.utf8seq)t.codepoint=31&e;else if(3===t.utf8seq)t.codepoint=15&e;else{if(4!==t.utf8seq)throw new Error("Invalid UTF-8 sequence");t.codepoint=7&e}t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw new Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|63&e,t.utf8seq-=1,0===t.utf8seq&&r(t.codepoint)}}(e,n,r)};for(let o=0;o<e.length;o+=1)zn(e.charCodeAt(o),s,a);return t.join("")}function Fn(e,t){if(!(e<=127)){if(e<=2047)return t(192|e>>6),void t(128|63&e);if(e<=65535)return t(224|e>>12),t(128|e>>6&63),void t(128|63&e);if(e<=1114111)return t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),void t(128|63&e);throw new Error(`Unrecognized Unicode codepoint: ${e.toString(16)}`)}t(e)}function Wn(e){const t=[],r={queue:0,queuedBits:0},n=e=>{t.push(e)};for(let s=0;s<e.length;s+=1)zn(e.charCodeAt(s),r,n);return new Uint8Array(t)}function Vn(e){const t=[];return function(e,t){for(let r=0;r<e.length;r+=1){let n=e.charCodeAt(r);if(n>55295&&n<=56319){const t=1024*(n-55296)&65535;n=65536+(e.charCodeAt(r+1)-56320&65535|t),r+=1}Fn(n,t)}}(e,e=>t.push(e)),new Uint8Array(t)}function Kn(e){const t=[],r={queue:0,queuedBits:0},n=e=>{t.push(e)};return e.forEach(e=>qn(e,r,n)),qn(null,r,n),t.join("")}const Hn=()=>"undefined"!=typeof window&&"undefined"!=typeof document,Gn={tested:!1,writable:!1},Jn=()=>{if(!Hn())return!1;try{if("object"!=typeof globalThis.localStorage)return!1}catch(t){return!1}if(Gn.tested)return Gn.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),Gn.tested=!0,Gn.writable=!0}catch(t){Gn.tested=!0,Gn.writable=!1}return Gn.writable};const Yn=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),Xn=async(e,t,r)=>{await e.setItem(t,JSON.stringify(r))},Qn=async(e,t)=>{const r=await e.getItem(t);if(!r)return null;try{return JSON.parse(r)}catch(n){return r}},Zn=async(e,t)=>{await e.removeItem(t)};class es{constructor(){this.promise=new es.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}}function ts(e){const t=e.split(".");if(3!==t.length)throw new Dn("Invalid JWT structure");for(let r=0;r<t.length;r++)if(!xn.test(t[r]))throw new Dn("JWT not in base64url format");return{header:JSON.parse(Bn(t[0])),payload:JSON.parse(Bn(t[1])),signature:Wn(t[2]),raw:{header:t[0],payload:t[1]}}}function rs(e){return("0"+e.toString(16)).substr(-2)}async function ns(e){if(!("undefined"!=typeof crypto&&void 0!==crypto.subtle&&"undefined"!=typeof TextEncoder))return e;const t=await async function(e){const t=(new TextEncoder).encode(e),r=await crypto.subtle.digest("SHA-256",t),n=new Uint8Array(r);return Array.from(n).map(e=>String.fromCharCode(e)).join("")}(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function ss(e,t,r=!1){const n=function(){const e=new Uint32Array(56);if("undefined"==typeof crypto){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",t=e.length;let r="";for(let n=0;n<56;n++)r+=e.charAt(Math.floor(Math.random()*t));return r}return crypto.getRandomValues(e),Array.from(e,rs).join("")}();let s=n;r&&(s+="/PASSWORD_RECOVERY"),await Xn(e,`${t}-code-verifier`,s);const a=await ns(n);return[a,n===a?"plain":"s256"]}es.promiseConstructor=Promise;const as=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;const os=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function is(e){if(!os.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function ls(){return new Proxy({},{get:(e,t)=>{if("__isUserNotAvailableProxy"===t)return!0;if("symbol"==typeof t){const e=t.toString();if("Symbol(Symbol.toPrimitive)"===e||"Symbol(Symbol.toStringTag)"===e||"Symbol(util.inspect.custom)"===e)return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${t}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function cs(e){return JSON.parse(JSON.stringify(e))}const ds=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),us=[502,503,504];async function hs(e){var t,r;if(!("object"==typeof(r=e)&&null!==r&&"status"in r&&"ok"in r&&"json"in r&&"function"==typeof r.json))throw new On(ds(e),0);if(us.includes(e.status))throw new On(ds(e),e.status);let n,s;try{n=await e.json()}catch(o){throw new Tn(ds(o),o)}const a=function(e){const t=e.headers.get(wn);if(!t)return null;if(!t.match(as))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch(o){return null}}(e);if(a&&a.getTime()>=bn.timestamp&&"object"==typeof n&&n&&"string"==typeof n.code?s=n.code:"object"==typeof n&&n&&"string"==typeof n.error_code&&(s=n.error_code),s){if("weak_password"===s)throw new $n(ds(n),e.status,(null===(t=n.weak_password)||void 0===t?void 0:t.reasons)||[]);if("session_not_found"===s)throw new En}else if("object"==typeof n&&n&&"object"==typeof n.weak_password&&n.weak_password&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.reasons.reduce((e,t)=>e&&"string"==typeof t,!0))throw new $n(ds(n),e.status,n.weak_password.reasons);throw new jn(ds(n),e.status||500,s)}async function ps(e,t,r,n){var s;const a=Object.assign({},null==n?void 0:n.headers);a[wn]||(a[wn]=bn.name),(null==n?void 0:n.jwt)&&(a.Authorization=`Bearer ${n.jwt}`);const o=null!==(s=null==n?void 0:n.query)&&void 0!==s?s:{};(null==n?void 0:n.redirectTo)&&(o.redirect_to=n.redirectTo);const i=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",l=await async function(e,t,r,n,s,a){const o=((e,t,r,n)=>{const s={method:e,headers:(null==t?void 0:t.headers)||{}};return"GET"===e?s:(s.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},null==t?void 0:t.headers),s.body=JSON.stringify(n),Object.assign(Object.assign({},s),r))})(t,n,s,a);let i;try{i=await e(r,Object.assign({},o))}catch(l){throw new On(ds(l),0)}i.ok||await hs(i);if(null==n?void 0:n.noResolveJson)return i;try{return await i.json()}catch(l){await hs(l)}}(e,t,r+i,{headers:a,noResolveJson:null==n?void 0:n.noResolveJson},{},null==n?void 0:n.body);return(null==n?void 0:n.xform)?null==n?void 0:n.xform(l):{data:Object.assign({},l),error:null}}function fs(e){var t;let r=null;var n;(function(e){return e.access_token&&e.refresh_token&&e.expires_in})(e)&&(r=Object.assign({},e),e.expires_at||(r.expires_at=(n=e.expires_in,Math.round(Date.now()/1e3)+n)));return{data:{session:r,user:null!==(t=e.user)&&void 0!==t?t:e},error:null}}function ms(e){const t=fs(e);return!t.error&&e.weak_password&&"object"==typeof e.weak_password&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&"string"==typeof e.weak_password.message&&e.weak_password.reasons.reduce((e,t)=>e&&"string"==typeof t,!0)&&(t.data.weak_password=e.weak_password),t}function gs(e){var t;return{data:{user:null!==(t=e.user)&&void 0!==t?t:e},error:null}}function ys(e){return{data:e,error:null}}function vs(e){const{action_link:t,email_otp:r,hashed_token:n,redirect_to:s,verification_type:a}=e,o=k(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]);return{data:{properties:{action_link:t,email_otp:r,hashed_token:n,redirect_to:s,verification_type:a},user:Object.assign({},o)},error:null}}function ws(e){return e}const bs=["global","local","others"];class xs{constructor({url:e="",headers:t={},fetch:r}){this.url=e,this.headers=t,this.fetch=Yn(r),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}async signOut(e,t=bs[0]){if(bs.indexOf(t)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${bs.join(", ")}`);try{return await ps(this.fetch,"POST",`${this.url}/logout?scope=${t}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(r){if(kn(r))return{data:null,error:r};throw r}}async inviteUserByEmail(e,t={}){try{return await ps(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:t.data},headers:this.headers,redirectTo:t.redirectTo,xform:gs})}catch(r){if(kn(r))return{data:{user:null},error:r};throw r}}async generateLink(e){try{const{options:t}=e,r=k(e,["options"]),n=Object.assign(Object.assign({},r),t);return"newEmail"in r&&(n.new_email=null==r?void 0:r.newEmail,delete n.newEmail),await ps(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:n,headers:this.headers,xform:vs,redirectTo:null==t?void 0:t.redirectTo})}catch(t){if(kn(t))return{data:{properties:null,user:null},error:t};throw t}}async createUser(e){try{return await ps(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:gs})}catch(t){if(kn(t))return{data:{user:null},error:t};throw t}}async listUsers(e){var t,r,n,s,a,o,i;try{const l={nextPage:null,lastPage:0,total:0},c=await ps(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:null!==(r=null===(t=null==e?void 0:e.page)||void 0===t?void 0:t.toString())&&void 0!==r?r:"",per_page:null!==(s=null===(n=null==e?void 0:e.perPage)||void 0===n?void 0:n.toString())&&void 0!==s?s:""},xform:ws});if(c.error)throw c.error;const d=await c.json(),u=null!==(a=c.headers.get("x-total-count"))&&void 0!==a?a:0,h=null!==(i=null===(o=c.headers.get("link"))||void 0===o?void 0:o.split(","))&&void 0!==i?i:[];return h.length>0&&(h.forEach(e=>{const t=parseInt(e.split(";")[0].split("=")[1].substring(0,1)),r=JSON.parse(e.split(";")[1].split("=")[1]);l[`${r}Page`]=t}),l.total=parseInt(u)),{data:Object.assign(Object.assign({},d),l),error:null}}catch(l){if(kn(l))return{data:{users:[]},error:l};throw l}}async getUserById(e){is(e);try{return await ps(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:gs})}catch(t){if(kn(t))return{data:{user:null},error:t};throw t}}async updateUserById(e,t){is(e);try{return await ps(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:t,headers:this.headers,xform:gs})}catch(r){if(kn(r))return{data:{user:null},error:r};throw r}}async deleteUser(e,t=!1){is(e);try{return await ps(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:t},xform:gs})}catch(r){if(kn(r))return{data:{user:null},error:r};throw r}}async _listFactors(e){is(e.userId);try{const{data:t,error:r}=await ps(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:e=>({data:{factors:e},error:null})});return{data:t,error:r}}catch(t){if(kn(t))return{data:null,error:t};throw t}}async _deleteFactor(e){is(e.userId),is(e.id);try{return{data:await ps(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(t){if(kn(t))return{data:null,error:t};throw t}}async _listOAuthClients(e){var t,r,n,s,a,o,i;try{const l={nextPage:null,lastPage:0,total:0},c=await ps(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:null!==(r=null===(t=null==e?void 0:e.page)||void 0===t?void 0:t.toString())&&void 0!==r?r:"",per_page:null!==(s=null===(n=null==e?void 0:e.perPage)||void 0===n?void 0:n.toString())&&void 0!==s?s:""},xform:ws});if(c.error)throw c.error;const d=await c.json(),u=null!==(a=c.headers.get("x-total-count"))&&void 0!==a?a:0,h=null!==(i=null===(o=c.headers.get("link"))||void 0===o?void 0:o.split(","))&&void 0!==i?i:[];return h.length>0&&(h.forEach(e=>{const t=parseInt(e.split(";")[0].split("=")[1].substring(0,1)),r=JSON.parse(e.split(";")[1].split("=")[1]);l[`${r}Page`]=t}),l.total=parseInt(u)),{data:Object.assign(Object.assign({},d),l),error:null}}catch(l){if(kn(l))return{data:{clients:[]},error:l};throw l}}async _createOAuthClient(e){try{return await ps(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:e=>({data:e,error:null})})}catch(t){if(kn(t))return{data:null,error:t};throw t}}async _getOAuthClient(e){try{return await ps(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:e=>({data:e,error:null})})}catch(t){if(kn(t))return{data:null,error:t};throw t}}async _updateOAuthClient(e,t){try{return await ps(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:t,headers:this.headers,xform:e=>({data:e,error:null})})}catch(r){if(kn(r))return{data:null,error:r};throw r}}async _deleteOAuthClient(e){try{return await ps(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(t){if(kn(t))return{data:null,error:t};throw t}}async _regenerateOAuthClientSecret(e){try{return await ps(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:e=>({data:e,error:null})})}catch(t){if(kn(t))return{data:null,error:t};throw t}}}function _s(e={}){return{getItem:t=>e[t]||null,setItem:(t,r)=>{e[t]=r},removeItem:t=>{delete e[t]}}}const ks=!!(globalThis&&Jn()&&globalThis.localStorage&&"true"===globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug"));class js extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class Ts extends js{}async function Ss(e,t,r){const n=new globalThis.AbortController;return t>0&&setTimeout(()=>{n.abort()},t),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,0===t?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:n.signal},async n=>{if(!n){if(0===t)throw new Ts(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(ks)try{await globalThis.navigator.locks.query()}catch(s){}return await r()}try{return await r()}finally{}}))}function Es(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function Ns(e){const t=(new TextEncoder).encode(e);return"0x"+Array.from(t,e=>e.toString(16).padStart(2,"0")).join("")}class Cs extends Error{constructor({message:e,code:t,cause:r,name:n}){var s;super(e,{cause:r}),this.__isWebAuthnError=!0,this.name=null!==(s=null!=n?n:r instanceof Error?r.name:void 0)&&void 0!==s?s:"Unknown Error",this.code=t}}class As extends Cs{constructor(e,t){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t,message:e}),this.name="WebAuthnUnknownError",this.originalError=t}}function Rs({error:e,options:t}){var r,n,s;const{publicKey:a}=t;if(!a)throw Error("options was missing required publicKey property");if("AbortError"===e.name){if(t.signal instanceof AbortSignal)return new Cs({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if("ConstraintError"===e.name){if(!0===(null===(r=a.authenticatorSelection)||void 0===r?void 0:r.requireResidentKey))return new Cs({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if("conditional"===t.mediation&&"required"===(null===(n=a.authenticatorSelection)||void 0===n?void 0:n.userVerification))return new Cs({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if("required"===(null===(s=a.authenticatorSelection)||void 0===s?void 0:s.userVerification))return new Cs({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:e})}else{if("InvalidStateError"===e.name)return new Cs({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if("NotAllowedError"===e.name)return new Cs({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if("NotSupportedError"===e.name){return 0===a.pubKeyCredParams.filter(e=>"public-key"===e.type).length?new Cs({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new Cs({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e})}if("SecurityError"===e.name){const t=window.location.hostname;if(!Us(t))return new Cs({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e});if(a.rp.id!==t)return new Cs({message:`The RP ID "${a.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else if("TypeError"===e.name){if(a.user.id.byteLength<1||a.user.id.byteLength>64)return new Cs({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:e})}else if("UnknownError"===e.name)return new Cs({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new Cs({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function Is({error:e,options:t}){const{publicKey:r}=t;if(!r)throw Error("options was missing required publicKey property");if("AbortError"===e.name){if(t.signal instanceof AbortSignal)return new Cs({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if("NotAllowedError"===e.name)return new Cs({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if("SecurityError"===e.name){const t=window.location.hostname;if(!Us(t))return new Cs({message:`${window.location.hostname}
2 is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e});if(r.rpId!==t)return new Cs({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else if("UnknownError"===e.name)return new Cs({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new Cs({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}const Os=new class{createNewAbortSignal(){if(this.controller){const e=new Error("Cancelling existing WebAuthn API call for new one");e.name="AbortError",this.controller.abort(e)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}};function Ps(e){if(!e)throw new Error("Credential creation options are required");if("undefined"!=typeof PublicKeyCredential&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&"function"==typeof PublicKeyCredential.parseCreationOptionsFromJSON)return PublicKeyCredential.parseCreationOptionsFromJSON(e);const{challenge:t,user:r,excludeCredentials:n}=e,s=k(e,["challenge","user","excludeCredentials"]),a=Wn(t).buffer,o=Object.assign(Object.assign({},r),{id:Wn(r.id).buffer}),i=Object.assign(Object.assign({},s),{challenge:a,user:o});if(n&&n.length>0){i.excludeCredentials=new Array(n.length);for(let e=0;e<n.length;e++){const t=n[e];i.excludeCredentials[e]=Object.assign(Object.assign({},t),{id:Wn(t.id).buffer,type:t.type||"public-key",transports:t.transports})}}return i}function $s(e){if(!e)throw new Error("Credential request options are required");if("undefined"!=typeof PublicKeyCredential&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&"function"==typeof PublicKeyCredential.parseRequestOptionsFromJSON)return PublicKeyCredential.parseRequestOptionsFromJSON(e);const{challenge:t,allowCredentials:r}=e,n=k(e,["challenge","allowCredentials"]),s=Wn(t).buffer,a=Object.assign(Object.assign({},n),{challenge:s});if(r&&r.length>0){a.allowCredentials=new Array(r.length);for(let e=0;e<r.length;e++){const t=r[e];a.allowCredentials[e]=Object.assign(Object.assign({},t),{id:Wn(t.id).buffer,type:t.type||"public-key",transports:t.transports})}}return a}function Ds(e){var t;if("toJSON"in e&&"function"==typeof e.toJSON)return e.toJSON();const r=e;return{id:e.id,rawId:e.id,response:{attestationObject:Kn(new Uint8Array(e.response.attestationObject)),clientDataJSON:Kn(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:null!==(t=r.authenticatorAttachment)&&void 0!==t?t:void 0}}function Ls(e){var t;if("toJSON"in e&&"function"==typeof e.toJSON)return e.toJSON();const r=e,n=e.getClientExtensionResults(),s=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:Kn(new Uint8Array(s.authenticatorData)),clientDataJSON:Kn(new Uint8Array(s.clientDataJSON)),signature:Kn(new Uint8Array(s.signature)),userHandle:s.userHandle?Kn(new Uint8Array(s.userHandle)):void 0},type:"public-key",clientExtensionResults:n,authenticatorAttachment:null!==(t=r.authenticatorAttachment)&&void 0!==t?t:void 0}}function Us(e){return"localhost"===e||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function Ms(){var e,t;return!!(Hn()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&"function"==typeof(null===(e=null===navigator||void 0===navigator?void 0:navigator.credentials)||void 0===e?void 0:e.create)&&"function"==typeof(null===(t=null===navigator||void 0===navigator?void 0:navigator.credentials)||void 0===t?void 0:t.get))}const qs={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},zs={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Bs(...e){const t=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),r=e=>e instanceof ArrayBuffer||ArrayBuffer.isView(e),n={};for(const s of e)if(s)for(const e in s){const a=s[e];if(void 0!==a)if(Array.isArray(a))n[e]=a;
vendor: 30,203 bytes, line 2
2else if(r(a))n[e]=a;else if(t(a)){const r=n[e];t(r)?n[e]=Bs(r,a):n[e]=Bs(a)}else n[e]=a}return n}class Fs{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:t,friendlyName:r,signal:n},s){try{const{data:a,error:o}=await this.client.mfa.challenge({factorId:e,webauthn:t});if(!a)return{data:null,error:o};const i=null!=n?n:Os.createNewAbortSignal();if("create"===a.webauthn.type){const{user:e}=a.webauthn.credential_options.publicKey;e.name||(e.name=`${e.id}:${r}`),e.displayName||(e.displayName=e.name)}switch(a.webauthn.type){case"create":{const t=function(e,t){return Bs(qs,e,t||{})}(a.webauthn.credential_options.publicKey,null==s?void 0:s.create),{data:r,error:n}=await async function(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new As("Browser returned unexpected credential type",t)}:{data:null,error:new As("Empty credential response",t)}}catch(t){return{data:null,error:Rs({error:t,options:e})}}}({publicKey:t,signal:i});return r?{data:{factorId:e,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:r}},error:null}:{data:null,error:n}}case"request":{const t=function(e,t){return Bs(zs,e,t||{})}(a.webauthn.credential_options.publicKey,null==s?void 0:s.request),{data:r,error:n}=await async function(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new As("Browser returned unexpected credential type",t)}:{data:null,error:new As("Empty credential response",t)}}catch(t){return{data:null,error:Is({error:t,options:e})}}}(Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:t,signal:i}));return r?{data:{factorId:e,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:r}},error:null}:{data:null,error:n}}}}catch(a){return kn(a)?{data:null,error:a}:{data:null,error:new Tn("Unexpected error in challenge",a)}}}async _verify({challengeId:e,factorId:t,webauthn:r}){return this.client.mfa.verify({factorId:t,challengeId:e,webauthn:r})}async _authenticate({factorId:e,webauthn:{rpId:t=("undefined"!=typeof window?window.location.hostname:void 0),rpOrigins:r=("undefined"!=typeof window?[window.location.origin]:void 0),signal:n}={}},s){if(!t)return{data:null,error:new _n("rpId is required for WebAuthn authentication")};try{if(!Ms())return{data:null,error:new Tn("Browser does not support WebAuthn",null)};const{data:a,error:o}=await this.challenge({factorId:e,webauthn:{rpId:t,rpOrigins:r},signal:n},{request:s});if(!a)return{data:null,error:o};const{webauthn:i}=a;return this._verify({factorId:e,challengeId:a.challengeId,webauthn:{type:i.type,rpId:t,rpOrigins:r,credential_response:i.credential_response}})}catch(a){return kn(a)?{data:null,error:a}:{data:null,error:new Tn("Unexpected error in authenticate",a)}}}async _register({friendlyName:e,webauthn:{rpId:t=("undefined"!=typeof window?window.location.hostname:void 0),rpOrigins:r=("undefined"!=typeof window?[window.location.origin]:void 0),signal:n}={}},s){if(!t)return{data:null,error:new _n("rpId is required for WebAuthn registration")};try{if(!Ms())return{data:null,error:new Tn("Browser does not support WebAuthn",null)};const{data:a,error:o}=await this._enroll({friendlyName:e});if(!a)return await this.client.mfa.listFactors().then(t=>{var r;return null===(r=t.data)||void 0===r?void 0:r.all.find(t=>"webauthn"===t.factor_type&&t.friendly_name===e&&"unverified"!==t.status)}).then(e=>e?this.client.mfa.unenroll({factorId:null==e?void 0:e.id}):void 0),{data:null,error:o};const{data:i,error:l}=await this._challenge({factorId:a.id,friendlyName:a.friendly_name,webauthn:{rpId:t,rpOrigins:r},signal:n},{create:s});return i?this._verify({factorId:a.id,challengeId:i.challengeId,webauthn:{rpId:t,rpOrigins:r,type:i.webauthn.type,credential_response:i.webauthn.credential_response}}):{data:null,error:l}}catch(a){return kn(a)?{data:null,error:a}:{data:null,error:new Tn("Unexpected error in register",a)}}}}!function(){if("object"!=typeof globalThis)try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch(e){"undefined"!=typeof self&&(self.globalThis=self)}}();const Ws={url:"http://localhost:9999",storageKey:"supabase.auth.token",autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:vn,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1};async function Vs(e,t,r){return await r()}const Ks={};class Hs{get jwks(){var e,t;return null!==(t=null===(e=Ks[this.storageKey])||void 0===e?void 0:e.jwks)&&void 0!==t?t:{keys:[]}}set jwks(e){Ks[this.storageKey]=Object.assign(Object.assign({},Ks[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,t;return null!==(t=null===(e=Ks[this.storageKey])||void 0===e?void 0:e.cachedAt)&&void 0!==t?t:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){Ks[this.storageKey]=Object.assign(Object.assign({},Ks[this.storageKey]),{cachedAt:e})}constructor(e){var t,r,n;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const s=Object.assign(Object.assign({},Ws),e);if(this.storageKey=s.storageKey,this.instanceID=null!==(t=Hs.nextInstanceID[this.storageKey])&&void 0!==t?t:0,Hs.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!s.debug,"function"==typeof s.debug&&(this.logger=s.debug),this.instanceID>0&&Hn()){this._logPrefix();this.logDebugMessages}if(this.persistSession=s.persistSession,this.autoRefreshToken=s.autoRefreshToken,this.admin=new xs({url:s.url,headers:s.headers,fetch:s.fetch}),this.url=s.url,this.headers=s.headers,this.fetch=Yn(s.fetch),this.lock=s.lock||Vs,this.detectSessionInUrl=s.detectSessionInUrl,this.flowType=s.flowType,this.hasCustomAuthorizationHeader=s.hasCustomAuthorizationHeader,this.throwOnError=s.throwOnError,s.lock?this.lock=s.lock:this.persistSession&&Hn()&&(null===(r=null===globalThis||void 0===globalThis?void 0:globalThis.navigator)||void 0===r?void 0:r.locks)?this.lock=Ss:this.lock=Vs,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new Fs(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.persistSession?(s.storage?this.storage=s.storage:Jn()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=_s(this.memoryStorage)),s.userStorage&&(this.userStorage=s.userStorage)):(this.memoryStorage={},this.storage=_s(this.memoryStorage)),Hn()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(a){}null===(n=this.broadcastChannel)||void 0===n||n.addEventListener("message",async e=>{this._debug("received broadcast notification from other tab or client",e),await this._notifyAllSubscribers(e.data.event,e.data.session,!1)})}this.initialize()}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${mn}) ${(new Date).toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise||(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))()),await this.initializePromise}async _initialize(){var e;try{let t={},r="none";if(Hn()&&(t=function(e){const t={},r=new URL(e);if(r.hash&&"#"===r.hash[0])try{new URLSearchParams(r.hash.substring(1)).forEach((e,r)=>{t[r]=e})}catch(n){}return r.searchParams.forEach((e,r)=>{t[r]=e}),t}(window.location.href),this._isImplicitGrantCallback(t)?r="implicit":await this._isPKCECallback(t)&&(r="pkce")),Hn()&&this.detectSessionInUrl&&"none"!==r){const{data:n,error:s}=await this._getSessionFromURL(t,r);if(s){if(this._debug("#_initialize()","error detecting session from URL",s),function(e){return kn(e)&&"AuthImplicitGrantRedirectError"===e.name}(s)){const t=null===(e=s.details)||void 0===e?void 0:e.code;if("identity_already_exists"===t||"identity_not_found"===t||"single_identity_not_deletable"===t)return{error:s}}return await this._removeSession(),{error:s}}const{session:a,redirectType:o}=n;return this._debug("#_initialize()","detected session in URL",a,"redirect type",o),await this._saveSession(a),setTimeout(async()=>{"recovery"===o?await this._notifyAllSubscribers("PASSWORD_RECOVERY",a):await this._notifyAllSubscribers("SIGNED_IN",a)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(t){return kn(t)?this._returnResult({error:t}):this._returnResult({error:new Tn("Unexpected error during initialization",t)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var t,r,n;try{const s=await ps(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:null!==(r=null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.data)&&void 0!==r?r:{},gotrue_meta_security:{captcha_token:null===(n=null==e?void 0:e.options)||void 0===n?void 0:n.captchaToken}},xform:fs}),{data:a,error:o}=s;if(o||!a)return this._returnResult({data:{user:null,session:null},error:o});const i=a.session,l=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",i)),this._returnResult({data:{user:l,session:i},error:null})}catch(s){if(kn(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signUp(e){var t,r,n;try{let s;if("email"in e){const{email:r,password:n,options:a}=e;let o=null,i=null;"pkce"===this.flowType&&([o,i]=await ss(this.storage,this.storageKey)),s=await ps(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:null==a?void 0:a.emailRedirectTo,body:{email:r,password:n,data:null!==(t=null==a?void 0:a.data)&&void 0!==t?t:{},gotrue_meta_security:{captcha_token:null==a?void 0:a.captchaToken},code_challenge:o,code_challenge_method:i},xform:fs})}else{if(!("phone"in e))throw new Cn("You must provide either an email or phone number and a password");{const{phone:t,password:a,options:o}=e;s=await ps(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:t,password:a,data:null!==(r=null==o?void 0:o.data)&&void 0!==r?r:{},channel:null!==(n=null==o?void 0:o.channel)&&void 0!==n?n:"sms",gotrue_meta_security:{captcha_token:null==o?void 0:o.captchaToken}},xform:fs})}}const{data:a,error:o}=s;if(o||!a)return await Zn(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:o});const i=a.session,l=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",i)),this._returnResult({data:{user:l,session:i},error:null})}catch(s){if(await Zn(this.storage,`${this.storageKey}-code-verifier`),kn(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithPassword(e){try{let t;if("email"in e){const{email:r,password:n,options:s}=e;t=await ps(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:r,password:n,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken}},xform:ms})}else{if(!("phone"in e))throw new Cn("You must provide either an email or phone number and a password");{const{phone:r,password:n,options:s}=e;t=await ps(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:r,password:n,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken}},xform:ms})}}const{data:r,error:n}=t;if(n)return this._returnResult({data:{user:null,session:null},error:n});if(!r||!r.session||!r.user){const e=new Nn;return this._returnResult({data:{user:null,session:null},error:e})}return r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:Object.assign({user:r.user,session:r.session},r.weak_password?{weakPassword:r.weak_password}:null),error:n})}catch(t){if(kn(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async signInWithOAuth(e){var t,r,n,s;return await this._handleProviderSignIn(e.provider,{redirectTo:null===(t=e.options)||void 0===t?void 0:t.redirectTo,scopes:null===(r=e.options)||void 0===r?void 0:r.scopes,queryParams:null===(n=e.options)||void 0===n?void 0:n.queryParams,skipBrowserRedirect:null===(s=e.options)||void 0===s?void 0:s.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:t}=e;switch(t){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${t}"`)}}async signInWithEthereum(e){var t,r,n,s,a,o,i,l,c,d,u;let h,p;if("message"in e)h=e.message,p=e.signature;else{const{chain:d,wallet:u,statement:f,options:m}=e;let g;if(Hn())if("object"==typeof u)g=u;else{const e=window;if(!("ethereum"in e)||"object"!=typeof e.ethereum||!("request"in e.ethereum)||"function"!=typeof e.ethereum.request)throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.");g=e.ethereum}else{if("object"!=typeof u||!(null==m?void 0:m.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");g=u}const y=new URL(null!==(t=null==m?void 0:m.url)&&void 0!==t?t:window.location.href),v=await g.request({method:"eth_requestAccounts"}).then(e=>e).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!v||0===v.length)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const w=Es(v[0]);let b=null===(r=null==m?void 0:m.signInWithEthereum)||void 0===r?void 0:r.chainId;if(!b){const e=await g.request({method:"eth_chainId"});b=parseInt(e,16)}h=function(e){var t;const{chainId:r,domain:n,expirationTime:s,issuedAt:a=new Date,nonce:o,notBefore:i,requestId:l,resources:c,scheme:d,uri:u,version:h}=e;if(!Number.isInteger(r))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${r}`);if(!n)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(o&&o.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${o}`);if(!u)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if("1"!==h)throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${h}`);if(null===(t=e.statement)||void 0===t?void 0:t.includes("\n"))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`);const p=`${d?`${d}://${n}`:n} wants you to sign in with your Ethereum account:\n${Es(e.address)}\n\n${e.statement?`${e.statement}\n`:""}`;let f=`URI: ${u}\nVersion: ${h}\nChain ID: ${r}${o?`\nNonce: ${o}`:""}\nIssued At: ${a.toISOString()}`;if(s&&(f+=`\nExpiration Time: ${s.toISOString()}`),i&&(f+=`\nNot Before: ${i.toISOString()}`),l&&(f+=`\nRequest ID: ${l}`),c){let e="\nResources:";for(const t of c){if(!t||"string"!=typeof t)throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${t}`);e+=`\n- ${t}`}f+=e}return`${p}\n${f}`}({domain:y.host,address:w,statement:f,uri:y.href,version:"1",chainId:b,nonce:null===(n=null==m?void 0:m.signInWithEthereum)||void 0===n?void 0:n.nonce,issuedAt:null!==(a=null===(s=null==m?void 0:m.signInWithEthereum)||void 0===s?void 0:s.issuedAt)&&void 0!==a?a:new Date,expirationTime:null===(o=null==m?void 0:m.signInWithEthereum)||void 0===o?void 0:o.expirationTime,notBefore:null===(i=null==m?void 0:m.signInWithEthereum)||void 0===i?void 0:i.notBefore,requestId:null===(l=null==m?void 0:m.signInWithEthereum)||void 0===l?void 0:l.requestId,resources:null===(c=null==m?void 0:m.signInWithEthereum)||void 0===c?void 0:c.resources}),p=await g.request({method:"personal_sign",params:[Ns(h),w]})}try{const{data:t,error:r}=await ps(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:h,signature:p},(null===(d=e.options)||void 0===d?void 0:d.captchaToken)?{gotrue_meta_security:{captcha_token:null===(u=e.options)||void 0===u?void 0:u.captchaToken}}:null),xform:fs});if(r)throw r;if(!t||!t.session||!t.user){const e=new Nn;return this._returnResult({data:{user:null,session:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("SIGNED_IN",t.session)),this._returnResult({data:Object.assign({},t),error:r})}catch(f){if(kn(f))return this._returnResult({data:{user:null,session:null},error:f});throw f}}async signInWithSolana(e){var t,r,n,s,a,o,i,l,c,d,u,h;let p,f;if("message"in e)p=e.message,f=e.signature;else{const{chain:u,wallet:h,statement:m,options:g}=e;let y;if(Hn())if("object"==typeof h)y=h;else{const e=window;if(!("solana"in e)||"object"!=typeof e.solana||!("signIn"in e.solana&&"function"==typeof e.solana.signIn||"signMessage"in e.solana&&"function"==typeof e.solana.signMessage))throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.");y=e.solana}else{if("object"!=typeof h||!(null==g?void 0:g.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");y=h}const v=new URL(null!==(t=null==g?void 0:g.url)&&void 0!==t?t:window.location.href);if("signIn"in y&&y.signIn){const e=await y.signIn(Object.assign(Object.assign(Object.assign({issuedAt:(new Date).toISOString()},null==g?void 0:g.signInWithSolana),{version:"1",domain:v.host,uri:v.href}),m?{statement:m}:null));let t;if(Array.isArray(e)&&e[0]&&"object"==typeof e[0])t=e[0];else{if(!(e&&"object"==typeof e&&"signedMessage"in e&&"signature"in e))throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");t=e}if(!("signedMessage"in t&&"signature"in t&&("string"==typeof t.signedMessage||t.signedMessage instanceof Uint8Array)&&t.signature instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields");p="string"==typeof t.signedMessage?t.signedMessage:(new TextDecoder).decode(t.signedMessage),f=t.signature}else{if(!("signMessage"in y&&"function"==typeof y.signMessage&&"publicKey"in y&&"object"==typeof y&&y.publicKey&&"toBase58"in y.publicKey&&"function"==typeof y.publicKey.toBase58))throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");p=[`${v.host} wants you to sign in with your Solana account:`,y.publicKey.toBase58(),...m?["",m,""]:[""],"Version: 1",`URI: ${v.href}`,`Issued At: ${null!==(n=null===(r=null==g?void 0:g.signInWithSolana)||void 0===r?void 0:r.issuedAt)&&void 0!==n?n:(new Date).toISOString()}`,...(null===(s=null==g?void 0:g.signInWithSolana)||void 0===s?void 0:s.notBefore)?[`Not Before: ${g.signInWithSolana.notBefore}`]:[],...(null===(a=null==g?void 0:g.signInWithSolana)||void 0===a?void 0:a.expirationTime)?[`Expiration Time: ${g.signInWithSolana.expirationTime}`]:[],...(null===(o=null==g?void 0:g.signInWithSolana)||void 0===o?void 0:o.chainId)?[`Chain ID: ${g.signInWithSolana.chainId}`]:[],...(null===(i=null==g?void 0:g.signInWithSolana)||void 0===i?void 0:i.nonce)?[`Nonce: ${g.signInWithSolana.nonce}`]:[],...(null===(l=null==g?void 0:g.signInWithSolana)||void 0===l?void 0:l.requestId)?[`Request ID: ${g.signInWithSolana.requestId}`]:[],...(null===(d=null===(c=null==g?void 0:g.signInWithSolana)||void 0===c?void 0:c.resources)||void 0===d?void 0:d.length)?["Resources",...g.signInWithSolana.resources.map(e=>`- ${e}`)]:[]].join("\n");const e=await y.signMessage((new TextEncoder).encode(p),"utf8");if(!(e&&e instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");f=e}}try{const{data:t,error:r}=await ps(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:p,signature:Kn(f)},(null===(u=e.options)||void 0===u?void 0:u.captchaToken)?{gotrue_meta_security:{captcha_token:null===(h=e.options)||void 0===h?void 0:h.captchaToken}}:null),xform:fs});if(r)throw r;if(!t||!t.session||!t.user){const e=new Nn;return this._returnResult({data:{user:null,session:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("SIGNED_IN",t.session)),this._returnResult({data:Object.assign({},t),error:r})}catch(m){if(kn(m))return this._returnResult({data:{user:null,session:null},error:m});throw m}}async _exchangeCodeForSession(e){const t=await Qn(this.storage,`${this.storageKey}-code-verifier`),[r,n]=(null!=t?t:"").split("/");try{if(!r&&"pkce"===this.flowType)throw new In;const{data:t,error:s}=await ps(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:r},xform:fs});if(await Zn(this.storage,`${this.storageKey}-code-verifier`),s)throw s;if(!t||!t.session||!t.user){const e=new Nn;return this._returnResult({data:{user:null,session:null,redirectType:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("SIGNED_IN",t.session)),this._returnResult({data:Object.assign(Object.assign({},t),{redirectType:null!=n?n:null}),error:s})}catch(s){if(await Zn(this.storage,`${this.storageKey}-code-verifier`),kn(s))return this._returnResult({data:{user:null,session:null,redirectType:null},error:s});throw s}}async signInWithIdToken(e){try{const{options:t,provider:r,token:n,access_token:s,nonce:a}=e,o=await ps(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:n,access_token:s,nonce:a,gotrue_meta_security:{captcha_token:null==t?void 0:t.captchaToken}},xform:fs}),{data:i,error:l}=o;if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!i||!i.session||!i.user){const e=new Nn;return this._returnResult({data:{user:null,session:null},error:e})}return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),this._returnResult({data:i,error:l})}catch(t){if(kn(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async signInWithOtp(e){var t,r,n,s,a;try{if("email"in e){const{email:n,options:s}=e;let a=null,o=null;"pkce"===this.flowType&&([a,o]=await ss(this.storage,this.storageKey));const{error:i}=await ps(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:n,data:null!==(t=null==s?void 0:s.data)&&void 0!==t?t:{},create_user:null===(r=null==s?void 0:s.shouldCreateUser)||void 0===r||r,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken},code_challenge:a,code_challenge_method:o},redirectTo:null==s?void 0:s.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:i})}if("phone"in e){const{phone:t,options:r}=e,{data:o,error:i}=await ps(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:t,data:null!==(n=null==r?void 0:r.data)&&void 0!==n?n:{},create_user:null===(s=null==r?void 0:r.shouldCreateUser)||void 0===s||s,gotrue_meta_security:{captcha_token:null==r?void 0:r.captchaToken},channel:null!==(a=null==r?void 0:r.channel)&&void 0!==a?a:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:null==o?void 0:o.message_id},error:i})}throw new Cn("You must provide either an email or phone number.")}catch(o){if(await Zn(this.storage,`${this.storageKey}-code-verifier`),kn(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}}async verifyOtp(e){var t,r;try{let n,s;"options"in e&&(n=null===(t=e.options)||void 0===t?void 0:t.redirectTo,s=null===(r=e.options)||void 0===r?void 0:r.captchaToken);const{data:a,error:o}=await ps(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:s}}),redirectTo:n,xform:fs});if(o)throw o;if(!a){throw new Error("An error occurred on token verification.")}const i=a.session,l=a.user;return(null==i?void 0:i.access_token)&&(await this._saveSession(i),await this._notifyAllSubscribers("recovery"==e.type?"PASSWORD_RECOVERY":"SIGNED_IN",i)),this._returnResult({data:{user:l,session:i},error:null})}catch(n){if(kn(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithSSO(e){var t,r,n,s,a;try{let o=null,i=null;"pkce"===this.flowType&&([o,i]=await ss(this.storage,this.storageKey));const l=await ps(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:null!==(r=null===(t=e.options)||void 0===t?void 0:t.redirectTo)&&void 0!==r?r:void 0}),(null===(n=null==e?void 0:e.options)||void 0===n?void 0:n.captchaToken)?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:o,code_challenge_method:i}),headers:this.headers,xform:ys});return(null===(s=l.data)||void 0===s?void 0:s.url)&&Hn()&&!(null===(a=e.options)||void 0===a?void 0:a.skipBrowserRedirect)&&window.location.assign(l.data.url),this._returnResult(l)}catch(o){if(await Zn(this.storage,`${this.storageKey}-code-verifier`),kn(o))return this._returnResult({data:null,error:o});throw o}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:t},error:r}=e;if(r)throw r;if(!t)throw new En;const{error:n}=await ps(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return this._returnResult({data:{user:null,session:null},error:n})})}catch(e){if(kn(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const t=`${this.url}/resend`;if("email"in e){const{email:r,type:n,options:s}=e,{error:a}=await ps(this.fetch,"POST",t,{headers:this.headers,body:{email:r,type:n,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken}},redirectTo:null==s?void 0:s.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:a})}if("phone"in e){const{phone:r,type:n,options:s}=e,{data:a,error:o}=await ps(this.fetch,"POST",t,{headers:this.headers,body:{phone:r,type:n,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:null==a?void 0:a.message_id},error:o})}throw new Cn("You must provide either an email or phone number and a type")}catch(t){if(kn(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async getSession(){await this.initializePromise;return await this._acquireLock(-1,async()=>this._useSession(async e=>e))}async _acquireLock(e,t){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const e=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),r=(async()=>(await e,await t()))();return this.pendingInLock.push((async()=>{try{await r}catch(e){}})()),r}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const e=t();for(this.pendingInLock.push((async()=>{try{await e}catch(t){}})()),await e;this.pendingInLock.length;){const e=[...this.pendingInLock];await Promise.all(e),this.pendingInLock.splice(0,e.length)}return await e}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const t=await this.__loadSession();return await e(t)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",(new Error).stack);try{let e=null;const t=await Qn(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",t),null!==t&&(this._isValidSession(t)?e=t:(this._debug("#getSession()","session from storage is not val
2id"),await this._removeSession())),!e)return{data:{session:null},error:null};const r=!!e.expires_at&&1e3*e.expires_at-Date.now()<yn;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",e.expires_at),!r){if(this.userStorage){const t=await Qn(this.userStorage,this.storageKey+"-user");(null==t?void 0:t.user)?e.user=t.user:e.user=ls()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const t={value:this.suppressGetSessionWarning};e.user=function(e,t){return new Proxy(e,{get:(e,r,n)=>{if("__isInsecureUserWarningProxy"===r)return!0;if("symbol"==typeof r){const t=r.toString();if("Symbol(Symbol.toPrimitive)"===t||"Symbol(Symbol.toStringTag)"===t||"Symbol(util.inspect.custom)"===t||"Symbol(nodejs.util.inspect.custom)"===t)return Reflect.get(e,r,n)}return t.value||"string"!=typeof r||(t.value=!0),Reflect.get(e,r,n)}})}(e.user,t),t.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:n,error:s}=await this._callRefreshToken(e.refresh_token);return s?this._returnResult({data:{session:null},error:s}):this._returnResult({data:{session:n},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;const t=await this._acquireLock(-1,async()=>await this._getUser());return t.data.user&&(this.suppressGetSessionWarning=!0),t}async _getUser(e){try{return e?await ps(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:gs}):await this._useSession(async e=>{var t,r,n;const{data:s,error:a}=e;if(a)throw a;return(null===(t=s.session)||void 0===t?void 0:t.access_token)||this.hasCustomAuthorizationHeader?await ps(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:null!==(n=null===(r=s.session)||void 0===r?void 0:r.access_token)&&void 0!==n?n:void 0,xform:gs}):{data:{user:null},error:new En}})}catch(t){if(kn(t))return function(e){return kn(e)&&"AuthSessionMissingError"===e.name}(t)&&(await this._removeSession(),await Zn(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:t});throw t}}async updateUser(e,t={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,t))}async _updateUser(e,t={}){try{return await this._useSession(async r=>{const{data:n,error:s}=r;if(s)throw s;if(!n.session)throw new En;const a=n.session;let o=null,i=null;"pkce"===this.flowType&&null!=e.email&&([o,i]=await ss(this.storage,this.storageKey));const{data:l,error:c}=await ps(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:null==t?void 0:t.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:o,code_challenge_method:i}),jwt:a.access_token,xform:gs});if(c)throw c;return a.user=l.user,await this._saveSession(a),await this._notifyAllSubscribers("USER_UPDATED",a),this._returnResult({data:{user:a.user},error:null})})}catch(r){if(await Zn(this.storage,`${this.storageKey}-code-verifier`),kn(r))return this._returnResult({data:{user:null},error:r});throw r}}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new En;const t=Date.now()/1e3;let r=t,n=!0,s=null;const{payload:a}=ts(e.access_token);if(a.exp&&(r=a.exp,n=r<=t),n){const{data:t,error:r}=await this._callRefreshToken(e.refresh_token);if(r)return this._returnResult({data:{user:null,session:null},error:r});if(!t)return{data:{user:null,session:null},error:null};s=t}else{const{data:n,error:a}=await this._getUser(e.access_token);if(a)throw a;s={access_token:e.access_token,refresh_token:e.refresh_token,user:n.user,token_type:"bearer",expires_in:r-t,expires_at:r},await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)}return this._returnResult({data:{user:s.user,session:s},error:null})}catch(t){if(kn(t))return this._returnResult({data:{session:null,user:null},error:t});throw t}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async t=>{var r;if(!e){const{data:n,error:s}=t;if(s)throw s;e=null!==(r=n.session)&&void 0!==r?r:void 0}if(!(null==e?void 0:e.refresh_token))throw new En;const{data:n,error:s}=await this._callRefreshToken(e.refresh_token);return s?this._returnResult({data:{user:null,session:null},error:s}):n?this._returnResult({data:{user:n.user,session:n},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(t){if(kn(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async _getSessionFromURL(e,t){try{if(!Hn())throw new An("No browser detected.");
vendor: 27,883 bytes, line 2
2if(e.error||e.error_description||e.error_code)throw new An(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(t){case"implicit":if("pkce"===this.flowType)throw new Rn("Not a valid PKCE flow url.");break;case"pkce":if("implicit"===this.flowType)throw new An("Not a valid implicit grant flow url.")}if("pkce"===t){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new Rn("No code detected.");const{data:t,error:r}=await this._exchangeCodeForSession(e.code);if(r)throw r;const n=new URL(window.location.href);return n.searchParams.delete("code"),window.history.replaceState(window.history.state,"",n.toString()),{data:{session:t.session,redirectType:null},error:null}}const{provider_token:r,provider_refresh_token:n,access_token:s,refresh_token:a,expires_in:o,expires_at:i,token_type:l}=e;if(!(s&&o&&a&&l))throw new An("No session defined in URL");const c=Math.round(Date.now()/1e3),d=parseInt(o);let u=c+d;i&&(u=parseInt(i));const{data:h,error:p}=await this._getUser(s);if(p)throw p;const f={provider_token:r,provider_refresh_token:n,access_token:s,expires_in:d,expires_at:u,refresh_token:a,token_type:l,user:h.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:f,redirectType:e.type},error:null})}catch(r){if(kn(r))return this._returnResult({data:{session:null,redirectType:null},error:r});throw r}}_isImplicitGrantCallback(e){return"function"==typeof this.detectSessionInUrl?this.detectSessionInUrl(new URL(window.location.href),e):Boolean(e.access_token||e.error_description)}async _isPKCECallback(e){const t=await Qn(this.storage,`${this.storageKey}-code-verifier`);return!(!e.code||!t)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async t=>{var r;const{data:n,error:s}=t;if(s)return this._returnResult({error:s});const a=null===(r=n.session)||void 0===r?void 0:r.access_token;if(a){const{error:t}=await this.admin.signOut(a,e);if(t&&(!function(e){return kn(e)&&"AuthApiError"===e.name}(t)||404!==t.status&&401!==t.status&&403!==t.status))return this._returnResult({error:t})}return"others"!==e&&(await this._removeSession(),await Zn(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const t=Symbol("auth-callback"),r={id:t,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",t),this.stateChangeEmitters.delete(t)}};return this._debug("#onAuthStateChange()","registered callback with id",t),this.stateChangeEmitters.set(t,r),(async()=>{await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(t)})})(),{data:{subscription:r}}}async _emitInitialSession(e){return await this._useSession(async t=>{var r,n;try{const{data:{session:n},error:s}=t;if(s)throw s;await(null===(r=this.stateChangeEmitters.get(e))||void 0===r?void 0:r.callback("INITIAL_SESSION",n)),this._debug("INITIAL_SESSION","callback id",e,"session",n)}catch(s){await(null===(n=this.stateChangeEmitters.get(e))||void 0===n?void 0:n.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",s)}})}async resetPasswordForEmail(e,t={}){let r=null,n=null;"pkce"===this.flowType&&([r,n]=await ss(this.storage,this.storageKey,!0));try{return await ps(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:r,code_challenge_method:n,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(s){if(await Zn(this.storage,`${this.storageKey}-code-verifier`),kn(s))return this._returnResult({data:null,error:s});throw s}}async getUserIdentities(){var e;try{const{data:t,error:r}=await this.getUser();if(r)throw r;return this._returnResult({data:{identities:null!==(e=t.user.identities)&&void 0!==e?e:[]},error:null})}catch(t){if(kn(t))return this._returnResult({data:null,error:t});throw t}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var t;try{const{data:r,error:n}=await this._useSession(async t=>{var r,n,s,a,o;const{data:i,error:l}=t;if(l)throw l;const c=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:null===(r=e.options)||void 0===r?void 0:r.redirectTo,scopes:null===(n=e.options)||void 0===n?void 0:n.scopes,queryParams:null===(s=e.options)||void 0===s?void 0:s.queryParams,skipBrowserRedirect:!0});return await ps(this.fetch,"GET",c,{headers:this.headers,jwt:null!==(o=null===(a=i.session)||void 0===a?void 0:a.access_token)&&void 0!==o?o:void 0})});if(n)throw n;return Hn()&&!(null===(t=e.options)||void 0===t?void 0:t.skipBrowserRedirect)&&window.location.assign(null==r?void 0:r.url),this._returnResult({data:{provider:e.provider,url:null==r?void 0:r.url},error:null})}catch(r){if(kn(r))return this._returnResult({data:{provider:e.provider,url:null},error:r});throw r}}async linkIdentityIdToken(e){return await this._useSession(async t=>{var r;try{const{error:n,data:{session:s}}=t;if(n)throw n;const{options:a,provider:o,token:i,access_token:l,nonce:c}=e,d=await ps(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:null!==(r=null==s?void 0:s.access_token)&&void 0!==r?r:void 0,body:{provider:o,id_token:i,access_token:l,nonce:c,link_identity:!0,gotrue_meta_security:{captcha_token:null==a?void 0:a.captchaToken}},xform:fs}),{data:u,error:h}=d;return h?this._returnResult({data:{user:null,session:null},error:h}):u&&u.session&&u.user?(u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("USER_UPDATED",u.session)),this._returnResult({data:u,error:h})):this._returnResult({data:{user:null,session:null},error:new Nn})}catch(n){if(await Zn(this.storage,`${this.storageKey}-code-verifier`),kn(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}})}async unlinkIdentity(e){try{return await this._useSession(async t=>{var r,n;const{data:s,error:a}=t;if(a)throw a;return await ps(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:null!==(n=null===(r=s.session)||void 0===r?void 0:r.access_token)&&void 0!==n?n:void 0})})}catch(t){if(kn(t))return this._returnResult({data:null,error:t});throw t}}async _refreshAccessToken(e){const t=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(t,"begin");try{const s=Date.now();return await(r=async r=>(r>0&&await async function(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}(200*Math.pow(2,r-1)),this._debug(t,"refreshing attempt",r),await ps(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:fs})),n=(e,t)=>{const r=200*Math.pow(2,e);return t&&Pn(t)&&Date.now()+r-s<gn},new Promise((e,t)=>{(async()=>{for(let a=0;a<1/0;a++)try{const t=await r(a);if(!n(a,null,t))return void e(t)}catch(s){if(!n(a,s))return void t(s)}})()}))}catch(s){if(this._debug(t,"error",s),kn(s))return this._returnResult({data:{session:null,user:null},error:s});throw s}finally{this._debug(t,"end")}var r,n}_isValidSession(e){return"object"==typeof e&&null!==e&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,t){const r=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:t.redirectTo,scopes:t.scopes,queryParams:t.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",t,"url",r),Hn()&&!t.skipBrowserRedirect&&window.location.assign(r),{data:{provider:e,url:r},error:null}}async _recoverAndRefresh(){var e,t;const r="#_recoverAndRefresh()";this._debug(r,"begin");try{const s=await Qn(this.storage,this.storageKey);if(s&&this.userStorage){let t=await Qn(this.userStorage,this.storageKey+"-user");this.storage.isServer||!Object.is(this.storage,this.userStorage)||t||(t={user:s.user},await Xn(this.userStorage,this.storageKey+"-user",t)),s.user=null!==(e=null==t?void 0:t.user)&&void 0!==e?e:ls()}else if(s&&!s.user&&!s.user){const e=await Qn(this.storage,this.storageKey+"-user");e&&(null==e?void 0:e.user)?(s.user=e.user,await Zn(this.storage,this.storageKey+"-user"),await Xn(this.storage,this.storageKey,s)):s.user=ls()}if(this._debug(r,"session from storage",s),!this._isValidSession(s))return this._debug(r,"session is not valid"),void(null!==s&&await this._removeSession());const a=1e3*(null!==(t=s.expires_at)&&void 0!==t?t:1/0)-Date.now()<yn;if(this._debug(r,`session has${a?"":" not"} expired with margin of 90000s`),a){if(this.autoRefreshToken&&s.refresh_token){const{error:e}=await this._callRefreshToken(s.refresh_token);e&&(Pn(e)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",e),await this._removeSession()))}}else if(s.user&&!0===s.user.__isUserNotAvailableProxy)try{const{data:e,error:t}=await this._getUser(s.access_token);!t&&(null==e?void 0:e.user)?(s.user=e.user,await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(n){this._debug(r,"error getting user data, skipping SIGNED_IN notification",n)}else await this._notifyAllSubscribers("SIGNED_IN",s)}catch(s){return void this._debug(r,"error",s)}finally{this._debug(r,"end")}}async _callRefreshToken(e){var t,r;if(!e)throw new En;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const n=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(n,"begin");try{this.refreshingDeferred=new es;const{data:t,error:r}=await this._refreshAccessToken(e);if(r)throw r;if(!t.session)throw new En;await this._saveSession(t.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",t.session);const n={data:t.session,error:null};return this.refreshingDeferred.resolve(n),n}catch(s){if(this._debug(n,"error",s),kn(s)){const e={data:null,error:s};return Pn(s)||await this._removeSession(),null===(t=this.refreshingDeferred)||void 0===t||t.resolve(e),e}throw null===(r=this.refreshingDeferred)||void 0===r||r.reject(s),s}finally{this.refreshingDeferred=null,this._debug(n,"end")}}async _notifyAllSubscribers(e,t,r=!0){const n=`#_notifyAllSubscribers(${e})`;this._debug(n,"begin",t,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:e,session:t});const n=[],s=Array.from(this.stateChangeEmitters.values()).map(async r=>{try{await r.callback(e,t)}catch(s){n.push(s)}});if(await Promise.all(s),n.length>0){for(let e=0;e<n.length;e+=1);throw n[0]}}finally{this._debug(n,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await Zn(this.storage,`${this.storageKey}-code-verifier`);const t=Object.assign({},e),r=t.user&&!0===t.user.__isUserNotAvailableProxy;if(this.userStorage){!r&&t.user&&await Xn(this.userStorage,this.storageKey+"-user",{user:t.user});const e=Object.assign({},t);delete e.user;const n=cs(e);await Xn(this.storage,this.storageKey,n)}else{const e=cs(t);await Xn(this.storage,this.storageKey,e)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await Zn(this.storage,this.storageKey),await Zn(this.storage,this.storageKey+"-code-verifier"),await Zn(this.storage,this.storageKey+"-user"),this.userStorage&&await Zn(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&Hn()&&(null===window||void 0===window?void 0:window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}catch(t){}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),gn);this.autoRefreshTicker=e,e&&"object"==typeof e&&"function"==typeof e.unref?e.unref():"undefined"!=typeof Deno&&"function"==typeof Deno.unrefTimer&&Deno.unrefTimer(e),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const t=Date.now();try{return await this._useSession(async e=>{const{data:{session:r}}=e;if(!r||!r.refresh_token||!r.expires_at)return void this._debug("#_autoRefreshTokenTick()","no session");const n=Math.floor((1e3*r.expires_at-t)/gn);this._debug("#_autoRefreshTokenTick()",`access token expires in ${n} ticks, a tick lasts 30000ms, refresh threshold is 3 ticks`),n<=3&&await this._callRefreshToken(r.refresh_token)})}catch(e){}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(!(e.isAcquireTimeout||e instanceof js))throw e;this._debug("auto refresh token tick lock not available")}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Hn()||!(null===window||void 0===window?void 0:window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),null===window||void 0===window||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){}}async _onVisibilityChanged(e){const t=`#_onVisibilityChanged(${e})`;this._debug(t,"visibilityState",document.visibilityState),"visible"===document.visibilityState?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(-1,async()=>{"visible"===document.visibilityState?await this._recoverAndRefresh():this._debug(t,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting")}))):"hidden"===document.visibilityState&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,r){const n=[`provider=${encodeURIComponent(t)}`];if((null==r?void 0:r.redirectTo)&&n.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),(null==r?void 0:r.scopes)&&n.push(`scopes=${encodeURIComponent(r.scopes)}`),"pkce"===this.flowType){const[e,t]=await ss(this.storage,this.storageKey),r=new URLSearchParams({code_challenge:`${encodeURIComponent(e)}`,code_challenge_method:`${encodeURIComponent(t)}`});n.push(r.toString())}if(null==r?void 0:r.queryParams){const e=new URLSearchParams(r.queryParams);n.push(e.toString())}return(null==r?void 0:r.skipBrowserRedirect)&&n.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${e}?${n.join("&")}`}async _unenroll(e){try{return await this._useSession(async t=>{var r;const{data:n,error:s}=t;return s?this._returnResult({data:null,error:s}):await ps(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:null===(r=null==n?void 0:n.session)||void 0===r?void 0:r.access_token})})}catch(t){if(kn(t))return this._returnResult({data:null,error:t});throw t}}async _enroll(e){try{return await this._useSession(async t=>{var r,n;const{data:s,error:a}=t;if(a)return this._returnResult({data:null,error:a});const o=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},"phone"===e.factorType?{phone:e.phone}:"totp"===e.factorType?{issuer:e.issuer}:{}),{data:i,error:l}=await ps(this.fetch,"POST",`${this.url}/factors`,{body:o,headers:this.headers,jwt:null===(r=null==s?void 0:s.session)||void 0===r?void 0:r.access_token});return l?this._returnResult({data:null,error:l}):("totp"===e.factorType&&"totp"===i.type&&(null===(n=null==i?void 0:i.totp)||void 0===n?void 0:n.qr_code)&&(i.totp.qr_code=`data:image/svg+xml;utf-8,${i.totp.qr_code}`),this._returnResult({data:i,error:null}))})}catch(t){if(kn(t))return this._returnResult({data:null,error:t});throw t}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async t=>{var r;const{data:n,error:s}=t;if(s)return this._returnResult({data:null,error:s});const a=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:"create"===e.webauthn.type?Ds(e.webauthn.credential_response):Ls(e.webauthn.credential_response)})}:{code:e.code}),{data:o,error:i}=await ps(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:a,headers:this.headers,jwt:null===(r=null==n?void 0:n.session)||void 0===r?void 0:r.access_token});return i?this._returnResult({data:null,error:i}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+o.expires_in},o)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",o),this._returnResult({data:o,error:i}))})}catch(t){if(kn(t))return this._returnResult({data:null,error:t});throw t}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async t=>{var r;const{data:n,error:s}=t;if(s)return this._returnResult({data:null,error:s});const a=await ps(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:null===(r=null==n?void 0:n.session)||void 0===r?void 0:r.access_token});if(a.error)return a;const{data:o}=a;if("webauthn"!==o.type)return{data:o,error:null};switch(o.webauthn.type){case"create":return{data:Object.assign(Object.assign({},o),{webauthn:Object.assign(Object.assign({},o.webauthn),{credential_options:Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:Ps(o.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},o),{webauthn:Object.assign(Object.assign({},o.webauthn),{credential_options:Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:$s(o.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(t){if(kn(t))return this._returnResult({data:null,error:t});throw t}})}async _challengeAndVerify(e){const{data:t,error:r}=await this._challenge({factorId:e.factorId});return r?this._returnResult({data:null,error:r}):await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){var e;const{data:{user:t},error:r}=await this.getUser();if(r)return{data:null,error:r};const n={all:[],phone:[],totp:[],webauthn:[]};for(const s of null!==(e=null==t?void 0:t.factors)&&void 0!==e?e:[])n.all.push(s),"verified"===s.status&&n[s.factor_type].push(s);return{data:n,error:null}}async _getAuthenticatorAssuranceLevel(){var e,t;const{data:{session:r},error:n}=await this.getSession();if(n)return this._returnResult({data:null,error:n});if(!r)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:s}=ts(r.access_token);let a=null;s.aal&&(a=s.aal);let o=a;(null!==(t=null===(e=r.user.factors)||void 0===e?void 0:e.filter(e=>"verified"===e.status))&&void 0!==t?t:[]).length>0&&(o="aal2");return{data:{currentLevel:a,nextLevel:o,currentAuthenticationMethods:s.amr||[]},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async t=>{const{data:{session:r},error:n}=t;return n?this._returnResult({data:null,error:n}):r?await ps(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:r.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new En})})}catch(t){if(kn(t))return this._returnResult({data:null,error:t});throw t}}async _approveAuthorization(e,t){try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!n)return this._returnResult({data:null,error:new En});const a=await ps(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:n.access_token,body:{action:"approve"},xform:e=>({data:e,error:null})});return a.data&&a.data.redirect_url&&Hn()&&!(null==t?void 0:t.skipBrowserRedirect)&&window.location.assign(a.data.redirect_url),a})}catch(r){if(kn(r))return this._returnResult({data:null,error:r});throw r}}async _denyAuthorization(e,t){try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!n)return this._returnResult({data:null,error:new En});const a=await ps(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:n.access_token,body:{action:"deny"},xform:e=>({data:e,error:null})});return a.data&&a.data.redirect_url&&Hn()&&!(null==t?void 0:t.skipBrowserRedirect)&&window.location.assign(a.data.redirect_url),a})}catch(r){if(kn(r))return this._returnResult({data:null,error:r});throw r}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:t},error:r}=e;return r?this._returnResult({data:null,error:r}):t?await ps(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:t.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new En})})}catch(e){if(kn(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async t=>{const{data:{session:r},error:n}=t;return n?this._returnResult({data:null,error:n}):r?(await ps(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new En})})}catch(t){if(kn(t))return this._returnResult({data:null,error:t});throw t}}async fetchJwk(e,t={keys:[]}){let r=t.keys.find(t=>t.kid===e);if(r)return r;const n=Date.now();if(r=this.jwks.keys.find(t=>t.kid===e),r&&this.jwks_cached_at+6e5>n)return r;const{data:s,error:a}=await ps(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(a)throw a;return s.keys&&0!==s.keys.length?(this.jwks=s,this.jwks_cached_at=n,r=s.keys.find(t=>t.kid===e),r||null):null}async getClaims(e,t={}){try{let r=e;if(!r){const{data:e,error:t}=await this.getSession();if(t||!e.session)return this._returnResult({data:null,error:t});r=e.session.access_token}const{header:n,payload:s,signature:a,raw:{header:o,payload:i}}=ts(r);(null==t?void 0:t.allowExpired)||function(e){if(!e)throw new Error("Missing exp claim");if(e<=Math.floor(Date.now()/1e3))throw new Error("JWT has expired")}(s.exp);const l=n.alg&&!n.alg.startsWith("HS")&&n.kid&&"crypto"in globalThis&&"subtle"in globalThis.crypto?await this.fetchJwk(n.kid,(null==t?void 0:t.keys)?{keys:t.keys}:null==t?void 0:t.jwks):null;if(!l){const{error:e}=await this.getUser(r);if(e)throw e;return{data:{claims:s,header:n,signature:a},error:null}}const c=function(e){switch(e){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}(n.alg),d=await crypto.subtle.importKey("jwk",l,c,!0,["verify"]);if(!(await crypto.subtle.verify(c,d,a,Vn(`${o}.${i}`))))throw new Dn("Invalid JWT signature");return{data:{claims:s,header:n,signature:a},error:null}}catch(r){if(kn(r))return this._returnResult({data:null,error:r});throw r}}}Hs.nextInstanceID={};const Gs=Hs;let Js="";Js="undefined"!=typeof Deno?"deno":"undefined"!=typeof document?"web":"undefined"!=typeof navigator&&"ReactNative"===navigator.product?"react-native":"node";const Ys={headers:{"X-Client-Info":`supabase-js-${Js}/2.89.0`}},Xs={schema:"public"},Qs={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Zs={};function ea(e){return(ea="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ta(e){var t=function(e,t){if("object"!=ea(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!=ea(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==ea(t)?t:t+""}function ra(e,t,r){return(t=ta(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function na(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function sa(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?na(Object(r),!0).forEach(function(t){ra(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):na(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}const aa=(e,t,r)=>{const n=(e=>e?(...t)=>e(...t):(...e)=>fetch(...e))(r),s=Headers;return async(r,a)=>{var o;const i=null!==(o=await t())&&void 0!==o?o:e;let l=new s(null==a?void 0:a.headers);return l.has("apikey")||l.set("apikey",e),l.has("Authorization")||l.set("Authorization",`Bearer ${i}`),n(r,sa(sa({},a),{},{headers:l}))}};var oa=class extends Gs{constructor(e){super(e)}},ia=class{constructor(e,t,r){var n,s;this.supabaseUrl=e,this.supabaseKey=t;const a=function(e){const t=null==e?void 0:e.trim();if(!t)throw new Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL((r=t).endsWith("/")?r:r+"/")}catch(n){throw Error("Invalid supabaseUrl: Provided URL is malformed.")}var r}(e);if(!t)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",a),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",a),this.storageUrl=new URL("storage/v1",a),this.functionsUrl=new URL("functions/v1",a);const o=`sb-${a.hostname.split(".")[0]}-auth-token`,i=function(e,t){var r,n;const{db:s,auth:a,realtime:o,global:i}=e,{db:l,auth:c,realtime:d,global:u}=t,h={db:sa(sa({},l),s),auth:sa(sa({},c),a),realtime:sa(sa({},d),o),storage:{},global:sa(sa(sa({},u),i),{},{headers:sa(sa({},null!==(r=null==u?void 0:u.headers)&&void 0!==r?r:{}),null!==(n=null==i?void 0:i.headers)&&void 0!==n?n:{})}),accessToken:async()=>""};return e.accessToken?h.accessToken=e.accessToken:delete h.accessToken,h}(null!=r?r:{},{db:Xs,realtime:Zs,auth:sa(sa({},Qs),{},{storageKey:o}),global:Ys});var l;(this.storageKey=null!==(n=i.auth.storageKey)&&void 0!==n?n:"",this.headers=null!==(s=i.global.headers)&&void 0!==s?s:{},i.accessToken)?(this.accessToken=i.accessToken,this.auth=new Proxy({},{get:(e,t)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(t)} is not possible`)}})):this.auth=this._initSupabaseAuthClient(null!==(l=i.auth)&&void 0!==l?l:{},this.headers,i.global.fetch);this.fetch=aa(t,this._getAccessToken.bind(this),i.global.fetch),this.realtime=this._initRealtimeClient(sa({headers:this.headers,accessToken:this._getAccessToken.bind(this)},i.realtime)),this.accessToken&&this.accessToken().then(e=>this.realtime.setAuth(e)).catch(e=>{}),this.rest=new jt(new URL("rest/v1",a).href,{headers:this.headers,schema:i.db.schema,fetch:this.fetch}),this.storage=new fn(this.storageUrl.href,this.headers,this.fetch,null==r?void 0:r.storage),i.accessToken||this._listenForAuthEvents()}get functions(){return new yt(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,r)}
2channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e,t,r=this;if(r.accessToken)return await r.accessToken();const{data:n}=await r.auth.getSession();return null!==(e=null===(t=n.session)||void 0===t?void 0:t.access_token)&&void 0!==e?e:r.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:n,userStorage:s,storageKey:a,flowType:o,lock:i,debug:l,throwOnError:c},d,u){const h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new oa({url:this.authUrl.href,headers:sa(sa({},h),d),storageKey:a,autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:n,userStorage:s,flowType:o,lock:i,debug:l,throwOnError:c,fetch:u,hasCustomAuthorizationHeader:Object.keys(this.headers).some(e=>"authorization"===e.toLowerCase())})}_initRealtimeClient(e){return new fr(this.realtimeUrl.href,sa(sa({},e),{},{params:sa(sa({},{apikey:this.supabaseKey}),null==e?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",null==t?void 0:t.access_token)})}_handleTokenChanged(e,t,r){"TOKEN_REFRESHED"!==e&&"SIGNED_IN"!==e||this.changedAccessToken===r?"SIGNED_OUT"===e&&(this.realtime.setAuth(),"STORAGE"==t&&this.auth.signOut(),this.changedAccessToken=void 0):(this.changedAccessToken=r,this.realtime.setAuth(r))}};!function(){if("undefined"!=typeof window)return!1;if("undefined"==typeof process)return!1;const e=process.version;if(null==e)return!1;const t=e.match(/^v(\d+)\./);!!t&&parseInt(t[1],10)}();const la=(ca="https://gxmkplmlycgiuwtienix.supabase.co",da="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Imd4bWtwbG1seWNnaXV3dGllbml4Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjY0OTE1MjYsImV4cCI6MjA4MjA2NzUyNn0.6dcemEpR79EJB7f8-OPvBqJqxIxUwrybkmfDWAxSHe8",ua={auth:{storage:function(){var e,t;if("undefined"==typeof window)return;const r=location.hostname,n="[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}",s=["lovableproject.com","lovableproject-dev.com","lovable.app","gpt-eng.com","gptengineer.run"].some(e=>r===e||r.endsWith("."+e))?(null==(e=r.match(new RegExp("^(?:id-preview(?:-[a-z0-9]+)?|project)--("+n+")(?:-dev)?(?=\\.|$)","i")))?void 0:e[1])??(null==(t=r.match(new RegExp("^("+n+")(?=[.-])","i")))?void 0:t[1]):void 0,a=window.parent&&window.parent!==window;if(!s||!a)return localStorage;const o=r.endsWith(".lovableproject-dev.com")||r.endsWith(".gpt-eng.com"),i=o?/^https:\/\/([a-z0-9-]+\.)*(lovable\.dev|gptengineer\.app)$|^http:\/\/localhost:3000$/:/^https:\/\/([a-z0-9-]+\.)*(lovable\.dev|gptengineer\.app)$/,l=location.ancestorOrigins&&location.ancestorOrigins[0]||(document.referrer?new URL(document.referrer).origin:""),c=l&&i.test(l)?[l]:o?["https://lovable.dev","http://localhost:3000"]:["https://lovable.dev"],d=(e,t,r)=>new Promise(n=>{const a=Math.random().toString(36).slice(2)+Date.now().toString(36);let o,i=!1;const l=e=>{i||(i=!0,clearTimeout(o),window.removeEventListener("message",d),n(e))},d=e=>{if(c.indexOf(e.origin)<0)return;const t=e.data;t&&"lovable-preview-auth:result"===t.type&&t.requestId===a&&l(t)};window.addEventListener("message",d);const u={type:e,requestId:a,projectId:s,key:t};void 0!==r&&(u.value=r);for(const e of c)window.parent.postMessage(u,e);o=setTimeout(()=>l(null),2e3)});let u=!0;return{getItem:async e=>{let t=await d("lovable-preview-auth:get",e);return!t&&u&&(await new Promise(e=>setTimeout(e,250)),t=await d("lovable-preview-auth:get",e)),u=!1,t&&t.ok&&"string"==typeof t.value?""===t.value?(localStorage.removeItem(e),null):t.value:localStorage.getItem(e)},setItem:(e,t)=>(localStorage.setItem(e,t),d("lovable-preview-auth:set",e,t).then(r=>{r&&r.ok&&"string"==typeof r.value&&localStorage.getItem(e)===t&&(""===r.value?localStorage.removeItem(e):localStorage.setItem(e,r.value))})),removeItem:e=>(localStorage.removeItem(e),d("lovable-preview-auth:remove",e).then(()=>{}))}}(),persistSession:!0,autoRefreshToken:!0}},new ia(ca,da,ua));var ca,da,ua;const ha={siteName:"1ADisplay",siteUrl:"https://1adisplay.com",defaultTitle:"1ADisplay | Premium Banners, Flags & Display Stands",defaultDescription:"Professional advertising and display products with custom printing. Premium banners, flags, stands, and event tents. Fast delivery & bulk pricing available.",defaultImage:"https://storage.googleapis.com/gpt-engineer-file-uploads/zb1wCKfjTBhg4ZdUesRwzG43kfk2/social-images/social-1767955619760-1a-Display-New-logo1A.png",twitterHandle:"@1ADisplay",locale:"en_US"},pa={name:"1ADisplay",legalName:"1A Display LLC",url:"https://1adisplay.com",logo:"https://storage.googleapis.com/gpt-engineer-file-uploads/zb1wCKfjTBhg4ZdUesRwzG43kfk2/social-images/social-1767955619760-1a-Display-New-logo1A.png",email:"[email protected]",phone:"+1-858-863-0275",address:{streetAddress:"5965 Village Way E105-124",addressLocality:"San Diego",addressRegion:"CA",postalCode:"92130",addressCountry:"US"},sameAs:["https://www.facebook.com/1adisplay","https://www.instagram.com/1adisplay","https://www.linkedin.com/company/1adisplay"],description:"1ADisplay is a leading provider of premium banners, flags, display stands, and custom-printed signage for trade shows, events, and businesses across the United States.",foundingDate:"2004"},fa={home:{title:"1ADisplay | Premium Banners, Flags & Display Stands",description:"Professional advertising and display products with custom printing. Premium banners, flags, stands, and event tents. Fast delivery & bulk pricing available."},product:{titleTemplate:e=>`${e} | Custom Printing | 1ADisplay`,descriptionTemplate:(e,t)=>
2`Buy ${e} with custom printing. ${t}. Bulk discounts available.`},auth:{title:"Sign In | 1ADisplay Admin",description:"Sign in to your 1ADisplay admin account to manage orders and quotes."},notFound:{title:"Page Not Found | 1ADisplay",description:"The page you're looking for doesn't exist. Browse our premium display products."},about:{title:"About Us | 1ADisplay - Your Trusted Display Partner",description:"Learn about 1ADisplay - your trusted source for premium banners, flags, and display stands. Quality products, fast shipping, and expert customer service."},contact:{title:"Contact Us | 1ADisplay - Get Help & Support",description:"Have questions? Contact the 1ADisplay team for help with orders, custom quotes, or product questions. We're here to help!"},faq:{title:"Frequently Asked Questions | 1ADisplay",description:"Find answers to common questions about ordering, shipping, returns, and custom printing at 1ADisplay. Get the info you need fast."},shipping:{title:"Shipping Information | 1ADisplay - Fast & Reliable Delivery",description:"Learn about 1ADisplay shipping options, delivery times, and tracking. Free shipping on orders over $99. Fast turnaround available."},returns:{title:"Returns & Refunds Policy | 1ADisplay",description:"100% satisfaction guaranteed. Learn about our hassle-free returns and refunds policy at 1ADisplay. Easy 30-day returns."},privacy:{title:"Privacy Policy | 1ADisplay",description:"Read 1ADisplay's privacy policy. Learn how we protect your personal information and data when you shop with us."},terms:{title:"Terms of Service | 1ADisplay",description:"Review 1ADisplay's terms of service. Understand the terms and conditions for using our website and purchasing products."},clearance:{title:"Clearance Sale | Up to 50% Off | 1A Display",description:"Shop our clearance sale for amazing deals on custom banners, flags, trade show displays, and more. Limited quantities at discounted prices!"},products:{title:"All Products | 1A Display - Custom Banners, Flags & Trade Show Displays",description:"Browse our complete collection of custom banners, advertising flags, trade show displays, and promotional products. High-quality printing with fast turnaround."}},ma={heroTitleLead:"Your Trusted Partner in ",heroTitleHighlight:"Effective Visual Advertising",heroText:"Visual advertising is indispensable to better exposure and enhanced sales of your business. At 1ADisplay, we have created a complete line-up of marketing tools that are valuable for giving your brand a powerful stance in the marketplace.",missionLabel:"Our Mission",missionTitle:"Your Reliable Marketing Partner",missionText:"We aspire to be your reliable partner in all phases of your marketing campaign by offering an array of custom promotional products at affordable prices. Our prime objective is to make sure that our customers are successful in achieving the marketing goals of their business.",missionPoints:["Custom promotional products at affordable prices","Complete line-up of marketing tools","Expert support for your marketing campaign","Solutions that match your requirements"],brandName:"1A Display",brandTagline:"Your Visual Advertising Partner",offeringsLabel:"Our Offerings",offeringsTitle:"Find the Ideal Marketing Tools",offeringsText:"Whether it is a fully fledged marketing roll out, inflatable advertising products, a branding activation, or pop up banners, at 1ADisplay, we make sure that you find the ideal marketing tools matching your requirements.",values:[{key:"quality",title:"Quality First",description:"We use only premium materials and state-of-the-art printing technology to ensure your displays look professional and last."},{key:"speed",title:"Fast Turnaround",description:"Need it quick? We offer same-day production and expedited shipping to meet your deadlines."},{key:"customer",title:"Customer Focused",description:"Our team of display experts is here to help you every step of the way, from design to delivery."},{key:"results",title:"Results Driven",description:"We help businesses get noticed. Our products are designed to attract attention and drive results."}],journeyLabel:"Our Journey",journeyTitle:"Growing With Our Customers",milestones:[{year:"2015",title:"Founded",description:"Started with a mission to make professional displays accessible to every business."},{year:"2018",title:"10K Customers",description:"Reached our first 10,000 satisfied customers milestone."},{year:"2021",title:"Nationwide Shipping",description:"Expanded to offer fast shipping to all 50 states."},{year:"2024",title:"Industry Leader",description:"Recognized as a top provider of custom display solutions."}]},ga=pa.address,ya={heroTitle:"Get in Touch",heroText:"Have questions about our products or need help with an order? We're here to help!",infoTitle:"Contact Information",infoText:"Reach out to us through any of these channels. We typically respond within 24 hours on business days.",info:[{key:"email",label:"Email Us",value:pa.email,href:`mailto:${pa.email}`,description:"We'll respond within 24 hours"},{key:"phone",label:"Call Us",value:pa.phone,href:`tel:${pa.phone}`,description:"Mon-Fri, 9am-6pm PT"},{key:"location",label:"Location",value:`${ga.streetAddress}, ${ga.addressLocality}, ${ga.addressRegion} ${ga.postalCode}`,href:null,description:"Serving customers nationwide"},{key:"hours",label:"Business Hours",value:"Mon-Fri: 9am-6pm PT",href:null,description:"Weekend orders processed Monday"}],formTitle:"Send Us a Message"},va={heroTitle:"Frequently Asked Questions",heroText:"Find quick answers to common questions about our products, ordering process, and policies.",ctaTitle:"Still have questions?",ctaText:"Our team is here to help. Reach out and we'll get back to you within 24 hours.",categories:[{title:"Ordering & Pricing",faqs:[{question:"How do I place an order?",answer:"You can place an order directly on our website by selecting your product, customizing your options, and adding to cart. For custom quotes or bulk orders, use our quote request form or contact our sales team."},{question:"Do you offer bulk discounts?",answer:"Yes! We offer tiered volume discounts starting at 5 units. The more you order, the more you saveâup to 40% off for orders of 50+ units. Bulk pricing is automatically applied at checkout."},{question:"What payment methods do you accept?",answer:"We accept all major credit cards (Visa, Mastercard, American Express, Discover), PayPal, and company purchase orders for established business accounts."},{question:"Can I get a custom quote for my project?",answer:"Absolutely! Use our Quick Quote form on any product page or contact our sales team directly. We typically respond with a detailed quote within 24 hours."}]},{title:"Design & Artwork",faqs:[{question:"What file formats do you accept?",answer:"We accept PDF, AI, EPS, PSD, and high-resolution JPEG/PNG files. For best results, please provide vector files (AI, EPS, PDF) with fonts outlined and images at 300 DPI."},{question:"Do you offer design services?",answer:"Yes! We offer free basic design assistance with every order. For more complex design needs, our professional design team can create custom artwork for an additional fee."},{question:"Can I see a proof before production?",answer:"Yes, we provide digital proofs for all orders before production begins. You'll receive an email with your proof and can request revisions until you're satisfied."},{question:"What are your bleed and margin requirements?",answer:'We recommend a 0.25" bleed on all sides and keeping important content 0.5" from the trim edge. Detailed templates are available on each product page.'}]},{title:"Shipping & Delivery",faqs:[{question:"How long does shipping take?",answer:"Standard shipping is 5-7 business days. Expedited (2-3 days) and overnight shipping options are available at checkout. Production time is typically 2-3 business days."},{question:"Do you offer free shipping?",answer:"Yes! We offer free standard shipping on most orders within the continental United States."},{question:"Can you ship internationally?",answer:"Currently, we ship to the United States and Canada. International shipping rates are calculated at checkout. Contact us for bulk international orders."},{question:"How do I track my order?",answer:"Once your order ships, you'll receive an email with tracking information. You can also log into your account to view order status and tracking details."}]},{title:"Returns & Warranty",faqs:[{question:"What is your return policy?",answer:"We offer a 30-day satisfaction guarantee. If you're not happy with your order for any reason, contact us for a refund or replacement. Custom printed items must have a quality issue to qualify."},{question:"What if my order arrives damaged?",answer:"If your order arrives damaged, please contact us within 48 hours with photos of the damage. We'll send a replacement at no charge."},{question:"Do your products come with a warranty?",answer:"Yes, all our products come with a 1-year manufacturer warranty against defects in materials and workmanship under normal use conditions."},{question:"How do I request a refund?",answer:"Contact our customer service team with your order number and reason for the refund. We typically process refunds within 5-7 business days of receiving the return."}]}]},wa={shipping:{policyKey:"shippingPolicy",fallbackTitle:"Shipping Policy"},returns:{policyKey:"refundPolicy",fallbackTitle:"Returns & Refunds Policy"},terms:{policyKey:"termsOfService",fallbackTitle:"Terms of Service"},privacy:{policyKey:"privacyPolicy",fallbackTitle:"Privacy Policy"}},ba={clearance:{eyebrow:"Limited Time Offers",heroTitleLead:"Clearance ",heroTitleHighlight:"Sale",heroText:"Don't miss these incredible deals on our premium display products. Limited quantities available â once they're gone, they're gone!",badge:"Up to 50% OFF",collectionDescription:"Shop our clearance sale for amazing deals on custom banners, flags, trade show displays, and more. Limited quantities at discounted prices!"},products:{heroTitle:"All Products",heroText:"Browse our complete collection of custom display solutions",featuredTitle:"Featured Products",featuredText:"Our hand-picked featured display solutions",collectionDescription:"Browse our complete collection of custom banners, advertising flags, trade show displays, and promotional products."}};const xa=["trade-show-displays","banner-stands","umbrellas","custom-inflatables","flags","tablecloths","pop-up-tents","digital-signage"],_a=new Set(xa);function ka(e){return!!e&&_a.has(e)}function ja(e){return e.split("-").map(e=>e.length<=2?e.toUpperCase():e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}const Ta=["product-category-map"];let Sa=new Map,Ea=null;
2function Na(e=!1){return Ea&&!e||(Ea=(async()=>{const{data:e,error:t}=await la.from("product_settings").select("shopify_product_handle, primary_category");if(t)return Sa;const r=new Map;for(const n of e??[]){const e=n.primary_category;e&&_a.has(e)&&r.set(n.shopify_product_handle,e)}return Sa=r,Sa})()),Ea}function Ca(e){if(!e)return null;const t=Sa.get(e);return ka(t)?t:null}function Aa(e){return`${ha.siteUrl}${function(e){return`/${e}`}(e)}`}function Ra(e){if(!e)return null;const t=Ca(e);return t?`/${t}/${e}`:null}function Ia(e){const t=Ra(e);return t?`${ha.siteUrl}${t}`:null}function Oa(e){const t=Ra(e);return t||"/products"}function Pa(e){let t=e;if(/^https?:\/\//i.test(t))try{t=new URL(t).pathname}catch{}return t=t.split("?")[0].split("#")[0],t.startsWith("/")||(t=`/${t}`),t.length>1&&(t=t.replace(/\/+$/,"")),`${ha.siteUrl}${t}`}const $a={},Da=function(e,t,r){let n=Promise.resolve();if(t&&t.length>0){document.getElementsByTagName("link");const e=document.querySelector("meta[property=csp-nonce]"),r=(null==e?void 0:e.nonce)||(null==e?void 0:e.getAttribute("nonce"));n=Promise.allSettled(t.map(e=>{if((e=function(e){return"/"+e}(e))in $a)return;$a[e]=!0;const t=e.endsWith(".css"),n=t?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${e}"]${n}`))return;const s=document.createElement("link");return s.rel=t?"stylesheet":"modulepreload",t||(s.as="script"),s.crossOrigin="",s.href=e,r&&s.setAttribute("nonce",r),document.head.appendChild(s),t?new Promise((t,r)=>{s.addEventListener("load",t),s.addEventListener("error",()=>r(new Error(`Unable to preload CSS for ${e}`)))}):void 0}))}function s(e){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return n.then(t=>{for(const e of t||[])"rejected"===e.status&&s(e.reason);return e().catch(s)})};let La=0;const Ua=new Map,Ma=e=>{if(Ua.has(e))return;const t=setTimeout(()=>{Ua.delete(e),Fa({type:"REMOVE_TOAST",toastId:e})},1e6);Ua.set(e,t)},qa=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case"DISMISS_TOAST":{const{toastId:r}=t;return r?Ma(r):e.toasts.forEach(e=>{Ma(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===r||void 0===r?{...e,open:!1}:e)}}case"REMOVE_TOAST":return void 0===t.toastId?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},za=[];let Ba={toasts:[]};function Fa(e){Ba=qa(Ba,e),za.forEach(e=>{e(Ba)})}function Wa({...e}){const t=(La=(La+1)%Number.MAX_SAFE_INTEGER,La.toString()),r=()=>Fa({type:"DISMISS_TOAST",toastId:t});return Fa({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:e=>{e||r()}}}),{id:t,dismiss:r,update:e=>Fa({type:"UPDATE_TOAST",toast:{...e,id:t}})}}function Va(){const[e,t]=p.useState(Ba);return p.useEffect(()=>(za.push(t),()=>{const e=za.indexOf(t);e>-1&&za.splice(e,1)}),[e]),{...e,toast:Wa,dismiss:e=>Fa({type:"DISMISS_TOAST",toastId:e})}}function Ka(e){const t=e+"CollectionProvider",[r,n]=j(t),[s,o]=r(t,{collectionRef:{current:null},itemMap:new Map}),i=e=>{const{scope:t,children:r}=e,n=f.useRef(null),o=f.useRef(new Map).current;return a.jsx(s,{scope:t,itemMap:o,collectionRef:n,children:r})};i.displayName=t;const l=e+"CollectionSlot",c=S(l),d=f.forwardRef((e,t)=>{const{scope:r,children:n}=e,s=o(l,r),i=T(t,s.collectionRef);return a.jsx(c,{ref:i,children:n})});d.displayName=l;const u=e+"CollectionItemSlot",h="data-radix-collection-item",p=S(u),m=f.forwardRef((e,t)=>{const{scope:r,children:n,...s}=e,i=f.useRef(null),l=T(t,i),c=o(u,r);return f.useEffect(()=>(c.itemMap.set(i,{ref:i,...s}),()=>{c.itemMap.delete(i)})),a.jsx(p,{[h]:"",ref:l,children:n})});return m.displayName=u,[{Provider:i,Slot:d,ItemSlot:m},function(t){const r=o(e+"CollectionConsumer",t);return f.useCallback(()=>{const e=r.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${h}]`));return Array.from(r.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current))},[r.collectionRef,r.itemMap])},n]}var Ha="ToastProvider",[Ga,Ja,Ya]=Ka("Toast"),[Xa]=j("Toast",[Ya]),[Qa,Za]=Xa(Ha),eo=e=>{const{__scopeToast:t,label:r="Notification",duration:n=5e3,swipeDirection:s="right",swipeThreshold:o=50,children:i}=e,[l,c]=p.useState(null),[d,u]=p.useState(0),h=p.useRef(!1),f=p.useRef(!1);return r.trim(),a.jsx(Ga.Provider,{scope:t,children:a.jsx(Qa,{scope:t,label:r,duration:n,swipeDirection:s,swipeThreshold:o,toastCount:d,viewport:l,onViewportChange:c,onToastAdd:p.useCallback(()=>u(e=>e+1),[]),onToastRemove:p.useCallback(()=>u(e=>e-1),[]),isFocusedToastEscapeKeyDownRef:h,isClosePausedRef:f,children:i})})};eo.displayName=Ha;var to="ToastViewport",ro=["F8"],no="toast.viewportPause",so="toast.viewportResume",ao=p.forwardRef((e,t)=>
vendor: 12,722 bytes, lines 2-15
2{const{__scopeToast:r,hotkey:n=ro,label:s="Notifications ({hotkey})",...o}=e,i=Za(to,r),l=Ja(r),c=p.useRef(null),d=p.useRef(null),u=p.useRef(null),h=p.useRef(null),f=T(t,h,i.onViewportChange),m=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),g=i.toastCount>0;p.useEffect(()=>{const e=e=>{var t;0!==n.length&&n.every(t=>e[t]||e.code===t)&&(null==(t=h.current)||t.focus())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[n]),p.useEffect(()=>{const e=c.current,t=h.current;if(g&&e&&t){const r=()=>{if(!i.isClosePausedRef.current){const e=new CustomEvent(no);t.dispatchEvent(e),i.isClosePausedRef.current=!0}},n=()=>{if(i.isClosePausedRef.current){const e=new CustomEvent(so);t.dispatchEvent(e),i.isClosePausedRef.current=!1}},s=t=>{!e.contains(t.relatedTarget)&&n()},a=()=>{e.contains(document.activeElement)||n()};return e.addEventListener("focusin",r),e.addEventListener("focusout",s),e.addEventListener("pointermove",r),e.addEventListener("pointerleave",a),window.addEventListener("blur",r),window.addEventListener("focus",n),()=>{e.removeEventListener("focusin",r),e.removeEventListener("focusout",s),e.removeEventListener("pointermove",r),e.removeEventListener("pointerleave",a),window.removeEventListener("blur",r),window.removeEventListener("focus",n)}}},[g,i.isClosePausedRef]);const y=p.useCallback(({tabbingDirection:e})=>{const t=l().map(t=>{const r=t.ref.current,n=[r,...jo(r)];return"forwards"===e?n:n.reverse()});return("forwards"===e?t.reverse():t).flat()},[l]);return p.useEffect(()=>{const e=h.current;if(e){const t=t=>{var r,n,s;const a=t.altKey||t.ctrlKey||t.metaKey;if("Tab"===t.key&&!a){const a=document.activeElement,o=t.shiftKey;if(t.target===e&&o)return void(null==(r=d.current)||r.focus());const i=y({tabbingDirection:o?"backwards":"forwards"}),l=i.findIndex(e=>e===a);To(i.slice(l+1))?t.preventDefault():o?null==(n=d.current)||n.focus():null==(s=u.current)||s.focus()}};return e.addEventListener("keydown",t),()=>e.removeEventListener("keydown",t)}},[l,y]),a.jsxs(E,{ref:c,role:"region","aria-label":s.replace("{hotkey}",m),tabIndex:-1,style:{pointerEvents:g?void 0:"none"},children:[g&&a.jsx(io,{ref:d,onFocusFromOutsideViewport:()=>{To(y({tabbingDirection:"forwards"}))}}),a.jsx(Ga.Slot,{scope:r,children:a.jsx(N.ol,{tabIndex:-1,...o,ref:f})}),g&&a.jsx(io,{ref:u,onFocusFromOutsideViewport:()=>{To(y({tabbingDirection:"backwards"}))}})]})});ao.displayName=to;var oo="ToastFocusProxy",io=p.forwardRef((e,t)=>{const{__scopeToast:r,onFocusFromOutsideViewport:n,...s}=e,o=Za(oo,r);return a.jsx(O,{"aria-hidden":!0,tabIndex:0,...s,ref:t,style:{position:"fixed"},onFocus:e=>{var t;const r=e.relatedTarget;!(null==(t=o.viewport)?void 0:t.contains(r))&&n()}})});io.displayName=oo;var lo="Toast",co=p.forwardRef((e,t)=>{const{forceMount:r,open:n,defaultOpen:s,onOpenChange:o,...i}=e,[l,c]=C({prop:n,defaultProp:s??!0,onChange:o,caller:lo});return a.jsx(A,{present:r||l,children:a.jsx(po,{open:l,...i,ref:t,onClose:()=>c(!1),onPause:I(e.onPause),onResume:I(e.onResume),onSwipeStart:R(e.onSwipeStart,e=>{e.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:R(e.onSwipeMove,e=>{const{x:t,y:r}=e.detail.delta;e.currentTarget.setAttribute("data-swipe","move"),e.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${t}px`),e.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${r}px`)}),onSwipeCancel:R(e.onSwipeCancel,e=>{e.currentTarget.setAttribute("data-swipe","cancel"),e.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),e.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),e.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),e.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:R(e.onSwipeEnd,e=>{const{x:t,y:r}=e.detail.delta;e.currentTarget.setAttribute("data-swipe","end"),e.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),e.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),e.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${t}px`),e.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${r}px`),c(!1)})})})});co.displayName=lo;var[uo,ho]=Xa(lo,{onClose(){}}),po=p.forwardRef((e,t)=>{const{__scopeToast:r,type:n="foreground",duration:s,open:o,onClose:i,onEscapeKeyDown:l,onPause:c,onResume:d,onSwipeStart:h,onSwipeMove:f,onSwipeCancel:m,onSwipeEnd:g,...y}=e,v=Za(lo,r),[w,b]=p.useState(null),x=T(t,e=>b(e)),_=p.useRef(null),k=p.useRef(null),j=s||v.duration,S=p.useRef(0),E=p.useRef(j),C=p.useRef(0),{onToastAdd:A,onToastRemove:O}=v,$=I(()=>{var e;(null==w?void 0:w.contains(document.activeElement))&&(null==(e=v.viewport)||e.focus()),i()}),D=p.useCallback(e=>{e&&e!==1/0&&(window.clearTimeout(C.current),S.current=(new Date).getTime(),C.current=window.setTimeout($,e))},[$]);p.useEffect(()=>{const e=v.viewport;if(e){const t=()=>{D(E.current),null==d||d()},r=()=>{const e=(new Date).getTime()-S.current;E.current=E.current-e,window.clearTimeout(C.current),null==c||c()};return e.addEventListener(no,r),e.addEventListener(so,t),()=>{e.removeEventListener(no,r),e.removeEventListener(so,t)}}},[v.viewport,j,c,d,D]),p.useEffect(()=>{o&&!v.isClosePausedRef.current&&D(j)},[o,j,v.isClosePausedRef,D]),p.useEffect(()=>(A(),()=>O()),[A,O]);const L=p.useMemo(()=>w?xo(w):null,[w]);return v.viewport?a.jsxs(a.Fragment,{children:[L&&a.jsx(fo,{__scopeToast:r,role:"status","aria-live":"foreground"===n?"assertive":"polite","aria-atomic":!0,children:L}),a.jsx(uo,{scope:r,onClose:$,children:u.createPortal(a.jsx(Ga.ItemSlot,{scope:r,children:a.jsx(P,{asChild:!0,onEscapeKeyDown:R(l,()=>{v.isFocusedToastEscapeKeyDownRef.current||$(),v.isFocusedToastEscapeKeyDownRef.current=!1}),children:a.jsx(N.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":v.swipeDirection,...y,ref:x,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:R(e.onKeyDown,e=>{"Escape"===e.key&&(null==l||l(e.nativeEvent),e.nativeEvent.defaultPrevented||(v.isFocusedToastEscapeKeyDownRef.current=!0,$()))}),onPointerDown:R(e.onPointerDown,e=>{0===e.button&&(_.current={x:e.clientX,y:e.clientY})}),onPointerMove:R(e.onPointerMove,e=>{if(!_.current)return;const t=e.clientX-_.current.x,r=e.clientY-_.current.y,n=Boolean(k.current),s=["left","right"].includes(v.swipeDirection),a=["left","up"].includes(v.swipeDirection)?Math.min:Math.max,o=s?a(0,t):0,i=s?0:a(0,r),l="touch"===e.pointerType?10:2,c={x:o,y:i},d={originalEvent:e,delta:c};n?(k.current=c,_o("toast.swipeMove",f,d,{discrete:!1})):ko(c,v.swipeDirection,l)?(k.current=c,_o("toast.swipeStart",h,d,{discrete:!1}),e.target.setPointerCapture(e.pointerId)):(Math.abs(t)>l||Math.abs(r)>l)&&(_.current=null)}),onPointerUp:R(e.onPointerUp,e=>{const t=k.current,r=e.target;if(r.hasPointerCapture(e.pointerId)&&r.releasePointerCapture(e.pointerId),k.current=null,_.current=null,t){const r=e.currentTarget,n={originalEvent:e,delta:t};ko(t,v.swipeDirection,v.swipeThreshold)?_o("toast.swipeEnd",g,n,{discrete:!0}):_o("toast.swipeCancel",m,n,{discrete:!0}),r.addEventListener("click",e=>e.preventDefault(),{once:!0})}})})})}),v.viewport)})]}):null}),fo=e=>{const{__scopeToast:t,children:r,...n}=e,s=Za(lo,t),[o,i]=p.useState(!1),[l,c]=p.useState(!1);return function(e=()=>{}){const t=I(e);D(()=>{let e=0,r=0;return e=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(e),window.cancelAnimationFrame(r)}},[t])}(()=>i(!0)),p.useEffect(()=>{const e=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(e)},[]),l?null:a.jsx($,{asChild:!0,children:a.jsx(O,{...n,children:o&&a.jsxs(a.Fragment,{children:[s.label," ",r]})})})},mo=p.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return a.jsx(N.div,{...n,ref:t})});mo.displayName="ToastTitle";var go=p.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return a.jsx(N.div,{...n,ref:t})});go.displayName="ToastDescription";var yo=p.forwardRef((e,t)=>{const{altText:r,...n}=e;return r.trim()?a.jsx(bo,{altText:r,asChild:!0,children:a.jsx(wo,{...n,ref:t})}):null});yo.displayName="ToastAction";var vo="ToastClose",wo=p.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e,s=ho(vo,r);return a.jsx(bo,{asChild:!0,children:a.jsx(N.button,{type:"button",...n,ref:t,onClick:R(e.onClick,s.onClose)})})});wo.displayName=vo;var bo=p.forwardRef((e,t)=>{const{__scopeToast:r,altText:n,...s}=e;return a.jsx(N.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":n||void 0,...s,ref:t})});function xo(e){const t=[];return Array.from(e.childNodes).forEach(e=>{if(e.nodeType===e.TEXT_NODE&&e.textContent&&t.push(e.textContent),function(e){return e.nodeType===e.ELEMENT_NODE}(e)){const r=e.ariaHidden||e.hidden||"none"===e.style.display,n=""===e.dataset.radixToastAnnounceExclude;if(!r)if(n){const r=e.dataset.radixToastAnnounceAlt;r&&t.push(r)}else t.push(...xo(e))}}),t}function _o(e,t,r,{discrete:n}){const s=r.originalEvent.currentTarget,a=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:r});t&&s.addEventListener(e,t,{once:!0}),n?L(s,a):s.dispatchEvent(a)}var ko=(e,t,r=0)=>{const n=Math.abs(e.x),s=Math.abs(e.y),a=n>s;return"left"===t||"right"===t?a&&n>r:!a&&s>r};function jo(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function To(e){const t=document.activeElement;return e.some(e=>e===t||(e.focus(),document.activeElement!==t))}var So=eo,Eo=ao,No=co,Co=mo,Ao=go,Ro=yo,Io=wo;function Oo(e){var t,r,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=Oo(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Po(){for(var e,t,r=0,n="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=Oo(e))&&(n&&(n+=" "),n+=t);return n}const $o=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,Do=Po,Lo=(e,t)=>r=>{var n;if(null==(null==t?void 0:t.variants))return Do(e,null==r?void 0:r.class,null==r?void 0:r.className);const{variants:s,defaultVariants:a}=t,o=Object.keys(s).map(e=>{const t=null==r?void 0:r[e],n=null==a?void 0:a[e];if(null===t)return null;const o=$o(t)||$o(n);return s[e][o]}),i=r&&Object.entries(r).reduce((e,t)=>{let[r,n]=t;return void 0===n||(e[r]=n),e},{}),l=null==t||null===(n=t.compoundVariants)||void 0===n?void 0:n.reduce((e,t)=>{let{class:r,className:n,...s}=t;return Object.entries(s).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...a,...i}[t]):{...a,...i}[t]===r})?[...e,r,n]:e},[]);return Do(e,o,l,null==r?void 0:r.class,null==r?void 0:r.className)},Uo=(...e)=>e.filter((e,t,r)=>Boolean(e)&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(); 3/** 4 * @license lucide-react v0.462.0 - ISC 5 * 6 * This source code is licensed under the ISC license. 7 * See the LICENSE file in the root directory of this source tree. 8 */ 9var Mo={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}; 10/** 11 * @license lucide-react v0.462.0 - ISC 12 * 13 * This source code is licensed under the ISC license. 14 * See the LICENSE file in the root directory of this source tree. 15 */const qo=p.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:a,iconNode:o,...i},l)=>p.createElement("svg",{ref:l,...Mo,width:t,height:t,stroke:e,strokeWidth:n?24*Number(r)/Number(t):r,className:Uo("lucide",s),...i},[...o.map(([e,t])=>p.createElement(e,t)),...Array.isArray(a)?a:[a]])),zo=(e,t)=>{const r=p.forwardRef(({className:r,...n},s)=>{return p.createElement(qo,{ref:s,iconNode:t,className:Uo(`lucide-${a=e,a.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,r),...n});var a});return r.displayName=`${e}`,r},Bo=zo("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),Fo=zo("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),Wo=zo("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),Vo=zo("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),Ko=zo("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),Ho=zo("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]),Go=zo("Cookie",[["path",{d:"M12 2a10 10 0 1 0 10 10 4 4 0 0 1-5-5 4 4 0 0 1-5-5",key:"laymnq"}],["path",{d:"M8.5 8.5v.01",key:"ue8clq"}],["path",{d:"M16 15.5v.01",key:"14dtrp"}],["path",{d:"M12 12v.01",key:"u5ubse"}],["path",{d:"M11 17v.01",key:"1hyl5a"}],["path",{d:"M7 14v.01",key:"uct60s"}
15]]),Jo=zo("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]),Yo=zo("Facebook",[["path",{d:"M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z",key:"1jg4f8"}]]),Xo=zo("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]),Qo=zo("Gift",[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]]),Zo=zo("Grid3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]),ei=zo("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]),ti=zo("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"}]]),ri=zo("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),ni=zo("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"}]]),si=zo("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]),ai=zo("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]),oi=zo("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]),ii=zo("Megaphone",[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]]),li=zo("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]),ci=zo("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]),di=zo("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]),ui=zo("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),hi=zo("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]),pi=zo("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]),fi=zo("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),mi=zo("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),gi=zo("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]),yi=zo("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",ke
vendor: 4,800 bytes, line 15
15y:"oel41y"}]]),vi=zo("ShoppingCart",[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]]),wi=zo("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]),bi=zo("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]),xi=zo("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]),_i=zo("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]),ki=zo("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]),ji=zo("Truck",[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]]),Ti=zo("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]),Si=zo("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Ei=zo("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),Ni=e=>{const t=Ii(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:e=>{const r=e.split("-");return""===r[0]&&1!==r.length&&r.shift(),Ci(r,t)||Ri(e)},getConflictingClassGroupIds:(e,t)=>{const s=r[e]||[];return t&&n[e]?[...s,...n[e]]:s}}},Ci=(e,t)=>{var r;if(0===e.length)return t.classGroupId;const n=e[0],s=t.nextPart.get(n),a=s?Ci(e.slice(1),s):void 0;if(a)return a;if(0===t.validators.length)return;const o=e.join("-");return null==(r=t.validators.find(({validator:e})=>e(o)))?void 0:r.classGroupId},Ai=/^\[(.+)\]$/,Ri=e=>{if(Ai.test(e)){const t=Ai.exec(e)[1],r=null==t?void 0:t.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},Ii=e=>{const{theme:t,prefix:r}=e,n={nextPart:new Map,validators:[]};return Di(Object.entries(e.classGroups),r).forEach(([e,r])=>{Oi(r,n,e,t)}),n},Oi=(e,t,r,n)=>{e.forEach(e=>{if("string"==typeof e){return void((""===e?t:Pi(t,e)).classGroupId=r)}if("function"==typeof e)return $i(e)?void Oi(e(n),t,r,n):void t.validators.push({validator:e,classGroupId:r});Object.entries(e).forEach(([e,s])=>{Oi(s,Pi(t,e),r,n)})})},Pi=(e,t)=>{let r=e;return t.split("-").forEach(e=>{r.nextPart.has(e)||r.nextPart.set(e,{nextPart:new Map,validators:[]}),r=r.nextPart.get(e)}),r},$i=e=>e.isThemeGetter,Di=(e,t)=>t?e.map(([e,r])=>[e,r.map(e=>"string"==typeof e?t+e:"object"==typeof e?Object.fromEntries(Object.entries(e).map(([e,r])=>[t+e,r])):e)]):e,Li=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const s=(s,a)=>{r.set(s,a),t++,t>e&&(t=0,n=r,r=new Map)};return{get(e){let t=r.get(e);return void 0!==t?t:void 0!==(t=n.get(e))?(s(e,t),t):void 0},set(e,t){r.has(e)?r.set(e,t):s(e,t)}}},Ui=e=>{const{separator:t,experimentalParseClassName:r}=e,n=1===t.length,s=t[0],a=t.length,o=e=>{const r=[];let o,i=0,l=0;for(let u=0;u<e.length;u++){let c=e[u];if(0===i){if(c===s&&(n||e.slice(u,u+a)===t)){r.push(e.slice(l,u)),l=u+a;continue}if("/"===c){o=u;continue}}"["===c?i++:"]"===c&&i--}const c=0===r.length?e:e.substring(l),d=c.startsWith("!");return{modifiers:r,hasImportantModifier:d,baseClassName:d?c.substring(1):c,maybePostfixModifierPosition:o&&o>l?o-l:void 0}};return r?e=>r({className:e,parseClassName:o}):o},Mi=e=>{if(e.length<=1)return e;const t=[];let r=[];
vendor: 5,190 bytes, lines 15-21
15return e.forEach(e=>{"["===e[0]?(t.push(...r.sort(),e),r=[]):r.push(e)}),t.push(...r.sort()),t},qi=/\s+/; 16/** 17 * @license lucide-react v0.462.0 - ISC 18 * 19 * This source code is licensed under the ISC license. 20 * See the LICENSE file in the root directory of this source tree. 21 */function zi(){let e,t,r=0,n="";for(;r<arguments.length;)(e=arguments[r++])&&(t=Bi(e))&&(n&&(n+=" "),n+=t);return n}const Bi=e=>{if("string"==typeof e)return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Bi(e[n]))&&(r&&(r+=" "),r+=t);return r};function Fi(e,...t){let r,n,s,a=function(i){const l=t.reduce((e,t)=>t(e),e());return r=(e=>({cache:Li(e.cacheSize),parseClassName:Ui(e),...Ni(e)}))(l),n=r.cache.get,s=r.cache.set,a=o,o(i)};function o(e){const t=n(e);if(t)return t;const a=((e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:s}=t,a=[],o=e.trim().split(qi);let i="";for(let l=o.length-1;l>=0;l-=1){const e=o[l],{modifiers:t,hasImportantModifier:c,baseClassName:d,maybePostfixModifierPosition:u}=r(e);let h=Boolean(u),p=n(h?d.substring(0,u):d);if(!p){if(!h){i=e+(i.length>0?" "+i:i);continue}if(p=n(d),!p){i=e+(i.length>0?" "+i:i);continue}h=!1}const f=Mi(t).join(":"),m=c?f+"!":f,g=m+p;if(a.includes(g))continue;a.push(g);const y=s(p,h);for(let r=0;r<y.length;++r){const e=y[r];a.push(m+e)}i=e+(i.length>0?" "+i:i)}return i})(e,r);return s(e,a),a}return function(){return a(zi.apply(null,arguments))}}const Wi=e=>{const t=t=>t[e]||[];return t.isThemeGetter=!0,t},Vi=/^\[(?:([a-z-]+):)?(.+)\]$/i,Ki=/^\d+\/\d+$/,Hi=new Set(["px","full","screen"]),Gi=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ji=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Yi=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,Xi=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Qi=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Zi=e=>tl(e)||Hi.has(e)||Ki.test(e),el=e=>fl(e,"length",ml),tl=e=>Boolean(e)&&!Number.isNaN(Number(e)),rl=e=>fl(e,"number",tl),nl=e=>Boolean(e)&&Number.isInteger(Number(e)),sl=e=>e.endsWith("%")&&tl(e.slice(0,-1)),al=e=>Vi.test(e),ol=e=>Gi.test(e),il=new Set(["length","size","percentage"]),ll=e=>fl(e,il,gl),cl=e=>fl(e,"position",gl),dl=new Set(["image","url"]),ul=e=>fl(e,dl,vl),hl=e=>fl(e,"",yl),pl=()=>!0,fl=(e,t,r)=>{const n=Vi.exec(e);return!!n&&(n[1]?"string"==typeof t?n[1]===t:t.has(n[1]):r(n[2]))},ml=e=>Ji.test(e)&&!Yi.test(e),gl=()=>!1,yl=e=>Xi.test(e),vl=e=>Qi.test(e),wl=Fi(()=>{const e=Wi("colors"),t=Wi("spacing"),r=Wi("blur"),n=Wi("brightness"),s=Wi("borderColor"),a=Wi("borderRadius"),o=Wi("borderSpacing"),i=Wi("borderWidth"),l=Wi("contrast"),c=Wi("grayscale"),d=Wi("hueRotate"),u=Wi("invert"),h=Wi("gap"),p=Wi("gradientColorStops"),f=Wi("gradientColorStopPositions"),m=Wi("inset"),g=Wi("margin"),y=Wi("opacity"),v=Wi("padding"),w=Wi("saturate"),b=Wi("scale"),x=Wi("sepia"),_=Wi("skew"),k=Wi("space"),j=Wi("translate"),T=()=>["auto",al,t],S=()=>[al,t],E=()=>["",Zi,el],N=()=>["auto",tl,al],C=()=>["","0",al],A=()=>[tl,al];return{cacheSize:500,separator:":",theme:{colors:[pl],spacing:[Zi,el],blur:["none","",ol,al],brightness:A(),borderColor:[e],borderRadius:["none","","full",ol,al],borderSpacing:S(),borderWidth:E(),contrast:A(),grayscale:C(),hueRotate:A(),invert:C(),gap:S(),gradientColorStops:[e],gradientColorStopPositions:[sl,el],inset:T(),margin:T(),opacity:A(),padding:S(),saturate:A(),scale:A(),sepia:C(),skew:A(),space:S(),translate:S()},classGroups:{aspect:[{aspect:["auto","square","video",al]}],container:["container"],columns:[{columns:[ol]}],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top",al]}],overflow:[{overflow:["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],overscroll:[{overscroll:["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}
vendor: 5,048 bytes, line 21
21],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",nl,al]}],basis:[{basis:T()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",al]}],grow:[{grow:C()}],shrink:[{shrink:C()}],order:[{order:["first","last","none",nl,al]}],"grid-cols":[{"grid-cols":[pl]}],"col-start-end":[{col:["auto",{span:["full",nl,al]},al]}],"col-start":[{"col-start":N()}],"col-end":[{"col-end":N()}],"grid-rows":[{"grid-rows":[pl]}],"row-start-end":[{row:["auto",{span:[nl,al]},al]}],"row-start":[{"row-start":N()}],"row-end":[{"row-end":N()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",al]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",al]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal","start","end","center","between","around","evenly","stretch"]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal","start","end","center","between","around","evenly","stretch","baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],ps:[{ps:[v]}],pe:[{pe:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[k]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[k]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",al,t]}],"min-w":[{"min-w":[al,t,"min","max","fit"]}],"max-w":[{"max-w":[al,t,"none","full","min","max","fit","prose",{screen:[ol]},ol]}],h:[{h:[al,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[al,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[al,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[al,t,"auto","min","max","fit"]}],"font-size":[{text:["base",ol,el]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",rl]}],"font-family":[{font:[pl]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",al]}],"line-clamp":[{"line-clamp":["none",tl,rl]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Zi,al]}],"list-image":[{"list-image":["none",al]}],"list-style-type":[{list:["none","disc","decimal",al]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","none","wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Zi,el]}],"underline-offset":[{"underline-offset":["auto",Zi,al]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:S()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",al]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",al]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top",cl]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",ll]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},ul]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[f]}
21],"gradient-via-pos":[{via:[f]}],"gradient-to-pos":[{to:[f]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[i]}],"border-w-x":[{"border-x":[i]}],"border-w-y":[{"border-y":[i]}],"border-w-s":[{"border-s":[i]}],"border-w-e":[{"border-e":[i]}],"border-w-t":[{"border-t":[i]}],"border-w-r":[{"border-r":[i]}],"border-w-b":[{"border-b":[i]}],"border-w-l":[{"border-l":[i]}],"border-opacity":[{"border-opacity":[y]}],"border-style":[{border:["solid","dashed","dotted","double","none","hidden"]}],"divide-x":[{"divide-x":[i]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[i]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[y]}
vendor: 4,419 bytes, line 21
21],"divide-style":[{divide:["solid","dashed","dotted","double","none"]}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["","solid","dashed","dotted","double","none"]}],"outline-offset":[{"outline-offset":[Zi,al]}],"outline-w":[{outline:[Zi,el]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:E()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[Zi,el]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",ol,hl]}],"shadow-color":[{shadow:[pl]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",ol,al]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[u]}],saturate:[{saturate:[w]}],sepia:[{sepia:[x]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[u]}],"backdrop-opacity":[{"backdrop-opacity":[y]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[x]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",al]}],duration:[{duration:A()}],ease:[{ease:["linear","in","out","in-out",al]}],delay:[{delay:A()}],animate:[{animate:["none","spin","ping","pulse","bounce",al]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[b]}],"scale-x":[{"scale-x":[b]}],"scale-y":[{"scale-y":[b]}],rotate:[{rotate:[nl,al]}],"translate-x":[{"translate-x":[j]}],"translate-y":[{"translate-y":[j]}],"skew-x":[{"skew-x":[_]}],"skew-y":[{"skew-y":[_]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",al]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",al]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":S()}],"scroll-mx":[{"scroll-mx":S()}],"scroll-my":[{"scroll-my":S()}],"scroll-ms":[{"scroll-ms":S()}],"scroll-me":[{"scroll-me":S()}],"scroll-mt":[{"scroll-mt":S()}],"scroll-mr":[{"scroll-mr":S()}],"scroll-mb":[{"scroll-mb":S()}],"scroll-ml":[{"scroll-ml":S()}],"scroll-p":[{"scroll-p":S()}],"scroll-px":[{"scroll-px":S()}],"scroll-py":[{"scroll-py":S()}],"scroll-ps":[{"scroll-ps":S()}],"scroll-pe":[{"scroll-pe":S()}],"scroll-pt":[{"scroll-pt":S()}],"scroll-pr":[{"scroll-pr":S()}],"scroll-pb":[{"scroll-pb":S()}],"scroll-pl":[{"scroll-pl":S()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}
21],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",al]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Zi,el,rl]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function bl(...e){return wl(Po(e))}const xl=So,_l=p.forwardRef(({className:e,...t},r)=>a.jsx(Eo,{ref:r,className:bl("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));_l.displayName=Eo.displayName;const kl=Lo("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),jl=p.forwardRef(({className:e,variant:t,...r},n)=>a.jsx(No,{ref:n,className:bl(kl({variant:t}),e),...r}));jl.displayName=No.displayName;p.forwardRef(({className:e,...t},r)=>a.jsx(Ro,{ref:r,className:bl("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors group-[.destructive]:border-muted/40 hover:bg-secondary group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 group-[.destructive]:focus:ring-destructive disabled:pointer-events-none disabled:opacity-50",e),...t})).displayName=Ro.displayName;const Tl=p.forwardRef(({className:e,...t},r)=>a.jsx(Io,{ref:r,className:bl("absolute right-2 top-2 rounded-md p-1 text-foreground
21/70 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 hover:text-foreground group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:outline-none focus:ring-2 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:a.jsx(Si,{className:"h-4 w-4"})}));Tl.displayName=Io.displayName;const Sl=p.forwardRef(({className:e,...t},r)=>a.jsx(Co,{ref:r,className:bl("text-sm font-semibold",e),...t}));Sl.displayName=Co.displayName;const El=p.forwardRef(({className:e,...t},r)=>a.jsx(Ao,{ref:r,className:bl("text-sm opacity-90",e),...t}));function Nl(){const{toasts:e}=Va();return a.jsxs(xl,{children:[e.map(function({id:e,title:t,description:r,action:n,...s}){return a.jsxs(jl,{...s,children:[a.jsxs("div",{className:"grid gap-1",children:[t&&a.jsx(Sl,{children:t}),r&&a.jsx(El,{children:r})]}),n,a.jsx(Tl,{})]},e)}),a.jsx(_l,{})]})}El.displayName=Ao.displayName;var Cl=["light","dark"],Al=p.createContext(void 0),Rl={setTheme:e=>{},themes:[]};p.memo(({forcedTheme:e,storageKey:t,attribute:r,enableSystem:n,enableColorScheme:s,defaultTheme:a,value:o,attrs:i,nonce:l})=>{let c="system"===a,d="class"===r?`var d=document.documentElement,c=d.classList;c.remove(${i.map(e=>`'${e}'`).join(",")});`:`var d=document.documentElement,n='${r}',s='setAttribute';`,u=s?Cl.includes(a)&&a?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${a}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",h=(e,t=!1,n=!0)=>{let a=o?o[e]:e,i=t?e+"|| ''":`'${a}'`,l="";return s&&n&&!t&&Cl.includes(e)&&(l+=`d.style.colorScheme = '${e}';`),"class"===r?l+=t||a?`c.add(${i})`:"null":a&&(l+=`d[s](n,${i})`),l},f=e?`!function(){${d}${h(e)}}()`:n?`!function(){try{${d}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${c})){var t='(prefers-color-scheme: dark)',m=window.matchMedia(t);if(m.media!==t||m.matches){${h("dark")}}else{${h("light")}}}else if(e){${o?`var x=${JSON.stringify(o)};`:""}${h(o?"x[e]":"e",!0)}}${c?"":"else{"+h(a,!1,!1)+"}"}${u}}catch(e){}}()`:`!function(){try{${d}var e=localStorage.getItem('${t}');if(e){${o?`var x=${JSON.stringify(o)};`:""}${h(o?"x[e]":"e",!0)}}else{${h(a,!1,!1)};}${u}}catch(t){}}();`;return p.createElement("script",{nonce:l,dangerouslySetInnerHTML:{__html:f}})});var Il=Array(12).fill(0),Ol=({visible:e,className:t})=>f.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},f.createElement("div",{className:"sonner-spinner"},Il.map((e,t)=>f.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${t}`})))),Pl=f.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},f.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),$l=f.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},f.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),Dl=f.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},f.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),Ll=f.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},f.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),Ul=f.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},f.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),f.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Ml=1,ql=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>
21{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:r,...n}=e,s="number"==typeof(null==e?void 0:e.id)||(null==(t=e.id)?void 0:t.length)>0?e.id:Ml++,a=this.toasts.find(e=>e.id===s),o=void 0===e.dismissible||e.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),a?this.toasts=this.toasts.map(t=>t.id===s?(this.publish({...t,...e,id:s,title:r}),{...t,...e,id:s,dismissible:o,title:r}):t):this.addToast({title:r,...n,dismissible:o,id:s}),s},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,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)=>
21this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let r;void 0!==t.loading&&(r=this.create({...t,promise:e,type:"loading",message:t.loading,description:"function"!=typeof t.description?t.description:void 0}));let n,s=e instanceof Promise?e:e(),a=void 0!==r,o=s.then(async e=>{if(n=["resolve",e],f.isValidElement(e))a=!1,this.create({id:r,type:"default",message:e});else if(zl(e)&&!e.ok){a=!1;let n="function"==typeof t.error?await t.error(`HTTP error! status: ${e.status}`):t.error,s="function"==typeof t.description?await t.description(`HTTP error! status: ${e.status}`):t.description;this.create({id:r,type:"error",message:n,description:s})}else if(void 0!==t.success){a=!1;let n="function"==typeof t.success?await t.success(e):t.success,s="function"==typeof t.description?await t.description(e):t.description;this.create({id:r,type:"success",message:n,description:s})}}).catch(async e=>{if(n=["reject",e],void 0!==t.error){a=!1;let n="function"==typeof t.error?await t.error(e):t.error,s="function"==typeof t.description?await t.description(e):t.description;this.create({id:r,type:"error",message:n,description:s})}}).finally(()=>{var e;a&&(this.dismiss(r),r=void 0),null==(e=t.finally)||e.call(t)}),i=()=>new Promise((e,t)=>o.then(()=>"reject"===n[0]?t(n[1]):e(n[1])).catch(t));return"string"!=typeof r&&"number"!=typeof r?{unwrap:i}:Object.assign(r,{unwrap:i})},this.custom=(e,t)=>{let r=(null==t?void 0:t.id)||Ml++;return this.create({jsx:e(r),id:r,...t}),r},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},zl=e=>e&&"object"==typeof e&&"ok"in e&&"boolean"==typeof e.ok&&"status"in e&&"number"==typeof e.status,Bl=(e,t)=>{let r=(null==t?void 0:t.id)||Ml++;return ql.addToast({title:e,...t,id:r}),r},Fl=Object.assign(Bl,{success:ql.success,info:ql.info,warning:ql.warning,error:ql.error,custom:ql.custom,message:ql.message,promise:ql.promise,dismiss:ql.dismiss,loading:ql.loading},{getHistory:()=>ql.toasts,getToasts:()=>ql.getActiveToasts()});function Wl(e){return void 0!==e.label}!function(e,{insertAt:t}={}){if("undefined"==typeof document)return;let r=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===t&&r.firstChild?r.insertBefore(n,r.firstChild):r.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}(':where(html[dir="ltr"]),:where([data-sonner-toaster][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%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][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%)}:where([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:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([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);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([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 #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([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)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([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;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;
21left: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);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-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}
21:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([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}:where([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}:where([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, 0px)) translate(var(--swipe-amount-x, 0px));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{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{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{0%{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-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--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-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-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-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, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);
21--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-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-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],[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],[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],[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],[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:nth-child(1){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)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{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%)}\n');var Vl=3,Kl=14;function Hl(...e){return e.filter(Boolean).join(" ")}var Gl=e=>{var t,r,n,s,a,o,i,l,c,d,u;let{invert:h,toast:m,unstyled:g,interacting:y,setHeights:v,visibleToasts:w,heights:b,index:x,toasts:_,expanded:k,removeToast:j,defaultRichColors:T,closeButton:S,style:E,cancelButtonStyle:N,actionButtonStyle:C,className:A="",descriptionClassName:R="",duration:I,position:O,gap:P,loadingIcon:$,expandByDefault:D,classNames:L,icons:U,closeButtonAriaLabel:M="Close toast",pauseWhenPageIsHidden:q}=e,[z,B]=f.useState(null),[F,W]=f.useState(null),[V,K]=f.useState(!1),[H,G]=f.useState(!1),[J,Y]=f.useState(!1),[X,Q]=f.useState(!1),[Z,ee]=f.useState(!1),[te,re]=f.useState(0),[ne,se]=f.useState(0),ae=f.useRef(m.duration||I||4e3),oe=f.useRef(null),ie=f.useRef(null),le=0===x,ce=x+1<=w,de=m.type,ue=!1!==m.dismissible,he=m.className||"",pe=m.descriptionClassName||"",fe=f.useMemo(()=>b.findIndex(e=>e.toastId===m.id)||0,[b,m.id]),me=f.useMemo(()=>{var e;return null!=(e=m.closeButton)?e:S},[m.closeButton,S]),ge=f.useMemo(()=>m.duration||I||4e3,[m.duration,I]),ye=f.useRef(0),ve=f.useRef(0),we=f.useRef(0),be=f.useRef(null),[xe,_e]=O.split("-"),ke=f.useMemo(()=>b.reduce((e,t,r)=>r>=fe?e:e+t.height,0),[b,fe]),je=(()=>{let[e,t]=f.useState(document.hidden);return f.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",e),()=>window.removeEventListener("visibilitychange",e)},[]),e})(),Te=m.invert||h,Se="loading"===de;ve.current=f.useMemo(()=>fe*P+ke,[fe,ke]),f.useEffect(()=>{ae.current=ge},[ge]),f.useEffect(()=>{K(!0)},[]),f.useEffect(()=>{let e=ie.current;if(e){let t=e.getBoundingClientRect().height;return se(t),v(e=>[{toastId:m.id,height:t,position:m.position},...e]),()=>v(e=>e.filter(e=>e.toastId!==m.id))}},[v,m.id]),f.useLayoutEffect(()=>{if(!V)return;let e=ie.current,t=e.style.height;e.style.height="auto";let r=e.getBoundingClientRect().height;e.style.height=t,se(r),v(e=>e.find(e=>e.toastId===m.id)?e.map(e=>e.toastId===m.id?{...e,height:r}:e):[{toastId:m.id,height:r,position:m.position},...e])},[V,m.title,m.description,v,m.id]);let Ee=f.useCallback(()=>{G(!0),re(ve.current),v(e=>e.filter(e=>e.toastId!==m.id)),setTimeout(()=>{j(m)},200)},[m,j,v,ve]);return f.useEffect(()=>{if(m.promise&&"loading"===de||m.duration===1/0||"loading"===m.type)return;let e;return k||y||q&&je?(()=>{if(we.current<ye.current){let e=(new Date).getTime()-ye.current;ae.current=ae.current-e}we.current=(new Date).getTime()})():ae.current!==1/0&&(ye.current=(new Date).getTime(),e=setTimeout(()=>{var e;null==(e=m.onAutoClose)||e.call(m,m),Ee()},ae.current)),()=>clearTimeout(e)},[k,y,m,de,q,je,Ee]),f.useEffect(()=>{m.delete&&Ee()},[Ee,m.delete]),f.createElement("li",{tabIndex:0,ref:ie,className:Hl(A,he,null==L?void 0:L.toast,null==(t=null==m?void 0:m.classNames)?void 0:t.toast,null==L?void 0:L.default,null==L?void 0:L[de],null==(r=null==m?void 0:m.classNames)?void 0:r[de]),"data-sonner-toast":"","data-rich-colors":null!=(n=m.richColors)?n:T,"data-styled":!(m.jsx||m.unstyled||g),"data-mounted":V,"data-promise":!!m.promise,"data-swiped":Z,"data-removed":H,"data-visible":ce,"data-y-position":xe,"data-x-position":_e,"data-index":x,"data-front":le,"data-swiping":J,"data-dismissible":ue,"data-type":de,"data-invert":Te,"data-swipe-out":X,"data-swipe-direction":F,"data-expanded":!!(k||D&&V),style:{"--index":x,"--toasts-before":x,"--z-index":_.length-x,"--offset":`${H?te:ve.current}px`,"--initial-height":D?"auto":`${ne}px`,...E,...m.style},onDragEnd:()=>{Y(!1),B(null),be.current=null},onPointerDown:e=>
21{Se||!ue||(oe.current=new Date,re(ve.current),e.target.setPointerCapture(e.pointerId),"BUTTON"!==e.target.tagName&&(Y(!0),be.current={x:e.clientX,y:e.clientY}))},onPointerUp:()=>{var e,t,r,n;if(X||!ue)return;be.current=null;let s=Number((null==(e=ie.current)?void 0:e.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),a=Number((null==(t=ie.current)?void 0:t.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),o=(new Date).getTime()-(null==(r=oe.current)?void 0:r.getTime()),i="x"===z?s:a,l=Math.abs(i)/o;if(Math.abs(i)>=20||l>.11)return re(ve.current),null==(n=m.onDismiss)||n.call(m,m),W("x"===z?s>0?"right":"left":a>0?"down":"up"),Ee(),Q(!0),void ee(!1);Y(!1),B(null)},onPointerMove:t=>{var r,n,s,a;if(!be.current||!ue||(null==(r=window.getSelection())?void 0:r.toString().length)>0)return;let o=t.clientY-be.current.y,i=t.clientX-be.current.x,l=null!=(n=e.swipeDirections)?n:function(e){let[t,r]=e.split("-"),n=[];return t&&n.push(t),r&&n.push(r),n}(O);!z&&(Math.abs(i)>1||Math.abs(o)>1)&&B(Math.abs(i)>Math.abs(o)?"x":"y");let c={x:0,y:0};"y"===z?(l.includes("top")||l.includes("bottom"))&&(l.includes("top")&&o<0||l.includes("bottom")&&o>0)&&(c.y=o):"x"===z&&(l.includes("left")||l.includes("right"))&&(l.includes("left")&&i<0||l.includes("right")&&i>0)&&(c.x=i),(Math.abs(c.x)>0||Math.abs(c.y)>0)&&ee(!0),null==(s=ie.current)||s.style.setProperty("--swipe-amount-x",`${c.x}px`),null==(a=ie.current)||a.style.setProperty("--swipe-amount-y",`${c.y}px`)}},me&&!m.jsx?f.createElement("button",{"aria-label":M,"data-disabled":Se,"data-close-button":!0,onClick:Se||!ue?()=>{}:()=>{var e;Ee(),null==(e=m.onDismiss)||e.call(m,m)},className:Hl(null==L?void 0:L.closeButton,null==(s=null==m?void 0:m.classNames)?void 0:s.closeButton)},null!=(a=null==U?void 0:U.close)?a:Ul):null,m.jsx||p.isValidElement(m.title)?m.jsx?m.jsx:"function"==typeof m.title?m.title():m.title:f.createElement(f.Fragment,null,de||m.icon||m.promise?f.createElement("div",{"data-icon":"",className:Hl(null==L?void 0:L.icon,null==(o=null==m?void 0:m.classNames)?void 0:o.icon)},m.promise||"loading"===m.type&&!m.icon?m.icon||(null!=U&&U.loading?f.createElement("div",{className:Hl(null==L?void 0:L.loader,null==(Ne=null==m?void 0:m.classNames)?void 0:Ne.loader,"sonner-loader"),"data-visible":"loading"===de},U.loading):$?f.createElement("div",{className:Hl(null==L?void 0:L.loader,null==(Ce=null==m?void 0:m.classNames)?void 0:Ce.loader,"sonner-loader"),"data-visible":"loading"===de},$):f.createElement(Ol,{className:Hl(null==L?void 0:L.loader,null==(Ae=null==m?void 0:m.classNames)?void 0:Ae.loader),visible:"loading"===de})):null,"loading"!==m.type?m.icon||(null==U?void 0:U[de])||(e=>{switch(e){case"success":return Pl;case"info":return Dl;case"warning":return $l;case"error":return Ll;default:return null}})(de):null):null,f.createElement("div",{"data-content":"",className:Hl(null==L?void 0:L.content,null==(i=null==m?void 0:m.classNames)?void 0:i.content)},f.createElement("div",{"data-title":"",className:Hl(null==L?void 0:L.title,null==(l=null==m?void 0:m.classNames)?void 0:l.title)},"function"==typeof m.title?m.title():m.title),m.description?f.createElement("div",{"data-description":"",className:Hl(R,pe,null==L?void 0:L.description,null==(c=null==m?void 0:m.classNames)?void 0:c.description)},"function"==typeof m.description?m.description():m.description):null),p.isValidElement(m.cancel)?m.cancel:m.cancel&&Wl(m.cancel)?f.createElement("button",{"data-button":!0,"data-cancel":!0,style:m.cancelButtonStyle||N,onClick:e=>{var t,r;Wl(m.cancel)&&ue&&(null==(r=(t=m.cancel).onClick)||r.call(t,e),Ee())},className:Hl(null==L?void 0:L.cancelButton,null==(d=null==m?void 0:m.classNames)?void 0:d.cancelButton)},m.cancel.label):null,p.isValidElement(m.action)?m.action:m.action&&Wl(m.action)?f.createElement("button",{"data-button":!0,"data-action":!0,style:m.actionButtonStyle||C,onClick:e=>{var t,r;Wl(m.action)&&(null==(r=(t=m.action).onClick)||r.call(t,e),!e.defaultPrevented&&Ee())},className:Hl(null==L?void 0:L.actionButton,null==(u=null==m?void 0:m.classNames)?void 0:u.actionButton)},m.action.label):null));var Ne,Ce,Ae};function Jl(){if("undefined"==typeof window||"undefined"==typeof document)return"ltr";let e=document.documentElement.getAttribute("dir");return"auto"!==e&&e?e:window.getComputedStyle(document.documentElement).direction}function Yl(e,t){let r={};return[e,t].forEach((e,t)=>
21{let n=1===t,s=n?"--mobile-offset":"--offset",a=n?"16px":"32px";function o(e){["top","right","bottom","left"].forEach(t=>{r[`${s}-${t}`]="number"==typeof e?`${e}px`:e})}"number"==typeof e||"string"==typeof e?o(e):"object"==typeof e?["top","right","bottom","left"].forEach(t=>{void 0===e[t]?r[`${s}-${t}`]=a:r[`${s}-${t}`]="number"==typeof e[t]?`${e[t]}px`:e[t]}):o(a)}),r}var Xl=p.forwardRef(function(e,t){let{invert:r,position:n="bottom-right",hotkey:s=["altKey","KeyT"],expand:a,closeButton:o,className:i,offset:l,mobileOffset:c,theme:d="light",richColors:u,duration:h,style:p,visibleToasts:g=Vl,toastOptions:y,dir:v=Jl(),gap:w=Kl,loadingIcon:b,icons:x,containerAriaLabel:_="Notifications",pauseWhenPageIsHidden:k}=e,[j,T]=f.useState([]),S=f.useMemo(()=>Array.from(new Set([n].concat(j.filter(e=>e.position).map(e=>e.position)))),[j,n]),[E,N]=f.useState([]),[C,A]=f.useState(!1),[R,I]=f.useState(!1),[O,P]=f.useState("system"!==d?d:"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),$=f.useRef(null),D=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),L=f.useRef(null),U=f.useRef(!1),M=f.useCallback(e=>{T(t=>{var r;return null!=(r=t.find(t=>t.id===e.id))&&r.delete||ql.dismiss(e.id),t.filter(({id:t})=>t!==e.id)})},[]);return f.useEffect(()=>ql.subscribe(e=>{e.dismiss?T(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t)):setTimeout(()=>{m.flushSync(()=>{T(t=>{let r=t.findIndex(t=>t.id===e.id);return-1!==r?[...t.slice(0,r),{...t[r],...e},...t.slice(r+1)]:[e,...t]})})})}),[]),f.useEffect(()=>{if("system"!==d)return void P(d);if("system"===d&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?P("dark"):P("light")),"undefined"==typeof window)return;let e=window.matchMedia("(prefers-color-scheme: dark)");try{e.addEventListener("change",({matches:e})=>{P(e?"dark":"light")})}catch(t){e.addListener(({matches:e})=>{try{P(e?"dark":"light")}catch(t){}})}},[d]),f.useEffect(()=>{j.length<=1&&A(!1)},[j]),f.useEffect(()=>{let e=e=>{var t,r;s.every(t=>e[t]||e.code===t)&&(A(!0),null==(t=$.current)||t.focus()),"Escape"===e.code&&(document.activeElement===$.current||null!=(r=$.current)&&r.contains(document.activeElement))&&A(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[s]),f.useEffect(()=>{if($.current)return()=>{L.current&&(L.current.focus({preventScroll:!0}),L.current=null,U.current=!1)}},[$.current]),f.createElement("section",{ref:t,"aria-label":`${_} ${D}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},S.map((t,n)=>{var s;let[d,m]=t.split("-");return j.length?f.createElement("ol",{key:t,dir:"auto"===v?Jl():v,tabIndex:-1,ref:$,className:i,"data-sonner-toaster":!0,"data-theme":O,"data-y-position":d,"data-lifted":C&&j.length>1&&!a,"data-x-position":m,style:{"--front-toast-height":`${(null==(s=E[0])?void 0:s.height)||0}px`,"--width":"356px","--gap":`${w}px`,...p,...Yl(l,c)},onBlur:e=>{U.current&&!e.currentTarget.contains(e.relatedTarget)&&(U.current=!1,L.current&&(L.current.focus({preventScroll:!0}),L.current=null))},onFocus:e=>{e.target instanceof HTMLElement&&"false"===e.target.dataset.dismissible||U.current||(U.current=!0,L.current=e.relatedTarget)},onMouseEnter:()=>A(!0),onMouseMove:()=>A(!0),onMouseLeave:()=>{R||A(!1)},onDragEnd:()=>A(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&"false"===e.target.dataset.dismissible||I(!0)},onPointerUp:()=>I(!1)},j.filter(e=>!e.position&&0===n||e.position===t).map((n,s)=>{var i,l;return f.createElement(Gl,{key:n.id,icons:x,index:s,toast:n,defaultRichColors:u,duration:null!=(i=null==y?void 0:y.duration)?i:h,className:null==y?void 0:y.className,descriptionClassName:null==y?void 0:y.descriptionClassName,invert:r,visibleToasts:g,closeButton:null!=(l=null==y?void 0:y.closeButton)?l:o,interacting:R,position:t,style:null==y?void 0:y.style,unstyled:null==y?void 0:y.unstyled,classNames:null==y?void 0:y.classNames,cancelButtonStyle:null==y?void 0:y.cancelButtonStyle,actionButtonStyle:null==y?void 0:y.actionButtonStyle,removeToast:M,toasts:j.filter(e=>e.position==n.position),heights:E.filter(e=>e.position==n.position),setHeights:N,expandByDefault:a,gap:w,loadingIcon:b,expanded:C,pauseWhenPageIsHidden:k,swipeDirections:e.swipeDirections})})):null}))});const Ql=({...e})=>{const{theme:t="system"}=null!=(r=p.useContext(Al))?r:Rl;var r;return a.jsx(Xl,{position:"top-center",theme:t,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...e})},Zl=z,ec=M,tc=q,rc=p.forwardRef(({className:e,sideOffset:t=4,...r},n)=>
21a.jsx(U,{ref:n,sideOffset:t,className:bl("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",e),...r}));rc.displayName=U.displayName;const nc={init(e){!function(e){try{return t=window,r=document,n="clarity",s="script",a=e,void(r.getElementById("clarity-script")||(t[n]=t[n]||function(){(t[n].q=t[n].q||[]).push(arguments)},(o=r.createElement(s)).async=1,o.src="https://www.clarity.ms/tag/"+a+"?ref=npm",o.id="clarity-script",(i=r.getElementsByTagName(s)[0]).parentNode.insertBefore(o,i)))}catch(l){return}var t,r,n,s,a,o,i}(e)},setTag(e,t){window.clarity("set",e,t)},identify(e,t,r,n){window.clarity("identify",e,t,r,n)},consent(e=!0){window.clarity("consent",e)},consentV2(e={ad_Storage:"granted",analytics_Storage:"granted"}){window.clarity("consentv2",e)},upgrade(e){window.clarity("upgrade",e)},event(e){window.clarity("event",e)}};let sc=!1;function ac(){if(!sc&&function(){if("undefined"==typeof window)return!1;const e=window.location.hostname;return"localhost"!==e&&"127.0.0.1"!==e&&!e.startsWith("id-preview--")&&!e.startsWith("preview--")&&"lovableproject.com"!==e&&!e.endsWith(".lovableproject.com")}())try{nc.init("y3rrrnrk32"),sc=!0}catch{}}function oc(e){ac(),function(e){if(sc)try{nc.consent(e)}catch{}}(e)}function ic(e,t={}){"undefined"!=typeof window&&(window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:e,...t}))}function lc(e,t){"undefined"!=typeof window&&(window.dataLayer=window.dataLayer||[],window.dataLayer.push({ecommerce:null}),window.dataLayer.push({event:e,ecommerce:t}))}function cc(e){const t=function(){if("undefined"==typeof document)return null;const e=document.cookie.match(/_ga=GA1\.\d\.(.+?)(?:;|$)/);return e?e[1]:null}();if(!t)return e;try{const r=new URL(e);return r.searchParams.set("_ga","2."+t),r.toString()}catch{return e}}const dc="cookie_consent";function uc(){const e=localStorage.getItem(dc);return"granted"===e?"granted":"denied"===e?"denied":"pending"}const hc="1a_visitor",pc="1a_session",fc="1a_current_touch",mc="1a_session_recorded";function gc(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function yc(){return crypto.randomUUID()}function vc(){if("undefined"==typeof window)return"";const e=Date.now(),t=gc(localStorage.getItem(hc));if((null==t?void 0:t.id)&&t.expiresAt>e)return t.id;const r={id:yc(),expiresAt:e+63072e6};return localStorage.setItem(hc,JSON.stringify(r)),r.id}function wc(e){if(e)try{return new URL(e).hostname.toLowerCase()}catch{return}}function bc(e,t){var r,n;const s=null==(r=e.get("utm_medium"))?void 0:r.toLowerCase(),a=null==(n=e.get("utm_source"))?void 0:n.toLowerCase();if(e.get("gclid")||s&&["cpc","ppc","paid","paidsearch"].includes(s))return"Paid Search";if(e.get("fbclid")||e.get("li_fat_id")||"paid-social"===s||a&&["facebook","instagram","linkedin","tiktok"].includes(a)&&(null==s?void 0:s.includes("paid")))return"Paid Social";if("email"===s||"email"===a)return"Email";if(!t)return"Direct";const o=wc(t);return o?"1adisplay.com"===o||o.endsWith(".1adisplay.com")||o.endsWith(".myshopify.com")||o.endsWith(".lovable.app")?"Direct":["google.","bing.","duckduckgo.","yandex.","baidu.","yahoo."].some(e=>o.includes(e))?"Organic Search":["facebook.","instagram.","linkedin.","twitter.","x.com","reddit.","youtube.","tiktok."].some(e=>o.includes(e))?"Social":"Referral":"Direct"}function xc(){if("undefined"==typeof window)return{channel:"Unknown"};const e=new URLSearchParams(window.location.search),t=document.referrer||"",r={channel:bc(e,t),source:e.get("utm_source")||wc(t),medium:e.get("utm_medium")||void 0,campaign:e.get("utm_campaign")||void 0,referrer:t||void 0,landingPage:`${window.location.pathname}${window.location.search}`,gclid:e.get("gclid")||void 0};return sessionStorage.setItem(fc,JSON.stringify(r)),r}let _c=null;function kc(){return _c||(_c=(async()=>{try{const e=vc(),t=function(){if("undefined"==typeof window)return"";const e=Date.now(),t=gc(sessionStorage.getItem(pc));if((null==t?void 0:t.id)&&e-t.lastActiveAt<=18e5)return sessionStorage.setItem(pc,JSON.stringify({...t,lastActiveAt:e})),t.id;const r={id:yc(),lastActiveAt:e};return sessionStorage.setItem(pc,JSON.stringify(r)),sessionStorage.removeItem(mc),r.id}(),r=xc();if(sessionStorage.getItem(mc)===t)return null;const{data:n,error:s}=await la.functions.invoke("track-attribution",{body:{action:"session",visitorId:e,sessionId:t,touch:r}});return s||(null==n?void 0:n.error)?null:(sessionStorage.setItem(mc,t),(null==n?void 0:n.attribution)??null)}catch{return null}})(),_c)}const jc="https://embed.tawk.to/6abe0289d52c513444ad39b4/1k3r3jqku";let Tc=!1;const Sc=[];function Ec(e){if("undefined"==typeof window)return;const t=window.Tawk_API;if(Tc&&t)try{e(t)}catch(r){}else Sc.push(e)}function Nc(){Tc=!0;const e=window.Tawk_API;if(e)for(;Sc.length;){const r=Sc.shift();try{r(e)}catch(t){}}}function Cc(e){const t={};for(const[r,n]of Object.entries(e)){if(null==n||""===n)continue;const e=r.toLowerCase().replace(/[^a-z0-9-]+/g,"-").replace(/^-+|-+$/g,""),s=String(n).slice(0,255);e&&s&&(t[e]=s)}return t}let Ac,Rc,Ic={},Oc={items:0,value:0,currency:"USD"},Pc=!1;function $c(){const e=window.innerWidth;return e<768?"mobile":e<=1024?"tablet":"desktop"}function Dc(){const e=uc();return"pending"===e?"unknown":e}
21function Lc(){return Cc({"cart-items":String(Oc.items||0),"cart-value":Oc.items>0?Oc.value.toFixed(2):"0","cart-currency":Oc.currency||"USD","page-url":window.location.href,referrer:document.referrer||"direct",device:$c(),"logged-in":Pc?"true":"false","cookie-consent":Dc(),"attribution-visitor":vc(),"first-page-channel":("undefined"==typeof window?{channel:"Unknown"}:gc(sessionStorage.getItem(fc))??xc()).channel,"last-product":Ic.title,"last-product-sku":Ic.sku,"last-category":Ac??Ic.category})}let Uc=0,Mc="",qc=!1,zc={},Bc=!1;function Fc(){if("undefined"==typeof window)return;if(void 0!==Rc)return;const e=Math.max(0,500-(Date.now()-Uc));Rc=window.setTimeout(()=>{Rc=void 0,function(){if(Uc=Date.now(),Bc)return;const e={...Lc(),...Cc(zc)},t=JSON.stringify(e);t!==Mc&&(Mc=t,Ec(t=>{var r;null==(r=t.setAttributes)||r.call(t,e,e=>{e&&(Mc="",qc||(qc=!0))})}))}()},e)}function Wc(e){Oc=e,Fc()}function Vc(e){Ic=e,e.category&&(Ac=e.category),Fc()}function Kc(e){e&&(Ac=e,Fc())}function Hc(e){Pc!==e&&(Pc=e,e?Yc(["shopify-customer"]):Xc(["shopify-customer"]),Fc())}function Gc(){return Pc}function Jc(e,t={}){const r=e.toLowerCase().replace(/[^a-z0-9-]+/g,"-"),n=Cc(t);Ec(e=>{var t;null==(t=e.addEvent)||t.call(e,r,n,e=>{})})}function Yc(e){const t=e.filter(Boolean).slice(0,10);t.length&&Ec(e=>{var r;return null==(r=e.addTags)?void 0:r.call(e,t,e=>{})})}function Xc(e){Ec(t=>{var r;return null==(r=t.removeTags)?void 0:r.call(t,e,e=>{})})}function Qc(){Ec(e=>{var t;return null==(t=e.maximize)?void 0:t.call(e)})}function Zc(){Ec(e=>{var t;return null==(t=e.showWidget)?void 0:t.call(e)})}function ed(){Ec(e=>{var t;return null==(t=e.hideWidget)?void 0:t.call(e)})}async function td(e){if(e.id){Bc=!0;try{const{data:t,error:r}=await la.functions.invoke("tawk-hash",{body:{}});if(r||!(null==t?void 0:t.hash)||!t.userId)return;const n=t.email??e.email;zc=t.emailHash&&n?{name:e.name,email:n,hash:t.emailHash}:{},Ec(r=>{var s;return null==(s=r.login)?void 0:s.call(r,{userId:t.userId,hash:t.hash,name:e.name,email:n},e=>{})})}catch(t){}finally{Bc=!1,Mc="",Fc()}}}function rd(){zc={},Mc="",Ec(e=>{var t;return null==(t=e.logout)?void 0:t.call(e,e=>{})})}const nd=Object.freeze(Object.defineProperty({__proto__:null,TAWK_EMBED_SRC:jc,addTawkTags:Yc,buildTawkContext:Lc,cleanTawkValues:Cc,hideTawkChat:ed,identifyTawkUser:td,isTawkLoggedIn:Gc,logoutTawkUser:rd,markTawkReady:Nc,minimizeTawkChat:function(){Ec(e=>{var t;return null==(t=e.minimize)?void 0:t.call(e)})},openTawkChat:Qc,pushTawkEvent:Jc,removeTawkTags:Xc,setTawkCart:Wc,setTawkLastCategory:Kc,setTawkLastProduct:Vc,setTawkLoggedIn:Hc,showTawkChat:Zc,syncTawkContext:Fc},Symbol.toStringTag,{value:"Module"})),sd=e=>{let t;const r=new Set,n=(e,n)=>{const s="function"==typeof e?e(t):e;if(!Object.is(s,t)){const e=t;t=(null!=n?n:"object"!=typeof s||null===s)?s:Object.assign({},t,s),r.forEach(r=>r(t,e))}},s=()=>t,a={setState:n,getState:s,getInitialState:()=>o,subscribe:e=>(r.add(e),()=>r.delete(e))},o=t=e(n,s,a);return a},ad=e=>e;const od=e=>{const t=(e=>e?sd(e):sd)(e),r=e=>function(e,t=ad){const r=f.useSyncExternalStore(e.subscribe,f.useCallback(()=>t(e.getState()),[e,t]),f.useCallback(()=>t(e.getInitialState()),[e,t]));return f.useDebugValue(r),r}(t,e);return Object.assign(r,t),r},id=e=>od;function ld(e,t){let r;try{r=e()}catch(n){return}return{getItem:e=>{var t;const n=e=>null===e?null:JSON.parse(e,void 0),s=null!=(t=r.getItem(e))?t:null;return s instanceof Promise?s.then(n):n(s)},setItem:(e,t)=>r.setItem(e,JSON.stringify(t,void 0)),removeItem:e=>r.removeItem(e)}}const cd=e=>t=>{try{const r=e(t);return r instanceof Promise?r:{then:e=>cd(e)(r),catch(e){return this}}}catch(r){return{then(e){return this},catch:e=>cd(e)(r)}}},dd=(e,t)=>(r,n,s)=>{let a={storage:ld(()=>localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},o=!1;const i=new Set,l=new Set;let c=a.storage;if(!c)return e((...e)=>{r(...e)},n,s);const d=()=>{const e=a.partialize({...n()});return c.setItem(a.name,{state:e,version:a.version})},u=s.setState;s.setState=(e,t)=>(u(e,t),d());const h=e((...e)=>(r(...e),d()),n,s);let p;s.getInitialState=()=>h;const f=()=>{var e,t;if(!c)return;
21o=!1,i.forEach(e=>{var t;return e(null!=(t=n())?t:h)});const s=(null==(t=a.onRehydrateStorage)?void 0:t.call(a,null!=(e=n())?e:h))||void 0;return cd(c.getItem.bind(c))(a.name).then(e=>{if(e){if("number"!=typeof e.version||e.version===a.version)return[!1,e.state];if(a.migrate){const t=a.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}}return[!1,void 0]}).then(e=>{var t;const[s,o]=e;if(p=a.merge(o,null!=(t=n())?t:h),r(p,!0),s)return d()}).then(()=>{null==s||s(p,void 0),p=n(),o=!0,l.forEach(e=>e(p))}).catch(e=>{null==s||s(void 0,e)})};return s.persist={setOptions:e=>{a={...a,...e},e.storage&&(c=e.storage)},clearStorage:()=>{null==c||c.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>f(),hasHydrated:()=>o,onHydrate:e=>(i.add(e),()=>{i.delete(e)}),onFinishHydration:e=>(l.add(e),()=>{l.delete(e)})},a.skipHydration||f(),p||h},ud="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Imd4bWtwbG1seWNnaXV3dGllbml4Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjY0OTE1MjYsImV4cCI6MjA4MjA2NzUyNn0.6dcemEpR79EJB7f8-OPvBqJqxIxUwrybkmfDWAxSHe8";function hd(e){try{const t=new URL(e);return t.searchParams.set("channel","online_store"),t.toString()}catch{return e}}function pd(e){return e.some(e=>e.message.toLowerCase().includes("cart not found")||e.message.toLowerCase().includes("does not exist"))}async function fd(e,t,r){const n=(await gd("\n mutation cartLinesUpdate($cartId: ID!, $lines: [CartLineUpdateInput!]!) {\n cartLinesUpdate(cartId: $cartId, lines: $lines) {\n cart { id }\n userErrors { field message }\n }\n }\n",{cartId:e,lines:[{id:t,quantity:r}]})).data.cartLinesUpdate.userErrors||[];return pd(n)?{success:!1,cartNotFound:!0}:n.length>0?{success:!1}:{success:!0}}
21class md extends Error{constructor(e,t,r){super(e),s(this,"code"),s(this,"status"),this.name="ShopifyApiError",this.code=t,this.status=r}}async function gd(e,t={},r=2e4){var n,s;let a=null;for(let i=0;i<=1;i++){i>0&&await new Promise(e=>setTimeout(e,1500));const l=new AbortController,c=setTimeout(()=>l.abort(),r);let d;try{d=await fetch("https://gxmkplmlycgiuwtienix.supabase.co/functions/v1/shopify-storefront",{method:"POST",headers:{"Content-Type":"application/json",apikey:ud,Authorization:`Bearer ${ud}`},body:JSON.stringify({query:e,variables:t}),signal:l.signal})}catch(o){clearTimeout(c),a=o instanceof Error?o:new Error(String(o));const e=o instanceof DOMException&&"AbortError"===o.name;if((e||o instanceof TypeError)&&i<1)continue;if(e)throw new md("Request timed out","NETWORK_ERROR");throw new md(o instanceof Error?o.message:"Network error","NETWORK_ERROR")}finally{clearTimeout(c)}if(401===d.status){const e=await d.text();throw new md(`Shopify API unauthorized (401): ${e}`,"UNAUTHORIZED",401)}if(402===d.status)throw Fl.error("Shopify: Payment required",{description:"Shopify API access requires an active Shopify billing plan. Visit https://admin.shopify.com to upgrade."}),new md("Payment required","PAYMENT_REQUIRED",402);if(!d.ok)throw new md(`HTTP error! status: ${d.status}`,"UNKNOWN",d.status);const u=await d.json();if(u.errors){if("UNAUTHORIZED"===(null==(s=null==(n=u.errors[0])?void 0:n.extensions)?void 0:s.code))throw new md(`Shopify API unauthorized: ${u.errors.map(e=>e.message).join(", ")}`,"UNAUTHORIZED",401);throw new md(`Error calling Shopify: ${u.errors.map(e=>e.message).join(", ")}`,"UNKNOWN")}return u}throw a||new md("Request failed after retries","NETWORK_ERROR")}const yd="shopify-products-cache";function vd(e,t){try{sessionStorage.setItem(`${yd}-${e}`,JSON.stringify({ts:Date.now(),data:t}))}catch{}}async function wd(e=12,t){const r=`all-${e}-${t||""}`;if(100===e&&!t){const e=await async function(){var e,t;try{const r=window.__PREFETCH_PRODUCTS__;if(r&&"function"==typeof r.then){delete window.__PREFETCH_PRODUCTS__;const n=await r;if(null==(t=null==(e=null==n?void 0:n.data)?void 0:e.products)?void 0:t.edges)return n.data.products.edges}}catch{}return null}();if(e)return vd(r,e),e}try{const n=(await gd("\n query GetProducts($first: Int!, $query: String) {\n products(first: $first, query: $query) {\n edges {\n node {\n id\n title\n description\n handle\n productType\n tags\n priceRange {\n minVariantPrice {\n amount\n currencyCode\n }\n }\n compareAtPriceRange {\n minVariantPrice {\n amount\n currencyCode\n }\n }\n images(first: 5) {\n edges {\n node {\n url\n altText\n }\n }\n }\n variants(first: 10) {\n edges {\n node {\n id\n title\n price {\n amount\n currencyCode\n }\n compareAtPrice {\n amount\n currencyCode\n }\n availableForSale\n sku\n selectedOptions {\n name\n value\n }\n }\n }\n }\n options {\n name\n values\n }\n collections(first: 5) {\n edges {\n node {\n handle\n title\n }\n }\n }\n }\n }\n }\n }\n",{first:e,query:t})).data.products.edges;return vd(r,n),n}catch(n){const e=function(e){try{const t=sessionStorage.getItem(`${yd}-${e}`);if(!t)return null;const r=JSON.parse(t);return Date.now()-r.ts>18e5?null:r.data}catch{return null}}(r);if(e)return e;throw n}}async function bd(e){return(await gd('\n query GetProductByHandle($handle: String!) {\n productByHandle(handle: $handle) {\n id\n title\n description\n descriptionHtml\n seo {\n title\n description\n }\n handle\n productType\n tags\n priceRange {\n minVariantPrice {\n amount\n currencyCode\n }\n }\n compareAtPriceRange {\n minVariantPrice {\n amount\n currencyCode\n }\n }\n images(first: 10) {\n edges {\n node {\n url\n altText\n }\n }\n }\n variants(first: 50) {\n edges {\n node {\n id\n title\n image {\n url\n altText\n }\n price {\n amount\n currencyCode\n }\n compareAtPrice {\n amount\n currencyCode\n }\n availableForSale\n sku\n selectedOptions {\n name\n value\n }\n }\n }\n }\n options {\n name\n values\n }\n collections(first: 1) {\n edges {\n node {\n handle\n title\n }\n }\n }\n specifications: metafield(namespace: "custom", key: "specifications") {\n value\n type\n }\n }\n }\n',{handle:e})).data.productByHandle}async function xd(e){const t=e.trim();if(t.length<2||!/^[A-Za-z0-9._\-\/]+$/.test(t))return[];try{const e=await fetch("https://gxmkplmlycgiuwtienix.supabase.co/functions/v1/shopify-sku-search",{method:"POST",headers:{"Content-Type":"application/json",apikey:ud,Authorization:`Bearer ${ud}`},body:JSON.stringify({term:t})});if(!e.ok)return[];const r=await e.json();return Array.isArray(null==r?void 0:r.products)?r.products:[]}catch{return[]}}async function _d(e=20){return(await gd("\n query GetCollections($first: Int!) {\n collections(first: $first) {\n edges {\n node {\n id\n title\n description\n handle\n image {\n url\n altText\n }\n products(first: 1, sortKey: PRICE) {\n edges {\n node {\n id\n priceRange {\n minVariantPrice {\n amount\n currencyCode\n }\n }\n images(first: 1) {\n edges {\n node {\n url\n altText\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n",{first:e})).data.collections.edges.map(e=>{var t,r,n,s,a,o;const i=(null==(t=e.node.products)?void 0:t.edges)||[];let l;if(i.length>0){const e=i.map(e=>({amount:parseFloat(e.node.priceRange.minVariantPrice.amount),currencyCode:e.node.priceRange.minVariantPrice.currencyCode})).filter(e=>!isNaN(e.amount));if(e.length>0){const t=e.reduce((e,t)=>
21t.amount<e.amount?t:e);l={amount:t.amount.toString(),currencyCode:t.currencyCode}}}const c=(null==(o=null==(a=null==(s=null==(n=null==(r=i[0])?void 0:r.node)?void 0:n.images)?void 0:s.edges)?void 0:a[0])?void 0:o.node)||null;return{...e.node,productsCount:{count:i.length},minPrice:l,firstProductImage:c}})}async function kd(e,t=50){return(await gd("\n query GetCollectionByHandle($handle: String!, $first: Int!) {\n collection(handle: $handle) {\n id\n title\n description\n handle\n seo {\n title\n description\n }\n image {\n url\n altText\n }\n products(first: $first) {\n edges {\n node {\n id\n title\n description\n handle\n priceRange {\n minVariantPrice {\n amount\n currencyCode\n }\n }\n images(first: 5) {\n edges {\n node {\n url\n altText\n }\n }\n }\n variants(first: 10) {\n edges {\n node {\n id\n title\n price {\n amount\n currencyCode\n }\n availableForSale\n selectedOptions {\n name\n value\n }\n }\n }\n }\n options {\n name\n values\n }\n }\n }\n }\n }\n }\n",{handle:e,first:t})).data.collection}function jd(e,t="USD"){return new Intl.NumberFormat("en-US",{style:"currency",currency:t}).format(parseFloat(e))}function Td(e){var t,r;return function(e,t){const r=parseFloat(String(e??"0"))||0,n=parseFloat(String(t??"0"))||0;return r>0&&r>n}(null==(r=null==(t=e.node.compareAtPriceRange)?void 0:t.minVariantPrice)?void 0:r.amount,e.node.priceRange.minVariantPrice.amount)}function Sd(e){var t,r;const n=parseFloat(e.node.priceRange.minVariantPrice.amount),s=parseFloat((null==(r=null==(t=e.node.compareAtPriceRange)?void 0:t.minVariantPrice)?void 0:r.amount)||"0"),a=s>0&&s>n;return{isOnSale:a,originalPrice:a?e.node.compareAtPriceRange.minVariantPrice.amount:null,salePrice:e.node.priceRange.minVariantPrice.amount,discountPercent:a?(o=s,i=n,o<=0||i>=o?0:Math.round((o-i)/o*100)):0};var o,i}function Ed(e){return Oa(e.handle)}function Nd(e){return Oa(e.node.handle)}async function Cd(e,t){const r=(await gd("\n mutation customerAccessTokenCreate($input: CustomerAccessTokenCreateInput!) {\n customerAccessTokenCreate(input: $input) {\n customerAccessToken {\n accessToken\n expiresAt\n }\n customerUserErrors {\n code\n field\n message\n }\n }\n }\n",{input:{email:e,password:t}})).data.customerAccessTokenCreate;if(r.customerUserErrors.length>0)throw new Error(r.customerUserErrors.map(e=>e.message).join(", "));return r.customerAccessToken}async function Ad(e){const t=await gd("\n query getCustomerOrders($customerAccessToken: String!) {\n customer(customerAccessToken: $customerAccessToken) {\n id\n firstName\n lastName\n email\n phone\n orders(first: 20, sortKey: PROCESSED_AT, reverse: true) {\n edges {\n node {\n id\n orderNumber\n name\n processedAt\n financialStatus\n fulfillmentStatus\n totalPrice {\n amount\n currencyCode\n }\n lineItems(first: 10) {\n edges {\n node {\n title\n quantity\n customAttributes {\n key\n value\n }\n originalTotalPrice {\n amount\n currencyCode\n }\n variant {\n title\n image {\n url\n altText\n }\n product {\n handle\n }\n }\n }\n }\n }\n statusUrl\n }\n }\n }\n }\n }\n",{customerAccessToken:e});if(!t.data.customer)return null;const{orders:r,...n}=t.data.customer;return{customer:n,orders:r.edges.map(e=>e.node)}}async function Rd(e){var t;const r=await gd("\n query getCustomerAddresses($customerAccessToken: String!) {\n customer(customerAccessToken: $customerAccessToken) {\n defaultAddress {\n id\n }\n addresses(first: 20) {\n edges {\n node {\n id\n firstName\n lastName\n company\n address1\n address2\n city\n province\n provinceCode\n country\n countryCodeV2\n zip\n phone\n }\n }\n }\n }\n }\n",{customerAccessToken:e});return r.data.customer?{addresses:r.data.customer.addresses.edges.map(e=>e.node),defaultAddressId:(null==(t=r.data.customer.defaultAddress)?void 0:t.id)||null}:{addresses:[],defaultAddressId:null}}async function Id(){return(await gd("\n query GetShopPolicies {\n shop {\n privacyPolicy { title body handle }\n refundPolicy { title body handle }\n termsOfService { title body handle }\n shippingPolicy { title body handle }\n }\n }\n")).data.shop}const Od=id()(dd((e,t)=>({accessToken:null,expiresAt:null,customer:null,orders:[],addresses:[],defaultAddressId:null,isLoading:!1,error:null,login:async(t,r)=>
21{e({isLoading:!0,error:null});try{const n=await Cd(t,r);if(!n)throw new Error("Invalid email or password");e({accessToken:n.accessToken,expiresAt:n.expiresAt});const s=await Ad(n.accessToken);s&&e({customer:s.customer,orders:s.orders});const a=await Rd(n.accessToken);e({addresses:a.addresses,defaultAddressId:a.defaultAddressId})}catch(n){throw e({error:n instanceof Error?n.message:"Login failed"}),n}finally{e({isLoading:!1})}},register:async(t,r,n,s)=>{e({isLoading:!0,error:null});try{await async function(e,t,r,n){const s=(await gd("\n mutation customerCreate($input: CustomerCreateInput!) {\n customerCreate(input: $input) {\n customer {\n id\n email\n firstName\n lastName\n }\n customerUserErrors {\n code\n field\n message\n }\n }\n }\n",{input:{email:e,password:t,firstName:r,lastName:n}})).data.customerCreate;if(s.customerUserErrors.length>0)throw new Error(s.customerUserErrors.map(e=>e.message).join(", "));if(!s.customer)throw new Error("Failed to create customer");return s.customer}(t,r,n,s);const a=await Cd(t,r);if(!a)throw new Error("Account created but login failed");e({accessToken:a.accessToken,expiresAt:a.expiresAt});const o=await Ad(a.accessToken);o&&e({customer:o.customer,orders:o.orders})}catch(a){throw e({error:a instanceof Error?a.message:"Registration failed"}),a}finally{e({isLoading:!1})}},logout:()=>{e({accessToken:null,expiresAt:null,customer:null,orders:[],addresses:[],defaultAddressId:null,error:null})},fetchOrders:async()=>{const{accessToken:r}=t();if(r){e({isLoading:!0,error:null});try{const t=await Ad(r);e(t?{customer:t.customer,orders:t.orders}:{accessToken:null,expiresAt:null,customer:null,orders:[],addresses:[],defaultAddressId:null})}catch(n){e({error:n instanceof Error?n.message:"Failed to fetch orders"})}finally{e({isLoading:!1})}}},fetchAddresses:async()=>{const{accessToken:r}=t();if(r){e({isLoading:!0,error:null});try{const t=await Rd(r);e({addresses:t.addresses,defaultAddressId:t.defaultAddressId})}catch(n){e({error:n instanceof Error?n.message:"Failed to fetch addresses"})}finally{e({isLoading:!1})}}},addAddress:async r=>{const{accessToken:n}=t();if(!n)throw new Error("Not logged in");e({isLoading:!0,error:null});try{const t=await async function(e,t){const r=(await gd("\n mutation customerAddressCreate($customerAccessToken: String!, $address: MailingAddressInput!) {\n customerAddressCreate(customerAccessToken: $customerAccessToken, address: $address) {\n customerAddress {\n id\n firstName\n lastName\n company\n address1\n address2\n city\n province\n provinceCode\n country\n countryCodeV2\n zip\n phone\n }\n customerUserErrors {\n code\n field\n message\n }\n }\n }\n",{customerAccessToken:e,address:t})).data.customerAddressCreate;if(r.customerUserErrors.length>0)throw new Error(r.customerUserErrors.map(e=>e.message).join(", "));if(!r.customerAddress)throw new Error("Failed to create address");return r.customerAddress}(n,r);return e(e=>({addresses:[...e.addresses,t]})),t}catch(s){throw e({error:s instanceof Error?s.message:"Failed to add address"}),s}finally{e({isLoading:!1})}},updateAddress:async(r,n)=>{const{accessToken:s}=t();if(!s)throw new Error("Not logged in");e({isLoading:!0,error:null});try{const t=await async function(e,t,r){const n=(await gd("\n mutation customerAddressUpdate($customerAccessToken: String!, $id: ID!, $address: MailingAddressInput!) {\n customerAddressUpdate(customerAccessToken: $customerAccessToken, id: $id, address: $address) {\n customerAddress {\n id\n firstName\n lastName\n company\n address1\n address2\n city\n province\n provinceCode\n country\n countryCodeV2\n zip\n phone\n }\n customerUserErrors {\n code\n field\n message\n }\n }\n }\n",{customerAccessToken:e,id:t,address:r})).data.customerAddressUpdate;if(n.customerUserErrors.length>0)throw new Error(n.customerUserErrors.map(e=>e.message).join(", "));if(!n.customerAddress)throw new Error("Failed to update address");return n.customerAddress}(s,r,n);return e(e=>({addresses:e.addresses.map(e=>e.id===r?t:e)})),t}catch(a){throw e({error:a instanceof Error?a.message:"Failed to update address"}),a}finally{e({isLoading:!1})}},removeAddress:async r=>{const{accessToken:n}=t();if(!n)throw new Error("Not logged in");e({isLoading:!0,error:null});try{await async function(e,t){const r=(await gd("\n mutation customerAddressDelete($customerAccessToken: String!, $id: ID!) {\n customerAddressDelete(customerAccessToken: $customerAccessToken, id: $id) {\n deletedCustomerAddressId\n customerUserErrors {\n code\n field\n message\n }\n }\n }\n",{customerAccessToken:e,id:t})).data.customerAddressDelete;if(r.customerUserErrors.length>0)throw new Error(r.customerUserErrors.map(e=>e.message).join(", "))}(n,r),e(e=>({addresses:e.addresses.filter(e=>e.id!==r),defaultAddressId:e.defaultAddressId===r?null:e.defaultAddressId}))}
21catch(s){throw e({error:s instanceof Error?s.message:"Failed to delete address"}),s}finally{e({isLoading:!1})}},setDefaultAddress:async r=>{const{accessToken:n}=t();if(!n)throw new Error("Not logged in");e({isLoading:!0,error:null});try{await async function(e,t){const r=(await gd("\n mutation customerDefaultAddressUpdate($customerAccessToken: String!, $addressId: ID!) {\n customerDefaultAddressUpdate(customerAccessToken: $customerAccessToken, addressId: $addressId) {\n customer {\n defaultAddress {\n id\n }\n }\n customerUserErrors {\n code\n field\n message\n }\n }\n }\n",{customerAccessToken:e,addressId:t})).data.customerDefaultAddressUpdate;if(r.customerUserErrors.length>0)throw new Error(r.customerUserErrors.map(e=>e.message).join(", "))}(n,r),e({defaultAddressId:r})}catch(s){throw e({error:s instanceof Error?s.message:"Failed to set default address"}),s}finally{e({isLoading:!1})}},updateProfile:async r=>{const{accessToken:n}=t();if(!n)throw new Error("Not logged in");e({isLoading:!0,error:null});try{const t=await async function(e,t){const r=(await gd("\n mutation customerUpdate($customerAccessToken: String!, $customer: CustomerUpdateInput!) {\n customerUpdate(customerAccessToken: $customerAccessToken, customer: $customer) {\n customer {\n id\n firstName\n lastName\n email\n phone\n acceptsMarketing\n }\n customerAccessToken {\n accessToken\n expiresAt\n }\n customerUserErrors {\n code\n field\n message\n }\n }\n }\n",{customerAccessToken:e,customer:t})).data.customerUpdate;if(r.customerUserErrors.length>0)throw new Error(r.customerUserErrors.map(e=>e.message).join(", "));if(!r.customer)throw new Error("Failed to update profile");return{customer:r.customer,newAccessToken:r.customerAccessToken||void 0}}(n,r);e({customer:t.customer}),t.newAccessToken&&e({accessToken:t.newAccessToken.accessToken,expiresAt:t.newAccessToken.expiresAt})}catch(s){throw e({error:s instanceof Error?s.message:"Failed to update profile"}),s}finally{e({isLoading:!1})}},requestPasswordReset:async t=>{e({isLoading:!0,error:null});try{await async function(e){const t=(await gd("\n mutation customerRecover($email: String!) {\n customerRecover(email: $email) {\n customerUserErrors {\n code\n field\n message\n }\n }\n }\n",{email:e})).data.customerRecover;if(t.customerUserErrors.length>0)throw new Error(t.customerUserErrors.map(e=>e.message).join(", "))}(t)}catch(r){throw e({error:r instanceof Error?r.message:"Failed to request password reset"}),r}finally{e({isLoading:!1})}},clearError:()=>e({error:null})}),{name:"shopify-customer",storage:ld(()=>localStorage),partialize:e=>({accessToken:e.accessToken,expiresAt:e.expiresAt})})),Pd=p.createContext(void 0);async function $d(e,t,r){e.accessToken=t,e.expiresAt=r;try{const e=await Ad(t);if(e){Od.setState({accessToken:t,expiresAt:r,customer:e.customer,orders:e.orders});const n=await Rd(t);Od.setState({addresses:n.addresses,defaultAddressId:n.defaultAddressId})}}catch(n){Od.setState({accessToken:t,expiresAt:r})}}let Dd=!1;async function Ld(e){const t=!0===(null==e?void 0:e.returnDetails),r=(e,r)=>t?{status:e,reason:r}:e;try{const t=(null==e?void 0:e.candidatePassword)?{candidatePassword:e.candidatePassword}:void 0,{data:n,error:s}=await la.functions.invoke("shopify-customer-token",{body:t});if(s)return r("failed","invoke_error");const a=null==n?void 0:n.status,o=null==n?void 0:n.reason;if("linked"===a&&(null==n?void 0:n.accessToken)){const e=Od.getState();return await $d(e,n.accessToken,n.expiresAt),r("linked")}if("needs_activation"===a)return r("needs_activation",o);if("needs_password"===a)return r("needs_password",o);if("failed"===a)return r("failed",o);if((null==n?void 0:n.needsManualLogin)||(null==n?void 0:n.needsActivation)){return r((null==n?void 0:n.needsActivation)?"needs_activation":"needs_password")}if(null==n?void 0:n.accessToken){const e=Od.getState();return await $d(e,n.accessToken,n.expiresAt),r("linked")}return r("failed","unknown")}catch(n){return r("failed","exception")}}function Ud({children:e}){const[t,r]=p.useState(null),[n,s]=p.useState(null),[o,i]=p.useState(!0),[l,c]=p.useState(!1),d=async e=>{const{data:t,error:r}=await la.from("user_roles").select("role").eq("user_id",e).eq("role","admin").maybeSingle();c(!(r||!t))};p.useEffect(()=>{const{data:{subscription:e}}=la.auth.onAuthStateChange((e,t)=>{s(t),r((null==t?void 0:t.user)??null),i(!1),(null==t?void 0:t.user)?(setTimeout(()=>{d(t.user.id)},0),"SIGNED_IN"===e&&(Jc("signed-in"),setTimeout(()=>{Od.getState().accessToken||Dd||(Dd=!0,Ld().finally(()=>{Dd=!1}))},0))):c(!1)});return la.auth.getSession().then(({data:{session:e}})=>{if(s(e),r((null==e?void 0:e.user)??null),i(!1),null==e?void 0:e.user){d(e.user.id);Od.getState().accessToken||Dd||(Dd=!0,Ld().finally(()=>{Dd=!1}))}}),()=>e.unsubscribe()},[]);return a.jsx(Pd.Provider,{value:{user:t,session:n,isLoading:o,isAdmin:l,signIn:async(e,t)=>{try{const{error:r}=await la.auth.signInWithPassword({email:e,password:t});return r||setTimeout(()=>{Ld({candidatePassword:t})},100),{error:r}}catch(r){return{error:new Error("Network error. Please check your connection and try again.")}}},signUp:async(e,t)=>{try{const r=`${window.location.origin}/`,{data:n,error:s}=await la.auth.signUp({email:e,password:t,options:{emailRedirectTo:r}});return!s&&(null==n?void 0:n.user)&&(Jc("account-created"),la.functions.invoke("sync-shopify-customer",{body:{email:e,user_id:n.user.id,chosenPassword:t}}).then(({data:e})=>
21{if(null==e?void 0:e.accessToken){$d(Od.getState(),e.accessToken,e.expiresAt)}}).catch(e=>{})),{error:s}}catch(r){return{error:new Error("Network error. Please check your connection and try again.")}}},signOut:async()=>{try{await la.auth.signOut({scope:"local"})}catch(e){}r(null),s(null),c(!1),Od.getState().logout()},resetPassword:async e=>{try{const{error:t}=await la.auth.resetPasswordForEmail(e,{redirectTo:`${window.location.origin}/reset-password`});return{error:t}}catch(t){return{error:new Error("Network error. Please check your connection and try again.")}}},updatePassword:async e=>{try{const{error:t}=await la.auth.updateUser({password:e});return{error:t}}catch(t){return{error:new Error("Network error. Please check your connection and try again.")}}}},children:e})}function Md(){const e=p.useContext(Pd);if(void 0===e)throw new Error("useAuth must be used within an AuthProvider");return e}const qd=Object.freeze(Object.defineProperty({__proto__:null,AuthProvider:Ud,fetchShopifyTokenOnLogin:Ld,useAuth:Md},Symbol.toStringTag,{value:"Module"})),zd=p.createContext(void 0),Bd=({children:e})=>{const[t,r]=p.useState(!0),[n,s]=p.useState(!1);p.useEffect(()=>{localStorage.getItem("announcement-dismissed")&&r(!1)},[]);const o=p.useCallback(e=>{s(e)},[]),i=t&&n;return a.jsx(zd.Provider,{value:{isVisible:t,hasActiveItems:n,shouldShowBar:i,dismiss:()=>{r(!1),localStorage.setItem("announcement-dismissed","true")},setHasActiveItems:o},children:e})},Fd=()=>{const e=p.useContext(zd);if(!e)throw new Error("useAnnouncement must be used within AnnouncementProvider");return e},Wd=Lo("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-medium transition-all duration-300 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-md hover:bg-primary/90 hover:shadow-lg",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-border bg-background hover:bg-muted hover:text-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-muted hover:text-foreground",link:"text-primary underline-offset-4 hover:underline",hero:"bg-accent-gradient text-primary-foreground shadow-lg hover:shadow-xl hover:scale-105 font-semibold tracking-wide",glow:"bg-primary text-primary-foreground shadow-md btn-glow hover:shadow-lg relative overflow-hidden",glass:"bg-white/90 backdrop-blur text-foreground hover:bg-white border border-border shadow-sm",navy:"bg-[hsl(var(--brand-navy))] text-white hover:bg-[hsl(214_54%_28%)] border-[hsl(var(--brand-navy))]"},size:{default:"h-11 px-6 py-2",sm:"h-9 rounded-md px-4 text-xs",lg:"h-12 rounded-lg px-8 text-base",xl:"h-14 roun
21ded-xl px-10 text-lg",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Vd=p.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...s},o)=>{const i=n?B:"button";return a.jsx(i,{className:bl(Wd({variant:t,size:r,className:e})),ref:o,...s})});Vd.displayName="Button";const Kd=J,Hd=Y,Gd=W,Jd=p.forwardRef(({className:e,...t},r)=>a.jsx(F,{className:bl("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,ref:r}));Jd.displayName=F.displayName;const Yd=Lo("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),Xd=p.forwardRef(({side:e="right",className:t,children:r,...n},s)=>a.jsxs(Gd,{children:[a.jsx(Jd,{}),a.jsxs(V,{ref:s,className:bl(Yd({side:e}),t),...n,children:[r,a.jsxs(K,{className:"absolute right-4 top-4 roun
21ded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-secondary hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[a.jsx(Si,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Xd.displayName=V.displayName;const Qd=({className:e,...t})=>a.jsx("div",{className:bl("flex flex-col space-y-2 text-center sm:text-left",e),...t});Qd.displayName="SheetHeader";const Zd=p.forwardRef(({className:e,...t},r)=>a.jsx(H,{ref:r,className:bl("text-lg font-semibold text-foreground",e),...t}));Zd.displayName=H.displayName;p.forwardRef(({className:e,...t},r)=>a.jsx(G,{ref:r,className:bl("text-sm text-muted-foreground",e),...t})).displayName=G.displayName;var eu=p.createContext(void 0);function tu(e){const t=p.useContext(eu);return e||t||"ltr"}function ru(e,[t,r]){return Math.min(r,Math.max(t,e))}var nu="ScrollArea",[su]=j(nu),[au,ou]=su(nu),iu=p.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:s,scrollHideDelay:o=600,...i}=e,[l,c]=p.useState(null),[d,u]=p.useState(null),[h,f]=p.useState(null),[m,g]=p.useState(null),[y,v]=p.useState(null),[w,b]=p.useState(0),[x,_]=p.useState(0),[k,j]=p.useState(!1),[S,E]=p.useState(!1),C=T(t,e=>c(e)),A=tu(s);return a.jsx(au,{scope:r,type:n,dir:A,scrollHideDelay:o,scrollArea:l,viewport:d,onViewportChange:u,content:h,onContentChange:f,scrollbarX:m,onScrollbarXChange:g,scrollbarXEnabled:k,onScrollbarXEnabledChange:j,scrollbarY:y,onScrollbarYChange:v,scrollbarYEnabled:S,onScrollbarYEnabledChange:E,onCornerWidthChange:b,onCornerHeightChange:_,children:a.jsx(N.div,{dir:A,...i,ref:C,style:{position:"relative","--radix-scroll-area-corner-width":w+"px","--radix-scroll-area-corner-height":x+"px",...e.style}})})});iu.displayName=nu;var lu="ScrollAreaViewport",cu=p.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:s,...o}=e,i=ou(lu,r),l=p.useRef(null),c=T(t,l,i.onViewportChange);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),a.jsx(N.div,{"data-radix-scroll-area-viewport":"",...o,ref:c,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:a.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});cu.displayName=lu;var du="ScrollAreaScrollbar",uu=p.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=ou(du,e.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:i}=s,l="horizontal"===e.orientation;return p.useEffect(()=>(l?o(!0):i(!0),()=>{l?o(!1):i(!1)}),[l,o,i]),"hover"===s.type?a.jsx(hu,{...n,ref:t,forceMount:r}):"scroll"===s.type?a.jsx(pu,{...n,ref:t,forceMount:r}):"auto"===s.type?a.jsx(fu,{...n,ref:t,forceMount:r}):"always"===s.type?a.jsx(mu,{...n,ref:t}):null});uu.displayName=du;var hu=p.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=ou(du,e.__scopeScrollArea),[o,i]=p.useState(!1);return p.useEffect(()=>{const e=s.scrollArea;let t=0;if(e){const r=()=>{window.clearTimeout(t),i(!0)},n=()=>{t=window.setTimeout(()=>i(!1),s.scrollHideDelay)};return e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",n),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",r),e.removeEventListener("pointerleave",n)}}},[s.scrollArea,s.scrollHideDelay]),a.jsx(A,{present:r||o,children:a.jsx(fu,{"data-state":o?"visible":"hidden",...n,ref:t})})}),pu=p.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=ou(du,e.__scopeScrollArea),o="horizontal"===e.orientation,i=Pu(()=>c("SCROLL_END"),100),[l,c]=(d="hidden",u={hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}},p.useReducer((e,t)=>u[e][t]??e,d));var d,u;return p.useEffect(()=>{if("idle"===l){const e=window.setTimeout(()=>c("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(e)}},[l,s.scrollHideDelay,c]),p.useEffect(()=>{const e=s.viewport,t=o?"scrollLeft":"scrollTop";if(e){let r=e[t];const n=()=>{const n=e[t];r!==n&&(c("SCROLL"),i()),r=n};return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}}
vendor: 9,466 bytes, line 21
21,[s.viewport,o,c,i]),a.jsx(A,{present:r||"hidden"!==l,children:a.jsx(mu,{"data-state":"hidden"===l?"hidden":"visible",...n,ref:t,onPointerEnter:R(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:R(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),fu=p.forwardRef((e,t)=>{const r=ou(du,e.__scopeScrollArea),{forceMount:n,...s}=e,[o,i]=p.useState(!1),l="horizontal"===e.orientation,c=Pu(()=>{if(r.viewport){const e=r.viewport.offsetWidth<r.viewport.scrollWidth,t=r.viewport.offsetHeight<r.viewport.scrollHeight;i(l?e:t)}},10);return $u(r.viewport,c),$u(r.content,c),a.jsx(A,{present:n||o,children:a.jsx(mu,{"data-state":o?"visible":"hidden",...s,ref:t})})}),mu=p.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,s=ou(du,e.__scopeScrollArea),o=p.useRef(null),i=p.useRef(0),[l,c]=p.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=Nu(l.viewport,l.content),u={...n,sizes:l,onSizesChange:c,hasThumb:Boolean(d>0&&d<1),onThumbChange:e=>o.current=e,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:e=>i.current=e};function h(e,t){return function(e,t,r,n="ltr"){const s=Cu(r),a=s/2,o=t||a,i=s-o,l=r.scrollbar.paddingStart+o,c=r.scrollbar.size-r.scrollbar.paddingEnd-i,d=r.content-r.viewport,u="ltr"===n?[0,d]:[-1*d,0];return Ru([l,c],u)(e)}(e,i.current,l,t)}return"horizontal"===r?a.jsx(gu,{...u,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const e=Au(s.viewport.scrollLeft,l,s.dir);o.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{s.viewport&&(s.viewport.scrollLeft=e)},onDragScroll:e=>{s.viewport&&(s.viewport.scrollLeft=h(e,s.dir))}}):"vertical"===r?a.jsx(yu,{...u,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const e=Au(s.viewport.scrollTop,l);o.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{s.viewport&&(s.viewport.scrollTop=e)},onDragScroll:e=>{s.viewport&&(s.viewport.scrollTop=h(e))}}):null}),gu=p.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...s}=e,o=ou(du,e.__scopeScrollArea),[i,l]=p.useState(),c=p.useRef(null),d=T(t,c,o.onScrollbarXChange);return p.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),a.jsx(bu,{"data-orientation":"horizontal",...s,ref:d,sizes:r,style:{bottom:0,left:"rtl"===o.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===o.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Cu(r)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,r)=>{if(o.viewport){const n=o.viewport.scrollLeft+t.deltaX;e.onWheelScroll(n),Iu(n,r)&&t.preventDefault()}},onResize:()=>{c.current&&o.viewport&&i&&n({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Eu(i.paddingLeft),paddingEnd:Eu(i.paddingRight)}})}})}),yu=p.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...s}=e,o=ou(du,e.__scopeScrollArea),[i,l]=p.useState(),c=p.useRef(null),d=T(t,c,o.onScrollbarYChange);return p.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),a.jsx(bu,{"data-orientation":"vertical",...s,ref:d,sizes:r,style:{top:0,right:"ltr"===o.dir?0:void 0,left:"rtl"===o.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Cu(r)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,r)=>{if(o.viewport){const n=o.viewport.scrollTop+t.deltaY;e.onWheelScroll(n),Iu(n,r)&&t.preventDefault()}},onResize:()=>{c.current&&o.viewport&&i&&n({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Eu(i.paddingTop),paddingEnd:Eu(i.paddingBottom)}})}})}),[vu,wu]=su(du),bu=p.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:s,onThumbChange:o,onThumbPointerUp:i,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:d,onWheelScroll:u,onResize:h,...f}=e,m=ou(du,r),[g,y]=p.useState(null),v=T(t,e=>y(e)),w=p.useRef(null),b=p.useRef(""),x=m.viewport,_=n.content-n.viewport,k=I(u),j=I(c),S=Pu(h,10);function E(e){if(w.current){const t=e.clientX-w.current.left,r=e.clientY-w.current.top;d({x:t,y:r})}}return p.useEffect(()=>{const e=e=>{const t=e.target;(null==g?void 0:g.contains(t))&&k(e,_)};return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})},[x,g,_,k]),p.useEffect(j,[n,j]),$u(g,S),$u(m.content,S),a.jsx(vu,{scope:r,scrollbar:g,hasThumb:s,onThumbChange:I(o),onThumbPointerUp:I(i),onThumbPositionChange:j,onThumbPointerDown:I(l),children:a.jsx(N.div,{...f,ref:v,style:{position:"absolute",...f.style},onPointerDown:R(e.onPointerDown,e=>{if(0===e.button){e.target.setPointerCapture(e.pointerId),w.current=g.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",m.viewport&&(m.viewport.style.scrollBehavior="auto"),E(e)}}),onPointerMove:R(e.onPointerMove,E),onPointerUp:R(e.onPointerUp,e=>{const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=b.current,m.viewport&&(m.viewport.style.scrollBehavior=""),w.current=null})})})}),xu="ScrollAreaThumb",_u=p.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=wu(xu,e.__scopeScrollArea);return a.jsx(A,{present:r||s.hasThumb,children:a.jsx(ku,{ref:t,...n})})}),ku=p.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...s}=e,o=ou(xu,r),i=wu(xu,r),{onThumbPositionChange:l}=i,c=T(t,e=>i.onThumbChange(e)),d=p.useRef(void 0),u=Pu(()=>{d.current&&(d.current(),d.current=void 0)},100);return p.useEffect(()=>{const e=o.viewport;if(e){const t=()=>{if(u(),!d.current){const t=Ou(e,l);d.current=t,l()}};return l(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[o.viewport,u,l]),a.jsx(N.div,{"data-state":i.hasThumb?"visible":"hidden",...s,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:R(e.onPointerDownCapture,e=>{const t=e.target.getBoundingClientRect(),r=e.clientX-t.left,n=e.clientY-t.top;i.onThumbPointerDown({x:r,y:n})}),onPointerUp:R(e.onPointerUp,i.onThumbPointerUp)})});_u.displayName=xu;var ju="ScrollAreaCorner",Tu=p.forwardRef((e,t)=>{const r=ou(ju,e.__scopeScrollArea),n=Boolean(r.scrollbarX&&r.scrollbarY);return"scroll"!==r.type&&n?a.jsx(Su,{...e,ref:t}):null});Tu.displayName=ju;var Su=p.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,s=ou(ju,r),[o,i]=p.useState(0),[l,c]=p.useState(0),d=Boolean(o&&l);return $u(s.scrollbarX,()=>{var e;const t=(null==(e=s.scrollbarX)?void 0:e.offsetHeight)||0;s.onCornerHeightChange(t),c(t)}),$u(s.scrollbarY,()=>{var e;const t=(null==(e=s.scrollbarY)?void 0:e.offsetWidth)||0;s.onCornerWidthChange(t),i(t)}),d?a.jsx(N.div,{...n,ref:t,style:{width:o,height:l,position:"absolute",right:"ltr"===s.dir?0:void 0,left:"rtl"===s.dir?0:void 0,bottom:0,...e.style}}):null});function Eu(e){return e?parseInt(e,10):0}function Nu(e,t){const r=e/t;return isNaN(r)?0:r}function Cu(e){const t=Nu(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function Au(e,t,r="ltr"){const n=Cu(t),s=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-s,o=t.content-t.viewport,i=a-n,l=ru(e,"ltr"===r?[0,o]:[-1*o,0]);return Ru([0,o],[0,i])(l)}function Ru(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function Iu(e,t){return e>0&&e<t}var Ou=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function s(){const a={left:e.scrollLeft,top:e.scrollTop},o=r.left!==a.left,i=r.top!==a.top;(o||i)&&t(),r=a,n=window.requestAnimationFrame(s)}(),()=>window.cancelAnimationFrame(n)};function Pu(e,t){const r=I(e),n=p.useRef(0);return p.useEffect(()=>()=>window.clearTimeout(n.current),[]),p.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function $u(e,t){const r=I(t);D(()=>{let t=0;if(e){const n=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(r)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.unobserve(e)}}},[e,r])}var Du=iu,Lu=cu,Uu=Tu;const Mu=p.forwardRef(({className:e,children:t,...r},n)=>a.jsxs(Du,{ref:n,className:bl("relative overflow-hidden",e),...r,children:[a.jsx(Lu,{className:"h-full w-full rounded-[inherit]",children:t}),a.jsx(qu,{}),a.jsx(Uu,{})]}));Mu.displayName=Du.displayName;const qu=p.forwardRef(({className:e,orientation:t="vertical",...r},n)=>a.jsx(uu,{ref:n,orientation:t,className:bl("flex touch-none select-none transition-colors","vertical"===t&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===t&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:a.jsx(_u,{className:"relative flex-1 rounded-full bg-border"})}));qu.displayName=uu.displayName;var zu="horizontal",Bu=["horizontal","vertical"],Fu=p.forwardRef((e,t)=>{const{decorative:r,orientation:n=zu,...s}=e,o=function(e){return Bu.includes(e)}(n)?n:zu,i=r?{role:"none"}:{"aria-orientation":"vertical"===o?o:void 0,role:"separator"};return a.jsx(N.div,{"data-orientation":o,...i,...s,ref:t})});Fu.displayName="Separator";var Wu=Fu;const Vu=p.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...n},s)=>a.jsx(Wu,{ref:s,decorative:r,orientation:t,className:bl("shrink-0 bg-border","horizontal"===t?"h-[1px] w-full":"h-full w-[1px]",e),...n}));
21Vu.displayName=Wu.displayName;const Ku=p.forwardRef(({className:e,...t},r)=>a.jsx("textarea",{className:bl("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...t}));Ku.displayName="Textarea";var Hu="Collapsible",[Gu,Ju]=j(Hu),[Yu,Xu]=Gu(Hu),Qu=p.forwardRef((e,t)=>{const{__scopeCollapsible:r,open:n,defaultOpen:s,disabled:o,onOpenChange:i,...l}=e,[c,d]=C({prop:n,defaultProp:s??!1,onChange:i,caller:Hu});return a.jsx(Yu,{scope:r,disabled:o,contentId:X(),open:c,onOpenToggle:p.useCallback(()=>d(e=>!e),[d]),children:a.jsx(N.div,{"data-state":sh(c),"data-disabled":o?"":void 0,...l,ref:t})})});Qu.displayName=Hu;var Zu="CollapsibleTrigger",eh=p.forwardRef((e,t)=>{const{__scopeCollapsible:r,...n}=e,s=Xu(Zu,r);return a.jsx(N.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":sh(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...n,ref:t,onClick:R(e.onClick,s.onOpenToggle)})});eh.displayName=Zu;var th="CollapsibleContent",rh=p.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=Xu(th,e.__scopeCollapsible);return a.jsx(A,{present:r||s.open,children:({present:e})=>a.jsx(nh,{...n,ref:t,present:e})})});rh.displayName=th;var nh=p.forwardRef((e,t)=>{const{__scopeCollapsible:r,present:n,children:s,...o}=e,i=Xu(th,r),[l,c]=p.useState(n),d=p.useRef(null),u=T(t,d),h=p.useRef(0),f=h.current,m=p.useRef(0),g=m.current,y=i.open||l,v=p.useRef(y),w=p.useRef(void 0);return p.useEffect(()=>{const e=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(e)},[]),D(()=>{const e=d.current;if(e){w.current=w.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration="0s",e.style.animationName="none";const t=e.getBoundingClientRect();h.current=t.height,m.current=t.width,v.current||(e.style.transitionDuration=w.current.transitionDuration,e.style.animationName=w.current.animationName),c(n)}},[i.open,n]),a.jsx(N.div,{"data-state":sh(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!y,...o,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:y&&s})});function sh(e){return e?"open":"closed"}var ah=Qu,oh=eh,ih=rh;const lh=ah,ch=eh,dh=rh;async function uh(){var e,t,r;const n=null==(e=Od.getState().customer)?void 0:e.email;if(n)return n;try{const{data:e}=await la.auth.getSession();return(null==(r=null==(t=e.session)?void 0:t.user)?void 0:r.email)||void 0}catch{return}}function hh(e){return`${e.variantId}::${e.designId??""}`}function ph(e){var t,r,n,s,a,o,i,l,c,d;Jc("add-to-cart",{sku:(null==(o=null==(a=null==(s=null==(n=null==(r=null==(t=e.product)?void 0:t.node)?void 0:r.variants)?void 0:n.edges)?void 0:s.find(t=>t.node.id===e.variantId))?void 0:a.node)?void 0:o.sku)||(null==(l=null==(i=e.product)?void 0:i.node)?void 0:l.handle)||e.variantId,name:(null==(d=null==(c=e.product)?void 0:c.node)?void 0:d.title)??"Product",qty:e.quantity,price:e.price.amount})}const fh=id()(dd((e,t)=>({items:[],cartId:null,checkoutUrl:null,note:"",isOpen:!1,isLoading:!1,isSyncing:!1,openCart:()=>e({isOpen:!0}),closeCart:()=>e({isOpen:!1}),toggleCart:()=>e(e=>({isOpen:!e.isOpen})),addItem:async r=>{var n,s,a,o,i,l,c,d,u,h,p,f,m,g,y,v,w,b,x,_,k,j,T,S,E,N,C,A,R,I,O,P,$,D,L,U,M,q,z,B,F,W,V,K,H,G,J,Y;const{items:X,cartId:Q,clearCart:Z}=t(),ee=hh(r),te=X.find(e=>hh(e)===ee),re=[];r.needsDesignAssistance&&re.push({key:"Needs Design Assistance",value:"Yes"}),r.artworkUrl&&re.push({key:"Artwork File",value:r.artworkUrl}),r.designId&&re.push({key:"Design ID",value:r.designId}),r.designPreviewUrl&&re.push({key:"Design Preview",value:r.designPreviewUrl}),r.designBackPreviewUrl&&re.push({key:"Design Preview (Back)",value:r.designBackPreviewUrl}),r.printFileUrl&&re.push({key:"Print File",value:r.printFileUrl}),r.backPrintFileUrl&&re.push({key:"Print File (Back)",value:r.backPrintFileUrl}),e({isLoading:!0});try{const X=await uh();if(Q)if(te){const n=te.quantity+r.quantity;if(!te.lineId)return;const s=await fd(Q,te.lineId,n);if(s.success){lc("add_to_cart",{currency:r.price.currencyCode||"USD",value:parseFloat(r.price.amount)*r.quantity,items:[{item_id:(null==(j=null==(k=null==(_=null==(x=null==(b=null==(w=r.product)?void 0:w.node)?void 0:b.variants)?void 0:x.edges)?void 0:_.find(e=>e.node.id===r.variantId))?void 0:k.node)?void 0:j.sku)||(null==(S=null==(T=r.product)?void 0:T.node)?void 0:S.handle)||r.variantId,item_name:((null==(N=null==(E=r.product)?void 0:E.node)?void 0:N.title)??"Product")+(r.variantTitle&&"Default Title"!==r.variantTitle?" â "+r.variantTitle:""),item_category:(null==(P=null==(O=null==(I=null==(R=null==(A=null==(C=r.product)?void 0:C.node)?void 0:A.collections)?void 0:R.edges)?void 0:I[0])?void 0:O.node)?void 0:P.handle)??void 0,price:parseFloat(r.price.amount),quantity:r.quantity}]}),ph(r);const s=t().items;e({items:s.map(e=>hh(e)===ee?{...e,quantity:n}:e),isOpen:!0})}else s.cartNotFound&&Z()}else{const n=await async function(e,t,r,n){var s,a,o;const i={quantity:r,merchandiseId:t};(null==n?void 0:n.length)&&(i.attributes=n);const l=await gd("\n mutation cartLinesAdd($cartId: ID!, $lines: [CartLineInput!]!) {\n cartLinesAdd(cartId: $cartId, lines: $lines) {\n cart {\n id\n lines(first: 100) { edges { node { id merchandise { ... on ProductVariant { id } } } } }\n }\n userErrors { field message }\n }\n }\n",{cartId:e,lines:[i]}),c=l.data.cartLinesAdd.userErrors||[];
21if(pd(c))return{success:!1,cartNotFound:!0};if(c.length>0)return{success:!1};const d=((null==(a=null==(s=l.data.cartLinesAdd.cart)?void 0:s.lines)?void 0:a.edges)||[]).find(e=>e.node.merchandise.id===t);return{success:!0,lineId:null==(o=null==d?void 0:d.node)?void 0:o.id}}(Q,r.variantId,r.quantity,re.length>0?re:void 0);if(n.success){lc("add_to_cart",{currency:r.price.currencyCode||"USD",value:parseFloat(r.price.amount)*r.quantity,items:[{item_id:(null==(q=null==(M=null==(U=null==(L=null==(D=null==($=r.product)?void 0:$.node)?void 0:D.variants)?void 0:L.edges)?void 0:U.find(e=>e.node.id===r.variantId))?void 0:M.node)?void 0:q.sku)||(null==(B=null==(z=r.product)?void 0:z.node)?void 0:B.handle)||r.variantId,item_name:((null==(W=null==(F=r.product)?void 0:F.node)?void 0:W.title)??"Product")+(r.variantTitle&&"Default Title"!==r.variantTitle?" â "+r.variantTitle:""),item_category:(null==(Y=null==(J=null==(G=null==(H=null==(K=null==(V=r.product)?void 0:V.node)?void 0:K.collections)?void 0:H.edges)?void 0:G[0])?void 0:J.node)?void 0:Y.handle)??void 0,price:parseFloat(r.price.amount),quantity:r.quantity}]}),ph(r);const s=t().items;e({items:[...s,{...r,lineId:n.lineId??null}],isOpen:!0})}else n.cartNotFound&&Z()}else{const t=await async function(e,t,r,n){var s,a;const o={quantity:t,merchandiseId:e};(null==r?void 0:r.length)&&(o.attributes=r);const i={lines:[o]};n&&(i.buyerIdentity={email:n});const l=await gd("\n mutation cartCreate($input: CartInput!) {\n cartCreate(input: $input) {\n cart {\n id\n checkoutUrl\n totalQuantity\n lines(first: 100) {\n edges {\n node {\n id\n merchandise {\n ... on ProductVariant {\n id\n }\n }\n }\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }\n",{input:i});if(l.data.cartCreate.userErrors.length>0)return null;const c=l.data.cartCreate.cart;if(!(null==c?void 0:c.checkoutUrl))return null;const d=null==(a=null==(s=c.lines.edges[0])?void 0:s.node)?void 0:a.id;return d?{cartId:c.id,checkoutUrl:hd(c.checkoutUrl),lineId:d}:null}(r.variantId,r.quantity,re.length>0?re:void 0,X);t&&(lc("add_to_cart",{currency:r.price.currencyCode||"USD",value:parseFloat(r.price.amount)*r.quantity,items:[{item_id:(null==(l=null==(i=null==(o=null==(a=null==(s=null==(n=r.product)?void 0:n.node)?void 0:s.variants)?void 0:a.edges)?void 0:o.find(e=>e.node.id===r.variantId))?void 0:i.node)?void 0:l.sku)||(null==(d=null==(c=r.product)?void 0:c.node)?void 0:d.handle)||r.variantId,item_name:((null==(h=null==(u=r.product)?void 0:u.node)?void 0:h.title)??"Product")+(r.variantTitle&&"Default Title"!==r.variantTitle?" â "+r.variantTitle:""),item_category:(null==(v=null==(y=null==(g=null==(m=null==(f=null==(p=r.product)?void 0:p.node)?void 0:f.collections)?void 0:m.edges)?void 0:g[0])?void 0:y.node)?void 0:v.handle)??void 0,price:parseFloat(r.price.amount),quantity:r.quantity}]}),ph(r),e({cartId:t.cartId,checkoutUrl:t.checkoutUrl,items:[{...r,lineId:t.lineId}],isOpen:!0}))}}catch(ne){}finally{e({isLoading:!1})}},updateQuantity:async(r,n)=>{if(n<=0)return void(await t().removeItem(r));const{items:s,cartId:a,clearCart:o}=t(),i=s.find(e=>hh(e)===r);if((null==i?void 0:i.lineId)&&a){e({isLoading:!0});try{const s=await fd(a,i.lineId,n);if(s.success){const s=t().items;e({items:s.map(e=>hh(e)===r?{...e,quantity:n}:e)})}else s.cartNotFound&&o()}catch(l){}finally{e({isLoading:!1})}}},removeItem:async r=>{const{items:n,cartId:s,clearCart:a}=t(),o=n.find(e=>hh(e)===r);if((null==o?void 0:o.lineId)&&s){e({isLoading:!0});try{const n=await async function(e,t){const r=(await gd("\n mutation cartLinesRemove($cartId: ID!, $lineIds: [ID!]!) {\n cartLinesRemove(cartId: $cartId, lineIds: $lineIds) {\n cart { id }\n userErrors { field message }\n }\n }\n",{cartId:e,lineIds:[t]})).data.cartLinesRemove.userErrors||[];return pd(r)?{success:!1,cartNotFound:!0}:r.length>0?{success:!1}:{success:!0}}(s,o.lineId);if(n.success){const n=t().items.filter(e=>hh(e)!==r);0===n.length?a():e({items:n})}else n.cartNotFound&&a()}catch(i){}finally{e({isLoading:!1})}}},clearCart:()=>e({items:[],cartId:null,checkoutUrl:null,note:""}),setNote:t=>e({note:t}),syncNote:async()=>{const{cartId:e,note:r}=t();e&&await async function(e,t){var r,n;
21try{const s=await gd("\n mutation cartNoteUpdate($cartId: ID!, $note: String!) {\n cartNoteUpdate(cartId: $cartId, note: $note) {\n cart { id note }\n userErrors { field message }\n }\n }\n",{cartId:e,note:t}),a=(null==(n=null==(r=null==s?void 0:s.data)?void 0:r.cartNoteUpdate)?void 0:n.userErrors)||[];return pd(a)?{success:!1,cartNotFound:!0}:a.length>0?{success:!1}:{success:!0}}catch(s){return{success:!1}}}(e,r)},getCheckoutUrl:()=>t().checkoutUrl,syncBuyerIdentity:async()=>{const{cartId:r}=t();if(!r)return;const n=await uh();if(n)try{const t=await async function(e,t){var r;try{const n=await gd("\n mutation cartBuyerIdentityUpdate($cartId: ID!, $buyerIdentity: CartBuyerIdentityInput!) {\n cartBuyerIdentityUpdate(cartId: $cartId, buyerIdentity: $buyerIdentity) {\n cart {\n id\n checkoutUrl\n }\n userErrors { field message }\n }\n }\n",{cartId:e,buyerIdentity:{email:t}});if((n.data.cartBuyerIdentityUpdate.userErrors||[]).length>0)return{success:!1};const s=null==(r=n.data.cartBuyerIdentityUpdate.cart)?void 0:r.checkoutUrl;return{success:!0,checkoutUrl:s?hd(s):void 0}}catch(n){return{success:!1}}}(r,n);t.success&&t.checkoutUrl&&e({checkoutUrl:t.checkoutUrl})}catch(s){}},syncCart:async()=>{const{cartId:r,isSyncing:n,clearCart:s}=t();if(r&&!n){e({isSyncing:!0});try{const e=await async function(e){var t;try{const r=await gd("\n query cart($id: ID!) {\n cart(id: $id) { id totalQuantity }\n }\n",{id:e});return(null==(t=null==r?void 0:r.data)?void 0:t.cart)?{exists:!0,totalQuantity:r.data.cart.totalQuantity}:{exists:!1,totalQuantity:0}}catch{return{exists:!1,totalQuantity:0}}}(r);e.exists&&0!==e.totalQuantity||s()}catch(a){}finally{e({isSyncing:!1})}}},totalItems:()=>t().items.reduce((e,t)=>e+t.quantity,0),subtotal:()=>t().items.reduce((e,t)=>e+parseFloat(t.price.amount)*t.quantity,0)}),{name:"shopify-cart",storage:ld(()=>localStorage),partialize:e=>({items:e.items,cartId:e.cartId,checkoutUrl:e.checkoutUrl,note:e.note})})),mh=()=>{var e,t;const{items:r,isOpen:n,isLoading:s,isSyncing:o,note:i,closeCart:l,removeItem:c,updateQuantity:d,clearCart:u,getCheckoutUrl:h,syncCart:f,syncBuyerIdentity:m,setNote:y,syncNote:v,totalItems:w,subtotal:b}=fh(),[x,_]=p.useState(!1),k=Od(e=>e.customer),{user:j}=Md(),T=(null==k?void 0:k.email)||(null==j?void 0:j.email),S=p.useRef(!1);p.useEffect(()=>{n&&f()},[n,f]),p.useEffect(()=>{n&&T&&!S.current&&(S.current=!0,m()),n||(S.current=!1)},[n,T,m]);const E=w(),N=b();return a.jsx(Kd,{open:n,onOpenChange:e=>!e&&l(),children:a.jsxs(Xd,{className:"w-full sm:max-w-lg flex flex-col",children:[a.jsx(Qd,{className:"space-y-2.5 pb-4",children:a.jsxs(Zd,{className:"flex items-center gap-2 font-display text-xl",children:[a.jsx(vi,{className:"w-5 h-5 text-primary"}),"Your Cart",E>0&&a.jsxs("span",{className:"ml-2 bg-primary text-primary-foreground text-xs font-medium px-2 py-0.5 rounded-full",children:[E," ",1===E?"item":"items"]})]})}),0===r.length?a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-center py-12",children:[a.jsx("div",{className:"w-20 h-20 rounded-full bg-muted flex items-center justify-center mb-4",children:a.jsx(vi,{className:"w-10 h-10 text-muted-foreground"})}),a.jsx("h3",{className:"font-display text-lg font-semibold text-foreground mb-2",children:"Your cart is empty"}),a.jsx("p",{className:"text-sm text-muted-foreground max-w-[200px] mb-6",children:"Add some products to get started with your order"}),a.jsx(Vd,{onClick:l,className:"mb-4",children:"Continue Shopping"}),a.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[a.jsx("p",{className:"font-medium",children:"Popular categories:"}),a.jsx("div",{className:"flex flex-wrap gap-2 justify-center",children:a.jsx(g,{to:"/products",onClick:l,className:"text-primary hover:underline text-xs",children:"All Products"})})]})]}):a.jsxs(a.Fragment,{children:[a.jsx(Mu,{className:"flex-1 -mx-6 px-6",children:a.jsx("div",{className:"space-y-4",children:r.map(e=>{var t,r,n;const o=(null==(t=e.product)?void 0:t.node)?Ed(e.product.node):"/products";return a.jsxs("div",{className:"flex gap-4 p-3 rounded-lg bg-muted/30 border border-border/50",children:[a.jsx("div",{className:"w-20 h-20 rounded-md overflow-hidden bg-muted flex-shrink-0",children:(()=>{var t,r,n,s,o,i,l,c;const d=e.imageUrl||(null==(i=null==(o=null==(s=null==(n=null==(r=null==(t=e.product)?void 0:t.node)?void 0:r.images)?void 0:n.edges)?void 0:s[0])?void 0:o.node)?void 0:i.url);return d?a.jsx("img",{src:d,alt:(null==(c=null==(l=e.product)?void 0:l.node)?void 0:c.title)??"Product",className:"w-full h-full object-cover"}):a.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground text-xs",children:"No image"})})()}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx(g,{to:o,onClick:l,className:"font-medium text-sm text-foreground line-clamp-2 hover:text-primary transition-colors",children:(null==(n=null==(r=e.product)?void 0:r.no
21de)?void 0:n.title)??e.variantTitle??"Unknown Product"}),e.selectedOptions.length>0&&a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e.selectedOptions.map(e=>e.value).join(" / ")}),e.needsDesignAssistance&&a.jsxs("p",{className:"text-xs text-primary mt-1 flex items-center gap-1",children:[a.jsx(wi,{className:"w-3 h-3"}),"Needs design assistance"]}),e.designId&&a.jsxs("p",{className:"text-xs text-primary mt-1 flex items-center gap-1",children:[a.jsx(wi,{className:"w-3 h-3"}),"Your custom design attached"]})]}),a.jsx("button",{onClick:()=>c(hh(e)),className:"text-muted-foreground hover:text-destructive transition-colors p-1","aria-label":"Remove item",disabled:s,children:a.jsx(_i,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"flex items-center justify-between mt-3",children:[a.jsxs("div",{className:"flex items-center gap-1 bg-background border border-border rounded-md",children:[a.jsx("button",{onClick:()=>d(hh(e),e.quantity-1),className:"p-1.5 hover:bg-muted transition-colors rounded-l-md","aria-label":"Decrease quantity",disabled:s,children:a.jsx(ui,{className:"w-3 h-3"})}),a.jsx("span",{className:"w-8 text-center text-sm font-medium",children:e.quantity}),a.jsx("button",{onClick:()=>d(hh(e),e.quantity+1),className:"p-1.5 hover:bg-muted transition-colors rounded-r-md","aria-label":"Increase quantity",disabled:s,children:a.jsx(fi,{className:"w-3 h-3"})})]}),a.jsx("div",{className:"text-right",children:a.jsx("p",{className:"font-semibold text-foreground",children:jd((parseFloat(e.price.amount)*e.quantity).toString(),e.price.currencyCode)})})]})]})]},hh(e))})})}),a.jsxs("div",{className:"pt-4 mt-4 border-t border-border space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between text-sm",children:[a.jsx("span",{className:"text-muted-foreground",children:"Subtotal"}),a.jsx("span",{className:"text-foreground",children:jd(N.toString(),(null==(e=r[0])?void 0:e.price.currencyCode)||"USD")})]}),a.jsxs("div",{className:"flex items-center justify-between text-sm",children:[a.jsx("span",{className:"text-muted-foreground",children:"Shipping"}),a.jsx("span",{className:"text-muted-foreground",children:"Calculated at checkout"})]}),a.jsx(Vu,{}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"font-semibold text-foreground",children:"Total"}),a.jsx("span",{className:"font-display text-xl font-bold text-foreground",children:jd(N.toString(),(null==(t=r[0])?void 0:t.price.currencyCode)||"USD")})]})]}),a.jsxs(lh,{open:x,onOpenChange:_,children:[a.jsxs(ch,{className:"flex items-center justify-between w-full text-sm text-muted-foreground hover:text-foreground transition-colors py-1",children:[a.jsx("span",{children:"Add a note to your order"}),a.jsx(Wo,{className:"w-4 h-4 transition-transform "+(x?"rotate-180":"")})]}),a.jsxs(dh,{className:"pt-2",children:[a.jsx(Ku,{value:i,onChange:e=>y(e.target.value),placeholder:"Special instructions, delivery notes, etc.",className:"min-h-[70px] text-sm resize-none",maxLength:500}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1 text-right",children:[i.length,"/500"]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Vd,{className:"w-full",size:"lg",onClick:async()=>{var e,t;const n=h();if(!n)return;const s=window.open("about:blank","_blank");if(i.trim())try{await v()}catch(o){}lc("begin_checkout",{currency:(null==(e=r[0])?void 0:e.price.currencyCode)||"USD",value:b(),items:r.map(e=>{var t,r,n,s,a,o,i,l,c,d,u,h,p,f,m,g;return{item_id:(null==(o=null==(a=null==(s=null==(n=null==(r=null==(t=e.product)?void 0:t.node)?void 0:r.variants)?void 0:n.edges)?void 0:s.find(t=>t.node.id===e.variantId))?void 0:a.node)?void 0:o.sku)||(null==(l=null==(i=e.product)?void 0:i.node)?void 0:l.handle)||e.variantId,item_name:((null==(d=null==(c=e.product)?void 0:c.node)?void 0:d.title)??"Product")+(e.variantTitle&&"Default Title"!==e.variantTitle?" â "+e.variantTitle:""),item_category:(null==(g=null==(m=null==(f=null==(p=null==(h=null==(u=e.product)?void 0:u.node)?void 0:h.collections)?void 0:p.edges)?void 0:f[0])?void 0:m.node)?void 0:g.handle)??void 0,price:parseFloat(e.price.amount),quantity:e.quantity}})}),Jc("started-checkout",{"cart-items":r.reduce((e,t)=>
21e+t.quantity,0),"cart-value":b().toFixed(2)});const a=cc(n);s&&!s.closed?s.location.href=a:(ic("checkout_popup_blocked",{had_note:i.trim().length>0,item_count:w(),value:b(),currency:(null==(t=r[0])?void 0:t.price.currencyCode)||"USD"}),window.location.href=a),l()},disabled:0===r.length||s||o,children:s||o?a.jsxs(a.Fragment,{children:[a.jsx(ri,{className:"w-4 h-4 mr-2 animate-spin"}),o?"Syncing...":"Processing..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Jo,{className:"w-4 h-4 mr-2"}),"Proceed to Checkout"]})}),a.jsxs("p",{className:"text-xs text-center text-muted-foreground flex items-center justify-center gap-1",children:[a.jsx(ni,{className:"w-3 h-3"}),"No account required · Secure checkout"]}),a.jsx(Vd,{variant:"outline",className:"w-full",onClick:l,children:"Continue Shopping"})]}),a.jsx("button",{onClick:u,className:"w-full text-center text-xs text-muted-foreground hover:text-destructive transition-colors py-2",children:"Clear Cart"})]})]})]})})},gh=()=>{const{pathname:e}=y();return p.useEffect(()=>{window.scrollTo(0,0)},[e]),null};function yh({className:e,variant:t="shimmer",...r}){return a.jsx("div",{className:bl("rounded-md bg-muted/60","shimmer"===t&&["relative overflow-hidden isolate","before:absolute before:inset-0","before:bg-gradient-to-r before:from-transparent before:via-foreground/5 before:to-transparent","before:animate-shimmer before:bg-[length:200%_100%]"],"pulse"===t&&"animate-pulse",e),...r})}function vh({className:e}){return a.jsxs("div",{className:bl("bg-card rounded-2xl overflow-hidden border border-border shadow-card",e),children:[a.jsx(yh,{className:"aspect-square w-full"}),a.jsxs("div",{className:"p-5 space-y-3",children:[a.jsx(yh,{className:"h-4 w-20"}),a.jsx(yh,{className:"h-6 w-full"}),a.jsx(yh,{className:"h-4 w-3/4"}),a.jsxs("div",{className:"flex items-baseline gap-2 pt-1",children:[a.jsx(yh,{className:"h-4 w-16"}),a.jsx(yh,{className:"h-6 w-20"})]})]})]})}function wh({className:e}){return a.jsxs("div",{className:bl("flex items-center gap-3 p-2 bg-background rounded-lg border border-border/50",e),children:[a.jsx(yh,{className:"w-20 h-20 md:w-24 md:h-24 rounded-md flex-shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[a.jsx(yh,{className:"h-4 w-full"}),a.jsx(yh,{className:"h-4 w-2/3"}),a.jsx(yh,{className:"h-5 w-16"})]})]})}const bh=()=>a.jsxs("div",{className:"min-h-screen bg-background",children:[a.jsx("div",{className:"h-16 md:h-20 border-b border-border bg-background",children:a.jsxs("div",{className:"container mx-auto px-4 h-full flex items-center justify-between",children:[a.jsx(yh,{className:"h-10 w-32"}),a.jsx(yh,{className:"hidden md:block h-10 w-64"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(yh,{className:"h-10 w-10 rounded-full"}),a.jsx(yh,{className:"h-10 w-10 rounded-full"})]})]})}),a.jsx("div",{className:"container mx-auto px-4 py-12",children:a.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[60vh] gap-4",children:[a.jsx("div",{className:"relative",children:a.jsx("div",{className:"w-12 h-12 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}),a.jsx("p",{className:"text-muted-foreground text-sm",children:"Loading..."})]})})]}),xh=()=>o({queryKey:["announcement-items"],queryFn:async()=>{const{data:e,error:t}=await la.from("announcement_bar_items").select("*").order("sort_order",{ascending:!0});if(t)throw t;return e}}),_h=()=>{const e=i();return l({mutationFn:async e=>{const{data:t,error:r}=await la.from("announcement_bar_items").insert(e).select().single();if(r)throw r;return t},onSuccess:()=>{e.invalidateQueries({queryKey:["announcement-items"]}),Fl.success("Announcement added")},onError:e=>{Fl.error("Failed to add announcement: "+e.message)}})},kh=()=>{const e=i();return l({mutationFn:async({id:e,...t})=>{const{data:r,error:n}=await la.from("announcement_bar_items").update(t).eq("id",e).select().single();if(n)throw n;return r},onSuccess:()=>{e.invalidateQueries({queryKey:["announcement-items"]}),Fl.success("Announcement updated")},onError:e=>{Fl.error("Failed to update announcement: "+e.message)}})},jh=()=>{const e=i();return l({mutationFn:async e=>{const{error:t}=await la.from("announcement_bar_items").delete().eq("id",e);if(t)throw t},onSuccess:()=>
21{e.invalidateQueries({queryKey:["announcement-items"]}),Fl.success("Announcement deleted")},onError:e=>{Fl.error("Failed to delete announcement: "+e.message)}})},Th={Truck:ji,Tag:xi,Clock:Ho,Megaphone:ii,Gift:Qo,Zap:Ei,Star:bi},Sh=()=>{const{isVisible:e,dismiss:t,setHasActiveItems:r}=Fd(),{data:n}=xh(),[s,o]=p.useState(0),i=(null==n?void 0:n.filter(e=>e.is_active))||[];if(p.useEffect(()=>{r(i.length>0)},[i.length,r]),p.useEffect(()=>{if(i.length<=1)return;const e=setInterval(()=>{o(e=>(e+1)%i.length)},5e3);return()=>clearInterval(e)},[i.length]),!e||0===i.length)return null;const l=i[s],c=Th[null==l?void 0:l.icon]||ji;return a.jsx("div",{className:"bg-brand-navy text-white py-2.5 px-4",children:a.jsxs("div",{className:"container mx-auto flex items-center justify-center gap-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium animate-fade-in",children:[a.jsx(c,{className:"w-4 h-4 text-primary"}),a.jsxs("span",{children:[a.jsx("span",{className:"text-primary font-bold",children:l.highlight}),l.text.replace(l.highlight,"")]})]}),i.length>1&&a.jsx("div",{className:"hidden sm:flex items-center gap-1 ml-4",children:i.map((e,t)=>a.jsx("button",{onClick:()=>o(t),className:"min-w-[48px] min-h-[48px] flex items-center justify-center","aria-label":`View promotion ${t+1}`,children:a.jsx("span",{className:"block rounded-full transition-all duration-300 "+(t===s?"bg-primary w-3 h-2":"bg-white/40 hover:bg-white/60 w-1.5 h-1.5")})},t))}),a.jsx("button",{onClick:t,className:"absolute right-2 top-1/2 -translate-y-1/2 min-w-[48px] min-h-[48px] flex items-center justify-center hover:bg-white/10 rounded transition-colors","aria-label":"Dismiss announcement",children:a.jsx(Si,{className:"w-4 h-4"})})]})})},Eh=()=>{const e=fh(e=>e.toggleCart),t=fh(e=>e.items).reduce((e,t)=>e+t.quantity,0);return a.jsxs(Vd,{variant:"ghost",size:"icon",className:"relative min-w-[48px] min-h-[48px]",onClick:e,"aria-label":"Open cart",children:[a.jsx(vi,{className:"w-5 h-5"}),t>0&&a.jsx("span",{className:"absolute -top-1 -right-1 w-5 h-5 bg-primary text-primary-foreground text-xs font-bold rounded-full flex items-center justify-center",children:t>99?"99+":t})]})},Nh=p.forwardRef(({className:e,type:t,...r},n)=>a.jsx("input",{type:t,className:bl("flex h-10 w-full rounded-md border border-muted-foreground/40 bg-[#ffffff] px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 focus-visible:border-primary/50 focus-visible:ring-offset-0 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm transition-colors duration-200",e),ref:n,...r}));Nh.displayName="Input";const Ch={categories:[{slug:"pop-up-tents",name:"Pop-Up Tents",description:"Pop-up canopy tents for events",image:"https://1adisplay.com/cdn/shop/collections/Pop-Up-Canopy-Tent-10-x-10.jpg?v=1715684562&width=100"},{slug:"flags",name:"Flags & Banners",description:"Feather flags & custom banners",image:"https://1adisplay.com/cdn/shop/collections/custom-printed-advertising-flag.jpg?v=1704448223&width=100"},{slug:"digital-signage",name:"Digital Signage",description:"LED displays & kiosks",image:"https://1adisplay.com/cdn/shop/collections/hyper-lumin-kiosks-a_frame-digital-signage-inuse-restaurant_2.jpg?v=1704448181&width=100"},{slug:"custom-inflatables",name:"Custom Inflatables",description:"Air dancers & inflatables",image:"https://1adisplay.com/cdn/shop/collections/Custom-Printed-Wacky-Man.jpg?v=1704448219&width=100"},{slug:"banner-stands",name:"Banner Stands",description:"A-frames & exhibition displays",image:"https://1adisplay.com/cdn/shop/collections/SP--60-Sidewalk-sign-8.jpg?v=1704448166&width=100"},{slug:"tablecloths",name:"Table Covers",description:"Fitted tablecloths & runners",image:"https://1adisplay.com/cdn/shop/files/6_-Fitted-Tablecloth_-Dye-Sublimation.jpg?v=1738321191&width=100"}]},Ah=["Canopy Tent","Feather Flag","Table Cover","Banner Stand","Trade Show"],Rh=e=>/^[A-Za-z0-9._\-\/]{2,}$/.test(e)&&/\d/.test(e)&&/[A-Za-z]/.test(e),Ih=({isMobile:e=!1,onClose:t})=>{const[r,n]=p.useState(""),[s,o]=p.useState(!1),[i,l]=p.useState([]),[c,d]=p.useState(!1),[u,h]=p.useState(-1),[f,m]=p.useState([]),g=p.useRef(null),y=p.useRef(null),w=v(),b=p.useRef();p.useEffect(()=>{const e=localStorage.getItem("recentSearches");e&&m(JSON.parse(e).slice(0,3))},[]);const x=p.useCallback(async e=>{if(e.length<2)return[];const t=/^[A-Za-z0-9._\-\/]{2,}$/.test(e);try{const[r,n]=await Promise.all([wd(6,`title:*${e}*`).catch(()=>[]),t?xd(e).catch(()=>[]):Promise.resolve([])]),s=new Set,a=[];
21return n.forEach(e=>{var t,r,n,o,i,l,c,d;if(s.has(e.node.id))return;s.add(e.node.id);const u=e.node.matchedSku??(null==(o=null==(n=null==(r=null==(t=e.node.variants)?void 0:t.edges)?void 0:r[0])?void 0:n.node)?void 0:o.sku)??null;a.push({type:"sku",id:e.node.id,name:e.node.title,subtitle:u?`SKU ${u} · From ${jd(e.node.priceRange.minVariantPrice.amount,e.node.priceRange.minVariantPrice.currencyCode)}`:`From ${jd(e.node.priceRange.minVariantPrice.amount,e.node.priceRange.minVariantPrice.currencyCode)}`,url:Ed(e.node),image:null==(d=null==(c=null==(l=null==(i=e.node.images)?void 0:i.edges)?void 0:l[0])?void 0:c.node)?void 0:d.url,sku:u??void 0})}),r.forEach(e=>{var t,r,n,o;s.has(e.node.id)||(s.add(e.node.id),a.push({type:"product",id:e.node.id,name:e.node.title,subtitle:`From ${jd(e.node.priceRange.minVariantPrice.amount,e.node.priceRange.minVariantPrice.currencyCode)}`,url:Ed(e.node),image:null==(o=null==(n=null==(r=null==(t=e.node.images)?void 0:t.edges)?void 0:r[0])?void 0:n.node)?void 0:o.url}))}),a.slice(0,8)}catch{return[]}},[]);p.useEffect(()=>{if(r.trim().length<1)return l([]),void d(!1);const e=r.toLowerCase(),t=[];if(Ch.categories.forEach(r=>{(r.name.toLowerCase().includes(e)||r.description.toLowerCase().includes(e))&&t.push({type:"category",id:r.slug,name:r.name,subtitle:r.description,url:`/${r.slug}`,image:r.image})}),l(t),h(-1),b.current&&clearTimeout(b.current),r.trim().length>=2){d(!0);const e=Rh(r.trim())?120:300;b.current=setTimeout(async()=>{const e=await x(r.trim()),t=[];Ch.categories.forEach(e=>{(e.name.toLowerCase().includes(r.toLowerCase())||e.description.toLowerCase().includes(r.toLowerCase()))&&t.push({type:"category",id:e.slug,name:e.name,subtitle:e.description,url:`/${e.slug}`,image:e.image})});const n=Rh(r.trim())?[...e,...t]:[...t,...e];l(n.slice(0,8)),d(!1)},e)}return()=>{b.current&&clearTimeout(b.current)}},[r,x]),p.useEffect(()=>{const e=e=>{y.current&&!y.current.contains(e.target)&&g.current&&!g.current.contains(e.target)&&o(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const _=e=>{"popular"!==e.type?((e=>{const t=[e,...f.filter(t=>t!==e)].slice(0,3);m(t),localStorage.setItem("recentSearches",JSON.stringify(t))})(e.name),w(e.url),n(""),o(!1),null==t||t()):n(e.name)},k=e=>{var t;n(e),null==(t=g.current)||t.focus()},j=s&&0===r.length&&(f.length>0||Ah.length>0),T=s&&r.length>=1&&i.length>0,S=s&&r.length>=1&&0===i.length&&!c,E=s&&r.length>=2&&0===i.length&&c;return a.jsxs("div",{className:"relative "+(e?"w-full":"w-64 lg:w-80"),children:[a.jsxs("div",{className:"relative",children:[a.jsx(gi,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),a.jsx(Nh,{ref:g,type:"text",placeholder:"Search products...",value:r,onChange:e=>n(e.target.value),onFocus:()=>o(!0),onKeyDown:e=>{var t;const s=0===r.length?f.length+Ah.length:i.length;"ArrowDown"===e.key?(e.preventDefault(),h(e=>Math.min(e+1,s-1))):"ArrowUp"===e.key?(e.preventDefault(),h(e=>Math.max(e-1,-1))):"Enter"===e.key?(e.preventDefault(),0===r.length?u>=0&&(u<f.length?n(f[u]):n(Ah[u-f.length])):u>=0&&i[u]&&_(i[u])):"Escape"===e.key&&(o(!1),null==(t=g.current)||t.blur())},className:"pl-10 pr-10 h-10 bg-white border-muted-foreground/30"}),r&&a.jsx(Vd,{variant:"ghost",size:"icon",className:"absolute right-1 top-1/2 -translate-y-1/2 h-8 w-8",onClick:()=>{var e;n(""),l([]),null==(e=g.current)||e.focus()},children:a.jsx(Si,{className:"w-4 h-4"})})]}),j&&a.jsxs("div",{ref:y,className:"absolute top-full left-0 right-0 mt-2 bg-white border border-border rounded-xl shadow-xl overflow-hidden z-50 animate-fade-in",children:[f.length>0&&a.jsxs("div",{className:"p-2",children:[a.jsxs("p",{className:"px-3 py-1.5 text-xs font-semibold text-muted-foreground uppercase tracking-wide flex items-center gap-2",children:[a.jsx(Ho,{className:"w-3 h-3"}),"Recent"]}),f.map((e,t)=>a.jsxs("button",{className:"w-full px-3 py-2 text-left hover:bg-accent rounded-lg transition-colors flex items-center gap-3 "+(t===u?"bg-accent":""),onClick:()=>k(e),children:[a.jsx(Ho,{className:"w-4 h-4 text-muted-foreground"}),a.jsx("span",{className:"text-sm",children:e})]},`recent-${e}`))]}),a.jsxs("div",{className:"p-2 "+(f.length>0?"border-t border-border":""),children:[a.jsxs("p",{className:"px-3 py-1.5 text-xs font-semibold text-muted-foreground uppercase tracking-wide flex items-center gap-2",children:[a.jsx(ki,{className:"w-3 h-3"}),"Popular"]}),Ah.map((e,t)=>a.jsxs("button",{className:"w-full px-3 py-2 text-left hover:bg-accent rounded-lg transition-colors flex items-center gap-3 "+(t+f.length===u?"bg-accent":""),onClick:()=>k(e),children:[a.jsx(ki,{className:"w-4 h-4 text-primary"}),a.jsx("span",{className:"text-sm",children:e})]},`popular-${e}`))]})]}),T&&a.jsx("div",{ref:y,className:"absolute top-full left-0 right-0 mt-2 bg-white border border-border rounded-xl shadow-xl overflow-hidden z-50 animate-fade-in",children:i.map((e,t)=>a.jsxs("button",{className:`w-full px-3 py-2.5 text-left hover:bg-accent transition-colors flex items-center gap-3 ${t===u?"bg-accent":""} ${0!==t?"border-t border-border/50":""}`,onClick:()=>_(e),children:[a.jsx("div",{className:"w-12 h-12 rounded-lg overflow-hidden bg-secondary flex-shrink-0",children:e.image?a.jsx("img",{src:e.image,alt:e.name,className:"w-full h-full object-cover"}):a.jsx("div",{className:"w-full h-full flex items-center justify-center "+("category"===e.type?"bg-primary/10 text-primary":"bg-secondary text-muted-foreground"),children:"category"===e.type?a.jsx(Xo,{className:"w-5 h-5"}):a.jsx(hi,{className:"w-5 h-5"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-medium truncate",children:e.name}),a.jsx("p",{className:"text-xs text-muted-foreground truncate",children:"sku"===e.type&&e.sku?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"font-mono font-semibold text-foreground",children:e.sku}),e.subtitle.replace(/^SKU \S+\s*·\s*/," · ")]}
21):e.subtitle})]}),a.jsx("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full flex-shrink-0 "+("category"===e.type?"bg-primary/10 text-primary":"sku"===e.type?"bg-primary text-primary-foreground":"bg-secondary text-muted-foreground"),children:"category"===e.type?"Category":"sku"===e.type?"SKU":"Product"})]},`${e.type}-${e.id}`))}),E&&a.jsx("div",{ref:y,className:"absolute top-full left-0 right-0 mt-2 bg-white border border-border rounded-xl shadow-xl p-6 z-50 animate-fade-in",children:a.jsxs("div",{className:"text-center flex items-center justify-center gap-2",children:[a.jsx(ri,{className:"w-4 h-4 animate-spin text-primary"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Searching products..."})]})}),S&&a.jsx("div",{ref:y,className:"absolute top-full left-0 right-0 mt-2 bg-white border border-border rounded-xl shadow-xl p-6 z-50 animate-fade-in",children:a.jsxs("div",{className:"text-center",children:[a.jsx(gi,{className:"w-8 h-8 text-muted-foreground mx-auto mb-2"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:['No results found for "',a.jsx("span",{className:"font-medium text-foreground",children:r}),'"']}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Try a different search term"})]})})]})},Oh=({rating:e,reviewCount:t,showCount:r=!0,size:n="sm",className:s})=>{const o={sm:"w-3.5 h-3.5",md:"w-4 h-4",lg:"w-5 h-5"},i=Math.floor(e),l=e%1>=.5,c=5-i-(l?1:0);return a.jsxs("div",{className:bl("flex items-center gap-1",s),children:[a.jsxs("div",{className:"flex items-center gap-0.5",children:[Array.from({length:i}).map((e,t)=>a.jsx(bi,{className:bl(o[n],"fill-primary text-primary")},`full-${t}`)),l&&a.jsxs("div",{className:"relative",children:[a.jsx(bi,{className:bl(o[n],"text-muted-foreground/60")}),a.jsx("div",{className:"absolute inset-0 overflow-hidden w-1/2",children:a.jsx(bi,{className:bl(o[n],"fill-primary text-primary")})})]}),Array.from({length:c}).map((e,t)=>a.jsx(bi,{className:bl(o[n],"text-muted-foreground/60")},`empty-${t}`))]}),r&&void 0!==t&&a.jsxs("span",{className:bl({sm:"text-xs",md:"text-sm",lg:"text-base"}[n],"text-muted-foreground"),children:["(",t.toLocaleString(),")"]})]})},Ph=({onClose:e})=>{const{data:t,isLoading:r}=o({queryKey:["shopify-collections-mega"],queryFn:()=>_d(6)}),{data:n,isLoading:s}=o({queryKey:["shopify-products-mega",4],queryFn:()=>wd(4)});return a.jsxs("div",{className:"grid grid-cols-12 gap-6",children:[a.jsxs("div",{className:"col-span-5",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"font-display font-bold text-foreground",children:"Shop by Category"}),a.jsxs(g,{to:"/products",onClick:e,className:"text-sm text-primary hover:text-primary/80 flex items-center gap-1",children:["View All ",a.jsx(Bo,{className:"w-3 h-3"})]})]}),a.jsx("div",{className:"grid grid-cols-2 gap-3",children:r?Array.from({length:6}).map((e,t)=>a.jsxs("div",{className:"flex items-center gap-3 p-2",children:[a.jsx("div",{className:"w-12 h-12 rounded-lg bg-muted animate-pulse"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"h-4 w-20 bg-muted animate-pulse rounded mb-1"}),a.jsx("div",{className:"h-3 w-16 bg-muted animate-pulse rounded"})]})]},t)):null==t?void 0:t.map(t=>a.jsxs(g,{to:`/${t.handle}`,onClick:e,className:"flex items-center gap-3 p-2 rounded-lg hover:bg-secondary/50 transition-colors group",children:[a.jsx("div",{className:"w-12 h-12 rounded-lg overflow-hidden bg-muted flex-shrink-0",children:t.image?a.jsx("img",{src:t.image.url,alt:t.title,className:"w-full h-full object-cover group-hover:scale-110 transition-transform duration-300"}):a.jsx("div",{className:"w-full h-full flex items-center justify-center",children:a.jsx(hi,{className:"w-5 h-5 text-muted-foreground"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"font-medium text-sm text-foreground group-hover:text-primary transition-colors truncate",children:t.title}),t.minPrice&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["From ",jd(t.minPrice.amount,t.minPrice.currencyCode)]})]})]},t.id))})]}),a.jsxs("div",{className:"col-span-4 border-l border-border pl-6",children:[a.jsx("div",{className:"flex items-center justify-between mb-4",children:a.jsx("h3",{className:"font-display font-bold text-foreground",children:"Featured Products"})}),a.jsx("div",{className:"grid grid-cols-2 gap-3",children:s?Array.from({length:4}).map((e,t)=>a.jsxs("div",{className:"p-2",children:[a.jsx("div",{className:"aspect-square w-full rounded-lg bg-muted animate-pulse mb-2"}),a.jsx("div",{className:"h-3 w-full bg-muted animate-pulse rounded mb-1"}),a.jsx("div",{className:"h-4 w-16 bg-muted animate-pulse rounded"})]},t)):null==n?void 0:n.slice(0,4).map(t=>{var r;const n=4.3+t.node.title.length%7*.1;return a.jsxs(g,{to:Nd(t),onClick:e,className:"p-2 rounded-lg hover:bg-secondary/50 transition-colors group",children:[a.jsx("div",{className:"aspect-square rounded-lg overflow-hidden bg-muted mb-2",children:(null==(r=t.node.images.edges[0])?void 0:r.no
21de.url)?a.jsx("img",{src:t.node.images.edges[0].node.url,alt:t.node.title,className:"w-full h-full object-cover group-hover:scale-110 transition-transform duration-300"}):a.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground text-xs",children:"No image"})}),a.jsx("p",{className:"text-xs font-medium text-foreground group-hover:text-primary transition-colors line-clamp-1",children:t.node.title}),a.jsx(Oh,{rating:n,showCount:!1,size:"sm",className:"my-1"}),a.jsx("p",{className:"text-xs font-bold text-primary",children:jd(t.node.priceRange.minVariantPrice.amount,t.node.priceRange.minVariantPrice.currencyCode)})]},t.node.id)})})]}),a.jsx("div",{className:"col-span-3 border-l border-border pl-6",children:a.jsxs("div",{className:"h-full flex flex-col gap-4",children:[a.jsxs(g,{to:"/contact",onClick:e,className:"flex-1 rounded-xl bg-gradient-to-br from-primary/10 via-primary/5 to-transparent border border-primary/20 p-4 flex flex-col justify-between hover:border-primary/40 transition-colors group",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2 py-1 rounded-full bg-primary/10 text-primary text-xs font-medium mb-3",children:[a.jsx(wi,{className:"w-3 h-3"}),"Custom Orders"]}),a.jsx("h4",{className:"font-display font-bold text-lg text-foreground mb-1",children:"Need Something Unique?"}),a.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"Get a custom quote for bulk orders or special designs"})]}),a.jsxs("span",{className:"inline-flex items-center gap-1 text-sm font-medium text-primary group-hover:text-primary/80",children:["Request Quote ",a.jsx(Bo,{className:"w-4 h-4"})]})]}),a.jsxs("div",{className:"rounded-xl bg-brand-navy text-white p-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(ji,{className:"w-4 h-4 text-primary"}),a.jsx("span",{className:"text-sm font-medium",children:"Free Shipping"})]}),a.jsx("p",{className:"text-xs text-white/80",children:"On all orders. Fast 2-3 day delivery."})]})]})})]})},$h=({onClose:e})=>{const{data:t,isLoading:r}=o({queryKey:["shopify-collections-categories-menu"],queryFn:()=>_d(12)}),n=null==t?void 0:t.filter(e=>"popular-products"!==e.handle&&"popular products"!==e.title.toLowerCase());return a.jsxs("div",{className:"w-64",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3 pb-3 border-b border-border",children:[a.jsx("h3",{className:"font-display font-semibold text-sm text-foreground",children:"Categories"}),a.jsxs(g,{to:"/products",onClick:e,className:"text-xs text-primary hover:text-primary/80 flex items-center gap-1",children:["View All ",a.jsx(Bo,{className:"w-3 h-3"})]})]}),a.jsx("div",{className:"flex flex-col",children:r?Array.from({length:6}).map((e,t)=>a.jsx("div",{className:"h-9 bg-muted animate-pulse rounded mb-1"},t)):null==n?void 0:n.map(t=>a.jsx(g,{to:`/${t.handle}`,onClick:e,className:"py-2 px-3 text-sm text-foreground hover:text-primary hover:bg-secondary/50 rounded-md transition-colors",children:t.title},t.id))})]})};var Dh="rovingFocusGroup.onEntryFocus",Lh={bubbles:!1,cancelable:!0},Uh="RovingFocusGroup",[Mh,qh,zh]=Ka(Uh),[Bh,Fh]=j(Uh,[zh]),[Wh,Vh]=Bh(Uh),Kh=p.forwardRef((e,t)=>a.jsx(Mh.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(Mh.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(Hh,{...e,ref:t})})}));Kh.displayName=Uh;var Hh=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:s=!1,dir:o,currentTabStopId:i,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:u=!1,...h}=e,f=p.useRef(null),m=T(t,f),g=tu(o),[y,v]=C({prop:i,defaultProp:l??null,onChange:c,caller:Uh}),[w,b]=p.useState(!1),x=I(d),_=qh(r),k=p.useRef(!1),[j,S]=p.useState(0);return p.useEffect(()=>{const e=f.current;if(e)return e.addEventListener(Dh,x),()=>e.removeEventListener(Dh,x)},[x]),a.jsx(Wh,{scope:r,orientation:n,dir:g,loop:s,currentTabStopId:y,onItemFocus:p.useCallback(e=>v(e),[v]),onItemShiftTab:p.useCallback(()=>b(!0),[]),onFocusableItemAdd:p.useCallback(()=>S(e=>e+1),[]),onFocusableItemRemove:p.useCallback(()=>S(e=>e-1),[]),children:a.jsx(N.div,{tabIndex:w||0===j?-1:0,"data-orientation":n,...h,ref:m,style:{outline:"none",...e.style},onMouseDown:R(e.onMouseDown,()=>{k.current=!0}),onFocus:R(e.onFocus,e=>{const t=!k.current;if(e.target===e.currentTarget&&t&&!w){const t=new CustomEvent(Dh,Lh);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=_().filter(e=>
vendor: 17,264 bytes, line 21
21e.focusable);Xh([e.find(e=>e.active),e.find(e=>e.id===y),...e].filter(Boolean).map(e=>e.ref.current),u)}}k.current=!1}),onBlur:R(e.onBlur,()=>b(!1))})})}),Gh="RovingFocusGroupItem",Jh=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:s=!1,tabStopId:o,children:i,...l}=e,c=X(),d=o||c,u=Vh(Gh,r),h=u.currentTabStopId===d,f=qh(r),{onFocusableItemAdd:m,onFocusableItemRemove:g,currentTabStopId:y}=u;return p.useEffect(()=>{if(n)return m(),()=>g()},[n,m,g]),a.jsx(Mh.ItemSlot,{scope:r,id:d,focusable:n,active:s,children:a.jsx(N.span,{tabIndex:h?0:-1,"data-orientation":u.orientation,...l,ref:t,onMouseDown:R(e.onMouseDown,e=>{n?u.onItemFocus(d):e.preventDefault()}),onFocus:R(e.onFocus,()=>u.onItemFocus(d)),onKeyDown:R(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void u.onItemShiftTab();if(e.target!==e.currentTarget)return;const t=function(e,t,r){const n=function(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,r);return"vertical"===t&&["ArrowLeft","ArrowRight"].includes(n)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(n)?void 0:Yh[n]}(e,u.orientation,u.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let s=f().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)s.reverse();else if("prev"===t||"next"===t){"prev"===t&&s.reverse();const a=s.indexOf(e.currentTarget);s=u.loop?(n=a+1,(r=s).map((e,t)=>r[(n+t)%r.length])):s.slice(a+1)}setTimeout(()=>Xh(s))}var r,n}),children:"function"==typeof i?i({isCurrentTabStop:h,hasTabStop:null!=y}):i})})});Jh.displayName=Gh;var Yh={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Xh(e,t=!1){const r=document.activeElement;for(const n of e){if(n===r)return;if(n.focus({preventScroll:t}),document.activeElement!==r)return}}var Qh=Kh,Zh=Jh,ep=["Enter"," "],tp=["ArrowUp","PageDown","End"],rp=["ArrowDown","PageUp","Home",...tp],np={ltr:[...ep,"ArrowRight"],rtl:[...ep,"ArrowLeft"]},sp={ltr:["ArrowLeft"],rtl:["ArrowRight"]},ap="Menu",[op,ip,lp]=Ka(ap),[cp,dp]=j(ap,[lp,Q,Fh]),up=Q(),hp=Fh(),[pp,fp]=cp(ap),[mp,gp]=cp(ap),yp=e=>{const{__scopeMenu:t,open:r=!1,children:n,dir:s,onOpenChange:o,modal:i=!0}=e,l=up(t),[c,d]=p.useState(null),u=p.useRef(!1),h=I(o),f=tu(s);return p.useEffect(()=>{const e=()=>{u.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}},[]),a.jsx(ie,{...l,children:a.jsx(pp,{scope:t,open:r,onOpenChange:h,content:c,onContentChange:d,children:a.jsx(mp,{scope:t,onClose:p.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:u,dir:f,modal:i,children:n})})})};yp.displayName=ap;var vp=p.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,s=up(r);return a.jsx(ee,{...s,...n,ref:t})});vp.displayName="MenuAnchor";var wp="MenuPortal",[bp,xp]=cp(wp,{forceMount:void 0}),_p=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:s}=e,o=fp(wp,t);return a.jsx(bp,{scope:t,forceMount:r,children:a.jsx(A,{present:r||o.open,children:a.jsx($,{asChild:!0,container:s,children:n})})})};_p.displayName=wp;var kp="MenuContent",[jp,Tp]=cp(kp),Sp=p.forwardRef((e,t)=>{const r=xp(kp,e.__scopeMenu),{forceMount:n=r.forceMount,...s}=e,o=fp(kp,e.__scopeMenu),i=gp(kp,e.__scopeMenu);return a.jsx(op.Provider,{scope:e.__scopeMenu,children:a.jsx(A,{present:n||o.open,children:a.jsx(op.Slot,{scope:e.__scopeMenu,children:i.modal?a.jsx(Ep,{...s,ref:t}):a.jsx(Np,{...s,ref:t})})})})}),Ep=p.forwardRef((e,t)=>{const r=fp(kp,e.__scopeMenu),n=p.useRef(null),s=T(t,n);return p.useEffect(()=>{const e=n.current;if(e)return oe(e)},[]),a.jsx(Ap,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:R(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),Np=p.forwardRef((e,t)=>{const r=fp(kp,e.__scopeMenu);return a.jsx(Ap,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),Cp=S("MenuContent.ScrollLock"),Ap=p.forwardRef((e,t)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:d,onPointerDownOutside:u,onFocusOutside:h,onInteractOutside:f,onDismiss:m,disableOutsideScroll:g,...y}=e,v=fp(kp,r),w=gp(kp,r),b=up(r),x=hp(r),_=ip(r),[k,j]=p.useState(null),S=p.useRef(null),E=T(t,S,v.onContentChange),N=p.useRef(0),C=p.useRef(""),A=p.useRef(0),I=p.useRef(null),O=p.useRef("right"),P=p.useRef(0),$=g?re:p.Fragment,D=g?{as:Cp,allowPinchZoom:!0}:void 0,L=e=>{var t,r;const n=C.current+e,s=_().filter(e=>!e.disabled),a=document.activeElement,o=null==(t=s.find(e=>e.ref.current===a))?void 0:t.textValue,i=function(e,t,r){const n=t.length>1&&Array.from(t).every(e=>e===t[0]),s=n?t[0]:t,a=r?e.indexOf(r):-1;let o=(i=e,l=Math.max(a,0),i.map((e,t)=>i[(l+t)%i.length]));var i,l;1===s.length&&(o=o.filter(e=>e!==r));const c=o.find(e=>e.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}(s.map(e=>e.textValue),n,o),l=null==(r=s.find(e=>e.textValue===i))?void 0:r.ref.current;!function e(t){C.current=t,window.clearTimeout(N.current),""!==t&&(N.current=window.setTimeout(()=>e(""),1e3))}(n),l&&setTimeout(()=>l.focus())};p.useEffect(()=>()=>window.clearTimeout(N.current),[]),te();const U=p.useCallback(e=>{var t,r;return O.current===(null==(t=I.current)?void 0:t.side)&&function(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return function(e,t){const{x:r,y:n}=e;let s=!1;for(let a=0,o=t.length-1;a<t.length;o=a++){const e=t[a],i=t[o],l=e.x,c=e.y,d=i.x,u=i.y;c>n!=u>n&&r<(d-l)*(n-c)/(u-c)+l&&(s=!s)}return s}(r,t)}(e,null==(r=I.current)?void 0:r.area)},[]);return a.jsx(jp,{scope:r,searchRef:C,onItemEnter:p.useCallback(e=>{U(e)&&e.preventDefault()},[U]),onItemLeave:p.useCallback(e=>{var t;U(e)||(null==(t=S.current)||t.focus(),j(null))},[U]),onTriggerLeave:p.useCallback(e=>{U(e)&&e.preventDefault()},[U]),pointerGraceTimerRef:A,onPointerGraceIntentChange:p.useCallback(e=>{I.current=e},[]),children:a.jsx($,{...D,children:a.jsx(ne,{asChild:!0,trapped:s,onMountAutoFocus:R(o,e=>{var t;e.preventDefault(),null==(t=S.current)||t.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:a.jsx(se,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:d,onPointerDownOutside:u,onFocusOutside:h,onInteractOutside:f,onDismiss:m,children:a.jsx(Qh,{asChild:!0,...x,dir:w.dir,orientation:"vertical",loop:n,currentTabStopId:k,onCurrentTabStopIdChange:j,onEntryFocus:R(c,e=>{w.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(ae,{role:"menu","aria-orientation":"vertical","data-state":rf(v.open),"data-radix-menu-content":"",dir:w.dir,...b,...y,ref:E,style:{outline:"none",...y.style},onKeyDown:R(y.onKeyDown,e=>{const t=e.target.closest("[data-radix-menu-content]")===e.currentTarget,r=e.ctrlKey||e.altKey||e.metaKey,n=1===e.key.length;t&&("Tab"===e.key&&e.preventDefault(),!r&&n&&L(e.key));const s=S.current;if(e.target!==s)return;if(!rp.includes(e.key))return;e.preventDefault();const a=_().filter(e=>!e.disabled).map(e=>e.ref.current);tp.includes(e.key)&&a.reverse(),function(e){const t=document.activeElement;for(const r of e){if(r===t)return;if(r.focus(),document.activeElement!==t)return}}(a)}),onBlur:R(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(N.current),C.current="")}),onPointerMove:R(e.onPointerMove,af(e=>{const t=e.target,r=P.current!==e.clientX;if(e.currentTarget.contains(t)&&r){const t=e.clientX>P.current?"right":"left";O.current=t,P.current=e.clientX}}))})})})})})})});Sp.displayName=kp;var Rp=p.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return a.jsx(N.div,{role:"group",...n,ref:t})});Rp.displayName="MenuGroup";var Ip=p.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return a.jsx(N.div,{...n,ref:t})});Ip.displayName="MenuLabel";var Op="MenuItem",Pp="menu.itemSelect",$p=p.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...s}=e,o=p.useRef(null),i=gp(Op,e.__scopeMenu),l=Tp(Op,e.__scopeMenu),c=T(t,o),d=p.useRef(!1);return a.jsx(Dp,{...s,ref:c,disabled:r,onClick:R(e.onClick,()=>{const e=o.current;if(!r&&e){const t=new CustomEvent(Pp,{bubbles:!0,cancelable:!0});e.addEventListener(Pp,e=>null==n?void 0:n(e),{once:!0}),L(e,t),t.defaultPrevented?d.current=!1:i.onClose()}}),onPointerDown:t=>{var r;null==(r=e.onPointerDown)||r.call(e,t),d.current=!0},onPointerUp:R(e.onPointerUp,e=>{var t;d.current||null==(t=e.currentTarget)||t.click()}),onKeyDown:R(e.onKeyDown,e=>{const t=""!==l.searchRef.current;r||t&&" "===e.key||ep.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});$p.displayName=Op;var Dp=p.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:s,...o}=e,i=Tp(Op,r),l=hp(r),c=p.useRef(null),d=T(t,c),[u,h]=p.useState(!1),[f,m]=p.useState("");return p.useEffect(()=>{const e=c.current;e&&m((e.textContent??"").trim())},[o.children]),a.jsx(op.ItemSlot,{scope:r,disabled:n,textValue:s??f,children:a.jsx(Zh,{asChild:!0,...l,focusable:!n,children:a.jsx(N.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...o,ref:d,onPointerMove:R(e.onPointerMove,af(e=>{if(n)i.onItemLeave(e);else if(i.onItemEnter(e),!e.defaultPrevented){e.currentTarget.focus({preventScroll:!0})}})),onPointerLeave:R(e.onPointerLeave,af(e=>i.onItemLeave(e))),onFocus:R(e.onFocus,()=>h(!0)),onBlur:R(e.onBlur,()=>h(!1))})})})}),Lp=p.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:n,...s}=e;return a.jsx(Vp,{scope:e.__scopeMenu,checked:r,children:a.jsx($p,{role:"menuitemcheckbox","aria-checked":nf(r)?"mixed":r,...s,ref:t,"data-state":sf(r),onSelect:R(s.onSelect,()=>null==n?void 0:n(!!nf(r)||!r),{checkForDefaultPrevented:!1})})})});Lp.displayName="MenuCheckboxItem";var Up="MenuRadioGroup",[Mp,qp]=cp(Up,{value:void 0,onValueChange:()=>{}}),zp=p.forwardRef((e,t)=>{const{value:r,onValueChange:n,...s}=e,o=I(n);return a.jsx(Mp,{scope:e.__scopeMenu,value:r,onValueChange:o,children:a.jsx(Rp,{...s,ref:t})})});zp.displayName=Up;var Bp="MenuRadioItem",Fp=p.forwardRef((e,t)=>{const{value:r,...n}=e,s=qp(Bp,e.__scopeMenu),o=r===s.value;return a.jsx(Vp,{scope:e.__scopeMenu,checked:o,children:a.jsx($p,{role:"menuitemradio","aria-checked":o,...n,ref:t,"data-state":sf(o),onSelect:R(n.onSelect,()=>{var e;return null==(e=s.onValueChange)?void 0:e.call(s,r)},{checkForDefaultPrevented:!1})})})});Fp.displayName=Bp;var Wp="MenuItemIndicator",[Vp,Kp]=cp(Wp,{checked:!1}),Hp=p.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:n,...s}=e,o=Kp(Wp,r);return a.jsx(A,{present:n||nf(o.checked)||!0===o.checked,children:a.jsx(N.span,{...s,ref:t,"data-state":sf(o.checked)})})});Hp.displayName=Wp;var Gp=p.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return a.jsx(N.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});Gp.displayName="MenuSeparator";var Jp=p.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,s=up(r);return a.jsx(le,{...s,...n,ref:t})});Jp.displayName="MenuArrow";var[Yp,Xp]=cp("MenuSub"),Qp="MenuSubTrigger",Zp=p.forwardRef((e,t)=>{const r=fp(Qp,e.__scopeMenu),n=gp(Qp,e.__scopeMenu),s=Xp(Qp,e.__scopeMenu),o=Tp(Qp,e.__scopeMenu),i=p.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=o,d={__scopeMenu:e.__scopeMenu},u=p.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return p.useEffect(()=>u,[u]),p.useEffect(()=>{const e=l.current;return()=>{window.clearTimeout(e),c(null)}},[l,c]),a.jsx(vp,{asChild:!0,...d,children:a.jsx(Dp,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":s.contentId,"data-state":rf(r.open),...e,ref:Z(t,s.onTriggerChange),onClick:t=>{var n;null==(n=e.onClick)||n.call(e,t),e.disabled||t.defaultPrevented||(t.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:R(e.onPointerMove,af(t=>{o.onItemEnter(t),t.defaultPrevented||e.disabled||r.open||i.current||(o.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{r.onOpenChange(!0),u()},100))})),onPointerLeave:R(e.onPointerLeave,af(e=>{var t,n;u();const s=null==(t=r.content)?void 0:t.getBoundingClientRect();if(s){const t=null==(n=r.content)?void 0:n.dataset.side,a="right"===t,i=a?-5:5,c=s[a?"left":"right"],d=s[a?"right":"left"];o.onPointerGraceIntentChange({area:[{x:e.clientX+i,y:e.clientY},{x:c,y:s.top},{x:d,y:s.top},{x:d,y:s.bottom},{x:c,y:s.bottom}],side:t}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(e),e.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:R(e.onKeyDown,t=>{var s;const a=""!==o.searchRef.current;e.disabled||a&&" "===t.key||np[n.dir].includes(t.key)&&(r.onOpenChange(!0),null==(s=r.content)||s.focus(),t.preventDefault())})})})});Zp.displayName=Qp;var ef="MenuSubContent",tf=p.forwardRef((e,t)=>{const r=xp(kp,e.__scopeMenu),{forceMount:n=r.forceMount,...s}=e,o=fp(kp,e.__scopeMenu),i=gp(kp,e.__scopeMenu),l=Xp(ef,e.__scopeMenu),c=p.useRef(null),d=T(t,c);return a.jsx(op.Provider,{scope:e.__scopeMenu,children:a.jsx(A,{present:n||o.open,children:a.jsx(op.Slot,{scope:e.__scopeMenu,children:a.jsx(Ap,{id:l.contentId,"aria-labelledby":l.triggerId,...s,ref:d,align:"start",side:"rtl"===i.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{var t;i.isUsingKeyboardRef.current&&(null==(t=c.current)||t.focus()),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:R(e.onFocusOutside,e=>{e.target!==l.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:R(e.onEscapeKeyDown,e=>{i.onClose(),e.preventDefault()}),onKeyDown:R(e.onKeyDown,e=>{var t;const r=e.currentTarget.contains(e.target),n=sp[i.dir].includes(e.key);r&&n&&(o.onOpenChange(!1),null==(t=l.trigger)||t.focus(),e.preventDefault())})})})})})});function rf(e){return e?"open":"closed"}function nf(e){return"indeterminate"===e}function sf(e){return nf(e)?"indeterminate":e?"checked":"unchecked"}function af(e){return t=>"mouse"===t.pointerType?e(t):void 0}tf.displayName=ef;var of=yp,lf=vp,cf=_p,df=Sp,uf=Rp,hf=Ip,pf=$p,ff=Lp,mf=zp,gf=Fp,yf=Hp,vf=Gp,wf=Jp,bf=Zp,xf=tf,_f="DropdownMenu",[kf]=j(_f,[dp]),jf=dp(),[Tf,Sf]=kf(_f),Ef=e=>{const{__scopeDropdownMenu:t,children:r,dir:n,open:s,defaultOpen:o,onOpenChange:i,modal:l=!0}=e,c=jf(t),d=p.useRef(null),[u,h]=C({prop:s,defaultProp:o??!1,onChange:i,caller:_f});return a.jsx(Tf,{scope:t,triggerId:X(),triggerRef:d,contentId:X(),open:u,onOpenChange:h,onOpenToggle:p.useCallback(()=>h(e=>!e),[h]),modal:l,children:a.jsx(of,{...c,open:u,onOpenChange:h,dir:n,modal:l,children:r})})};Ef.displayName=_f;var Nf="DropdownMenuTrigger",Cf=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...s}=e,o=Sf(Nf,r),i=jf(r);return a.jsx(lf,{asChild:!0,...i,children:a.jsx(N.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...s,ref:Z(t,o.triggerRef),onPointerDown:R(e.onPointerDown,e=>{n||0!==e.button||!1!==e.ctrlKey||(o.onOpenToggle(),o.open||e.preventDefault())}),onKeyDown:R(e.onKeyDown,e=>{n||(["Enter"," "].includes(e.key)&&o.onOpenToggle(),"ArrowDown"===e.key&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(e.key)&&e.preventDefault())})})})});Cf.displayName=Nf;var Af=e=>{const{__scopeDropdownMenu:t,...r}=e,n=jf(t);return a.jsx(cf,{...n,...r})};Af.displayName="DropdownMenuPortal";var Rf="DropdownMenuContent",If=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=Sf(Rf,r),o=jf(r),i=p.useRef(!1);return a.jsx(df,{id:s.contentId,"aria-labelledby":s.triggerId,...o,...n,ref:t,onCloseAutoFocus:R(e.onCloseAutoFocus,e=>{var t;i.current||null==(t=s.triggerRef.current)||t.focus(),i.current=!1,e.preventDefault()}),onInteractOutside:R(e.onInteractOutside,e=>{const t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey,n=2===t.button||r;s.modal&&!n||(i.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});If.displayName=Rf;p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=jf(r);return a.jsx(uf,{...s,...n,ref:t})}).displayName="DropdownMenuGroup";var Of=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=jf(r);return a.jsx(hf,{...s,...n,ref:t})});Of.displayName="DropdownMenuLabel";var Pf=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=jf(r);return a.jsx(pf,{...s,...n,ref:t})});Pf.displayName="DropdownMenuItem";var $f=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=jf(r);return a.jsx(ff,{...s,...n,ref:t})});$f.displayName="DropdownMenuCheckboxItem";p.forwardRef((e,t)=>
21{const{__scopeDropdownMenu:r,...n}=e,s=jf(r);return a.jsx(mf,{...s,...n,ref:t})}).displayName="DropdownMenuRadioGroup";var Df=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=jf(r);return a.jsx(gf,{...s,...n,ref:t})});Df.displayName="DropdownMenuRadioItem";var Lf=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=jf(r);return a.jsx(yf,{...s,...n,ref:t})});Lf.displayName="DropdownMenuItemIndicator";var Uf=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=jf(r);return a.jsx(vf,{...s,...n,ref:t})});Uf.displayName="DropdownMenuSeparator";p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=jf(r);return a.jsx(wf,{...s,...n,ref:t})}).displayName="DropdownMenuArrow";var Mf=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=jf(r);return a.jsx(bf,{...s,...n,ref:t})});Mf.displayName="DropdownMenuSubTrigger";var qf=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=jf(r);return a.jsx(xf,{...s,...n,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});qf.displayName="DropdownMenuSubContent";var zf=Af,Bf=If,Ff=Of,Wf=Pf,Vf=$f,Kf=Df,Hf=Lf,Gf=Uf,Jf=Mf,Yf=qf;const Xf=Ef,Qf=Cf;p.forwardRef(({className:e,inset:t,children:r,...n},s)=>a.jsxs(Jf,{ref:s,className:bl("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[state=open]:bg-accent focus:bg-accent",t&&"pl-8",e),...n,children:[r,a.jsx(Vo,{className:"ml-auto h-4 w-4"})]})).displayName=Jf.displayName;p.forwardRef(({className:e,...t},r)=>a.jsx(Yf,{ref:r,className:bl("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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",e),...t})).displayName=Yf.displayName;const Zf=p.forwardRef(({className:e,sideOffset:t=4,...r},n)=>a.jsx(zf,{children:a.jsx(Bf,{ref:n,sideOffset:t,className:bl("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md 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",e),...r})}));Zf.displayName=Bf.displayName;const em=p.forwardRef(({className:e,inset:t,...r},n)=>a.jsx(Wf,{ref:n,className:bl("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",t&&"pl-8",e),...r}));em.displayName=Wf.displayName;p.forwardRef(({className:e,children:t,checked:r,...n},s)=>a.jsxs(Vf,{ref:s,className:bl("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),checked:r,...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(Hf,{children:a.jsx(Fo,{className:"h-4 w-4"})})}),t]})).displayName=Vf.displayName;p.forwardRef(({className:e,children:t,...r},n)=>a.jsxs(Kf,{ref:n,className:bl("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(Hf,{children:a.jsx(Ko,{className:"h-2 w-2 fill-current"})})}),t]})).displayName=Kf.displayName;const tm=p.forwardRef(({className:e,inset:t,...r},n)=>
21a.jsx(Ff,{ref:n,className:bl("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r}));tm.displayName=Ff.displayName;const rm=p.forwardRef(({className:e,...t},r)=>a.jsx(Gf,{ref:r,className:bl("-mx-1 my-1 h-px bg-muted",e),...t}));rm.displayName=Gf.displayName;const nm=()=>{const[e,t]=p.useState(!1),[r,n]=p.useState(!1),[s,o]=p.useState(!1),{shouldShowBar:i}=Fd(),{user:l,isAdmin:c,signOut:d}=Md(),{customer:u,logout:h}=Od(),f=y(),m=()=>{var e;return u?u.firstName||u.email||"My Account":l?(null==(e=l.email)?void 0:e.split("@")[0])||"My Account":"Sign In"},v=!!u||!!l,w=[{name:"Clearance",href:"/clearance",isRoute:!0,highlight:!0},{name:"About",href:"/about",isRoute:!0}];return a.jsx("header",{className:"fixed left-0 right-0 z-50 bg-background border-b border-border shadow-sm transition-all duration-300 "+(i?"top-[42px]":"top-0"),children:a.jsxs("div",{className:"container mx-auto px-4",children:[a.jsxs("div",{className:"flex items-center justify-between h-16 md:h-20 gap-4",children:[a.jsx(g,{to:"/",className:"flex items-center shrink-0",children:a.jsx("img",{src:"/assets/1a-display-logo-new-DwT4gcsH.png",alt:"1A Display - Premium Banners, Flags & Display Stands",width:120,height:48,className:"h-10 md:h-12 w-auto"})}),a.jsx("div",{className:"hidden md:block flex-1 max-w-md mx-4",children:a.jsx(Ih,{})}),a.jsxs("nav",{className:"hidden lg:flex items-center gap-6",children:[a.jsxs("div",{className:"relative",onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),children:[a.jsxs("button",{className:"flex items-center gap-1 transition-colors duration-200 text-sm font-medium py-2 "+(f.pathname.startsWith("/shop")||f.pathname.startsWith("/product")||"/products"===f.pathname?"text-primary font-semibold":"text-muted-foreground hover:text-foreground"),children:["Products",a.jsx(Wo,{className:"w-4 h-4 transition-transform duration-200 "+(r?"rotate-180":"")})]}),r&&a.jsx("div",{className:"absolute top-full left-1/2 -translate-x-1/2 pt-2",children:a.jsx("div",{className:"w-[900px] bg-background border border-border rounded-xl shadow-elevated p-6 animate-fade-in",children:a.jsx(Ph,{onClose:()=>n(!1)})})})]}),a.jsxs("div",{className:"relative",onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),children:[a.jsxs("button",{className:"flex items-center gap-1 transition-colors duration-200 text-sm font-medium py-2 "+(f.pathname.startsWith("/category")?"text-primary font-semibold":"text-muted-foreground hover:text-foreground"),children:["Categories",a.jsx(Wo,{className:"w-4 h-4 transition-transform duration-200 "+(s?"rotate-180":"")})]}),s&&a.jsx("div",{className:"absolute top-full left-1/2 -translate-x-1/2 pt-2",children:a.jsx("div",{className:"bg-background border border-border rounded-xl shadow-elevated p-4 animate-fade-in",children:a.jsx($h,{onClose:()=>o(!1)})})})]}),w.map(e=>{return e.isRoute?a.jsx(g,{to:e.href,className:"transition-colors duration-200 text-sm font-medium "+(t=e.href,("/"===t?"/"===f.pathname:f.pathname.startsWith(t))?"text-primary font-semibold":e.highlight?"text-destructive hover:text-destructive/80 font-semibold":"text-muted-foreground hover:text-foreground"),children:e.name},e.name):a.jsx("a",{href:e.href,className:"text-muted-foreground hover:text-foreground transition-colors duration-200 text-sm font-medium",children:e.name},e.name);var t})]}),a.jsxs("div",{className:"flex items-center gap-2 md:gap-3",children:[a.jsxs("a",{href:"tel:858-863-0275",className:"hidden lg:flex items-center gap-1.5 text-sm font-medium text-foreground hover:text-primary transition-colors px-2 py-1",children:[a.jsx(pi,{className:"w-4 h-4 text-primary"}),a.jsx("span",{className:"hidden xl:inline",children:"858-863-0275"})]}),a.jsx("a",{href:"tel:858-863-0275",className:"lg:hidden min-w-[48px] min-h-[48px] flex items-center justify-center text-muted-foreground hover:text-primary transition-colors","aria-label":"Call us",children:a.jsx(pi,{className:"w-5 h-5"})}),a.jsx(g,{to:"/contact",children:a.jsx(Vd,{variant:"ghost",size:"icon",className:"min-w-[48px] min-h-[48px] text-muted-foreground hover:text-primary","aria-label":"Contact us",children:a.jsx(ci,{className:"w-5 h-5"})})}),a.jsxs(Xf,{children:[a.jsx(Qf,{asChild:!0,children:a.jsxs("button",{className:"hidden md:flex items-center gap-1.5 text-sm font-medium text-muted-foreground hover:text-primary transition-colors px-2 py-1","aria-label":`My Account - ${m()}`,children:[a.jsx(Ti,{className:"w-4 h-4"}),a.jsx("span",{className:"hidden xl:inline",children:m()})]})}),a.jsx(Zf,{align:"end",className:"w-56 bg-background z-[100]",children:v?a.jsxs(a.Fragment,{children:[u&&a.jsxs(a.Fragment,{children:[a.jsx(tm,{className:"font-normal",children:a.jsxs("div",{className:"flex flex-col space-y-1",children:[a.jsxs("p",{className:"text-sm font-medium leading-none",children:[u.firstName," ",u.lastName]}),a.jsx("p",{className:"text-xs leading-none text-muted-foreground",children:u.email})]})}),a.jsx(rm,{})]}),l&&!u&&a.jsxs(a.Fragment,{children:[a.jsx(tm,{className:"font-normal",children:a.jsxs("div",{className:"flex flex-col space-y-1",children:[a.jsx("p",{className:"text-sm font-medium leading-none",children:"Welcome back!"}),a.jsx("p",{className:"text-xs leading-none text-muted-foreground",children:l.email})]})}),a.jsx(rm,{})]}),a.jsx(em,{asChild:!0,children:a.jsxs(g,{to:"/order-history",className:"flex items-center gap-2 cursor-pointer",children:[a.jsx(hi,{className:"w-4 h-4"}),"Order History"]})}),c&&a.jsxs(a.Fragment,{children:[a.jsx(rm,{}),a.jsx(em,{asChild:!0,children:a.jsxs(g,{to:"/admin",className:"flex items-center gap-2 cursor-pointer",children:[a.jsx(yi,{className:"w-4 h-4"}),"Admin Dashboard"]})})]}),a.jsx(rm,{}),a.jsxs(em,{onClick:()=>{u&&h(),l&&d()},className:"flex items-center gap-2 cursor-pointer",children:[a.jsx(si,{className:"w-4 h-4"}),"Sign Out"]})]}):a.jsxs(a.Fragment,{children:[a.jsx(em,{asChild:!0,children:a.jsxs(g,{to:"/order-history",className:"flex items-center gap-2 cursor-pointer",children:[a.jsx(hi,{className:"w-4 h-4"}),"Order History"]})}),a.jsx(rm,{}),a.jsx(em,{asChild:!0,children:a.jsxs(g,{to:"/auth",className:"flex items-center gap-2 cursor-pointer",children:[a.jsx(Ti,{className:"w-4 h-4"}),"Sign In"]})})]})})]}),a.jsx("div",{className:"hidden md:block w-px h-6 bg-border"}),a.jsx(Eh,{}),a.jsx(Vd,{variant:"ghost",size:"icon",className:"lg:hidden min-w-[48px] min-h-[48px]",onClick:()=>t(!e),"aria-label":e?"Close menu":"Open menu",children:e?a.jsx(Si,{className:"w-5 h-5"}):a.jsx(li,{className:"w-5 h-5"})})]})]}),e&&a.jsxs("div",{className:"lg:hidden py-4 border-t border-border animate-slide-up",children:[a.jsx("div",{className:"px-4 pb-4 md:hidden",children:a.jsx(Ih,{isMobile:!0,onClose:()=>t(!1)})}),a.jsxs("nav",{className:"flex flex-col gap-2",children:[a.jsx(g,{to:"/products",className:"px-4 py-3 text-muted-foreground hover:text-foreground hover:bg-secondary/50 rounded-lg transition-all duration-200",onClick:()=>t(!1),children:"Products"}),a.jsxs(g,{to:"/products",className:"px-4 py-3 text-muted-foreground hover:text-foreground hover:bg-secondary/50 rounded-lg transition-all duration-200 flex items-center gap-2",onClick:()=>t(!1),children:[a.jsx(Zo,{className:"w-4 h-4"}),"Categories"]}),w.map(e=>e.isRoute?a.jsx(g,{to:e.href,className:"px-4 py-3 text-muted-foreground hover:text-foreground hover:bg-secondary/50 rounded-lg transition-all duration-200",onClick:()=>t(!1),children:e.name},e.name):a.jsx("a",{href:e.href,className:"px-4 py-3 text-muted-foreground hover:text-foreground hover:bg-secondary/50 rounded-lg transition-all duration-200 block",onClick:()=>t(!1),children:e.name},e.name)),u&&a.jsxs("div",{className:"px-4 py-2 border-t border-border mt-2",children:[a.jsxs("p",{className:"text-sm font-medium",children:[u.firstName," ",u.lastName]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:u.email})]}),a.jsxs(g,{to:"/order-history",className:"px-4 py-3 text-muted-foreground hover:text-foreground hover:bg-secondary/50 rounded-lg transition-all duration-200 flex items-center gap-2",onClick:()=>t(!1),children:[a.jsx(hi,{className:"w-4 h-4"}),"Order History"]}),c&&a.jsxs(g,{to:"/admin",className:"px-4 py-3 text-muted-foreground hover:text-foreground hover:bg-secondary/50 rounded-lg transition-all duration-200 flex items-center gap-2",onClick:()=>t(!1),children:[a.jsx(yi,{className:"w-4 h-4"}),"Admin Dashboard"]}),v&&a.jsxs("button",{className:"px-4 py-3 text-muted-foreground hover:text-foreground hover:bg-secondary/50 rounded-lg transition-all duration-200 flex items-center gap-2 w-full text-left",onClick:()=>{u&&h(),l&&d(),t(!1)},children:[a.jsx(si,{className:"w-4 h-4"}),"Sign Out"]}),!v&&a.jsxs(g,{to:"/auth",className:"px-4 py-3 text-muted-foreground hover:text-foreground hover:bg-secondary/50 rounded-lg transition-all duration-200 flex items-center gap-2",onClick:()=>t(!1),children:[a.jsx(Ti,{className:"w-4 h-4"}),"Sign In"]})]})]})]})})},sm={Products:[{label:"All Products",href:"/products"},{label:"Clearance Sale",href:"/clearance",highlight:!0},{label:"Flags & Banners",href:"/flags"},{label:"Display Stands",href:"/banner-stands"},{label:"Canopy Tents",href:"/pop-up-tents"}],Support:[{label:"Shipping Info",href:"/shipping"},{label:"Returns Policy",href:"/returns"},{label:"FAQ",href:"/faq"},{label:"Contact Us",href:"/contact"}],Resources:[{label:"Blog",href:"/blog"}],Company:[{label:"About Us",href:"/about"},{label:"Privacy Policy",href:"/privacy"},{label:"Terms of Service",href:"/terms"}]},am=()=>a.jsx("footer",{className:"bg-slate-900 text-white pt-16 pb-8 lg:pb-24",children:a.jsxs("div",{className:"container mx-auto px-4",children:[a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-8 mb-12",children:[a.jsxs("div",{className:"col-span-2 lg:col-span-2",children:[a.jsx(g,{to:"/",className:"inline-block mb-4",children:a.jsx("img",{src:"/assets/1a-display-logo-white-C_AvEOQt.png",alt:"1A Display - Premium Banners, Flags & Display Stands",loading:"lazy",width:180,height:48,className:"h-12 w-auto"})}),a.jsx("p",{className:"text-slate-400 text-base mb-6 max-w-xs",children:"Professional advertising and display solutions for businesses that demand excellence."}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("a",{href:"mailto:[email protected]",className:"flex items-center gap-2 text-base text-slate-400 hover:text-white transition-colors min-h-[48px]",children:[a.jsx(ai,{className:"w-4 h-4 shrink-0"}),"[email protected]"]}),a.jsxs("a",{href:"tel:+18588630275",className:"flex items-center gap-2 text-base text-slate-400 hover:text-white transition-colors min-h-[48px]",children:[a.jsx(pi,{className:"w-4 h-4 shrink-0"}),"858-863-0275"]}),a.jsxs("div",{className:"flex items-center gap-2 text-base text-slate-400 py-2",children:[a.jsx(oi,{className:"w-4 h-4 shrink-0"}
21),"San Diego, CA 92130"]})]}),a.jsxs("div",{className:"flex items-center gap-2 mt-4",children:[a.jsx("a",{href:"https://www.facebook.com/1Adisplay/",target:"_blank",rel:"noopener noreferrer",className:"min-w-[48px] min-h-[48px] flex items-center justify-center text-slate-400 hover:text-white transition-colors","aria-label":"Follow us on Facebook",children:a.jsx(Yo,{className:"w-5 h-5"})}),a.jsx("a",{href:"https://www.instagram.com/1adisplay/",target:"_blank",rel:"noopener noreferrer",className:"min-w-[48px] min-h-[48px] flex items-center justify-center text-slate-400 hover:text-white transition-colors","aria-label":"Follow us on Instagram",children:a.jsx(ti,{className:"w-5 h-5"})})]})]}),Object.entries(sm).map(([e,t])=>a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-white mb-4",children:e}),a.jsx("ul",{className:"space-y-0",children:t.map(e=>a.jsx("li",{children:a.jsx(g,{to:e.href,className:"block text-base min-h-[48px] flex items-center transition-colors "+(e.highlight?"text-red-400 hover:text-red-300 font-medium":"text-slate-400 hover:text-white"),children:e.label})},e.label))})]},e))]}),a.jsxs("div",{className:"pt-8 border-t border-slate-700 flex flex-col md:flex-row justify-between items-center gap-4",children:[a.jsxs("p",{className:"text-base text-slate-400",children:["© ",(new Date).getFullYear()," 1ADisplay. All rights reserved."]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(g,{to:"/privacy",className:"text-base text-slate-400 hover:text-white transition-colors min-h-[48px] flex items-center px-2",children:"Privacy Policy"}),a.jsx(g,{to:"/terms",className:"text-base text-slate-400 hover:text-white transition-colors min-h-[48px] flex items-center px-2",children:"Terms of Service"})]})]})]})}),om=()=>{const e=y(),{user:t}=Md(),r=[{icon:ei,label:"Home",href:"/"},{icon:Zo,label:"Products",href:"/products"},{icon:xi,label:"Clearance",href:"/clearance",highlight:!0},{icon:di,label:"Contact",href:"/contact"},{icon:Ti,label:"Account",href:t?"/order-history":"/auth"}];return a.jsx("nav",{className:"fixed bottom-0 left-0 right-0 z-50 lg:hidden glass-card border-t border-border/30 safe-area-bottom",children:a.jsx("div",{className:"flex items-center justify-around h-[64px]",children:r.map(t=>{return a.jsxs(g,{to:t.href,className:"flex flex-col items-center justify-center gap-0.5 min-w-[48px] min-h-[48px] px-3 py-1 transition-colors duration-200 group "+(r=t.href,("/"===r?"/"===e.pathname:e.pathname.startsWith(r))?t.highlight?"text-destructive":"text-primary":t.highlight?"text-destructive/70 hover:text-destructive":"text-muted-foreground hover:text-primary"),children:[a.jsx(t.icon,{className:"w-5 h-5 group-hover:scale-110 transition-transform duration-200"}),a.jsx("span",{className:"text-[11px] font-medium",children:t.label})]},t.label);var r})})})},im=()=>{const[e,t]=p.useState(!1);return p.useEffect(()=>{if(!("serviceWorker"in navigator))return;const e=()=>{t(!0)};navigator.serviceWorker.addEventListener("controllerchange",e),navigator.serviceWorker.getRegistration().then(e=>{(null==e?void 0:e.waiting)&&t(!0)});const r=setTimeout(()=>t(!1),3e4);return()=>{navigator.serviceWorker.removeEventListener("controllerchange",e),clearTimeout(r)}},[]),e?a.jsx("div",{className:"fixed bottom-4 left-4 right-4 md:left-auto md:right-4 md:w-auto z-[100] animate-in slide-in-from-bottom-4",children:a.jsxs("div",{className:"bg-primary text-primary-foreground px-4 py-3 rounded-lg shadow-lg flex items-center gap-3",children:[a.jsx(mi,{className:"h-4 w-4 shrink-0 animate-spin"}),a.jsx("span",{className:"text-sm font-medium",children:"A new version is available."}),a.jsx("button",{onClick:()=>window.location.reload(),className:"text-sm font-bold underline underline-offset-2 hover:opacity-80",children:"Update now"}),a.jsx("button",{onClick:()=>t(!1),className:"ml-1 hover:opacity-80","aria-label":"Dismiss",children:a.jsx(Si,{className:"h-4 w-4"})})]})}):null},lm=()=>{const[e,t]=p.useState(!1);if(p.useEffect(()=>{const e=setTimeout(()=>{"pending"===uc()&&t(!0)},1500);return()=>clearTimeout(e)},[]),!e)return null;const r=()=>{localStorage.setItem(dc,"denied"),oc(!1),Da(()=>Promise.resolve().then(()=>nd),void 0).then(e=>e.syncTawkContext()),t(!1)};return a.jsx("div",{className:"fixed bottom-0 left-0 right-0 z-[100] p-4 sm:p-6 animate-in slide-in-from-bottom-5 duration-500",children:a.jsx("div",{className:"mx-auto max-w-2xl rounded-2xl border border-border bg-card shadow-xl p-5 sm:p-6",children:a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"hidden sm:flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-primary/10",children:a.jsx(Go,{className:"h-5 w-5 text-primary"})}),a.jsxs("div",{className:"flex-1 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"font-display text-sm font-semibold text-foreground",children:"We value your privacy"}),a.jsx("button",{onClick:r,className:"sm:hidden text-muted-foreground hover:text-foreground transition-colors -mt-1 -mr-1 p-1","aria-label":"Close",children:a.jsx(Si,{className:"h-4 w-4"})})]}),a.jsxs("p",{className:"text-xs leading-relaxed text-muted-foreground",children:["We use cookies to analyze site traffic and optimize your experience. No data is collected until you consent."," ",a.jsx(g,{to:"/privacy",className:"underline text-primary hover:text-primary/80 transition-colors",children:"Privacy Policy"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Vd,{size:"sm",onClick:()=>{localStorage.setItem(dc,"granted"),ic("consent_granted",{analytics_storage:"granted"}),oc(!0),Da(()=>Promise.resolve().then(()=>nd),void 0).then(e=>e.syncTawkContext()),t(!1)},className:"text-xs h-8 px-4",children:"Accept"}),a.jsx(Vd,{size:"sm",variant:"outline",onClick:r,className:"text-xs h-8 px-4",children:"Decline"})]})]})]})})})},cm=["/admin","/designer","/design-tool","/design/"],dm=e=>cm.some(t=>e.startsWith(t));let um=!1;const hm=()=>({chat_provider:"tawk",chat_segments:Gc()?"logged-in":"guest",chat_session_id:vc()?"tawk":"unknown",page_path:window.location.pathname}),pm=()=>{const e=y(),{user:t}=Md(),r=fh(e=>e.items),n=fh(e=>e.subtotal),s=p.useRef(0),a=p.useRef(!1);return p.useEffect(()=>{if("undefined"==typeof window)return;window.Tawk_API=window.Tawk_API||{};const e=window.Tawk_API;e.onLoad=()=>{Nc(),Yc(["1adisplay"]),dm(window.location.pathname)&&ed(),Fc(),ic("chat_open",{...hm(),chat_state:"loaded"})},e.onChatMaximized=()=>ic("chat_open",{...hm(),chat_state:"opened"}),e.onChatMinimized=()=>ic("chat_close",{...hm(),visitor_message_count:s.current,chat_engaged:s.current>0}),e.onChatMessageVisitor=()=>{s.current+=1,a.current||(a.current=!0,ic("chat_conversation_start",{...hm(),message_type:"text"}),async function(e,t=100){if(!e)return null;await kc();try{const{data:r,error:n}=await la.functions.invoke("track-attribution",{body:{action:"conversion",visitorId:vc(),eventType:"chat_started",externalId:e,value:t,currency:"USD"}});return n||(null==r?void 0:r.error)?null:(null==r?void 0:r.conversionId)??null}catch{return null}}(`tawk-${Date.now()}`)),ic("chat_message",{...hm(),message_direction:"visitor",message_type:"text",visitor_message_count:s.current})},e.onChatMessageAgent=()=>ic("chat_message",{...hm(),message_direction:"agent",message_type:"text",visitor_message_count:s.current}),function(){if(um||"undefined"==typeof window)return;um=!0;const e=window.location.hostname,t="localhost"===e||"127.0.0.1"===e,r=/bot|crawl|spider|slurp|bingpreview|lighthouse|headless/i.test(navigator.userAgent);if(t||r)return;if(document.querySelector(`script[src="${jc}"]`))return;window.Tawk_API=window.Tawk_API||{},window.Tawk_LoadStart=new Date,window.Tawk_API.customStyle={zIndex:9999};const n=document.createElement("script"),s=document.getElementsByTagName("script")[0];n.async=!0,n.src=jc,n.charset="UTF-8",n.setAttribute("crossorigin","*"),(null==s?void 0:s.parentNode)?s.parentNode.insertBefore(n,s):document.head.appendChild(n)}()},[]),p.useEffect(()=>{if(Hc(!!t),t){const e=t.user_metadata??{}
21,r=e.full_name||[e.first_name,e.last_name].filter(Boolean).join(" ")||void 0;td({id:e.shopify_customer_id||t.id,name:r,email:t.email??void 0})}else rd()},[t]),p.useEffect(()=>{var e,t;const s=r.reduce((e,t)=>e+t.quantity,0);Wc({items:s,value:s>0?n():0,currency:(null==(t=null==(e=r[0])?void 0:e.price)?void 0:t.currencyCode)||"USD"})},[r,n]),p.useEffect(()=>{dm(e.pathname)?ed():Zc(),Fc()},[e.pathname]),null};const fm=p.lazy(()=>Da(()=>import("./Index-DAKNIKv_.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]))),mm=p.lazy(()=>Da(()=>import("./ShopifyProductDetail-SbOUpXGi.js"),__vite__mapDeps([26,1,2,27,3,4,28,25,12,29,30,31,32,19,9,33,23,34,35,36,16,37,22,24,38,18,39,40,13,14,15,41,10,42,43,21,44,45,46,47,11]))),gm=p.lazy(()=>Da(()=>import("./ProductsPage-CSKUv3gD.js"),__vite__mapDeps([48,1,2,49,25,32,30,18,13,14,15,16,9,11,17,31,46,47,50,51]))),ym=p.lazy(()=>Da(()=>import("./ClearancePage-D5_lA7g5.js"),__vite__mapDeps([52,1,2,49,25,32,30,18,13,14,15,9,11,53,51]))),vm=p.lazy(()=>Da(()=>import("./CategoryPage-DQ6dPJnl.js"),__vite__mapDeps([54,1,2,22,9,23,24,12,36,55,25,32,56,18,27,13,14,15,16,11,57,51]))),wm=p.lazy(()=>Da(()=>import("./BlogRedirect-vsob5tRm.js"),__vite__mapDeps([58,2]))),bm=p.lazy(()=>Da(()=>import("./PageRedirect-Br2_Xmpt.js"),__vite__mapDeps([59,2]))),xm=p.lazy(()=>Da(()=>import("./AboutPage-BBHLe1QA.js"),__vite__mapDeps([60,1,2,18,47,61,8,25]))),_m=p.lazy(()=>Da(()=>import("./ContactPage-B-jTzxWS.js"),__vite__mapDeps([62,1,2,43,44,18,42,25,63]))),km=p.lazy(()=>Da(()=>import("./FAQPage-Dm0KXewp.js"),__vite__mapDeps([64,1,2,18,56,25]))),jm=p.lazy(()=>Da(()=>import("./ShippingPage-BsEH2-JR.js"),__vite__mapDeps([65,1,2,66,18,3,4,67,25]))),Tm=p.lazy(()=>Da(()=>import("./ReturnsPage-DNUtzBwo.js"),__vite__mapDeps([68,1,2,66,18,3,4,67,25]))),Sm=p.lazy(()=>Da(()=>import("./PrivacyPage-DiYLWbLP.js"),__vite__mapDeps([69,1,2,66,18,3,4,67,25]))),Em=p.lazy(()=>Da(()=>import("./TermsPage-D5qsPBpv.js"),__vite__mapDeps([70,1,2,66,18,3,4,67,25]))),Nm=p.lazy(()=>Da(()=>import("./Auth-CDpum3PO.js"),__vite__mapDeps([71,1,2,42,25,72,73,18,6,47,43]))),Cm=p.lazy(()=>Da(()=>import("./ResetPassword-BL2uGidw.js"),__vite__mapDeps([74,1,2,42,25,72,18,6,47,43]))),Am=p.lazy(()=>Da(()=>import("./AdminDashboard-iPsdHPMY.js"),__vite__mapDeps([75,1,2,72,9,49,25,32,30,33,23,12,73,28,41,67,63,76,42,46,77,39,78,53,31,79,80,3,4,11,81,51,37,6,7,82,19,17,14,57,56,34,10,47,61,20,83,40,24,50]))),Rm=p.lazy(()=>Da(()=>import("./BlogPage-DofvzTkm.js"),__vite__mapDeps([84,1,2,85,9,72,23,41,18,86,79,38,25]))),Im=p.lazy(()=>Da(()=>import("./BlogPostPage-CSYd5Nis.js"),__vite__mapDeps([87,1,2,18,85,9,72,23,41,36,35,80,3,4,11,25,34,8,47,24,30,51,21,38,6]))),Om=p.lazy(()=>Da(()=>import("./BlogCategoryPage-D1s9gTGS.js"),__vite__mapDeps([88,1,2,18,85,9,72,23,41,86,79,38,25,6]))),Pm=p.lazy(()=>Da(()=>import("./OrderHistoryPage-CZsFbuKK.js"),__vite__mapDeps([89,1,2,18,72,73,25,9,42,28,78,77,43,19,37]))),$m=p.lazy(()=>Da(()=>import("./NotFound-BkYbugnV.js"),__vite__mapDeps([90,1,2,18,6,25]))),Dm=p.lazy(()=>Da(()=>import("./DesignerPage-BsyAm4w6.js").then(e=>e.D),__vite__mapDeps([91,1,2,73,25,56,28,55,32,42,67,77,81,20,14,92,19,30,39,40,29,37,82,93]))),Lm=p.lazy(()=>Da(()=>import("./DesignTemplateEditorPage-DkNH-psx.js"),__vite__mapDeps([94,1,2,42,25,76,32,72,28,49,30,9,46,77,39,67,73,92,55,6,82,19]))),Um=p.lazy(()=>Da(()=>import("./ShopifyAdminOAuthStart-Dvjj6Q6H.js"),__vite__mapDeps([95,1,2,72,83,15,25]))),Mm=new c({defaultOptions:{queries:{retry:(e,t)=>t instanceof Error&&(t.message.includes("aborted")||t.message.includes("timed out"))?e<1:e<2,retryDelay:e=>Math.min(1e3*2**e,1e4)}}});function qm(){return function(){const e=fh(e=>e.syncCart);p.useEffect(()=>{e();const t=()=>{"visible"===document.visibilityState&&e()};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[e])}(),p.useEffect(()=>{oc("granted"===uc()),kc()},[]),a.jsxs(a.Fragment,{children:[a.jsx(gh,{}),a.jsx("div",{className:"fixed top-0 left-0 right-0 z-[60]",children:a.jsx(Sh,{})}),a.jsx(nm,{}),a.jsx(p.Suspense,{fallback:a.jsx(bh,{}),children:a.jsxs(b,{children:[a.jsx(x,{path:"/",element:a.jsx(fm,{})}),a.jsx(x,{path:"/products",element:a.jsx(gm,{})}),a.jsx(x,{path:"/clearance",element:a.jsx(ym,{})}),a.jsx(x,{path:"/:slug",element:a.jsx(vm,{})}),a.jsx(x,{path:"/pages/:page",element:a.jsx(bm,{})}),a.jsx(x,{path:"/blogs/:blog/:slug",element:a.jsx(wm,{})}),a.jsx(x,{path:"/blogs/:blog",element:a.jsx(wm,{})}),a.jsx(x,{path:"/about",element:a.jsx(xm,{})}),a.jsx(x,{path:"/contact",element:a.jsx(_m,{})}),a.jsx(x,{path:"/faq",element:a.jsx(km,{})}),a.jsx(x,{path:"/shipping",element:a.jsx(jm,{})}),a.jsx(x,{path:"/returns",element:a.jsx(Tm,{})}),a.jsx(x,{path:"/privacy",element:a.jsx(Sm,{})}),a.jsx(x,{path:"/terms",element:a.jsx(Em,{})}),a.jsx(x,{path:"/blog",element:a.jsx(Rm,{})}),a.jsx(x,{path:"/blog/category/:slug",element:a.jsx(Om,{})}),a.jsx(x,{path:"/blog/:slug",element:a.jsx(Im,{})}),a.jsx(x,{path:"/auth",element:a.jsx(Nm,{})}),a.jsx(x,{path:"/reset-password",element:a.jsx(Cm,{})}),a.jsx(x,{path:"/order-history",element:a.jsx(Pm,{})}),a.jsx(x,{path:"/admin/shopify-oauth-start",element:a.jsx(Um,{})}),a.jsx(x,{path:"/admin",element:a.jsx(Am,{})}
21),a.jsx(x,{path:"/admin/design-templates/:handle",element:a.jsx(Lm,{})}),a.jsx(x,{path:"/design/:templateId",element:a.jsx(Dm,{})}),a.jsx(x,{path:"/:category/:handle",element:a.jsx(mm,{})}),a.jsx(x,{path:"*",element:a.jsx($m,{})})]})}),a.jsx(am,{}),a.jsx(om,{}),a.jsx(im,{}),a.jsx(lm,{}),a.jsx(pm,{})]})}const zm=()=>a.jsx(d,{client:Mm,children:a.jsx(Zl,{children:a.jsx(Ud,{children:a.jsxs(Bd,{children:[a.jsx(Nl,{}),a.jsx(Ql,{}),a.jsxs(w,{children:[a.jsx(mh,{}),a.jsx(qm,{})]})]})})})});(async function(){const e=localStorage.getItem(lt),t="1"===localStorage.getItem(dt);if(sessionStorage.getItem(ct))return sessionStorage.removeItem(ct),localStorage.setItem(lt,it),localStorage.setItem(dt,"1"),!1;const{cacheKeys:r,registrations:n}=await async function(){return{cacheKeys:"caches"in window?await caches.keys():[],registrations:"serviceWorker"in navigator?await navigator.serviceWorker.getRegistrations():[]}}(),s=r.length>0||n.length>0;if(Boolean(e&&e!==it)||!e&&!t&&s){try{await Promise.all(r.map(e=>caches.delete(e))),await Promise.all(n.map(e=>e.unregister()))}catch(a){}return localStorage.setItem(lt,it),localStorage.setItem(dt,"1"),sessionStorage.setItem(ct,"1"),window.location.reload(),!0}return localStorage.setItem(lt,it),t||s||localStorage.setItem(dt,"1"),!1})().then(e=>{if(e)return;"serviceWorker"in navigator&&(navigator.serviceWorker.getRegistrations().then(e=>{for(const t of e)t.waiting&&t.waiting.postMessage({type:"SKIP_WAITING"}),t.update().catch(()=>{}),t.addEventListener("updatefound",()=>{const e=t.installing;e&&e.addEventListener("statechange",()=>{"installed"===e.state&&navigator.serviceWorker.controller&&e.postMessage({type:"SKIP_WAITING"})})})}).catch(()=>{}),setInterval(()=>{navigator.serviceWorker.getRegistrations().then(e=>{for(const t of e)t.update().catch(()=>{})}).catch(()=>{})},6e4));Promise.race([Na(),new Promise(e=>setTimeout(e,2500))]).finally(()=>{const e=document.getElementById("root");e&&r(e).render(a.jsx(Ze,{children:a.jsx(zm,{})}))})});export{Aa as $,Bo as A,Vd as B,Ho as C,fi as D,la as E,Md as F,bi as G,ot as H,Nh as I,Ku as J,Va as K,ri as L,vc as M,ic as N,Yc as O,hi as P,wh as Q,Ca as R,yi as S,ji as T,Ia as U,lc as V,Vc as W,Si as X,md as Y,Pa as Z,Da as _,bl as a,Ju as a$,ja as a0,ei as a1,xi as a2,ba as a3,gi as a4,Zo as a5,xd as a6,Td as a7,Kc as a8,ka as a9,_i as aA,ui as aB,Mu as aC,xh as aD,_h as aE,kh as aF,jh as aG,ii as aH,Qo as aI,Ei as aJ,lh as aK,ch as aL,dh as aM,xa as aN,Na as aO,Ta as aP,Lo as aQ,ki as aR,si as aS,Wd as aT,Yo as aU,Ed as aV,Od as aW,Ld as aX,pa as aY,Ko as aZ,Ka as a_,Xf as aa,Qf as ab,Zf as ac,em as ad,Kd as ae,Hd as af,Xd as ag,Qd as ah,Zd as ai,Oa as aj,mi as ak,Jo as al,ma as am,ya as an,Qc as ao,ci as ap,oi as aq,pi as ar,ai as as,va as at,wa as au,Id as av,ni as aw,Ti as ax,Vu as ay,di as az,jd as b,ah as b0,oh as b1,ih as b2,tu as b3,ru as b4,Fh as b5,Qh as b6,Zh as b7,qd as b8,zo as c,Nd as d,vi as e,wd as f,Sd as g,Oh as h,Fl as i,Vo as j,_d as k,ha as l,vh as m,fa as n,Wo as o,Jc as p,wi as q,Fo as r,yh as s,Zl as t,fh as u,ec as v,tc as w,rc as x,bd as y,kd as z};
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.