efficient-web-builder 0.0.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4 @@
1
+ Bundled license information:
2
+
3
+ dompurify/dist/purify.cjs.js:
4
+ /*! @license DOMPurify 3.4.11 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.11/LICENSE */
@@ -0,0 +1 @@
1
+ var $e=Symbol.for("efficient-web.efficient-backend");function Ue(e){return!!e&&e[$e]===!0}function X(e){return e?.trim()||null}function Me(e={}){let t=e.backend??null,n=new Map,r={token:null,brandId:null},s={documentId:null,bridgedId:null};return{hostBackend:t,usesBridgedToken:t===null||Ue(t),blocks:e.blocks??null,auth:r,site:s,siteId:()=>s.documentId??s.bridgedId,cache(i,u){return n.has(i)||n.set(i,u()),n.get(i)},forget(i){i===void 0?n.clear():n.delete(i)}}}function He(e,t){e.site.documentId=X(t)}function De(e,t){e.site.bridgedId=X(t)}var We=Me(),O=null,q=new Set;function _(){return O??We}function Ut(e){q.delete(e),O=e}function Mt(e){q.add(e),queueMicrotask(()=>{q.delete(e)&&O===e&&(O=null)})}function ee(){return _().usesBridgedToken}var N="x-forwarded-for";function te(e){let t=(e??"").split(",").map(n=>n.trim()).filter(Boolean);return t.length>0?t[t.length-1]:null}var Je="x-forwarded-host";function ne(e,t,n){let r={};return e&&(r[Je]=e),t&&n==="uncached"&&(r[N]=t),r}function re(e){if(e?.cache==="no-store"||e?.cache==="no-cache")return"uncached";if(e?.cache==="force-cache")return"data-cached";let t=e?.next?.revalidate;return typeof t=="number"&&t>0?"data-cached":"uncached"}var Ge={siteSlug:null,shopOrigin:""},$=Ge;function Wt(e){$={siteSlug:e.siteSlug?.trim()||null,shopOrigin:(e.shopOrigin??"").trim().replace(/\/+$/,"")}}function U(){return $.siteSlug}function se(){return $.shopOrigin}var ie="x-storefront-site",oe="x-storefront-host";var ae={contentHash:"db2b679aad5380c6",schema:1,mediaFields:{ImageBlock:["src"],LogoBlock:["src"],Flex:["bgImage"],FeaturedCover:["image"],LongRead:["image"],Banner:["imageSrc"],Timeline:["imageSrc"],Logos:["items[].src"],ContactLocations:["locations[].photo"],HeroSingle:["imageFocal","mediaImage","mediaVideo","poster"],HeroSlide:["mediaImage","mediaVideo","poster"],PostCard:["image"],Gallery:["othersCards[].image","othersCards[].photos[].src","vehicleCards[].image","vehicleCards[].photos[].src","wheelCards[].image","wheelCards[].photos[].src"],GalleryItem:["image","photos[].src"],Manifesto:["imageSrc"],SectionHeader:["logoSrc"],IntroBleed:["imageSrc","imageSrcMobile"],Split:["imageSrc","textBgSrc"],ProcessSteps:["steps[].image"],DetailRows:["rows[].image"],PaymentBadges:["badges[].src"]},mediaKeyNames:["bgImage","image","imageFocal","imageSrc","imageSrcMobile","logoSrc","mediaImage","mediaVideo","photo","poster","src","textBgSrc"],snapshotObjects:{ProductGrid:{source:{keep:["slug"]}},GalleryItem:{product:{keep:["code","finish"]}},FeaturedCover:{source:{keep:["slug"]}},LongRead:{source:{keep:["slug"]}}},hydratedLists:{Events:["posts"],SubscribeBlogs:["posts"]},technicalStateKeys:["imageFocal"]};function M(e){return{getItem(t){try{return e()?.getItem(t)??null}catch{return null}},setItem(t,n){try{e()?.setItem(t,n)}catch{}},removeItem(t){try{e()?.removeItem(t)}catch{}}}}var A="__storefront_probe__";function Kt(e){try{e.setItem(A,A);let t=e.getItem(A)===A;return e.removeItem(A),t}catch{return!1}}var v=M(()=>typeof window>"u"?null:window.localStorage),zt=M(()=>typeof window>"u"?null:window.sessionStorage);function jt(e){return M(()=>e.defaultView?.localStorage??null)}var Ke="shop_access_token",le="shop_refresh_token",H=null;function D(){v.removeItem(Ke),v.removeItem(le)}var b={getAccess(){return H},takeLegacyRefresh(){let e=v.getItem(le);return D(),e},setTokens(e){H=e,D()},clear(){H=null,D()}};function ze(e){return!!e.src}function R(e){let t=e.finishes.filter(ze);if(t.length===e.finishes.length)return e;let n=e.defaultFinish&&t.some(r=>r.name===e.defaultFinish)?e.defaultFinish:null;return{...e,finishes:t,defaultFinish:n}}function je(e){return e.listable!==!1}function W(e){return e.map(R).filter(je)}var I="https://cdn.inovit.com"?.replace(/\/+$/,"");function J(e,t){let n=_().hostBackend?.media.resolve;if(!(!n||n===Qe))return n(e,t)??e}function Ze(e){return/^(?:https?:)?\/\//i.test(e)||/^(?:data|blob):/i.test(e)}function G(e){return J(e)??ce(e)}function ce(e){return!I||Ze(e)?e:I+e.replace(/^\/media/,"")}var Qe=e=>ce(e),Ye="";function E(e){if(!e)return null;let t=J(e);return t!==void 0?t:e.startsWith("/")?`${Ye}${e}`:e}function rn(e){return/^https?:\/\//i.test(e)&&!(I&&e.startsWith(I+"/"))}function sn(e){if(!e)return;let t=J(e);return t!==void 0?t:e.startsWith("/media/")?G(e):e}function on(e){let t=e.split("?")[0],n=t.substring(t.lastIndexOf("/")+1);try{return decodeURIComponent(n.replace(/^[0-9a-f]{32}_/i,""))||n}catch{return n}}var Xe="/videos/products/";function an(e){return!!e&&e.includes(Xe)}var pe=["fill","stroke","stop-color","color","flood-color","lighting-color","solid-color"],ge=new Set(["none","transparent","currentcolor","inherit","initial","unset","context-fill","context-stroke"]),F={black:[0,0,0],white:[255,255,255],gray:[128,128,128],grey:[128,128,128],darkgray:[169,169,169],darkgrey:[169,169,169],dimgray:[105,105,105],dimgrey:[105,105,105],lightgray:[211,211,211],lightgrey:[211,211,211],gainsboro:[220,220,220],silver:[192,192,192],whitesmoke:[245,245,245]},he=12,ye=/\burl\(/i,fe=new RegExp(`(?<![-\\w])(${pe.join("|")})(\\s*=\\s*)(["'])([^"']*)\\3`,"gi"),Se=new RegExp(`((?:^|[;{\\s"'])(?:${pe.join("|")})\\s*:\\s*)([^;}"'<>]+)`,"gi"),et=/<svg\b([^>]*)>/i,tt=/\bfill\s*[=:]/i;function nt(e){let t=e.replace(fe,(n,r,s,i,u)=>{let m=ue(u);return m===null?n:`${r}${s}${i}${m}${i}`}).replace(Se,(n,r,s)=>{let i=ue(s);return i===null?n:`${r}${i}`});return t=t.replace(et,(n,r)=>tt.test(r)?n:`<svg fill="#ffffff"${r}>`),t}function ue(e){let t=/!important/i.test(e),r=e.replace(/!important/gi,"").trim().toLowerCase();if(!r||ye.test(r)||ge.has(r))return null;let s=r in F?[...F[r],1]:Pe(r);if(!s)return null;let[i,u,m,d]=s;if(Math.max(i,u,m)-Math.min(i,u,m)>he)return null;let y=rt(255-i,255-u,255-m,d);return t?`${y} !important`:y}function rt(e,t,n,r){if(r<1)return`rgba(${e}, ${t}, ${n}, ${r})`;let s=i=>i.toString(16).padStart(2,"0");return`#${s(e)}${s(t)}${s(n)}`}function Pe(e){return e.startsWith("#")?st(e):e.startsWith("rgb")?it(e):e.startsWith("hsl")?at(e):null}function st(e){let t=e.slice(1),n=1;if(t.length===3||t.length===4)t.length===4&&(n=parseInt(t[3]+t[3],16)/255),t=t.slice(0,3).split("").map(r=>r+r).join("");else if(t.length===6||t.length===8)t.length===8&&(n=parseInt(t.slice(6,8),16)/255),t=t.slice(0,6);else return null;return/^[0-9a-f]{6}$/.test(t)?[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16),n]:null}function it(e){let t=e.slice(e.indexOf("(")+1,e.lastIndexOf(")")),[n,r]=t.split("/"),s=n.split(/[\s,]+/).filter(Boolean).slice(0,3);if(s.length<3)return null;let i=s.map(m=>m.endsWith("%")?Math.round(parseFloat(m)/100*255):Math.round(parseFloat(m)));if(i.some(m=>Number.isNaN(m)))return null;let u=r?B(r):ot(n);return[i[0],i[1],i[2],u]}function ot(e){let t=e.split(/[\s,]+/).filter(Boolean);return t.length>=4?B(t[3]):1}function B(e){let t=e.trim().endsWith("%")?parseFloat(e)/100:parseFloat(e);return Number.isNaN(t)?1:t}function at(e){let t=e.slice(e.indexOf("(")+1,e.lastIndexOf(")")),[n,r]=t.split("/"),s=n.split(/[\s,]+/).filter(Boolean);if(s.length<3)return null;let i=parseFloat(s[0]),u=parseFloat(s[1])/100,m=parseFloat(s[2])/100;if([i,u,m].some(Ne=>Number.isNaN(Ne)))return null;let d=r?B(r):s.length>=4?B(s[3]):1,[y,S,P]=lt(i,u,m);return[y,S,P,d]}function lt(e,t,n){let r=(1-Math.abs(2*n-1))*t,s=(e%360+360)%360/60,i=r*(1-Math.abs(s%2-1)),u=0,m=0,d=0;s<1?[u,m,d]=[r,i,0]:s<2?[u,m,d]=[i,r,0]:s<3?[u,m,d]=[0,r,i]:s<4?[u,m,d]=[0,i,r]:s<5?[u,m,d]=[i,0,r]:[u,m,d]=[r,0,i];let y=n-r/2;return[Math.round((u+y)*255),Math.round((m+y)*255),Math.round((d+y)*255)]}var me=512*1024;function V(e){return/\.svg(\?|$)/i.test(e)}function ct(e){return`data:image/svg+xml,${encodeURIComponent(nt(e))}`}function ut(e){let t=e.replace(/!important/gi,"").trim().toLowerCase();if(!t||ye.test(t)||ge.has(t))return null;let n=t in F?[...F[t],1]:Pe(t);if(!n)return null;let[r,s,i]=n;return Math.max(r,s,i)-Math.min(r,s,i)>he?null:(.2126*r+.7152*s+.0722*i)/255}function mt(e){let t=[],n=r=>{let s=ut(r);s!==null&&t.push(s)};for(let r of e.matchAll(fe))n(r[4]);for(let r of e.matchAll(Se))n(r[2]);return t.length?t.reduce((r,s)=>r+s,0)/t.length<.5:null}var de=/^(?:\uFEFF|\s+|<\?xml[^>]*\?>|<!--[\s\S]*?-->|<!DOCTYPE\s+svg[^>[]*>)/i;function dt(e){let t=e;for(let n=de.exec(t);n&&n[0].length>0;n=de.exec(t))t=t.slice(n[0].length);return/^<svg[\s>/]/i.test(t)}async function pt(e,t){if(!V(e))return null;try{let n=await fetch(e,{signal:t,redirect:"manual"});if(!n.ok)return null;let r=Number(n.headers.get("content-length"));if(Number.isFinite(r)&&r>me)return null;let s=await n.text();return s.length>me?null:dt(s)?s:null}catch{return null}}async function be(e,t){let n=await pt(e,t);return n===null?null:{reversed:ct(n),inkIsDark:mt(n)}}function we(){return _().siteId()}var gt="",f=class extends Error{constructor(t,n,r){super(n),this.status=t,this.data=r}},z="Unable to reach the server. This could be a problem with your internet connection, or the server may be undergoing maintenance or an upgrade. Please try again shortly.",ht=new Set([502,503,504]),K=0,yt="This editor runs on its host's own backend, which does not serve this request.",ft=5e3,St=15e3,Pt=()=>typeof window>"u"?ft:St;function ve(e){let t=(e.method??"GET").toUpperCase();if(!(e.body!=null||t!=="GET"&&t!=="HEAD")&&e.audience!=="admin"&&typeof AbortSignal?.timeout=="function")return AbortSignal.timeout(Pt())}var _e=e=>e instanceof Error&&e.name==="TimeoutError",Ae=(e,t)=>ht.has(e)?z:t;function bt(e){if(typeof window>"u"||!e.startsWith("/api/v1/"))return e;let t=U();return!t||/[?&]site=/.test(e)?e:j(e,`site=${encodeURIComponent(t)}`)}async function o(e,t={}){let{token:n,baseUrl:r,headers:s,audience:i,...u}=t;if(typeof window<"u"&&!ee())throw new f(K,yt,null);if(typeof window>"u"&&r===void 0)throw new Error(`apiFetch(${JSON.stringify(e)}) ran on the server without an explicit baseUrl. The API_URL default it would inherit is browser-only (the prod image bakes NEXT_PUBLIC_API_URL="" for same-origin use, which a Node fetch cannot resolve). Pass a base explicitly: \`await backendOpts()\` (or baseUrl: PRODUCT_FETCH_BASE) for product reads, or the server-only PRODUCT_BACKEND_URL env for other backend surfaces.`);let m=typeof FormData<"u"&&u.body instanceof FormData,d;try{d=await fetch(`${r??gt}${bt(e)}`,{...u,headers:{...m?{}:{"Content-Type":"application/json"},...n?{Authorization:`Bearer ${n}`}:{},"X-Portal-Audience":i??"shop",...s},signal:u.signal??ve({...u,audience:i})})}catch(P){throw P instanceof TypeError||_e(P)?new f(K,z,null):P}let y;try{y=await d.text()}catch(P){throw _e(P)?new f(K,z,null):P}let S=null;if(y)try{S=JSON.parse(y)}catch{throw new f(d.status,d.ok?"Expected JSON but received a non-JSON response":Ae(d.status,d.statusText),y)}if(!d.ok){let P=(S&&typeof S=="object"&&"detail"in S&&typeof S.detail=="string"?S.detail:null)??Ae(d.status,d.statusText);throw new f(d.status,P,S)}return S}var x=null;async function Ie(){return x||(x=wt().finally(()=>{x=null}),x)}async function wt(){let e=b.takeLegacyRefresh(),t=await _t.refresh(e??void 0);return b.setTokens(t.access),t.access}async function Ee(){return b.getAccess()??Ie()}async function p(e,t={}){let n;try{n=await Ee()}catch{throw b.clear(),new f(401,"Not signed in",null)}try{return await o(e,{...t,token:n})}catch(r){if(!(r instanceof f)||r.status!==401)throw r;try{let s=await Ie();return await o(e,{...t,token:s})}catch{throw b.clear(),r}}}async function Re(){let e=await p("/api/auth/me/");if(e.portal!=="shop")throw b.clear(),new f(403,"This session is not valid for this shop.",null);return e}var _t={login:(e,t)=>o("/api/auth/login/",{method:"POST",body:JSON.stringify({email:e,password:t,portal:"shop"}),credentials:"include"}),refresh:e=>o("/api/auth/refresh/",{method:"POST",body:JSON.stringify(e?{refresh:e,portal:"shop"}:{portal:"shop"}),credentials:"include"}),logout:async()=>{b.clear();try{await o("/api/auth/logout/",{method:"POST",body:JSON.stringify({portal:"shop"}),credentials:"include"})}catch{}},restoreSession:async()=>{let e=await Ee();return await Re(),e},me:Re,updateMe:e=>p("/api/auth/me/",{method:"PATCH",body:JSON.stringify(e)}),changePassword:(e,t)=>p("/api/auth/me/",{method:"PATCH",body:JSON.stringify({password:t,old_password:e})}),changeEmail:(e,t)=>p("/api/shop-portal/change-email/",{method:"POST",body:JSON.stringify({new_email:e,current_password:t})}),myProfile:()=>p("/api/shop-portal/profile/"),updateMyProfile:e=>p("/api/shop-portal/profile/",{method:"PATCH",body:JSON.stringify(e)}),myAddresses:()=>p("/api/shop-portal/delivery-locations/"),createAddress:e=>p("/api/shop-portal/delivery-locations/",{method:"POST",body:JSON.stringify(e)}),updateAddress:(e,t)=>p(`/api/shop-portal/delivery-locations/${e}/`,{method:"PATCH",body:JSON.stringify(t)}),deleteAddress:e=>p(`/api/shop-portal/delivery-locations/${e}/`,{method:"DELETE"}),passwordResetRequest:e=>o("/api/auth/password-reset/",{method:"POST",body:JSON.stringify({email:e})}),passwordResetConfirm:(e,t,n)=>o("/api/auth/password-reset/confirm/",{method:"POST",body:JSON.stringify({uid:e,token:t,new_password:n})}),brands:()=>p("/api/products/brands/"),myOrders:()=>p("/api/shop-portal/orders/").then(e=>e.results),myOrder:e=>p(`/api/shop-portal/orders/${e}/`),cancelOrder:e=>p(`/api/shop-portal/orders/${e}/cancel/`,{method:"POST"}),myReturns:e=>p(`/api/shop-portal/returns/${e?`?order=${encodeURIComponent(e)}`:""}`).then(t=>t.results),createReturn:e=>p("/api/shop-portal/returns/",{method:"POST",body:JSON.stringify(e)}),withdrawReturn:e=>p(`/api/shop-portal/returns/${e}/cancel/`,{method:"POST"}),uploadReturnPhoto:(e,t)=>{let n=new FormData;return n.append("claim_item",e),n.append("file",t),n.append("media_type",t.type.startsWith("video/")?"video":"image"),p("/api/shop-portal/return-media/",{method:"POST",body:n})}};function h(e){if(typeof e=="string")return e.startsWith("/media/")?G(e):e;if(Array.isArray(e))return e.map(h);if(e&&typeof e=="object"){let t={};for(let[n,r]of Object.entries(e))t[n]=n==="captions"&&r&&typeof r=="object"&&!Array.isArray(r)?Object.fromEntries(Object.entries(r).map(([s,i])=>[h(s),i])):h(r);return t}return e}var At="",Fe="".replace(/\/+$/,""),Be=typeof window>"u"&&Fe!=="",Rt=Be?Fe:At,w=se;function l(e,t){let n=t?`?process=${encodeURIComponent(t)}`:"";return`/api/v1${e}${n}`}var xt=100,xe=50;function Le(e,t,n){let r=new URLSearchParams;for(let[s,i]of Object.entries(t))i!=null&&i!==""&&r.set(s,String(i));return r.set("pageSize",String(xt)),n&&r.set("cursor",n),`/api/v1${e}?${r.toString()}`}function kt(e,t){return Le("/wheels",{process:e},t)}function Tt(e,t,n){return Le("/products",{kind:e.join(","),make:t?.make,model:t?.model,year:t?.year,modification:t?.modification},n)}function Ct(e){if(!e)return null;try{return new URL(e,"http://cursor.invalid").searchParams.get("cursor")}catch{return null}}async function ke(e,t,n=()=>!1){let r=[],s=null;try{for(let i=0;i<xe;i++){let u=await o(await t(s),await a());if(r.push(...u.results),s=Ct(u.next),!s)break}s&&console.warn(`[${e}] stopped at ${xe} pages (${r.length} rows); catalog may be truncated`)}catch(i){if(n(i))throw i;console.warn(`[${e}] product API unavailable, returning []`,i)}return r}var Ot=e=>e instanceof f&&e.status===400;function vt(e){return e.flatMap(t=>t.kind==="alloy-wheel"?W([t]):[t])}async function qe(){return(await It()).host}async function It(){try{let{headers:e}=await import("./headers-3CAQXQEY.js"),t=await e(),n=i=>i?.split(",")[0]?.split(":")[0]?.trim().toLowerCase()||null,r=n(t.get(oe)??t.get("x-forwarded-host")??t.get("host")),s=n(t.get("host"));return{host:r,matchesRequestHost:r!==null&&r===s}}catch{return{host:null,matchesRequestHost:!1}}}async function Et(){try{let{headers:e}=await import("./headers-3CAQXQEY.js");return te((await e()).get(N))}catch{return null}}async function Ft(){try{let{headers:e}=await import("./headers-3CAQXQEY.js");return(await e()).get(ie)||null}catch{return null}}async function Bt(){let e=await Ft();if(e)return`site=${encodeURIComponent(e)}`;let t=await qe();return t?`host=${encodeURIComponent(t)}`:""}async function g(e){if(typeof window<"u"){let t=U();return t?j(e,`site=${encodeURIComponent(t)}`):e}return j(e,await Bt())}function j(e,t){return t?`${e}${e.includes("?")?"&":"?"}${t}`:e}async function Lt(e){if(!Be)return;let[t,n]=await Promise.all([qe(),Et()]),r=ne(t,n,e);return Object.keys(r).length>0?r:void 0}async function a(e){let t=await Lt(re(e)),n={baseUrl:Rt,...e};return t&&(n.headers={...t,...e?.headers}),n}var k=typeof window>"u";function T(e,t){let n=new URLSearchParams;for(let[s,i]of Object.entries(t))i!==void 0&&i!==""&&n.set(s,String(i));let r=n.toString();return`/api/v1/fitment${e}${r?`?${r}`:""}`}var An={listMakes:async e=>{if(k){let{fitmentData:n}=await import("./fitment-data-ZLYB5QPR.js");return n.makes(e)}return(await o(T("/makes",{region:e}),{baseUrl:w()})).results},listModels:async(e,t)=>{if(k){let{fitmentData:r}=await import("./fitment-data-ZLYB5QPR.js");return r.models(e,t)}return(await o(T("/models",{make:e,region:t}),{baseUrl:w()})).results},listYears:async(e,t,n)=>{if(k){let{fitmentData:s}=await import("./fitment-data-ZLYB5QPR.js");return s.years(e,t,n)}return(await o(T("/years",{make:e,model:t,region:n}),{baseUrl:w()})).results},listModifications:async(e,t,n,r)=>{if(k){let{fitmentData:i}=await import("./fitment-data-ZLYB5QPR.js");return i.modifications(e,t,n,r)}return(await o(T("/modifications",{make:e,model:t,year:n,region:r}),{baseUrl:w()})).results},getStockFitment:async(e,t,n,r,s)=>{if(k){let{fitmentData:i}=await import("./fitment-data-ZLYB5QPR.js");return i.stockFitment(e,t,n,r,s)}return o(T("/stock-fitment",{make:e,model:t,year:n,modification:r,region:s}),{baseUrl:w()})}},Rn={listWheels:async e=>{let t=await ke("products.listWheels",async n=>await g(kt(e,n)));return W(h(t))},listCatalog:async(e,t)=>{if(e.length===0)throw new Error("products.listCatalog() needs at least one kind. An empty list would omit `kind`, which the contract reads as `alloy-wheel` \u2014 so the call would silently return the wheel catalog instead of nothing.");let n=await ke("products.listCatalog",async r=>await g(Tt(e,t,r)),Ot);return vt(h(n))},getWheel:async e=>R(h(await o(await g(l(`/wheels/${e}`)),await a()))),getTyre:async e=>h(await o(await g(l(`/tyres/${e}`)),await a())),listBundles:async()=>{try{return await o(await g(l("/bundles")),await a())}catch{return[]}},getBundle:async e=>o(await g(l(`/bundles/${e}`)),await a()),listGalleryBuilds:async(e={})=>{let{process:t=null,wheelSlug:n=null}=e;if(typeof window>"u"){let{listGalleryBuilds:r}=await import("./gallery-builds-data-SWA6XKFF.js");return h(r(t,n))}try{let r=new URLSearchParams;t&&r.set("process",t),n&&r.set("wheelSlug",n);let s=r.toString(),i=await o(`/api/v1/gallery-builds${s?`?${s}`:""}`,{baseUrl:w()});return h(i.results)}catch(r){return console.warn("[products.listGalleryBuilds] product API unavailable, returning []",r),[]}},getSite:async()=>o(await g(l("/site")),await a()),getSiteBySlug:async e=>o(`${l("/site")}?${new URLSearchParams({site:e})}`,typeof window>"u"?await a():void 0),listBrands:async()=>{try{return(await o(await g(l("/brands")),await a())).results??[]}catch(e){return console.warn("[products.listBrands] product API unavailable, returning []",e),[]}},listBrandsForSite:async e=>(await o(`${l("/brands")}?${new URLSearchParams({site:e})}`,typeof window>"u"?await a():void 0)).results??[],listPages:async()=>h(await o(await g(l("/pages")),await a())),listProductTemplates:async()=>{try{return await o(await g(l("/product-templates")),await a())}catch(e){return console.warn("[products.listProductTemplates] unavailable, returning []",e),[]}},listProductTypeChoices:async()=>{try{return await o(await g(l("/product-type-choices")),await a())}catch(e){return console.warn("[products.listProductTypeChoices] unavailable, returning []",e),[]}},listFieldUsage:async()=>{try{return await o(await g(l("/field-usage")),await a())}catch(e){return console.warn("[products.listFieldUsage] unavailable, returning []",e),[]}},getPage:async(e,t={})=>h(await o(await g(l(`/pages/${e}`)),await a(t.revalidate!==void 0?{next:{revalidate:t.revalidate}}:void 0))),listBlogPosts:async()=>{try{return(await o(l("/blog-posts"),await a())).map(t=>({...t,coverImage:E(t.coverImage)??""}))}catch(e){return console.warn("[products.listBlogPosts] blog API unavailable, returning []",e),[]}},getBlogPost:async e=>{let t=await o(l(`/blog-posts/${e}`),await a());return{...t,coverImage:E(t.coverImage)??""}},createOrder:async e=>o(l("/orders"),await a({method:"POST",body:JSON.stringify(e)})),createOrderAuthed:async e=>p(l("/orders"),await a({method:"POST",body:JSON.stringify(e)})),lookupOrder:async e=>o(l("/orders/lookup"),await a({method:"POST",body:JSON.stringify(e)})),createPaymentIntent:async e=>o(l("/payments/intent"),await a({method:"POST",body:JSON.stringify(e)})),createPaypalOrder:async e=>o(l("/payments/paypal/order"),await a({method:"POST",body:JSON.stringify(e)})),capturePaypalOrder:async e=>o(l("/payments/paypal/capture"),await a({method:"POST",body:JSON.stringify(e)})),createAfterpayCheckout:async e=>o(l("/payments/afterpay/checkout"),await a({method:"POST",body:JSON.stringify(e)})),captureAfterpayPayment:async e=>o(l("/payments/afterpay/capture"),await a({method:"POST",body:JSON.stringify(e)})),chargeSquare:async e=>o(l("/payments/square/charge"),await a({method:"POST",body:JSON.stringify(e)})),createGocardlessBillingRequest:async e=>o(l("/payments/gocardless/billing-request"),await a({method:"POST",body:JSON.stringify(e)})),completeGocardlessPayment:async e=>o(l("/payments/gocardless/complete"),await a({method:"POST",body:JSON.stringify(e)})),createZipCheckout:async e=>o(l("/payments/zip/checkout"),await a({method:"POST",body:JSON.stringify(e)})),captureZipPayment:async e=>o(l("/payments/zip/capture"),await a({method:"POST",body:JSON.stringify(e)})),createKlarnaCheckout:async e=>o(l("/payments/klarna/checkout"),await a({method:"POST",body:JSON.stringify(e)})),captureKlarnaPayment:async e=>o(l("/payments/klarna/capture"),await a({method:"POST",body:JSON.stringify(e)})),createStockAlert:async e=>o(l("/stock-alerts"),await a({method:"POST",body:JSON.stringify(e)})),createPreOrderIntent:async e=>o(l("/pre-order-intents"),await a({method:"POST",body:JSON.stringify(e)})),createNewsletterSubscription:async e=>o(l("/newsletter-subscriptions"),await a({method:"POST",body:JSON.stringify(e)})),unsubscribeNewsletter:async e=>o(l("/newsletter-unsubscribe"),await a({method:"POST",body:JSON.stringify(e)})),captureCart:async e=>o(l("/carts"),await a({method:"POST",body:JSON.stringify(e)})),restoreCart:async e=>o(l("/carts/restore"),await a({method:"POST",body:JSON.stringify(e)})),unsubscribeCartReminders:async e=>o(l("/carts/unsubscribe"),await a({method:"POST",body:JSON.stringify(e)})),listReviews:async(e={})=>{let t=new URLSearchParams;e.limit&&t.set("limit",String(e.limit)),e.designCode&&t.set("designCode",e.designCode);let n=l("/reviews"),r=t.toString();try{return await o(await g(r?`${n}?${r}`:n),await a())}catch(s){return console.warn("[products.listReviews] product API unavailable, returning []",s),[]}},submitReview:async e=>o(l("/reviews"),await a({method:"POST",body:JSON.stringify(e)})),getForm:async e=>o(l(`/forms/${encodeURIComponent(e)}`),await a()),submitForm:async(e,t)=>o(l(`/forms/${encodeURIComponent(e)}/submissions`),await a({method:"POST",body:JSON.stringify(t)})),listShippingMethods:async()=>{try{return await o(l("/shipping-methods"),await a())}catch(e){return console.warn("[products.listShippingMethods] product API unavailable, returning []",e),[]}},listCountrySubdivisions:async e=>{try{return await o(l(`/countries/${encodeURIComponent(e)}/subdivisions`),await a())}catch(t){return console.warn("[products.listCountrySubdivisions] unavailable, returning []",t),[]}},quoteCart:async e=>o(l("/cart/quote"),await a({method:"POST",body:JSON.stringify(e)})),validateCoupon:async e=>o(l("/coupons/validate"),await a({method:"POST",body:JSON.stringify(e)})),getHeaderSettings:async()=>{let e=ve({method:"GET"}),t=await o(await g(l("/header-settings")),await a({signal:e})),n=E(t.logoUrl),r=null,s=null;if(n&&V(n)){let i=await be(n,e);i&&(r=i.reversed,s=i.inkIsDark)}return{...t,logoUrl:n,logoReversed:r,logoInkIsDark:s}},getThemeSettings:async()=>o(await g(l("/theme-settings")),await a()),getChatSettings:async()=>o(await g(l("/chat-settings")),await a())},xn={listServices:async()=>{try{return await o(l("/bookings/services"),await a())}catch(e){return console.warn("[bookings.listServices] API unavailable, returning []",e),{results:[],currency:"USD"}}},getAvailability:async(e,t)=>o(l(`/bookings/availability?service=${encodeURIComponent(e)}&date=${t}`),await a()),create:async e=>o(l("/bookings"),await a({method:"POST",body:JSON.stringify(e)})),get:async e=>o(l(`/bookings/manage/${encodeURIComponent(e)}`),await a()),cancel:async e=>o(l(`/bookings/manage/${encodeURIComponent(e)}/cancel`),await a({method:"POST"})),createPaymentIntent:async e=>o(l("/bookings/payments/intent"),await a({method:"POST",body:JSON.stringify({manageToken:e})}))},Z=class extends Error{constructor(n,r){super(`Slug "${n}" exists on ${r} websites; a site is required to pick one.`);this.slug=n;this.count=r;this.name="AmbiguousPageSlugError"}},C=e=>e?`/api/storefront/header-settings/?${new URLSearchParams({site:e})}`:"/api/storefront/header-settings/",Te=e=>e?`/api/storefront/theme-settings/?${new URLSearchParams({site:e})}`:"/api/storefront/theme-settings/",Ce=e=>e?`/api/storefront/chat-settings/?${new URLSearchParams({site:e})}`:"/api/storefront/chat-settings/",Oe=e=>`/api/storefront/social-settings/?${new URLSearchParams({site:e})}`,Q=e=>`/api/storefront/sites/${encodeURIComponent(e)}/`,qt=e=>`${Q(e)}currencies/`,Nt="/api/storefront/media/ingest/",Y=class extends Error{constructor(){super("This editor is not connected to a website, so an upload has nowhere to go. Open the page from the website the file should belong to, then try again."),this.name="MediaUploadDestinationError"}};function $t(){let e=we();if(!e)throw new Y;return`${Nt}?${new URLSearchParams({site:e})}`}var L={"X-Puck-Media-Manifest":ae.contentHash},c=(e,t={})=>o(e,{...t,audience:"admin"}),kn={findPageBySlug:async(e,t,n)=>{let r=new URLSearchParams({slug:e});n&&r.set("site",n);let s=await c(`/api/storefront/pages/?${r.toString()}`,{token:t}),i=Array.isArray(s)?s:s.results??[];if(!n&&i.length>1)throw new Z(e,i.length);return i[0]??null},getPageById:(e,t)=>c(`/api/storefront/pages/${e}/`,{token:t}),saveLayout:(e,t,n,r,s)=>c(`/api/storefront/pages/${e}/`,{method:"PATCH",body:JSON.stringify({layout:t,expected_updated_at:r,...s?{client_id:s}:{}}),token:n}),publishPage:(e,t,n)=>c(`/api/storefront/pages/${e}/publish/`,{method:"POST",body:n?JSON.stringify({expected_updated_at:n}):void 0,token:t}),claimPageEditLock:(e,t,n,r=!1)=>c(`/api/storefront/pages/${e}/edit-lock/`,{method:"POST",body:JSON.stringify({client_id:n,takeover:r}),token:t}),releasePageEditLock:(e,t)=>c(`/api/storefront/pages/${e}/edit-lock/`,{method:"DELETE",token:t}),createTemplate:(e,t,n)=>c("/api/storefront/page-templates/",{method:"POST",body:JSON.stringify({name:e,layout:t}),headers:L,token:n}),getTemplate:(e,t)=>c(`/api/storefront/page-templates/${e}/`,{token:t}),saveTemplateLayout:(e,t,n)=>c(`/api/storefront/page-templates/${e}/`,{method:"PATCH",body:JSON.stringify({layout:t}),headers:L,token:n}),listTemplatePages:async(e,t)=>{let n=await c(`/api/storefront/template-pages/?template=${encodeURIComponent(e)}`,{token:t});return Array.isArray(n)?n:n.results??[]},findTemplatePageBySlug:async(e,t,n)=>{let r=await c(`/api/storefront/template-pages/?template=${encodeURIComponent(e)}&slug=${encodeURIComponent(t)}`,{token:n});return(Array.isArray(r)?r:r.results??[])[0]??null},createTemplatePage:(e,t,n)=>c("/api/storefront/template-pages/",{method:"POST",body:JSON.stringify({template:e,...t}),headers:L,token:n}),saveTemplatePageLayout:(e,t,n)=>c(`/api/storefront/template-pages/${e}/`,{method:"PATCH",body:JSON.stringify({layout:t}),headers:L,token:n}),deleteTemplatePage:(e,t)=>c(`/api/storefront/template-pages/${e}/`,{method:"DELETE",token:t}),listPages:async(e,t)=>{let n=new URLSearchParams({no_page:"true"});t&&n.set("site",t);let r=await c(`/api/storefront/pages/?${n.toString()}`,{token:e});return Array.isArray(r)?r:r.results??[]},createPage:(e,t,n,r)=>c("/api/storefront/pages/",{method:"POST",body:JSON.stringify({title:e,slug:t,layout:n}),token:r}),deletePage:(e,t)=>c(`/api/storefront/pages/${e}/`,{method:"DELETE",token:t}),getHeaderSettings:(e,t)=>c(C(t),{token:e}),listMenus:async(e,t)=>{let n=new URLSearchParams({no_page:"true"});t&&n.set("site",t);let r=await c(`/api/storefront/menus/?${n}`,{token:e});return Array.isArray(r)?r:r.results??[]},listBlogPosts:async(e,t={})=>{let n=new URLSearchParams({no_page:"true"});t.visibleOnly&&n.set("is_visible","true"),t.siteId&&n.set("site",t.siteId);let r=await c(`/api/storefront/blog-posts/?${n.toString()}`,{token:e});return Array.isArray(r)?r:r.results??[]},listCategories:async(e,t={})=>{let n=new URLSearchParams({no_page:"true"});t.visibleOnly&&n.set("is_visible","true"),t.siteId&&n.set("site",t.siteId);let r=await c(`/api/storefront/categories/?${n.toString()}`,{token:e});return[...Array.isArray(r)?r:r.results??[]].sort((i,u)=>i.sort_order-u.sort_order||i.name.localeCompare(u.name))},listForms:async(e,t={})=>{let n=new URLSearchParams({no_page:"true"});t.siteId&&n.set("site",t.siteId);let r=await c(`/api/storefront/forms/?${n.toString()}`,{token:e});return[...Array.isArray(r)?r:r.results??[]].sort((i,u)=>i.title.localeCompare(u.title))},listWheelSummaries:async(e,t={})=>{let n=new URLSearchParams;t.siteId&&n.set("site",t.siteId);let r=n.toString(),s=await c(`/api/storefront/wheel-curations/summaries/${r?`?${r}`:""}`,{token:e});return h(s)},listProducts:async(e,t={})=>{let n=new URLSearchParams;t.kinds?.length&&n.set("kind",t.kinds.join(",")),t.siteId&&n.set("site",t.siteId);let r=n.toString(),s=await c(`/api/storefront/products/${r?`?${r}`:""}`,{token:e});return h(s)},getWheelDetail:async(e,t,n={})=>{let r=new URLSearchParams({slug:t});return n.siteId&&r.set("site",n.siteId),R(h(await c(`/api/storefront/wheel-curations/detail/?${r.toString()}`,{token:e})))},updateHeaderSettings:(e,t,n)=>c(C(n),{method:"PATCH",body:JSON.stringify(e),token:t}),getSite:(e,t)=>c(Q(e),{token:t}),listSiteCurrencies:async(e,t)=>{let n=await c(qt(e),{token:t});return Array.isArray(n)?n:[]},updateSite:(e,t,n)=>c(Q(e),{method:"PATCH",body:JSON.stringify(t),token:n}),getThemeSettings:(e,t)=>c(Te(t),{token:e}),updateThemeSettings:(e,t,n)=>c(Te(n),{method:"PATCH",body:JSON.stringify(e),token:t}),getChatSettings:(e,t)=>c(Ce(t),{token:e}),updateChatSettings:(e,t,n)=>c(Ce(n),{method:"PATCH",body:JSON.stringify(e),token:t}),getSocialSettings:(e,t)=>c(Oe(t),{token:e}),updateSocialSettings:(e,t,n)=>c(Oe(n),{method:"PATCH",body:JSON.stringify(e),token:t}),uploadHeaderLogo:(e,t,n)=>{let r=new FormData;return r.append("logo",e),c(C(n),{method:"PATCH",body:r,token:t})},clearHeaderLogo:(e,t)=>c(C(t),{method:"PATCH",body:JSON.stringify({logo:null}),token:e}),setHeaderLogoFromAsset:(e,t,n)=>c(C(n),{method:"PATCH",body:JSON.stringify({logo_asset_id:e}),token:t}),uploadMedia:async(e,t)=>{let n=new FormData;return n.append("file",e),c($t(),{method:"POST",body:n,token:t})},listMedia:async(e,t)=>{let n=new URLSearchParams({no_page:"true"});t&&n.set("kind",t);let r=await c(`/api/storefront/media-assets/?${n.toString()}`,{token:e});return Array.isArray(r)?r:r.results??[]}};export{$e as a,Ue as b,Me as c,He as d,De as e,_ as f,Ut as g,Mt as h,ee as i,G as j,Qe as k,E as l,rn as m,sn as n,on as o,an as p,ne as q,re as r,ae as s,Kt as t,v as u,zt as v,jt as w,b as x,ze as y,V as z,we as A,Wt as B,se as C,gt as D,f as E,z as F,K as G,o as H,_t as I,At as J,qe as K,It as L,Et as M,Ft as N,An as O,Rn as P,xn as Q,Z as R,c as S,kn as T};
@@ -0,0 +1 @@
1
+ import{createContext as d,useContext as n}from"react";import{jsx as a}from"react/jsx-runtime";var i={connected:!1,ownsDocument:!0,send:()=>{},subscribe:()=>()=>{},address:{search:()=>"",show:()=>{},load:()=>{},reload:()=>{}}},s=d(i);function y({host:o,children:t}){return a(s.Provider,{value:o,children:t})}function f(){return n(s)}function u(o){let t=new Set;return{host:{connected:!0,ownsDocument:!1,send:((e,r)=>{o.onMessage({type:e,...r})}),subscribe(e){return t.add(e),()=>{t.delete(e)}},address:o.address},deliver:e=>{for(let r of[...t])r(e)}}}export{y as a,f as b,u as c};