@imagineio/configurator-sdk 0.1.0-beta.1
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.
- package/LICENSE.md +294 -0
- package/README.md +103 -0
- package/dist/00a41227ff.js +1 -0
- package/dist/00ab3dcbb5.js +1 -0
- package/dist/01a664fa9f.css +51 -0
- package/dist/04746bff9a.js +1 -0
- package/dist/04931f795e.js +1 -0
- package/dist/05973a4da2.js +3 -0
- package/dist/061b81ad81.js +1 -0
- package/dist/066fc9aa40.js +1 -0
- package/dist/09c4973968.js +1 -0
- package/dist/0a35b2c5f4.js +1 -0
- package/dist/0af28430ab.js +1 -0
- package/dist/0e2dedae0d.js +1 -0
- package/dist/0f7c8345a8.js +1 -0
- package/dist/12b8165d6d.js +1 -0
- package/dist/1458417bdb.js +1 -0
- package/dist/14c83bc57a.js +1 -0
- package/dist/15d6bec3b5.css +150 -0
- package/dist/16a399703e.js +1 -0
- package/dist/17876f4322.css +114 -0
- package/dist/1870fc037b.js +1 -0
- package/dist/1a2629800a.css +196 -0
- package/dist/1e243363f6.js +1 -0
- package/dist/1fac915f8b.js +1 -0
- package/dist/1fff100656.js +1 -0
- package/dist/205827c5c8.js +1 -0
- package/dist/20b0104576.js +1 -0
- package/dist/2239b22616.js +1 -0
- package/dist/22bd38ddcf.js +1 -0
- package/dist/239b619005.css +1849 -0
- package/dist/23dc0ccf32.js +1 -0
- package/dist/26155bf68c.js +1 -0
- package/dist/2774152dd2.js +1 -0
- package/dist/27fee7007f.js +1 -0
- package/dist/281cf952fa.js +1 -0
- package/dist/28a9d58274.js +1 -0
- package/dist/28d887bf8a.js +1 -0
- package/dist/28df2aa12f.js +1 -0
- package/dist/297e653adf.js +1 -0
- package/dist/2990ba64d6.js +1 -0
- package/dist/2b6aa27f6d.js +1 -0
- package/dist/2c7c1bcef1.js +1 -0
- package/dist/2cab5c5c23.js +1 -0
- package/dist/2cafe3274b.js +1 -0
- package/dist/2e366d7386.js +1 -0
- package/dist/2f8cc8b292.js +1 -0
- package/dist/30be653f00.css +110 -0
- package/dist/31ea036f5c.js +1 -0
- package/dist/32861ea2b0.js +1 -0
- package/dist/33fa2c8ca2.js +1 -0
- package/dist/35d8449ed8.js +1 -0
- package/dist/3656ffa1b8.js +1 -0
- package/dist/367a479d3a.js +1 -0
- package/dist/371ed78aa2.js +1 -0
- package/dist/37596ace72.js +1 -0
- package/dist/37addc7fb3.js +1 -0
- package/dist/388cadacbd.js +1 -0
- package/dist/39a62ef7b8.js +1 -0
- package/dist/3bbcee0334.js +1 -0
- package/dist/3c916f744f.js +1 -0
- package/dist/3f37665dd1.js +1 -0
- package/dist/3fb3ab6757.js +1 -0
- package/dist/40d6aeb28c.js +1 -0
- package/dist/41ed5985ad.js +1 -0
- package/dist/431a2d8618.js +1 -0
- package/dist/44a229099f.js +1 -0
- package/dist/4741e5d07d.css +263 -0
- package/dist/4910c07ca8.css +411 -0
- package/dist/4a99ddb3fd.js +1 -0
- package/dist/4aa671f9f6.js +1 -0
- package/dist/4b8958aa4c.js +1 -0
- package/dist/4ba4f544b9.js +1 -0
- package/dist/4c24338793.js +1 -0
- package/dist/4d7a0d1897.js +1 -0
- package/dist/4e1db1e3b0.js +1 -0
- package/dist/4e7d0a0d4a.js +1 -0
- package/dist/51b23203e5.css +1447 -0
- package/dist/52436e0169.js +1 -0
- package/dist/54413c1eae.js +1 -0
- package/dist/54f0fcf38b.js +1 -0
- package/dist/55ab45ada4.css +370 -0
- package/dist/561dc3f1ab.js +1 -0
- package/dist/58e6419ba8.js +1 -0
- package/dist/5c9fd9201c.js +1 -0
- package/dist/5d05e8982e.js +1 -0
- package/dist/5d5e8a9c58.js +3 -0
- package/dist/5e4f2349ff.js +1 -0
- package/dist/609e5e5d28.js +1 -0
- package/dist/60d697292c.js +1 -0
- package/dist/61e0c0c9b5.js +1 -0
- package/dist/631a9f7fac.js +1 -0
- package/dist/64e9020b49.js +1 -0
- package/dist/66c461dc2c.js +1 -0
- package/dist/672404d987.js +1 -0
- package/dist/67f6338a4a.js +1 -0
- package/dist/6855e6a3b1.js +1 -0
- package/dist/6b0a81e4f8.js +1 -0
- package/dist/6ba86aa3b8.js +1 -0
- package/dist/6bff84d27e.js +1 -0
- package/dist/6c0a2572dd.js +1 -0
- package/dist/6d238282c1.js +1 -0
- package/dist/6e2595aa36.js +1 -0
- package/dist/6f9ae59d6c.js +1 -0
- package/dist/70dd811d74.js +1 -0
- package/dist/710c1ab641.js +1 -0
- package/dist/7206ce49c6.js +1 -0
- package/dist/7281d77ed9.js +1 -0
- package/dist/73f7d65985.js +1 -0
- package/dist/776277593f.js +1 -0
- package/dist/79a397bb92.js +1 -0
- package/dist/7a748aae59.js +1 -0
- package/dist/7bfb0ecfbb.css +572 -0
- package/dist/7bfcd0a517.js +1 -0
- package/dist/7d9ddaeb47.js +1 -0
- package/dist/7f833bc5af.js +1 -0
- package/dist/811b403d43.js +1 -0
- package/dist/817d930a49.js +1 -0
- package/dist/81802759ca.js +1 -0
- package/dist/81eb433604.js +1 -0
- package/dist/82a8a4bc35.js +1 -0
- package/dist/85af90fade.js +1 -0
- package/dist/872c4302e0.js +1 -0
- package/dist/87bb469216.js +1 -0
- package/dist/87dcc12b65.js +1 -0
- package/dist/87f511c4a8.js +1 -0
- package/dist/88251d6671.js +1 -0
- package/dist/882bc739c8.js +1 -0
- package/dist/89ab18ebc5.js +1 -0
- package/dist/8a22e8944f.css +563 -0
- package/dist/8a3a57c008.js +1 -0
- package/dist/8ade32d067.js +1 -0
- package/dist/8bf6d26ad6.css +233 -0
- package/dist/8c27edda0f.js +1 -0
- package/dist/8db8655f21.js +24 -0
- package/dist/8f60e5059a.js +1 -0
- package/dist/91707f5ca0.css +78 -0
- package/dist/921bf270dd.js +20 -0
- package/dist/9326c23506.js +1 -0
- package/dist/94a0a79c65.js +1 -0
- package/dist/9526094bb7.js +1 -0
- package/dist/9544661159.js +1 -0
- package/dist/95a44ebec2.js +1 -0
- package/dist/970313b92b.js +1 -0
- package/dist/9794652102.js +1 -0
- package/dist/983cbed22c.js +1 -0
- package/dist/9840b9ce12.js +1 -0
- package/dist/98f3644031.js +1 -0
- package/dist/992778075d.css +353 -0
- package/dist/9c6c598569.js +1 -0
- package/dist/9f474b5d1a.js +1 -0
- package/dist/a0f71d0bf5.js +1 -0
- package/dist/a3c983d431.js +1 -0
- package/dist/a3f18e76fe.js +1 -0
- package/dist/a493e9aa8f.js +1 -0
- package/dist/a77b15c0d6.js +1 -0
- package/dist/a811c90bd5.js +1 -0
- package/dist/a822c5e4f2.js +1 -0
- package/dist/aaa0e82d7f.css +69 -0
- package/dist/ab6c80484f.js +1 -0
- package/dist/ae96f219e3.js +1 -0
- package/dist/b11b38869d.css +427 -0
- package/dist/b1349d5a21.js +4 -0
- package/dist/b14379d31b.css +151 -0
- package/dist/b3efb26fd7.js +1 -0
- package/dist/b59b0dde17.js +1 -0
- package/dist/b5c372377f.js +1 -0
- package/dist/b976df09ec.js +1 -0
- package/dist/baeaed46c9.js +1 -0
- package/dist/bb719febc6.js +1 -0
- package/dist/bcd44b4040.js +1 -0
- package/dist/bdc4e4c5b9.css +209 -0
- package/dist/bdec200d00.js +1 -0
- package/dist/be0cfe2236.js +1 -0
- package/dist/be337ddda5.js +1 -0
- package/dist/c12c112c6f.js +1 -0
- package/dist/c2a14a77ae.js +1 -0
- package/dist/c3b8f1973b.js +1 -0
- package/dist/c44d37da7a.js +1 -0
- package/dist/c4790179f1.js +1 -0
- package/dist/c5e990946e.js +1 -0
- package/dist/c71892453b.js +1 -0
- package/dist/c9a1656c62.js +1 -0
- package/dist/ca497b066c.js +1 -0
- package/dist/cdb4a0f7b3.js +3 -0
- package/dist/ce663020e4.js +60 -0
- package/dist/cec035efb1.js +1 -0
- package/dist/d0f9681634.js +1 -0
- package/dist/d118c2e7ba.js +1 -0
- package/dist/d20718159b.js +3 -0
- package/dist/d30f1f506e.js +1 -0
- package/dist/d3cd7f1bc1.js +1 -0
- package/dist/d4378d9afa.js +1 -0
- package/dist/d464da28a5.js +1 -0
- package/dist/d566d3874b.js +1 -0
- package/dist/d617bbb9f5.js +26 -0
- package/dist/d65f32e004.js +1 -0
- package/dist/d6851ea979.js +1 -0
- package/dist/d7c9500ba9.js +1 -0
- package/dist/d803155241.js +1 -0
- package/dist/d903df4e0d.js +1 -0
- package/dist/d94df858ea.js +1 -0
- package/dist/da7b5f450d.js +1 -0
- package/dist/daa11edd01.js +1 -0
- package/dist/db4afd43c9.js +1 -0
- package/dist/dbd5ba1d07.js +1 -0
- package/dist/dc2a1a0e13.js +1 -0
- package/dist/dc812f3e14.js +1 -0
- package/dist/dcbf419090.css +122 -0
- package/dist/dcdba78ddf.js +1 -0
- package/dist/de408c4516.js +1 -0
- package/dist/e1cd279733.js +1 -0
- package/dist/e379e0039b.js +1 -0
- package/dist/e4fe0551fd.js +1 -0
- package/dist/e6eed481cc.css +28 -0
- package/dist/e75f1e5992.js +1 -0
- package/dist/ea8577d22b.js +1 -0
- package/dist/ec4a34fc80.css +313 -0
- package/dist/ed6a54cdf6.js +1 -0
- package/dist/ee242c0099.js +1 -0
- package/dist/ee9b9fd7d1.js +1 -0
- package/dist/f0c3d8a28a.js +1 -0
- package/dist/f11a45a150.js +1 -0
- package/dist/f1b3b2622a.js +1 -0
- package/dist/f7b4a178e3.js +1 -0
- package/dist/f89d7cd931.js +1 -0
- package/dist/f8cb80a93c.js +1 -0
- package/dist/f8fec86f10.js +1 -0
- package/dist/fbd844f2d1.js +1 -0
- package/dist/fe235d7160.js +1 -0
- package/dist/fe58a84b85.js +1 -0
- package/dist/fe68b361ba.js +1 -0
- package/dist/ff5b3d17e2.js +1 -0
- package/dist/styles/globals.css +442 -0
- package/dist/styles/themes.css +532 -0
- package/dist/styles/variables.css +299 -0
- package/package.json +68 -0
- package/static/assets/draco/README.md +32 -0
- package/static/assets/draco/draco_decoder.js +34 -0
- package/static/assets/draco/draco_decoder.wasm +0 -0
- package/static/assets/draco/draco_encoder.js +35 -0
- package/static/assets/draco/draco_encoder.wasm +0 -0
- package/static/assets/draco/draco_encoder_wrapper.js +98 -0
- package/static/assets/draco/draco_wasm_wrapper.js +117 -0
- package/static/favicon.svg +28 -0
- package/static/version.txt +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{HOSTED_PLACEMENT_ID_PREFIX as M,isHostedPlacementId as $,stripHostedPlacementPrefix as N}from"./23dc0ccf32.js";import k,{deriveSceneFeatures as U}from"./be337ddda5.js";import G from"./d94df858ea.js";import w from"./9c6c598569.js";import _ from"./8f60e5059a.js";import j from"./872c4302e0.js";import{isHostFloating as B}from"./061b81ad81.js";import{getProductAllComponents as V,pieceKindOf as q}from"./9326c23506.js";import{autoFixAdjacency as z}from"./710c1ab641.js";import{getPlacementStrategy as X}from"./281cf952fa.js";function K(o){const l=o?.features||{};for(const[d,p]of Object.entries(l))if(p?.type==="appliance_selection")return d;const u=new Set(Object.keys(o?.hostedProductByOptionId||{}));if(u.size>0){for(const[d,p]of Object.entries(l))if((Array.isArray(p?.options)?p.options.map(String):[]).some(a=>u.has(a)))return d}return null}function Y(o,l){if(l==null)return!1;const u=o?.products||{},d=u[l]||u[String(l)];return d?String(d.placement_group??d.placementGroup??"").toLowerCase().includes("overlay"):!1}function Q(o=null){const l=_.getState(),u=j.getState(),d=K(u);if(d==null)return{osId:null,assignments:[]};const p=l.basePiecePositions||{},g=l.hostProductOverrides||{},a=Object.keys(p).filter(n=>!Y(u,g[n]??p[n]?.productId)).sort((n,f)=>n.localeCompare(f,void 0,{numeric:!0})),t=[];for(const n of l.sceneHostedProducts||[]){if(o!=null&&String(n.id)===String(o))continue;const f=n.hostedProductId??n.productId??null;if(f==null)continue;const m=u.getHostedProduct?.(f)?.optionId??null;m!=null&&t.push({instanceId:n.id,variantId:f,optionId:m,replacedPiece:n.replacedPiece??null,pos:Array.isArray(n.position)?n.position:null})}const i=new Map;for(const n of t){const f=String(n.optionId),m=i.get(f);(!m||!m.pos&&n.pos)&&i.set(f,n)}const r=[...i.values()],s=new Set,e=[],c=(n,f)=>{const m=p[f]?.position;if(!Array.isArray(m)||!Array.isArray(n))return 1/0;const I=(m[0]??0)-(n[0]??0),b=(m[1]??0)-(n[1]??0),v=(m[2]??0)-(n[2]??0);return I*I+b*b+v*v},S=r.filter(n=>n.pos),y=new Set(S.map(n=>n.instanceId));for(;y.size;){let n=null;for(const f of S)if(y.has(f.instanceId))for(const m of a){if(s.has(m))continue;const I=c(f.pos,m);(n==null||I<n.d)&&(n={a:f,pieceId:m,d:I})}if(!n)break;s.add(n.pieceId),y.delete(n.a.instanceId),e.push({instanceId:n.a.instanceId,variantId:n.a.variantId,pieceId:n.pieceId,optionId:n.a.optionId})}for(const n of r){if(n.pos)continue;const f=n.replacedPiece&&!s.has(n.replacedPiece)&&p[n.replacedPiece]?n.replacedPiece:a.find(m=>!s.has(m));if(!f)break;s.add(f),e.push({instanceId:n.instanceId,variantId:n.variantId,pieceId:f,optionId:n.optionId})}return{osId:d,assignments:e}}const J=1;function mt(o){const l=N(o);return`${M}${l}`}function Z(o){switch(o){case"left":return"left";case"right":case"side":return"right";case"front":case"front-left":case"front-right":return"front";default:return"back"}}function yt(o,l){const u=k.getState().placementGroups||{},d=Object.keys(u);if(d.length===0)return null;const p=i=>u[i]?.type??u[i]?.kind??null,g=i=>String(u[i]?.wall??u[i]?.location??"").toLowerCase(),a=i=>p(i)===o,t=Z(l);return d.find(i=>a(i)&&g(i)===t)||d.find(i=>a(i)&&g(i).includes(t))||d.find(a)||null}const L="floor_back";function St(){const o=Object.keys(k.getState().placementGroups||{});return o.find(l=>/floor/i.test(l))??o[0]??L}function It(o={}){const l=k.getState(),u=_.getState(),d=j.getState(),p=G.getState().sceneSelections||{},g=w.getState().placementSelections||{},a=[];{const s=w.getState(),e=j.getState(),c=Object.keys(k.getState().placementGroups||{}),S=Object.values(s.productInstances||{}).map(y=>y?.placementGroup).find(Boolean)??null;for(const[y,n]of Object.entries(s.productInstances||{})){if(!n)continue;const f=n.variantId??n.productId??null;if(f==null)continue;const m=e.getProduct?.(n.productId)||e.getProduct?.(f),I=n.placementGroup??m?.placementGroup??m?.placement_group??S??c.find(v=>/floor/i.test(v))??c[0]??L,b=(()=>{const v=n.positionedAbove??n.positioned_above??null;if(v!=null){const O=(s.productInstances||{})[String(v)];return O?.variantId??O?.productId??null}const h=m?.hostVariants??m?.host_variants;if(Array.isArray(h)&&h.length){const O=h.find(x=>x?.isDefault??x?.is_default)||h[0];return O?.hostVariantId??O?.host_variant_id??null}return null})();a.push({id:y,variantId:f,placementGroup:I,sequence:0,...b!=null?{hostVariantId:b}:{},transform:{position:n.position||[0,0,0],rotation:n.rotation||[0,0,0]},selections:g[y]||{},overrides:{},edge:(m?.edge??e.getProduct?.(f)?.edge??"")||null,createdAt:n.createdAt??0})}}{const s=w.getState().productInstances||{};for(const e of a){const c=Number(s[String(e.id)]?.sequence);e.sequence=Number.isFinite(c)?c:0}for(const e of a)e.sequence==null&&(e.sequence=0),delete e.createdAt,delete e.edge}const{osId:t,assignments:i}=Q(o.excludeHostedProductInstanceId??null);if(t!=null){const s=String(t);for(const c of a)c.selections&&s in c.selections&&delete c.selections[s];const e=new Map(a.map(c=>[String(c.id),c]));for(const c of i){const S=e.get(String(c.pieceId));S&&(S.selections[s]=c.optionId)}}const r={};for(const[s,e]of Object.entries(p)){const c=Number(e);!Number.isFinite(c)||!Number.isFinite(Number(s))||(d.features?.[s]?.type??d.features?.[String(s)]?.type)==="load_new_product"||(r[String(s)]=c)}return{schemaVersion:J,systemId:Number(l.systemId)||l.systemId,versionNumber:1,catalogVersion:l.catalogVersion??null,room:(()=>{const s=l.systemRoom||{},e=c=>Number(c)>0?Number(c):null;return{width:(u.roomFootprint?.width>0?u.roomFootprint.width:null)??e(s.width)??4,depth:(u.roomFootprint?.depth>0?u.roomFootprint.depth:null)??e(s.depth)??3.5,height:e(s.height)??2.7}})(),selections:r,placements:a}}function ht(o){if(!Array.isArray(o)||o.length===0)return;try{tt(o)}catch{}const l=_.getState(),u=j.getState();for(const d of o){if(String(d?.reason||"").includes("max_count"))continue;const p=String(d?.variantId??N(d?.id)),g=(l.sceneHostedProducts||[]).find(a=>{if(String(a.hostedProductId)===p)return!0;const t=u.getHostedProduct?.(a.hostedProductId)?.id;return t!=null&&String(t)===p});if(g){try{l.removeHostedProduct?.(g.id)}catch{}const a=g.name||u.getHostedProduct?.(g.hostedProductId)?.name||"Hosted product",t=String(d?.reason||"");let i=`${a} was removed automatically.`;t.includes("mutually_exclusive")?i=`${a} was removed \u2014 it can't be combined with the product you just added.`:(t.includes("positioned_above")||t.includes("cascade"))&&(i=`${a} was removed because the product it was paired with is no longer in the scene.`);try{l.showInfo?.(i)}catch{}}}}let R="",W=0;function tt(o){const l=(Array.isArray(o)?o:[]).filter(f=>String(f?.reason||"").includes("max_count"));if(l.length===0)return;const u=_.getState(),d=u.pieceConfigSnapshot;if(!d||typeof d!="object")return;const p=u.basePiecePositions||{},g=u.hostProductOverrides||{},a=f=>String(g[f]??p[f]?.productId??""),t={};for(const f of l){const m=String(f?.variantId??String(f?.id??"").replace(/^.*?-/,""));m&&(t[m]=(t[m]||0)+1)}const i=Object.entries(t).map(([f,m])=>`${f}:${m}`).sort().join(","),r=Date.now();if(i&&i===R&&r-W<6e3)return;const s=[];for(const[f,m]of Object.entries(t)){const I=Object.keys(p).filter(b=>a(b)===f).sort((b,v)=>b.localeCompare(v,void 0,{numeric:!0}));s.push(...I.slice(Math.max(0,I.length-m)))}if(s.length===0)return;const e={...d};for(const f of s){const m=f.indexOf("-");if(m===-1)continue;const I=f.slice(0,m),b=Number(f.slice(m+1));Array.isArray(e[I])&&(e[I]=e[I].filter(h=>h!==b));const v=`${I}ByWall`;if(e[v]&&typeof e[v]=="object"){const h={};for(const[O,x]of Object.entries(e[v]))h[O]=Array.isArray(x)?x.filter(H=>H!==b):x;e[v]=h}if(I==="corner"&&e.cornerPositions&&typeof e.cornerPositions=="object"){const h={...e.cornerPositions};delete h[b],e.cornerPositions=h}}const c=new Set(s),S=f=>{const m={...f};for(const I of c)delete m[I];return m},y={pieceConfigSnapshot:e};for(const f of["hostProductOverrides","hostWidths","hostDoorTypes","hostStyles","hostHandleTypes","hostFinishes","hostMaterials","hostHardwareFinishes"])u[f]&&typeof u[f]=="object"&&(y[f]=S(u[f]));_.setState(y);const n=_.getState().selectedPieceIndex;n&&c.has(n)&&_.getState().clearSelectedFeature?.(),R=i,W=r}function Pt(o){const l=(Array.isArray(o)?o:[]).filter(a=>String(a?.code??a?.type??"").toUpperCase()!=="STALE_SELECTION"),u=_.getState().setConstraintWarnings;if(typeof u!="function")return;const d=k.getState().constraints||[],p=new Map(d.map(a=>[String(a.id),a.constraintType??a.constraint_type??null])),g=l.map(a=>{const t=a?.details?.constraintId??a?.constraintId??null;return{code:a?.code??a?.type??"CONSTRAINT_VIOLATION_SOFT",message:a?.message??String(a??""),constraintId:t,constraintType:t!=null?p.get(String(t))??null:null,placementId:a?.details?.placementId??null,offending:Array.isArray(a?.details?.offending)?a.details.offending:[]}});u(g);try{z(g)}catch{}}function D(o){const l=String(o??"info").toLowerCase();return l==="success"||l==="warning"||l==="error"?l:"info"}function bt(o){const l=_.getState(),u=(Array.isArray(o)?o:[]).map(t=>{const i=t||{};return{ruleId:i.ruleId??i.rule_id??null,text:i.text??i.message??"",severity:String(i.severity??"info").toLowerCase(),display:String(i.display??"toast").toLowerCase(),placementId:i.placementId??i.placement_id??null}}).filter(t=>t.text),d=u.filter(t=>t.display==="modal"),p=u.filter(t=>t.display!=="modal");try{l.setInlineMessages?.([])}catch{}for(const t of p){const i=D(t.severity),r=i==="warning"||i==="error"?0:5e3;try{l.addNotification?.({type:i,message:t.text,duration:r})}catch{}}const g=d.map(t=>t.ruleId??t.text??null).filter(t=>t!=null),a=Array.isArray(l.lastModalKeys)?l.lastModalKeys:[];if(d.length){const t=d[d.length-1],i=t.ruleId??t.text??null;if(i==null||!a.includes(i))try{l.setMessageModal?.({ruleId:t.ruleId,text:t.text,severity:D(t.severity)})}catch{}}try{_.setState({lastModalKeys:g})}catch{}}function At(o,l){if(!Array.isArray(o)||o.length===0)return;const u=_.getState(),d=j.getState(),p=u.basePiecePositions||{};let g=!1;for(const a of o){const t=a?.variantId??String(a?.id??"").replace(/^.*?-/,"");if(t==null||t===""||(u.sceneHostedProducts||[]).some(y=>{if(String(y.hostedProductId)===String(t))return!0;const n=d.getHostedProduct?.(y.hostedProductId)?.id;return n!=null&&String(n)===String(t)}))continue;const r=d.getHostedProduct?.(t);if(!r?.id)continue;let s=r.modelUrl;s||(s=(V(r.id)||[]).find(n=>!!n.url)?.url||null);const e=(l?.placements||[]).find(y=>String(y.id)===String(a.id));let c=e?.hostPlacementId&&p[e.hostPlacementId]?e.hostPlacementId:null;if(!c){const y=(u.sceneHostedProducts||[]).find(n=>B(n)&&n.replacedPiece);y?.replacedPiece&&p[y.replacedPiece]&&(c=y.replacedPiece)}if(c||(c=Object.keys(p).sort((y,n)=>y.localeCompare(n,void 0,{numeric:!0})).find(y=>q(y)==="base"&&p[y]?.position)||null),!c||!p[c]?.position)continue;const S=p[c];try{u.placeHostedProductAtPiece?.({...r,modelUrl:s},c,S.position,S.rotation||[0,0,0]),g=!0}catch{}}}let C=[],et=0;function _t(o){const l=++et;return C.push({token:l,req:o,consumed:!1}),l}function vt(o){C=C.filter(l=>l.token!==o)}function Ot(o){const u=!!C.find(d=>d.token===o)?.consumed;return C=C.filter(d=>d.token!==o),u}function xt(o){if(C.length===0)return 0;const l=Array.isArray(o?.placements)?o.placements:[];if(l.length===0)return 0;const u=j.getState(),d=_.getState(),p=d.basePiecePositions||{};let g=0;for(const a of C){if(a.consumed)continue;const t=String(a.req.productId);l.find(r=>{if(p[r.id])return!1;const s=r.variantId??String(r.id??"");return!(String(s)!==t||u.getHostedProduct?.(s)?.id)})&&(d.setPendingPieceAdd({...a.req,_preValidated:!0,_fromResponse:!0}),a.consumed=!0,g+=1)}return g}function wt(o){if(!o||typeof o!="object")return;const l=o.selections||{},u=G.getState(),d=u.sceneSelections||{};for(const[p,g]of Object.entries(l)){const a=Number(g);if(Number.isFinite(a)&&!(d[p]!=null||d[String(p)]!=null))try{(u.setSeededSceneSelection??u.setSceneSelection)?.(p,a)}catch{}}}function Ht(o){const d=(k.getState().sceneConfigurations||{})[o];if(!d)return!1;const p=G.getState(),g=w.getState(),a=j.getState();d?.scene_id&&g.setActiveSceneId?.(d.scene_id);const t=U(d);for(const i of t)i.id&&i.default_option_id&&p.setSceneSelection(i.id,i.default_option_id);if(t.length>0){const i=a.options||{};for(const r of t){if(!r?.id)continue;const s=r.type;if(s!=="layout_change"&&s!=="load_configuration")continue;let e=d.scene_option_id??d.sceneOptionId??null;if(e==null){const c=a.features||{},S=r.feature_id??r.id,y=c[S]??c[String(S)],n=Array.isArray(y?.options)?y.options:[];for(const f of n){const m=typeof f=="object"?f?.id??f?.optionId??f?.option_id:f;if(m==null)continue;const I=i[m]??i[String(m)];if(!I)continue;if([I.value,I.valueText,I.value_text,I.id].filter(v=>v!=null).map(String).includes(String(o))){e=I.id;break}}}e!=null&&p.setSceneSelection(r.id,e)}}if(d.default_scene_selections)for(const[i,r]of Object.entries(d.default_scene_selections))p.setSceneSelection(i,r);return g.setSceneLoading?.(!1),!0}function nt(o){const l=Array.isArray(o?.placements)?o.placements:[],u=l.filter(g=>g?.positionedAbove!=null);if(u.length===0)return;const d=j.getState(),p=_.getState().basePiecePositions||{};for(const g of u){const a=g.variantId??N(g.id),t=d.getHostedProduct?.(a);if(!t?.id)continue;const i=l.find(A=>String(A.id)===String(g.positionedAbove)),r=i?.variantId??(i?N(i.id):null);if(r==null)continue;const s=(_.getState().sceneHostedProducts||[]).find(A=>{if(String(A.hostedProductId)===String(r))return!0;const P=d.getHostedProduct?.(A.hostedProductId)?.id;return P!=null&&String(P)===String(r)}),e=s?.replacedPiece,c=e&&p[e]?.position?p[e]:null,S=c?.position??s?.position??null,y=c?.rotation??s?.rotation??[0,0,0];if(!S)continue;let n=0;if(c){const A=d.getHostedProduct?.(r),P=c.productId||A?.target_product_id;n=(A?.slots?.find(F=>F.product_id===P)||A?.slots?.find(F=>F.isDefault)||A?.slots?.[0])?.position?.[0]??A?.componentModelOffset?.[0]??0}const f=S[0];let m=S[1]+1.5;for(const[A,P]of Object.entries(p))if(q(A)==="upper"&&Math.abs((P.position?.[0]??1/0)-f)<.5){m=P.position[1];break}const I=m-S[1]+.25,b=(y||[0,0,0])[1],v=Math.cos(b),h=Math.sin(b),O=[n,I,0],x=[S[0]+n*v,S[1]+I,S[2]-n*h];let H=t.modelUrl;H||(H=(V(t.id)||[]).find(P=>!!P.url)?.url||null);const T=(_.getState().sceneHostedProducts||[]).find(A=>{if(String(A.hostedProductId)===String(t.id))return!0;const P=d.getHostedProduct?.(A.hostedProductId)?.id;return P!=null&&String(P)===String(t.id)});if(T)_.setState(A=>({sceneHostedProducts:A.sceneHostedProducts.map(P=>P.id===T.id?{...P,position:x,rotation:y||[0,0,0],positionOffset:O,replacedPiece:e??P.replacedPiece,pairedWithPiece:e??P.pairedWithPiece,pairedWithHostedProductId:s?.id??P.pairedWithHostedProductId}:P)}));else{const A=String(g.id??`${M}${t.id}`);_.setState(P=>({sceneHostedProducts:[...P.sceneHostedProducts,{id:A,hostedProductId:t.id,name:t.name,modelUrl:H,position:x,rotation:y||[0,0,0],scale:t.scale||[1,1,1],placement_type:t.placement_type,replacedPiece:e??null,positionOffset:O,pairedWithPiece:e??null,pairedWithHostedProductId:s?.id??null}],...e?{occupiedPieceSlots:{...P.occupiedPieceSlots,[e]:{...P.occupiedPieceSlots[e],pairedHostedProductId:A}}}:{}}))}}}const E=()=>{try{const o=X();return!!o&&typeof o.computeLayout!="function"}catch{return!1}};function jt(o){if(!o||!Array.isArray(o.placements))return;const u=w.getState().productInstances||{};let d=!1;try{d=!!_.getState().ownsSceneGraph}catch{}if(E())return;const p={};let g=!1;for(const r of o.placements){const s=String(r.id??"");if(!s)continue;const e=[r.transform,r.default_transform,r.defaultTransform,Array.isArray(r.position)?{position:r.position,rotation:r.rotation}:null].find(y=>y&&Array.isArray(y.position))||{},c=u[s],S={id:s,instanceId:s,placementId:s,productId:r.variantId,variantId:r.variantId,configId:null,placementGroup:r.placementGroup??null,sequence:Number.isFinite(Number(r.sequence))?Number(r.sequence):null,positionedAbove:r.positionedAbove??r.positioned_above??r.hostPlacementId??r.host_placement_id??r.host??null,lockVariantId:r.lockVariantId??r.lock_variant_id??null,position:Array.isArray(e.position)?e.position:[0,0,0],rotation:Array.isArray(e.rotation)?e.rotation:[0,0,0],scale:[1,1,1],locked:r.locked===!0,createdAt:c?.createdAt??(d?Date.now()+(Number.isFinite(Number(r.sequence))?Number(r.sequence):0):Date.now())};p[s]=S,(!c||c.productId!==S.productId||c.position!==S.position||c.rotation!==S.rotation||c.locked!==S.locked)&&(g=!0)}for(const[r,s]of Object.entries(u))r in p||(g=!0);const a=Object.entries(u).filter(([r])=>!(r in p));let t=a;Object.keys(p).length>0&&(t=[]);const i=t.length!==a.length;!g&&!i||w.setState({productInstances:{...Object.fromEntries(t),...p}})}function Ct(o){if(!o||!Array.isArray(o.placements))return;try{if(!_.getState().ownsSceneGraph)return}catch{return}const l=w.getState(),u=l.productInstances||{},d=l.componentStates||{},p={...u},g={...d};let a=!1;if(!E()){for(const t of o.placements){const i=String(t.id??""),r=u[i];if(!r)continue;const s=t.variantId;s!=null&&(String(r.productId)===String(s)&&String(r.variantId??r.productId)===String(s)||(p[i]={...r,productId:s,variantId:s},g[i]&&(g[i]={}),a=!0))}a&&w.setState({productInstances:p,componentStates:g})}}function ot(o){if(!o||!Array.isArray(o.placements))return;try{if(!_.getState().ownsSceneGraph)return}catch{return}const u=w.getState().productInstances||{},d={};for(const t of o.placements){const i=String(t?.id??"");i&&(d[i]=t)}const p=t=>{const r=d[String(t?.id??"")]?.transform?.position?.[1];return typeof r=="number"&&r>0?r:null},g={...u};let a=!1;for(const[t,i]of Object.entries(u)){const r=p(i);if(r==null)continue;const s=Array.isArray(i.position)?i.position:[0,0,0];Math.abs((s[1]||0)-r)<1e-6||(g[t]={...i,position:[s[0]||0,r,s[2]||0]},a=!0)}a&&w.setState({productInstances:g})}function kt(o){if(!o||!Array.isArray(o.placements))return;const l=_.getState(),u=j.getState(),d=u.componentGroups||{},p=u.components||{},g={},a={},t=(s,e,c)=>{e!=null&&(s!=null&&(g[String(s)]={variantKey:e,isHandle:c}),a[String(e)]=c)};for(const s of Object.values(d)){const e=c=>(p[c]?.type??p[String(c)]?.type)==="handle";for(const[c,S]of Object.entries(s?.variants||{}))t(S,c,e(S));for(const c of Array.isArray(s?.members)?s.members:[]){const S=c?.componentId??c?.component_id;t(S,c?.variantKey??c?.variant_key,e(S))}}const i=(s,e)=>{const c=g[String(e)];return c||{variantKey:e,isHandle:a[String(e)]??!1}},r=K(u);for(const s of o.placements){const e=s.id;if(!e)continue;if(s.selections&&typeof s.selections=="object"){let h=s.selections;r!=null&&String(r)in h&&(h={...h},delete h[String(r)]),w.getState().setPlacementSelections?.(e,h)}if($(String(e)))continue;const c=s.overrides||{},S=c.materials;if(S&&typeof S=="object")for(const[h,O]of Object.entries(S))O!=null&&l.setHostMaterialOverride(e,h,O);const y=c.componentSlots||c.component_slots,n=[];if(y&&typeof y=="object"){const h=w.getState();for(const[O,x]of Object.entries(y)){if(x===null){n.push(O),h.setComponentSwap?.(e,O,null);continue}if(x===void 0)continue;h.setComponentSwap?.(e,O,x);const{variantKey:H,isHandle:T}=i(O,x);H!=null&&(T?l.setHostHandleType?.(e,H):l.setHostStyle?.(e,H))}}const f=c.visibility&&typeof c.visibility=="object"?{...c.visibility}:null,m=f||n.length?f||{}:null;for(const h of n)m[h]===void 0&&(m[h]=!1);const I=c.transforms||c.transform,b=c.hiddenComponentIds||c.hidden_component_ids,v=Array.isArray(b)&&b.length?b.map(Number):null;if(w.getState().setPlacementOverrides?.(e,{visibility:m,transforms:I&&typeof I=="object"?I:null,hiddenComponentIds:v}),m)for(const[h,O]of Object.entries(m))O===!1&&String(h).toLowerCase().includes("handle")&&l.setHostHandleType?.(e,"none")}nt(o),ot(o)}export{L as DEFAULT_PLACEMENT_GROUP,At as applyAddedPlacements,wt as applyInitialSelections,bt as applyMessages,ot as applyOwnedTransforms,tt as applyPresetPieceTrims,ht as applyRemovedPlacements,xt as applyResolvedPieceAdds,kt as applyResolvedToScene,Ht as applySceneConfigDefaults,nt as applyWallMountedPlacements,Pt as applyWarnings,It as buildCanonicalState,vt as dequeuePieceAdd,Q as getHostedProductSpawnSelections,mt as hostedProductPlacementId,jt as hydrateProductInstancesFromState,Y as isOverlayPlacementProduct,_t as queuePieceAdd,yt as resolveDeclaredPlacementGroup,St as resolveDefaultFloorPlacementGroup,Ct as syncOwnedInstanceVariants,Ot as wasPieceAddConsumed};
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
@layer sdk-base, vendor, sdk;
|
|
2
|
+
@layer sdk {
|
|
3
|
+
/* ============================================================================
|
|
4
|
+
ShowroomLayout (Theme 3) — clean product page: scene left (with floating corner
|
|
5
|
+
tools), white options panel right (product title + info + option groups with
|
|
6
|
+
swatch labels beneath). Bright, minimal, neutral. Self-contained.
|
|
7
|
+
============================================================================ */
|
|
8
|
+
|
|
9
|
+
.showroom-layout {
|
|
10
|
+
/* literal = fallback; a theme record's --color-* overrides it (§4). */
|
|
11
|
+
--sr-scene: var(--color-background, #d9d7d1); /* soft warm greige backdrop */
|
|
12
|
+
--sr-panel: var(--color-surface, #ffffff);
|
|
13
|
+
/* The literal ends the chain DELIBERATELY. This used to read
|
|
14
|
+
`var(--color-foreground, var(--text-primary, #1f1d1b))`, while the block below re-exports
|
|
15
|
+
`--text-primary: var(--sr-ink)` — a custom-property CYCLE whenever the theme ships no
|
|
16
|
+
`--color-foreground`. Both sides of a cycle compute to the guaranteed-invalid value, so
|
|
17
|
+
`background: var(--sr-ink)` fell back to transparent and the primary CTA rendered
|
|
18
|
+
pale-on-pale: present, sized, clickable, invisible. applyTheme writes --color-foreground and
|
|
19
|
+
--text-primary from the SAME source, so the hop bought nothing anyway. */
|
|
20
|
+
--sr-ink: var(--color-foreground, #1f1d1b);
|
|
21
|
+
--sr-ink-soft: var(--color-secondary, #8b8681);
|
|
22
|
+
--sr-line: var(--color-border, #ececea);
|
|
23
|
+
--sr-line-strong: var(--color-border, #dcdad6);
|
|
24
|
+
--sr-accent: var(--color-accent, #1f1d1b); /* calm near-black accent */
|
|
25
|
+
--sr-accent-soft: rgba(var(--text-primary-rgb, 31, 29, 27), 0.07);
|
|
26
|
+
|
|
27
|
+
/* Floating AI chat FAB → this theme's accent (matches the CTA colour). */
|
|
28
|
+
--shell-fab-bg: var(--sr-accent);
|
|
29
|
+
--shell-fab-bg-strong: var(--text-primary, #3a3733);
|
|
30
|
+
/* Mobile FAB clearance: this theme pins a Generate/Save footer bar at the bottom. */
|
|
31
|
+
--shell-fab-bottom-m: 112px;
|
|
32
|
+
|
|
33
|
+
/* embedded-Sidebar token remap */
|
|
34
|
+
--color-selection: var(--sr-ink);
|
|
35
|
+
--color-selection-rgb: 31, 29, 27;
|
|
36
|
+
--color-selection-light: var(--sr-accent-soft);
|
|
37
|
+
--color-selection-border: rgba(var(--text-primary-rgb, 31, 29, 27), 0.4);
|
|
38
|
+
--border-selected: var(--sr-ink);
|
|
39
|
+
--thumbnail-border-selected: var(--sr-ink);
|
|
40
|
+
--thumbnail-border-hover: var(--sr-ink);
|
|
41
|
+
--text-link: var(--sr-ink);
|
|
42
|
+
--icon-color-active: var(--sr-ink);
|
|
43
|
+
--color-neutral-900: var(--sr-ink);
|
|
44
|
+
--color-neutral-700: var(--sr-ink-soft);
|
|
45
|
+
--text-primary: var(--sr-ink);
|
|
46
|
+
--text-secondary: var(--sr-ink-soft);
|
|
47
|
+
--bg-scene: var(--sr-scene);
|
|
48
|
+
|
|
49
|
+
position: relative;
|
|
50
|
+
display: flex;
|
|
51
|
+
height: 100%;
|
|
52
|
+
overflow: hidden;
|
|
53
|
+
background: var(--sr-scene);
|
|
54
|
+
color: var(--sr-ink);
|
|
55
|
+
font-family: var(--font-family-base);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* ---------------------------------------------------------------------------------------------
|
|
59
|
+
THE SAME PALETTE ON A DARK PRESET.
|
|
60
|
+
|
|
61
|
+
Every literal above is a LIGHT-mode fallback, reached whenever the theme record ships no
|
|
62
|
+
`--color-*` — which the shared dark skin (styles/themes.css) never does: it remaps the generic
|
|
63
|
+
tokens (--text-primary, --bg-primary, --border-default …), not the --color-* family. So on a
|
|
64
|
+
dark preset this shell kept its near-black ink, and because the block above re-exports
|
|
65
|
+
`--text-primary: var(--<x>-ink)`, it also OVERWROTE the dark skin's light text for every
|
|
66
|
+
descendant. Anything mounted inside the shell that inherits its colour — the live-status
|
|
67
|
+
panel, the chat bar — rendered dark-on-dark: present, sized, unreadable.
|
|
68
|
+
|
|
69
|
+
Same failure mode as the --*-ink cycle documented above, reached by a different route, so the
|
|
70
|
+
repair is the same shape: end the chain in a literal, and let a theme's own --color-* still
|
|
71
|
+
win by keeping the var() in front of it.
|
|
72
|
+
--------------------------------------------------------------------------------------------- */
|
|
73
|
+
:root[data-theme-mode="dark"] .showroom-layout {
|
|
74
|
+
--sr-scene: var(--color-background, #17171a);
|
|
75
|
+
--sr-panel: var(--color-surface, #1e1e22);
|
|
76
|
+
--sr-ink: var(--color-foreground, #f2f2f4);
|
|
77
|
+
--sr-ink-soft: var(--color-secondary, #b8b8be);
|
|
78
|
+
--sr-line: var(--color-border, #34343a);
|
|
79
|
+
--sr-line-strong: var(--color-border, #44444c);
|
|
80
|
+
--sr-accent: var(--color-accent, #f2f2f4);
|
|
81
|
+
--sr-accent-soft: rgba(var(--text-primary-rgb, 242, 242, 244), 0.10);
|
|
82
|
+
--color-selection-rgb: 242, 242, 244;
|
|
83
|
+
--color-selection-border: rgba(var(--text-primary-rgb, 242, 242, 244), 0.4);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* The CTA paints ITS label on an ink ground, so inverting the ink has to invert the label too —
|
|
87
|
+
otherwise the primary action goes white-on-white, which is how this shell's CTA disappeared
|
|
88
|
+
once before. --text-inverse is the existing token for exactly this and the shared dark skin
|
|
89
|
+
already flips it; the light rule above keeps its own warm literal untouched. */
|
|
90
|
+
:root[data-theme-mode="dark"] .showroom-cta { color: var(--text-inverse, #1a1a1a); }
|
|
91
|
+
|
|
92
|
+
/* ---- Scene (left) ---- */
|
|
93
|
+
.showroom-scene { flex: 1 1 auto; min-width: 0; position: relative; overflow: hidden; background: var(--sr-scene); }
|
|
94
|
+
.showroom-scene .header__toolbar {
|
|
95
|
+
position: absolute; top: 20px; right: 24px; z-index: 4;
|
|
96
|
+
background: transparent; box-shadow: none; border-radius: 0; padding: 0; gap: 16px;
|
|
97
|
+
}
|
|
98
|
+
.showroom-scene .header__toolbar-btn {
|
|
99
|
+
width: 36px; height: 36px; border: none; border-radius: 50%;
|
|
100
|
+
background: rgba(255, 255, 255, 0.85); color: var(--sr-ink);
|
|
101
|
+
box-shadow: 0 2px 10px -3px rgba(var(--text-primary-rgb, 31, 29, 27), 0.25);
|
|
102
|
+
}
|
|
103
|
+
.showroom-scene .header__toolbar-btn:hover { background: #fff; color: #000; }
|
|
104
|
+
.showroom-scene .header__toolbar-btn--active { background: #fff; color: #000; box-shadow: 0 2px 10px -3px rgba(var(--text-primary-rgb, 31, 29, 27), 0.25); }
|
|
105
|
+
.showroom-scene .header__toolbar-btn svg { width: 18px; height: 18px; }
|
|
106
|
+
|
|
107
|
+
/* ---- Right product panel ---- */
|
|
108
|
+
.showroom-panel {
|
|
109
|
+
flex: 0 0 clamp(300px, 26vw, 380px);
|
|
110
|
+
display: flex;
|
|
111
|
+
flex-direction: column;
|
|
112
|
+
min-width: 0;
|
|
113
|
+
min-height: 0;
|
|
114
|
+
background: var(--sr-panel);
|
|
115
|
+
border-left: 1px solid var(--sr-line);
|
|
116
|
+
}
|
|
117
|
+
.showroom-head { flex: 0 0 auto; padding: 26px 24px 14px; }
|
|
118
|
+
.showroom-title { margin: 0 0 6px; font-size: 20px; font-weight: 700; color: var(--sr-ink); }
|
|
119
|
+
.showroom-info { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--sr-ink-soft); }
|
|
120
|
+
|
|
121
|
+
.showroom-body { flex: 1 1 auto; min-height: 0; min-width: 0; overflow-x: hidden; display: flex; flex-direction: column; }
|
|
122
|
+
.showroom-body .sidebar--embedded { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; width: 100%; background: transparent; }
|
|
123
|
+
.showroom-body .sidebar--embedded .sidebar__content { flex: 1 1 auto; overflow-y: auto; padding: 8px 22px 16px; }
|
|
124
|
+
.showroom-body .sidebar__section-title {
|
|
125
|
+
color: var(--sr-ink);
|
|
126
|
+
font-weight: 600;
|
|
127
|
+
letter-spacing: 0.4px;
|
|
128
|
+
text-transform: none;
|
|
129
|
+
font-size: 13px;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/* Card labels below (static), tidy swatch captions */
|
|
133
|
+
.showroom-body .finish-thumbnail__name::after,
|
|
134
|
+
.showroom-body .layout-thumbnail__label::after { display: none; }
|
|
135
|
+
.showroom-body .option-thumbnail--has-img {
|
|
136
|
+
aspect-ratio: auto; min-height: 0; padding: 0; display: flex; flex-direction: column; overflow: hidden;
|
|
137
|
+
}
|
|
138
|
+
.showroom-body .option-thumbnail--has-img .option-thumbnail__img {
|
|
139
|
+
width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 0;
|
|
140
|
+
}
|
|
141
|
+
.showroom-body .option-thumbnail__img-label,
|
|
142
|
+
.showroom-body .option-thumbnail__name,
|
|
143
|
+
.showroom-body .color-swatch__name {
|
|
144
|
+
position: static; opacity: 1; background: none; color: var(--sr-ink-soft);
|
|
145
|
+
text-shadow: none; font-size: 11px; font-weight: 500; line-height: 1.25; padding: 6px 2px 4px;
|
|
146
|
+
}
|
|
147
|
+
.showroom-body .finish-thumbnail__name {
|
|
148
|
+
position: static; transform: none; opacity: 1; visibility: visible; pointer-events: auto;
|
|
149
|
+
background: none; color: var(--sr-ink-soft); border-radius: 0; white-space: normal; box-shadow: none;
|
|
150
|
+
margin: 0; padding: 6px 2px 2px; font-size: 11px; font-weight: 500; line-height: 1.2;
|
|
151
|
+
}
|
|
152
|
+
.showroom-body .finish-thumbnail--selected .finish-thumbnail__name { color: var(--sr-ink); font-weight: 600; }
|
|
153
|
+
.showroom-body .layout-thumbnail { display: flex; flex-direction: column; }
|
|
154
|
+
.showroom-body .layout-thumbnail__label {
|
|
155
|
+
position: static; transform: none; opacity: 1; visibility: visible; pointer-events: auto;
|
|
156
|
+
background: none; color: var(--sr-ink-soft); border-radius: 0; white-space: normal; box-shadow: none;
|
|
157
|
+
margin: 0; padding: 6px 4px 0; font-size: 11px; font-weight: 500; text-align: center;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/* ---- Footer ---- */
|
|
161
|
+
.showroom-foot { flex: 0 0 auto; padding: 14px 22px 18px; border-top: 1px solid var(--sr-line); }
|
|
162
|
+
.showroom-foot__price { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
|
|
163
|
+
.showroom-foot__label { font-size: 11px; font-weight: 700; letter-spacing: 1px; color: var(--sr-ink-soft); }
|
|
164
|
+
.showroom-foot__value { font-size: 20px; font-weight: 700; color: var(--sr-ink); }
|
|
165
|
+
.showroom-foot__actions { display: flex; gap: 10px; }
|
|
166
|
+
.showroom-cta {
|
|
167
|
+
flex: 1;
|
|
168
|
+
display: inline-flex; align-items: center; justify-content: center; gap: 8px;
|
|
169
|
+
height: 46px; border: none; border-radius: 3px;
|
|
170
|
+
background: var(--sr-ink); color: #fff;
|
|
171
|
+
font-size: 12.5px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; cursor: pointer;
|
|
172
|
+
transition: background 0.15s;
|
|
173
|
+
}
|
|
174
|
+
.showroom-cta:hover { background: var(--text-primary, #3a3733); }
|
|
175
|
+
/* Icon-only square save (collapse the shared button's "Save" text with font-size:0) */
|
|
176
|
+
.showroom-save {
|
|
177
|
+
flex: 0 0 auto;
|
|
178
|
+
display: inline-flex; align-items: center; justify-content: center;
|
|
179
|
+
height: 46px; width: 46px; padding: 0;
|
|
180
|
+
border: 1px solid var(--sr-line-strong); border-radius: 3px; background: transparent;
|
|
181
|
+
color: var(--sr-ink-soft); font-size: 0; cursor: pointer;
|
|
182
|
+
}
|
|
183
|
+
.showroom-save:hover { border-color: var(--sr-ink); color: var(--sr-ink); }
|
|
184
|
+
.showroom-save .save-btn__icon { width: 17px; height: 17px; }
|
|
185
|
+
|
|
186
|
+
/* ============================================================================
|
|
187
|
+
MOBILE (≤768px) — reflow the scene-left / panel-right product page into a single
|
|
188
|
+
column: scene on top, the product panel (title + options + footer) below,
|
|
189
|
+
full-width and scrolling. No MainLayout fallback — the theme keeps its identity.
|
|
190
|
+
============================================================================ */
|
|
191
|
+
@media (max-width: 768px) {
|
|
192
|
+
.showroom-layout { flex-direction: column; }
|
|
193
|
+
.showroom-scene { flex: 0 0 46vh; min-height: 0; }
|
|
194
|
+
.showroom-panel {
|
|
195
|
+
flex: 1 1 auto;
|
|
196
|
+
width: 100%;
|
|
197
|
+
min-height: 0;
|
|
198
|
+
border-left: none;
|
|
199
|
+
border-top: 1px solid var(--sr-line);
|
|
200
|
+
}
|
|
201
|
+
.showroom-head { padding: 16px 18px 10px; }
|
|
202
|
+
.showroom-title { font-size: 18px; }
|
|
203
|
+
.showroom-body .sidebar--embedded .sidebar__content { padding: 8px 16px 14px; }
|
|
204
|
+
.showroom-foot { padding: 12px 16px 16px; }
|
|
205
|
+
.showroom-cta { height: 44px; }
|
|
206
|
+
.showroom-save { height: 44px; width: 44px; }
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Fragment as Z,jsx as d,jsxs as C}from"react/jsx-runtime";import{useMemo as $e,useRef as Ie,useEffect as ae,useSyncExternalStore as mt}from"react";import{HOSTED_PLACEMENT_ID_PREFIX as St}from"./23dc0ccf32.js";import"./4d7a0d1897.js";import"./ab6c80484f.js";import{subscribe as _t,getVersion as We,getPlacementBindings as Ve,getEffectiveSelections as ft,isOptionAvailable as Ke,isOptionVisible as bt,getPlacementOSAllowlist as yt}from"./817d930a49.js";import{ChevronLeft as Ce,LogoIcon as vt}from"./c5e990946e.js";import{useHasIcon as Pt}from"./09c4973968.js";import{getProductAllComponents as It,pieceKindOf as Ct}from"./9326c23506.js";import{isHostedProduct as Ot,isHostFloating as je}from"./061b81ad81.js";import"./87dcc12b65.js";import"./ee242c0099.js";import{applyFinishClick as Oe}from"./dc2a1a0e13.js";import kt from"./54f0fcf38b.js";import wt from"./c4790179f1.js";import{useSystemConfig as Tt,useSceneFeaturesReader as Ht}from"./6855e6a3b1.js";import{getCatalog as w,useCatalogMaps as Ft}from"./1458417bdb.js";import{useUIState as ze,useOptionGating as Nt,useHostedProductState as J,getUIState as ce,useUIRegion as Ge}from"./9840b9ce12.js";import{useCornerSlots as At,getBasePiecePositions as Dt,clearOverlapFlags as Lt,appendSceneHostedProduct as Rt}from"./367a479d3a.js";import{useSceneState as ke,getSceneState as we}from"./16a399703e.js";import{useSystem as Bt}from"./066fc9aa40.js";import{setSceneSelection as Ye,clearSceneSelection as Et,removeSceneInstance as xt,setSceneInstanceVariant as Ut,showInfo as Q,clearSceneLoading as Mt,clearPendingHostedProduct as $t,setPendingSlotPlacement as Wt,clearPendingSlotPlacement as Vt,clearDeferredHostedProductPlacement as Kt,deselect as jt}from"./2cafe3274b.js";import zt from"./6e2595aa36.js";import Gt from"./2990ba64d6.js";import Yt from"./6ba86aa3b8.js";import{selectOption as qt,selectProductOption as Xt}from"./dbd5ba1d07.js";import"./9526094bb7.js";import"./2774152dd2.js";import Jt from"./3fb3ab6757.js";import{resolveComponent as B,useComponentRegistry as Qt}from"./882bc739c8.js";import{SlotHost as qe}from"./73f7d65985.js";import{LayoutThumbnail as Zt,FinishThumbnail as en,OptionThumbnail as tn,AddProductToggle as nn,HostedProductThumbnail as sn}from"./c12c112c6f.js";import"./239b619005.css";let Te=null;function ji(){return Te||(Te=w().listHostedProducts()),Te}function Xe(E,ee,F){if(ee==null||!Array.isArray(E)||E.length===0)return null;const te=S=>S.value_product??S.valueProduct??S.value,ie=S=>S==null?null:F[S]||F[String(S)]||null,z=S=>String(S??"").toLowerCase().replace(/\s+/g," ").trim(),x=E.find(S=>{const N=te(S);return N!=null&&String(N)===String(ee)});if(x)return x;const u=ie(ee),ue=z(u?.name??u?.title);if(ue){const S=E.filter(N=>{const U=z(N.name??N.label??N.title);return U.length>0&&ue.includes(U)});if(S.length===1)return S[0]}const pe=u?u.productGraph??u.product_graph??null:null;if(pe!=null){const S=E.filter(N=>{const U=ie(te(N)),he=U?U.productGraph??U.product_graph??null:null;return he!=null&&String(he)===String(pe)});if(S.length===1)return S[0]}return null}function on({embedded:E=!1,optionSetIds:ee=null,filterFeatureIds:F=null,backHeader:te=!0}={}){F=ee??F;const ie=Pt("logo"),{confirmDialog:z,setConfirmDialog:x}=zt(),u=Yt(),ue=u.finishes,pe=u.widths,S=u.styles,N=u.handleTypes,U=u.hardwareFinishes,he=u.doorTypes,Je=u.productOverrides,Qe=u.materialOverrides,rn=u.materials,dn=u.freePieceTier,ln=u.freePieceWidthOption,an=u.setFinish,cn=u.setWidth,un=u.setStyle,pn=u.setHandleType,hn=u.setHardwareFinish,gn=u.setDoorType,mn=u.setProductOverride,Sn=u.setMaterialOverride,_n=u.setFreePieceTier,fn=u.setFreePieceWidthOption;Qt();const D=B("OptionSetSection",Jt),se=B("OptionThumbnail",tn),ge=B("FinishThumbnail",en),Ze=B("LayoutThumbnail",Zt),He=B("ChatBar",kt),et=B("HostedProductThumbnail",sn),tt=B("AddProductToggle",nn),me=B("ConfirmDialog",wt),{isMobile:nt,selectedFeatureId:G,selectedElementType:bn,isLayoutLoading:oe}=ze(),it=Ge("sidebar"),Fe=Ge("chat"),{selectedId:Se,locked:_e,instances:re,placementSelections:yn}=ke(),st=xt,ot=mt(_t,We,We),Ne=e=>{if(e==null)return null;const g=re?.[e];let r=Je?.[e]??g?.variantId??g?.productId??null;if(r==null&&String(e).endsWith("__host")){const i=w(),n=we(),o=String(e).replace(/__host$/,""),t=n.productInstances?.[o],s=i.getProduct?.(t?.variantId??t?.productId),a=s?.hostVariants??s?.host_variants,l=Array.isArray(a)?a.find(h=>h?.isDefault??h?.is_default)??a[0]:null;r=l?.hostVariantId??l?.host_variant_id??null}return r},{standalone:rt}=J(),{validCornerSlots:vn,wallCornerCount:Pn}=At(),{pending:fe}=J(),{pendingSlot:Ae}=J(),{placed:Y}=J(),{scene:dt,product:In,features:Cn,rulesReady:lt,rulesTriggerIndex:On}=Tt(),{name:at}=Bt(),{deferred:De}=J(),{occupiedSlots:kn}=J(),{pieceConfigSnapshot:wn}=ze(),Tn=e=>Y.some(g=>g.hostedProductId===e),de=Ie({}),T=Se!=null,f=Se??null;ae(()=>{G&&de.current[G]&&de.current[G].scrollIntoView({behavior:"smooth",block:"center"})},[G]);const Le=Ie(new Set);ae(()=>{const e=new Set((Y||[]).map(t=>t.id)),g=Le.current,r=[...e].filter(t=>!g.has(t)),i=[...g].filter(t=>!e.has(t));if(Le.current=e,r.length===0&&i.length===0||oe)return;const n=r,o=i.length>0;import("./a77b15c0d6.js").then(({placeHostedProduct:t,refreshCanonicalState:s})=>{n.forEach(a=>t(a)),o&&n.length===0&&s()}).catch(()=>{})},[Y,oe]),ae(()=>{if(!De)return;const e=setTimeout(()=>{ce().deferred&&(Kt(),Mt(),Q("Could not place the product \u2014 please try again"))},1e4);return()=>clearTimeout(e)},[De]);const{options:Re,materials:M,features:$}=Ft(),{activeSceneConfigId:be}=ke(),Be=Ht(),{sceneSelections:ct}=ke(),{disabled:Hn,hidden:ye,managedOptionSets:Fn,featureToOptions:Nn}=Nt(),W=$e(()=>be?Be(be):[],[be,Be,dt,ot]),An=$e(()=>{const e=W.find(n=>n.type==="layout_change"),g=W.filter(n=>n.type==="finish_change"),r=W.filter(n=>n.type==="load_new_product"),i=W.find(n=>n.type==="appliance_selection");return{layoutFeature:e,finishFeatures:g,productFeatures:r,appliancesFeature:i}},[W]),ut=Ie(new Map),pt=`${Object.keys($).length}_${Object.keys(Re).length}`;ae(()=>{ut.current.clear()},[pt]);const{getOptionsForFeature:O,getSelection:L,getEffectiveSelection:Dn,optionDisabledPropsFor:q,visibleOptions:X}=Gt(),le=qt,ht=(e,g)=>{const r=e?._hostedProductRecord||e;if(!r){Q("No product data.");return}const i=e?._hostedProductRecord?e:{id:r.id,name:r.name,isPlaced:Y?.some(o=>String(o.hostedProductId)===String(r.id)||String(o.hostedProductId)===String(r.optionId))||ce().standalone.some(o=>String(o.optionId)===String(r.optionId)||String(o.optionId)===String(r.id))};if(i.isPlaced){const o=we().productInstances,t=Object.values(o).find(s=>String(s.variantId??s.productId)===String(r.id));t&&import("./a77b15c0d6.js").then(({removeProduct:s})=>s(t.id)).then(s=>{s&&s.applied&&(st(t.id),Q(`${i.name} removed`))}).catch(()=>{});return}if(String(fe?.id)===String(r.id)||String(Ae?.productId)===String(r.id)){$t(),Vt();return}let n=r.modelUrl;if(!n&&r.id!=null&&(n=(It(r.id)||[]).find(t=>!!t.url)?.url||null),je(r)){const o=Dt(),t=Object.keys(o).filter(l=>Ct(l)==="base"&&o[l]?.position).sort((l,h)=>l.localeCompare(h,void 0,{numeric:!0}))[0];if(!t){Q(`Add a floor piece first \u2014 ${r.name} mounts above it.`);return}const s=o[t],a=`${St}${r.id}-${Date.now()}`;Rt({id:a,hostedProductId:r.id,name:r.name,modelUrl:n,position:[s.position[0],(s.position[1]||0)+1.5,s.position[2]],rotation:s.rotation||[0,0,0],scale:r.scale||[1,1,1],placement_type:"wall_mounted",replacedPiece:t}),Q(`${r.name} added`);return}Wt({productId:r.id,variantId:r.id,name:r.name??"product",compatibleGraphIds:Array.isArray(r.compatibleSlots)?r.compatibleSlots:Array.isArray(r.compatible_slots)?r.compatible_slots:[]}),Q(`Click a highlighted slot to place ${r.name}.`)},ve=()=>{jt(),Et()},Ee=e=>{const g=e?.feature_id??e?.id;let r=e?O(e)||[]:[];const i=T&&ye&&ye.size>0;let n=r.filter(t=>bt(g,t.id));i&&(n=n.filter(t=>!ye.has(String(t.id))));const o=n.map(t=>{const s=[t.value_product,t.valueProduct,typeof t.value=="number"?t.value:null].filter(c=>c!=null);let a=null,l=null;for(const c of s){const v=w().getHostedProduct(c);if(v){l=v,a=c;break}}l||(l={id:a??t.id,optionId:t.id,name:t.name||t.displayName||t.label||`Option ${t.id}`,thumbnail:t.thumbnail||t.thumbnailUrl||t.thumbnail_url||t.imageUrl||t.image_url||null,placement_type:"replace_full"});const h=l.optionId??l.option_id??l.id??t.id,b=rt?.some(c=>String(c.optionId)===String(h)||String(c.optionId)===String(l.id))||Y?.some(c=>String(c.hostedProductId)===String(h)||String(c.hostedProductId)===String(l.id))||Object.values(re||{}).some(c=>String(c.variantId??c.productId)===String(l.id));let y=!1;if(!b){const c=new Set((l.compatibleSlots??l.compatible_slots??[]).map(String)),v=w();y=je(l)?Object.keys(re||{}).length>0:c.size>0&&Object.values(re||{}).some(I=>{const K=v.getProduct?.(I.variantId)||v.getProduct?.(I.productId),R=K?.product_graph??K?.productGraph;return R!=null&&c.has(String(R))})}const A=!Ke(g,t.id),_=A||!b&&!y,m=A?"Not available":null;return{id:h,optId:t.id,name:l.name||String(h),thumbnail:l.thumbnail||l.thumbnailUrl||l.icon||null,description:l.description,isPlaced:b,isDisabled:_,disabledReason:m,canReplace:b,_hostedProductRecord:l}});return o.length===0?null:d(D,{title:e?.name?.toUpperCase()||"APPLIANCES",presentation:e?.presentation,gridClassName:"thumbnail-grid thumbnail-grid--hosted",beforeGrid:fe&&d("p",{className:"sidebar__hint",children:"Click on a highlighted slot in the scene to place the hostedProduct"}),children:o.map(t=>d(et,{hostedProduct:t,isSelected:fe?.id===t.id||String(Ae?.productId)===String(t.id),isPlaced:t.isPlaced,canReplace:t.canReplace,isDisabled:t.isDisabled,onClick:()=>ht(t,e)},t.optId??t.id))})},xe=(e,g)=>{if(!e)return null;const r=g||new Set;if(e.contentKind==="group"||Array.isArray(e.childOptionSetIds)&&e.childOptionSetIds.length>0){if(r.has(e.id))return null;const i=r.size;r.add(e.id);const n=w().features,o=e.childOptionSetIds&&e.childOptionSetIds.length?e.childOptionSetIds:n[e.id]?.childOptionSetIds||[],t=s=>{const a=n[s];if(!a)return null;let l=a.type;return(l==="layout_change"||l==="load_configuration")&&(l="layout_change"),{id:s,feature_id:s,name:a.name,type:l,contentKind:a.contentKind||"options",childOptionSetIds:a.childOptionSetIds||[],default_option_id:a.default_option_id??a.defaultOption,...a.presentation?{presentation:a.presentation}:{}}};return d(D,{labelKey:e.id,sectionRef:s=>de.current[e.id]=s,className:`sidebar__section sidebar__section--group ${G===e.id?"sidebar__section--highlighted":""}`,title:e.name?.toUpperCase(),presentation:e.presentation||"inline",flow:e.flow||"column",kind:"group",depth:i,children:o.map(s=>{const a=t(s);return a?d("div",{className:"sidebar__group-child",children:xe(a,r)},s):null})},e.id)}if(e.type==="layout_change")return d(D,{labelKey:e.id,sectionRef:i=>de.current[e.id]=i,className:`sidebar__section ${G===e.id?"sidebar__section--highlighted":""}`,title:e.name?.toUpperCase()||"LAYOUT",presentation:e.presentation,flow:e.flow,gridClassName:"thumbnail-grid thumbnail-grid--layout",children:X(e.id,O(e)).map(i=>d(Ze,{option:q(e.id,i).disabled?{...i,...q(e.id,i)}:i,isSelected:L(e.id)===i.id,onClick:()=>{if(L(e.id)===i.id)return;const n=ce(),o=n.initialPerPieceOverrides||{},t=(_,m)=>{if(_===m)return!1;const c=_||{},v=m||{},I=Object.keys(c),K=Object.keys(v);if(I.length!==K.length)return!0;for(const R of I)if(c[R]!==v[R])return!0;return!1},a=((_,m)=>{if(_===m)return!1;const c=_||[],v=m||[];if(c.length!==v.length)return!0;for(let I=0;I<c.length;I++)if(c[I]!==v[I])return!0;return!1})(Y,o.sceneHostedProducts)||t(n.hostFinishes,o.hostFinishes)||t(n.hostStyles,o.hostStyles)||t(n.hostHandleTypes,o.hostHandleTypes)||t(n.hostWidths,o.hostWidths)||t(n.hostDoorTypes,o.hostDoorTypes)||t(n.hostProductOverrides,o.hostProductOverrides)||t(n.hostHardwareFinishes,o.hostHardwareFinishes),l=o.sceneSelections||{},h=W.some(_=>{if(_.type==="layout_change")return!1;const m=ct[_.id];if(!m)return!1;const c=l[_.id];return c!==void 0?m!==c:_.default_option_id?m!==_.default_option_id:Re[m]?.value!==null}),b=!!n.initialPieceConfigSnapshot&&!!n.pieceConfigSnapshot&&n.pieceConfigSnapshot!==n.initialPieceConfigSnapshot,y=(n.disabledWalls||[]).length>0;a||h||b||y?x({title:"Change Layout",message:"You will lose the existing configuration. Do you want to continue?",confirmText:"Yes",cancelText:"No",onConfirm:()=>{Lt(),le(e.id,i.id)},onCancel:()=>{}}):le(e.id,i.id)}},i.id))},e.id);if(e.type==="load_new_product"){const i=O(e),n=w().products;if(i.some(t=>{const s=t.value_product??t.valueProduct??(typeof t.value=="number"?t.value:null)??(typeof t.value=="string"&&n[t.value]?t.value:null);return s!=null&&n[s]?.category==="island"}))return d(tt,{optionSet:e,getOptionsForSet:O,feature:e,getOptionsForFeature:O,getSelection:L,onSelectionChange:le},e.id)}if(e.type==="finish_change"&&!T){const i=O(e);if(i.length>0&&i.some(o=>!!M?.[o.value]))return d(D,{labelKey:e.id,title:e.name?.toUpperCase(),presentation:e.presentation,flow:e.flow,gridClassName:"thumbnail-grid thumbnail-grid--finish",children:X(e.id,i).map(o=>{const t=q(e.id,o);return d(ge,{option:t.disabled?{...o,...t}:o,material:M[o.value],isSelected:L(e.id)===o.id,onClick:()=>{le(e.id,o.id,e)}},o.id)})},e.id)}{const i=w().products,n=O(e);if(e.type==="appliance_selection"||n.some(t=>{const s=t.value_product??t.valueProduct;return s!=null&&Ot(i?.[s])}))return Ee(e)}if(e.type==="load_new_component"||e.type==="load_new_product"||e.type==="product_change"){let i=null;if((e.type==="load_new_product"||e.type==="product_change")&&T&&f!=null){const n=Ne(f),o=Xe(O(e),n,w().products);o&&(i=o.id)}return d(D,{labelKey:e.id,title:e.name?.toUpperCase(),presentation:e.presentation,flow:e.flow,gridClassName:"thumbnail-grid thumbnail-grid--options",children:X(e.id,O(e)).map(n=>{const o=!Ke(e.id,n.id);return d(se,{option:o?{...n,disabled:!0,disabledReason:o?"Not available":null}:n,isSelected:i!=null?String(i)===String(n.id):String(L(e.id))===String(n.id),onClick:()=>Xt(e,n)},n.id)})},e.id)}if(e.type==="appliance_selection")return Ee(e);if(e.type==="finish_change"&&!T)return d(D,{labelKey:e.id,title:e.name?.toUpperCase(),presentation:e.presentation,flow:e.flow,gridClassName:"thumbnail-grid thumbnail-grid--options",children:X(e.id,O(e)).map(i=>{const n=q(e.id,i);return d(se,{option:n.disabled?{...i,...n}:i,isSelected:L(e.id)===i.id,onClick:()=>{if(n.disabled)return;const o=$?.[e.id]||$?.[String(e.id)]||e;Oe({option:i,feature:{...e||{},...o},scope:T?"single":"all",pieceIndex:T?f:null}).scope||Ye(e.id,i.id)}},i.id)})},e.id);if(e.type==="finish_change"&&T){const i=O(e),n=i.length>0&&i.some(t=>!!M?.[t.value]),o=t=>{const s=$?.[e.id]||$?.[String(e.id)]||e;Oe({option:t,feature:{...e||{},...s},scope:T?"single":"all",pieceIndex:T?f:null}).scope||Ye(e.id,t.id)};return d(D,{labelKey:e.id,title:e.name?.toUpperCase(),presentation:e.presentation,flow:e.flow,gridClassName:`thumbnail-grid ${n?"thumbnail-grid--finish":"thumbnail-grid--options"}`,children:X(e.id,i).map(t=>{const s=q(e.id,t),a=s.disabled?{...t,...s}:t;return n?d(ge,{option:a,material:M[t.value],isSelected:L(e.id)===t.id,onClick:()=>{s.disabled||o(t)}},t.id):d(se,{option:a,isSelected:L(e.id)===t.id,onClick:()=>{s.disabled||o(t)}},t.id)})},e.id)}return null},ne=()=>C(Z,{children:[d(qe,{name:"sidebar-top",ctx:{placementId:f??null}}),(()=>{const e=(()=>{if(!(T&&f!=null))return null;const i=w(),n=we(),o=n.productInstances?.[f];let t=o?.variantId??o?.productId;if(t==null&&String(f).endsWith("__host")){const h=String(f).replace(/__host$/,""),b=n.productInstances?.[h],y=i.getProduct?.(b?.variantId??b?.productId),A=y?.hostVariants??y?.host_variants,_=Array.isArray(A)?A.find(m=>m?.isDefault??m?.is_default)??A[0]:null;t=_?.hostVariantId??_?.host_variant_id??null}t=t??ce().hostProductOverrides?.[f]??f;const s=i.getProduct?.(t)||i.getProduct?.(f),a=s?.optionSets||s?.features_configuration_ids||[];if(!Array.isArray(a)||a.length===0)return null;const l=new Set;for(const h of a){const b=h&&typeof h=="object"?h.optionSetId??h.option_set_id??h.id??h.feature_id:h;b!=null&&l.add(String(b))}return l})(),g=new Set,r=Array.isArray(F)?new Set(F.map(String)):null;return W.filter(i=>{const n=String(i?.feature_id??i?.id??"");return!n||g.has(n)||(g.add(n),r&&!r.has(n)&&!r.has(String(i?.id))&&!r.has(String(i?.feature_id)))?!1:i?.type==="finish_change"?!0:!(e&&!e.has(n)&&!e.has(String(i?.id))&&!e.has(String(i?.feature_id)))}).map(i=>d("div",{children:xe(i)},i.id))})(),d(qe,{name:"sidebar-bottom",ctx:{placementId:f??null}})]}),gt=()=>{const e=f,g=yt(e),r=[...Ve(e)].filter(t=>!g||g.includes(String(t.optionSetId))).sort((t,s)=>(t.sequence??0)-(s.sequence??0)),i=Array.isArray(F)?new Set(F.map(String)):null;let n=r;if(i){const t=r.filter(s=>i.has(String(s.optionSetId)));t.length>0&&(n=t)}const o=ft(e)||{};return!n.length&&!_e?null:C(Z,{children:[_e&&d("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"8px 12px",marginBottom:10,borderRadius:6,fontSize:13,background:"rgba(120,120,120,0.12)",borderLeft:"3px solid #888",color:"inherit"},children:"\u{1F512} This item is locked and can\u2019t be changed."}),d("div",{style:_e?{opacity:.5,pointerEvents:"none"}:void 0,children:n.map(t=>{const s=t.optionSetId,a=$[s]||$[String(s)]||{id:s,name:""},l=a.type,h={id:s,feature_id:s,name:a.name,options:a.options},b=new Set((t.available||[]).map(String)),y=O(h);if(!y.length)return null;const A=l==="load_new_product"||l==="product_change",_=/finish/i.test(String(l||"")),m=!A&&y.length>0&&(_?y.some(p=>!!M?.[p.value]):y.every(p=>!!M?.[p.value])),c=o[s]??o[String(s)]??t.default??null;let v=null;if(l==="load_new_product"||l==="product_change"){const p=Ne(e),H=Xe(y,p,w().products);H&&(v=H.id)}let I=null;if(m){const p=Qe?.[e]||{},H=new Set((a.material_targets??a.materialTargets??a.materials??[]).map(P=>String(P).toLowerCase())),k=new Set(Object.entries(p).filter(([P])=>H.size===0||H.has(String(P).toLowerCase())).map(([,P])=>String(P)));if(k.size>0){const P=y.find(j=>j.value!=null&&k.has(String(j.value)));P&&(I=P.id)}}const K=v??I??c,R=p=>{if(l&&/finish/i.test(String(l))){Oe({option:p,feature:a,scope:"single",pieceIndex:e});return}if(l==="load_new_product"){const k=p.value??p.valueText??p.value_text,P=w().products,j=k!=null?P[k]||P[String(k)]:null;j?.id!=null&&Ut(e,j.id)}const H=String(e).endsWith("__host")?String(e).replace(/__host$/,""):e;import("./a77b15c0d6.js").then(({selectOptionForProduct:k})=>k({placementId:H,optionSetId:s,optionId:p.id})).catch(()=>{})};return d(D,{labelKey:s,title:String(a.name||"").toUpperCase(),presentation:a.presentation,flow:a.flow,gridClassName:`thumbnail-grid ${m?"thumbnail-grid--finish":"thumbnail-grid--options"}`,children:X(s,y).map(p=>{const H=q(s,p),k=b.size>0&&!b.has(String(p.id)),P=H.disabled||k,j=H.disabledReason||(k?"Not available":null),Me=P?{...p,disabled:!0,disabledReason:j}:p;return m?d(ge,{option:Me,material:M[p.value],isSelected:String(K)===String(p.id),onClick:()=>{P||R(p)}},p.id):d(se,{option:Me,isSelected:String(K)===String(p.id),onClick:()=>{P||R(p)}},p.id)})},s)})})]})},V=Se!=null,Ue=V&&[...Ve(f)||[]].length>0,Pe=()=>Ue?gt()??ne():ne();return E?C("div",{className:"sidebar sidebar--embedded",style:oe?{opacity:.5,pointerEvents:"none"}:void 0,children:[V&&Ue&&te&&d("div",{className:"sidebar__mobile-header",children:C("button",{className:"sidebar__back-btn",onClick:ve,children:[d(Ce,{}),d("span",{children:"Selected"})]})}),d("div",{className:"sidebar__content",children:V?Pe():ne()}),d(me,{dialog:z,onClose:()=>x(null)})]}):it?nt?C(Z,{children:[V&&te&&d("div",{className:"sidebar__mobile-header",children:C("button",{className:"sidebar__back-btn",onClick:ve,children:[d(Ce,{}),d("span",{children:"Selected"})]})}),d("div",{className:"sidebar__content sidebar__content--mobile",children:V?Pe():ne()}),d(me,{dialog:z,onClose:()=>x(null)})]}):C(Z,{children:[C("div",{"data-sdk-overlay":!0,className:"sidebar-container",style:oe?{opacity:.5,pointerEvents:"none"}:void 0,children:[C("aside",{className:"sidebar sidebar--card",children:[d("div",{className:"sidebar__header",children:V?C("button",{className:"sidebar__back-btn",onClick:ve,children:[d(Ce,{}),d("span",{children:"Selected"})]}):C(Z,{children:[C("div",{className:"sidebar__logo",children:[ie?C(Z,{children:[d(vt,{className:"sidebar__logo-icon"}),d("span",{className:"sidebar__logo-divider"})]}):null,d("span",{className:"sidebar__logo-text",children:at||"Configurator"})]}),d("div",{className:"sidebar__header-actions"})]})}),d("div",{className:"sidebar__content",children:V?Pe():ne()})]}),Fe&&d("div",{className:"sidebar-chat-card",children:d(He,{})})]}),d(me,{dialog:z,onClose:()=>x(null)})]}):Fe?d("div",{"data-sdk-overlay":!0,className:"sidebar-container sidebar-container--chat-only",children:d("div",{className:"sidebar-chat-card",children:d(He,{})})}):null}var zi=on;export{zi as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import c from"./79a397bb92.js";import{markThemeReady as o}from"./066fc9aa40.js";let i=null,a=null;function s(t){if(!i||t==null||String(t)!==i.id)return null;const{data:e}=i;return i=null,e}function p(t){if(!a||t==null||String(t)!==a.id)return null;const{data:e}=a;return a=null,e}function d(){i=null,a=null}function f(t){return t!=null&&(typeof t=="number"||/^\d+$/.test(String(t)))}async function S(t){try{const e=new URLSearchParams(window.location.search);if(e.has("theme")){const{applySystemTheme:r}=await import("./5c9fd9201c.js");return r(e.get("theme")),o(),!0}}catch{}if(t==null)return!1;try{const e=await c.fetchSystem(t);if(!e)return!1;i={id:String(t),data:e};const r=e.themeId??e.theme_id??null,u=e.theme??e.themeKey??null;let n=null;if(f(r)){try{const l=await c.fetchTheme(r);l&&(a={id:String(r),data:l},n=l)}catch{}n==null&&(n=String(r))}else u&&(n=String(u).trim().toLowerCase());if(n!=null){const{applySystemTheme:l}=await import("./5c9fd9201c.js");l(n)}return o(),!0}catch{return!1}}export{d as _resetPrefetch,S as prepareTheme,s as takePrefetchedSystem,p as takePrefetchedTheme};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{create as fe}from"zustand";import{devtools as de}from"./52436e0169.js";import oe from"./79a397bb92.js";import{isHostThemeApplied as ie}from"./40d6aeb28c.js";import W from"./872c4302e0.js";import J from"./8f60e5059a.js";import X,{registerSelectionReconciler as pe}from"./d94df858ea.js";import"./9326c23506.js";import{isHostedProduct as le,isHostFloating as ae}from"./061b81ad81.js";import{setWatermarkFromBackend as ge}from"./d3cd7f1bc1.js";import{isOptionSetVisible as me}from"./817d930a49.js";const _e=["option_selected","option_deselected","variant_selected","variant_deselected","component_loaded","component_removed"];function ye(a){return a?.startsWith?.("option_")?{single:["triggerOption","trigger_option"],many:["triggerOptions","trigger_options"]}:a?.startsWith?.("variant_")?{single:["triggerVariant","trigger_variant"],many:["triggerVariants","trigger_variants"]}:a?.startsWith?.("component_")?{single:["triggerComponent","trigger_component"],many:["triggerComponents","trigger_components"]}:null}function ce(a,o){for(const e of o){const r=a?.[e];if(r!=null)return r}return null}function Se(a,o){const e=ye(o);if(!e)return[];const r=ce(a,e.single),l=ce(a,e.many),n=new Set;if(r!=null&&n.add(String(r)),Array.isArray(l))for(const p of l)p!=null&&n.add(String(p));return[...n]}function he(a){const o={};for(const e of _e)o[e]=new Map;if(!Array.isArray(a))return o;for(const e of a){const r=e.triggerType??e.trigger_type,l=o[r];if(!l)continue;const n=Se(e,r);for(const p of n)l.has(p)||l.set(p,[]),l.get(p).push(e)}for(const e of Object.values(o))for(const r of e.values())r.sort((l,n)=>(n.priority||0)-(l.priority||0));return o}let Z=null;function ve(a,o){const e=o?.[a]??o?.[String(a)]??{},r=e.type??e.kind??null,l=e.wall??e.location??null,n=e.position??e.corner??void 0;return{wall:l,type:r,...n?{position:n}:{}}}function be(a,o,e,r,l,n,p){if(!Array.isArray(e)||e.length===0)return{id:a,name:o,sceneOptionId:l??null,scene_option_id:l??null,optionSets:Array.isArray(r)?r:[],products:[],floatingHostedProducts:[]};const h=t=>typeof t!="string"?"":t.replace("_overlay","").replace("overlay_",""),g=[...e].sort((t,s)=>{const u=h(t?.placement_group||t?.placementGroup||""),c=h(s?.placement_group||s?.placementGroup||"");return u!==c?u.localeCompare(c):(t?.sequence??0)-(s?.sequence??0)}),P=t=>{const s=Array.isArray(t?.hostVariants)?t.hostVariants:Array.isArray(t?.host_variants)?t.host_variants:null;if(!Array.isArray(s)||s.length===0)return null;const u=s.find(c=>c?.isDefault??c?.is_default)||s[0];return u?.hostVariantId??u?.host_variant_id??null},f=g.map(t=>{let s=t.variant??t.variantId??t.product??t.productId,u=t.placement_group??t.placementGroup??null,c=null,_=!1,L=!1;const q=s;if(s!=null&&n){const j=n[s]||n[String(s)];if(j&&le(j))if(ae(j))_=!0;else{const d=P(j);if(d!=null){c=s,s=d;const w=n[d]||n[String(d)],N=w?.placement_group??w?.placementGroup;N!=null&&(u=N)}else c=s,L=!0,typeof u=="string"&&(u=u.replace("_overlay","").replace("overlay_",""))}}return{p:t,productId:s,placementGroup:u,autoLoadHostedProductId:c,dropPlacement:_,overlayHostedProduct:L}}),y=new Map;f.forEach((t,s)=>{if(t.dropPlacement||t.productId==null||t.autoLoadHostedProductId!=null)return;const u=String(t.productId);y.has(u)||y.set(u,s)}),f.forEach(t=>{if(t.dropPlacement||t.autoLoadHostedProductId==null)return;const s=y.get(String(t.productId));s!=null&&(f[s].autoLoadHostedProductId==null&&(f[s].autoLoadHostedProductId=t.autoLoadHostedProductId),t.dropPlacement=!0)});const S=f.map(t=>{if(t.dropPlacement)return null;const s=t.p,u=t.placementGroup,c=s.defaultTransform??s.default_transform??(s.position?{position:s.position,rotation:s.rotation,scale:s.scale}:null),_=ve(u,p);return{placement_id:s.id??s.placementId,product_id:t.productId,product_graph_id:s.product??s.productId??null,placement_group:u,sequence:s.sequence,default_transform:c,initial_options:s.options??s.initialOptions??s.initial_options??null,..._,...t.autoLoadHostedProductId!=null?{auto_load_appliance_product_id:t.autoLoadHostedProductId}:{},...t.overlayHostedProduct?{overlay_appliance:!0}:{}}}).filter(Boolean),T=t=>typeof t?.sequence=="number"?t.sequence:0;for(const t of["corner","wall_corner"]){const s=S.filter(u=>u.type===t&&(u.position==="back-right"||u.position==="back-left")).sort((u,c)=>T(u)-T(c));s.length>=2&&s.every(u=>u.position===s[0].position)&&(s[0].position="back-left",s[s.length-1].position="back-right")}for(const t of["corner","wall_corner"]){const s=S.filter(u=>u.type===t&&(u.position==="front-right"||u.position==="front-left")).sort((u,c)=>T(u)-T(c));s.length>=2&&s.every(u=>u.position===s[0].position)&&(s[0].position="front-left",s[s.length-1].position="front-right")}const F=t=>typeof t?.sequence=="number"?t.sequence:0,A=(t,s)=>{const u=S.find(c=>c.type===t&&c.position===s);return u!=null?F(u):null},K=[{rowType:"base",cornerType:"corner",backWall:"back"},{rowType:"upper",cornerType:"wall_corner",backWall:"back"}];for(const{rowType:t,cornerType:s,backWall:u}of K){const c=A(s,"back-left"),_=A(s,"back-right"),L=S.filter(d=>d.type===t&&d.wall===u).map(F),q=c!=null&&L.some(d=>d>c),j=_!=null&&L.some(d=>d<_);for(const d of S){if(d.type!==t||d.wall!==u)continue;const w=F(d);if(j&&w>_){d.wall="right";continue}if(q&&w<c){d.wall="left";continue}}}const V=f.filter(t=>{if(!t.dropPlacement)return!1;const s=t.p.variant??t.p.variantId??t.p.product??t.p.productId,u=n?.[s]||n?.[String(s)];return le(u)&&ae(u)}).map(t=>({placement_id:t.p.id??t.p.placementId,product_id:t.p.variant??t.p.variantId??t.p.product??t.p.productId,sequence:t.p.sequence}));return{id:a,name:o,sceneOptionId:l??null,scene_option_id:l??null,optionSets:r,products:S,floatingHostedProducts:V}}function Y(a){return a==null?null:typeof a=="object"?a.id??a.optionSetId??a.option_set_id??a.optionId??a.option_id??null:a}function Ie(a){if(!a)return{};const e=(Array.isArray(a.optionSets)?a.optionSets:[]).map(Y).filter(f=>f!=null),r=a.products||null,l=a.placement_groups??a.placementGroups??{},n={},p=(f,y,S,T,F=!1)=>{if(f==null)return;const A=be(f,y,S,e,T,r,l);A&&(A.useTransform=!!F,n[A.id]=A)},h=a.presets??a.layouts??null;if(h&&typeof h=="object"){const f=Array.isArray(h)?h.map(y=>[y?.id,y]):Object.entries(h);for(const[y,S]of f){const T=Array.isArray(S?.data)?S.data:Array.isArray(S?.placements)?S.placements:[];p(S?.id??y,S?.name??null,T,S?.sceneOptionId??S?.scene_option_id??S?.optionId??S?.option_id??null,S?.useTransform??S?.use_transform??!1)}if(Object.keys(n).length>0)return n}const g=a.defaultPreset??a.default_preset;if(g&&typeof g=="object"){const f=Array.isArray(g.placements)?g.placements:Array.isArray(g.data)?g.data:[];if(p(g.id??"default_layout",g.name??null,f,null,g.useTransform??g.use_transform??!1),Object.keys(n).length>0)return n}const P=Array.isArray(a.placements)?a.placements:[];if(P.length>0){const f=Y(g)??"default_layout";p(f,null,P,null,(g&&(g.useTransform??g.use_transform))??a.useTransform??a.use_transform??!1)}return Object.keys(n).length===0&&p(Y(g)??"default_layout",a.name??null,[],null,a.useTransform??a.use_transform??!1),n}function Oe(a,o,e,r,l){const n=a?.optionSets||[],p=a?.sceneOptionId||a?.scene_option_id,h=[];return n.forEach((g,P)=>{const f=e[g];if(!f)return;const y=f.type==="layout_change"||f.type==="load_configuration";let S=f.type;y&&(S="layout_change");const T=String(g),F=l&&l[T],A=y?p:F??f.default_option_id??f.defaultOption,K=o[String(g)],V=typeof K=="number"?K:P,t=r&&r[T];h.push({id:g,feature_id:g,...f.presentation?{presentation:f.presentation}:{},...f.flow?{flow:f.flow}:{},sequence:V,name:f.name,type:S,...f.role?{role:f.role}:{},...f.metadata?.role&&!f.role?{role:f.metadata.role}:{},contentKind:f.contentKind||"options",childOptionSetIds:f.childOptionSetIds||[],default_option_id:A,...Array.isArray(t)&&t.length>0?{options:t}:{}})}),h.sort((g,P)=>(g.sequence??0)-(P.sequence??0)),h}const ue=new WeakMap,ne=fe(de((a,o)=>({rules:[],rulesTriggerIndex:{option_selected:new Map,option_deselected:new Map,component_loaded:new Map,component_removed:new Map},productConfigurations:{},sceneConfigurations:{},originalSceneConfigurations:{},channels:{},constraints:[],systemRoom:null,placementStrategy:null,placementStrategyConfig:null,placementType:null,systemEnvironment:null,placementGroups:{},systemOptionSetSequence:{},systemOptionSetOptions:{},systemOptionSetDefault:{},systemId:null,systemName:null,systemConfiguratorKey:null,systemLayoutTemplate:null,systemQuoteTemplate:null,systemTheme:null,systemThemeRecord:null,useTransform:!1,catalogVersion:null,defaultPresetId:null,activeChannelId:"channel_internal",isLoading:!1,loadError:null,rulesReady:!1,loadConfigurations:async(e=null)=>{if(Z)return Z;const r=o();return r.sceneConfigurations&&Object.keys(r.sceneConfigurations).length>0?Promise.resolve():(Z=(async()=>{a({isLoading:!0,loadError:null});try{const l=W.getState().features,n=W.getState().products,p=W.getState().presets||{},h=W.getState().defaultPresetId,g=new URLSearchParams(window.location.search);let P=e??g.get("system")??null;if(!P)try{const v=await oe.fetchSystems(),i=Array.isArray(v)?v[0]:Object.values(v||{})[0];i?.id!=null&&(P=i.id)}catch{}let f=[],y=[],S=null,T=null,F=null,A=null,K={},V=[];const t={},s={},u={};let c=null,_=null,L=null,q=null,j=null,d=null,w=null,N=null,b=!1,m=null;if(P)try{const{takePrefetchedSystem:v}=await import("./be0cfe2236.js"),i=v(P)??await oe.fetchSystem(P),M=i.uiToggles??i.ui_toggles??null;if(M&&typeof M=="object")try{W.getState().mergeSystemUiToggles(M)}catch{}const z=i.watermarkEnabled??i.watermark_enabled;if(z!=null){try{ge(z)}catch{}try{W.setState({watermarkEnabled:z!==!1})}catch{}}f=i.rules??[],y=i.constraints??[],S=i.room??null,T=i.placementStrategy??i.placement_strategy??i.room?.placement_strategy??null,F=i.placementStrategyConfig??i.placement_strategy_config??i.room?.placement_strategy_config??null,L=i.name??null,q=i.configurator??i.configurator_key??i.configuratorKey??null,j=i.uiTemplate??i.ui_template??i.layoutTemplate??i.layout_template??null,j=j?String(j).trim().toLowerCase():null,d=i.quoteTemplate??i.quote_template??null;const I=i.themeId??i.theme_id??null,D=i.theme??i.themeKey??null;if(I!=null&&(typeof I=="number"||/^\d+$/.test(String(I)))){w=String(I);try{const{takePrefetchedTheme:C}=await import("./be0cfe2236.js"),R=C(I)??await oe.fetchTheme(I);R&&(N=R)}catch{}}else w=D?String(D).trim().toLowerCase():null;b=i.useTransform??i.use_transform??!1,_=i.catalogVersion??i.catalog_version??null,A=i.environment??null,m=i.placement_type??i.placementType??i.room?.placement_type??null,m=m?String(m).toLowerCase():null,K=i.placement_groups??i.placementGroups??{};const O=Array.isArray(i.optionSets)?i.optionSets:[];V=O.map(Y).filter(C=>C!=null);for(const C of O){if(!C||typeof C!="object")continue;const R=Y(C);if(R==null)continue;const Q=String(R),ee=C.sequence??C.seq??null;ee!=null&&(t[Q]=ee),Array.isArray(C.options)&&(s[Q]=C.options.map(H=>H&&typeof H=="object"?H.id??H.optionId:H).filter(H=>H!=null));const te=C.defaultOption??C.default_option??C.default_option_id;te!=null&&(u[Q]=te)}c=Y(i.defaultPreset??i.default_preset)}catch{}const k={},G=Ie({presets:p,defaultPreset:h,optionSets:V,products:n});for(const[v,i]of Object.entries(G))k[v]=i;let E=null;if(c!=null&&k[c])E=c;else if(h!=null&&k[h])E=h;else{const v=Object.keys(k)[0];v!=null&&(E=v)}const U={};for(const[v,i]of Object.entries(n)){const M=i.optionSets||i.features_configuration_ids||[],z=[],I={};let D=1;for(const O of M){const C=O&&typeof O=="object"&&!Array.isArray(O),R=C?O.optionSetId??O.option_set_id??O.id??O.feature_id:O;if(R==null)continue;const Q=l[R]||l[String(R)];if(!Q)continue;const ee=C?O.defaultOption??O.default_option??O.default_option_id:null,te=C&&O.sequence!=null?O.sequence:D++,H=ee??Q.default_option_id??Q.defaultOption,se=C&&Array.isArray(O.options)?O.options:null;z.push({feature_id:R,sequence:te,default_option_id:H,...se?{options:se}:{}}),H!=null&&(I[R]=H)}U[v]={...i,feature_sets:z,default_selections:I}}const B={};for(const[v,i]of Object.entries(k))B[v]={...i,scene_option_id:i.sceneOptionId||i.scene_option_id};const x=new Map;for(const v of f||[])v?.id!=null&&x.set(v.id,v);for(const v of Object.values(l||{}))for(const i of v?.rules||[])i?.id!=null&&!x.has(i.id)&&x.set(i.id,i);const $=W.getState().options||{};for(const[v,i]of Object.entries($))for(const M of i?.rules||[]){if(M?.id==null)continue;const I={...x.get(M.id)||{},...M},D=Number(v),O=Number.isFinite(D)&&String(D)===String(v)?D:v;I.triggerType==null&&I.trigger_type==null&&(I.triggerType="option_selected"),I.triggerOption==null&&I.trigger_option==null&&(!Array.isArray(I.triggerOptions)||I.triggerOptions.length===0)&&(!Array.isArray(I.trigger_options)||I.trigger_options.length===0)&&(I.triggerOption=O),x.set(M.id,I)}for(const[,v]of Object.entries(n||{}))for(const i of v?.rules||[])i?.id!=null&&!x.has(i.id)&&x.set(i.id,i);const re=[...x.values()];a({rules:re,rulesTriggerIndex:he(re),productConfigurations:U,sceneConfigurations:B,originalSceneConfigurations:B,constraints:y,systemRoom:S,placementStrategy:T,placementStrategyConfig:F,systemEnvironment:A,placementType:m,placementGroups:K,systemOptionSetSequence:t,systemOptionSetOptions:s,systemOptionSetDefault:u,systemId:P,systemName:L,systemConfiguratorKey:q,systemLayoutTemplate:j,systemQuoteTemplate:d,systemTheme:ie()?o().systemTheme:w,systemThemeRecord:ie()?o().systemThemeRecord:N,useTransform:b,catalogVersion:_,defaultPresetId:E,isLoading:!1}),a({rulesReady:!0})}catch(l){throw a({loadError:l.message,isLoading:!1,rulesReady:!1}),Z=null,l}})(),Z)},setActiveChannel:e=>{o().channels[e]&&a({activeChannelId:e})},syncSelectionsToSelectedVariant:()=>{const e=J.getState(),r=e.selectedPieceIndex;if(!r)return;const l=e.hostProductOverrides?.[r]??e.basePiecePositions?.[r]?.productId??null;if(l==null)return;const n=W.getState(),p=n.products||{},h=n.features||{},g=p[l]||p[String(l)];if(!g)return;const P=o().rulesTriggerIndex?.option_selected,f=new Set;for(const c of P?.values?.()||[])for(const _ of c){if((_.effectType??_.effect_type)!=="show_option")continue;const q=_.effectParams??_.effect_params??{},j=q.option_ids??q.optionIds;if(Array.isArray(j))for(const d of j)d!=null&&f.add(String(d));else{const d=_.effectOption??_.effect_option;d!=null&&f.add(String(d))}}const y=n.options||{},S=o().rules||[],T=g.product_graph??g.productGraph??g.parent_graph??g.parentGraph??null,F=T!=null?p[T]||p[String(T)]:null,A={};for(const c of F?.optionSets||[]){const _=c?.optionSetId??c?.option_set_id??c?.id??c?.feature_id;_!=null&&(A[String(_)]=c)}const K=g.optionSets||g.features_configuration_ids||[],V={},t=[];for(const c of K){const _=c?.optionSetId??c?.option_set_id??c?.id??c?.feature_id;if(_==null)continue;const L=h[_]||h[String(_)],q=L?.options||[];if(!q.some(b=>{const m=typeof b=="object"?b?.id:b;return m!=null&&f.has(String(m))}))continue;let d=null,w=null;const N=b=>{if(!b||typeof b!="object")return null;for(const[m,k]of Object.entries(b))if(String(k)===String(l))return m;return null};if(d=N(c?.valueProductOverrides??c?.value_product_overrides),d!=null&&(w="binding.vpo"),d==null){const b=A[String(_)];d=N(b?.valueProductOverrides??b?.value_product_overrides),d!=null&&(w="parentGraph.vpo")}if(d==null)for(const b of q){const m=typeof b=="object"?b?.id:b,k=y[m]||y[String(m)]||(typeof b=="object"?b:null),G=k?.value??k?.optionValue??k?.option_value;if(G!=null&&String(G)===String(l)){d=m,w="option.value";break}}if(d==null){const b=new Set(q.map(m=>String(typeof m=="object"?m?.id:m)));for(const m of S){const k=m.effectType??m.effect_type;if(k!=="load_product"&&k!=="swap_via_group")continue;const G=m.effectVariant??m.effect_variant,E=m.effectProduct??m.effect_product,U=m.effectParams??m.effect_params??{},B=U.variant_id??U.variantId??U.product_id??U.productId,x=G??E??B;if(x==null||String(x)!==String(l))continue;const $=m.triggerOption??m.trigger_option;if($!=null&&b.has(String($))){d=$,w="rule.lookup";break}}}if(d==null){const b=(g?.name||"").toLowerCase();if(b){let m=null,k=0;for(const G of q){const E=typeof G=="object"?G?.id:G,B=((y[E]?.name??y[String(E)]?.name??(typeof G=="object"?G?.name:null))||"").toLowerCase();B&&B.length>k&&b.includes(B)&&(m=E,k=B.length)}m!=null&&(d=m,w="name.match")}}d==null&&(d=c?.defaultOption??c?.default_option??c?.default_option_id??null,d!=null&&(w="binding.defaultOption")),t.push({osId:_,osName:L?.name,identityOpt:d,identitySource:w,bindingVpo:c?.valueProductOverrides??c?.value_product_overrides,parentVpo:A[String(_)]?.valueProductOverrides??A[String(_)]?.value_product_overrides,defaultOption:c?.defaultOption??c?.default_option}),d!=null&&(V[_]=d)}if(Object.keys(V).length===0)return;const s=X.getState().sceneSelections||{};let u=!1;for(const[c,_]of Object.entries(V))if(String(s[c])!==String(_)){u=!0;break}u&&X.setState({sceneSelections:{...s,...V}})},recomputeVisibilityForSelectedPiece:()=>{},getRule:e=>o().rules.find(r=>r.id===e),getProductConfiguration:e=>o().productConfigurations[e],getSceneConfiguration:e=>o().sceneConfigurations[e],getChannel:e=>o().channels[e],getFeaturesConfiguration:e=>o().featuresConfiguration[e],getAllSceneConfigurations:()=>Object.values(o().sceneConfigurations).sort((r,l)=>(r.sequence||0)-(l.sequence||0)),getActiveChannel:()=>o().channels[o().activeChannelId],getRulesForConfiguration:e=>{const r=o().productConfigurations[e];if(!r||!r.rules)return[];const l=o().rules;return r.rules.map(n=>l.find(p=>p.id===n)).filter(Boolean)},getRulesForSceneConfiguration:e=>{const r=o().sceneConfigurations[e];if(!r||!r.scene_rules)return[];const l=o().rules;return r.scene_rules.map(n=>l.find(p=>p.id===n)).filter(Boolean)},getProductConfigForChannel:(e,r=null)=>{const l=r||o().activeChannelId,n=o().productConfigurations[e];return n&&n.channel_id===l?n:Object.values(o().productConfigurations).find(h=>h.id===e&&h.channel_id===l)},getSceneConfigForChannel:(e,r=null)=>{const l=r||o().activeChannelId;return Object.values(o().sceneConfigurations).find(p=>p.scene_id===e&&p.channel_id===l)},getAvailableFeaturesForProduct:e=>{const r=o().getProductConfigForChannel(e),l=o().getActiveChannel();if(!r)return[];let n=[...r.feature_sets||[]];return l?.option_restrictions?.hidden_features&&(n=n.filter(p=>!l.option_restrictions.hidden_features.includes(p))),n},getDefaultSelections:e=>o().productConfigurations[e]?.default_selections||{},getSceneDefaultSelections:e=>o().sceneConfigurations[e]?.default_scene_selections||{},isFeatureAvailableInChannel:(e,r=null)=>{const l=o().channels[r||o().activeChannelId];return l?!l.option_restrictions?.hidden_features?.includes(e):!0},isOptionAvailableInChannel:(e,r=null)=>(o().channels[r||o().activeChannelId],!0),getChannelUIConfig:()=>o().getActiveChannel()?.ui_config||{},getChannelPermissions:()=>o().getActiveChannel()?.permissions||{},getChannelPriceConfig:()=>o().getActiveChannel()?.price_config||{multiplier:1,currency:"USD"},getAvailableChannels:()=>Object.values(o().channels).filter(e=>e.status==="active"),getSceneFeaturesForConfig:e=>{if(!e)return[];const r=ue.get(e);if(r)return r;const l=W.getState().features||{},n=o(),p=Oe(e,n.systemOptionSetSequence||{},l,n.systemOptionSetOptions||{},n.systemOptionSetDefault||{});return ue.set(e,p),p},getSceneFeatures:e=>{const r=o().sceneConfigurations[e];if(!r)return[];let l=o().getSceneFeaturesForConfig(r);return r.overrides?.hidden_scene_features&&(l=l.filter(n=>!r.overrides.hidden_scene_features.includes(n.id))),l.filter(n=>me(n?.id??n?.feature_id))},getSceneProducts:e=>o().sceneConfigurations[e]?.products||[]}),{name:"configuration-graph"}));{const a=()=>ne.getState().recomputeVisibilityForSelectedPiece(),o=()=>ne.getState().syncSelectionsToSelectedVariant();let e=J.getState().selectedPieceIndex,r=J.getState().hostProductOverrides;J.subscribe(n=>{(n.selectedPieceIndex!==e||n.hostProductOverrides!==r)&&(e=n.selectedPieceIndex,r=n.hostProductOverrides,o(),a())});let l=X.getState().sceneSelections;X.subscribe(n=>{n.sceneSelections!==l&&(l=n.sceneSelections,a())})}pe(()=>{const o=J.getState().hiddenOptions;if(!o||o.size===0)return;const e=X.getState(),r=e.sceneSelections||{},l=W.getState().features||{},n=e.setSceneSelection;for(const[p,h]of Object.entries(r)){if(h==null||!o.has(String(h))&&!o.has(h))continue;const f=((l[p]||l[String(p)])?.options||[]).map(y=>typeof y=="object"?y?.id:y).find(y=>y!=null&&!o.has(String(y))&&!o.has(y));if(f!=null&&String(f)!==String(h))try{n(p,f)}catch{}}});function xe(a){return ne.getState().getSceneFeaturesForConfig(a)}var Re=ne;export{Re as default,xe as deriveSceneFeatures};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Fragment as T,jsx as e,jsxs as p}from"react/jsx-runtime";import{useState as R,useMemo as Y,useRef as F,useEffect as H,useCallback as Z,memo as I}from"react";import E from"./8f60e5059a.js";import{resolveAssetUrl as tt}from"./cec035efb1.js";import et from"./872c4302e0.js";const at=s=>typeof s=="string"&&(s.startsWith("http")||s.startsWith("/")||s.startsWith("data:"));function A(s,a){const l=!s||typeof s!="string"?null:at(s)?s:`/${s}`;return tt(l,{kind:"thumbnail",...a})}function D(s){const[a,l]=R(!1),[b,h]=R(!1),[c,u]=R(0),f=F(0);H(()=>{l(!1),h(!1),u(0),f.current=0},[s]);const d=()=>{f.current<2?(f.current+=1,u(f.current)):l(!0)},m=()=>h(!0),g=Z(v=>{v&&v.complete&&v.naturalWidth>0&&h(!0)},[s]);return{imgError:a,imgLoaded:b,onError:d,onLoad:m,imgRef:g,imgKey:`${s}#${c}`}}function B(){return e("div",{className:"thumb-skeleton","aria-hidden":"true"})}const ot=I(function({option:a,isSelected:l,onClick:b}){const h=a.value||"l_shaped",c=A(a.thumbnail),{imgError:u,imgLoaded:f,onError:d,onLoad:m,imgRef:g,imgKey:v}=D(c),o=a.disabled;return p("div",{className:`layout-thumbnail ${l?"layout-thumbnail--selected":""} ${o?"layout-thumbnail--disabled":""}`,"data-part":"option-card",onClick:o?void 0:b,title:o?a.disabledReason||"Not available":a.name,"aria-disabled":o||void 0,children:[e("div",{className:"layout-thumbnail__scene",children:c&&!u?p(T,{children:[!f&&e(B,{}),e("img",{ref:g,src:c,alt:a.name,className:"layout-thumbnail__img",loading:"lazy",onLoad:m,onError:d,style:{opacity:f?1:0}},v)]}):p(T,{children:[e("div",{className:"layout-thumbnail__floor"}),e("div",{className:`layout-thumbnail__cabinets layout-thumbnail__cabinets--${h}`})]})}),e("span",{className:"layout-thumbnail__label",children:a.name})]})}),nt=I(function({option:a,material:l,isSelected:b,onClick:h}){const c=E(n=>n.showOptionLabels),u=a.thumbnail??l?.thumbnail??l?.thumbnailUrl??l?.thumbnail_url,f=l?.textures?.diffuse??l?.diffuseMap??l?.diffuse_map??l?.materialJson?.map,d=l?.color??l?.materialJson?.color??a.color??a.color_hex??a.metadata?.color_hex,m=(()=>{if(d==null)return"var(--border-dark, #cccccc)";if(typeof d=="number")return"#"+d.toString(16).padStart(6,"0");if(typeof d=="string"){const n=d.trim();return/^[0-9a-fA-F]{3}$/.test(n)||/^[0-9a-fA-F]{6}$/.test(n)?"#"+n:n}return"var(--border-dark, #cccccc)"})(),g=A(u)||A(f)||null,{imgError:v,imgLoaded:o,onError:r,onLoad:y,imgRef:N,imgKey:k}=D(g),C=`data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'><rect width='100' height='100' fill='${m}'/></svg>`)}`,i=a.disabled;return p("div",{className:`finish-thumbnail ${b?"finish-thumbnail--selected":""} ${i?"finish-thumbnail--disabled":""} ${c?"finish-thumbnail--show-labels":""}`,"data-part":"option-card",onClick:i?void 0:h,title:i?a.disabledReason||"Not available":a.name,"aria-disabled":i||void 0,children:[e("div",{className:"finish-thumbnail__preview",children:g&&!v?p(T,{children:[!o&&e(B,{}),e("img",{ref:N,src:g,alt:a.name,className:"finish-thumbnail__img",loading:"lazy",onLoad:y,onError:r,style:{opacity:o?1:0}},k)]}):e("img",{src:C,alt:a.name,className:"finish-thumbnail__img",draggable:!1})}),e("span",{className:"finish-thumbnail__name",children:a.name}),i&&e("div",{className:"finish-thumbnail__unavailable",children:a.disabledReason||"Not available"})]})}),ct=I(function({option:a,isSelected:l,onClick:b}){const h=a.disabled,c=A(a.thumbnail),{imgError:u,imgLoaded:f,onError:d,onLoad:m,imgRef:g,imgKey:v}=D(c),o=E(r=>r.showOptionLabels);return p("div",{className:`option-thumbnail ${l?"option-thumbnail--selected":""} ${h?"option-thumbnail--disabled":""} ${c&&!u?"option-thumbnail--has-img":""} ${o?"option-thumbnail--show-labels":""}`,"data-part":"option-card",onClick:h?void 0:b,title:h?a.disabledReason||"Coming soon":a.description||a.name,children:[c&&!u?p(T,{children:[!f&&e(B,{}),e("img",{ref:g,src:c,alt:a.name,className:"option-thumbnail__img",loading:"lazy",onLoad:m,onError:d,style:{opacity:f?1:0}},v),e("span",{className:"option-thumbnail__img-label",children:a.name})]}):e("div",{className:"option-thumbnail__content",children:e("span",{className:"option-thumbnail__name",children:a.name})}),h&&e("div",{className:"option-thumbnail__coming-soon",children:a.disabledReason||"Coming soon"})]})}),dt=I(function({widthOptions:a,currentWidth:l,defaultWidth:b,onSelect:h}){const c=Y(()=>[...a].sort((i,n)=>(i.value||0)-(n.value||0)),[a]),u=b||c[0]?.value,f=l||u,d=c.findIndex(i=>i.value===f),m=d>=0?d:0,g=F(null),v=F(null),o=F(h);o.current=h;const r=F(null),y=F(!1),N=F(-1);H(()=>()=>{r.current&&cancelAnimationFrame(r.current)},[]),H(()=>{!y.current&&g.current&&(g.current.value=m),k(m)},[m]);const k=i=>{if(!v.current||i===N.current)return;const n=v.current.children;N.current>=0&&N.current<n.length&&n[N.current].classList.remove("width-slider__tick--active"),i>=0&&i<n.length&&n[i].classList.add("width-slider__tick--active"),N.current=i},C=i=>{r.current&&cancelAnimationFrame(r.current),g.current&&(g.current.value=i),k(i);const n=c[i];n&&(r.current=requestAnimationFrame(()=>{r.current=null,o.current(n.value)}))};return e("div",{className:"width-slider",children:p("div",{className:"width-slider__track-wrapper",children:[e("input",{ref:g,type:"range",step:"any",min:0,max:c.length-1,defaultValue:m,onChange:i=>k(Math.round(parseFloat(i.target.value))),onPointerDown:i=>{y.current=!0,i.currentTarget.setPointerCapture(i.pointerId)},onPointerUp:i=>{if(!y.current)return;y.current=!1,i.currentTarget.releasePointerCapture(i.pointerId);const n=parseFloat(g.current?.value||0),$=Math.max(0,Math.min(Math.round(n),c.length-1));C($)},onTouchEnd:()=>{y.current=!1;const i=parseFloat(g.current?.value||0),n=Math.max(0,Math.min(Math.round(i),c.length-1));C(n)},className:"width-slider__input"}),e("div",{className:"width-slider__ticks",ref:v,children:c.map((i,n)=>p("span",{className:`width-slider__tick${n===m?" width-slider__tick--active":""}`,onClick:()=>C(n),children:[i.value,'"']},i.id||n))})]})})},(s,a)=>s.widthOptions===a.widthOptions&&s.currentWidth===a.currentWidth&&s.defaultWidth===a.defaultWidth);function ut({optionSet:s,getOptionsForSet:a,feature:l,getOptionsForFeature:b,getSelection:h,onSelectionChange:c}){l=s??l,b=a??b;const u=b(l),f=et(n=>n.products),d=n=>n!=null&&!!(f?.[n]||f?.[String(n)]),m=u.find(n=>!d(n.value)),g=u.find(n=>d(n.value)),v=h(l.id),o=v&&v!==m?.id,r=E(n=>n.freePieceTier),y=E(n=>n.setFreePieceTier),N=n=>{if(y(n),!o){const $=u.find(S=>S.tier===n)||g;c(l.id,$?.id)}},[k,C]=R({none:!1,standard:!1,large:!1}),i=n=>{C($=>({...$,[n]:!0}))};return p("div",{className:"sidebar__section",children:[e("h3",{className:"sidebar__section-title",children:"ISLAND"}),p("div",{className:"thumbnail-grid thumbnail-grid--3col",children:[p("button",{className:`option-thumbnail option-thumbnail--has-img${o?"":" option-thumbnail--selected"}`,onClick:()=>c(l.id,m?.id),children:[k.none?p("svg",{width:"100%",height:"100%",viewBox:"0 0 60 60",fill:"none",style:{display:"block"},children:[e("rect",{width:"60",height:"60",fill:"#F7F7F7"}),e("rect",{x:"12",y:"20",width:"36",height:"20",rx:"2",stroke:"#C4A882",strokeWidth:"1.5",strokeDasharray:"4 2"}),e("line",{x1:"18",y1:"26",x2:"42",y2:"34",stroke:"#C4A882",strokeWidth:"1.5"}),e("line",{x1:"42",y1:"26",x2:"18",y2:"34",stroke:"#C4A882",strokeWidth:"1.5"})]}):e("img",{src:"/assets/thumbnails/islands/none.svg",alt:"No Island",style:{width:"100%",height:"100%",display:"block",objectFit:"cover"},loading:"lazy",onError:()=>i("none")}),e("span",{className:"option-thumbnail__img-label",children:"No Island"})]}),p("button",{className:`option-thumbnail option-thumbnail--has-img${o&&r==="single"?" option-thumbnail--selected":""}`,onClick:()=>N("single"),children:[k.standard?p("svg",{width:"100%",height:"100%",viewBox:"0 0 60 60",fill:"none",style:{display:"block"},children:[e("rect",{width:"60",height:"60",fill:"#F7F7F7"}),e("rect",{x:"10",y:"12",width:"40",height:"36",rx:"2",fill:"#E8DED0",stroke:"#C4A882",strokeWidth:"1"}),e("line",{x1:"10",y1:"29",x2:"50",y2:"29",stroke:"#C4A882",strokeWidth:"0.5",strokeDasharray:"3 2"})]}):e("img",{src:"/assets/thumbnails/islands/standard.svg",alt:"Standard Island",style:{width:"100%",height:"100%",display:"block",objectFit:"cover"},loading:"lazy",onError:()=>i("standard")}),e("span",{className:"option-thumbnail__img-label",children:"Single"})]}),p("button",{className:`option-thumbnail option-thumbnail--has-img${o&&r==="double"?" option-thumbnail--selected":""}`,onClick:()=>N("double"),children:[k.large?p("svg",{width:"100%",height:"100%",viewBox:"0 0 60 60",fill:"none",style:{display:"block"},children:[e("rect",{width:"60",height:"60",fill:"#F7F7F7"}),e("rect",{x:"14",y:"8",width:"32",height:"18",rx:"2",fill:"#E8DED0",stroke:"#C4A882",strokeWidth:"1"}),e("rect",{x:"8",y:"34",width:"44",height:"18",rx:"2",fill:"#E8DED0",stroke:"#C4A882",strokeWidth:"1"})]}):e("img",{src:"/assets/thumbnails/islands/large.svg",alt:"Large Island",style:{width:"100%",height:"100%",display:"block",objectFit:"cover"},loading:"lazy",onError:()=>i("large")}),e("span",{className:"option-thumbnail__img-label",children:"Double"})]})]})]})}function ht({option:s,isSelected:a,onClick:l,disabled:b}){const h=s.value?.height,c=s.value?.width;let u;return h&&c?u=`${c}W x ${h}H`:h&&!c?u=`${h}H`:u=s.name,e("button",{className:`frame-size-btn ${a?"frame-size-btn--selected":""}`,onClick:l,disabled:b,title:s.description||s.name,style:b?{opacity:.4,cursor:"not-allowed"}:void 0,children:u})}function mt({option:s,isSelected:a,onClick:l}){const b=s.color_hex||s.metadata?.color_hex||"var(--border-dark, #cccccc)";return p("div",{className:`color-swatch ${a?"color-swatch--selected":""}`,onClick:l,title:s.name,children:[e("div",{className:"color-swatch__color",style:{backgroundColor:b}}),e("span",{className:"color-swatch__name",children:s.name})]})}const bt=I(function({hostedProduct:a,onClick:l,isSelected:b,isPlaced:h,canReplace:c,isDisabled:u,selectedPieceType:f}){const{name:d,icon:m,thumbnail:g}=a,v=a.hasNoSlots,o=a.hasNoCompatiblePieceInLayout,r=A(g),{imgError:y,onError:N,imgKey:k}=D(r),C=()=>{let n="hosted-product-thumbnail";return u?n+=" hosted-product-thumbnail--disabled":h?n+=" hosted-product-thumbnail--placed":b&&(n+=" hosted-product-thumbnail--selected"),r&&!y&&(n+=" hosted-product-thumbnail--has-img"),n},i=()=>v&&a.placement_type!=="replace_full"?`${d} - coming soon`:o?`No compatible piece for ${d} in the current layout`:u?`${d} is not compatible with this piece type`:h?`Click to remove ${d}`:b?`Click to cancel ${d} placement`:c?`Click to replace ${f} with ${d}`:`Click to place ${d}`;return p("div",{className:C(),onClick:u?null:l,title:i(),style:u?{cursor:"not-allowed"}:{},children:[r&&!y?e("img",{src:r,alt:d,className:"hosted-product-thumbnail__img",loading:"lazy",onError:N},k):m?e("div",{className:"hosted-product-thumbnail__icon",children:e(m,{})}):e("div",{className:"hosted-product-thumbnail__icon hosted-product-thumbnail__icon--placeholder","aria-hidden":"true"}),e("span",{className:"hosted-product-thumbnail__label",children:d}),h&&p("span",{className:"hosted-product-thumbnail__badge",children:[e("span",{className:"hosted-product-badge-placed",children:"Placed"}),e("span",{className:"hosted-product-badge-remove",children:"Remove"})]}),u&&e("span",{className:"hosted-product-thumbnail__badge hosted-product-thumbnail__badge--disabled",children:v?"Coming Soon":o?"Not in Layout":"Not Compatible"})]})}),gt=I(function({productFeatureSets:a,features:l,options:b,materials:h,currentSelections:c,hiddenOptions:u,managedOptionSets:f,featureToOptionsMap:d,disabledOptions:m,onSelect:g}){if(!Array.isArray(a)||a.length===0)return null;const v=[...a].sort((o,r)=>(o.sequence||0)-(r.sequence||0));return e(T,{children:v.map(o=>{const r=o.feature_id,y=l?.[r]||l?.[String(r)];if(!y)return null;const N=f&&(f.has(String(r))||f.has(r)),k=d&&(d[String(r)]||d[r]),C=N&&Array.isArray(k)&&k.length>0?k:(y.options||[]).map(t=>typeof t=="object"?t.id:t);let i;if(N?i=C:o.options&&o.options.length>0?i=o.options:C.length>0?i=C:o.default_option_id!=null?i=[o.default_option_id]:i=[],!i||i.length===0)return null;const n=t=>u&&(u.has(String(t))||u.has(t)),$=i.filter(t=>!n(t));let S;if($.length>0?S=$:o.options&&o.options.length>0?S=o.options:o.default_option_id!=null?S=[o.default_option_id]:S=N?[]:i,S.length===0)return null;const L=S.map(t=>b?.[t]||b?.[String(t)]).filter(Boolean);if(L.length===0)return null;const K=c?.[r]??c?.[String(r)],O=t=>typeof t=="string"&&(t.startsWith("http://")||t.startsWith("https://")||t.startsWith("/")||t.startsWith("data:")),j=h||{},W=t=>{if(!t)return null;const _=t.value;return _==null?null:j[_]||j[String(_)]||null},J=t=>{const _=W(t),w=t?.thumbnail??t?.thumbnailUrl??t?.thumbnail_url??_?.thumbnail??_?.thumbnailUrl??_?.thumbnail_url;return O(w)?w:null},q=t=>{const _=W(t);if(!_)return null;const w=_?.textures?.diffuse??_?.diffuseMap??_?.diffuse_map??_?.materialJson?.map;return O(w)?w:null},V=t=>{const _=W(t),w=_?.color??_?.materialJson?.color??t?.color??t?.color_hex??t?.metadata?.color_hex;if(w==null)return null;if(typeof w=="number")return"#"+w.toString(16).padStart(6,"0");if(typeof w=="string"){const x=w.trim();return/^[0-9a-fA-F]{3}$/.test(x)||/^[0-9a-fA-F]{6}$/.test(x)?"#"+x:x}return null},M=L.some(t=>!!J(t)||!!q(t)||!!V(t)),G=L.length>0&&L.some(t=>!!W(t)),Q=/finish/i.test(String(y?.type||""));return G||Q?p("div",{className:"sidebar__section",children:[e("h3",{className:"sidebar__section-title",children:y.name||String(r)}),e("div",{className:"thumbnail-grid thumbnail-grid--finish",children:L.map(t=>{const _=m&&(m.has(String(t.id))||m.has(t.id));return e(nt,{option:t,material:W(t),isSelected:String(t.id)===String(K),onClick:_?void 0:()=>g(r,t.id,t)},t.id)})})]},r):p("div",{className:"sidebar__section",children:[e("h3",{className:"sidebar__section-title",children:y.name||String(r)}),e("div",{className:`thumbnail-grid ${M?"thumbnail-grid--options":"thumbnail-grid--handle"}`,children:L.map(t=>{const _=J(t),w=_?null:q(t),x=!_&&!w?V(t):null,P=t.name||t.displayName||t.label||t.value||String(t.id),X=String(t.id)===String(K),z=m&&(m.has(String(t.id))||m.has(t.id)),U=_||w;return p("button",{type:"button",disabled:z,className:`option-thumbnail${X?" option-thumbnail--selected":""}${z?" option-thumbnail--disabled":""}`,onClick:z?void 0:()=>g(r,t.id,t),title:P,children:[U?e("img",{src:U,alt:P,className:"option-thumbnail__img",loading:"lazy"}):x?e("span",{className:"option-thumbnail__swatch",style:{backgroundColor:x,display:"block",width:"100%",height:"100%",borderRadius:4},"aria-hidden":"true"}):M?e("span",{className:"option-thumbnail__swatch",style:{backgroundColor:"var(--border-dark, #cccccc)",display:"block",width:"100%",height:"100%",borderRadius:4},"aria-hidden":"true"}):null,e("span",{className:U||x||M?"option-thumbnail__img-label":"option-thumbnail__name",children:P})]},t.id)})})]},r)})})});export{ut as AddProductToggle,mt as ColorSwatch,nt as FinishThumbnail,ht as FrameSizeButton,bt as HostedProductThumbnail,ot as LayoutThumbnail,ct as OptionThumbnail,gt as ProductFeaturePickers,dt as WidthSlider};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Fragment as M,jsx as c,jsxs as R}from"react/jsx-runtime";import{useRef as i,useEffect as w}from"react";import{TransformControls as m}from"@react-three/drei";function E({selected:g,position:f,rotationY:u=0,mode:t="translate",disabled:p=!1,onCommit:l,children:h}){const o=i(),e=i();return w(()=>{const n=e.current;if(!n)return;const a=d=>{if(!d.value&&o.current){const r=o.current,s=r.quaternion,v=2*Math.atan2(s.y,s.w);l?.({position:[r.position.x,0,r.position.z],rotationY:v})}};return n.addEventListener("dragging-changed",a),()=>n.removeEventListener("dragging-changed",a)}),R(M,{children:[c("group",{ref:o,position:f,rotation:[0,u,0],children:h}),g&&!p&&c(m,{ref:e,object:o,mode:t,showX:t==="translate",showZ:t==="translate",showY:t==="rotate",rotationSnap:Math.PI/2,size:.8})]})}export{E as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getConfigState as f}from"./817d930a49.js";const a=Math.PI/180,s=t=>Array.isArray(t)&&t.length===3&&t.every(n=>Number.isFinite(Number(n))),c=t=>s(t)?[t[0]*a,t[1]*a,t[2]*a]:null,p=(t,n)=>[Number(t?.[0]||0)+Number(n?.[0]||0),Number(t?.[1]||0)+Number(n?.[1]||0),Number(t?.[2]||0)+Number(n?.[2]||0)];function b(t){if(t==null)return null;const n=f();return(Array.isArray(n?.placements)?n.placements:[]).find(i=>String(i.id)===String(t))?.overrides??null}function g(t,n){if(!n)return null;const e=b(t);if(!e)return null;const r=e.transforms?.[n],i=e.visibility?.[n],l=e.materials?.[n],o={};return r&&typeof r=="object"&&(o.transform=r),(i===!1||i===!0)&&(o.visible=i),l!=null&&(o.materialId=l),Object.keys(o).length>0?o:null}function N(t,n,e={}){const r=s(t?.position)?t.position:[0,0,0],i=c(t?.orientation)||[0,0,0],l=s(e?.scale)?e.scale:[1,1,1],o=s(n?.position_delta)?p(r,n.position_delta):r,u=s(n?.rotation)?c(n.rotation):i,m=s(n?.scale)?n.scale:l;return{position:o,rotation:u,scale:m}}function y(t,n){return t?.hiddenLocally===!0?!1:n?.visible!==!1}function _(t,n){return n?.materialId!=null?n.materialId:t?.materialId??null}export{b as getPlacementOverrides,g as getSlotOverride,_ as resolveComponentMaterial,N as resolveComponentTransform,y as resolveComponentVisibility};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as i from"three";import m from"./872c4302e0.js";const h=new Map,f=new Map,M=new Map,y=new i.TextureLoader;let g=!1;function L(e){g=e}function R(e){if(!g||!e)return e;const t=e.lastIndexOf(".");return t===-1?e:e.slice(0,t)+"_mobile"+e.slice(t)}function C(e){if(e==null)return null;if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e!="string")return null;const t=e.trim().replace(/^#/,"");if(/^[0-9a-fA-F]{3}$/.test(t)){const n=t[0],r=t[1],a=t[2];return parseInt(n+n+r+r+a+a,16)}return/^[0-9a-fA-F]{6}$/.test(t)?parseInt(t,16):/^[0-9a-fA-F]{8}$/.test(t)?parseInt(t.slice(0,6),16):null}function w(e){if(!e||typeof e!="object")return e;const t=["color","emissive","specular","sheenColor","attenuationColor"];let n=null;for(const r of t){if(e[r]===void 0)continue;const a=C(e[r]);a!=null&&a!==e[r]&&(n||(n={...e}),n[r]=a)}return n||e}function d(e){if(e==null)return new i.Color(16777215);if(typeof e=="number")return new i.Color(e);if(typeof e=="string"){const t=e.trim();return/^[0-9a-fA-F]{3}$/.test(t)||/^[0-9a-fA-F]{6}$/.test(t)?new i.Color("#"+t):/^[0-9a-fA-F]{8}$/.test(t)?new i.Color("#"+t.slice(0,6)):new i.Color(t)}return new i.Color(16777215)}function I(e,t){return new Promise(n=>{y.load(encodeURI(e),r=>{r.colorSpace=i.SRGBColorSpace,r.wrapS=i.RepeatWrapping,r.wrapT=i.RepeatWrapping,n(r)},void 0,()=>{t&&t!==e?y.load(encodeURI(t),r=>{r.colorSpace=i.SRGBColorSpace,r.wrapS=i.RepeatWrapping,r.wrapT=i.RepeatWrapping,n(r)},void 0,()=>n(null)):n(null)})})}async function b(e){if(h.has(e))return h.get(e);try{const t=await fetch(encodeURI(e));if(!t.ok)throw new Error(`Failed to fetch ${e}`);const n=await t.json();return h.set(e,n),n}catch{return null}}const T={diffuse:{slot:"map",space:i.SRGBColorSpace},albedo:{slot:"map",space:i.SRGBColorSpace},normal:{slot:"normalMap",space:i.LinearSRGBColorSpace},roughness:{slot:"roughnessMap",space:i.LinearSRGBColorSpace},ao:{slot:"aoMap",space:i.LinearSRGBColorSpace},metalness:{slot:"metalnessMap",space:i.LinearSRGBColorSpace},emissive:{slot:"emissiveMap",space:i.SRGBColorSpace},map:{slot:"map",space:i.SRGBColorSpace},albedoMap:{slot:"map",space:i.SRGBColorSpace},normalMap:{slot:"normalMap",space:i.LinearSRGBColorSpace},roughnessMap:{slot:"roughnessMap",space:i.LinearSRGBColorSpace},metalnessMap:{slot:"metalnessMap",space:i.LinearSRGBColorSpace},aoMap:{slot:"aoMap",space:i.LinearSRGBColorSpace},emissiveMap:{slot:"emissiveMap",space:i.SRGBColorSpace}};function B(e){const t={};let n=!1;if(e.color!==void 0&&(t.color=d(e.color)),e.roughness!==void 0&&(t.roughness=e.roughness),e.metalness!==void 0&&(t.metalness=e.metalness),e.emissive!==void 0&&(t.emissive=d(e.emissive)),e.envMapIntensity!==void 0&&(t.envMapIntensity=e.envMapIntensity),e.sheen!==void 0&&e.sheen>0&&(t.sheen=e.sheen,n=!0),e.sheenColor!==void 0&&e.sheenColor!==0&&(t.sheenColor=d(e.sheenColor),n=!0),e.sheenRoughness!==void 0&&e.sheenRoughness!==1&&(t.sheenRoughness=e.sheenRoughness,n=!0),e.clearcoat!==void 0&&e.clearcoat>0&&(t.clearcoat=e.clearcoat,n=!0),e.clearcoatRoughness!==void 0&&e.clearcoatRoughness>0&&(t.clearcoatRoughness=e.clearcoatRoughness,n=!0),e.transmission!==void 0&&e.transmission>0&&(t.transmission=e.transmission,n=!0),e.thickness!==void 0&&e.thickness>0&&(t.thickness=e.thickness,n=!0),e.attenuationColor!==void 0&&e.attenuationColor!==16777215&&(t.attenuationColor=d(e.attenuationColor),n=!0),e.iridescence!==void 0&&e.iridescence>0&&(t.iridescence=e.iridescence,n=!0),e.iridescenceIOR!==void 0&&e.iridescenceIOR!==1.3&&(t.iridescenceIOR=e.iridescenceIOR,n=!0),e.iridescenceThicknessRange!==void 0){const r=e.iridescenceThicknessRange;(r[0]!==100||r[1]!==400)&&(t.iridescenceThicknessRange=r,n=!0)}if(e.specularIntensity!==void 0&&e.specularIntensity!==1&&(t.specularIntensity=e.specularIntensity,n=!0),e.specularColor!==void 0&&e.specularColor!==16777215&&(t.specularColor=d(e.specularColor),n=!0),e.reflectivity!==void 0&&e.reflectivity!==.5&&(t.reflectivity=e.reflectivity,n=!0),e.anisotropy!==void 0&&e.anisotropy!==0&&(t.anisotropy=e.anisotropy,n=!0),e.anisotropyRotation!==void 0&&e.anisotropyRotation!==0&&(t.anisotropyRotation=e.anisotropyRotation,n=!0),e.side!==void 0){const r={0:i.FrontSide,1:i.BackSide,2:i.DoubleSide};t.side=r[e.side]??i.FrontSide}return{params:t,needsPhysical:n}}async function G(e){if(!e)return null;const t=e.id;if(t!=null&&f.has(t))return f.get(t);let n=null,r=[1,1];if(e.materialJson)try{let a=w(e.materialJson);a.type||(a={...a,type:"MeshPhysicalMaterial"}),n=new i.MaterialLoader().parse(a),Array.isArray(e.materialJson.tiling)&&(r=e.materialJson.tiling)}catch{}if(!n&&e.materialFile){const a=await b(e.materialFile);if(a){const{params:c,needsPhysical:o}=B(a);Array.isArray(a.tiling)&&(r=a.tiling),n=o?new i.MeshPhysicalMaterial(c):new i.MeshStandardMaterial(c)}}if(!n&&(e.color!=null||e.roughness!=null||e.metalness!=null)){const a={};e.color!=null&&(a.color=d(e.color)),e.roughness!=null&&(a.roughness=e.roughness),e.metalness!=null&&(a.metalness=e.metalness),n=new i.MeshStandardMaterial(a)}if(!n&&e.textures&&(n=new i.MeshStandardMaterial),!n)return null;if(e.textures&&typeof e.textures=="object"){const a=[];for(const[c,o]of Object.entries(e.textures)){const l=T[c];if(!l||!o)continue;const u=String(o);a.push(I(R(u),u).then(s=>{s&&(s.colorSpace=l.space,s.repeat.set(r[0],r[1]),n[l.slot]=s)}))}await Promise.all(a),n.needsUpdate=!0}if(Array.isArray(r)&&(r[0]!==1||r[1]!==1)){const a=["map","normalMap","roughnessMap","metalnessMap","aoMap","emissiveMap","bumpMap","displacementMap","alphaMap"];for(const c of a){const o=n[c];o&&(o.wrapS=i.RepeatWrapping,o.wrapT=i.RepeatWrapping,o.repeat.set(r[0],r[1]),o.needsUpdate=!0)}n.needsUpdate=!0}return t!=null&&f.set(t,n),n}function F(e){return e?!!(e.materialJson||e.materialFile||e.textures||e.color!=null||e.roughness!=null||e.metalness!=null):!1}function P(e){return!e||!e.id?null:f.get(e.id)||null}function A(e){const t=m.getState().materials,n=m.getState().options;if(!t)return;const r=new Set,a=["cabinet_finish","hardware_finish","countertop_finish"];a.forEach(s=>{const p=e?.[s]&&n[e[s]]?.value;p&&r.add(p)}),e?.products?.forEach(s=>{a.forEach(p=>{const S=s[p]&&n[s[p]]?.value;S&&r.add(S)})});const c=Object.values(t).filter(F),o=c.filter(s=>r.has(s.id)),l=c.filter(s=>!r.has(s.id)),u=s=>G(s).catch(p=>null);Promise.all(o.map(u)).then(()=>{l.length>0&&Promise.all(l.map(u))})}function $({color:e="#ffffff",roughness:t=.7,metalness:n=0,side:r}={}){const c=`${String(e).toLowerCase()}|${t}|${n}|${r??"def"}`,o=M.get(c);if(o)return o;const l={color:e,roughness:t,metalness:n};r!=null&&(l.side=r);const u=new i.MeshStandardMaterial(l);return M.set(c,u),u}function E(){f.forEach(e=>e.dispose()),f.clear(),h.clear(),M.forEach(e=>e.dispose()),M.clear()}export{E as clearMaterialCache,P as getCachedMaterial,$ as getFlatMaterial,F as isPhysicalMaterial,G as loadPhysicalMaterial,A as preloadMaterials,L as setUseMobileTextures};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Fragment as c,jsx as t,jsxs as e}from"react/jsx-runtime";import s from"./d566d3874b.js";import r from"./fe68b361ba.js";import{InfoIcon as a}from"./c5e990946e.js";function l({dialog:n,onClose:o}){if(!n)return null;const i=()=>{n.onCancel?.(),o()},m=()=>{n.onConfirm?.(),o()};return e(s,{isOpen:!!n,onClose:i,title:n.title||"Confirm",size:"small",footer:e(c,{children:[!n.singleButton&&t(r,{variant:"outline",size:"medium",onClick:i,children:n.cancelText||"No"}),t(r,{variant:"primary",size:"medium",onClick:m,children:n.confirmText||"Yes, Replace"})]}),children:[t("p",{style:{fontSize:"var(--font-size-md)",color:"var(--text-secondary)",lineHeight:1.5,margin:0},children:n.message}),n.hint&&e("p",{className:"dialog-hint",children:[t("span",{className:"dialog-hint__icon",children:t(a,{})}),n.hint]})]})}export{l as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as n,jsxs as r}from"react/jsx-runtime";import{useIcon as t}from"./09c4973968.js";function i({className:o,...e}){return n("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:o,...e,children:n("path",{d:"M15 6l-6 6 6 6"})})}function c({className:o,...e}){return n("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:o,...e,children:n("path",{d:"M9 6l6 6-6 6"})})}function s({className:o,...e}){return n("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:o,...e,children:n("path",{d:"M18 6L6 18M6 6l12 12"})})}function l({className:o,...e}){return n("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:o,...e,children:n("path",{d:"M12 5v14M5 12h14"})})}function u(){return null}function a({className:o,...e}){return n("svg",{viewBox:"0 0 16 16",fill:"none",className:o,...e,children:n("path",{d:"M5.668 12.6666V11.3333H10.401C11.101 11.3333 11.71 11.1111 12.226 10.6666C12.743 10.2222 13.001 9.6666 13.001 9C13.001 8.3333 12.743 7.7777 12.226 7.3333C11.71 6.8888 11.101 6.6666 10.401 6.6666H6.201L7.935 8.4L7.001 9.3333L3.668 6L7.001 2.6666L7.935 3.6L6.201 5.3333H10.401C11.479 5.3333 12.404 5.6833 13.176 6.3833C13.949 7.0833 14.335 7.9555 14.335 9C14.335 10.0444 13.949 10.9166 13.176 11.6166C12.404 12.3166 11.479 12.6666 10.401 12.6666H5.668Z",fill:"currentColor"})})}function x({className:o,...e}){return n("svg",{viewBox:"0 0 16 16",fill:"none",className:o,...e,children:n("path",{d:"M5.601 12.6666C4.524 12.6666 3.599 12.3166 2.826 11.6166C2.054 10.9166 1.668 10.0444 1.668 9C1.668 7.9555 2.054 7.0833 2.826 6.3833C3.599 5.6833 4.524 5.3333 5.601 5.3333H9.801L8.068 3.6L9.001 2.6666L12.335 6L9.001 9.3333L8.068 8.4L9.801 6.6666H5.601C4.901 6.6666 4.293 6.8888 3.776 7.3333C3.26 7.7777 3.001 8.3333 3.001 9C3.001 9.6666 3.26 10.2222 3.776 10.6666C4.293 11.1111 4.901 11.3333 5.601 11.3333H10.335V12.6666H5.601Z",fill:"currentColor"})})}function v({className:o,...e}){return n("svg",{viewBox:"0 0 16 16",fill:"none",className:o,...e,children:n("path",{d:"M9.035 13.3333C7.546 13.3333 6.279 12.8166 5.235 11.7833C4.19 10.75 3.668 9.4888 3.668 8V7.8833L2.601 8.95L1.668 8.0166L4.335 5.35L7.001 8.0166L6.068 8.95L5.001 7.8833V8C5.001 9.1111 5.393 10.0555 6.176 10.8333C6.96 11.6111 7.912 12 9.035 12C9.324 12 9.607 11.9666 9.885 11.9C10.162 11.8333 10.435 11.7333 10.701 11.6L11.701 12.6C11.279 12.8444 10.846 13.0277 10.401 13.15C9.957 13.2722 9.501 13.3333 9.035 13.3333ZM13.668 10.65L11.001 7.9833L11.935 7.05L13.001 8.1166V8C13.001 6.8888 12.61 5.9444 11.826 5.1666C11.043 4.3888 10.09 4 8.968 4C8.679 4 8.396 4.0333 8.118 4.1C7.84 4.1666 7.568 4.2666 7.301 4.4L6.301 3.4C6.724 3.1555 7.157 2.9722 7.601 2.85C8.046 2.7277 8.501 2.6666 8.968 2.6666C10.457 2.6666 11.724 3.1833 12.768 4.2166C13.812 5.25 14.335 6.5111 14.335 8V8.1166L15.401 7.05L16.335 7.9833L13.668 10.65Z",fill:"currentColor"})})}function h({className:o,...e}){return r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:o,...e,children:[n("path",{d:"M22 11.08V12a10 10 0 11-5.93-9.14"}),n("path",{d:"M22 4L12 14.01l-3-3"})]})}function f({className:o,...e}){return r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:o,...e,children:[n("circle",{cx:"12",cy:"12",r:"10"}),n("path",{d:"M15 9l-6 6M9 9l6 6"})]})}function C({className:o,...e}){return r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:o,...e,children:[n("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),n("path",{d:"M12 9v4M12 17h.01"})]})}function d({className:o,...e}){return r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:o,...e,children:[n("circle",{cx:"12",cy:"12",r:"10"}),n("path",{d:"M12 16v-4M12 8h.01"})]})}function p({className:o,...e}){return r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:o,...e,children:[n("rect",{x:"8",y:"8",width:"12",height:"12",rx:"1"}),n("path",{d:"M16 8V6a2 2 0 00-2-2H6a2 2 0 00-2 2v8a2 2 0 002 2h2"})]})}function g({className:o,...e}){return r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:o,...e,children:[n("path",{d:"M3 8V5a2 2 0 012-2h3"}),n("path",{d:"M16 3h3a2 2 0 012 2v3"}),n("path",{d:"M21 16v3a2 2 0 01-2 2h-3"}),n("path",{d:"M8 21H5a2 2 0 01-2-2v-3"})]})}function k({className:o,...e}){return r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:o,...e,children:[n("rect",{x:"1",y:"5",width:"22",height:"14",rx:"1"}),n("line",{x1:"5",y1:"5",x2:"5",y2:"10"}),n("line",{x1:"9",y1:"5",x2:"9",y2:"8"}),n("line",{x1:"13",y1:"5",x2:"13",y2:"10"}),n("line",{x1:"17",y1:"5",x2:"17",y2:"8"}),n("line",{x1:"21",y1:"5",x2:"21",y2:"10"})]})}function w({className:o,...e}){return r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:o,...e,children:[n("polyline",{points:"3 6 5 6 21 6"}),n("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),n("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),n("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})}function y({className:o,...e}){return n("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",className:o,...e,children:n("path",{d:"M20 6L9 17l-5-5"})})}function I({className:o,...e}){return n("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:o,...e,children:n("path",{d:"M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"})})}function L({className:o,...e}){return r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:o,...e,children:[n("rect",{x:"2",y:"3",width:"20",height:"18",rx:"1"}),n("line",{x1:"2",y1:"8",x2:"22",y2:"8"}),n("line",{x1:"2",y1:"13",x2:"22",y2:"13"}),n("line",{x1:"2",y1:"18",x2:"22",y2:"18"}),n("line",{x1:"7",y1:"3",x2:"7",y2:"8"}),n("line",{x1:"15",y1:"3",x2:"15",y2:"8"}),n("line",{x1:"12",y1:"8",x2:"12",y2:"13"}),n("line",{x1:"7",y1:"13",x2:"7",y2:"18"}),n("line",{x1:"15",y1:"13",x2:"15",y2:"18"}),n("line",{x1:"12",y1:"18",x2:"12",y2:"21"})]})}function M({className:o,...e}){return r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:o,...e,children:[n("path",{d:"M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"}),n("path",{d:"M22 6l-10 7L2 6"})]})}function R({className:o,...e}){return r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:o,...e,children:[n("path",{d:"M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4"}),n("polyline",{points:"7 10 12 15 17 10"}),n("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})}function m({className:o,...e}){return r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:o,...e,children:[n("polyline",{points:"23 4 23 10 17 10"}),n("path",{d:"M20.49 15a9 9 0 11-2.12-9.36L23 10"})]})}function _({className:o,...e}){return r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:o,...e,children:[n("path",{d:"M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6"}),n("polyline",{points:"15 3 21 3 21 9"}),n("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})}function B({className:o,...e}){return r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:o,...e,children:[n("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),n("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]})}function H({className:o,...e}){return r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:o,...e,children:[n("path",{d:"M19 21H5a2 2 0 01-2-2V5a2 2 0 012-2h11l5 5v11a2 2 0 01-2 2z"}),n("polyline",{points:"17 21 17 13 7 13 7 21"}),n("polyline",{points:"7 3 7 8 15 8"})]})}function V({className:o,...e}){return r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:o,...e,children:[n("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),n("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),n("polyline",{points:"21 15 16 10 5 21"})]})}function W({className:o,...e}){return r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:o,...e,children:[n("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),n("polyline",{points:"14 2 14 8 20 8"}),n("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),n("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]})}function N({className:o,...e}){return r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:o,...e,children:[n("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),n("circle",{cx:"12",cy:"12",r:"3"})]})}function b(){return n("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:n("path",{d:"M3.75 14.25V9.75H5.25V12.75H8.25V14.25H3.75ZM12.75 8.25V5.25H9.75V3.75H14.25V8.25H12.75Z",fill:"currentColor"})})}function E(){return n("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:n("path",{d:"M3.75 8.25V6.75H6.75V3.75H8.25V8.25H3.75ZM9.75 9.75H14.25V11.25H11.25V14.25H9.75V9.75Z",fill:"currentColor"})})}function j(){return r("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n("path",{d:"M3 6h18v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6z"}),n("path",{d:"M3 6V4a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v2"}),n("line",{x1:"12",y1:"6",x2:"12",y2:"20"}),n("line",{x1:"8",y1:"10",x2:"8",y2:"10.01"}),n("line",{x1:"16",y1:"10",x2:"16",y2:"10.01"})]})}function F(){return n("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function z(){return n("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})})}function U(o){const e=t("chevronLeft",i);return n(e,{...o})}function q(o){const e=t("chevronRight",c);return n(e,{...o})}function G(o){const e=t("close",s);return n(e,{...o})}function J(o){const e=t("plus",l);return n(e,{...o})}function K(o){const e=t("logo",u);return n(e,{...o})}function O(o){const e=t("undo",a);return n(e,{...o})}function Q(o){const e=t("redo",x);return n(e,{...o})}function T(o){const e=t("reset",v);return n(e,{...o})}function D(o){const e=t("success",h);return n(e,{...o})}function Z(o){const e=t("error",f);return n(e,{...o})}function S(o){const e=t("warning",C);return n(e,{...o})}function A(o){const e=t("info",d);return n(e,{...o})}function X(o){const e=t("duplicate",p);return n(e,{...o})}function Y(o){const e=t("fullscreen",g);return n(e,{...o})}function $(o){const e=t("dimensions",k);return n(e,{...o})}function n1(o){const e=t("delete",w);return n(e,{...o})}function o1(o){const e=t("check",y);return n(e,{...o})}function e1(o){const e=t("aR",I);return n(e,{...o})}function t1(o){const e=t("wall",L);return n(e,{...o})}function r1(o){const e=t("email",M);return n(e,{...o})}function i1(o){const e=t("download",R);return n(e,{...o})}function c1(o){const e=t("regenerate",m);return n(e,{...o})}function s1(o){const e=t("externalLink",_);return n(e,{...o})}function l1(o){const e=t("copy",B);return n(e,{...o})}function u1(o){const e=t("save",H);return n(e,{...o})}function a1(o){const e=t("image",V);return n(e,{...o})}function x1(o){const e=t("file",W);return n(e,{...o})}function v1(o){const e=t("eye",N);return n(e,{...o})}function h1(o){const e=t("mobileFullscreen",b);return n(e,{...o})}function f1(o){const e=t("mobileExitFullscreen",E);return n(e,{...o})}function C1(o){const e=t("mobileConfigurator",j);return n(e,{...o})}function d1(o){const e=t("mobileChat",F);return n(e,{...o})}function p1(o){const e=t("mobileLiveStatus",z);return n(e,{...o})}const g1={success:D,error:Z,warning:S,info:A};export{e1 as ARIcon,o1 as CheckIcon,U as ChevronLeft,q as ChevronRight,G as CloseIcon,l1 as CopyIcon,n1 as DeleteIcon,$ as DimensionsIcon,i1 as DownloadIcon,X as DuplicateIcon,r1 as EmailIcon,Z as ErrorIcon,s1 as ExternalLinkIcon,v1 as EyeIcon,x1 as FileIcon,Y as FullscreenIcon,a1 as ImageIcon,A as InfoIcon,K as LogoIcon,d1 as MobileChatIcon,C1 as MobileConfiguratorIcon,f1 as MobileExitFullscreenIcon,h1 as MobileFullscreenIcon,p1 as MobileLiveStatusIcon,g1 as NotificationIcons,J as PlusIcon,Q as RedoIcon,c1 as RegenerateIcon,T as ResetIcon,u1 as SaveIcon,D as SuccessIcon,O as UndoIcon,t1 as WallIcon,S as WarningIcon};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Fragment as T,jsx as n,jsxs as f}from"react/jsx-runtime";import p,{useCallback as J,useEffect as Q,useMemo as x,useState as O,useSyncExternalStore as I,Suspense as k}from"react";import m from"./8f60e5059a.js";import{useUIRegions as z}from"./9840b9ce12.js";import B from"./9c6c598569.js";import X from"./d94df858ea.js";import C from"./be337ddda5.js";import{resolveComponent as F,useComponentRegistry as Y}from"./882bc739c8.js";import{useCopilotAvailable as G}from"./672404d987.js";import Z from"./ce663020e4.js";import ee from"./921bf270dd.js";import te from"./35d8449ed8.js";import ne from"./d0f9681634.js";import R from"./2990ba64d6.js";import{usePrice as oe}from"./16a399703e.js";import{subscribe as N,getVersion as h,getEffectiveSelections as se}from"./817d930a49.js";import{hasPlacementRows as ie}from"./82a8a4bc35.js";import{getCurrency as re,getLocale as ae}from"./28d887bf8a.js";const le=p.lazy(()=>import("./5d5e8a9c58.js")),ce=p.lazy(()=>import("./28df2aa12f.js")),ue=p.lazy(()=>import("./4c24338793.js")),pe=p.lazy(()=>import("./f89d7cd931.js")),me=p.lazy(()=>import("./7a748aae59.js")),fe=p.lazy(()=>import("./54f0fcf38b.js"));function Be(o){const t=I(N,h,h);return x(()=>o!=null?se(o)||{}:null,[o,t])}function de(){const{scope:o}=R(),{placements:t}=oe(),r=(C(a=>a.getChannelPriceConfig)?.()||{}).currency||"USD",s=I(N,h,h);return x(()=>{const a=o.placementId;if(a==null||!ie(a))return{placementId:null,price:null,text:null};const b=t?.[a],g=b?.unitPrice??b?.unit_price;return Number.isFinite(Number(g))?{placementId:a,price:Number(g),text:$(Number(g),r)}:{placementId:a,price:null,text:null}},[o.placementId,t,r,s])}function Fe(){return Z(),null}function U(){return f("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[n("path",{d:"M12 2l1.9 5.1L19 9l-5.1 1.9L12 16l-1.9-5.1L5 9l5.1-1.9L12 2z"}),n("path",{d:"M19 14l.9 2.3L22 17l-2.1.7L19 20l-.9-2.3L16 17l2.1-.7L19 14z"})]})}function D(){return n("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:n("path",{d:"M6 6l12 12M18 6L6 18"})})}function he(){Y();const o=F("ChatBar",fe),[t,i]=O(!1),r=G();return f(T,{children:[t&&n("div",{className:"shell-chat-backdrop","aria-hidden":"true",onClick:()=>i(!1)}),t&&f("div",{className:"shell-chat-pop",role:"dialog","aria-label":"Assistant",children:[f("div",{className:"shell-chat-pop__head",children:[f("span",{className:"shell-chat-pop__title",children:[n(U,{}),"Assistant",!r&&n("em",{className:"shell-chat-pop__off",children:"offline"})]}),n("button",{type:"button",className:"shell-chat-pop__close",onClick:()=>i(!1),"aria-label":"Close assistant",children:n(D,{})})]}),n("div",{className:"shell-chat-pop__body",children:n(k,{fallback:null,children:n(o,{alwaysExpanded:!0})})})]}),n("button",{type:"button",className:`shell-chat-fab${t?" shell-chat-fab--open":""}`,onClick:()=>i(s=>!s),"aria-label":t?"Close assistant":"Open assistant","aria-expanded":t,children:t?n(D,{}):n(U,{})})]})}function Ge(){const o=z(),t=m(s=>s.jsonPanelOpen),{isOn:i}=ne();return m(s=>s.modalOpen)?null:f(T,{children:[o.panels&&t&&i("liveStatus")&&n("div",{"data-sdk-overlay":!0,className:"shell-live",children:n(k,{fallback:null,children:p.createElement(F("LiveStatusPanel",me))})}),o.chat&&n(he,{})]})}function Re(){return f(k,{fallback:null,children:[n(le,{}),n(ce,{}),n(ue,{}),n(pe,{})]})}function ge(){const o=m(t=>t.setIsMobile);Q(()=>{const t=()=>{if(m.getState().isLandscapeMode){o(!0);return}o(window.innerWidth<768)};return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[o])}function $(o,t){const i=Number(o)||0,r=re()||t||"USD",s=ae();try{return new Intl.NumberFormat(s,{style:"currency",currency:r,maximumFractionDigits:0}).format(i)}catch{return`${r||""} ${i.toLocaleString(s)}`.trim()}}function Ue(){ge();const o=z(),t=m(e=>e.isLayoutLoading),i=m(e=>e.isMobile),r=m(e=>e.openModal),s=B(e=>e.setCameraPosition),a=G();te({disabled:i});const{handleGenerateAssets:b,isGenerating:g}=ee({openModal:r,setCameraPosition:s}),V=C(e=>e.systemName),j=X(e=>e.totalPrice),K=(C(e=>e.getChannelPriceConfig)?.()||{}).currency||"USD",L=B(e=>e.activeSceneConfigId),A=C(e=>e.getSceneFeatures),W=C(e=>e.sceneConfigurations),{productOptionSets:S,scope:y}=R(),q=I(N,h,h),l=x(()=>{const e=[],u=(c,v)=>{const d=String(c??"");d&&e.push({key:d,label:v||`Step ${e.length+1}`,featureIds:[c]})};if(y.isPlacementScoped&&S.length)for(const c of S)u(c?.feature_id??c?.id,c?.name);else{const c=L?A(L)||[]:[],v=new Set;for(const d of c){const P=d?.feature_id??d?.id;P==null||v.has(String(P))||(v.add(String(P)),u(P,d?.name))}}return e.push({key:"__summary",label:"Summary",featureIds:null,isSummary:!0}),e},[L,A,W,y.isPlacementScoped,S,q]),[M,_]=O(null),w=x(()=>{const e=l.findIndex(u=>u.key===M);return e>=0?e:0},[l,M]),H=J(e=>{const u=l[Math.max(0,Math.min(l.length-1,typeof e=="function"?e(0):e))];u&&_(u.key)},[l]),E=de();return{regions:o,isLayoutLoading:t,copilotAvailable:a,handleGenerateAssets:b,isGenerating:g,systemName:V||"Configurator",priceText:$(j,K),itemPriceText:E.text,focusedPlacementId:E.placementId,stepsScope:y.isPlacementScoped&&S.length?"piece":"scene",productOptionSetCount:S.length,selectedPlacementId:y.placementId??null,steps:l,activeStep:w,setActiveStep:H,activeKey:M,setActiveKey:_,step:l[w]||l[0]}}export{Fe as CopilotActionsRegister,Ge as ShellAssistants,he as ShellChatFab,Re as ShellModals,$ as formatPrice,Be as useEffectiveSelections,de as useFocusedItemPrice,ge as useMobileSync,Ue as useShellModel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as I,jsxs as nt}from"react/jsx-runtime";import{useRef as H,useMemo as k,useEffect as G,useState as N,Suspense as $}from"react";import{useGLTF as q,Edges as J}from"@react-three/drei";import*as a from"three";import Q from"./9c6c598569.js";import F from"./872c4302e0.js";import Y from"./609e5e5d28.js";import{useComponentOverride as Z,_trackMount as K}from"./a3c983d431.js";import{getFlatMaterial as V}from"./c44d37da7a.js";import{resolveMaterial as tt}from"./95a44ebec2.js";const rt={"bottom-center":{x:"c",y:"min",z:"c"},"front-bottom-center":{x:"c",y:"min",z:"max"},"back-bottom-center":{x:"c",y:"min",z:"min"},"left-bottom-center":{x:"min",y:"min",z:"c"},"right-bottom-center":{x:"max",y:"min",z:"c"},"front-left-bottom-center":{x:"min",y:"min",z:"max"},"front-right-bottom-center":{x:"max",y:"min",z:"max"},"back-left-bottom-center":{x:"min",y:"min",z:"min"},"back-right-bottom-center":{x:"max",y:"min",z:"min"}};function et({url:e,material:n,position:u,rotation:D,scale:W,skirt:w,onClick:h,isSelected:A,onMeasure:b,recalcPosition:E,slotName:x,slotKey:C,componentId:B,pivot:P,children:T}){const S=H(),{scene:d}=q(e,"/assets/draco/"),[O,z]=N(0),L=H(null);G(()=>{if(!E||!S.current){L.current=null,z(0);return}const r=S.current;r.updateWorldMatrix(!0,!0);const l=new a.Matrix4().copy(r.matrixWorld).invert(),i=r.parent?new a.Matrix4().copy(r.parent.matrixWorld).invert():new a.Matrix4,o=new a.Matrix4().multiplyMatrices(i,r.matrixWorld),s=new a.Box3,m=new a.Box3,v=new a.Matrix4;if(r.traverse(g=>{!g.isMesh||!g.geometry||(g.geometry.boundingBox||g.geometry.computeBoundingBox(),v.multiplyMatrices(o,new a.Matrix4().multiplyMatrices(l,g.matrixWorld)),m.copy(g.geometry.boundingBox).applyMatrix4(v),s.union(m))}),s.isEmpty())return;const t=(s.max.x-s.min.x)/2,y=(Array.isArray(u)&&u[0]||0)<0?-1:1;let f=L.current;if(L.current=t,f==null&&(f=.1),f==null){z(0);return}if(Math.abs(t-f)<1e-4)return;const p=y*(t-f);z(g=>g+p)},[d,E,u]),G(()=>{if(!b||!d)return;d.updateMatrixWorld(!0);const r=new a.Box3,l=new a.Box3;if(d.traverse(s=>{if(!s.isMesh||!s.geometry)return;const m=`${s.name||""} ${s.material?.name||""}`.toLowerCase();/shadow|contact[\s_-]?shadow|ao[\s_-]?(plane|map)|ground[\s_-]?plane/.test(m)||(s.geometry.boundingBox||s.geometry.computeBoundingBox(),l.copy(s.geometry.boundingBox).applyMatrix4(s.matrixWorld),r.union(l))}),r.isEmpty())return;const i=r.getSize(new a.Vector3),o=r.getCenter(new a.Vector3);(i.x>0||i.y>0||i.z>0)&&b({width:i.x,height:i.y,depth:i.z,cx:o.x,cy:o.y,cz:o.z})},[d,b]);const M=k(()=>{const r=d.clone(!0),l=x!=null&&String(x)!==""?String(x):null;l&&(r.name=l),r.userData={...r.userData,slotKey:C,componentId:B,slotName:l};let i=null;if(w){const o=new a.Box3().setFromObject(r);i=o.min.y+(o.max.y-o.min.y)*.12}return r.traverse(o=>{if(o.userData={...o.userData,slotKey:C,componentId:B,slotName:l},o.isMesh&&(o.castShadow=!0,o.receiveShadow=!0,n)){const s=n.clone();i!=null&&o.geometry?.attributes?.position&&s.color&&new a.Box3().setFromBufferAttribute(o.geometry.attributes.position).max.y<i&&s.color.multiplyScalar(.65),A&&(s.emissive=new a.Color("#ff6b35"),s.emissiveIntensity=1),o.material=s}}),r},[d,n,A,w,x,C,B]);G(()=>()=>{M.traverse(r=>{r.isMesh&&r.material&&r.material.dispose()})},[M]);const j=k(()=>{const r=rt[P||"model-derived"];if(!r)return null;M.updateMatrixWorld(!0);const l=new a.Matrix4().copy(M.matrixWorld).invert(),i=new a.Box3,o=new a.Box3,s=new a.Matrix4;if(M.traverse(_=>{!_.isMesh||!_.geometry||(_.geometry.boundingBox||_.geometry.computeBoundingBox(),o.copy(_.geometry.boundingBox),s.multiplyMatrices(l,_.matrixWorld),o.applyMatrix4(s),i.union(o))}),i.isEmpty())return null;const{min:m,max:v}=i,t=(m.x+v.x)/2,c=(m.y+v.y)/2,y=(m.z+v.z)/2,f=r.x==="min"?m.x:r.x==="max"?v.x:t,p=r.y==="min"?m.y:c,g=r.z==="min"?m.z:r.z==="max"?v.z:y;return[-f,-p,-g]},[M,P]),R=E&&O&&Array.isArray(u)?[(u[0]||0)+O,u[1]||0,u[2]||0]:u;return nt("group",{ref:S,name:x!=null?String(x):void 0,userData:{slotKey:C,componentId:B,slotName:x!=null?String(x):void 0},position:R,rotation:D,scale:W,onClick:h,children:[j?I("group",{position:j,children:I("primitive",{object:M})}):I("primitive",{object:M}),T]})}function xt({geometry:e,material:n,position:u,onClick:D,isSelected:W}){const w=H(),h=k(()=>{if(W){const A=n.clone();return A.emissive=new a.Color("#ff6b35"),A.emissiveIntensity=1,A}return n},[n,W]);return G(()=>()=>{h!==n&&h.dispose()},[h,n]),I("mesh",{ref:w,geometry:e,material:h,position:u,onClick:D,castShadow:!0,receiveShadow:!0,children:W&&I(J,{scale:1.01,threshold:15,color:"#ff6b35",linewidth:3})})}const X={visible:!0,materialId:null};function U({component:e,componentState:n,instanceId:u,isSelected:D,onMeasure:W,onPick:w,slotName:h,slotKey:A,componentId:b,pivot:E,hiddenComponentIds:x,onDescendantMeasured:C,slotMaterials:B}){const P=Q(t=>t.selectInstance),T=F(t=>t.getMaterial),S=F(t=>t.getComponent),d=Z(h,e?.name??e?.componentName,b);d?.materialId&&(n={...n,materialId:d.materialId}),G(()=>K({name:e?.name??e?.componentName??null,slotName:h??null,componentId:b!=null?String(b):null,instanceId:u??null}),[e?.name,e?.componentName,h,b,u]);const{physicalMat:O}=Y(n.materialId,{getMaterial:T}),z=k(()=>{const t=n.variantId&&e.style_variants?e.style_variants[n.variantId]:null,c=e.variants,y=c&&typeof c=="object"?c.default||Object.values(c)[0]:null;return t||e.url||e.asset_url||e.modelPath||e.model_path||e.modelUrl||e.model_url||y||null},[e,n.variantId]),L=k(()=>{if(!z||typeof z!="string")return!1;const t=z.split(/[?#]/)[0].toLowerCase();return t.endsWith(".glb")||t.endsWith(".gltf")},[z]),M=k(()=>{if(O)return O;if(n.materialId){const t=T(n.materialId),c=tt({...n,materialId:n.materialId,definition:t},{THREE:a,Default:()=>t&&t.color?V({color:t.color||"#808080",roughness:t.roughness||.5,metalness:t.metalness||0}):null});if(c)return c;if(t&&t.color)return V({color:t.color||"#808080",roughness:t.roughness||.5,metalness:t.metalness||0})}return n.color?V({color:n.color,roughness:n.roughness??.5,metalness:n.metalness??0}):null},[n.materialId,n.color,n.roughness,n.metalness,T,O]),j=t=>{t.stopPropagation();const c=b??e?.id??null;if(w){w(c);return}P(u,c)},R=e.position||[0,0,0],r=e.rotation||e.orientation||[0,0,0],l=Math.PI/180,i=Array.isArray(r)&&r.length===3?e.rotationRad?[r[0],r[1],r[2]]:[r[0]*l,r[1]*l,r[2]*l]:[0,0,0];let o=e.scale||[1,1,1],s=R,m=i;if(d?.transform){const t=d.transform;t.position&&(s=[R[0]+t.position[0],R[1]+t.position[1],R[2]+t.position[2]]),t.rotation&&(m=[i[0]+t.rotation[0]*l,i[1]+t.rotation[1]*l,i[2]+t.rotation[2]*l]),t.scale&&(o=[o[0]*t.scale[0],o[1]*t.scale[1],o[2]*t.scale[2]])}const v=k(()=>{const t=Array.isArray(e.children)?e.children:[];if(!t.length)return null;const c=Array.isArray(x)&&x.length?new Set(x.map(y=>String(y))):null;return t.map(y=>{const f=y.componentId??y.component_id;if(c&&f!=null&&c.has(String(f)))return null;const p=f!=null?S(f):null;if(!p)return null;const g=String(p.materialSlot??p.material_slot??"").toLowerCase(),_=B&&g?B[g]:null;return I(U,{component:{...p,position:y.position,rotation:y.rotation,scale:y.scale},componentState:_?{...X,materialId:_}:X,instanceId:u,componentId:f,slotKey:p.materialSlot??p.name??String(f),slotName:p.name??null,onPick:w,hiddenComponentIds:x,slotMaterials:B,onMeasure:C,onDescendantMeasured:C},y.id??f)})},[e.children,S,u,w,x,C,B]);return d?.hidden?null:L?I($,{children:I(et,{url:z,material:M,position:s,rotation:m,scale:o,skirt:e.skirt,onClick:j,isSelected:D,onMeasure:W,recalcPosition:e.recalcPosition,slotName:h,slotKey:A,componentId:b,pivot:E,children:v})}):null}var yt=U;export{yt as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var a={id:"backend-transforms",label:"Backend-driven transforms",computeLayout(o){return(Array.isArray(o)?o:[]).map(r=>({position:Array.isArray(r?.position)?r.position:[0,0,0],rotation:Array.isArray(r?.rotation)?r.rotation:[0,0,0]}))}};export{a as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{jsx as e,jsxs as n}from"react/jsx-runtime";import{useLabels as p}from"./28d887bf8a.js";import _ from"./0f7c8345a8.js";import q from"./e379e0039b.js";import{useQuoteDocument as h}from"./d464da28a5.js";import{COLUMN_DEFS as N,quoteHeading as g,quoteDate as y}from"./12b8165d6d.js";function f({quote:s}){const l=p(),{lines:c,scene:r,totals:a,images:u}=s,t=h(),m=t.columns.map(o=>({key:o,...N[o]})),i=t.accent?{"--quote-accent":t.accent}:void 0;return n("article",{className:"quote-doc","data-part":"quote",style:i,children:[(t.company||t.logoUrl)&&n("div",{className:"quote-doc__brand","data-part":"quote/brand",children:[t.logoUrl&&e("img",{className:"quote-doc__logo",src:t.logoUrl,alt:t.company??"",onError:o=>{o.currentTarget.style.display="none"}}),t.company&&e("span",{className:"quote-doc__company",children:t.company})]}),n("header",{className:"quote-doc__head","data-part":"quote/head",children:[e("h2",{className:"quote-doc__title",children:g(s,t)}),e("time",{className:"quote-doc__date",children:y(s,t)})]}),(t.reference||t.customer)&&e("p",{className:"quote-doc__for","data-part":"quote/for",children:[t.reference&&`Quote ${t.reference}`,t.customer&&`For ${t.customer}`].filter(Boolean).join(" \xB7 ")}),t.showSceneSelections&&r.selections.length>0&&e("p",{className:"quote-doc__scene","data-part":"quote/scene",children:r.selections.map(o=>`${o.setName}: ${o.optionName}`).join(" \xB7 ")}),c.length===0?l("quote.empty","Nothing configured yet.")?e("p",{className:"quote-doc__empty",children:l("quote.empty","Nothing configured yet.")}):null:n("table",{className:"quote-doc__table","data-part":"quote/lines",children:[e("thead",{children:e("tr",{children:m.map(o=>e("th",{className:o.align==="right"?"quote-doc__n":void 0,children:o.label},o.key))})}),e("tbody",{children:c.map(o=>e("tr",{children:m.map(d=>n("td",{className:[d.align==="right"?"quote-doc__n":null,d.key==="options"?"quote-doc__opts":null].filter(Boolean).join(" ")||void 0,children:[d.value(o),d.key==="item"&&o.sku&&!t.columns.includes("sku")&&e("span",{className:"quote-doc__sku",children:o.sku})]},d.key))},o.placementId))})]}),(s.additionalLines?.length??0)>0&&n("table",{className:"quote-doc__table quote-doc__additional","data-part":"quote/additional",children:[e("thead",{children:n("tr",{children:[e("th",{children:l("quote.additionalOptions","Additional options")}),e("th",{className:"quote-doc__n",children:"Qty"}),e("th",{className:"quote-doc__n",children:"Unit"}),e("th",{className:"quote-doc__n",children:"Total"})]})}),e("tbody",{children:s.additionalLines.map(o=>n("tr",{children:[e("td",{children:o.setName?`${o.setName}: ${o.label}`:o.label}),e("td",{className:"quote-doc__n",children:o.count}),e("td",{className:"quote-doc__n",children:o.unitAmountFormatted??"\u2014"}),e("td",{className:"quote-doc__n",children:o.amountFormatted??"\u2014"})]},`${o.optionSetId}:${o.optionId}`))})]}),n("div",{className:"quote-doc__totals","data-part":"quote/totals",children:[n("span",{children:[a.unitCount??a.lineCount," ",(a.unitCount??a.lineCount)===1?l("quote.item","item"):l("quote.items","items")]}),e("strong",{children:a.grandTotalFormatted??a.subtotalFormatted??"\u2014"})]}),a.hasSceneLevelAdjustment&&n("p",{className:"quote-doc__note",children:["Items total ",a.subtotalFormatted,a.additionalSubtotal?` + ${a.additionalSubtotalFormatted} options`:"","; quoted total ",a.grandTotalFormatted,"."]}),e(_,{images:u,...t.images}),t.arQr&&e(q,{images:u,label:t.arQrLabel}),(t.terms||t.notes)&&e("footer",{className:"quote-doc__terms","data-part":"quote/terms",children:[t.notes,t.terms].filter(Boolean).join(`
|
|
2
|
+
|
|
3
|
+
`)})]})}export{f as default};
|