@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
|
+
const o="appliance-",r=t=>typeof t=="string"&&t.startsWith(o),p=t=>{const e=String(t??"");return e.startsWith(o)?e.slice(o.length):e},s=[0,1.08,3.92],a=[0,1,0],n=[7,2.5,-.5],i=[1,.28,1],l=[-i[0],i[1],i[2]],c=[{key:"front",autoFit:!0,position:[0,1.08,3.92],target:[0,1,0],label:"Front"},{key:"side",autoFit:!0,position:[-4,1.5,0],target:[0,.8,0],label:"Side"},{key:"perspective",autoFit:!0,position:[4.2,3.4,4.5],target:[0,.4,0],label:"Perspective"},{key:"perspective_left",autoFit:!0,position:[-4.2,3.4,4.5],target:[0,.4,0],label:"Perspective Left"},{key:"perspective_right",autoFit:!0,position:[4.2,3.4,4.5],target:[0,.4,0],label:"Perspective Right"},{key:"top",autoFit:!0,position:[0,6.75,0],target:[0,.85,0],label:"Top"}],u=[{key:"front",autoFit:!0,position:[7,2.5,-.5],target:[0,.8,-.5],label:"Front"},{key:"side",autoFit:!0,position:[0,1.5,3.5],target:[0,.8,0],label:"Side"},{key:"perspective",autoFit:!0,position:[5.5,3.4,3.5],target:[0,.4,-.5],label:"Perspective"},{key:"perspective_left",autoFit:!0,position:[-5.5,3.4,3.5],target:[0,.4,-.5],label:"Perspective Left"},{key:"perspective_right",autoFit:!0,position:[5.5,3.4,3.5],target:[0,.4,-.5],label:"Perspective Right"},{key:"top",autoFit:!0,position:[0,6.75,-.5],target:[0,.85,-.5],label:"Top"}];export{s as FRONT_VIEW_POSITION,a as FRONT_VIEW_TARGET,n as GALLEY_VIEW_POSITION,u as GALLEY_VIEW_PRESETS,o as HOSTED_PLACEMENT_ID_PREFIX,i as PERSPECTIVE_VIEW_DIR,l as PERSPECTIVE_VIEW_DIR_LEFT,c as VIEW_PRESETS,r as isHostedPlacementId,p as stripHostedPlacementPrefix};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Fragment as l,jsx as t,jsxs as b}from"react/jsx-runtime";import{useLabels as o}from"./28d887bf8a.js";import{useUIRegion as i}from"./9840b9ce12.js";function u({onClick:s,isGenerating:r,disabled:e,className:a="sdk-btn sdk-btn--primary"}){const n=o();return i("generateAssets")?t("button",{className:a,onClick:s,disabled:e,style:e?{opacity:.5,pointerEvents:"none"}:void 0,children:r?b(l,{children:[t("span",{className:"generate-btn__spinner"}),n("generate.busy","Generating...")]}):n("generate.label","Generate Assets")}):null}export{u as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useProgress as a}from"@react-three/drei";import f from"./8f60e5059a.js";function A(r=1500){let e=!1;const i=()=>{e||(e=!0,f.getState().clearSceneLoading())};requestAnimationFrame(()=>requestAnimationFrame(i)),setTimeout(i,r)}function m({quietMs:r=300,safetyMs:e=3e4}={}){return new Promise(i=>{let n=!1,t=null,o=null;const u=()=>{n||(n=!0,t&&clearTimeout(t),o&&o(),clearTimeout(l),i())},l=setTimeout(u,e),s=()=>{if(n)return;const{active:c}=a.getState();if(c){t&&(clearTimeout(t),t=null);return}t||(t=setTimeout(u,r))};o=a.subscribe(s),requestAnimationFrame(()=>requestAnimationFrame(s))})}function g(r){let e=!1;return m().then(()=>{e||r()}),()=>{e=!0}}export{A as clearSceneLoadingAfterRender,m as waitForAssetsIdle,g as whenPiecePositionsReady};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as t,jsxs as n}from"react/jsx-runtime";import{useLabels as i}from"./28d887bf8a.js";function a(){const e=i();return t("div",{style:{display:"flex",flexDirection:"column",minHeight:"200px",height:"100%",backgroundColor:"var(--bg-muted, #f9f9f9)"},children:n("div",{style:{flex:1,padding:"16px",textAlign:"center",display:"flex",flexDirection:"column",justifyContent:"center",color:"var(--text-secondary, #666)"},children:[n("p",{style:{fontSize:"16px",marginBottom:"8px"},children:[t("span",{style:{display:"inline-block",fontSize:"18px",color:"#ff9800",marginRight:"4px"},children:"\u26A0"})," ",e("chat.unavailable","Chat Unavailable")]}),t("p",{style:{fontSize:"13px",color:"var(--text-secondary, #666)",marginBottom:"4px"},children:e("chat.unavailableHint","The AI assistant is not connected. Please connect with the admin.")})]})})}var o=a;export{o as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import f from"./be337ddda5.js";import m from"./7d9ddaeb47.js";import s from"./d803155241.js";import p from"./6f9ae59d6c.js";import y from"./ca497b066c.js";import d from"./6bff84d27e.js";const r={[p.id]:p,[m.id]:m,[s.id]:s,[y.id]:y,[d.id]:d},S=s.id;let o=null;const u={default:"chain-with-corners",sectional:"chain-with-corners"};function h(){try{const t=f.getState();return t?.configuratorKey?t.configuratorKey:new URLSearchParams(window.location.search).get("configurator")||null}catch{return null}}function A(){return h()}const c=new Map,g=t=>typeof t=="string"?t.trim().toLowerCase():"";function T(t){if(!t||typeof t!="object")return()=>{};const e=g(t.id),n=typeof t.computeLayout=="function"||t.mode==="scene-owned";return!e||!n?()=>{}:(c.set(e,t),()=>{c.get(e)===t&&c.delete(e)})}const x={"kitchen-cabinets":"scene-owned"};function a(t){if(t==null)return null;const e=g(t),n=x[e]??t;return c.get(g(n))||c.get(e)||r[n]||r[t]||null}function v(t){return!!a(t)}function E(){return Array.from(c.keys())}function I(){c.clear(),o=null,i=null}function _(t){const e=f.getState(),n=e.placementStrategy??e.systemRoom?.placement_strategy??null;if(n&&a(n))return n;if(o&&a(o))return o;if(r["grouped-chain"])return"grouped-chain";const l=t??h();return l&&u[l]&&r[u[l]]?u[l]:r["chain-with-corners"]?"chain-with-corners":u.default&&r[u.default]?u.default:S}let i=null;function R(){if(i)return i;try{const t=f.getState(),e=t?.placementStrategyConfig??t?.systemRoom?.placement_strategy_config??null;return e&&typeof e=="object"?e:{}}catch{return{}}}function K(t,e){const n=arguments.length>1?e:t;return n==null?(i=null,!0):typeof n!="object"?!1:(i=n,!0)}function j(t,e){const n=arguments.length>1?e:t;return a(n)?(o=n,!0):!1}function G(){o=null}function O(){return o}function D(t=_()){return a(t)||r[S]}export{S as DEFAULT_STRATEGY_ID,r as STRATEGIES,I as _resetPlacementStrategies,G as clearPlacementStrategy,A as currentConfiguratorKey,D as getPlacementStrategy,O as getPlacementStrategyOverride,v as hasPlacementStrategy,E as listPlacementStrategies,T as registerPlacementStrategy,R as resolvePlacementStrategyConfig,_ as resolvePlacementStrategyId,j as setPlacementStrategy,K as setPlacementStrategyConfig};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as g}from"react/jsx-runtime";import{useEffect as c,useRef as u,useState as f,useSyncExternalStore as h}from"react";import{subscribeWatermark as p,getWatermarkShown as s}from"./d3cd7f1bc1.js";import{getWatermarkPlacement as m}from"./b59b0dde17.js";const d="https://configurator-platform.imagine.io/",b=300;function k(){const r=h(p,s,s),[t,o]=f(null),n=u("");return c(()=>{if(!r){o(null);return}const a=()=>{const e=m(),i=e?`${e.left}|${e.bottom}|${e.width}|${e.height}`:"";i!==n.current&&(n.current=i,o(e))};a();const l=setInterval(a,b);return()=>clearInterval(l)},[r]),!r||!t?null:g("a",{className:"sdk-watermark-link",href:d,target:"_blank",rel:"noopener noreferrer","aria-label":"Powered by imagine.io \u2014 open the configurator platform",title:"Powered by imagine.io",style:{position:"absolute",left:`${t.left}px`,bottom:`${t.bottom}px`,width:`${t.width}px`,height:`${t.height}px`,background:"transparent",pointerEvents:"auto",cursor:"pointer",zIndex:5,borderRadius:"999px"}})}export{k as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useSyncExternalStore as g}from"react";let r={},p=null,y=null,h=0;const m=new Set;function f(){h+=1;for(const e of m)try{e()}catch{}}function d(e){return m.add(e),()=>{m.delete(e)}}const l=()=>h;function S(e){if(!e||typeof e!="object")return()=>{};const t={},n={},i=[];let s=!1;for(const o of Object.keys(e)){const u=e[o];typeof u=="string"&&(a.has(o)||i.push(o),a.add(o),Object.prototype.hasOwnProperty.call(r,o)&&(n[o]=r[o]),t[o]=u,r[o]!==u&&(r[o]=u,s=!0))}return s&&f(),function(){const u=new Set;for(const c of Object.keys(t))r[c]===t[c]&&(Object.prototype.hasOwnProperty.call(n,c)?r[c]=n[c]:delete r[c],u.add(c));for(const c of i)u.has(c)&&a.delete(c);u.size&&f()}}const a=new Set;let x=new Set;function N(e){const t=e&&typeof e=="object"?e:{};let n=!1;for(const s of x)Object.prototype.hasOwnProperty.call(t,s)||a.has(s)||Object.prototype.hasOwnProperty.call(r,s)&&(delete r[s],n=!0);const i=new Set;for(const s of Object.keys(t)){const o=t[s];typeof o=="string"&&(i.add(s),!a.has(s)&&r[s]!==o&&(r[s]=o,n=!0))}x=i,n&&f()}function k(e){if(!Array.isArray(e))return;let t=!1;for(const n of e)a.delete(n),Object.prototype.hasOwnProperty.call(r,n)&&(delete r[n],t=!0);t&&f()}function w(e,t){return Object.prototype.hasOwnProperty.call(r,e)?r[e]:t}function v(){return{...r}}function F(e,t){return g(d,l,l),w(e,t)}function P(){return g(d,l,l),w}function C(e){const t=typeof e=="string"&&e.trim()?e.trim():null;t!==p&&(p=t,f())}function b(){return p||(typeof navigator<"u"&&navigator.language?navigator.language:"en")}function A(e){const t=typeof e=="string"&&e.trim()?e.trim().toUpperCase():null;t!==y&&(y=t,f())}function I(){return y}function O(e=b()){const t=String(e).split("-")[0].toLowerCase();return["ar","he","fa","ur","ps","sd","yi"].includes(t)}function j(e,t=y,n=b()){const i=Number(e);if(!Number.isFinite(i))return"";try{return new Intl.NumberFormat(n,t?{style:"currency",currency:t}:{maximumFractionDigits:2}).format(i)}catch{return String(i)}}function L(e,t,n=b()){const i=Number(e);if(!Number.isFinite(i))return"";try{return new Intl.NumberFormat(n,t).format(i)}catch{return String(i)}}function K(){g(d,l,l);const e=b();return{locale:e,rtl:O(e),formatMoney:(t,n)=>j(t,n,e),formatNumber:(t,n)=>L(t,n,e)}}function M(){r={},p=null,y=null,f()}export{M as _resetLabels,j as formatMoney,L as formatNumber,I as getCurrency,w as getLabel,v as getLabels,b as getLocale,O as isRtl,A as setCurrency,S as setLabels,C as setLocale,N as setThemeLabels,k as unsetLabels,K as useFormatters,F as useLabel,P as useLabels};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Fragment as N,jsx as o,jsxs as t}from"react/jsx-runtime";import{useState as m}from"react";import{useLabels as O}from"./28d887bf8a.js";import s from"./8f60e5059a.js";import _ from"./9c6c598569.js";import l from"./d94df858ea.js";import g from"./be337ddda5.js";import B from"./872c4302e0.js";import z from"./d903df4e0d.js";import G from"./d566d3874b.js";import f from"./fe68b361ba.js";function L(){const n=O(),[d,p]=m(!1),[i,y]=m(!0),v=s(e=>e.modalOpen),x=s(e=>e.activeModal),a=s(e=>e.closeModal),u=s(e=>e.addNotification),h=_(e=>e.productInstances),P=l(e=>e.instanceSelections),C=l(e=>e.totalPrice),S=l(e=>e.calculatedValues),b=g(e=>e.getChannelPriceConfig),I=g(e=>e.getChannelPermissions),k=B(e=>e.products),D=v&&x==="export",r=I(),E=b(),w=async()=>{p(!0);try{const e={products:Object.values(h).map(c=>({instanceId:c.instanceId,productId:c.productId,productName:k[c.productId]?.name||c.productId})),selections:P},F={total:C,currency:E.currency||"USD",breakdown:S},M=document.querySelector(".scene-canvas");await z.downloadPDF({sceneCanvasElement:M,configuration:e,priceBreakdown:F,channelConfig:r,includePrice:i&&r.can_see_pricing}),u({type:"success",message:"PDF exported successfully"}),a()}catch{u({type:"error",message:"Failed to export PDF"})}finally{p(!1)}};return o(G,{isOpen:D,onClose:a,title:n("export.title","Export to PDF"),size:"small",footer:t(N,{children:[o(f,{variant:"ghost",onClick:a,children:"Cancel"}),o(f,{variant:"primary",onClick:w,disabled:d,children:d?"Exporting...":"Export PDF"})]}),children:t("div",{style:{display:"flex",flexDirection:"column",gap:"var(--spacing-md)"},children:[o("p",{style:{color:"var(--text-secondary)"},children:"Export your configuration as a PDF document including a screenshot of your design and all selected options."}),r.can_see_pricing&&t("label",{style:{display:"flex",alignItems:"center",gap:"var(--spacing-sm)",cursor:"pointer"},children:[o("input",{type:"checkbox",checked:i,onChange:e=>y(e.target.checked)}),"Include pricing information"]}),t("div",{style:{padding:"var(--spacing-md)",background:"var(--bg-secondary)",borderRadius:"var(--border-radius)",fontSize:"var(--font-size-sm)"},children:[o("strong",{children:"PDF will include:"}),t("ul",{style:{margin:"var(--spacing-sm) 0 0",paddingLeft:"var(--spacing-lg)"},children:[o("li",{children:n("export.screenshot","Scene screenshot")}),o("li",{children:n("export.productList","Product list with selections")}),i&&r.can_see_pricing&&o("li",{children:n("export.priceBreakdown","Price breakdown")})]})]})]})})}var T=L;export{T as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import l from"react";import f from"react-dom/client";const m={w:210,h:297},c=794,u=2;async function P(t,s,r={}){if(typeof document>"u")throw new Error("renderQuoteTemplatePdf needs a DOM");const[{default:e},{jsPDF:o}]=await Promise.all([import("html2canvas"),import("jspdf")]),n=document.createElement("div");n.setAttribute("data-sdk-pdf-stage",""),Object.assign(n.style,{position:"fixed",left:"-100000px",top:"0",width:`${c}px`,background:"#ffffff",color:"#111111",padding:"0",margin:"0",zIndex:"-1",pointerEvents:"none"}),document.body.appendChild(n);const i=f.createRoot(n);try{i.render(l.createElement(t,{quote:s,close:()=>{}})),await p(n,r.timeoutMs??8e3);const a=await e(n,{scale:u,useCORS:!0,allowTaint:!1,backgroundColor:"#ffffff",logging:!1,windowWidth:c});return h(a,o)}finally{try{i.unmount()}catch{}n.remove()}}async function p(t,s){await new Promise(e=>requestAnimationFrame(()=>setTimeout(e,30)));const r=Array.from(t.querySelectorAll("img")).filter(e=>!e.complete);r.length&&(await Promise.race([Promise.all(r.map(e=>new Promise(o=>{e.addEventListener("load",o,{once:!0}),e.addEventListener("error",o,{once:!0})}))),new Promise(e=>setTimeout(e,s))]),await new Promise(e=>requestAnimationFrame(e)))}function h(t,s){const r=new s({orientation:"portrait",unit:"mm",format:"a4"}),e=t.width/m.w,o=Math.floor(m.h*e),n=Math.max(1,Math.ceil(t.height/o));for(let i=0;i<n;i+=1){i>0&&r.addPage();const a=Math.min(o,t.height-i*o),d=document.createElement("canvas");d.width=t.width,d.height=a,d.getContext("2d").drawImage(t,0,i*o,t.width,a,0,0,t.width,a),r.addImage(d.toDataURL("image/jpeg",.92),"JPEG",0,0,m.w,a/e)}return r.output("blob")}export{P as renderQuoteTemplatePdf};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useCallback as a,useEffect as G,useMemo as S,useRef as M}from"react";import b from"./872c4302e0.js";import L from"./d94df858ea.js";import O from"./9c6c598569.js";import N from"./be337ddda5.js";import $ from"./8f60e5059a.js";import{getPlacementBindings as h,isOptionAvailable as B,isOptionVisible as x}from"./817d930a49.js";import{selectOption as U}from"./dbd5ba1d07.js";import{sceneOptionSetsFrom as V,productOptionSetsFrom as q,optionsForSetFrom as z}from"./4a99ddb3fd.js";import{isAddFeature as H}from"./8c27edda0f.js";function J({placementId:u}={}){const r=b(e=>e.options),v=b(e=>e.materials),t=b(e=>e.features),d=L(e=>e.sceneSelections),m=O(e=>e.placementSelections),D=O(e=>e.selectedInstanceId),A=O(e=>e.activeSceneConfigId),C=N(e=>e.sceneConfigurations),F=$(e=>e.hiddenOptions),i=u===void 0?D??null:u,o=i!=null,p=S(()=>V({features:t,sceneConfigurations:C,activeSceneConfigId:A}),[t,C,A]),R=S(()=>o?q({features:t,bindings:h(i)||[]}):[],[t,o,i,m]),f=M(new Map),E=`${Object.keys(t).length}_${Object.keys(r).length}`;G(()=>{f.current.clear()},[E]);const g=a(e=>{const n=e?.feature_id||e?.id;if(!n)return[];const c=o;if(!c){const l=f.current.get(n);if(l)return l}const s=z(e,{features:t,options:r,bindings:c?h(i)||[]:null});return c||f.current.set(n,s),s},[t,r,o,i,f]),y=S(()=>new Set((p||[]).filter(e=>H(e,{productSelected:o})).map(e=>String(e?.id))),[p,o]),_=a(e=>{if(!y.has(String(e))){if(o){const n=m?.[i];if(n&&n[e]!=null)return n[e]}return d[e]}},[y,o,i,m,d]),j=a(e=>e==null?null:d[e]??d[String(e)]??null,[d]),w=a((e,n)=>{if(!n)return{hidden:!1,disabled:!1,disabledReason:null};if(!x(e,n.id))return{hidden:!0,disabled:!0,disabledReason:null};if(!B(e,n.id))return{hidden:!1,disabled:!0,disabledReason:"Not available"};if(i!=null){const s=(h(i)||[]).find(l=>String(l.optionSetId??l.option_set_id)===String(e));if(s&&Array.isArray(s.available)&&!s.available.some(I=>String(I)===String(n.id)))return{hidden:!1,disabled:!0,disabledReason:"Not available"}}return{hidden:!1,disabled:!1,disabledReason:null}},[i]),P=a((e,n)=>(Array.isArray(n)?n:[]).filter(s=>s&&x(e,s.id)),[]),k=a((e,n,c)=>{const s=c||t?.[e]||t?.[String(e)]||null;return U(e,n,s)},[t]);return S(()=>({features:t,optionSets:t,optionSetList:Object.values(t||{}),sceneOptionSets:p,productOptionSets:R,getOptionsForSet:g,options:r,materials:v,hiddenOptions:F,scope:{placementId:i,isPlacementScoped:o},getOptionsForFeature:g,select:k,getSelection:_,getEffectiveSelection:j,optionDisabledPropsFor:w,visibleOptions:P}),[t,r,v,F,i,o,p,R,g,k,_,j,w,P])}function ie(u){const r=M(new Map);return G(()=>{r.current.clear()},[u]),r}export{J as default,ie as useOptionsCache};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as s,jsxs as n}from"react/jsx-runtime";import{useState as Q}from"react";import{useLabels as V}from"./28d887bf8a.js";import X from"./8f60e5059a.js";import S from"./872c4302e0.js";import Y from"./d94df858ea.js";import Z from"./bdec200d00.js";import{optionRecordFrom as ee,optionsForSetFrom as se}from"./4a99ddb3fd.js";import{currentOptionIdFor as oe,readCurrentOptionInputs as te}from"./2c7c1bcef1.js";import{getPlacementBindings as ne}from"./817d930a49.js";import ae from"./9794652102.js";import re from"./54413c1eae.js";import{resolveComponent as d,useComponentRegistry as O}from"./882bc739c8.js";import le from"./37596ace72.js";import ie from"./26155bf68c.js";import ce from"./2cab5c5c23.js";import{LogoIcon as ue,ChevronLeft as me,ChevronRight as pe}from"./c5e990946e.js";import{useHasIcon as de}from"./09c4973968.js";import{useShellModel as he,useEffectiveSelections as fe,CopilotActionsRegister as we,ShellModals as ve,ShellAssistants as be}from"./c71892453b.js";import{resolveAssetUrl as _e}from"./cec035efb1.js";import"./4910c07ca8.css";function ge({Scene:h}){return s(Se,{Scene:h})}function Se({Scene:h}){O();const P=d("Sidebar",Z);O();const B=d("SceneToolbar",re),E=d("GenerateAssetsButton",ie),F=d("SaveProjectButton",ce),{regions:f,isLayoutLoading:u,copilotAvailable:L,handleGenerateAssets:x,isGenerating:G,systemName:R,priceText:U,itemPriceText:w,focusedPlacementId:m,steps:$,stepsScope:ye,productOptionSetCount:Ne,selectedPlacementId:Ce}=he(),j=de("logo"),H=X(e=>e.isMobile),l=V(),v=l("showcase.heading1","Customize"),b=l("showcase.heading2","your design"),y=l("showcase.intro","Select your options below \u2014 the preview updates as you go."),N=S(e=>e.options),C=S(e=>e.materials),c=S(e=>e.features),J=Y(e=>e.sceneSelections),A=$.filter(e=>!e.isSummary),[k,T]=Q(null),_=k!=null?A.find(e=>e.key===k)??null:null,Ae=fe(m),I=e=>{const o=Array.isArray(e)?e[0]:e,a=c?.[o]??c?.[String(o)]??null;if(!a)return null;const r=m!=null&&ne(m)||null,i=se(a,{features:c,options:N,bindings:r}),t=oe({placementId:m,set:a,opts:i,inputs:{...te(),sceneSelections:J}});return t==null?null:ee(a,t,{features:c,options:N,bindings:r})??i.find(p=>String(p?.id)===String(t))??null},K=e=>{const o=I(e);return o?o.name??o.label??o.title??null:null},M=e=>typeof e=="string"&&e?/^https?:|^\//.test(e)?e:`/${e}`:null,z=e=>{if(e==null)return null;if(typeof e=="number")return"#"+e.toString(16).padStart(6,"0");if(typeof e=="string"){const o=e.trim();return/^[0-9a-fA-F]{3}$/.test(o)||/^[0-9a-fA-F]{6}$/.test(o)?"#"+o:o}return null},W=e=>{const o=I(e);if(!o)return null;const a=Array.isArray(e)?e[0]:e,r=c?.[a]||c?.[String(a)],t=/finish/i.test(String(r?.type||""))&&(C?.[o.value]||C?.[String(o.value)])||null,p=o.thumbnail??t?.thumbnail??t?.thumbnailUrl??t?.thumbnail_url,g=t?.textures?.diffuse??t?.diffuseMap??t?.diffuse_map??t?.materialJson?.map,q=_e(M(p)||M(g)||null,{kind:"thumbnail"}),D=t?.color??t?.materialJson?.color??o.color??o.color_hex??o.metadata?.color_hex;return{src:q,color:z(D)}};return n("div",{className:"showcase-layout",children:[s(ae,{}),L&&s(we,{}),f.sidebar&&s("aside",{className:"showcase-panel",style:u?{opacity:.6,pointerEvents:"none"}:void 0,children:_?n("div",{className:"showcase-detail",children:[n("button",{type:"button",className:"showcase-back",onClick:()=>T(null),children:[s(me,{})," ",s("span",{children:l("showcase.allOptions","All options")})]}),s("h2",{className:"showcase-detail__title",children:_.label}),s("div",{className:"showcase-detail__body",children:s(P,{embedded:!0,backHeader:!1,filterFeatureIds:_.featureIds})})]}):n("div",{className:"showcase-master",children:[n("div",{className:"showcase-brand",children:[j?s(ue,{className:"showcase-logo"}):null,s("span",{className:"showcase-brand__name",children:R})]}),v||b?n("h1",{className:"showcase-heading",children:[v,v&&b?s("br",{}):null,b]}):null,y?s("p",{className:"showcase-sub",children:y}):null,s("div",{className:"showcase-rows",children:A.map(e=>{const o=K(e.featureIds),a=!!o,r=a?W(e.featureIds):null,i=!r?.src&&!!r?.color,t=a&&!i;return n("button",{type:"button",className:"showcase-row",onClick:()=>T(e.key),disabled:u,children:[n("span",{className:`showcase-row__preview${a?i?"":" showcase-row__preview--mono":" showcase-row__preview--empty"}`,style:i?{background:r.color}:void 0,children:[t&&s("span",{className:"showcase-row__preview-initial",children:(o.trim()[0]||"?").toUpperCase()}),r?.src&&s("img",{src:r.src,alt:"",onError:g=>{g.currentTarget.style.display="none"}}),!a&&s("svg",{className:"showcase-row__preview-plus",viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",children:s("path",{d:"M8 3.25v9.5M3.25 8h9.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",fill:"none"})})]}),n("span",{className:"showcase-row__text",children:[s("span",{className:"showcase-row__label",children:e.label}),s("span",{className:"showcase-row__value",children:o||l("showcase.select","Select")})]}),s(pe,{className:"showcase-row__chev"})]},e.key)})}),n("div",{className:"showcase-foot",children:[n("div",{className:"showcase-foot__price",children:[(w?l("shell.itemPrice","ITEM PRICE"):l("shell.total","TOTAL"))?s("span",{className:"showcase-foot__label",children:w?l("shell.itemPrice","ITEM PRICE"):l("shell.total","TOTAL")}):null,s("strong",{className:"showcase-foot__value",children:w||U})]}),n("div",{className:"showcase-foot__actions",children:[s(F,{disabled:u,className:"showcase-save"}),s(E,{onClick:x,isGenerating:G,disabled:u,className:"showcase-cta"})]})]})]})}),n("main",{className:"showcase-scene",children:[s(h,{isMobile:H}),f.toolbar&&s(B,{variant:"desktop"}),f.notifications&&s(le,{}),s(be,{})]}),s(ve,{})]})}var Ve=ge;export{Ve as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import p from"./8f60e5059a.js";import h from"./9c6c598569.js";import S from"./872c4302e0.js";import{getEffectiveSelections as v,getPlacementBinding as _}from"./817d930a49.js";const g=t=>String(t??"").toLowerCase().replace(/\s+/g," ").trim();function m(t,e,s){if(e==null||!Array.isArray(t)||t.length===0)return null;const c=r=>r.value_product??r.valueProduct??r.value,o=r=>r==null?null:s?.[r]||s?.[String(r)]||null,i=t.find(r=>{const n=c(r);return n!=null&&String(n)===String(e)});if(i)return i;const l=o(e),a=g(l?.name??l?.title);if(a){const r=t.filter(n=>{const u=g(n.name??n.label??n.title);return u.length>0&&a.includes(u)});if(r.length===1)return r[0]}const d=l?l.productGraph??l.product_graph??null:null;if(d!=null){const r=t.filter(n=>{const u=o(c(n)),f=u?u.productGraph??u.product_graph??null:null;return f!=null&&String(f)===String(d)});if(r.length===1)return r[0]}return null}function O(t,{productInstances:e,hostProductOverrides:s,getProduct:c}={}){if(t==null)return null;const o=e?.[t];let i=s?.[t]??o?.variantId??o?.productId??null;if(i==null&&String(t).endsWith("__host")){const l=String(t).replace(/__host$/,""),a=e?.[l],d=c?.(a?.variantId??a?.productId),r=d?.hostVariants??d?.host_variants,n=Array.isArray(r)?r.find(u=>u?.isDefault??u?.is_default)??r[0]:null;i=n?.hostVariantId??n?.host_variant_id??null}return i}function C(t){return y(t).id}function y({placementId:t,set:e,opts:s,inputs:c}){const o=c||V(),i=String(e?.type??""),l=e?.feature_id??e?.id;if(l==null)return{id:null,rule:"none"};let a=null;if(t!=null&&(i==="load_new_product"||i==="product_change")){a=O(t,o);const n=m(s,a,o.products);if(n)return{id:n.id,rule:"variant",currentVariantId:a}}if(t!=null&&/finish/i.test(i)){const n=P(t,e,o);if(n.size>0){const u=(s||[]).find(f=>f?.value!=null&&n.has(String(f.value)));if(u)return{id:u.id,rule:"material",currentVariantId:a}}}if(t!=null){const n=v(t)||{},u=n[l]??n[String(l)];if(u!=null)return{id:u,rule:"tracked",currentVariantId:a};const f=_(t,l);return f?.default!=null?{id:f.default,rule:"binding-default",currentVariantId:a}:{id:null,rule:"none",currentVariantId:a}}const d=o.sceneSelections||{},r=d[l]??d[String(l)]??null;return{id:r,rule:r==null?"none":"scene"}}function P(t,e,s){const c=s.hostMaterialOverrides?.[t]||{},o=new Set((e?.material_targets??e?.materialTargets??e?.materials??[]).map(i=>String(i).toLowerCase()));return new Set(Object.entries(c).filter(([i])=>o.size===0||o.has(String(i).toLowerCase())).map(([,i])=>String(i)))}function V(){const t=p.getState(),e=h.getState(),s=S.getState();return{productInstances:e.productInstances||{},hostProductOverrides:t.hostProductOverrides||{},hostMaterialOverrides:t.hostMaterialOverrides||{},products:s.products||{},getProduct:s.getProduct,sceneSelections:void 0}}export{C as currentOptionIdFor,O as currentVariantIdFor,y as explainCurrentOption,V as readCurrentOptionInputs,m as resolveCurrentSwapOption};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as l,jsxs as v}from"react/jsx-runtime";import{openModal as n}from"./09c4973968.js";import{SaveIcon as a}from"./c5e990946e.js";import{useLabels as s}from"./28d887bf8a.js";import{useUIRegion as r}from"./9840b9ce12.js";function i({disabled:e,className:t="header__save-btn"}){const o=s();return r("save")?v("button",{className:t,onClick:()=>n("save"),disabled:e,style:e?{opacity:.5,pointerEvents:"none"}:void 0,title:o("save.title","Save"),children:[l(a,{className:"save-btn__icon"}),o("save.label","Save")]}):null}export{i as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import D from"./8f60e5059a.js";import I from"./9c6c598569.js";import x from"./d94df858ea.js";import S from"./1fac915f8b.js";import y,{deriveSceneFeatures as C}from"./be337ddda5.js";import{runCommand as d,COMMANDS as f}from"./d6851ea979.js";import{runIntent as P,INTENTS as H}from"./6d238282c1.js";import{UI_REGIONS as m}from"./9840b9ce12.js";import{readPieceFrame as E}from"./da7b5f450d.js";import{clearSceneLoadingAfterRender as b}from"./2774152dd2.js";const o=()=>D.getState(),s=()=>I.getState(),l=()=>o().selectedPieceIndex;function v(e=400){import("./a77b15c0d6.js").then(({refreshCanonicalState:t})=>setTimeout(()=>t(),e)).catch(()=>{})}const L=e=>s().selectInstance?.(e!=null?String(e):null),j=L,W=e=>s().selectInstance?.(e!=null?String(e):null),Q=()=>{s().clearSelection?.(),o().clearSelectedFeature()},q=()=>s().selectedInstanceId??l(),$=(e,t)=>o().setSelectedFeature(e,t),z=()=>d(f.MOVE_LEFT),J=()=>d(f.MOVE_RIGHT),K=()=>d(f.DUPLICATE),X=()=>d(f.DELETE),Z=()=>d(f.ADD_CABINET),Y=()=>d(f.OPEN_FINISH);function ee(e){const t=l();return t==null?!1:(o().setHostWidth(t,e),!0)}function te(e,t){const r=l();return r==null?!1:(o().setHostFinish(r,e,t),!0)}function oe(e){const t=l();return t==null?!1:(o().setHostStyle(t,e),!0)}function re(e){const t=l();return t==null?!1:(o().setHostHandleType(t,e),!0)}function ne(e){const t=l();return t==null?!1:(o().setHostHardwareFinish(t,e),!0)}function ce(e,t,r){const n=l();return n==null?!1:(o().setHostDoorType(n,e,t,r),!0)}function se(e){const t=l();return t==null?!1:(o().setHostProductOverride(t,e),!0)}function h(e){const t=o(),r=typeof e=="boolean"?e:!t.is3D;return t.is3D===r?!1:(t.setSceneLoading?.(!0,`Switching to ${r?"3D":"2D"}...`),s().setCameraPosition?.(r?[4,4,6]:[0,10,.1]),t.toggleView(),b(),!0)}const ae=()=>h(!1),ie=()=>h(!0),le=()=>h(),ue=()=>o().is3D,pe=()=>o().toggleDimensions(),de=()=>o().toggleWalls(),fe=()=>o().toggleFloor(),Se=()=>o().toggleCeiling(),ge=()=>s().resetCameraToDefault(),xe=e=>s().setCameraPreset(e),me=(e,t,r)=>{if(Array.isArray(e))return s().focusOnObject(e,Number.isFinite(t)?t:1,r),!0;const n=E(e);return n?(s().focusOnObject(n.center,Number.isFinite(t)?t:n.radius,r??n.facingY),!0):!1};async function he(e){if(e==null)return!1;const r=y.getState().sceneConfigurations?.[s().activeSceneConfigId],n=C(r);let a=!1;try{const{executeLayoutChange:p}=await import("./9526094bb7.js");a=p(e,n)}catch{return!1}const c=n.find(p=>p.type==="layout_change");return c&&x.getState().setSceneSelection(c.id,e),v(),a}const ye=e=>o().setRoomFootprint(e),w=()=>P({type:H.QUOTE_OPEN},()=>{try{o().openModal?.("quote")}catch{}}),Pe=(e={})=>{const{waitForImages:t=!1,generate:r=!1,timeoutMs:n,onProgress:a}=e;return!t&&!r?w():(async()=>{try{const c=await import("./5d05e8982e.js"),p=r===!0?["silo","lifestyle"]:Array.isArray(r)?r:r?[r]:[];if(p.length){const u={silo:c.generateSilo,lifestyle:c.generateLifestyle,ar:c.generateAr,pdf:c.generateBomPdf};await Promise.all(p.map(g=>{const i=u[g];return i?i({timeoutMs:n,onProgress:a}).catch(T=>{}):null}).filter(Boolean))}else{const u=c.generationStatus?.()??null,g=u?[...u.silo??[],...u.lifestyle??[],u.ar,u.pdf].filter(i=>i&&i.status==="generating").map(i=>i.id):[];g.length&&await c.waitForAssets(g,{timeoutMs:n,onProgress:a}).catch(i=>{})}}catch{}return w()})()},M=e=>{try{o().setRegions?.(e)}catch{}},F=(e,t)=>{const r=t.length===0?m:t.flat().filter(c=>typeof c=="string");r.filter(c=>!m.includes(c)).length;const a={};for(const c of r)m.includes(c)&&(a[c]=e);Object.keys(a).length&&M(a)},He=(...e)=>F(!1,e),we=(...e)=>F(!0,e),Fe=e=>{try{o().showInfo?.(e)}catch{}},De=(...e)=>{try{o().setSceneLoading?.(...e)}catch{}},Ie=()=>{try{o().clearSceneLoading?.()}catch{}},Ce=e=>{try{o().setPendingSlotPlacement?.(e)}catch{}},Ee=()=>{try{o().clearPendingSlotPlacement?.()}catch{}},be=()=>{try{o().clearDeferredHostedProductPlacement?.()}catch{}},ve=(...e)=>{try{return o().setHostedProductFeatureForSlot?.(...e)}catch{return}},Le=(...e)=>{try{return o().updateHostedProductSlotForProduct?.(...e)}catch{return}},Me=()=>{try{s().clearSelection?.()}catch{}},Te=e=>{try{s().removeProductInstance?.(e)}catch{}},Oe=(e,t)=>{try{s().updateInstanceVariant?.(e,t)}catch{}},Ae=(e,t)=>{try{x.getState().setSceneSelection?.(e,t)}catch{}},Ue=()=>S.getState().undo(),_e=()=>S.getState().redo(),Ne=()=>S.getState().clearHistory(),Re=()=>(S.getState().past?.length||0)>0,Ve=()=>(S.getState().future?.length||0)>0,Ge=()=>P({type:H.SCENE_RESET},()=>s().resetScene()),ke=e=>o().removeHostedProduct(e),Be=()=>o().clearHostedProducts(),je=e=>o().addHostedProduct(e),We=(e,t)=>o().setPendingHostedProduct(e,t),Qe=()=>o().clearPendingHostedProduct(),qe=(e,t,r,n,a)=>o().placeHostedProductAtPiece(e,t,r,n,a),$e=()=>o().toggleSidebar(),ze=e=>o().setSidebarTab(e),Je=(e,t)=>o().openModal(e,t),Ke=()=>o().closeModal(),Xe=e=>o().addNotification(e),Ze=e=>o().setGuiVisible(e);async function Ye(){const{buildSceneSnapshot:e}=await import("./7f833bc5af.js");return e()}async function et(e){const{restoreSceneSnapshot:t}=await import("./7f833bc5af.js");return t(e)}async function tt(e){const{default:t}=await import("./ee9b9fd7d1.js");return t.copyShareUrl(e)}async function ot(e){const{default:t}=await import("./ee9b9fd7d1.js");return t.generateShareUrl(e)}async function rt(e){if(!e)return null;const{exportModel:t}=await import("./f7b4a178e3.js");return new Promise((r,n)=>{t({model:e,callBack:r}).catch(n)})}async function nt(e){const{generateARModel:t}=await import("./f7b4a178e3.js");return t(e)}async function ct(e){return e?(await import("./ee242c0099.js")).loadDomainDefaults(e):null}async function st(e){const{preloadMaterials:t}=await import("./c44d37da7a.js");return t(e)}async function at(){const{default:e}=await import("./ee9b9fd7d1.js");return e.parseUrlConfig()}async function it(e){if(!e)return null;const{default:t}=await import("./ee9b9fd7d1.js");return t.restoreFromConfig(e,{configurationGraphStore:y,sceneConfigStore:x})}export{je as addHostedProduct,Z as addPiece,Ve as canRedo,Re as canUndo,he as changeLayout,be as clearDeferredHostedProductPlacement,Ne as clearHistory,Be as clearHostedProducts,Qe as clearPendingHostedProduct,Ee as clearPendingSlotPlacement,Ie as clearSceneLoading,Me as clearSceneSelection,Ke as closeModal,tt as copyShareUrl,X as deleteSelected,Q as deselect,K as duplicateSelected,rt as exportModelGLB,me as focusOnObject,nt as generateAR,q as getSelectedProduct,ot as getShareUrl,He as hideUI,ue as isView3D,ct as loadDomainDefaults,z as moveSelectedLeft,J as moveSelectedRight,Xe as notify,Y as openFinishSelector,Je as openModal,Pe as openQuote,at as parseShareLink,qe as placeHostedProductAtHost,st as preloadMaterials,_e as redo,ke as removeHostedProduct,Te as removeSceneInstance,ge as resetCamera,Ge as resetScene,et as restoreSceneSnapshot,it as restoreShareLink,W as selectAppliance,$ as selectFeature,j as selectPiece,L as selectProduct,xe as setCameraPreset,Ze as setGuiVisible,ve as setHostedProductFeatureForSlot,We as setPendingHostedProduct,Ce as setPendingSlotPlacement,ye as setRoomFootprint,Oe as setSceneInstanceVariant,De as setSceneLoading,Ae as setSceneSelection,ce as setSelectedDoorType,te as setSelectedFinish,re as setSelectedHandle,ne as setSelectedHardwareFinish,se as setSelectedProduct,oe as setSelectedStyle,ee as setSelectedWidth,ze as setSidebarTab,M as setUIRegions,h as setViewMode,Fe as showInfo,we as showUI,Ye as snapshotScene,Se as toggleCeiling,pe as toggleDimensions,fe as toggleFloor,$e as toggleSidebar,le as toggleView,de as toggleWalls,Ue as undo,Le as updateHostedProductSlotForProduct,ae as view2D,ie as view3D};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const A=Object.freeze({READY:"ready",ERROR:"error",OPTION_SELECTED:"option.selected",PRODUCT_ADDED:"product.added",PRODUCT_REMOVED:"product.removed",PRODUCT_MOVED:"product.moved",LAYOUT_CHANGED:"layout.changed",EVALUATE_STARTED:"evaluate.started",EVALUATE_COMPLETED:"evaluate.completed",EVALUATE_REJECTED:"evaluate.rejected",SELECTION_CHANGED:"selection.changed",PRICE_CHANGED:"price.changed",SCENE_READY:"scene.ready",PROJECT_SAVED:"project.saved",ASSETS_GENERATED:"assets.generated",EXTENSION_FAILED:"extension.failed"}),n=new Map,f=r=>typeof r=="string"?r.trim():"",i=new Set(["ready","scene.ready"]),c=new Map;function d(r,t){const e=f(r);if(!e||typeof t!="function")return()=>{};if(n.has(e)||n.set(e,new Set),n.get(e).add(t),c.has(e))try{t(c.get(e),e)}catch{}return()=>{const o=n.get(e);o&&(o.delete(t),o.size===0&&n.delete(e))}}function T(r,t){const e=d(r,(o,E)=>{e(),t(o,E)});return e}function u(r,t){n.get(f(r))?.delete(t)}function D(){return Array.from(n.keys())}function _(){c.clear(),n.clear()}function p(r,t){const e=f(r);if(!e)return;i.has(e)&&c.set(e,t);const o=n.get(e);if(o)for(const s of Array.from(o))try{s(t,e)}catch{}const E=n.get("*");if(E)for(const s of Array.from(E))try{s(e,t)}catch{}}export{A as EVENTS,_ as _resetEvents,p as emitEvent,D as listEvents,u as offEvent,d as onEvent,T as onceEvent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{fetchAiImageQuota as u}from"./79a397bb92.js";const f="https://imagine.io/pricing",r=e=>{if(e==null)return null;const i=Number(e);return Number.isFinite(i)?i:null};function o(e){if(!e||typeof e!="object")return null;const i=r(e.limit),n=r(e.used)??0;let t=r(e.remaining);return t===null&&i!==null&&(t=Math.max(0,i-n)),t!==null&&(t=Math.max(0,t)),{allowed:e.allowed!==!1,entitled:e.entitled!==!1,used:n,limit:i,remaining:t,period:typeof e.period=="string"?e.period:null,fetchedAt:Date.now()}}let l=!1;async function d(){try{return o(await u())}catch{return l||(l=!0),null}}function a(e){return!e||e.allowed?null:{code:e.entitled?"limit_reached":"not_entitled"}}function c(e){return e?a(e)?0:e.limit===null||e.remaining===null||e.remaining===void 0?1/0:Math.max(0,Number(e.remaining)||0):1/0}function s(e){return e===1?"Only 1 AI image was left this cycle":`Only ${e} AI images were left this cycle`}function g(e){return e?e.code==="not_entitled"?"AI image generation is not on this plan":"AI image limit reached for this cycle":null}function p(e){const i=e?.period;if(typeof i!="string")return null;let n=i.match(/^(\d{4})-(\d{2})-(\d{2})$/);if(n){const t=new Date(Number(n[1]),Number(n[2])-1,Number(n[3]));return Number.isNaN(t.getTime())?null:(t.setMonth(t.getMonth()+1),{kind:"date",date:t})}if(n=i.match(/^(\d{4})-(\d{2})$/),n){const t=new Date(Number(n[1]),Number(n[2]),1);return Number.isNaN(t.getTime())?null:{kind:"month",date:t}}return null}export{f as PLANS_URL,a as aiQuotaBlock,g as aiQuotaBlockText,c as aiQuotaImageBudget,s as aiQuotaPartialText,p as aiQuotaResetDate,o as normalizeAiQuota,d as refreshAiQuota};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
@layer sdk-base, vendor, sdk;
|
|
2
|
+
@layer sdk {
|
|
3
|
+
/* Boot failure screen — a FIXED palette, deliberately no theme tokens.
|
|
4
|
+
Same reasoning as ui/LicenceNotice.css: this renders when boot did not finish, so the theme
|
|
5
|
+
may never have applied, and a token that resolves to nothing leaves unreadable text on an
|
|
6
|
+
unpainted ground (which is exactly how a shell's CTA went invisible once). Every value here
|
|
7
|
+
is literal, and every property .error-screen would otherwise supply is set at higher
|
|
8
|
+
specificity. */
|
|
9
|
+
.error-screen.boot-error {
|
|
10
|
+
position: absolute;
|
|
11
|
+
inset: 0;
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
justify-content: center;
|
|
15
|
+
height: 100%;
|
|
16
|
+
padding: 24px;
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
background: #f4f5f7;
|
|
19
|
+
color: #111111;
|
|
20
|
+
color-scheme: light;
|
|
21
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
|
|
22
|
+
text-align: left;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.error-screen.boot-error .boot-error__card {
|
|
26
|
+
max-width: 520px;
|
|
27
|
+
padding: 28px 32px;
|
|
28
|
+
background: #ffffff;
|
|
29
|
+
border: 1px solid #e3e5e8;
|
|
30
|
+
border-radius: 12px;
|
|
31
|
+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.error-screen.boot-error h1.boot-error__title {
|
|
35
|
+
margin: 0 0 10px;
|
|
36
|
+
font-size: 18px;
|
|
37
|
+
font-weight: 600;
|
|
38
|
+
line-height: 1.35;
|
|
39
|
+
color: #111111;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.error-screen.boot-error button.boot-error__retry {
|
|
43
|
+
margin-top: 18px;
|
|
44
|
+
padding: 9px 18px;
|
|
45
|
+
border: 1px solid #d0d3d8;
|
|
46
|
+
border-radius: 6px;
|
|
47
|
+
background: #ffffff;
|
|
48
|
+
color: #111111;
|
|
49
|
+
font-size: 13px;
|
|
50
|
+
font-weight: 600;
|
|
51
|
+
cursor: pointer;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.error-screen.boot-error button.boot-error__retry:hover {
|
|
55
|
+
background: #f4f5f7;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.error-screen.boot-error p.boot-error__body {
|
|
59
|
+
margin: 0;
|
|
60
|
+
font-size: 14px;
|
|
61
|
+
line-height: 1.55;
|
|
62
|
+
color: #555b66;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* DEV ONLY (see BootErrorNotice.jsx): the integrator's instruction, COLLAPSED so it never
|
|
66
|
+
competes with the shopper's message, and visually separated so it cannot be mistaken for it. */
|
|
67
|
+
.error-screen.boot-error .boot-error__dev {
|
|
68
|
+
margin-top: 20px;
|
|
69
|
+
padding-top: 16px;
|
|
70
|
+
border-top: 1px dashed #d8dbe0;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.error-screen.boot-error summary.boot-error__dev-tag {
|
|
74
|
+
display: inline-block;
|
|
75
|
+
padding: 3px 10px;
|
|
76
|
+
border-radius: 999px;
|
|
77
|
+
background: #eef1f5;
|
|
78
|
+
color: #5b6472;
|
|
79
|
+
font-size: 10px;
|
|
80
|
+
font-weight: 700;
|
|
81
|
+
letter-spacing: 0.06em;
|
|
82
|
+
text-transform: uppercase;
|
|
83
|
+
cursor: pointer;
|
|
84
|
+
user-select: none;
|
|
85
|
+
list-style: none; /* hide the default marker; the pill IS the affordance */
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.error-screen.boot-error summary.boot-error__dev-tag::-webkit-details-marker { display: none; }
|
|
89
|
+
|
|
90
|
+
.error-screen.boot-error summary.boot-error__dev-tag::after {
|
|
91
|
+
content: ' ▸';
|
|
92
|
+
font-size: 9px;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.error-screen.boot-error .boot-error__dev[open] summary.boot-error__dev-tag::after {
|
|
96
|
+
content: ' ▾';
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.error-screen.boot-error summary.boot-error__dev-tag:hover {
|
|
100
|
+
background: #e4e8ee;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.error-screen.boot-error p.boot-error__dev-fix {
|
|
104
|
+
margin: 10px 0 0;
|
|
105
|
+
font-size: 13px;
|
|
106
|
+
line-height: 1.55;
|
|
107
|
+
color: #3f4652;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useSyncExternalStore as L}from"react";import h from"./baeaed46c9.js";import c from"./daa11edd01.js";import f from"./e4fe0551fd.js";import l from"./2b6aa27f6d.js";const o=new Map([["default",h],["wizard",c],["theme2",c],["showroom",f],["theme3",f],["showcase",l],["theme4",l]]),p=new Map(o);let y=0;const i=new Set;function u(){y+=1;for(const t of i)try{t()}catch{}}const s=t=>t?String(t).trim().toLowerCase():null;let r=null,d=null;function b(t,e){const n=s(t);if(!n||typeof e!="function")return()=>{};const a=o.has(n)?o.get(n):void 0;return o.set(n,e),u(),()=>{o.get(n)===e&&(a!==void 0?o.set(n,a):o.delete(n),u())}}function M(t){const e=r;return r=s(t),r&&o.has(r),u(),()=>{r=e,u()}}function k(){return r}function z(t){d=s(t)}function K(){return r??d??"default"}function R(t){const e=s(t);return!!e&&o.has(e)}function E(){return[...o.entries()].map(([t,e])=>({key:t,custom:p.get(t)!==e}))}function O(t){const e=s(t)??"default";return o.get(e)||o.get("default")}function _(t){return i.add(t),()=>{i.delete(t)}}const m=()=>y;function V(){return L(_,m,m)}function W(){r=null,o.clear();for(const[t,e]of p)o.set(t,e);u()}export{z as _publishResolvedLayoutKey,W as _resetLayouts,K as activeLayoutKey,R as hasLayout,k as layoutOverride,E as listLayouts,b as registerLayout,O as resolveLayout,M as setLayout,V as useLayoutRegistry};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{introspectCredential as l}from"./79a397bb92.js";import{setAiChatFeatureFromBackend as o}from"./87f511c4a8.js";let r=null,n=null;const u=new Set;function i(){for(const t of u)try{t()}catch{}}function s(t){return!t||typeof t!="object"?null:(r=t,o(t.features),i(),t)}function m({force:t=!1}={}){return n&&!t||(n=l().then(e=>!e||e.valid===!1?null:s(e)).catch(e=>(f(e)&&s({features:{ai_chat_configurator:!1}}),null))),n}function f(t){return(t?.status??t?.response?.status??null)===401?!0:/\b401\b/.test(String(t?.message||""))}function p(){return r}function h(t){return u.add(t),()=>{u.delete(t)}}function _(){r=null,n=null,i()}export{_ as _resetEntitlements,s as applyEntitlements,p as getEntitlements,m as refreshEntitlements,h as subscribeEntitlementPayload};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const m=.8,x=1800,g=5e3;let s=null,t=null,u=0,o=null,l=null;const p=new Set;function E(n){return typeof n!="function"?()=>{}:(p.add(n),()=>p.delete(n))}function S(){for(const n of p)try{n(o)}catch{}}function y(n){return typeof n!="function"?(s=null,_(),!1):(s=n,_(),!0)}function h(){return typeof s=="function"}function w(){return t}function d(){return o}function _(){const n=o;t=null,u=0,o=null,l=null,n!=null&&S()}function k(n){const i=o,T=e=>(o!==i&&S(),e);if(typeof n=="string"){const e=n.trim();if(!e)throw new Error("getToken() returned an empty string");return t=e,o=null,u=Date.now()+1800*1e3*.8,T(t)}if(!n||typeof n!="object")throw new Error("getToken() must resolve to a token string or a mint response object");const a=n.access_token??n.accessToken??n.token??null;if(typeof a!="string"||!a.trim())throw new Error("getToken() response has no access_token");t=a.trim(),o=n.scope??null;let r=null;const c=n.expires_at??n.expiresAt??null;if(c!=null){const e=typeof c=="number"?c:Date.parse(c);Number.isFinite(e)&&(r=e-Date.now())}if(r==null){const e=Number(n.expires_in??n.expiresIn);Number.isFinite(e)&&e>0&&(r=e*1e3)}return(r==null||!Number.isFinite(r))&&(r=1800*1e3),u=Date.now()+Math.max(5e3,r*.8),T(t)}let f=null;function L(){return f}async function b({force:n=!1}={}){return s?!n&&t&&Date.now()<u?t:l||(l=(async()=>{try{const i=k(await s());return f=null,i}catch(i){return f=i?.message||String(i),n&&(t=null,u=0),t}finally{l=null}})(),l):null}function A(){f=null,s=null,_()}export{A as _resetSessionToken,_ as clearSessionToken,b as ensureSessionToken,L as getLastMintError,d as getSessionScope,w as getSessionToken,h as hasTokenProvider,E as onScopeChange,y as setTokenProvider};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useEffect as s}from"react";import a from"./1fac915f8b.js";function f({disabled:o=!1}={}){s(()=>{if(o)return;const u=e=>{if(!e)return!1;if(e.isContentEditable)return!0;const t=e.tagName?.toLowerCase();if(t==="textarea"||t==="select")return!0;if(t==="input"){const r=(e.type||"text").toLowerCase();return r!=="range"&&r!=="checkbox"&&r!=="radio"&&r!=="button"}return!1},i=()=>!!document.querySelector(".modal-overlay"),n=e=>{if(!(e.ctrlKey||e.metaKey)||e.altKey||u(e.target)||i()||e.key.toLowerCase()!=="z")return;e.preventDefault();const t=a.getState();t&&(e.shiftKey?t.redo?.():t.undo?.())};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[o])}export{f as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import _ from"./9c6c598569.js";import P from"./d94df858ea.js";import O from"./872c4302e0.js";import q from"./3f37665dd1.js";import w from"./be337ddda5.js";import{formatMoney as L,getCurrency as G}from"./28d887bf8a.js";import{getEffectiveSelections as $,getPlacementBindings as k}from"./817d930a49.js";import{collectPlacementParts as B}from"./81802759ca.js";const v=Object.freeze({perPlacementBytes:4*1024,perProjectBytes:64*1024}),g={project:{},placements:{}};function x(e){try{return new TextEncoder().encode(JSON.stringify(e)).length}catch{return 1/0}}function et(e,n,o,{placementId:t}={}){const u=typeof n=="string"?n.trim():"";if(!u)return!1;if(e==="project"){const r={...g.project,[u]:o};return x(r)>v.perProjectBytes?!1:(g.project=r,!0)}if(e==="placement"){const r=t!=null?String(t):"";if(!r)return!1;const s={...g.placements[r]||{},[u]:o};return x(s)>v.perPlacementBytes?!1:(g.placements[r]=s,!0)}return!1}function F(e,n,{placementId:o}={}){const t=e==="placement"?g.placements[String(o)]||{}:g.project,u=n?t[n]:t;try{return Object.freeze(JSON.parse(JSON.stringify(u??null)))}catch{return null}}function nt(){try{return JSON.parse(JSON.stringify(g))}catch{return{project:{},placements:{}}}}function ot(e){!e||typeof e!="object"||(g.project=e.project&&typeof e.project=="object"?{...e.project}:{},g.placements=e.placements&&typeof e.placements=="object"?{...e.placements}:{})}function rt(){g.project={},g.placements={}}function V(){const e=_.getState(),n=P.getState(),o=O.getState(),t=e.productInstances||{},u=n.placementPricing||{},s=Object.entries(t).map(([l,c])=>{const m=o.getProduct?.(c?.variantId)||o.getProduct?.(c?.productId)||null,p=u[l]||null,f=B(String(l)),i=j({placementId:String(l),selections:c?.effectiveSelections??c?.selections??null}),d=T(p?.adjustments,{features:o.features||{},options:o.options||{}});return{placementId:String(l),productId:c?.productId??null,variantId:c?.variantId??null,sku:m?.sku??m?.code??null,name:m?.name??null,qty:1,sequence:Number(c?.sequence??0),placementGroup:c?.placementGroup??null,unitPrice:p?.unitPrice??null,adjustments:d,selections:i,selectionsNamed:A(i,{features:o.features||{},options:o.options||{}},d),components:f.components,materials:f.materials,metadata:F("placement",void 0,{placementId:l})}}).sort((l,c)=>l.sequence-c.sequence).flatMap(l=>{const c=C(l,t[l.placementId],o,u);return c?[l,c]:[l]});return{lines:J(s,o.features||{}),aggregateAdjustments:Array.isArray(n.aggregateAdjustments)?n.aggregateAdjustments:[],grandTotal:n.totalPrice??n.sceneTotal??n.grandTotal??null,currency:n.currency??null,metadata:F("project")}}function C(e,n,o,t){const u=`${e.placementId}__host`,r=t?.[u];if(!r)return null;const s=n?.hostVariantId??n?.host_variant_id??(()=>{if((n?.positionedAbove??n?.positioned_above)!=null)return null;const c=o.getProduct?.(n?.variantId)||o.getProduct?.(n?.productId),m=c?.hostVariants??c?.host_variants;if(!Array.isArray(m)||!m.length)return null;const p=m.find(f=>f?.isDefault??f?.is_default)||m[0];return p?.hostVariantId??p?.host_variant_id??null})(),a=s!=null&&o.getProduct?.(s)||null,l=T(r?.adjustments,{features:o.features||{},options:o.options||{}});return{placementId:u,productId:s,variantId:s,sku:a?.sku??a?.code??null,name:a?.name??(s!=null?`Item ${s}`:"Host item"),qty:1,sequence:e.sequence,placementGroup:e.placementGroup,unitPrice:r?.unitPrice??null,adjustments:l,selections:{},selectionsNamed:[],components:[],materials:[],hostOf:e.placementId,metadata:null}}function J(e,n){const o=new Map;for(const t of e){const u=t.hostOf!=null?t.selections||{}:j(t)||{},r=Object.entries(u).filter(([m])=>{const f=(n?.[m]??n?.[String(m)])?.priceMode??"per_placement";return!M(f)&&f!=="excluded"}).map(([m,p])=>`${m}:${p}`).sort().join("|");let s="";try{s=JSON.stringify(t.metadata??null)}catch{s=String(Math.random())}const a=[...(t.components??[]).map(m=>`c:${m.slot}=${m.componentId}`),...(t.materials??[]).map(m=>`m:${m.slot}=${m.materialId}`)].sort().join(","),l=[t.hostOf!=null?"H":"",t.productId,t.variantId,t.unitPrice,r,a,s].join("\u241F"),c=o.get(l);c?(c.qty+=1,c.placementIds.push(t.placementId)):o.set(l,{...t,qty:1,placementIds:[t.placementId],effectiveSelections:u})}return[...o.values()]}function T(e,{features:n,options:o}){return Array.isArray(e)?e.map(t=>{if(!t||typeof t!="object")return t;const u=n?.[t.optionSetId]??n?.[String(t.optionSetId)]??null;let r=o?.[t.optionId]??o?.[String(t.optionId)]??null;!r&&Array.isArray(u?.options)&&(r=u.options.find(a=>a&&typeof a=="object"&&String(a.id)===String(t.optionId))??null);const s=r?.name??r?.label??null;return{...t,label:t.label??t.name??s??u?.name??null,optionName:s,optionSetName:t.optionSetLabel??t.option_set_label??u?.name??null}}):[]}function A(e,{features:n,options:o},t=null){if(!e||typeof e!="object")return[];const u=(r,s)=>{if(!Array.isArray(t))return null;let a=null;for(const l of t){if(!l||typeof l!="object")continue;const c=l.optionId!=null&&String(l.optionId)===String(s),m=l.optionId==null&&l.optionSetId!=null&&String(l.optionSetId)===String(r);if(!c&&!m)continue;const p=Number(l.amount??l.value??l.delta);Number.isFinite(p)&&(a=(a??0)+p)}return a};return Object.entries(e).map(([r,s])=>{const a=n?.[r]??n?.[String(r)]??null;let l=o?.[s]??o?.[String(s)]??null;return!l&&Array.isArray(a?.options)&&(l=a.options.find(c=>c&&typeof c=="object"&&String(c.id)===String(s))??null),{setId:r,setName:a?.name??String(r),setType:a?.type??null,optionId:s??null,optionName:l?.name??(s!=null?String(s):null),amount:u(r,s)}}).filter(r=>r.optionId!=null)}function j(e){const n=e.placementId,o={},t=k(n);if(Array.isArray(t))for(const u of t){const r=u?.optionSetId??u?.option_set_id,s=u?.selected??u?.default??u?.defaultOption??null;r!=null&&s!=null&&(o[r]=s)}Object.assign(o,$(n)||{});try{const u=_.getState().placementSelections?.[n]??_.getState().placementSelections?.[String(n)];u&&typeof u=="object"&&Object.assign(o,u)}catch{}return Object.keys(o).length?o:e.selections??null}const M=e=>String(e||"").startsWith("aggregate");function E(e,n){if(!e||typeof e!="object")return e??null;const o={};for(const[t,u]of Object.entries(e)){const r=n?.[t]??n?.[String(t)],s=String(r?.priceMode??"per_placement");!M(s)&&s!=="excluded"&&s!=="not_listed"&&(o[t]=u)}return o}function z(e,n,o,t){if(!e||typeof e!="object"||t==null)return e??null;const u={};for(const[r,s]of Object.entries(e)){const a=n?.[r]??n?.[String(r)],l=String(a?.type??"").toLowerCase();if(l==="load_new_product"||l==="product_change"){let c=o?.[s]??o?.[String(s)]??null;!c&&Array.isArray(a?.options)&&(c=a.options.find(p=>p&&typeof p=="object"&&String(p.id)===String(s))??null);const m=c?.value??c?.valueProductVariant??c?.value_product_variant??null;if(m!=null&&String(m)!==String(t))continue}u[r]=s}return u}function D(e,n){if(!e||typeof e!="object")return e??null;const o={};for(const[t,u]of Object.entries(e))((n?.[t]??n?.[String(t)])?.priceMode??"per_placement")!=="excluded"&&(o[t]=u);return o}function st(e){return j({placementId:String(e),selections:null})||{}}function H(e){return Array.isArray(e)?e.reduce((n,o)=>{const t=Number(o?.amount??o?.value??o);return Number.isFinite(t)?n+t:n},0):0}function ut({quotedAt:e}={}){const n=V(),o=O.getState(),t=P.getState(),u=w.getState(),r={features:o.features||{},options:o.options||{}},s=n.currency??G()??null,a=i=>Number.isFinite(Number(i))?L(Number(i),s):null,l=(n.lines||[]).map(i=>{const d=Number(i.qty??1)||1,S=Number.isFinite(Number(i.unitPrice))?Number(i.unitPrice):null,I=H(i.adjustments),y=S==null?null:S*d;return{...i,qty:d,unitPrice:S,adjustmentTotal:I,lineTotal:y,unitPriceFormatted:a(S),lineTotalFormatted:a(y),selections:A(z(E(i.effectiveSelections??j(i),r.features),r.features,r.options,i.variantId),r,i.adjustments)}}),c=(n.aggregateAdjustments||[]).filter(i=>Number(i.amount??i.unitAmount??i.unit_amount)!==0).map(i=>{const d=i.optionSetId??i.option_set_id??null,S=i.optionId??i.option_id??null,I=r.features?.[d]??r.features?.[String(d)]??null,y=r.options?.[S]??r.options?.[String(S)]??null,b=Number.isFinite(Number(i.unitAmount??i.unit_amount))?Number(i.unitAmount??i.unit_amount):null,N=Number(i.count??1)||1,h=Number.isFinite(Number(i.amount))?Number(i.amount):b==null?null:b*N;return{optionSetId:d,optionId:S,setName:i.optionSetLabel??i.option_set_label??I?.name??(d!=null?String(d):null),label:i.label??y?.name??(S!=null?String(S):null),unitAmount:b,count:N,amount:h,unitAmountFormatted:a(b),amountFormatted:a(h)}}),m=l.reduce((i,d)=>i+(Number(d.lineTotal)||0),0),p=c.reduce((i,d)=>i+(Number(d.amount)||0),0),f=n.grandTotal;return{quotedAt:e??new Date().toISOString(),system:{id:u.systemId??null,name:u.systemName??null},currency:s,lines:l,additionalLines:c,scene:{selections:A(D(t.sceneSelections,r.features),r)},images:K(),totals:{lineCount:l.length,unitCount:l.reduce((i,d)=>i+(Number(d.qty)||0),0),subtotal:m,subtotalFormatted:a(m),additionalSubtotal:p,additionalSubtotalFormatted:a(p),grandTotal:f,grandTotalFormatted:a(f),hasSceneLevelAdjustment:Number.isFinite(Number(f))&&Math.abs(Number(f)-(m+p))>.005},metadata:n.metadata}}function K(){let e=[],n=null;try{const t=q.getState();e=Array.isArray(t.assets)?t.assets:[],n=t.uploadedImageUrl??null}catch{}const o=e.map(t=>({id:t.id,type:t.type,label:t.label,status:t.status,progress:t.progress??0,url:t.url??null,error:t.error??null}));return{images:o,ready:o.filter(t=>t.url&&t.status==="complete"),uploadedImageUrl:n}}export{v as METADATA_LIMITS,rt as _resetMetadata,V as readBom,K as readGeneratedAssets,F as readMetadata,ut as readQuote,st as resolveEffectiveSelections,ot as restoreMetadata,nt as serializeMetadata,et as setMetadata};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useMemo as a}from"react";import e from"./8f60e5059a.js";function n(){const t=e(o=>o.validCornerSlots),r=e(o=>o.wallCornerCount);return a(()=>({validCornerSlots:t||[],wallCornerCount:r??0}),[t,r])}function l(){const t=e.getState();try{t.clearHostFinishes?.()}catch{}try{t.clearHostHandleTypes?.()}catch{}try{t.clearHostHardwareFinishes?.()}catch{}try{t.clearHostStyles?.()}catch{}}const i=()=>{try{e.getState().clearHostFinishes?.()}catch{}},d=()=>{try{e.getState().clearHostHandleTypes?.()}catch{}},u=()=>{try{e.getState().clearHostHardwareFinishes?.()}catch{}},p=()=>{try{e.getState().clearHostStyles?.()}catch{}};function H(){try{return e.getState().basePiecePositions||{}}catch{return{}}}function S(...t){try{return e.getState().addSurfaceHostedProduct?.(...t)}catch{return null}}function h(t){try{e.setState(r=>({sceneHostedProducts:[...r.sceneHostedProducts||[],t]}))}catch{}}function y(){try{e.setState({pieceOverlapDetected:!1,tallWallOverlapDetected:!1,wallPieceOverlapDetected:!1,overlappingPieces:[]})}catch{}}export{S as addSurfaceHostedProduct,h as appendSceneHostedProduct,i as clearHostFinishes,d as clearHostHandleTypes,u as clearHostHardwareFinishes,l as clearHostOverrides,p as clearHostStyles,y as clearOverlapFlags,H as getBasePiecePositions,n as useCornerSlots};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getApiBaseUrl as F}from"./8ade32d067.js";import{describeBootFailure as K,probeBackendReachable as N,warnIntegrator as q}from"./05973a4da2.js";import{adoptUrlCredentials as J}from"./1fff100656.js";import Q from"./872c4302e0.js";import m from"./be337ddda5.js";import X from"./9c6c598569.js";import i from"./8f60e5059a.js";import _ from"./1fac915f8b.js";import{recomputePrice as A}from"./67f6338a4a.js";import{setUseMobileTextures as Y}from"./c44d37da7a.js";import{initIframeMessageService as Z}from"./1e243363f6.js";import{whenPiecePositionsReady as tt,waitForAssetsIdle as D}from"./2774152dd2.js";import{applyLayoutSceneSelections as et,applyLayoutStyling as at}from"./37addc7fb3.js";import{setTokenProvider as nt}from"./33fa2c8ca2.js";import{hideUI as G}from"./2cafe3274b.js";import{UI_REGIONS as k}from"./9840b9ce12.js";const _t="This configurator is unavailable.";function kt({resolveInitialSystemId:B,resolveConfigurator:v,resolveConfiguratorKey:P,resolveInitialChannelId:W,getToken:C,onReady:x,onError:L}={}){typeof C=="function"&&nt(C);let r=!1,w=null;return(async()=>{const l=await import("./a77b15c0d6.js"),T=W?.();T!=null&&l.setChannelId?.(T),import.meta.env?.DEV&&!window.__sdkEventLoggerRegistered&&(window.__sdkEventLoggerRegistered=!0,l.on?.("*",n=>{}));let d=B?.();const y=J().shareToken;y&&l.setShareToken?.(y);let u=null;if(y)try{u=await l.loadProject(y);const n=u?.system?.id??u?.system??u?.scene_snapshot?.canonical?.systemId??null;n!=null&&(d=n)}catch{}const{checkConfiguratorLicence:M,getConfiguratorBlockedMessage:$}=await import("./3bbcee0334.js"),H=await M({systemId:d});if(r)return;if(!H){L?.($(),{code:"unlicensed"});return}try{const{refreshEntitlements:n}=await import("./32861ea2b0.js");n().catch(()=>{})}catch{}try{const{ui:n,sceneCapabilities:c}=v?.(d)||{};n&&Object.keys(n).length&&i.setState(n),c&&i.setState({sceneCapabilities:c});const f=P?.(d);f!=null&&m.setState({configuratorKey:f}),i.setState({showWalls:!!c?.walls})}catch{}let R=!1;try{const{prepareTheme:n}=await import("./be0cfe2236.js");R=await n(d)}catch{}if(!r)try{try{await l.loadConfigurator(d)}catch(t){if(t?.status===401||t?.status===403||t?.status===404)throw t;await Q.getState().loadCatalog({systemId:d}),await m.getState().loadConfigurations(d);const e=m.getState(),a=e.systemDomainDefaults??e.systemRoom?.domain_defaults??null;a&&await l.loadDomainDefaults(a)}try{const t=m.getState(),e=t.systemId??d,a=v?.(e)||{};a.ui&&Object.keys(a.ui).length&&i.setState(a.ui);const s=!!t.systemRoom;i.setState({sceneCapabilities:{dimensions:s,walls:s},showWalls:s});const h=P?.(e);h!=null&&m.setState({configuratorKey:h})}catch{}if(!R)try{const{applySystemTheme:t}=await import("./5c9fd9201c.js");let e=null,a=!1;try{const S=new URLSearchParams(window.location.search);S.has("theme")&&(e=S.get("theme"),a=!0)}catch{}if(!a)for(let S=0;S<20;S+=1){const O=m.getState();if(e=O.systemThemeRecord??O.systemTheme,e!=null||r)break;await new Promise(z=>setTimeout(z,100))}if(r)return;const s=typeof document<"u"&&!!document.documentElement.getAttribute("data-theme-id"),h=typeof e=="string"&&/^\d+$/.test(e.trim()),V=s&&h&&!a;(e!=null||a)&&!V&&t(e)}catch{}if(r)return;i.setState({themeReady:!0});const n="ontouchstart"in window||navigator.maxTouchPoints>0,c=Math.min(window.innerWidth,window.innerHeight)<768;Y(n&&c);const f=u?null:await l.parseShareLink(),o=m.getState().sceneConfigurations,g=m.getState().defaultPresetId;let b=g!=null&&o[g]?g:null;b||(b=Object.values(o||{})[0]?.id);const I=u?.scene_snapshot?._state?.sceneGraph?.activeSceneConfigId,p=I!=null&&o[I]?I:f?.sc||b;l.preloadMaterials(o[p]),X.getState().initializeScene(p);try{const{applySceneConfigDefaults:t}=await import("./a77b15c0d6.js");t(p)}catch{}et(o[p]),at(o[p]),!u&&f&&await l.restoreShareLink(f);const E=new URLSearchParams(window.location.search),j=E.get("gui");(j==="false"||j==="0")&&i.getState().setGuiVisible(!1);const U=E.get("hide");if(U){const t=U.split(",").map(e=>e.trim()).filter(Boolean);if(t.includes("all"))G();else{const e=t.filter(s=>k.includes(s)),a=t.filter(s=>!k.includes(s)&&s!=="all");a.length&&console.warn(`[sdk] ?hide= ignored unknown region(s): ${a.join(", ")}. Known regions: ${k.join(", ")}, or "all".`),e.length&&G(e)}}A(),_.getState().clearHistory(),Z(),import("./a77b15c0d6.js").then(({initConfigEngine:t})=>t()).catch(()=>{}),(()=>{if(r)return;i.setState({bootEvaluating:!0});const t=_.getState();t.pauseTracking();let e=!1;const a=()=>{e||(e=!0,i.setState({bootEvaluating:!1}),t.resumeTracking())};D().then(()=>{if(r){a();return}import("./a77b15c0d6.js").then(async({seedInitialState:s,reevaluateForFocus:h})=>{await s(),!r&&await h()}).catch(()=>{}).finally(a)}).catch(a)})(),x?.(),u?(i.setState({isLayoutLoading:!0}),i.getState().setSceneLoading(!0,"Loading your saved design..."),w=tt(async()=>{r||(await l.restoreProject(u),A(),D().then(()=>{if(r)return;i.getState().setInitialPerPieceOverrides(),i.setState({isLayoutLoading:!1}),i.getState().clearSceneLoading(),_.getState().clearHistory();const t=u?.scene_snapshot?.canonical||null;import("./a77b15c0d6.js").then(({restoreConfiguration:e,refreshCanonicalState:a})=>t?e(t):a()).catch(()=>{})}))})):i.getState().setInitialPerPieceOverrides()}catch(n){const c=n?.status,f=c==null?await N(F()):null,o=K(n,{reachable:f});q(o,n);const g=o.code==="unavailable"?"unavailable":c===401||c===403?"unauthorized":c===404?"unavailable":"network";L?.(`${o.title} ${o.body}`,{code:g,reason:o.code,title:o.title,body:o.body,fix:o.fix,status:c,cause:n})}})(),{cancel(){r=!0,w&&w()}}}export{_t as ORG_UNAVAILABLE_MESSAGE,kt as bootConfigurator};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as n,jsxs as a}from"react/jsx-runtime";import{isHostedPlacementId as y}from"./23dc0ccf32.js";import{useEffect as f}from"react";import o from"./8f60e5059a.js";import C from"./9c6c598569.js";import{SuccessIcon as P,ErrorIcon as b,WarningIcon as g,InfoIcon as N,CloseIcon as E}from"./c5e990946e.js";import"./4741e5d07d.css";function M({maxCount:t=3}){const e=o(i=>i.notifications),c=o(i=>i.removeNotification),m=o(i=>i.islandOverlapDetected),r=o(i=>i.constraintWarnings),v=o(i=>i.setConstraintWarnings),I=o(i=>i.sceneHostedProducts),l=o(i=>i.messageModal),p=o(i=>i.dismissMessageModal),_=C(i=>i.selectInstance);f(()=>{if(!r||r.length===0)return;const i=setTimeout(()=>{v?.([])},5e3);return()=>clearTimeout(i)},[r,v]);const S=i=>{const s=i?.placementId;if(s&&!y(String(s))){_?.(String(s));return}const d=(i?.offending||[]).map(String),u=(I||[]).find(k=>d.includes(String(k.hostedProductId)));u&&_?.(String(u.id))};f(()=>{e.length>t&&e.slice(0,e.length-t).forEach(s=>c(s.id))},[e,t,c]);const h=e.slice(-t);return a("div",{className:"notification-container",children:[l&&l.text&&n("div",{className:"message-modal__overlay",onClick:()=>p?.(),children:a("div",{className:`message-modal message-modal--${l.severity||"info"}`,onClick:i=>i.stopPropagation(),role:"dialog","aria-modal":"true",children:[n("div",{className:"message-modal__body",children:l.text}),n("button",{className:"message-modal__btn",onClick:()=>p?.(),children:"OK"})]})}),m&&a("div",{className:"notification notification--warning notification--persistent",children:[n("span",{className:"notification__icon",children:n(g,{})}),n("div",{className:"notification__content",children:n("div",{className:"notification__message",children:"Island is overlapping with pieces. Please reposition the island."})})]}),(r||[]).map((i,s)=>{const d=!!(i.placementId||i.offending&&i.offending.length);return a("div",{className:"notification notification--warning notification--persistent",onClick:d?()=>S(i):void 0,style:d?{cursor:"pointer"}:void 0,title:d?"Click to locate":void 0,children:[n("span",{className:"notification__icon",children:n(g,{})}),n("div",{className:"notification__content",children:n("div",{className:"notification__message",children:i.message})})]},i.constraintId??`cw-${s}`)}),h.map(i=>n(O,{notification:i,onClose:()=>c(i.id)},i.id))]})}const T={success:P,error:b,warning:g,info:N};function O({notification:t,onClose:e}){f(()=>{if(t.duration!==0){const m=setTimeout(()=>{e()},t.duration||5e3);return()=>clearTimeout(m)}},[t,e]);const c=T[t.type]||N;return a("div",{className:`notification notification--${t.type||"info"}`,children:[n("span",{className:"notification__icon",children:n(c,{})}),a("div",{className:"notification__content",children:[t.title&&n("div",{className:"notification__title",children:t.title}),n("div",{className:"notification__message",children:t.message})]}),n("button",{className:"notification__close",onClick:e,children:n(E,{})})]})}var F=M;export{F as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import I from"./8f60e5059a.js";import"./9c6c598569.js";import{deriveSceneFeatures as Q}from"./be337ddda5.js";import It from"./d94df858ea.js";import j from"./872c4302e0.js";import{resolveDefaultCornerProduct as Gt}from"./87dcc12b65.js";import _t from"./ee242c0099.js";import{waitForAssetsIdle as x}from"./2774152dd2.js";import{FEATURE_ROLES as _,FEATURE_TYPES as yt,featureRole as Kt,findFeatureByType as Jt,getSelectionFor as Z,pickToggleOption as Vt,roleSelectionsToFeatureIds as tt}from"./f8cb80a93c.js";import{normalizeLayoutConfig as et}from"./bb719febc6.js";import{pieceKindOf as Et}from"./9326c23506.js";import{isHostFloating as bt}from"./061b81ad81.js";const m="island",ot="corner",nt="wall_corner";function Ot(c,i,a){const n=c||"base";return n===ot?`corner-${i[n]++}`:n===nt?`wcorner-${i[n]++}`:n===m?`${m}-part-${i[n]++}`:`${n}-${a}`}const Ft=()=>({[ot]:0,[nt]:0,[m]:0});function $t(c){return et(c,Q(c),tt)}function wt(c,i){return a=>{if(!a)return{color:null,materialId:null};if(typeof a=="string"&&a.startsWith("#"))return{color:a,materialId:null};const n=c[a];if(!n)return{color:null,materialId:null};const d=n.value||null;return{color:(d?i[d]:null)?.color||n.color||n.color_hex||null,materialId:d}}}const Ht=()=>({finishes:{},materials:{},styles:{},handleTypes:{},hardwareFinishes:{}});function st(c,i,a,n,d,r,{fillOnly:e=!1}={}){const s=(P,u)=>{u==null||u===""||e&&c[P][i]!=null||(c[P][i]=u)},l=a||{},f=l[_.PIECE_FINISH];if(f){const{color:P,materialId:u}=r(f);s("finishes",P),s("materials",u)}n&&s("materials",n);const S=P=>d[P]?.value??P;l[_.DOOR_STYLE]&&s("styles",S(l[_.DOOR_STYLE])),l[_.HANDLE_TYPE]&&s("handleTypes",S(l[_.HANDLE_TYPE])),l[_.HARDWARE_FINISH]&&s("hardwareFinishes",S(l[_.HARDWARE_FINISH]))}function Rt(c,{merge:i=!0}={}){const a=I.getState(),n={},d={finishes:"hostFinishes",materials:"hostMaterials",styles:"hostStyles",handleTypes:"hostHandleTypes",hardwareFinishes:"hostHardwareFinishes"};for(const[r,e]of Object.entries(d))Object.keys(c[r]).length!==0&&(n[e]=i?{...a[e],...c[r]}:c[r]);return n}function ae(c){const i=[],a=[],n=Ft();return(c||[]).forEach((d,r)=>{const e=et({products:[d]},[],tt).products[0],s=Ot(e.type,n,r);for(const S of e.hosted||[])i.push({hostedProductId:S.id,pieceKey:s,featureSelections:S.featureSelections||{}});const{hosted:l,...f}=e;a.push(f)}),{pendingHostedProducts:i,cleanedProducts:a}}function ue(c){const i=$t(c),a=i?.products||[];if(a.length===0&&!i?.freePieceConfig)return;const n=j.getState(),d=n.options,r=wt(d,n.materials),e=Ht(),s={},l=Ft();a.forEach((u,E)=>{const h=Ot(u.type,l,E);u.product_id&&(s[h]=u.product_id),st(e,h,u.selections,u.materialId,d,r)});const f=l[m],S=i.freePieceConfig;if(f>0&&S){st(e,m,S.selections,null,d,r,{fillOnly:!0});for(let u=0;u<f;u++){const E=`${m}-part-${u}`;for(const h of Object.keys(e))e[h][E]==null&&e[h][m]!=null&&(e[h][E]=e[h][m])}}else if(f>0)for(let u=0;u<f;u++){const E=`${m}-part-${u}`;for(const h of Object.keys(e))e[h][m]==null&&e[h][E]!=null&&(e[h][m]=e[h][E])}const P=Rt(e,{merge:!1});Object.keys(s).length>0&&(P.hostProductOverrides=s),Object.keys(P).length>0&&I.setState(P)}function de(c){const i=$t(c);if(!i)return;const a=It.getState().setSceneSelection;for(const[s,l]of Object.entries(i.default_scene_selections||{}))l!=null&&a(s,l);const n=i.freePieceConfig;if(n){const s=I.getState();n.tier&&s.setFreePieceTier(n.tier),n.width&&s.setFreePieceWidthOption(n.width)}const r=(i.products||[]).some(s=>s?.type===m)||n?.product_id?.length>0,e=Jt(Q(i),yt.FREE_PIECE);if(e){const s=Vt(e,j.getState().options,{on:r,tier:n?.tier??null});s!=null&&a(e.id,s)}}function pe(c,i){if(!c||c.length===0){i?.();return}const a=j.getState(),n=a.options,d=wt(n,a.materials),r=et({products:c},[],tt).products;(async()=>{for(const f of r){const S=f.product_id??f.variant??f.product;I.setState({pendingWallCornerAdd:{productId:S}}),await x()}const e=Ht();r.forEach((f,S)=>st(e,`wcorner-${S}`,f.selections,f.materialId,n,d));const s=Rt(e);Object.keys(s).length>0&&I.setState(s),await x();const{pieceConfigSnapshot:l}=I.getState();l&&I.getState().setInitialPieceConfigSnapshot(l),i?.()})()}function fe(c){if(!c||c.length===0){I.getState().clearSceneLoading();return}(async()=>{const i=I.getState().basePiecePositions||{};for(const{hostedProductId:a,pieceKey:n,featureSelections:d}of c){const r=j.getState().getHostedProduct(a);if(!r)continue;const e=i[n];if(!e)continue;if(I.setState({sceneLoadingMessage:`Placing ${r.name}...`}),bt(r)){const S=e.position[0];let P=e.position[1]+1.5;for(const[b,W]of Object.entries(i))if(Et(b)==="upper"&&Math.abs((W.position?.[0]??1/0)-S)<.5){P=W.position[1];break}const E=I.getState().sceneHostedProducts.find(b=>b.replacedPiece===n&&!bt(b)),h=E?j.getState().getHostedProduct(E.hostedProductId):null,R=e.productId||h?.target_product_id,C=(h?.slots?.find(b=>b.product_id===R)||h?.slots?.[0])?.position?.[0]||0,A=P-e.position[1]+.25,F=[C,A,0],L=(e.rotation||[0,0,0])[1],N=Math.cos(L),$=Math.sin(L),O=[e.position[0]+F[0]*N+F[2]*$,e.position[1]+F[1],e.position[2]-F[0]*$+F[2]*N],Y=`hosted-floating-${Date.now()}`;I.setState(b=>({sceneHostedProducts:[...b.sceneHostedProducts,{id:Y,hostedProductId:r.id,name:r.name,modelUrl:r.modelUrl,position:O,rotation:e.rotation||[0,0,0],scale:r.scale||[1,1,1],placement_type:r.placement_type,hostFloating:!0,replacedPiece:n,positionOffset:F,pairedWithHostedProductId:E?.id||null,pairedWithPiece:n}],...E?{occupiedPieceSlots:{...b.occupiedPieceSlots,[n]:{...b.occupiedPieceSlots[n],pairedHostedProductId:Y}}}:{}})),await x();continue}const s=e.position||[0,0,0],l=e.rotation||[0,0,0],f=e.productId||null;if(I.getState().placeHostedProductAtPiece(r,n,s,l,f),d&&Object.keys(d).length>0){const S=I.getState();for(const[P,u]of Object.entries(d))S.setHostedProductFeatureForSlot(n,P,u)}await x()}I.getState().clearSceneLoading()})()}function he({sceneConfig:c,pieceConfigSnapshot:i,hostProductOverrides:a,activeSceneConfigId:n,layoutName:d}){const r=c?.products||[],e=i||{},s=a||{},l=I.getState(),f=l.hostFinishes||{},S=l.hostMaterials||{},P=l.hostStyles||{},u=l.hostHandleTypes||{},E=l.hostHardwareFinishes||{},h=j.getState(),R=h.options,rt=h.materials||{},C=It.getState().sceneSelections||{},A=Q(c),F={};for(const t of Object.values(R))t?.value!=null&&rt[t.value]&&F[t.value]==null&&(F[t.value]=t.id);const L=t=>t?Object.values(R).find(o=>o.value===t)?.id||t:null,N={},$={};for(const t of A){const o=Kt(t);if(!o)continue;const p=Z(C,t);p!=null&&(N[o]=p,$[o]=R[p]?.value??null)}const O=(t,o=null)=>{const p=v=>v[t]??(o?v[o]:void 0),g={},y=p(S);if(y&&y!==$[_.PIECE_FINISH]){const v=F[y];v&&(g[_.PIECE_FINISH]=v)}else!y&&p(f)&&(g[_.PIECE_FINISH]=p(f));const w=p(P);w&&w!==$[_.DOOR_STYLE]&&(g[_.DOOR_STYLE]=L(w));const k=p(u);k&&k!==$[_.HANDLE_TYPE]&&(g[_.HANDLE_TYPE]=L(k));const H=p(E);return H&&H!==$[_.HARDWARE_FINISH]&&(g[_.HARDWARE_FINISH]=L(H)),Object.keys(g).length?{selections:g}:{}},Y=l.sceneHostedProducts||[],b=l.occupiedPieceSlots||{},W=e.baseByWall||{},B=[],M=[],G=e.cornerPositions||{},ct=e.corner||[],it=ct.some(t=>G[t]==="front-left"),lt=ct.some(t=>G[t]==="front-right"),at=e.frontWallSplit||0;for(const t of["back","side","left","right","front"])(W[t]||[]).forEach((o,p)=>{if(!e.base?.includes(o))return;const g=s[`base-${o}`]||r[o]?.product_id;if(!g)return;let y=t;t==="front"&&it&<&&(y=p<at?"front-left":"front-right"),B.push({product_id:g,wall:y,type:"base",...O(`base-${o}`)}),M.push(o)});const Lt=Object.values(W).flat();(e.base||[]).forEach(t=>{if(Lt.includes(t))return;const o=s[`base-${t}`]||r[t]?.product_id;o&&(B.push({product_id:o,wall:"back",type:"base",...O(`base-${t}`)}),M.push(t))});const ut=e.upperByWall||{},K=[],J=[];for(const t of["back","side","left","right","front"])(ut[t]||[]).forEach((o,p)=>{if(!e.upper?.includes(o))return;const g=s[`upper-${o}`]||r[o]?.product_id;if(!g)return;let y=t;t==="front"&&it&<&&(y=p<at?"front-left":"front-right"),K.push({product_id:g,wall:y,type:"upper",...O(`upper-${o}`)}),J.push(o)});const Tt=Object.values(ut).flat();(e.upper||[]).forEach(t=>{if(Tt.includes(t))return;const o=s[`upper-${t}`]||r[t]?.product_id;o&&(K.push({product_id:o,wall:"back",type:"upper",...O(`upper-${t}`)}),J.push(t))});const kt=new Set(e.tallLeft||[]),dt=[],pt=[];(e.tall||[]).forEach(t=>{const o=s[`tall-${t}`]||r[t]?.product_id;o&&(dt.push({product_id:o,type:"tall",side:kt.has(t)?"left":"right",...O(`tall-${t}`)}),pt.push(t))});const ft=h.products||{};let V=!1;for(const t of A){if(t?.type!==yt.FREE_PIECE)continue;const o=Z(C,t);if(o==null)continue;const p=R[o]?.value;if(p==null)continue;const g=ft[p]||ft[String(p)];if(!g)continue;if(String(g.placement_group??g.placementGroup??"").includes("freestanding")){V=!0;break}}const ht=[];if(V){const t=Math.max((e.island||[]).length,Object.keys(s).filter(o=>Et(o)===`${m}_part`).length);for(let o=0;o<t;o++){const p=`${m}-part-${o}`,g=(e.island||[])[o],y=s[p]||(g!==void 0?r[g]?.product_id:null)||_t.defaultDoorProduct;ht.push({product_id:y,type:m,...O(p,m)})}}const jt=(e.corner||[]).map((t,o)=>({product_id:s[`corner-${o}`]||r[t]?.product_id||Gt("floor_back_corner"),type:ot,position:G[t]||"back-right",...O(`corner-${o}`)})),Ct=e.wallCornerPositions||{},At=(e.wallCorners||[]).map((t,o)=>({product_id:s[`wcorner-${o}`]||_t.defaultWallCornerProduct,type:nt,position:Ct[t]||"back-right",...O(`wcorner-${o}`)})),U={};let X=0;M.forEach(t=>{U[`base-${t}`]=`base-${X++}`}),J.forEach(t=>{U[`upper-${t}`]=`upper-${X++}`}),pt.forEach(t=>{U[`tall-${t}`]=`tall-${X++}`});const Wt=t=>t?U[t]||t:null,D={};Y.forEach(t=>{const o=Wt(t.replacedPiece)||t.replacedPiece;if(!o)return;const p=b[t.replacedPiece],y=h.getHostedProduct(t.hostedProductId)?.feature_defaults||{},w={};for(const[k,H]of Object.entries(p?.featureSelections||{}))H&&y[k]!==H&&(w[k]=H);(D[o]||(D[o]=[])).push({id:t.hostedProductId,...Object.keys(w).length?{featureSelections:w}:{}})});const T=(t,o)=>D[o]?.length?{...t,hosted:D[o]}:t;let z=0;const Dt=B.map(t=>T(t,`base-${z++}`)),vt=K.map(t=>T(t,`upper-${z++}`)),Nt=dt.map(t=>T(t,`tall-${z++}`)),gt=ht.map((t,o)=>T(t,`${m}-part-${o}`)),Yt=jt.map((t,o)=>T(t,`corner-${o}`)),Ut=At.map((t,o)=>T(t,`wcorner-${o}`)),St=n||"custom_layout",Pt=c?.scene_option_id||null,xt={[St]:{id:St,...c?.features_configuration_ids?{features_configuration_ids:c.features_configuration_ids}:{},...Pt?{scene_option_id:Pt}:{},products:[...Dt,...vt,...Nt,...Yt,...Ut],...V?{freePieceConfig:{tier:l.freePieceTier,width:l.freePieceWidthOption,...gt.length?{product_id:gt}:{},...O(m)}}:{},default_scene_selections:Object.fromEntries(A.map(t=>[t.id,Z(C,t)]).filter(([,t])=>t!=null))}},Bt=new Blob([JSON.stringify(xt,null,2)],{type:"application/json"}),mt=URL.createObjectURL(Bt),q=document.createElement("a");q.href=mt;const Mt=d?d.toLowerCase().replace(/\s+/g,"_")+"_":"";q.download=`${Mt}layouts.json`,q.click(),URL.revokeObjectURL(mt)}export{de as applyLayoutSceneSelections,ue as applyLayoutStyling,pe as applyLayoutWallCorners,he as downloadLayoutJson,ae as extractHostedProductsFromProducts,fe as placeHostedProductsFromList};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import u from"./d803155241.js";const o=r=>!!(r?.corner??r?.isCorner);function f(r,t){const n=(t?.[0]??0)-(r?.[0]??0),e=(t?.[2]??0)-(r?.[2]??0);return Math.hypot(n,e)<1e-6?null:Math.atan2(e,n)}function h(r,t){let n=Math.abs(r-t)%(Math.PI*2);return n>Math.PI&&(n=Math.PI*2-n),n}function c(r,t){for(let n=0;n<t.length;n+=1){if(!o(t[n])||n===0||n>=r.length-1)continue;const e=f(r[n-1].position,r[n].position),i=f(r[n].position,r[n+1].position);if(e==null||i==null||h(e,i)<Math.PI/4)return!1}return!0}function s(r,t,n={},e=null){if(!Array.isArray(r)||!Array.isArray(t)||r.length!==t.length||!t.some(o)||e?.handlesCorners||c(r,t))return r;try{return u.computeLayout(t,n)}catch{return r}}var M=s;export{M as default,s as enforceCorners};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as b,jsxs as fn}from"react/jsx-runtime";import{memo as qt,useRef as Z,useState as J,useCallback as kt,useEffect as lt,useSyncExternalStore as Qt}from"react";import{useFrame as Ut,useThree as Xt}from"@react-three/fiber";import{Html as Ct}from"@react-three/drei";import*as _ from"three";import q from"./9c6c598569.js";import ut from"./872c4302e0.js";import Yt from"./8f60e5059a.js";import _t from"./c9a1656c62.js";import{resolveComponentRenderer as Zt,subscribeSceneRegistry as Jt,getSceneRegistryVersion as Ot,runInteraction as dt}from"./95a44ebec2.js";import mt,{SELECTION_COLOR as tn}from"./66c461dc2c.js";import{useUiToggles as nn}from"./d0f9681634.js";import{_anchorHasData as on}from"./9326c23506.js";function en(o){Qt(Jt,Ot,Ot);const c=[o?.slotName,o?.component?.slotName,o?.component?.slot_name,o?.component?.kind,o?.component?.name];let g=null;for(const l of c)if(l!=null&&(g=Zt(l),g))break;return g?b(g,{...o,Default:_t,THREE:_}):b(_t,{...o})}function Q(o,c,g=[0,0,0]){const l=o?.[c];if(Array.isArray(l)&&l.length>=3)return[Number(l[0])||0,Number(l[1])||0,Number(l[2])||0];if(l&&typeof l=="object")return[Number(l.x)||0,Number(l.y)||0,Number(l.z)||0];const I=D=>o?.[`${c}_${D}`]??o?.[`${c}${D.toUpperCase()}`],A=I("x"),x=I("y"),E=I("z");return A==null&&x==null&&E==null?g:[Number(A)||0,Number(x)||0,Number(E)||0]}function sn(o){if(!Array.isArray(o)||o.length<2)return o;const c=new Set,g=l=>(l?.groups||l?.group_ids||[]).map(String);for(const l of o){const I=l.component,A=I?.anchor_points||I?.anchorPoints;if(!(!Array.isArray(A)||!A.length))for(const x of A){if(!on(x))continue;const E=new Set((x.acceptedGroups||x.accepted_groups||[]).map(String));if(!E.size)continue;const D=new Set((x.excludedGroups||x.excluded_groups||[]).map(String)),L=o.find(B=>{if(B===l||c.has(B.key))return!1;const F=g(B.component);return F.some(T=>E.has(T))&&!F.some(T=>D.has(T))});if(!L)continue;const z=Q(x,"position"),M=Q(x,"orientation");L.position=[z[0],z[1],z[2]],L.rotation=[M[0],M[1],M[2]],c.add(L.key)}}return o}const rn="#ff0000",cn="#333333",Mn=()=>{},an="rgba(255, 87, 34, 0.85)",ln="#ff8a65",un=[0,0,0];function dn(o){return o.map(c=>{const g=new Set,l=I=>{I!=null&&String(I)!==""&&g.add(String(I).toLowerCase())};return l(c.slotKey),l(c.slotName),l(c.component?.slot_name??c.component?.slotName),l(c.componentId),g})}function mn({instance:o,components:c,slotMaterials:g,onMeasure:l,onSelect:I,isSelected:A,selectionColor:x=tn,style:E,footprintExcludeItem:D,stateInstanceId:L,overlapping:z=!1,isPlacementTarget:M=!1,onPlacementClick:B,label:F,hoverable:T=!1,focusable:Mt=!1,disableInteraction:H=!1}){const $=Z(),pt=Z(),tt=Z(),nt=Z({}),[ft,ht]=J(null),[ot,gt]=J(null),[Nt,At]=J(0),Et=kt(()=>At(t=>t+1),[]),[U,yt]=J(!1),X=nn()("selectionPanel");lt(()=>{nt.current={},ht(null),gt(null)},[o?.productId]);const zt=q(t=>t.selectInstance),Rt=q(t=>t.selectedInstanceId),et=ut(t=>t.getProduct),R=ut(t=>t.getComponent),O=ut(t=>t.componentGroups),vt=q(t=>t.componentStates),Pt=q(t=>t.placementOverrides),j=Yt(t=>t.guiVisible)!==!1,st=Xt(t=>t.invalidate);lt(()=>{z&&st?.()},[z,st]),Ut(({clock:t})=>{if(!z||!tt.current)return;const e=.45+.25*Math.sin(t.getElapsedTime()*6);tt.current.traverse(n=>{n.isMesh&&n.material&&(n.material.opacity=e)}),st?.()}),lt(()=>{const t=$.current,e=pt.current;if(!t||!e)return;const n=requestAnimationFrame(()=>{t.updateWorldMatrix(!0,!0);const s=new _.Matrix4().copy(t.matrixWorld).invert(),a=new _.Box3,i=new _.Box3,u=new _.Matrix4;if(e.traverse(r=>{!r.isMesh||!r.geometry||(r.geometry.boundingBox||r.geometry.computeBoundingBox(),i.copy(r.geometry.boundingBox),i.applyMatrix4(u.multiplyMatrices(s,r.matrixWorld)),a.union(i))}),a.isEmpty())return;const m=a.getSize(new _.Vector3),f=a.getCenter(new _.Vector3);gt(r=>r&&r.width===m.x&&r.height===m.y&&r.depth===m.z&&r.cx===f.x&&r.cy===f.y&&r.cz===f.z?r:{width:m.x,height:m.y,depth:m.z,cx:f.x,cy:f.y,cz:f.z})});return()=>cancelAnimationFrame(n)},[ft,Nt]);const Dt=kt((t,e,n,s=!1)=>{const a=(n?.[0]||0)+(e.cx||0),i=(n?.[2]||0)+(e.cz||0),u=(n?.[1]||0)+(e.cy||0);nt.current[t]={minx:a-(e.width||0)/2,maxx:a+(e.width||0)/2,minz:i-(e.depth||0)/2,maxz:i+(e.depth||0)/2,height:e.height||0,bottom:u-(e.height||0)/2,top:u+(e.height||0)/2,isLeg:s};const m=p=>{let d=1/0,h=-1/0,y=1/0,C=-1/0,w=-1/0,v=1/0,xt=!1;for(const N of Object.values(nt.current))p(N)&&(xt=!0,d=Math.min(d,N.minx),h=Math.max(h,N.maxx),y=Math.min(y,N.minz),C=Math.max(C,N.maxz),w=Math.max(w,N.top!=null?N.top:N.height||0),v=Math.min(v,N.bottom!=null?N.bottom:0));if(!xt||!Number.isFinite(d))return null;const Wt=Number.isFinite(w)&&Number.isFinite(v)?Math.max(0,w-v):0;return{width:h-d,depth:C-y,height:Wt,cx:(d+h)/2,cz:(y+C)/2,minX:d,minZ:y}},f=m(()=>!0);f&&ht(p=>p&&p.width===f.width&&p.height===f.height&&p.depth===f.depth&&p.cx===f.cx&&p.cz===f.cz?p:f);const r=m(p=>!p.isLeg)||f;r&&l?.(f?{...r,full:f}:r)},[l]),k=o.instanceId??o.id,bt=L??k,it=et(o.productId)||et(o.variantId),rt=A??Rt===k;if(!it)return null;const ct=(t=null)=>{if(!H){if(M&&B){B(k,o);return}X&&dt("click",{placementId:k,instanceId:k,instance:o,componentId:t},e=>{I?I(e.instanceId,e.instance,e.componentId):zt(e.instanceId,e.componentId)})}},Lt=t=>{H||(t.stopPropagation(),ct())},Bt=X?I?ct:void 0:ct,Tt=t=>{if(H||!Mt||M||!$.current)return;t.stopPropagation();const e=new _.Box3().setFromObject($.current),n=new _.Vector3;e.getCenter(n);const s=new _.Sphere;e.getBoundingSphere(s);const a=new _.Quaternion;$.current.getWorldQuaternion(a);const i=new _.Euler().setFromQuaternion(a,"YXZ").y;q.getState().focusOnObject?.([n.x,n.y,n.z],s.radius,i)},Kt=t=>{H||!T||(t.stopPropagation(),dt("hover",{placementId:k,instanceId:k,instance:o,hovered:!0},()=>{yt(!0),typeof document<"u"&&(document.body.style.cursor="pointer")}))},Ft=()=>{H||!T||dt("hover",{placementId:k,instanceId:k,instance:o,hovered:!1},()=>{yt(!1),typeof document<"u"&&(document.body.style.cursor="auto")})},Ht=it.components_configuration||it.componentsConfiguration||{},G=vt[bt]||{},S=ot||ft,V=S?.height>0?S.height:.8,It=ot?.cy!=null?ot.cy:V/2,St=(t,e)=>{const n=G[t]?.componentId??null;if(n!=null)return n;if(e==null||!O)return null;const s=R(e),a=s?.groups||s?.group_ids||[];for(const i of a){const u=O[i]||O[String(i)];if(!u)continue;const m=new Set([...Object.values(u.variants||{}),...Array.isArray(u.members)?u.members.map(d=>d?.componentId??d?.id??d):[]].map(String));if(m.size&&!m.has(String(e)))continue;const f=u.name??u.slotKey??u.slot_key,r=f!=null?G[f]?.componentId:null,p=G[i]?.componentId??G[String(i)]?.componentId;if(r!=null)return r;if(p!=null)return p}return null},$t=t=>{if(!E||t==null)return null;const e=R(t),n=String(e?.type??"").toLowerCase();if(n!=="door"&&n!=="drawer")return null;const s=e?.groups||e?.group_ids||[];for(const a of s){const u=(O?.[a]||O?.[String(a)])?.variants?.[E];if(u!=null)return u}return null};let P=Array.isArray(c)&&c.length?c.map((t,e)=>{const n=t.slotKey??t.materialSlot??t.material_slot??t.type??`res-${e}`,s=t.componentId??t.component_id??null,a=St(n,s),i=t.component??t;let u=i;if(a!=null&&String(a)!==String(s)){let m=R(a);if(!m){const f=et(a),r=f&&(f.components_configuration||f.componentsConfiguration||f.components);if(r&&typeof r=="object"){const p=r[n]??Object.values(r)[0],d=p?.componentId??p?.component_id??(typeof p=="number"||typeof p=="string"?p:null);m=(d!=null?R(d):null)??(p&&typeof p=="object"?p:null)}}m&&(u={...m,position:i.position??m.position,rotation:i.rotation??m.rotation,scale:i.scale??m.scale,materialSlot:i.materialSlot??i.material_slot??m.materialSlot,rotationRad:i.rotationRad??m.rotationRad})}return{key:t.key??`res-${e}`,slotKey:n,componentId:a??s,component:u,position:t.position??i?.position??null,offset:t.offset??i?.offset??null,baseState:{materialId:t.materialId??null,color:t.color??null,roughness:t.roughness,metalness:t.metalness}}}):Object.entries(Ht).flatMap(([t,e])=>(Array.isArray(e)?e:[e]).map((s,a)=>{const i=s?.slotName??s?.slot_name??t,u=s?.componentId??s?.component_id??i,m=St(i,u)??$t(u)??u;return{key:`${t}-${a}`,slotKey:i,slotName:s?.slotName??s?.slot_name??null,componentId:m,component:R(m),position:s?.position??null,rotation:s?.rotation??null,scale:s?.scale??null,offset:s?.offset??s?.offsets??null,baseState:null}}));{const t=new Set,e=(n,s)=>{if(!n||s>6)return;const a=Array.isArray(n.children)?n.children:[];for(const i of a){const u=i?.componentId??i?.component_id;u!=null&&(t.add(String(u)),e(R(u),s+1))}};for(const n of P)e(n.component??(n.componentId!=null?R(n.componentId):null),0);t.size&&(P=P.filter(n=>!t.has(String(n.componentId))))}{const t=new Map;for(const e of P){const n=String(e.key??e.slotKey??e.componentId??"item"),s=t.get(n)??0;t.set(n,s+1),e.key=s>0?`${n}#${s}`:n}}sn(P);const K=Pt?.[bt]||{},wt=!!(K.visibility||K.transforms),jt=wt?dn(P):null,W=S?.width>0&&S?.depth>0,Y=[S?.cx||0,It,S?.cz||0],at=t=>{const e=t.slotKey;if(e!=null&&String(e)!==""&&O)for(const a of Object.keys(O)){const i=O[a]?.slotKey??O[a]?.slot_key;if(i!=null&&String(i)===String(e))return String(a)}const n=t.component||(t.componentId!=null?R(t.componentId):null),s=n?.groups||n?.group_ids||[];return s.length?String(s[0]):"__ungrouped__"},Gt=(()=>{const t=new Map;return P.forEach((e,n)=>{const s=at(e);t.has(s)||t.set(s,{gid:s,items:[]}),t.get(s).items.push({it:e,i:n})}),[...t.values()]})(),Vt=(t,e)=>{const n=t.component;if(!n)return null;const s=G[t.slotKey],a={visible:!0,materialId:null,variantId:null,...t.baseState,...s};if(a.visible===!1||K.hiddenComponentIds?.some?.(d=>String(d)===String(t.componentId)))return null;let i=null;if(wt){const d=jt[e],h=K.visibility;if(h){for(const[C,w]of Object.entries(h))if(w===!1&&d.has(String(C).toLowerCase()))return null}const y=K.transforms;if(y){for(const[C,w]of Object.entries(y))if(w&&d.has(String(C).toLowerCase())){i=w;break}}}const u=String(n.materialSlot??n.material_slot??"").toLowerCase(),m=g&&u?g[u]:null,f=m?{...a,materialId:m}:a,r={...n,position:t.position||n.position||[0,0,0],rotation:t.rotation||n.rotation||n.orientation||[0,0,0],...t.scale?{scale:t.scale}:{}},p=n.offset||n.offsets||t.offset||null;if(p){const d=Q(p,"position"),h=Q(p,"rotation"),y=Q(p,"scale"),C=r.position||[0,0,0];r.position=[(C[0]||0)+d[0],(C[1]||0)+d[1],(C[2]||0)+d[2]];const w=r.rotation||[0,0,0];r.rotation=[(w[0]||0)+h[0],(w[1]||0)+h[1],(w[2]||0)+h[2]];const v=r.scale||n.scale||[1,1,1];r.scale=[(v[0]||1)+y[0],(v[1]||1)+y[1],(v[2]||1)+y[2]]}if(i){const d=i.position_delta||i.positionDelta;if(Array.isArray(d)){const y=r.position||[0,0,0];r.position=[(y[0]||0)+(d[0]||0),(y[1]||0)+(d[1]||0),(y[2]||0)+(d[2]||0)]}else Array.isArray(i.position)&&(r.position=i.position);Array.isArray(i.rotation)&&(r.rotation=i.rotation);const h=i.scale;Array.isArray(h)?r.scale=h:typeof h=="number"&&(r.scale=[h,h,h]),(i.recalculate_position||i.recalculatePosition)&&(r.recalcPosition=!0)}return b(en,{component:r,componentState:f,instanceId:k,isSelected:!1,onPick:Bt,slotName:t.slotKey??t.component?.slot_name??t.component?.slotName??(t.componentId!=null?`component-${t.componentId}`:null),slotKey:t.slotKey,componentId:t.componentId,hiddenComponentIds:K.hiddenComponentIds||null,slotMaterials:g,onDescendantMeasured:Et,pivot:O?.[at(t)]?.pivot??O?.[String(at(t))]?.pivot??null,onMeasure:d=>Dt(t.key,d,t.position,!!D?.(t,n))},t.key)};return fn("group",{ref:$,name:`placement-${k}`,userData:{instanceId:k,productId:o.productId??null},position:o.position,rotation:o.rotation,scale:Array.isArray(o.scale)?o.scale:[1,1,1],onClick:Lt,onDoubleClick:Tt,onPointerOver:Kt,onPointerOut:Ft,children:[M&&j&&W&&b(Ct,{position:Y,center:!0,style:{pointerEvents:"none"},zIndexRange:[100,0],children:b("div",{style:{width:22,height:22,borderRadius:"50%",background:U?ln:an,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontSize:13,fontWeight:"bold",boxShadow:"0 1px 4px rgba(0,0,0,0.3)",transform:U?"scale(1.15)":"scale(1)"},children:"+"})}),z&&!M&&j&&W&&b("group",{ref:tt,position:Y,children:b(mt,{width:S.width,height:V,depth:S.depth,color:rn,thickness:.01})}),X&&rt&&!M&&j&&W&&b("group",{position:Y,children:b(mt,{width:S.width,height:V,depth:S.depth,color:x,thickness:.008})}),X&&U&&!rt&&!M&&j&&W&&b("group",{position:Y,children:b(mt,{width:S.width,height:V,depth:S.depth,color:cn,thickness:.008})}),F&&(rt||U)&&j&&W&&b(Ct,{position:[S.cx||0,It+V/2+.12,S.cz||0],center:!0,zIndexRange:[100,0],children:b("div",{className:"dimension-label",children:b("span",{children:F})})}),b("group",{ref:pt,children:Gt.map(({gid:t,items:e})=>b("group",{position:un,children:e.map(({it:n,i:s})=>Vt(n,s))},t))})]})}function pn(o,c){if(!o.instance||!c.instance)return o.instance===c.instance;const g=o.instance.instanceId??o.instance.id,l=c.instance.instanceId??c.instance.id;return g===l&&o.instance.productId===c.instance.productId&&o.instance.position===c.instance.position&&o.instance.rotation===c.instance.rotation&&o.components===c.components&&o.slotMaterials===c.slotMaterials&&o.onMeasure===c.onMeasure&&o.footprintExcludeItem===c.footprintExcludeItem&&o.stateInstanceId===c.stateInstanceId&&o.onSelect===c.onSelect&&o.isSelected===c.isSelected&&o.selectionColor===c.selectionColor&&o.overlapping===c.overlapping&&o.isPlacementTarget===c.isPlacementTarget&&o.onPlacementClick===c.onPlacementClick&&o.label===c.label&&o.hoverable===c.hoverable&&o.focusable===c.focusable&&o.disableInteraction===c.disableInteraction}var Nn=qt(mn,pn);export{Nn as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{fetchConfiguratorStatus as m}from"./79a397bb92.js";import{resolveParentPage as d}from"./f0c3d8a28a.js";import{trackEmbed as h}from"./0af28430ab.js";import{blockAllRequests as p}from"./631a9f7fac.js";let r=!0,u=null,s=!1,t=null;const l=new Set;function a(){for(const e of l)try{e()}catch{}}function _(e){!e||typeof e!="object"||r&&e.status===!1&&(r=!1,u=typeof e.message=="string"&&e.message.trim()?e.message:null,p(u),a())}async function k(e={}){const{systemId:c=null,fetcher:f=m,resolver:g=d,force:i=!1}=e;if(t&&!i)return t;if(s&&!i)return r;s=!0,t=(async()=>{let o={domain:null,url:null};try{o=g()||o}catch{}try{const n=await f({domain:o.domain,url:o.url,systemId:c});_(n)}catch(n){try{h("configurator_status_unavailable",{reason:String(n?.message||n),status:n?.status??null})}catch{}}return r})();try{return await t}finally{t=null}}function w(){return t||Promise.resolve(r)}function S(){return r}function v(){return u}function L(e){return l.add(e),()=>{l.delete(e)}}function P(){r=!0,u=null,s=!1,t=null,a()}export{P as _resetConfiguratorLicenceGate,k as checkConfiguratorLicence,S as getConfiguratorAllowed,v as getConfiguratorBlockedMessage,_ as setConfiguratorStatusFromBackend,L as subscribeConfiguratorLicence,w as whenConfiguratorLicenceSettled};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const o=Object.freeze({CHANGE_VARIANT:"changeVariant",SET_ROOM_DIMENSIONS:"setRoomDimensions",RESTORE_STATE:"restoreState",SELECT_OPTION:"selectOption",SELECT_SYSTEM_OPTION:"selectSystemOption",ADD_PLACEMENT:"addPlacement",REMOVE_PLACEMENT:"removePlacement",MOVE_PLACEMENT:"movePlacement",SET_TRANSFORM:"setTransform",APPLY_PRESET:"applyPreset",CLEAR_SELECTION:"clearSelection",CLEAR_SYSTEM_SELECTION:"clearSystemSelection",NOOP:"noop"}),s=(e,t)=>({type:o.CHANGE_VARIANT,placementId:e,variantId:t}),O=(e,t,E)=>({type:o.SET_ROOM_DIMENSIONS,width:e,depth:t,height:E}),_=e=>({type:o.RESTORE_STATE,savedState:e}),a=(e,t,E)=>({type:o.SELECT_OPTION,placementId:e,optionSetId:t,optionId:E}),i=(e,t)=>({type:o.SELECT_SYSTEM_OPTION,optionSetId:e,optionId:t}),N=({productGraphId:e,variantId:t,placementGroup:E,position:p,sequence:T,hostPlacementId:r,hostVariantId:l,replace:n,replacePlacementId:c}={})=>{const S={type:o.ADD_PLACEMENT,productGraphId:e,variantId:t,placementGroup:E,position:p};return T!=null&&(S.sequence=T),r!=null&&(S.hostPlacementId=r),l!=null&&(S.hostVariantId=l),n&&(S.replace=!0,c!=null&&(S.replacePlacementId=c)),S},P=e=>({type:o.REMOVE_PLACEMENT,placementId:e}),A=({placementId:e,sequence:t,placementGroup:E,position:p,rotation:T,hostPlacementId:r,hostVariantId:l}={})=>{const n={type:o.MOVE_PLACEMENT,placementId:e,sequence:t};return E!=null&&(n.placementGroup=E),p!=null&&(n.position=p),T!=null&&(n.rotation=T),r!=null&&(n.hostPlacementId=r),l!=null&&(n.hostVariantId=l),n},R=(e,t,E)=>({type:o.SET_TRANSFORM,placementId:e,position:t,rotation:E}),M=e=>({type:o.APPLY_PRESET,presetId:e}),m=(e,t)=>({type:o.CLEAR_SELECTION,placementId:e,optionSetId:t}),y=e=>({type:o.CLEAR_SYSTEM_SELECTION,optionSetId:e}),L=()=>({type:o.NOOP});function C(e){return e?.type===o.SET_TRANSFORM}export{o as MutationType,N as addPlacement,M as applyPreset,s as changeVariant,m as clearSelection,y as clearSystemSelection,C as isLocalOnlyMutation,A as movePlacement,L as noop,P as removePlacement,_ as restoreState,a as selectOption,i as selectSystemOption,O as setRoomDimensions,R as setTransform};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{create as b}from"zustand";import{devtools as G}from"./52436e0169.js";import{buildDesignPdfDocument as I,parseShareToken as M,buildShareUrl as D}from"./d30f1f506e.js";import{generateImage as A,generationErrorMessage as h}from"./d7c9500ba9.js";import{emitEvent as U,EVENTS as v}from"./2e366d7386.js";import{normalizeAiQuota as E,refreshAiQuota as S,aiQuotaBlock as k,aiQuotaBlockText as P,aiQuotaImageBudget as F,aiQuotaPartialText as Q}from"./2f8cc8b292.js";import{imageAsDataUrl as N,captureAndWarm as w}from"./0e2dedae0d.js";import{runCommand as B,COMMANDS as C}from"./d6851ea979.js";const $=Object.freeze({silo:Object.freeze(["silo-front"]),lifestyle:Object.freeze(["lifestyle-1","lifestyle-2"]),ar:Object.freeze(["ar-viewer"]),pdf:Object.freeze(["bom-pdf"])}),T=[{id:"silo-front",type:"silo",label:"Silo",status:"idle",progress:0,url:null,error:null},{id:"lifestyle-1",type:"lifestyle",label:"Lifestyle 1",status:"idle",progress:0,url:null,error:null},{id:"lifestyle-2",type:"lifestyle",label:"Lifestyle 2",status:"idle",progress:0,url:null,error:null},{id:"ar-viewer",type:"ar",label:"AR Viewer",status:"idle",progress:0,url:null,error:null},{id:"bom-pdf",type:"pdf",label:"Bill of Materials",status:"idle",progress:0,url:null,error:null}],R=b(G((c,s)=>({assets:T.map(e=>({...e})),isGenerating:!1,screenshotDataUrl:null,screenshotViews:{front:null,side:null,top:null,perspective:null},_timers:[],_pdfFakeTimer:null,uploadStatus:"idle",uploadProgress:0,aiGenerationStatus:"idle",pipelineMessage:"",uploadedImageUrl:null,_assetGenParams:{},_lastConfigSnapshot:null,aiQuota:null,setScreenshot:e=>{c({screenshotDataUrl:e})},setScreenshotViews:e=>{c({screenshotViews:{...s().screenshotViews,...e}})},setUploadStatus:(e,t=0)=>{c({uploadStatus:e,uploadProgress:t})},setIsGenerating:e=>{c({isGenerating:e})},setLastConfigSnapshot:e=>{c({_lastConfigSnapshot:e})},setAiQuota:e=>{c({aiQuota:E(e)})},hasResultsForConfig:e=>{const t=s(),r=t._lastConfigSnapshot===e,n=t.assets.some(a=>a.status!=="idle");return r&&n},setAiGenerationStatus:e=>{c({aiGenerationStatus:e})},setPipelineMessage:e=>{c({pipelineMessage:e})},setUploadedImageUrl:e=>{c({uploadedImageUrl:e})},setAssetGenParams:(e,t)=>{c(r=>({_assetGenParams:{...r._assetGenParams,[e]:t}}))},resetAssets:()=>{s()._cancelTimers();const e=s()._pdfFakeTimer;e&&clearInterval(e),c({assets:T.map(t=>({...t})),isGenerating:!1,screenshotDataUrl:null,screenshotViews:{front:null,side:null,top:null,perspective:null},uploadStatus:"idle",uploadProgress:0,aiGenerationStatus:"idle",pipelineMessage:"",_pdfFakeTimer:null,_lastConfigSnapshot:null})},updateAsset:(e,t)=>{if(t.status&&t.status!=="error"&&t.loadFailed===void 0&&(t={...t,loadFailed:!1}),c(r=>({assets:r.assets.map(n=>n.id===e?{...n,...t}:n)})),t.status==="complete"){const r=s().assets.find(n=>n.id===e);r?.type==="lifestyle"?s()._checkAndTriggerPdf():r?.type==="silo"&&s()._checkPdfNotStranded()}(t.status==="complete"||t.status==="error"||t.status==="blocked")&&(s()._checkAllDone(),t.status!=="complete"&&s()._checkPdfNotStranded())},startSlowProgress:e=>{const{updateAsset:t}=s();t(e,{status:"generating",progress:0});let r=0;const n=setInterval(()=>{const a=s().assets.find(p=>p.id===e);if(!a||a.status!=="generating"){clearInterval(n);return}const l=99-r,u=Math.max(.5,l*.04);r=Math.min(r+u,99),t(e,{progress:Math.round(r)})},800);c(a=>({_timers:[...a._timers,n]}))},generateAll:async()=>{const e=s();if(e.isGenerating||e.assets.some(o=>(o.type==="silo"||o.type==="lifestyle")&&o.status!=="complete"&&!e._assetGenParams[o.id])&&B(C.GENERATE_ASSETS)!==void 0)return;e._cancelTimers();const r=e.assets.map(o=>o.status==="error"?{...o,status:"idle",progress:0,error:null}:o);c({assets:r,isGenerating:!0,_timers:[]}),s().startPdfFakeProgress();const n=r.filter(o=>o.status==="idle"&&o.type!=="ar"&&o.type!=="pdf"),a=n.some(o=>(o.type==="silo"||o.type==="lifestyle")&&s()._assetGenParams[o.id]),l=a?await S():null;a&&s().setAiQuota(l);const u=k(l),p=a?u?0:F(l):1/0;let i=p;n.forEach(o=>{const _=s()._assetGenParams[o.id];if(_&&(o.type==="silo"||o.type==="lifestyle")){if(u||i<=0){s().updateAsset(o.id,{status:"blocked",progress:0,error:u?P(u):Q(p)}),s()._checkAllDone();return}i-=1,s().updateAsset(o.id,{status:"generating",progress:0,error:null}),s().startSlowProgress(o.id),A({..._,assetId:o.id}).then(async d=>{const y=d?.images?.[0]?.url;if(!y)throw new Error("Generation returned no image URL");const g=await w(y);s().updateAsset(o.id,{status:"complete",progress:100,url:y,dataUrl:g}),d.quota&&s().setAiQuota(d.quota)}).catch(d=>{s().updateAsset(o.id,{status:"error",progress:0,error:h(d)})}).finally(()=>{s()._checkAllDone()})}else o.type==="pdf"&&s()._simulateAsset(o.id)})},retryAsset:async e=>{const t=s().assets.find(n=>n.id===e),r=s()._assetGenParams[e];if(r&&(t?.type==="silo"||t?.type==="lifestyle")){const n=await S();s().setAiQuota(n);const a=k(n);if(a){s().updateAsset(e,{status:"blocked",progress:0,error:P(a)});return}s().updateAsset(e,{status:"generating",progress:0,error:null,url:null,dataUrl:null}),s().startSlowProgress(e);const l=180*1e3,u=new Promise((p,i)=>setTimeout(()=>i(new Error("Retry timed out after 3 minutes")),l));try{const p=await Promise.race([A({...r,assetId:e}),u]),i=p?.images?.[0]?.url??null;if(!i)throw new Error("Generation returned no image URL");const o=await w(i);s().updateAsset(e,{status:"complete",progress:100,url:i,dataUrl:o}),p.quota&&s().setAiQuota(p.quota)}catch(p){s().updateAsset(e,{status:"error",progress:0,url:null,error:h(p,"Retry failed. Try again.")})}s()._checkAllDone();return}s().updateAsset(e,{status:"idle",progress:0,error:null}),t?.type==="pdf"&&s()._simulateAsset(e)},startPdfFakeProgress:()=>{const e=s().assets.find(n=>n.id==="bom-pdf");if(!e||e.status==="complete"||e.status==="error"||e.status==="generating"&&!s()._pdfFakeTimer)return;s().updateAsset("bom-pdf",{status:"generating",progress:0});let t=0;const r=setInterval(()=>{const n=s().assets.find(l=>l.id==="bom-pdf");if(!n||n.status!=="generating"||s()._pdfFakeTimer!==r){clearInterval(r);return}const a=30-t;t=Math.min(t+Math.max(.3,a*.06),30),s().updateAsset("bom-pdf",{progress:Math.round(t)})},800);c(n=>({_pdfFakeTimer:r,_timers:[...n._timers,r]})),s()._checkPdfNotStranded()},_checkPdfNotStranded:({lifestyleRequested:e=!0,siloRequested:t=!0}={})=>{const{assets:r,_pdfFakeTimer:n}=s(),a=r.find(i=>i.id==="bom-pdf");if(!a||a.status!=="generating"||!n)return;const l=r.filter(i=>i.type==="lifestyle");if(l.some(i=>i.status==="complete"&&i.url))return;const u=i=>i.status==="generating"||e&&i.status==="idle";if(l.some(u))return;const p=i=>i.status==="generating"||t&&i.status==="idle";r.some(i=>i.type==="silo"&&p(i))||s()._generateBomPdf("bom-pdf")},_checkAndTriggerPdf:()=>{const{assets:e,_pdfFakeTimer:t}=s(),r=e.find(a=>a.id==="bom-pdf");if(!r||r.status==="complete"||r.status==="error"||r.status==="generating"&&!t)return;e.find(a=>a.type==="lifestyle"&&a.status==="complete"&&a.url)&&s()._generateBomPdf("bom-pdf")},_generateBomPdf:async e=>{const{updateAsset:t}=s(),r=l=>new Promise(u=>setTimeout(u,l)),n=s()._pdfFakeTimer;n&&(clearInterval(n),c({_pdfFakeTimer:null}));const a=s().assets.find(l=>l.id===e)?.progress||0;t(e,{status:"generating",progress:Math.max(a,30)}),await r(200);try{const l=N,u={},p=s().assets.filter(f=>f.type==="lifestyle"&&f.status==="complete"&&f.url);for(const f of p){const m=f.dataUrl||await l(f.url);m&&(f.id==="lifestyle-1"?u.perspective=m:f.id==="lifestyle-2"&&(u.front=m))}if(!u.perspective&&!u.front){const f=s().assets.find(m=>m.type==="silo"&&m.status==="complete"&&m.url);if(f){const m=f.dataUrl||await l(f.url);m&&(u.perspective=m)}}t(e,{progress:40}),await r(300);const i=()=>s().assets.find(f=>f.type==="ar"),o=Date.now()+3e4;for(;i()?.status==="generating"&&Date.now()<o;)await r(250);const _=s().assets.find(f=>f.type==="ar"&&f.status==="complete"&&f.url)?.url??null,d=(()=>{try{const f=M();return f?D(f):null}catch{return null}})();t(e,{progress:70}),await r(200),t(e,{progress:80});const{url:y,kind:g}=await I({images:u,shareUrl:d,arUrl:_,source:"generate-assets"});await r(300),t(e,{status:"complete",progress:100,url:y,label:g==="quote"?"Quote":"Bill of Materials"})}catch(l){t(e,{status:"error",progress:0,error:`PDF generation failed: ${l?.message||l}`})}s()._checkAllDone()},_simulateAsset:e=>{if(s().assets.find(d=>d.id===e)?.type==="pdf"){s()._generateBomPdf(e);return}const{updateAsset:r}=s();r(e,{status:"generating",progress:0});const n=2e3+Math.random()*3e3,a=20,l=n/a;let u=0;const p=[],i=Math.random()<.1,o=i?Math.floor(a*.5+Math.random()*a*.3):-1,_=setInterval(()=>{u++;const d=Math.min(Math.round(u/a*100),100);if(i&&u>=o){clearInterval(_),r(e,{status:"error",progress:d,error:"Generation failed. Try again."}),s()._checkAllDone();return}if(u>=a){clearInterval(_),r(e,{status:"complete",progress:100,url:null}),s()._checkAllDone();return}r(e,{progress:d})},l);p.push(_),c(d=>({_timers:[...d._timers,_]}))},_checkAllDone:()=>{const{assets:e,aiGenerationStatus:t,isGenerating:r}=s();if(e.every(a=>a.status==="complete"||a.status==="error"||a.status==="blocked")){if(c({isGenerating:!1}),r){const a=Array.from(new Set(e.map(l=>l.family??l.type??l.kind).filter(Boolean)));U(v.ASSETS_GENERATED,{assets:e.map(l=>({...l})),families:a})}if(t==="in_progress"){const a=e.some(l=>l.status==="error");c({aiGenerationStatus:"complete",pipelineMessage:a?"Content generated with errors":"Content generated successfully"})}}},_cancelTimers:()=>{const{_timers:e}=s();e.forEach(t=>{clearTimeout(t),clearInterval(t)}),c({_timers:[]})}}),{name:"generated-assets-store"}));var H=R;export{$ as ASSET_IDS,H as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as t,jsxs as e}from"react/jsx-runtime";import{useRef as A,useState as O}from"react";import{useLabel as $}from"./28d887bf8a.js";function w({title:_,presentation:f="inline",flow:o="column",defaultOpen:m=!1,className:i="sidebar__section",gridClassName:n,sectionRef:s,beforeGrid:d=null,labelKey:r,kind:c,depth:v=0,children:p}){const l=$(r!=null?`optionSet.${r}`:"",_),[a,b]=O(m),g=A(null),h=f==="accordion",u=c?{"data-kind":c,"data-depth":v}:{};if(!h)return e("div",{ref:s,className:i,"data-part":"option-set","data-flow":o,...u,children:[t("h3",{className:"sidebar__section-title","data-part":"option-set/title",children:l}),d,t("div",{className:n,"data-part":"option-set/options",children:p})]});const N=t("h3",{className:"sidebar__section-title","data-part":"option-set/title",children:e("button",{ref:g,type:"button",className:"sidebar__section-toggle","data-part":"option-set/toggle","aria-expanded":a,onClick:()=>b(k=>!k),children:[l,t("span",{className:"sidebar__section-chevron","aria-hidden":"true"})]})}),S=t("div",{className:n,"data-part":"option-set/options",children:p});return e("div",{ref:s,className:`${i} sidebar__section--accordion`,"data-part":"option-set","data-flow":o,"data-open":a?"true":"false",...u,children:[N,a&&d,a&&S]})}var R=w;export{R as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e=!1;function t(){e=!0}function o(){return e}function r(){e=!1}export{r as _resetHostTheme,o as isHostThemeApplied,t as markHostTheme};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useSyncExternalStore as a}from"react";import{getAiChatGranted as g,getSceneAccessGranted as p}from"./87f511c4a8.js";const f={aiChat:g,exposeThreejsScene:p},l=e=>Object.prototype.hasOwnProperty.call(f,e);let t={},i=0;const n=new Set;function s(){i+=1;for(const e of n)try{e()}catch{}}function b(e){const o=t;if(e===null)t={};else if(e&&typeof e=="object"){const c={};for(const r of Object.keys(e))l(r)||(c[r]=e[r]);t={...t,...c}}else return()=>{};return s(),()=>{t=o,s()}}function T(){return{...t}}function j(e,o){return l(e)?f[e]()!==!1:Object.prototype.hasOwnProperty.call(t,e)?t[e]!==!1:o?.[e]!==!1}function _(e){return n.add(e),()=>{n.delete(e)}}const u=()=>i;function m(){return a(_,u,u)}function O(){t={},s()}export{O as _resetToggles,T as getToggles,b as setToggles,j as toggleValue,m as useHostToggles};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getSessionToken as h,getSessionScope as _,onScopeChange as w}from"./33fa2c8ca2.js";let o=null;function I(e){o=typeof e=="string"&&e.trim()?e.trim():null}function j(){return o}let s=null;function F(e){s=typeof e=="string"&&e.trim()?e.trim():null}function K(){return s}function k(e){if(typeof e!="string"||!e)return!1;let t=e;const n=t.indexOf("://");if(n!==-1){const r=t.indexOf("/",n+3);t=r===-1?"/":t.slice(r)}return t.includes("/api/v1/")||t.startsWith("/api/v1/")}let y=null;function $(e){y=e!=null&&String(e).trim()?String(e).trim():null}function R(){return y}let a=null;function X(e){a=typeof e=="string"&&e.trim()?e.trim():null}function m(){if(a)return a;try{const e=typeof window<"u"?window.__configApiKey:null;if(typeof e=="string"&&e.trim())return e.trim()}catch{}return null}function v(e){if(typeof e!="string"||!e)return!1;let t=e;const n=t.indexOf("://");if(n!==-1){const i=t.indexOf("/",n+3);t=i===-1?"/":t.slice(i)}if(!t.includes("/api/v1/")&&!t.startsWith("/api/v1/")||/\/api\/v1\/o\/[^/]+\/c\/[^/]+/.test(t)||/\/api\/v1\/channels\/[^/]+/.test(t))return!1;const r=t.match(/\/api\/v1\/projects\/([^/]+)/);if(r){const i=r[1];if(!/^\d+$/.test(i))return!1}return!0}function L(e){if(s&&k(e))return{"X-Share-Token":s};if(!v(e))return{};if(o)return{"X-Embed-Slug":o};const t=h();if(t)return{Authorization:`Bearer ${t}`};const n=m();return n?{"X-Api-Key":n}:{}}function N(){const e={};s&&(e["X-Share-Token"]=s),o&&(e["X-Embed-Slug"]=o);const t=h();t&&(e.Authorization=`Bearer ${t}`);const n=m();return n&&(e["X-Api-Key"]=n),e}let u=!1;const c=new Set;function g(){for(const e of c)try{e(u)}catch{}}function B(){const e=_();return e&&String(e).toLowerCase()!=="session"?!0:u}function O(e){u||(u=!0,g())}function W(e){return typeof e!="function"?()=>{}:(c.add(e),()=>c.delete(e))}w(()=>g());function z(){u=!1}async function H(e,t={}){if(!e||e.status!==403)return;let n=null,r=null,i=null;try{const l=await(e.clone?e.clone():e).json();n=l?.detail??null,r=l?.code??null,i=l?.hostname??null}catch{}if(r==="EMBED_NOT_LICENSED"){try{const{setConfiguratorStatusFromBackend:p}=await import("./3bbcee0334.js");p({status:!1,message:n||null})}catch{}try{console.warn(`[sdk] this organisation is not licensed to run on ${i||"this website"}${n?` \u2014 ${n}`:""}`)}catch{}return}const d=String(t.url||""),A=String(t.method||"GET").toUpperCase();if(/\/api\/v1\/projects\//.test(d)&&A!=="GET"){O(n);return}}let x=null,f=!1;function P(){f=!1}function S(e){const t=String(e||"").toLowerCase();return t.includes("required")?"missing":t.includes("revoked")?"revoked":t.includes("invalid")?"invalid":"unknown"}function T(e={}){if(f)return;f=!0;const t=e.reason?e:{...e,reason:S(e.detail)};if(!x){const n=t.reason&&t.reason!=="unknown"?`(${t.reason})`:"";return}try{x(t)}catch{}}function b(e){return!!e&&e.status===401}async function q(e,t={}){if(!b(e))return;let n=null;try{n=(await(e.clone?e.clone():e).json())?.detail??null}catch{}T({...t,status:401,detail:n,reason:S(n)})}export{z as _resetReadOnly,L as authHeaders,S as categorizeAuthFailure,N as copilotAuthHeaders,m as getApiKey,R as getChannelId,j as getEmbedSlug,K as getShareToken,b as isAuthFailure,B as isReadOnlyCredential,O as markReadOnlyCredential,T as notifyAuthFailure,W as onReadOnlyChange,v as pathRequiresApiKey,q as reportAuthFailure,H as reportForbidden,P as resetAuthFailureNotifier,X as setApiKey,$ as setChannelId,I as setEmbedSlug,F as setShareToken};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{default as r,SharedConfiguratorScene as t}from"./87bb469216.js";import{default as i}from"./4aa671f9f6.js";import{default as f}from"./baeaed46c9.js";import{default as d}from"./88251d6671.js";import{default as l}from"./81eb433604.js";import{default as h}from"./3fb3ab6757.js";import{default as x}from"./7206ce49c6.js";import{OptionThumbnail as c,FinishThumbnail as T,LayoutThumbnail as b,HostedProductThumbnail as P,WidthSlider as g,ColorSwatch as y,FrameSizeButton as C,ProductFeaturePickers as F}from"./c12c112c6f.js";import{applyTheme as O,themeMode as w,normalizeThemeId as z}from"./5c9fd9201c.js";export{l as ARViewer,y as ColorSwatch,r as DefaultConfigurator,T as FinishThumbnail,C as FrameSizeButton,P as HostedProductThumbnail,b as LayoutThumbnail,d as LoadingScreen,f as MainLayout,h as OptionSetSection,i as OptionSidebar,c as OptionThumbnail,x as Popover,F as ProductFeaturePickers,t as SharedConfiguratorScene,g as WidthSlider,O as applyTheme,z as normalizeThemeId,w as themeMode};
|