@epigraph/configurator 1.12.2 → 1.12.3

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.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -9144,7 +9144,7 @@ outputColor=vec4(Uncharted2ToneMapping(inputColor.rgb),inputColor.a);
9144
9144
  #else
9145
9145
  outputColor=vec4(toneMapping(inputColor.rgb),inputColor.a);
9146
9146
  #endif
9147
- }`,ToneMappingEffect=class extends Effect{constructor({blendFunction:a=BlendFunction.SRC,adaptive:e=!1,mode:t=e?ToneMappingMode.REINHARD2_ADAPTIVE:ToneMappingMode.ACES_FILMIC,resolution:n=256,maxLuminance:s=4,whitePoint:o=s,middleGrey:v=.6,minLuminance:A=.01,averageLuminance:b=1,adaptationRate:T=1}={}){super("ToneMappingEffect",tone_mapping_default,{blendFunction:a,uniforms:new Map([["luminanceBuffer",new Uniform(null)],["maxLuminance",new Uniform(s)],["whitePoint",new Uniform(o)],["middleGrey",new Uniform(v)],["averageLuminance",new Uniform(b)]])}),this.renderTargetLuminance=new WebGLRenderTarget(1,1,{minFilter:LinearMipmapLinearFilter,depthBuffer:!1}),this.renderTargetLuminance.texture.generateMipmaps=!0,this.renderTargetLuminance.texture.name="Luminance",this.luminancePass=new LuminancePass({renderTarget:this.renderTargetLuminance}),this.adaptiveLuminancePass=new AdaptiveLuminancePass(this.luminancePass.texture,{minLuminance:A,adaptationRate:T}),this.uniforms.get("luminanceBuffer").value=this.adaptiveLuminancePass.texture,this.resolution=n,this.mode=t}get mode(){return Number(this.defines.get("TONE_MAPPING_MODE"))}set mode(a){if(this.mode!==a){switch(this.defines.clear(),this.defines.set("TONE_MAPPING_MODE",a.toFixed(0)),a){case ToneMappingMode.REINHARD:this.defines.set("toneMapping(texel)","ReinhardToneMapping(texel)");break;case ToneMappingMode.OPTIMIZED_CINEON:this.defines.set("toneMapping(texel)","OptimizedCineonToneMapping(texel)");break;case ToneMappingMode.ACES_FILMIC:this.defines.set("toneMapping(texel)","ACESFilmicToneMapping(texel)");break;default:this.defines.set("toneMapping(texel)","texel");break}this.adaptiveLuminancePass.enabled=a===ToneMappingMode.REINHARD2_ADAPTIVE,this.setChanged()}}getMode(){return this.mode}setMode(a){this.mode=a}get whitePoint(){return this.uniforms.get("whitePoint").value}set whitePoint(a){this.uniforms.get("whitePoint").value=a}get middleGrey(){return this.uniforms.get("middleGrey").value}set middleGrey(a){this.uniforms.get("middleGrey").value=a}get averageLuminance(){return this.uniforms.get("averageLuminance").value}set averageLuminance(a){this.uniforms.get("averageLuminance").value=a}get adaptiveLuminanceMaterial(){return this.adaptiveLuminancePass.fullscreenMaterial}getAdaptiveLuminanceMaterial(){return this.adaptiveLuminanceMaterial}get resolution(){return this.luminancePass.resolution.width}set resolution(a){const e=Math.max(0,Math.ceil(Math.log2(a))),t=Math.pow(2,e);this.luminancePass.resolution.setPreferredSize(t,t),this.adaptiveLuminanceMaterial.mipLevel1x1=e}getResolution(){return this.resolution}setResolution(a){this.resolution=a}get adaptive(){return this.mode===ToneMappingMode.REINHARD2_ADAPTIVE}set adaptive(a){this.mode=a?ToneMappingMode.REINHARD2_ADAPTIVE:ToneMappingMode.REINHARD2}get adaptationRate(){return this.adaptiveLuminanceMaterial.adaptationRate}set adaptationRate(a){this.adaptiveLuminanceMaterial.adaptationRate=a}get distinction(){return console.warn(this.name,"distinction was removed."),1}set distinction(a){console.warn(this.name,"distinction was removed.")}update(a,e,t){this.adaptiveLuminancePass.enabled&&(this.luminancePass.render(a,e),this.adaptiveLuminancePass.render(a,null,null,t))}initialize(a,e,t){this.adaptiveLuminancePass.initialize(a,e,t)}};const coreSceneStore=create$3((a,e)=>({CORE_API:null,coreReady:void 0,frameloop:"always",hoveredGhostIndex:-1,itemDraggedSkuID:null,screenshotRenderer:new WebGLRenderer({antiAlias:!0,preserveDrawingBuffer:!0}),screenshotCamera:new PerspectiveCamera(75,1.33,.1,1e3),builderMode:!1,dragging:!1,bbox:null,draggingItemGUID:null,sceneRef:null,cssLoaded:!1,sceneHasDefaultConfigurationID:!1,configurationLoaded:!0,preconfigurationLoaded:!1,configurationLoadedOnRestart:!0,cursorParentRef:null,glContext:null,canvasTooltipText:"",canvasSize:{width:600,height:600},boundData:{center:new Vector3(0,0,0),size:new Vector3(0,0,0)},showDimensions:!1,autoFocusTrigger:0,cameraActive:!1,autoFocusRef:null,alertData:{},persistantAlertData:null,alertQueue:[],currentAlertData:null,alertSettings:null,draggingOnDropCollisionData:null,multipleTouchDetected:!1,isMobile:!1,isTouchDevice:!1,isTablet:!1,isDesktop:!0,isLandscape:!1,sceneSettings:{usdzMaxTextureSize:1024,usdzPrecision:7,swappableRoot:!0,ghostColorOnHoverWithDraggableUi:{r:153,g:252,b:0,a:1},preserveDrawingBuffer:!1,showSaveBtn:!0,showShareBtn:!0,showResetBtn:!0,showDimensionBtn:!0,showViewInYourSpaceBtn:!0,showDependencyOnHover:!1,showContextMenu:!0,showHotspotsBtn:!0,showInstructionsBtn:!1,showInstructionsOnStartup:!1,sceneScaleUnit:"ft",arPlacement:"floor",arTransforms:{position:[0,0,0],rotation:[0,0,0],scale:[1,1,1]},currency:"$",disableDragDrop:!1,ignoreSpawningCollision:!1,disableCollider:!1,disableContextMenu:!1,ghostColor:{r:10,g:10,b:10,a:.2},ghostScale:[1,1,1],ghostAsWireframe:!1,draggableUI:!1,addFromInfoModal:!1,clickToAddUi:!0,accordionInBuildUi:!1,outOfStock_EmissiveColor:{r:250,g:50,b:0},outOfStock_EmissiveIntensity:.002,defaultConfigurationID:null,emptySceneText:null,emptySceneTextFontSize:"2rem",addToCartCTAText:"Add To Cart",ignoreCollisionPostDragging:!1,comboPlugDistanceThreshold:.05,disableCart:!1,dimensionColor:{r:0,g:0,b:0},disableLocalColorOverride:!1,analyticsEventPrefix:"",outlineSettings:{multisampling:10,visibleEdgeColor:new Color$1("#0f0").convertSRGBToLinear(),hiddenEdgeColor:new Color$1("#0f0").convertSRGBToLinear(),blur:3,width:1e3,edgeStrength:1e3,blendFunction:BlendFunction.ALPHA,pulseSpeed:0,xRay:!0},textSettings:{cartQuantityText:"Qty",reviewButtonText:"Review",cartHeadingText:"Review Products",buildTabHeadingText:"Build",colorTabHeadingText:"Color",featuresTabHeadingText:"Features",tooltipEmptySceneText:"",tooltipInstructionText:"-Drag to rotate the camera-"},variantsTabOrder:{color:{enabled:!0,priority:1},geometryVariants:{enabled:!0,priority:2}},boundingBoxLeeway:.9,contactShadowVisibility:!0,measurementPrecision:2,disableAlerts:!1,focusCameraOnGhosts:!0,alertLevel:2999,alertControl:{default:!0,itemAdded:!0,geometryVariantChanged:!0,overridesRemoved:!0,materialVariantChanged:!0,itemRemoved:!0,itemRepositioned:!0,configurationSaved:!0,linkCopied:!0,outOfStock:!0,unvisualizedItemSpawn:!0},screenshotCameras:[{position:new Vector3(-2.5,.6,-5),rotation:new Vector3(-3.1097068566150314,-.6437852162982552,-3.122449778846033)},{position:new Vector3(3,1,-5),rotation:new Vector3(-.5,1,.5)}],instructionsSettings_desktop:[{header:"Add to Scene",description:"Click to add individual modules to the scene.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1A_Drag_Drop/Non-furniture_Step_1A.json"},{header:"Rearrange Modules",description:"Drag & drop individual modules in the scene to rearrange.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_2/Non-furniture_Step_2.json"},{header:"Remove Modules",description:"Click to select and remove individual modules from the scene.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_3/Non-furniture_Step_3.json"}],instructionsSettings_mobile:[{header:"Add to Scene",description:"Click to add individual modules to the scene.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1A_Drag_Drop_Mobile/Mobile_Non-furniture_Step_1A.json"},{header:"Rearrange Modules",description:"Drag & drop individual modules in the scene to rearrange.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_2/Non-furniture_Step_2.json"},{header:"Remove Modules",description:"Tap to select and remove individual modules from the scene.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_3/Non-furniture_Step_3.json"}],defaultInstructionsSettings:{step1_drag:{mobile:{header:"Add to Scene",description:"Drag & drop individual modules to add to the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_1A_Drag_Drop_Mobile/Mobile_Furniture_Step_1A.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1A_Drag_Drop_Mobile/Mobile_Non-furniture_Step_1A.json"}},desktop:{header:"Add to Scene",description:"Drag & drop individual modules to add to the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_1A_Drag_Drop/Furniture_Step_1A.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1A_Drag_Drop/Non-furniture_Step_1A.json"}}},step1_add:{mobile:{header:"Add to Scene",description:"Click to add individual modules to the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_1B_Click_Add_Mobile/Mobile_Furniture_Step_1B.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1B_Click_Add_Mobile/Mobile_Non-furniture_Step_1B.json"}},desktop:{header:"Add to Scene",description:"Click to add individual modules to the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_1B_Click_Add/Furniture_Step_1B.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1B_Click_Add/Non-furniture_Step_1B.json"}}},step2:{mobile:{header:"Rearrange Modules",description:"Drag & drop individual modules in the scene to rearrange.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_2/Furniture_Step_2.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_2/Non-furniture_Step_2.json"}},desktop:{header:"Rearrange Modules",description:"Drag & drop individual modules in the scene to rearrange.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_2/Furniture_Step_2.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_2/Non-furniture_Step_2.json"}}},step3:{mobile:{header:"Remove Modules",description:"Tap to select and remove individual modules from the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_3/Furniture_Step_3.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_3/Non-furniture_Step_3.json"}},desktop:{header:"Remove Modules",description:"Click to select and remove individual modules from the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_3/Furniture_Step_3.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_3/Non-furniture_Step_3.json"}}}}},setCSSLoaded:t=>{a({cssLoaded:t})},actions:{popFromAlertQueue:()=>{const{alertQueue:t}=e();return t.shift(),a({alertQueue:t}),t},addToAlertQueue:t=>{const{alertQueue:n,currentAlertData:s}=e();return n.length>0&&n[n.length-1].alertId&&t.alertId===n[n.length-1].alertId||n.length==0&&s&&s.alertId&&s.alertId==t.alertId||(n.push(t),a({alertQueue:n})),n},getDeviceState:()=>{const{isDesktop:t,isMobile:n,isTablet:s,isTouchDevice:o,isLandscape:v}=e();return{isDesktop:t,isMobile:n,isTablet:s,isTouchDevice:o,isLandscape:v}},enableCart:()=>{const{sceneSettings:t}=e();t.disableCart=!1,inventoryStore.getState().actions.refreshInventory(itemStore.getState().itemsSpawned),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.Cart_StatusUpdated,{disableCart:!1})},disableCart:()=>{const{sceneSettings:t}=e();t.disableCart=!0,inventoryStore.getState().actions.refreshInventory(itemStore.getState().itemsSpawned),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.Cart_StatusUpdated,{disableCart:!0})},getSceneSettings:()=>{const{sceneSettings:t}=e();return t},sendAlert:t=>{a({alertData:{...t}})},switchCursor(t){const{cursorParentRef:n}=e();if(!n)return;let s="";switch(t){default:case CURSORS.GRAB:s="grabCursor";break;case CURSORS.GRABBING:s="grabbingCursor";break;case CURSORS.BLOCKED:s="blockedCursor";break;case CURSORS.POINTER:s="pointerCursor";break;case CURSORS.MOVE:s="moveCursor";break}for(let o=0;o<n.classList.length;o++)n.classList[o].includes("Cursor")&&n.classList.remove(n.classList[o]);n.classList.add(s)},setAlertSettings:t=>{a({alertSettings:t})},async completeDropItem(){const t=attachmentStore$1.getState().attachmentSystem,{draggingOnDropCollisionData:n}=e(),{node:s,attachedChildrenGuids:o,collidingStatus:v,intersectingGhostObject:A,initPosition:b,initRotation:T,detachedPlugs:ee,attachedNodesToCurrentNode:ne}=n;CORE_API.alert({alertMsg:"Item(s) have been removed",alertTime:7e3,alertType:"info",alertLabel:"Item(s) Removed",alertId:"itemRemoved"});for(const[pe,de]of o.entries())v[pe]===!0&&await itemStore.getState().actions.removeItemByGUID(de);const re=A.userData;let se=s.getPlugByName(re.incomingPlugName),le=t.currentStructure.getPlugByGUID(re.receiverPlugGUID);s.ref.position.set(A.position.x,A.position.y,A.position.z),s.ref.setRotationFromEuler(A.rotation),s.transform={position:A.position,rotation:A.quaternion},t.currentStructure.connectPlugs({incomingPlug:se,receiverPlug:le}),ghostStore.getState().actions.clearAllGhosts(),itemStore.getState().actions.deselectItem(),ne.map(pe=>{s.ref.parent.attach(pe.ref),pe.transform={position:pe.ref.position,rotation:pe.ref.quaternion},s.dragging=!1,pe.dragging=!1}),await attachmentStore$1.getState().actions.updateFittingSkuIds()},async revertDropItem(){const t=attachmentStore$1.getState().attachmentSystem,{draggingOnDropCollisionData:n}=e(),{node:s,attachedChildrenGuids:o,collidingStatus:v,intersectingGhostObject:A,initPosition:b,initRotation:T,detachedPlugs:ee,attachedNodesToCurrentNode:ne}=n;CORE_API.alert({alertMsg:"Position of item"+s.skuID+"is being moved to it's original position",alertTime:4e3,alertType:"info",alertLabel:"Repositioning",alertId:"itemRepositioned"});const re=ee.neighbourDetachedPlugs;re&&(ee.neighbourNode.detachNodeFromReceiver(),t.currentStructure.connectPlugs({incomingPlug:re.incomingPlug,receiverPlug:re.receiverPlug}));let se=ee.rootDetachedPlugs.incomingPlug,le=ee.rootDetachedPlugs.receiverPlug;s.ref.position.set(b.x,b.y,b.z),s.ref.setRotationFromEuler(T);let pe=new Quaternion().identity();s.ref.getWorldQuaternion(pe),s.transform={position:b,rotation:pe},t.currentStructure.connectPlugs({incomingPlug:se,receiverPlug:le}),ghostStore.getState().actions.clearAllGhosts(),itemStore.getState().actions.deselectItem(),ne.map(de=>{s.ref.parent.attach(de.ref),de.transform={position:de.ref.position,rotation:de.ref.quaternion},s.dragging=!1,de.dragging=!1}),await attachmentStore$1.getState().actions.updateFittingSkuIds()},setCoreSettings:t=>{const{sceneSettings:n,isMobile:s,isTouchDevice:o,isLandscape:v,actions:A}=e(),b=s===!0?"mobile":"desktop",T=["showSave","showShare","showReset","showDimension","showHotspots","showInstructionsBtn","showViewInYourSpace","showContextMenu","showInstructionsOnStartup","draggableUI","clickToAddUi","textSettings","alertControl","variantsTabOrder","emptySceneTextFontSize","instructionsSettings"];for(const ee of T)if(ee==="draggableUI"||ee==="clickToAddUi"||ee==="emptySceneTextFontSize"||ee==="showInstructionsOnStartup"||ee==="showInstructionsBtn"||ee==="instructionsSettings"){const re=`${ee}_${v===!1&&o===!0?"mobile":"desktop"}`;t[re]!==void 0?n[ee]=t[re]:n[re]!==void 0&&(n[ee]=n[re])}else if(ee==="textSettings"||ee==="variantsTabOrder"||ee==="alertControl"||ee==="outlineSettings"){if(t.hasOwnProperty(ee)){let ne=n[ee];Object.keys(ne).map(re=>{let se=t[ee];se.hasOwnProperty(re)?(re==="visibleEdgeColor"||re==="hiddenEdgeColor")&&(se[re]=new Color$1(se[re]).convertSRGBToLinear()):se[re]=ne[re]})}}else{const ne=`${ee}_${b}`;if(t[ne]!==void 0){let re=`${ee}Btn`;ee=="showContextMenu"&&(re=`${ee}`),n[re]=t[ne]}}t.disableCart===!0&&A.disableCart(),Object.keys(t).map(ee=>n[ee]=t[ee]),n.emptySceneText===null&&(n.emptySceneTextFontSize=s?"1.2rem":"1.5rem",n.draggableUI===!0?n.emptySceneText="Drag an item here to get started":n.emptySceneText="Select an item to get started"),a({sceneSettings:{...n,ghostThreeColor:{r:n.ghostColor.r/255,g:n.ghostColor.g/255,b:n.ghostColor.b/255,a:n.ghostColor.a/255},draggableUiGhostThreeColorOnHover:{r:n.ghostColorOnHoverWithDraggableUi.r/255,g:n.ghostColorOnHoverWithDraggableUi.g/255,b:n.ghostColorOnHoverWithDraggableUi.b/255,a:n.ghostColorOnHoverWithDraggableUi.a/255}}})},triggerAutoFocus:(t=null)=>a(n=>({autoFocusRef:t,autoFocusTrigger:n.autoFocusTrigger+1})),requestNewScreenshot:async(t,n)=>new Promise(async(s,o)=>{LOGGER.info({title:"Taking a screenshot"});const{screenshotRenderer:v,sceneRef:A,screenshotCamera:b,canvasSize:T}=e(),ee=await CORE_API.getCurrentCameraDetails();if(v.setClearColor(16777215),b.copy(ee),t!==null&&(b.position.copy(t.position),b.rotation.copy(new Euler(t.rotation.x,t.rotation.y,t.rotation.z))),n==null?v.setSize(T.width,T.height):v.setSize(n.width,n.height),v.render(A.parent,b),v.preserveDrawingBuffer===!1)LOGGER.warn({title:"Preserve Drawing Buffer must be enabled to take a screenshot. Please make sure to enable this within the project input data coreSettings"}),o({success:!1,imageData:null});else{LOGGER.info({title:"Downloading the screenshot"});const ne=v.domElement.toDataURL("image/png").replace("image/png","image/octet-stream");s({success:!0,imageData:ne})}})}})),hotspotIdPrefix="rd",hotspotIdSeparator="_";function generateHotspotAbsoluteID(a,e){return`${hotspotIdPrefix}${hotspotIdSeparator}${a}${hotspotIdSeparator}${e}`}async function wait(a){return LOGGER.info({title:`Waiting for ${a}ms`}),new Promise((e,t)=>{setTimeout(()=>{e(!0)},a)})}function compareObjects(a,e){if(a===null||e===null)return!1;for(let t in a)if(a.hasOwnProperty(t)&&e.hasOwnProperty(t)&&a[t]!==e[t])return!1;return Object.keys(a).length===Object.keys(e).length}const saveStructureToCMS=a=>{const e={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)};return fetch(SAVE_CONFIG_ENDPOINT,e)},mobileCheck=function(){let a=!1;return function(e){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4)))&&(a=!0)}(navigator.userAgent||navigator.vendor||window.opera),a};function isIpadOS(){return navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform)}function tabletCheck(){const a=navigator.userAgent.toLowerCase(),e=/(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/.test(a);return e||isIpadOS()}function touchDeviceCheck(){return"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}async function getJSONFromEndpoint(a){let e={data:null,report:"",success:!1};try{const n=await(await fetch(a)).text();e.data=JSON.parse(n),e.success=!0,e.report="Successfully fetched JSON data."}catch(t){e.report=t,CORE_API.alert({alertMsg:"",alertTime:5e3,alertType:"warn",alertLabel:"Preload Failed"})}return e}const addVector=(a,e)=>new Vector3(a[0]+e[0],a[1]+e[1],a[2]+e[2]),Vec3ToArr=a=>[a.x,a.y,a.z],ArrToVec3=a=>new Vector3(a[0],a[1],a[2]),findMeshAndCloneMatFromScene=(a,e=!0)=>{let t=[];const n=coreSceneStore.getState().sceneSettings.outOfStock_EmissiveColor,s=coreSceneStore.getState().sceneSettings.outOfStock_EmissiveIntensity;return a.traverse(o=>{o.isMesh&&(o.material.userData.cloned?o.material.userData.inStock!==e&&(e?(o.material.emissive.set(new Color$1(255,255,255)),o.material.emissiveIntensity=0):(o.material.emissive.set(new Color$1(n.r,n.g,n.b)),o.material.emissiveIntensity=s),o.material.userData.inStock=e):(o.material=o.material.clone(),o.material.userData.inStock=e,o.material.userData.cloned=!0,e?(o.material.emissive.set(new Color$1(255,255,255)),o.material.emissiveIntensity=0):(o.material.emissive.set(new Color$1(n.r,n.g,n.b)),o.material.emissiveIntensity=s)),t.push(o))}),t},filterArrWithCondition=(a,e)=>{let t=0,n=[];for(let s=0;s<a.length;s++){const o=a[s];e(o)?a[t++]=o:n.push(a[s])}return a.length=t,n},degToRad=a=>a*Math.PI/180,resolveAssetUrl=a=>{if(!a)return;if(new RegExp("^(?:[a-z+]+:)?//","i").test(a))return a;let n=a;return n=n.replaceAll("<@all-projects@>",ALL_PROJECTS_ASSET_DATA_ROOT_URL),n=n.replaceAll("<@generic-project@>",GENERIC_PROJECT_ASSET_DATA_ROOT_URL),n};function componentToHex(a){var e=a.toString(16);return e.length==1?"0"+e:e}function rgbToHex(a,e,t){return"#"+componentToHex(a)+componentToHex(e)+componentToHex(t)}function getUrlParameterByName(a,e=window.location.search){const t=new URLSearchParams(e);return Object.fromEntries(t.entries())[a]}const lightStore=create$3((a,e)=>({defaultEnvMapUrl:"<@generic-project@>/env-map/neutral.hdr",envMapUrl:"",actions:{setEnvLightMap:t=>{a(n=>({envMapUrl:t}))},processLookEnvMapOverride:t=>{const{envMapUrl:n,defaultEnvMapUrl:s,actions:o}=e(),v=productDataStore$1.getState().lookData[t],A=v?.envMapOverride;if(!v||!A){o.setEnvLightMap(s);return}if(A===n){LOGGER.info({title:`New Env Map Url is the same as the current ${A}`});return}o.setEnvLightMap(A)}}}));var rngBrowser={exports:{}},getRandomValues=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof window.msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto);if(getRandomValues){var rnds8=new Uint8Array(16);rngBrowser.exports=function(){return getRandomValues(rnds8),rnds8}}else{var rnds=new Array(16);rngBrowser.exports=function(){for(var e=0,t;e<16;e++)e&3||(t=Math.random()*4294967296),rnds[e]=t>>>((e&3)<<3)&255;return rnds}}var rngBrowserExports=rngBrowser.exports,byteToHex=[];for(var i$3=0;i$3<256;++i$3)byteToHex[i$3]=(i$3+256).toString(16).substr(1);function bytesToUuid$2(a,e){var t=e||0,n=byteToHex;return[n[a[t++]],n[a[t++]],n[a[t++]],n[a[t++]],"-",n[a[t++]],n[a[t++]],"-",n[a[t++]],n[a[t++]],"-",n[a[t++]],n[a[t++]],"-",n[a[t++]],n[a[t++]],n[a[t++]],n[a[t++]],n[a[t++]],n[a[t++]]].join("")}var bytesToUuid_1=bytesToUuid$2,rng$1=rngBrowserExports,bytesToUuid$1=bytesToUuid_1,_nodeId,_clockseq,_lastMSecs=0,_lastNSecs=0;function v1$2(a,e,t){var n=e&&t||0,s=e||[];a=a||{};var o=a.node||_nodeId,v=a.clockseq!==void 0?a.clockseq:_clockseq;if(o==null||v==null){var A=rng$1();o==null&&(o=_nodeId=[A[0]|1,A[1],A[2],A[3],A[4],A[5]]),v==null&&(v=_clockseq=(A[6]<<8|A[7])&16383)}var b=a.msecs!==void 0?a.msecs:new Date().getTime(),T=a.nsecs!==void 0?a.nsecs:_lastNSecs+1,ee=b-_lastMSecs+(T-_lastNSecs)/1e4;if(ee<0&&a.clockseq===void 0&&(v=v+1&16383),(ee<0||b>_lastMSecs)&&a.nsecs===void 0&&(T=0),T>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");_lastMSecs=b,_lastNSecs=T,_clockseq=v,b+=122192928e5;var ne=((b&268435455)*1e4+T)%4294967296;s[n++]=ne>>>24&255,s[n++]=ne>>>16&255,s[n++]=ne>>>8&255,s[n++]=ne&255;var re=b/4294967296*1e4&268435455;s[n++]=re>>>8&255,s[n++]=re&255,s[n++]=re>>>24&15|16,s[n++]=re>>>16&255,s[n++]=v>>>8|128,s[n++]=v&255;for(var se=0;se<6;++se)s[n+se]=o[se];return e||bytesToUuid$1(s)}var v1_1=v1$2,rng=rngBrowserExports,bytesToUuid=bytesToUuid_1;function v4$1(a,e,t){var n=e&&t||0;typeof a=="string"&&(e=a==="binary"?new Array(16):null,a=null),a=a||{};var s=a.random||(a.rng||rng)();if(s[6]=s[6]&15|64,s[8]=s[8]&63|128,e)for(var o=0;o<16;++o)e[n+o]=s[o];return e||bytesToUuid(s)}var v4_1=v4$1,v1$1=v1_1,v4=v4_1,uuid=v4;uuid.v1=v1$1;uuid.v4=v4;var uuid_1=uuid;class Plug{constructor(e,t,n=null){this._attachedPlug=null,this._name=e.name,this._acceptedPlugTypes=e.acceptedPlugTypes,this._affectedNodes=e.affectedNodes,this._unvisualizedCount=e.unvisualizedCount,this._weight=e.weight,this._connectsToPlugTypes=e.connectsToPlugTypes,this._dependencySku=e.dependencySku,this._isDependencySkuInteractive=e.isDependencySkuInteractive,this._autoSpawnDependencyIfMissing=e.autoSpawnDependencyIfMissing,this._node=t,n?(this._comboPlugConnector=n.comboPlugConnector,this._guid=n.guid,this._isOpen=n.isOpen,this._type=n.type,this._isReceiverPlug=n.isReceiverPlug,this._attachedPlugGUID=n.attachedPlugGUID):(this._comboPlugConnector=!1,this._guid=uuid_1.v4(),this._isOpen=!0,this._type=e.type,this._isReceiverPlug=!1,this._attachedPlugGUID=null)}export(){return this.isOpen?null:{guid:this._guid,type:this._type,isOpen:this._isOpen,comboPlugConnector:this._comboPlugConnector,attachedPlugGUID:this._attachedPlugGUID,isReceiverPlug:this._isReceiverPlug}}get node(){return this._node}set comboPlugConnector(e){this._comboPlugConnector=e}get comboPlugConnector(){return this._comboPlugConnector}get attachedPlug(){return this._attachedPlug}set attachedPlug(e){this._attachedPlug=e}get attachedPlugGUID(){return this._attachedPlugGUID}set type(e){this._type=e}get type(){return this._type}get weight(){return this._weight}get unvisualizedCount(){return this.__unvisualizedCount}get affectedNodes(){return this._affectedNodes}get guid(){return this._guid}get isReceiverPlug(){return this._isReceiverPlug}get name(){return this._name}get acceptedPlugTypes(){return this._acceptedPlugTypes}set acceptedPlugTypes(e){this._acceptedPlugTypes=e}get connectsToPlugTypes(){return this._connectsToPlugTypes}set connectsToPlugTypes(e){this._connectsToPlugTypes=e}get isOpen(){return this._isOpen}attachPlug(e,t=!1){this._attachedPlug=e,this._attachedPlugGUID=e.guid,this._isOpen=!1,this._isReceiverPlug=t;const n=this,s=this._node;if(s.isConnectedToRoot&&t){const o=s.whichPlugAreWeAttachedUsing();switch(e.type){case"weighted_hider":o.weight<n.weight&&(s.showNodes(o.affectedNodes)||CORE_API.coreWCRef.addEventListener(s.guid+":modelLoaded",function(){s.showNodes(o.affectedNodes)},{once:!0}));break}}if(t&&e.type!==""&&e.type==n._type)switch(e.type){default:case"weighted_hider":n._weight>e.weight?e.node.hideNodes(e.affectedNodes)||CORE_API.coreWCRef.addEventListener(e.node.guid+":modelLoaded",function(){e.node.hideNodes(e.affectedNodes)},{once:!0}):n._weight<e.weight&&(s.hideNodes(n._affectedNodes)||CORE_API.coreWCRef.addEventListener(s.guid+":modelLoaded",function(){s.hideNodes(n._affectedNodes)},{once:!0}));break}t&&(s.isEndNode=!1)}async openPlug(){if(this._comboPlugConnector&&(this._comboPlugConnector=!1),this._node.isConnectedToRoot){const e=this._node.whichPlugAreWeAttachedUsing();if(e&&this._guid!==e.guid)switch(this.type){case"weighted_hider":e.type==="weighted_hider"&&e.weight<this.weight&&this._node.hideNodes(e.affectedNodes);break}}if(this._isReceiverPlug&&this._attachedPlug.type!==""&&this._attachedPlug.type==this._type)switch(this._attachedPlug.type){default:case"weighted_hider":this._weight>this._attachedPlug.weight?this._attachedPlug.node.showNodes(this._attachedPlug.affectedNodes):this._weight<this._attachedPlug.weight&&this._node.showNodes(this._affectedNodes);break}if(this._attachedPlug=null,this._attachedPlugGUID=null,this._isOpen=!0,this._isReceiverPlug&&(this._isReceiverPlug=!1,this._node.checkIfEndNode()),!!this._dependencySku&&!(this._autoSpawnDependencyIfMissing==!1||this._isDependencySkuInteractive||coreSceneStore.getState().configurationLoaded===!1))try{const e=await ghostStore.getState().actions.spawnGhostsForSkuID(this._dependencySku,!0);if(!e)return;const t=e.connectablePlugs;let n=!1;const s=this._isDependencySkuInteractive?this.isDependencySkuInteractive===1:!1;for(const o of t){if(o.receiverPlug.guid!==this._guid)continue;n=!0;const v=await itemStore.getState().actions.addItemBySkuID(this._dependencySku,t.indexOf(o),!0,s);v!==null&&this._node.addMyDependenciesGUID(v)}n||await ghostStore.getState().actions.clearAllGhosts()}catch{LOGGER.info({title:"The Plug has been removed!"})}}canAttachToPlug(e){for(let t=0;t<this._connectsToPlugTypes.length;t++)if(e._acceptedPlugTypes.includes(this._connectsToPlugTypes[t]))return!0;return!1}}let Node$1=class{#t="default";#r=!1;#i=!1;#s=!0;#n={};#o=!1;#c={};#u=[];constructor(e,t=null,n,s){let o=productDataStore$1.getState().productData;this._plugs=[],this._skuID=e,this._ref=null,this._dragging=!1,this._modelData=null,this._transform=null,this.#t="default",this._overrideVariant=null,this._followsParent=o[e].followsParent,this._categoryID=o[e].categoryID,this._replace=o[e].replace,this._swappable=o[e].swappable,this._price=this.#a(),this.#r=o[e]?.ignoreInCart,t?(this._guid=t.guid,this._isEndNode=t.isEndNode,this._overrideVariant=t.overrideVariant,this.generatePlugsWithData(e,t.plugs)):(this._guid=uuid_1.v4(),this._isEndNode=!0,this.generatePlugsForNode(e)),n&&Object.keys(n).map(v=>{if(o[e].looks&&o[e].looks.includes(v)){this.#t=v;return}})}get isRoot(){return this._skuID.toLowerCase()==="root"}updateGeometryVariant(e,t){const s=productDataStore$1.getState().categoryData.geometryVariants;let o=null;if(s.map(ee=>{ee.id==e&&(o=ee)}),!o)return;const v=o.productsInCategory,b=o.variants[t].productsToSwitch,T=itemStore.getState().itemsSpawned;v.map(ee=>{ee.products.map(ne=>{this.skuID===ne&&ee.products.map(re=>{b.map(se=>{if(se==re){const le=productDataStore$1.getState().actions.getProductDataById(se);this.skuID=le.skuID;const pe=T[this.guid];pe&&pe.itemData&&Object.keys(le).map(de=>{pe.itemData[de]=le[de]}),this.hideNodes(le.geometriesToHide),this.showNodes(le.geometriesToShow),this.updatePricing(),this.resetInStock(),inventoryStore.getState().actions.refreshInventory(T)}})})})})}resetInStock(){this.#n={},this.#o=!0}setInStockForRef(e){if(!this.ref)return!1;let t=this.ref.getObjectByName("GRP_RenderGeometry");return t?(t.inStock=e,!0):!1}set inStock({variantName:e,newValue:t}){if(this.#n[e]&&this.#n[e]==t||(this.#n[e]=t,e!==this.#t&&this.#o===!1))return;const n=()=>{this.setInStockForRef(t)};n()||CORE_API.coreWCRef.addEventListener(this.guid+":modelLoaded",n,{once:!0})}get myDependenciesGUID(){return this.#u}set myDependenciesGUID(e){this.#u=e}get dragging(){return this._dragging}set dragging(e){this._dragging=e}addMyDependenciesGUID(e){this.#u.push(e)}get isDependent(){return this.#i}set isDependent(e){this.#i=e}get isInteractive(){return this.#s}set isInteractive(e){this.#s=e}update(e){this._skuID=e;const t=productDataStore$1.getState().productData,n=t[e]?.plugs;if(this.ignoreInCart=t[e].ignoreInCart,!!n)for(let s=0;s<this._plugs.length;s++)for(let o=0;o<n.length;o++)this._plugs[s].name==n[o].name&&(this._plugs[s].acceptedPlugTypes=n[o].acceptedPlugTypes,this._plugs[s].connectsToPlugTypes=n[o].connectsToPlugTypes)}export(){let e={};for(let t=0;t<this._plugs.length;t++){let n=this._plugs[t].export();n&&(e[this._plugs[t].name]=n)}return{skuID:this._skuID,guid:this._guid,isEndNode:this._isEndNode,plugs:e,overrideVariant:this._overrideVariant}}get node(){return this}get swappable(){return this._swappable}get replace(){return this._replace}get ignoreInCart(){return this.#r}set ignoreInCart(e){this.#r=e}get isTypeCombo(){const e=this.whichPlugAreWeAttachedUsing();return e.type=="comboPlug"&&e.connectsToPlugTypes.length>0}get canRotate(){let e=!0;if(this.isTypeCombo)return!1;if(!this._isEndNode){const n=this.whichNodesAreAttachedToUs();if(n.length>0){let s=!0;if(n.map(o=>{o.followsParent===!1&&(s=!1)}),!s)return!1}}let t=!1;for(let n=0;n<this.plugs.length;n++)if(!this.plugs[n].isOpen&&this.plugs[n].attachedPlug.isReceiverPlug){const s=this.plugs[n].attachedPlug.acceptedPlugTypes;for(let o=0;o<this.plugs.length;o++)if(n!=o)for(let v=0;v<this.plugs[o].connectsToPlugTypes.length;v++)s.includes(this.plugs[o].connectsToPlugTypes[v])&&(t=!0)}return e=t,e}hideNodes(e){if(!this.ref)return!1;const t=this.ref.getObjectByName("GRP_RenderGeometry"),n=this.ref.getObjectByName("GRP_ProxyMesh");return e.map(s=>{if(t){const o=t.getObjectByName(s);o&&(o.visible=!1)}if(n){const o=n.getObjectByName(s);o&&(o.visible=!1)}}),!0}showNodes(e){if(!this.ref)return!1;const t=this.ref.getObjectByName("GRP_RenderGeometry"),n=this.ref.getObjectByName("GRP_ProxyMesh");return e.map(s=>{if(t){const o=t.getObjectByName(s);o&&(o.visible=!0)}if(n){const o=n.getObjectByName(s);o&&(o.visible=!0)}}),!0}canConnectToPlugType(e){let t=!1;return this._plugs.map(n=>{n.connectsToPlugTypes.map(s=>{s==e&&(t=!0)})}),t}isConnectedToSkuID(e){let t=!1;return this._plugs.map(n=>{if(n.isOpen||t===!0)return;let s=n.attachedPlug;!s&&n.attachedPlugGUID&&(s=attachmentStore$1.getState().attachmentSystem.currentStructure.getPlugByGUID(n.attachedPlugGUID)),s.node.skuID==e&&(t=!0)}),t}get isConnectedToRoot(){return this.isConnectedToSkuID("Root")}swapRoot(){if(!this.canSwapRoot)return;const t=attachmentStore$1.getState().attachmentSystem.currentStructure,n=this.whichNodesAreAttachedToUs();let s=null;n.map(T=>{T.followsParent===!1&&(s=T)});const o=s.detachNodeFromReceiver();let v=null;this._plugs.map(T=>{T.isOpen||T.attachedPlug.node.skuID=="Root"&&(v=T.attachedPlug)});const A=this.detachNodeFromReceiver();let b=null;return s.plugs.map(T=>{T.connectsToPlugTypes.includes("root")&&(b=T)}),t.connectPlugs({incomingPlug:b,receiverPlug:v}),{neighbourDetachedPlugs:o,rootDetachedPlugs:A,neighbourNode:s}}get canSwapRoot(){if(coreSceneStore.getState().sceneSettings.swappableRoot===!1)return!1;let e=!1;if(this.isConnectedToRoot&&!this._isEndNode){const n=this.whichNodesAreAttachedToUs();let s=0,o=null;n.map(v=>{v.followsParent===!1&&(s++,o=v)}),s==1?o.canConnectToPlugType("root")&&(e=!0):s>0&&(e=!1)}return e}get canRemove(){let e=!0;return this._isEndNode||(this.whichNodesAreAttachedToUs().map(n=>{n.followsParent===!1&&(e=!1)}),e||(e=this.canSwapRoot)),e}getComboPlugNodesAttachedToUs(){let e=[];return this.whichNodesAreAttachedToUs().forEach(n=>{n.isTypeCombo&&e.push(n);const s=n.getComboPlugNodesAttachedToUs();s.length>0&&(e=e.concat(s))}),e}getAllBranchedNodesAttachedToUs(){let e=[];const t=this.whichNodesAreAttachedToUs();for(let n=0;n<t.length;n++){e.push(t[n]);const s=t[n].getAllBranchedNodesAttachedToUs();s.length>0&&(e=e.concat(s))}return e}get canDrag(){let e=!0;if(this.isTypeCombo)return!1;for(let n=0;n<this._plugs.length;n++)if(this._plugs[n].isOpen==!1&&this._plugs[n].attachedPlug.type=="comboPlug")return!1;const t=this.getComboPlugNodesAttachedToUs();if(t.length>0){const n=this.getAllBranchedNodesAttachedToUs();let s=!0;if(t.map(o=>{const v=o.whichNodesIsThisComboPlugAttachedTo();let A=!0;if(v.map(b=>{let T=!1;if(n.map(ee=>{b.guid===ee.guid&&(T=!0)}),T==!1){A=!1;return}}),A==!1){s=!1;return}}),s==!1)return!1}return this._isEndNode||(this.whichNodesAreAttachedToUs().map(s=>{s.followsParent===!1&&(e=!1)}),e||(e=this.canSwapRoot)),e}get followsParent(){return this._followsParent}set followsParent(e){this._followsParent=e}resetFollowsParent(){const e=productDataStore$1.getState().productData;this._followsParent=e[this.skuID].followsParent}get currentVariant(){return this.#t==="default"?productDataStore$1.getState().actions.getProductDataById(this._skuID).lookDetails.default.id:this.#t}get price(){return this._price}set price(e){this._price=e}updatePricing(){this._price=this.#a()}#a(){let t=productDataStore$1.getState().actions.getProductDataById(this._skuID).lookDetails[this.#t]?.price;return t||(t=0),t}set currentVariant(e){this.#t=e,this._price=this.#a()}get overrideVariant(){return this._overrideVariant}set overrideVariant(e){this._overrideVariant=e,this.#t=this._overrideVariant,this._price=this.#a()}get guid(){return this._guid}get skuID(){return this._skuID}set skuID(e){this._skuID=e}get plugs(){return this._plugs}get ref(){return this._ref}set ref(e){this._ref=e}get modelData(){return this._modelData}set modelData(e){this._modelData=e;let t=new CustomEvent(this._guid+":modelLoaded",{bubbles:!0,cancelable:!1,composed:!0});const n=attachmentStore$1.getState().attachmentSystem;n.globalGeometryVariants&&Object.keys(n.globalGeometryVariants).map(s=>{this.updateGeometryVariant(s,n.globalGeometryVariants[s])}),t.data={},CORE_API.coreWCRef?CORE_API.coreWCRef.dispatchEvent(t):LOGGER.warn({title:"core web component not found!"})}get isEndNode(){return this._isEndNode}set isEndNode(e){this._isEndNode=e}get categoryID(){return this._categoryID}get transform(){return this._transform}set transform(e){this._transform=e}setModelVisibility(e){e?this._ref?.scale.set(1,1,1):this._ref.scale.set(0,0,0)}checkIfEndNode(){let e=!0;for(let t=0;t<this._plugs.length;t++)this._plugs[t].isReceiverPlug&&(e=!1);this.isEndNode=e}whichNodesAreAttachedToUs(){const e=[];for(let t=0;t<this._plugs.length;t++)this._plugs[t].isReceiverPlug&&e.push(this._plugs[t].attachedPlug.node);return e}whichPlugsAreAttachedToUs(){const e=[];for(let t=0;t<this._plugs.length;t++)this._plugs[t].isReceiverPlug&&e.push({receiverPlug:this._plugs[t],incomingPlug:this._plugs[t].attachedPlug});return e}whichNodeAreWeAttachedTo(){let e=null;for(const t of this._plugs)t?.attachedPlug?.isReceiverPlug&&(e=t.attachedPlug.node);return e}whichNodesIsThisComboPlugAttachedTo(){if(!this.isTypeCombo)return[];let e=[];for(const t of this._plugs)t?.attachedPlug?.isReceiverPlug&&e.push(t.attachedPlug.node);return e}isReplaceableWithSkuId(e){const n=productDataStore$1.getState().productData[e]?.plugs;let s=0;if(!n)return!1;for(let o=0;o<this._plugs.length;o++)for(let v=0;v<n.length;v++)this._plugs[o].name==n[v].name&&s++;return s==this._plugs.length}whichPlugAreWeAttachedUsing(){for(let e=0;e<this._plugs.length;e++){const t=this._plugs[e];let n=t.attachedPlug;if(!n&&t.attachedPlugGUID&&(n=attachmentStore$1.getState().attachmentSystem.currentStructure.getPlugByGUID(t.attachedPlugGUID)),!t.isOpen&&n.isReceiverPlug)return t}}whichPlugAreWeAttachedTo(){for(let e=0;e<this._plugs.length;e++)if(!this._plugs[e].isOpen&&this._plugs[e].attachedPlug.isReceiverPlug)return this._plugs[e].attachedPlug}getPlugWhichCanConnectToType(e){for(const t of this._plugs)if(t.connectsToPlugTypes.includes(e))return t;return null}getOpenPlugsWeCanAttachFrom(){let e=[];if(this.whichNodeAreWeAttachedTo())return e;for(let t=0;t<this._plugs.length;t++)this.plugs[t].isOpen&&this.plugs[t].connectsToPlugTypes.length>0&&e.push(this._plugs[t]);return e}getOpenPlugsFromNode(){let e=[];for(let t=0;t<this._plugs.length;t++)this._plugs[t].isOpen&&this._plugs[t].acceptedPlugTypes.length>0&&e.push(this._plugs[t]);return e}generatePlugsForNode(e){this._plugs=[];let t=productDataStore$1.getState().productData[e]?.plugs;if(t)for(let n=0;n<t.length;n++)if(t[n].type==="unvisualizedPlug"){const s=t[n]?.unvisualizedCount>=0?t[n].unvisualizedCount:1e3;for(let o=0;o<s;o++){const v=new Plug({...t[n],name:`${t[n].name}_${o}`},this);this._plugs.push(v)}}else{const s=new Plug(t[n],this);this._plugs.push(s)}}generatePlugsWithData(e,t){const n=productDataStore$1.getState().productData[e]?.plugs;n&&n.forEach(s=>{if(s.type==="unvisualizedPlug"){const o=s.unvisualizedCount&&s.unvisualizedCount>=0?s.unvisualizedCount:1e3;for(let v=0;v<o;v++){const A=new Plug({...s,name:`${s.name}_${v}`},this,t[`${s.name}_${v}`]);this._plugs.push(A)}}else{const o=new Plug(s,this,t[s.name]);this._plugs.push(o)}})}detachNodeFromReceiver(){for(let e=0;e<this.plugs.length;e++)if(!this.plugs[e].isOpen&&this.plugs[e].attachedPlug.isReceiverPlug){const t={incomingPlug:this.plugs[e],receiverPlug:this.plugs[e].attachedPlug};return this.plugs[e].attachedPlug.openPlug(),this.plugs[e].openPlug(),t}}detachNodeCompletely(){for(let e=0;e<this._plugs.length;e++)this._plugs[e].isOpen||(this._plugs[e].attachedPlug.openPlug(),this._plugs[e].openPlug())}getPlugByName(e){for(let t=0;t<this._plugs.length;t++)if(this._plugs[t].name==e)return this._plugs[t];return null}getPlugByGUID(e){for(let t=0;t<this._plugs.length;t++)if(this._plugs[t].guid==e)return this._plugs[t];return null}async removeNode(){const e=[];for(const t of this._plugs)if(!t.isOpen){if(t.type==="comboPlug"&&t.connectsToPlugTypes.length>0){t.attachedPlug.openPlug();continue}t.attachedPlug.isReceiverPlug?t.attachedPlug.openPlug():e.push(t.attachedPlug.node.guid)}if(e.length>0)for(const t of e)itemStore.getState().actions.addToRemoveItems(t)}};const EPIGRAPH_CONFIGURATOR_CATEGORY="Epigraph - Configurator",CONFIGURATOR_LOADING={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorLoading",label:"",interaction:{nonInteraction:!0}},CONFIGURATOR_READY={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorReady",label:"",interaction:{nonInteraction:!0}},CONFIGURATOR_FAILED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorFailed",label:"",interaction:{nonInteraction:!0}},CONFIGURATOR_REVIEW_CART_SHOWN={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorReviewCartShown",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_REVIEW_CART_HIDE={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorReviewCartHide",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_CHECKOUT={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorCheckout",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_CHECKOUT_ITEM={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorCheckoutItemDetails",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_GLOBAL_GEOMETRY_VARIANT_SWITCHED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorGlobalGeometryVariantSwitched",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_GLOBAL_VARIANT_SWITCHED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorGlobalVariantSwitched",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_LOCAL_VARIANT_SWITCHED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorLocalVariantSwitched",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_LOAD_FROM_PRECONFIG={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorLoadFromPreConfiguration",label:"",interaction:{nonInteraction:!0}},CONFIGURATOR_PRECONFIGURATION_ITEM_ADDED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"preconfigurationItemAdded",label:"",interaction:{nonInteraction:!0}},CONFIGURATOR_SCENE_RESTARTED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorSceneRestarted",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_AR_REQUESTED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorArRequested",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_ITEM_REMOVED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorItemRemoved",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_ITEM_ADDED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorItemAdded",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_INSTRUCTIONS_BTN_CLICKED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorInstructionsBtnClicked",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_INSTRUCTIONS_COMPLETION_RATE={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorInstructionsStageCompletionRate",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_INSTRUCTIONS_SHOWN={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorInstructionsShow",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_DIMENSION_SHOWN={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorDimensionsBtnShow",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_DIMENSION_HIDE={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorDimensionsBtnHide",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_HOTSPOT_ENTER={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorHotspotEnter",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_HOTSPOT_EXIT={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorHotspotExit",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_SCENE_SHARED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorSceneShared",label:"",interaction:{nonInteraction:!1}};class Structure{#t=!1;constructor(e=null,t,n){if(this._nodes=[],this._rootNode=null,LOGGER.info({title:"preloadNodes",details:e}),this.setupHookOnSceneItemsUpdated(),e){LOGGER.info({title:"PRELOAD Length-----------------:"+e.length});for(var s=0;s<e.length;s++){LOGGER.info({title:"FOUND PRELOAD-----------------"});const o=e[s].skuID;if(o.toLowerCase()=="root"){const A=itemStore.getState().itemsSpawned;Object.keys(A).length>0&&(e[s].guid=Object.keys(A)[0])}let v=new Node$1(o,e[s],t,n);o.toLowerCase()=="root"&&(this._rootNode=v),this._nodes.push(v)}}else{const o=new Node$1("Root",null,t,n);this._rootNode=o,this._nodes.push(o),itemStore.getState().actions.addItemWithTransform({position:new Vector3(0,0,0),rotation:new Quaternion().identity()},"Root",this._rootNode.guid,!1)}this._boundingBoxLeeway=coreSceneStore.getState().sceneSettings.boundingBoxLeeway}async setupHookOnSceneItemsUpdated(){CORE_API.coreWCRef.addEventListener(CORE_API.EVENTS.SCENE.FittingSkuIds_Updated,()=>{DynamicHooks.hookOnSceneItemsUpdated(this._nodes,CORE_API)})}get nodes(){return this._nodes}get rootNode(){return this._rootNode}updatePricing(){for(let e=0;e<this._nodes.length;e++)this._nodes[e].updatePricing()}getCurrentItemsInReplaceableCategory(){let e={};for(const t of this._nodes)t.replace&&(e[t.categoryID]=t.skuID);return e}recalculateStructureFromNode(e){for(let t=0;t<e.plugs.length;t++)if(!e.plugs[t].isOpen&&e.plugs[t].isReceiverPlug){const n=e.plugs[t].attachedPlug.node,s={receiverPlug:e.plugs[t],incomingPlug:e.plugs[t].attachedPlug};if(s){const o=this.findItemTransform(s);o&&(n.ref.position.set(o.position.x,o.position.y,o.position.z),o.rotation.isQuaternion===!0?n.ref.setRotationFromQuaternion(o.rotation):o.rotation.isEuler===!0&&n.ref.setRotationFromEuler(o.rotation),n.transform={position:o.position,rotation:o.rotation})}this.recalculateStructureFromNode(n)}}rotateNode(e){const t=this.getNodeByGUID(e);let n=null,s=null;for(let A=0;A<t.plugs.length;A++)if(!s&&!t.plugs[A].isOpen&&t.plugs[A].attachedPlug.isReceiverPlug){const b=t.plugs[A].attachedPlug.acceptedPlugTypes;s=t.plugs[A].attachedPlug;let T=[];for(let ee=A+1;ee<t.plugs.length;ee++)T.push(t.plugs[ee]);for(let ee=0;ee<A;ee++)T.push(t.plugs[ee]);for(let ee=0;ee<T.length;ee++)for(let ne=0;ne<T[ee].connectsToPlugTypes.length;ne++)b.includes(T[ee].connectsToPlugTypes[ne])&&(n=T[ee])}if(!n)return;t.detachNodeFromReceiver();const{position:o,rotation:v}=this.findItemTransform({receiverPlug:s,incomingPlug:n});t.ref.position.set(o.x,o.y,o.z),v.isQuaternion===!0?t.ref.setRotationFromQuaternion(v):v.isEuler===!0&&t.ref.setRotationFromEuler(v),t.transform={position:t.ref.position,rotation:v},this.connectPlugs({receiverPlug:s,incomingPlug:n}),this.recalculateStructureFromNode(t)}async load(e){this.resolvePlugConnections(e),await this.respawnItems()}materialOverrideExists(){let e=!1;return this.nodes.map(t=>{if(t.overrideVariant)return e=!0,!0}),e}findGhostTransformForReplacement(e,t){let n=[],s=[],o=[];for(const v of t){if(v.skuID==e)continue;const A=attachmentStore$1.getState().attachmentSystem,b=v.whichPlugAreWeAttachedTo(),T=v.whichPlugAreWeAttachedUsing(),ne=new Node$1(e,null,A.globalVariants,A.globalGeometryVariants).getPlugByName(T.name);if(!ne)continue;const re={incomingPlug:ne,receiverPlug:b},{position:se,rotation:le}=this.findItemTransform(re);se&&le&&(s.push({position:se,rotation:le,incomingPlugName:re.incomingPlug.name,receiverPlugName:re.receiverPlug.name,incomingPlugGUID:re.incomingPlug.guid,receiverPlugGUID:re.receiverPlug.guid}),o.push(re),n.push(v))}return{transforms:s,connectablePlugs:o,newNodes:n}}async findGhostTransforms(e,t){const n=this.getOpenPlugs(),s=coreSceneStore.getState().sceneSettings.comboPlugDistanceThreshold;if(n.length<=0)return{transforms:[]};const o=attachmentStore$1.getState().attachmentSystem,v=productDataStore$1.getState().productData,A=new Node$1(e,null,o.globalVariants,o.globalGeometryVariants),b=this.getConnectablePlugs(A,n);let T=[];if(b.length<=0)return{transforms:[]};let ee=[],ne=[];const re=assetStore.getState().assets.items[e].proxy.data.scene;if(!re)return!1;let se=re.clone();for(let de=0;de<b.length;de++){let fe=t,{incomingPlug:me,receiverPlug:ve}=b[de],_e=this.findItemTransform(b[de]);if(!_e)continue;let{position:De,rotation:Le}=_e;if(!De||!Le)continue;se.position.set(De.x,De.y,De.z),Le.isQuaternion===!0?se.setRotationFromQuaternion(Le):Le.isEuler===!0&&se.setRotationFromEuler(Le);let ke=[],We=[];if(me.type=="comboPlug"){if(me.connectsToPlugTypes.length<=0)continue;const bt=me.connectsToPlugTypes[0];let Ze=!1;if(ne.map(Dr=>{Ze===!0||Dr.length<=0||Dr.map(zn=>{Ze===!0||zn.incomingPlug.guid!==me.guid||zn.incomingPlug.connectsToPlugTypes.includes(bt)&&(Ze=!0)})}),Ze===!0)continue;const hr=me.node.plugs;let cr=!0;if(hr.map(Dr=>{if(Dr.type!=="comboPlug"||Dr.guid===me.guid||!Dr.connectsToPlugTypes.includes(bt))return;let zn=!1;if(n.map(ar=>{if(ve.guid===ar.guid||!ar.acceptedPlugTypes.includes(bt)||!ar.node.ref)return;let zr=new Vector3(0,0,0);const Pn=ar.node.ref.getObjectByName(""+ar.name);if(!Pn)return;Pn.getWorldPosition(zr);let si=new Vector3(0,0,0);const ea=se.getObjectByName(""+Dr.name);if(!ea)return;ea.getWorldPosition(si);const es=zr.distanceTo(si);Math.abs(es)<s&&(ke.push(ve.node.guid),ke.push(ar.node.guid),We.push({receiverPlug:ar,incomingPlug:Dr}),zn=!0)}),zn==!1){cr=!1;return}}),!cr)continue}let Ue=fe;Array.isArray(fe)===!0&&(Ue=!1),ke.length>0&&(Ue=!1,Array.isArray(fe)===!0?ke.map(bt=>{fe.push(bt)}):fe=ke),v[e].hasOwnProperty("ignoreSpawningCollision")&&(Ue=v[e].ignoreSpawningCollision),b[de].receiverPlug.type=="unvisualizedPlug"&&(Ue=!0),(Ue?!1:this.isColliding(A.skuID,_e,b[de].receiverPlug,fe))||(ee.push({position:De,rotation:Le,incomingPlugName:b[de].incomingPlug.name,receiverPlugName:b[de].receiverPlug.name,incomingPlugGUID:b[de].incomingPlug.guid,receiverPlugGUID:b[de].receiverPlug.guid}),T.push(b[de]),ne.push(We))}let le=[];for(let de=0;de<ee.length;de++)le.push(A);let pe={transforms:ee,newNodes:le,connectablePlugs:T,comboPlugs:ne};return pe=await DynamicHooks.hookOnNewItemGhostsCollected(pe,CORE_API),pe}resolvePlugConnections(e){for(let t=0;t<e.length;t++)Object.keys(e[t].plugs).map(n=>{let s=e[t].plugs[n].guid,o=this.getPlugInNodesByGUID(s);if(!o||o.attachedPlug)return;let v=e[t].plugs[n].attachedPlugGUID,A=this.getPlugInNodesByGUID(v);A&&(A.attachedPlug||(o.attachPlug(A,e[t].plugs[n].isReceiverPlug),A.attachPlug(o,!e[t].plugs[n].isReceiverPlug)))});LOGGER.info({title:"RESOLVED PLUG CONNECTION: ",details:this})}async respawnItems(){let e=[this.rootNode];for(let o=0;o<e.length;o++){let A=e[o].whichPlugsAreAttachedToUs();for(let b=0;b<A.length;b++){if(A[b].incomingPlug.type=="comboPlug"&&A[b].incomingPlug.connectsToPlugTypes.length>0&&!A[b].incomingPlug.comboPlugConnector)continue;let T=this.findItemTransformForPreload(A[b],A[b].receiverPlug.node.transform);T?await itemStore.getState().actions.addItemWithTransform(T,A[b].incomingPlug.node.skuID,A[b].incomingPlug.node.guid):LOGGER.warn({title:"Problem finding plug transform! "+A[b].name}),A[b].incomingPlug.node.transform=T,e.push(A[b].incomingPlug.node)}}const t=await CORE_API.getCartItemsAsync();CORE_API.fireEvent(CORE_API.EVENTS.SCENE.SavedConfiguration_Loaded,{...t}),coreSceneStore.getState().actions.triggerAutoFocus(),hotspotStore$1.getState().actions.checkHotspotHealth();const n=coreSceneStore.getState().preconfigurationLoaded==!1&&coreSceneStore.getState().sceneHasDefaultConfigurationID==!1,s=coreSceneStore.getState().configurationLoaded==!1&&coreSceneStore.getState().preconfigurationLoaded==!0&&coreSceneStore.getState().configurationLoadedOnRestart==!0;if(n||s){let o=Object.assign({},CONFIGURATOR_LOAD_FROM_PRECONFIG);o.parameters={project_id:`${CORE_API.projectId}`,...t},CORE_API.sendAnalyticsEvent(o)}}getPlugInNodesByGUID(e){for(let t=0;t<this._nodes.length;t++){let n=this._nodes[t].getPlugByGUID(e);if(n)return n}return null}export(){let e=[];for(let t=0;t<this._nodes.length;t++){let n=this._nodes[t].export();n&&e.push(n)}return e}async clear(){return new Promise(async(e,t)=>{!this._rootNode&&this._rootNode.isEndNode&&e(!0);let n=null;const s=this._rootNode.whichNodesAreAttachedToUs();s.length>0&&(n=s[0]),this.#t=!0,CORE_API.coreWCRef.addEventListener(CORE_API.EVENTS.SCENE.Scene_Cleared,o=>e(o.data),{once:!0}),n?CORE_API.removeItemByGUID(n.guid,!0):(await wait(500),e(!0))})}getNodeByGUID(e){for(let t=0;t<this._nodes.length;t++)if(this._nodes[t].guid==e)return this._nodes[t];return null}getPlugByGUID(e){for(const t of this._nodes){const n=t.getPlugByGUID(e);if(n)return n}return null}findItemTransformForPreload(e,t){let{receiverPlug:n,incomingPlug:s}=e,o=n,v=s;if(o.node.skuID=="Root")return this.findItemTransformRoot(e);let A=null,b=null,T=new Object3D,ee=assetStore.getState().assets.items[o.node.skuID].proxy.data.scene.clone();T.add(ee);let{position:ne,rotation:re}=t;if(ee.position.set(ne.x,ne.y,ne.z),re.isQuaternion===!0?ee.setRotationFromQuaternion(re):re.isEuler===!0&&ee.setRotationFromEuler(re),b=ee,!b||(A=b.getObjectByName(o.name),!A))return;let se=new Vector3(0,0,0);A.getWorldPosition(se);let le=new Quaternion().identity();A.getWorldQuaternion(le);let pe=new Object3D;A.add(pe);let de=assetStore.getState().assets.items[v.node.skuID].proxy.data.scene.clone();de.position.set(se.x,se.y,se.z),de.applyQuaternion(le);let fe=new Vector3;fe.copy(ee.up).applyQuaternion(b.quaternion);let me=new Vector3;me.copy(de.up).applyQuaternion(le),me.negate();let ve=new Quaternion().setFromUnitVectors(fe,me);fe.round(),me.round();let _e=fe.dot(me);_e!==1&&_e!==-1&&de.applyQuaternion(ve);let De=de.getObjectByName(v.name),Le=new Quaternion().identity();De.getWorldQuaternion(Le);let ke=new Vector3(0,1,0);ke.applyQuaternion(Le);let We=new Vector3(0,1,0);We.applyQuaternion(le),We.negate();let Ue=new Quaternion().setFromUnitVectors(ke,We);if(ke.round(),We.round(),ke.dot(We)!==-1)de.applyQuaternion(Ue);else{let hr=new Vector3(0,1,0),cr=We.dot(hr);if(cr!==1&&cr!==-1)de.rotateOnAxis(hr,Math.PI);else{let Dr=new Vector3(0,0,1),zn=We.dot(Dr);if(zn!==1&&zn!==-1)de.rotateOnAxis(Dr,Math.PI);else{let ar=new Vector3(1,0,0),zr=We.dot(ar);zr!==1&&zr!==-1&&de.rotateOnAxis(ar,Math.PI)}}}let sn=de.getObjectByName(v.name),bt=new Vector3(sn.position.x,sn.position.y,sn.position.z);de.translateX(-bt.x),de.translateY(-bt.y),de.translateZ(-bt.z);let Ze=new Vector3(0,0,0);de.getWorldPosition(Ze);let yn=new Quaternion().identity();return de.getWorldQuaternion(yn),de=null,{position:Ze,rotation:yn}}findItemTransformRoot(e){let{receiverPlug:t,incomingPlug:n}=e,s=n;const o=new Object3D;let v=o,A=new Vector3(0,0,0);v.getWorldPosition(A);let b=new Quaternion().identity(),T=new Object3D;T.position.set(0,0,0),o.add(T);let ee=assetStore.getState().assets.items[s.node.skuID].proxy.data.scene.clone();T.attach(ee),ee.translateX(A.x),ee.translateY(A.y),ee.translateZ(A.z);let ne=ee.getObjectByName(s.name),re=new Quaternion().identity();ne&&ne.getWorldQuaternion(re);const se=new Vector3(0,1,0);se.applyQuaternion(re);const le=new Vector3(0,1,0);le.applyQuaternion(b);const pe=le.angleTo(se),de=new Vector3(0,0,0);de.crossVectors(le,se),de.round(),de.length()!==0&&ee.rotateOnAxis(de,pe);var fe=new Matrix4().extractRotation(ee.matrixWorld);let me=new Vector3(0,0,0);ne&&me.set(ne.position.x,ne.position.y,ne.position.z),me.applyMatrix4(fe),ee.translateX(-me.x),ee.translateY(-me.y),ee.translateZ(-me.z);let ve=new Vector3(0,0,0);ee.getWorldPosition(ve);let _e=new Quaternion().identity();return ee.getWorldQuaternion(_e),T.remove(ee),T=null,ee=null,{position:ve,rotation:_e}}findItemTransform(e){let{receiverPlug:t,incomingPlug:n}=e,s=t,o=n;if(s.node.isRoot)return this.findItemTransformRoot(e);const v=s.node.transform;if(!v)return;const A=assetStore.getState().assets.items[s.node.skuID].proxy.data.scene.clone(),b=new Object3D;b.position.set(v.position.x,v.position.y,v.position.z),v.rotation.isQuaternion===!0?b.setRotationFromQuaternion(v.rotation):v.rotation.isEuler===!0&&b.setRotationFromEuler(v.rotation),b.add(A);let T=b.getObjectByName(""+s.name);if(!T){LOGGER.error({title:"Plug: "+s.name+" doesn't exist in "+s.node.skuID});return}let ee=new Vector3(0,1,0);T.getWorldPosition(ee);let ne=new Quaternion().identity();T.getWorldQuaternion(ne);let re=assetStore.getState().assets.items[o.node.skuID].proxy.data.scene.clone();re.position.set(ee.x,ee.y,ee.z),re.applyQuaternion(ne);let se=new Vector3;se.copy(A.up).applyQuaternion(b.quaternion);let le=new Vector3;le.copy(re.up).applyQuaternion(ne),le.negate();let pe=new Quaternion().setFromUnitVectors(se,le);se.round(),le.round();let de=se.dot(le);de!==1&&de!==-1&&re.applyQuaternion(pe);let fe=re.getObjectByName(o.name);if(!fe){LOGGER.error({title:"Plug: "+o.name+" doesn't exist in "+o.node.skuID});return}let me=new Quaternion().identity();fe.getWorldQuaternion(me);let ve=new Vector3(0,1,0);ve.applyQuaternion(me);let _e=new Vector3(0,1,0);_e.applyQuaternion(ne),_e.negate();let De=new Quaternion().setFromUnitVectors(ve,_e);if(ve.round(),_e.round(),ve.dot(_e)!==-1)re.applyQuaternion(De);else{let sn=new Vector3(0,1,0),bt=_e.dot(sn);if(bt!==1&&bt!==-1)re.rotateOnAxis(sn,Math.PI);else{let Ze=new Vector3(0,0,1),yn=_e.dot(Ze);if(yn!==1&&yn!==-1)re.rotateOnAxis(Ze,Math.PI);else{let hr=new Vector3(1,0,0),cr=_e.dot(hr);cr!==1&&cr!==-1&&re.rotateOnAxis(hr,Math.PI)}}}let ke=re.getObjectByName(o.name),We=new Vector3(ke.position.x,ke.position.y,ke.position.z);re.translateX(-We.x),re.translateY(-We.y),re.translateZ(-We.z);let Ue=new Vector3(0,0,0);re.getWorldPosition(Ue);let Ge=new Quaternion().identity();return re.getWorldQuaternion(Ge),b.remove(A),re=null,{position:Ue,rotation:Ge}}getSpawningRequirementForSkuID(e){let t=[];const n=productDataStore$1.getState().productData,s=n[e];if(!s)return t;const o=[];return s.plugs.map(v=>{v.connectsToPlugTypes.map(A=>{o.push(A)})}),Object.keys(n).map(v=>{for(let A=0;A<n[v].plugs.length;A++){const b=n[v].plugs[A].acceptedPlugTypes;for(let T=0;T<b.length;T++)o.map(ee=>{ee==b[T]&&!t.includes(v)&&t.push(v)})}}),t}getConnectablePlugs(e,t){let n=[],s=e.getOpenPlugsWeCanAttachFrom();for(let o=0;o<s.length;o++)for(let v=0;v<t.length;v++){let A=!1;for(let T=0;T<n.length;T++)if(n[T].receiverPlug.guid==t[v].guid&&n[T].incomingPlug.type!="comboPlug"){A=!0;break}if(A)continue;s[o].canAttachToPlug(t[v])&&n.push({incomingPlug:s[o],receiverPlug:t[v]})}return n}getOpenPlugs(){let e=[];return this._nodes.map(t=>{if(t.dragging===!0)return;let n=t.getOpenPlugsFromNode();e=e.concat(n)}),e}checkCollisionforGUID(e,t=[]){if(coreSceneStore.getState().sceneSettings.disableCollider)return!1;const n=itemStore.getState().itemsSpawned,s=productDataStore$1.getState().productData;if(!n[e])return!1;const v=this.getNodeByGUID(e);if(!v||!v.ref||s[v.skuID].disableCollider)return!1;let A=new Vector3;v.ref.getWorldPosition(A);let b=new Quaternion;v.ref.getWorldQuaternion(b);const T={position:A,rotation:b},ee=v.whichPlugAreWeAttachedTo();return ee==null?!1:this.isColliding(v.skuID,T,ee,t)}isColliding(e,{position:t,rotation:n},s,o=[]){const v=assetStore.getState().assets.items[e].proxy.data.scene,A=productDataStore$1.getState().productData;if(!v)return!1;let b=v.clone();b.position.set(t.x,t.y,t.z),n.isQuaternion===!0?b.setRotationFromQuaternion(n):n.isEuler===!0&&b.setRotationFromEuler(n);let T=new Box3().setFromObject(b);var ee=new Vector3;T.getCenter(ee);let ne=new Object3D;ne.position.set(ee.x,ee.y,ee.z),ne.attach(b),ne.scale.set(this._boundingBoxLeeway,this._boundingBoxLeeway,this._boundingBoxLeeway),T=new Box3().setFromObject(ne);const re=[];if(this._nodes.forEach(le=>{if(s.node.guid==le.guid||Array.isArray(o)===!0&&o.includes(le.guid)||!le.ref||(A[le.skuID].hasOwnProperty("disableCollider")?A[le.skuID].disableCollider:coreSceneStore.getState().sceneSettings.disableCollider))return;const pe=le.ref.getObjectByName("GRP_ProxyMesh");pe&&re.push(pe)}),re.length<=0)return!1;let se=!1;return re.forEach(le=>{if(se)return;let pe=new Box3().setFromObject(le);if(T.intersectsBox(pe)){se=!0;return}}),ne.clear(),b=null,ne=null,T=null,se}boxOverlapPercent(e,t){if(e.containsBox(t)||t.containsBox(e))return 100;if(!(e.min.x<t.max.x||t.min.x<e.max.x))return 0;let n=new Vector3(0,0,0);e.getSize(n),n.x*n.y*n.z;let s=new Vector3(0,0,0);t.getSize(s),s.x*s.y*s.z}checkInsideOutCollision(e,t,n){let s=t.position.clone(),o=new Float32Array(n.attributes.position.array),v=o.length/3;for(let A=0;A<v;A++){let b=new Vector3(o[A*3],o[A*3+1],o[A*3+2]),T=b.add(t.position);T=b.applyQuaternion(t.quaternion);let ee=T.sub(t.position);const re=new Raycaster(s,ee.clone().normalize()).intersectObjects(e),se=re.length>0,le=re[0].distance<ee.length();if(se&&le)return!0}return!1}addNode(e){this._nodes.push(e)}getFirstNodeByCategoryID(e){for(var t=0;t<this._nodes.length;t++)if(this._nodes[t]._categoryID==e)return this._nodes[t];return null}getNodesBySKUID(e){let t=[];for(var n=0;n<this._nodes.length;n++)this._nodes[n].skuID==e&&t.push(this._nodes[n]);return t}getNodesByCategoryID(e){let t=[];for(var n=0;n<this._nodes.length;n++)this._nodes[n]._categoryID==e&&t.push(this._nodes[n]);return t}async connectPlugs({incomingPlug:e,receiverPlug:t}){e.attachPlug(t,!1),t.attachPlug(e,!0),await attachmentStore$1.getState().actions.toggleStructureUpdated()}removeNodeByGUID(e){for(let t=0;t<this._nodes.length;t++)if(this._nodes[t].guid==e){this._nodes[t].removeNode(),this._nodes.splice(t,1);break}this._nodes.length==1&&this.#t&&CORE_API.fireEvent(CORE_API.EVENTS.SCENE.Scene_Cleared,!0),attachmentStore$1.getState().actions.updateFittingSkuIds(),attachmentStore$1.getState().actions.toggleStructureUpdated()}async removeNodeFromStructure(e){for(let t=0;t<this._nodes.length;t++)if(this._nodes[t].guid==e.guid){this._nodes.splice(t,1);break}await attachmentStore$1.getState().actions.toggleStructureUpdated()}}class AttachmentSystem{constructor(){this._globalVariants={},this._globalGeometryVariants={},productDataStore$1.getState().categoryData.geometryVariants.map(e=>{this._globalGeometryVariants[e.id]=e.defaultVariant}),productDataStore$1.getState().categoryData.color.map(e=>{this._globalVariants[e.id]=e.defaultLook}),this._currentStructure=new Structure(null,this._globalVariants,this._globalGeometryVariants);for(const[e,t]of Object.entries(this._globalVariants))this.switchGlobalVariant(e,t);for(const[e,t]of Object.entries(this._globalGeometryVariants))this.switchGlobalGeometryVariant(e,t)}get globalGeometryVariants(){return this._globalGeometryVariants}get globalVariants(){return this._globalVariants}get currentStructure(){return this._currentStructure}getClientProductId(e,t){let n;return n=productDataStore$1.getState()?.productData[e]?.lookDetails[t],n?.clientProductId?n?.clientProductId:""}getCartItems(){let e=[];const t=inventoryStore.getState().inventoryData;this.currentStructure.nodes.map(o=>{if(o.skuID=="Root"||o.ignoreInCart===!0)return;let v=!1;if(e.map(T=>{const ee=t[T.skuID];if(T.skuID==o.skuID&&T.currentVariant==o.currentVariant){T.count++,T.countAvailable=ee[o.currentVariant].countAvailable,T.countUnavailable=ee[o.currentVariant].countUnavailable,T.price=o.price*T.count,v=!0;return}}),v===!0)return;let A={};A.skuID=o.skuID,A.currentVariant=o.currentVariant,A.clientProductId=this.getClientProductId(A.skuID,A.currentVariant),A.count=1;const b=t[A.skuID];A.price=o.price,A.countAvailable=b[o.currentVariant].countAvailable,A.countUnavailable=b[o.currentVariant].countUnavailable,e.push(A)});let n=0;for(const o of e)n=n+o.price;return{cartItems:e,details:{total:n.toFixed(2)}}}async getCartItemsAsync(){let e=[];const t=inventoryStore.getState().inventoryData;this.currentStructure.nodes.map(o=>{if(o.skuID=="Root"||o.ignoreInCart===!0)return;let v=!1;if(e.map(T=>{const ee=t[T.skuID];if(T.skuID==o.skuID&&T.currentVariant==o.currentVariant){T.count++,T.countAvailable=ee[o.currentVariant].countAvailable,T.countUnavailable=ee[o.currentVariant].countUnavailable,T.price=o.price*T.count,v=!0;return}}),v===!0)return;let A={};A.skuID=o.skuID,A.currentVariant=o.currentVariant,A.clientProductId=this.getClientProductId(A.skuID,A.currentVariant),A.count=1;const b=t[A.skuID];A.price=o.price,A.countAvailable=b[o.currentVariant].countAvailable,A.countUnavailable=b[o.currentVariant].countUnavailable,e.push(A)}),e=await DynamicHooks.hookOnCartItemsCollected(e,CORE_API);let n=0;for(const o of e)n=n+o.price;return{cartItems:e,details:{total:n.toFixed(2)}}}async getFittingSKUIDs(){const e=productDataStore$1.getState().productData;if(!this.currentStructure)return;const t=coreSceneStore.getState().sceneSettings.draggableUI;let n=this.currentStructure.nodes,s=[],o=[],v=[],A=[];if(n.map(T=>{A.push(T.skuID),T.plugs.map(ee=>{if(!ee.isOpen){ee.attachedPlug.node.replace&&ee.acceptedPlugTypes.map(ne=>{o.includes(ne)||o.push(ne)});return}ee.acceptedPlugTypes.map(ne=>{s.includes(ne)||s.push(ne)})})}),s.length<=0&&o.length<=0)return[];Object.keys(e).map(T=>{!e[T].plugs||v.includes(T)||e[T].plugs.map(ee=>{v.includes(T)||ee.connectsToPlugTypes.map(ne=>{if(!v.includes(T)){if(o.includes(ne)){if(!A.includes(T)||t){let re=this.currentStructure.getNodesByCategoryID(e[T].categoryID);for(const se of re){if(v.includes(T)||se.skuID==T)continue;let le=!0,pe=!1;se?.plugs.map(de=>{!de.isOpen&&de.isReceiverPlug&&(pe=!0,le=!1,e[T].plugs.map(fe=>{fe.name==de.name&&de.attachedPlug.connectsToPlugTypes.map(me=>{fe.acceptedPlugTypes.includes(me)&&(le=!0)})}))}),(le||!pe)&&v.push(T)}}}else if(s.includes(ne)){const re=this.currentStructure.getFirstNodeByCategoryID(e[T].categoryID);if(re&&re.replace)return;v.push(T)}}})})});let b=[];for(const T of v){if(b.includes(T))continue;if(e[T].replace){b.push(T);continue}const{transforms:ee,newNodes:ne,connectablePlugs:re}=await this.currentStructure.findGhostTransforms(T,coreSceneStore.getState().sceneSettings.ignoreSpawningCollision);ee.length>0&&b.push(T)}for(const T of b)e[T].replace;return b}async removeAllVariantOverrides(){let e=this._currentStructure.nodes,t=productDataStore$1.getState().productData,n=itemStore.getState().itemsSpawned;await e.map(async s=>{if(!s.overrideVariant||(s.overrideVariant=null,!t[s.skuID].looks))return;let o=null;Object.keys(this._globalVariants).map(v=>{t[s.skuID].looks.includes(this._globalVariants[v])&&o==null&&(o=this._globalVariants[v])}),o&&await itemStore.getState().actions.switchToVariant(n[s.guid].itemData,o)}),CORE_API.alert({alertMsg:"Changes to individual items in the scene have been cleared",alertTime:6e3,alertType:"info",alertLabel:"Overrides Removed",alertId:"overridesRemoved"}),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.MaterialOverrides_Exists,!1)}async switchGlobalGeometryVariant(e,t){const s=productDataStore$1.getState().categoryData.geometryVariants;let o=null;if(s.map(re=>{re.id==e&&(o=re)}),!o)return;const v=o.productsInCategory,b=o.variants[t].productsToSwitch,T=itemStore.getState().itemsSpawned;let ee=productDataStore$1.getState().categoryData;b.map(re=>{v.map(se=>{let le=!1;se.products.map(pe=>{re==pe&&(le=!0)}),le&&ee.build.map(pe=>{se.products.map(de=>{pe.skus.map((fe,me)=>{pe.skus[me]==de&&(pe.skus[me]=re)})})})})}),this._currentStructure.nodes.map(re=>{v.map(se=>{se.products.map(le=>{re.skuID==le&&re.ref!==null&&se.products.map(pe=>{b.map(de=>{if(de==pe){const fe=productDataStore$1.getState().actions.getProductDataById(de);let me=fe.geometriesToHide;re.plugs.map(_e=>{!_e.isOpen&&_e.attachedPlug&&_e.type=="weighted_hider"&&_e.attachedPlug.weight>_e.weight&&(me=me.concat(_e.affectedNodes))}),re.showNodes(fe.geometriesToShow),re.hideNodes(me),re.skuID=de;const ve=T[re.guid];ve&&ve.itemData&&Object.keys(fe).map(_e=>{ve.itemData[_e]=fe[_e]}),re.resetInStock(),re.updatePricing()}})})})})}),this._globalGeometryVariants[e]=t,hotspotStore$1.getState().actions.checkHotspotHealth(),inventoryStore.getState().actions.refreshInventory(T),productDataStore$1.setState({categoryData:ee}),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.CategoryData_Updated,ee),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.GlobalGeometryVariant_Updated,this._globalGeometryVariants);const ne=await this.getCartItemsAsync();ne&&CORE_API.fireEvent(CORE_API.EVENTS.SCENE.CartItems_Updated,ne)}async switchGlobalVariant(e,t){this._globalVariants[e]=t;const n=itemStore.getState().actions;let s=itemStore.getState().itemsSpawned;for(let b=0;b<Object.keys(s).length;b++){let T=s[Object.keys(s)[b]];if(T.itemData.looks&&T.itemData.looks.includes(t)){let ee=this._currentStructure.getNodeByGUID(T.itemData.guid);ee&&!ee.overrideVariant&&await n.switchToVariant(T.itemData,t)}}const o=productDataStore$1.getState().lookData;lightStore.getState().actions.processLookEnvMapOverride(t);const v=e;Object.keys(s).length>0&&CORE_API.alert({alertMsg:v.charAt(0).toUpperCase()+v.slice(1)+" was successfully switched to "+o[t].label+".",alertTime:3e3,alertType:"success",alertLabel:`${v} Changed`,alertId:"materialVariantChanged"}),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.GlobalVariant_Updated,this._globalVariants),itemStore.setState({variantChangeAlert:!itemStore.getState().variantChangeAlert});const A=await this.getCartItemsAsync();A&&CORE_API.fireEvent(CORE_API.EVENTS.SCENE.CartItems_Updated,A)}async#t(e){if(!e)return;LOGGER.info({title:"Structure to load",details:e}),delete this._currentStructure,this._globalVariants={...e.globalVariants},this._globalGeometryVariants=e.globalGeometryVariants?{...e.globalGeometryVariants}:{};const t=[...e.structure];this._currentStructure=new Structure(t,this._globalVariants,this._globalGeometryVariants);for(const[n,s]of Object.entries(this._globalVariants))this.switchGlobalVariant(n,s);for(const[n,s]of Object.entries(this._globalGeometryVariants))this.switchGlobalGeometryVariant(n,s);LOGGER.info({title:"Structure Loading..."}),await this._currentStructure.load(t),LOGGER.info({title:"Structure Loaded."})}async loadStructure(e){e&&(CORE_API.fireEvent(CORE_API.EVENTS.UI.PreloadScreen_Show),coreSceneStore.setState({configurationLoaded:!1}),await wait(500),await this._currentStructure.clear(),await this.#t(e),coreSceneStore.getState().preconfigurationLoaded?CORE_API.fireEvent(CORE_API.EVENTS.UI.PreloadScreen_Hide):coreSceneStore.setState({preconfigurationLoaded:!0}),coreSceneStore.getState().configurationLoadedOnRestart||coreSceneStore.setState({configurationLoadedOnRestart:!0}),coreSceneStore.setState({configurationLoaded:!0}),await attachmentStore$1.getState().actions.toggleStructureUpdated())}export(){return{structure:this._currentStructure.export(),globalVariants:this._globalVariants,globalGeometryVariants:this._globalGeometryVariants}}async clear(){CORE_API.fireEvent(CORE_API.EVENTS.UI.PreloadScreen_Show),this._currentStructure.clear(),CORE_API.fireEvent(CORE_API.EVENTS.UI.PreloadScreen_Hide)}async restart(){LOGGER.warn({title:"Restarting the Scene!!"}),itemStore.getState().selectedItemData&&itemStore.getState().actions.deselectItem();const e=attachmentStore$1.getState().defaultConfig;coreSceneStore.setState({configurationLoaded:!1,configurationLoadedOnRestart:!1}),CORE_API.fireEvent(CORE_API.EVENTS.UI.PreloadScreen_Show),await wait(500),await this._currentStructure.clear(),await this.#t(e),await attachmentStore$1.getState().actions.toggleStructureUpdated(),coreSceneStore.setState({configurationLoaded:!0,configurationLoadedOnRestart:!0}),CORE_API.fireEvent(CORE_API.EVENTS.UI.PreloadScreen_Hide)}}const attachmentStore=create$3((a,e)=>({attachmentSystem:null,defaultConfig:null,structureUpdated:!1,colliderMeshRef:null,placeholderRef:null,draggingItem:null,snappingThreshold:.5,actions:{initializeAttachmentSystem:async()=>{const{actions:t,defaultConfig:n}=e();LOGGER.info({title:"Initializing Attachment System!"});const s=await new AttachmentSystem;a({attachmentSystem:s}),await t.updateFittingSkuIds(),await t.toggleStructureUpdated()},loadSavedStructureFromConfigID:async t=>{LOGGER.info({title:"Fetching Structure Using ConfigID!"});const n=await getJSONFromEndpoint(FETCH_CONFIG_ENDPOINT+t);return n.success===!1?null:n.data},loadDefaultStructure:async()=>{const{actions:t,defaultConfig:n,attachmentSystem:s}=e();LOGGER.info({title:"Loading Default Structure!"}),await t.loadStructure(n)},updateFittingSkuIds:async()=>{const t=await attachmentStore.getState().attachmentSystem.getFittingSKUIDs();t&&(itemStore.setState({fittingSkuIds:[...t]}),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.FittingSkuIds_Updated,{skuids:t}))},toggleStructureUpdated:async()=>{const{attachmentSystem:t}=e();a(s=>({structureUpdated:!s.structureUpdated})),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.ReplaceableCategory_Updated,t.currentStructure.getCurrentItemsInReplaceableCategory());const n=await t.getCartItemsAsync();n&&CORE_API.fireEvent(CORE_API.EVENTS.SCENE.CartItems_Updated,n)},loadStructure:async t=>{const{attachmentSystem:n}=e();LOGGER.info({title:"Loading Structure!"}),n&&coreSceneStore.getState().configurationLoaded!==!1&&await n.loadStructure(t)},export:()=>{const{attachmentSystem:t}=e();if(t)return t.export()}}})),attachmentStore$1=attachmentStore,productDataStore=create$3((a,e)=>({productData:{},categoryData:{},lookData:{},hotspotsData:{},endpoints:{},assetsData:void 0,actions:{getCurrentPricingInfo:()=>{const{productData:t}=e();let n={};return Object.keys(t).map(s=>{if(s.toLowerCase()==="root")return;let o=t[s].lookDetails,v={};Object.keys(o).map(A=>{A!="default"&&(v[A]=o[A].price)}),n[s]=v}),n},updatePricingForAllProducts:t=>{const{actions:n}=e();Object.keys(t).map(s=>{let o=t[s];Object.keys(o).map(v=>{n.updatePricingForProduct(s,v,o[v])})})},updatePricingForProduct:(t,n,s)=>{const{productData:o}=e();let v=o[t];if(!v||!v.lookDetails)return;let A=v.lookDetails[n];if(!A)return;A.price=s,attachmentStore$1.getState().attachmentSystem.currentStructure.getNodesBySKUID(t).map(ee=>ee.updatePricing())},setProductData:t=>{let n={};t&&Object.keys(t).map(s=>{const o=t[s];if(o.skuID=s,o.skuID.toLowerCase()==="root"){o.lookDetails={default:{title:"",description:"",productPageUrl:"",thumbnails:{high:"",low:""},price:0}},o.defaultVariant="default";return}if(o?.lookDetails){const v=o.lookDetails;let A=Object.keys(o.lookDetails);if(A.includes("default")){const T=A.indexOf("default");A.splice(T,1)}o.looks=A,Object.keys(o.lookDetails).map(T=>{let ee=o.lookDetails[T];ee.inventory===void 0&&(ee.inventory=DEFAULT_INVENTORY),ee.price===void 0&&(ee.price=DEFAULT_PRODUCT_PRICE),n[s]={...n[s],[T]:{inventory:DEFAULT_INVENTORY,inScene:[]}}});let b=o?.defaultVariant;b||(LOGGER.warn({title:`No defaultVariant set for ${o.skuID}. Attempting to auto resolve but the colour variants behaviour might be unexpected!`}),b=Object.keys(o.lookDetails).sort()[0],LOGGER.warn({title:"Auto resolved default look ID: "+b})),A.includes(b)?(o.lookDetails.default=v[b],o.lookDetails.default.id=b):(LOGGER.error({title:`Default look [ ${b} ] doesn't exist for: ${s}. Please make sure to select a default variant in Input Data for this project`}),o.lookDetails.default=null)}}),LOGGER.info({title:"PRODUCT DATA: ",details:t}),inventoryStore.setState({inventoryData:n}),a({productData:t})},setCategoryData:t=>{const{productData:n}=e();t.geometryVariants!==void 0&&t.geometryVariants.map(s=>{s.defaultVariant===void 0&&Object.keys(s.variants).length>0&&(s.defaultVariant=Object.keys(s.variants)[0])}),t.color!==void 0&&t.color.map(s=>{(s.defaultLook===void 0&&s.looks.length>0||!s.looks.includes(s.defaultLook))&&(s.defaultLook=s.looks[0])}),a({categoryData:t}),t.build!==void 0&&t.build.map(s=>{s.skus.map(o=>{n[o].categoryID=s.categoryID,n[o].categoryLabel=s.label,n[o].swappable=s.swappable?s.swappable:!1,n[o].replace=s.replace})})},getProductDataById:t=>{const{productData:n}=e();let s=null;return n[t]&&(s=n[t]),s},setLookData:t=>a({lookData:t}),setHotspotsData:t=>{const{categoryData:n,productData:s}=e();n.geometryVariants&&Object.keys(t).map(o=>{t[o].map(v=>{v.geometryVariantID&&n.geometryVariants.map(A=>{Object.keys(A.variants).map(b=>{v.geometryVariantID==b&&A.productsInCategory.map(T=>{let ee=null;T.products.map(ne=>{t.hasOwnProperty(ne)&&(ee=t[ne])}),T.products.map(ne=>{t.hasOwnProperty(ne)||(t[ne]=ee)})})})})})}),a({hotspotsData:t})},setEndpoints:t=>{a({endpoints:t}),setGlobalEndpoints(t)},setAssetsData:t=>a({assetsData:t})}})),productDataStore$1=productDataStore,UtilityMenu=({handleShareButtonTrigger:a,handleSaveButtonTrigger:e,handleRestartButtonClick:t,handleShowHotspots:n,handleDimensionClick:s,handleInstructionButtonClick:o,utilityMenuVisible:v,hotspotsVisibility:A,viewInYourSpaceMenuBtnVisible:b,restartMenuBtnVisible:T,saveMenuBtnVisible:ee,hotspotsMenuBtnVisible:ne,instructionsMenuBtnVisible:re,dimensionsMenuBtnVisible:se,shareMenuBtnVisible:le,dimensionsVisible:pe,position:de,CORE_API:fe})=>{const[me,ve]=reactExports.useState("bottom"),_e=productDataStore$1(Le=>Le.assetsData),De={ar:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/AR.svg",restart:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Restart.svg",save:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/save.svg",share:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Share.svg",dimensions:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Ruler.svg",hotspots:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Eye.svg",instructions:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Info.svg"};return reactExports.useEffect(()=>{switch(de){case"top":ve("top");break;case"bottom":ve("bottom");break;case"left":ve("left");break;case"right":ve("right");break}return()=>{}},[de]),jsxDevRuntimeExports.jsxDEV("div",{className:"shellCanvasContainerParent",id:me,children:jsxDevRuntimeExports.jsxDEV("div",{className:(v&&(le||b||T||se||ne||re))==!0?"shellCanvasContainer":"shellCanvasContainer shellCanvasContainerInactive",children:[b&&jsxDevRuntimeExports.jsxDEV(UtilityMenuButton,{buttonAction:()=>{fe.viewInYourSpace()},buttonLabel:"AR",hoverLabel:"View in Your Space",icon:_e?.icons?.utilityMenu?.viewInYourSpace?fe.getResolvedAssetUrl(_e?.icons?.utilityMenu?.viewInYourSpace):De.ar},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/reactComponents/UtilityMenu.js",lineNumber:81,columnNumber:11},globalThis),T&&jsxDevRuntimeExports.jsxDEV(UtilityMenuButton,{buttonAction:()=>{t()},buttonLabel:"Restart",hoverLabel:"Restart",icon:_e?.icons?.utilityMenu?.restart?fe.getResolvedAssetUrl(_e?.icons?.utilityMenu?.restart):De.restart},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/reactComponents/UtilityMenu.js",lineNumber:98,columnNumber:11},globalThis),ee&&jsxDevRuntimeExports.jsxDEV(UtilityMenuButton,{buttonAction:()=>{e()},buttonLabel:"Save",hoverLabel:"Save",icon:_e?.icons?.utilityMenu?.save?fe.getResolvedAssetUrl(_e?.icons?.utilityMenu?.save):De.save},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/reactComponents/UtilityMenu.js",lineNumber:115,columnNumber:11},globalThis),le&&jsxDevRuntimeExports.jsxDEV(UtilityMenuButton,{buttonAction:()=>{a()},buttonLabel:"Share",hoverLabel:"Share",icon:_e?.icons?.utilityMenu?.share?fe.getResolvedAssetUrl(_e?.icons?.utilityMenu?.share):De.share},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/reactComponents/UtilityMenu.js",lineNumber:132,columnNumber:11},globalThis),se&&jsxDevRuntimeExports.jsxDEV(UtilityMenuButton,{buttonAction:()=>{s()},buttonLabel:"Size",hoverLabel:"Size",icon:_e?.icons?.utilityMenu?.dimensions?fe.getResolvedAssetUrl(_e?.icons?.utilityMenu?.dimensions):De.dimensions,activeCondition:pe},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/reactComponents/UtilityMenu.js",lineNumber:149,columnNumber:11},globalThis),ne&&jsxDevRuntimeExports.jsxDEV(UtilityMenuButton,{buttonAction:()=>{n()},buttonLabel:"Hotspots",hoverLabel:"Hotspots",icon:_e?.icons?.utilityMenu?.hotspots?fe.getResolvedAssetUrl(_e?.icons?.utilityMenu?.hotspots):De.hotspots,activeCondition:A},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/reactComponents/UtilityMenu.js",lineNumber:168,columnNumber:11},globalThis),re&&jsxDevRuntimeExports.jsxDEV(UtilityMenuButton,{buttonAction:()=>{o()},buttonLabel:"Instructions",hoverLabel:"Instructions",icon:_e?.icons?.utilityMenu?.instructions?fe.getResolvedAssetUrl(_e?.icons?.utilityMenu?.instructions):De.instructions},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/reactComponents/UtilityMenu.js",lineNumber:187,columnNumber:11},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/reactComponents/UtilityMenu.js",lineNumber:67,columnNumber:7},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/reactComponents/UtilityMenu.js",lineNumber:66,columnNumber:5},globalThis)};var propTypes$5={exports:{}},reactIs={exports:{}},reactIs_development={};/** @license React v16.13.1
9147
+ }`,ToneMappingEffect=class extends Effect{constructor({blendFunction:a=BlendFunction.SRC,adaptive:e=!1,mode:t=e?ToneMappingMode.REINHARD2_ADAPTIVE:ToneMappingMode.ACES_FILMIC,resolution:n=256,maxLuminance:s=4,whitePoint:o=s,middleGrey:v=.6,minLuminance:A=.01,averageLuminance:b=1,adaptationRate:T=1}={}){super("ToneMappingEffect",tone_mapping_default,{blendFunction:a,uniforms:new Map([["luminanceBuffer",new Uniform(null)],["maxLuminance",new Uniform(s)],["whitePoint",new Uniform(o)],["middleGrey",new Uniform(v)],["averageLuminance",new Uniform(b)]])}),this.renderTargetLuminance=new WebGLRenderTarget(1,1,{minFilter:LinearMipmapLinearFilter,depthBuffer:!1}),this.renderTargetLuminance.texture.generateMipmaps=!0,this.renderTargetLuminance.texture.name="Luminance",this.luminancePass=new LuminancePass({renderTarget:this.renderTargetLuminance}),this.adaptiveLuminancePass=new AdaptiveLuminancePass(this.luminancePass.texture,{minLuminance:A,adaptationRate:T}),this.uniforms.get("luminanceBuffer").value=this.adaptiveLuminancePass.texture,this.resolution=n,this.mode=t}get mode(){return Number(this.defines.get("TONE_MAPPING_MODE"))}set mode(a){if(this.mode!==a){switch(this.defines.clear(),this.defines.set("TONE_MAPPING_MODE",a.toFixed(0)),a){case ToneMappingMode.REINHARD:this.defines.set("toneMapping(texel)","ReinhardToneMapping(texel)");break;case ToneMappingMode.OPTIMIZED_CINEON:this.defines.set("toneMapping(texel)","OptimizedCineonToneMapping(texel)");break;case ToneMappingMode.ACES_FILMIC:this.defines.set("toneMapping(texel)","ACESFilmicToneMapping(texel)");break;default:this.defines.set("toneMapping(texel)","texel");break}this.adaptiveLuminancePass.enabled=a===ToneMappingMode.REINHARD2_ADAPTIVE,this.setChanged()}}getMode(){return this.mode}setMode(a){this.mode=a}get whitePoint(){return this.uniforms.get("whitePoint").value}set whitePoint(a){this.uniforms.get("whitePoint").value=a}get middleGrey(){return this.uniforms.get("middleGrey").value}set middleGrey(a){this.uniforms.get("middleGrey").value=a}get averageLuminance(){return this.uniforms.get("averageLuminance").value}set averageLuminance(a){this.uniforms.get("averageLuminance").value=a}get adaptiveLuminanceMaterial(){return this.adaptiveLuminancePass.fullscreenMaterial}getAdaptiveLuminanceMaterial(){return this.adaptiveLuminanceMaterial}get resolution(){return this.luminancePass.resolution.width}set resolution(a){const e=Math.max(0,Math.ceil(Math.log2(a))),t=Math.pow(2,e);this.luminancePass.resolution.setPreferredSize(t,t),this.adaptiveLuminanceMaterial.mipLevel1x1=e}getResolution(){return this.resolution}setResolution(a){this.resolution=a}get adaptive(){return this.mode===ToneMappingMode.REINHARD2_ADAPTIVE}set adaptive(a){this.mode=a?ToneMappingMode.REINHARD2_ADAPTIVE:ToneMappingMode.REINHARD2}get adaptationRate(){return this.adaptiveLuminanceMaterial.adaptationRate}set adaptationRate(a){this.adaptiveLuminanceMaterial.adaptationRate=a}get distinction(){return console.warn(this.name,"distinction was removed."),1}set distinction(a){console.warn(this.name,"distinction was removed.")}update(a,e,t){this.adaptiveLuminancePass.enabled&&(this.luminancePass.render(a,e),this.adaptiveLuminancePass.render(a,null,null,t))}initialize(a,e,t){this.adaptiveLuminancePass.initialize(a,e,t)}};const coreSceneStore=create$3((a,e)=>({CORE_API:null,coreReady:void 0,frameloop:"always",hoveredGhostIndex:-1,itemDraggedSkuID:null,screenshotRenderer:new WebGLRenderer({antiAlias:!0,preserveDrawingBuffer:!0}),screenshotCamera:new PerspectiveCamera(75,1.33,.1,1e3),builderMode:!1,dragging:!1,bbox:null,draggingItemGUID:null,sceneRef:null,cssLoaded:!1,sceneHasDefaultConfigurationID:!1,configurationLoaded:!0,preconfigurationLoaded:!1,configurationLoadedOnRestart:!0,cursorParentRef:null,glContext:null,canvasTooltipText:"",canvasSize:{width:600,height:600},boundData:{center:new Vector3(0,0,0),size:new Vector3(0,0,0)},showDimensions:!1,autoFocusTrigger:0,cameraActive:!1,autoFocusRef:null,alertData:{},persistantAlertData:null,alertQueue:[],currentAlertData:null,alertSettings:null,draggingOnDropCollisionData:null,multipleTouchDetected:!1,isMobile:!1,isTouchDevice:!1,isTablet:!1,isDesktop:!0,isLandscape:!1,sceneSettings:{usdzMaxTextureSize:1024,usdzPrecision:7,swappableRoot:!0,ghostColorOnHoverWithDraggableUi:{r:153,g:252,b:0,a:1},preserveDrawingBuffer:!1,showSaveBtn:!0,showShareBtn:!0,showResetBtn:!0,showDimensionBtn:!0,showViewInYourSpaceBtn:!0,showDependencyOnHover:!1,showContextMenu:!0,showHotspotsBtn:!0,showInstructionsBtn:!1,showInstructionsOnStartup:!1,sceneScaleUnit:"ft",arPlacement:"floor",arTransforms:{position:[0,0,0],rotation:[0,0,0],scale:[1,1,1]},currency:"$",disableDragDrop:!1,ignoreSpawningCollision:!1,disableCollider:!1,disableContextMenu:!1,ghostColor:{r:10,g:10,b:10,a:.2},ghostScale:[1,1,1],ghostAsWireframe:!1,draggableUI:!1,addFromInfoModal:!1,clickToAddUi:!0,accordionInBuildUi:!1,outOfStock_EmissiveColor:{r:250,g:50,b:0},outOfStock_EmissiveIntensity:.002,defaultConfigurationID:null,emptySceneText:null,emptySceneTextFontSize:"2rem",addToCartCTAText:"Add To Cart",ignoreCollisionPostDragging:!1,comboPlugDistanceThreshold:.05,disableCart:!1,dimensionColor:{r:0,g:0,b:0},disableLocalColorOverride:!1,analyticsEventPrefix:"",outlineSettings:{multisampling:10,visibleEdgeColor:new Color$1("#0f0").convertSRGBToLinear(),hiddenEdgeColor:new Color$1("#0f0").convertSRGBToLinear(),blur:3,width:1e3,edgeStrength:1e3,blendFunction:BlendFunction.ALPHA,pulseSpeed:0,xRay:!0},textSettings:{arButtonLabel:"AR",arHoverLabel:"View In Your Space",restartButtonLabel:"Restart",restartHoverLabel:"Restart",saveButtonLabel:"Save",saveHoverLabel:"Save",shareButtonLabel:"Share",shareHoverLabel:"Share",sizeButtonLabel:"Size",sizeHoverLabel:"Size",hotspotsButtonLabel:"Hotspots",hotspotsHoverLabel:"Hotspots",instructionsButtonLabel:"Instructions",instructionsHoverLabel:"Instructions",cartQuantityText:"Qty",reviewButtonText:"Review",cartHeadingText:"Review Products",buildTabHeadingText:"Build",colorTabHeadingText:"Color",featuresTabHeadingText:"Features",tooltipEmptySceneText:"",tooltipInstructionText:"-Drag to rotate the camera-"},variantsTabOrder:{color:{enabled:!0,priority:1},geometryVariants:{enabled:!0,priority:2}},boundingBoxLeeway:.9,contactShadowVisibility:!0,measurementPrecision:2,disableAlerts:!1,focusCameraOnGhosts:!0,alertLevel:2999,alertControl:{default:!0,itemAdded:!0,geometryVariantChanged:!0,overridesRemoved:!0,materialVariantChanged:!0,itemRemoved:!0,itemRepositioned:!0,configurationSaved:!0,linkCopied:!0,outOfStock:!0,unvisualizedItemSpawn:!0},screenshotCameras:[{position:new Vector3(-2.5,.6,-5),rotation:new Vector3(-3.1097068566150314,-.6437852162982552,-3.122449778846033)},{position:new Vector3(3,1,-5),rotation:new Vector3(-.5,1,.5)}],instructionsSettings_desktop:[{header:"Add to Scene",description:"Click to add individual modules to the scene.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1A_Drag_Drop/Non-furniture_Step_1A.json"},{header:"Rearrange Modules",description:"Drag & drop individual modules in the scene to rearrange.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_2/Non-furniture_Step_2.json"},{header:"Remove Modules",description:"Click to select and remove individual modules from the scene.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_3/Non-furniture_Step_3.json"}],instructionsSettings_mobile:[{header:"Add to Scene",description:"Click to add individual modules to the scene.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1A_Drag_Drop_Mobile/Mobile_Non-furniture_Step_1A.json"},{header:"Rearrange Modules",description:"Drag & drop individual modules in the scene to rearrange.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_2/Non-furniture_Step_2.json"},{header:"Remove Modules",description:"Tap to select and remove individual modules from the scene.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_3/Non-furniture_Step_3.json"}],defaultInstructionsSettings:{step1_drag:{mobile:{header:"Add to Scene",description:"Drag & drop individual modules to add to the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_1A_Drag_Drop_Mobile/Mobile_Furniture_Step_1A.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1A_Drag_Drop_Mobile/Mobile_Non-furniture_Step_1A.json"}},desktop:{header:"Add to Scene",description:"Drag & drop individual modules to add to the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_1A_Drag_Drop/Furniture_Step_1A.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1A_Drag_Drop/Non-furniture_Step_1A.json"}}},step1_add:{mobile:{header:"Add to Scene",description:"Click to add individual modules to the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_1B_Click_Add_Mobile/Mobile_Furniture_Step_1B.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1B_Click_Add_Mobile/Mobile_Non-furniture_Step_1B.json"}},desktop:{header:"Add to Scene",description:"Click to add individual modules to the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_1B_Click_Add/Furniture_Step_1B.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1B_Click_Add/Non-furniture_Step_1B.json"}}},step2:{mobile:{header:"Rearrange Modules",description:"Drag & drop individual modules in the scene to rearrange.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_2/Furniture_Step_2.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_2/Non-furniture_Step_2.json"}},desktop:{header:"Rearrange Modules",description:"Drag & drop individual modules in the scene to rearrange.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_2/Furniture_Step_2.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_2/Non-furniture_Step_2.json"}}},step3:{mobile:{header:"Remove Modules",description:"Tap to select and remove individual modules from the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_3/Furniture_Step_3.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_3/Non-furniture_Step_3.json"}},desktop:{header:"Remove Modules",description:"Click to select and remove individual modules from the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_3/Furniture_Step_3.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_3/Non-furniture_Step_3.json"}}}}},setCSSLoaded:t=>{a({cssLoaded:t})},actions:{popFromAlertQueue:()=>{const{alertQueue:t}=e();return t.shift(),a({alertQueue:t}),t},addToAlertQueue:t=>{const{alertQueue:n,currentAlertData:s}=e();return n.length>0&&n[n.length-1].alertId&&t.alertId===n[n.length-1].alertId||n.length==0&&s&&s.alertId&&s.alertId==t.alertId||(n.push(t),a({alertQueue:n})),n},getDeviceState:()=>{const{isDesktop:t,isMobile:n,isTablet:s,isTouchDevice:o,isLandscape:v}=e();return{isDesktop:t,isMobile:n,isTablet:s,isTouchDevice:o,isLandscape:v}},enableCart:()=>{const{sceneSettings:t}=e();t.disableCart=!1,inventoryStore.getState().actions.refreshInventory(itemStore.getState().itemsSpawned),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.Cart_StatusUpdated,{disableCart:!1})},disableCart:()=>{const{sceneSettings:t}=e();t.disableCart=!0,inventoryStore.getState().actions.refreshInventory(itemStore.getState().itemsSpawned),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.Cart_StatusUpdated,{disableCart:!0})},getSceneSettings:()=>{const{sceneSettings:t}=e();return t},sendAlert:t=>{a({alertData:{...t}})},switchCursor(t){const{cursorParentRef:n}=e();if(!n)return;let s="";switch(t){default:case CURSORS.GRAB:s="grabCursor";break;case CURSORS.GRABBING:s="grabbingCursor";break;case CURSORS.BLOCKED:s="blockedCursor";break;case CURSORS.POINTER:s="pointerCursor";break;case CURSORS.MOVE:s="moveCursor";break}for(let o=0;o<n.classList.length;o++)n.classList[o].includes("Cursor")&&n.classList.remove(n.classList[o]);n.classList.add(s)},setAlertSettings:t=>{a({alertSettings:t})},async completeDropItem(){const t=attachmentStore$1.getState().attachmentSystem,{draggingOnDropCollisionData:n}=e(),{node:s,attachedChildrenGuids:o,collidingStatus:v,intersectingGhostObject:A,initPosition:b,initRotation:T,detachedPlugs:ee,attachedNodesToCurrentNode:ne}=n;CORE_API.alert({alertMsg:"Item(s) have been removed",alertTime:7e3,alertType:"info",alertLabel:"Item(s) Removed",alertId:"itemRemoved"});for(const[pe,de]of o.entries())v[pe]===!0&&await itemStore.getState().actions.removeItemByGUID(de);const re=A.userData;let se=s.getPlugByName(re.incomingPlugName),le=t.currentStructure.getPlugByGUID(re.receiverPlugGUID);s.ref.position.set(A.position.x,A.position.y,A.position.z),s.ref.setRotationFromEuler(A.rotation),s.transform={position:A.position,rotation:A.quaternion},t.currentStructure.connectPlugs({incomingPlug:se,receiverPlug:le}),ghostStore.getState().actions.clearAllGhosts(),itemStore.getState().actions.deselectItem(),ne.map(pe=>{s.ref.parent.attach(pe.ref),pe.transform={position:pe.ref.position,rotation:pe.ref.quaternion},s.dragging=!1,pe.dragging=!1}),await attachmentStore$1.getState().actions.updateFittingSkuIds()},async revertDropItem(){const t=attachmentStore$1.getState().attachmentSystem,{draggingOnDropCollisionData:n}=e(),{node:s,attachedChildrenGuids:o,collidingStatus:v,intersectingGhostObject:A,initPosition:b,initRotation:T,detachedPlugs:ee,attachedNodesToCurrentNode:ne}=n;CORE_API.alert({alertMsg:"Position of item"+s.skuID+"is being moved to it's original position",alertTime:4e3,alertType:"info",alertLabel:"Repositioning",alertId:"itemRepositioned"});const re=ee.neighbourDetachedPlugs;re&&(ee.neighbourNode.detachNodeFromReceiver(),t.currentStructure.connectPlugs({incomingPlug:re.incomingPlug,receiverPlug:re.receiverPlug}));let se=ee.rootDetachedPlugs.incomingPlug,le=ee.rootDetachedPlugs.receiverPlug;s.ref.position.set(b.x,b.y,b.z),s.ref.setRotationFromEuler(T);let pe=new Quaternion().identity();s.ref.getWorldQuaternion(pe),s.transform={position:b,rotation:pe},t.currentStructure.connectPlugs({incomingPlug:se,receiverPlug:le}),ghostStore.getState().actions.clearAllGhosts(),itemStore.getState().actions.deselectItem(),ne.map(de=>{s.ref.parent.attach(de.ref),de.transform={position:de.ref.position,rotation:de.ref.quaternion},s.dragging=!1,de.dragging=!1}),await attachmentStore$1.getState().actions.updateFittingSkuIds()},setCoreSettings:t=>{const{sceneSettings:n,isMobile:s,isTouchDevice:o,isLandscape:v,actions:A}=e(),b=s===!0?"mobile":"desktop",T=["showSave","showShare","showReset","showDimension","showHotspots","showInstructionsBtn","showViewInYourSpace","showContextMenu","showInstructionsOnStartup","draggableUI","clickToAddUi","textSettings","alertControl","variantsTabOrder","emptySceneTextFontSize","instructionsSettings"];for(const ee of T)if(ee==="draggableUI"||ee==="clickToAddUi"||ee==="emptySceneTextFontSize"||ee==="showInstructionsOnStartup"||ee==="showInstructionsBtn"||ee==="instructionsSettings"){const re=`${ee}_${v===!1&&o===!0?"mobile":"desktop"}`;t[re]!==void 0?n[ee]=t[re]:n[re]!==void 0&&(n[ee]=n[re])}else if(ee==="textSettings"||ee==="variantsTabOrder"||ee==="alertControl"||ee==="outlineSettings"){if(t.hasOwnProperty(ee)){let ne=n[ee];Object.keys(ne).map(re=>{let se=t[ee];se.hasOwnProperty(re)?(re==="visibleEdgeColor"||re==="hiddenEdgeColor")&&(se[re]=new Color$1(se[re]).convertSRGBToLinear()):se[re]=ne[re]})}}else{const ne=`${ee}_${b}`;if(t[ne]!==void 0){let re=`${ee}Btn`;ee=="showContextMenu"&&(re=`${ee}`),n[re]=t[ne]}}t.disableCart===!0&&A.disableCart(),Object.keys(t).map(ee=>n[ee]=t[ee]),n.emptySceneText===null&&(n.emptySceneTextFontSize=s?"1.2rem":"1.5rem",n.draggableUI===!0?n.emptySceneText="Drag an item here to get started":n.emptySceneText="Select an item to get started"),a({sceneSettings:{...n,ghostThreeColor:{r:n.ghostColor.r/255,g:n.ghostColor.g/255,b:n.ghostColor.b/255,a:n.ghostColor.a/255},draggableUiGhostThreeColorOnHover:{r:n.ghostColorOnHoverWithDraggableUi.r/255,g:n.ghostColorOnHoverWithDraggableUi.g/255,b:n.ghostColorOnHoverWithDraggableUi.b/255,a:n.ghostColorOnHoverWithDraggableUi.a/255}}})},triggerAutoFocus:(t=null)=>a(n=>({autoFocusRef:t,autoFocusTrigger:n.autoFocusTrigger+1})),requestNewScreenshot:async(t,n)=>new Promise(async(s,o)=>{LOGGER.info({title:"Taking a screenshot"});const{screenshotRenderer:v,sceneRef:A,screenshotCamera:b,canvasSize:T}=e(),ee=await CORE_API.getCurrentCameraDetails();if(v.setClearColor(16777215),b.copy(ee),t!==null&&(b.position.copy(t.position),b.rotation.copy(new Euler(t.rotation.x,t.rotation.y,t.rotation.z))),n==null?v.setSize(T.width,T.height):v.setSize(n.width,n.height),v.render(A.parent,b),v.preserveDrawingBuffer===!1)LOGGER.warn({title:"Preserve Drawing Buffer must be enabled to take a screenshot. Please make sure to enable this within the project input data coreSettings"}),o({success:!1,imageData:null});else{LOGGER.info({title:"Downloading the screenshot"});const ne=v.domElement.toDataURL("image/png").replace("image/png","image/octet-stream");s({success:!0,imageData:ne})}})}})),hotspotIdPrefix="rd",hotspotIdSeparator="_";function generateHotspotAbsoluteID(a,e){return`${hotspotIdPrefix}${hotspotIdSeparator}${a}${hotspotIdSeparator}${e}`}async function wait(a){return LOGGER.info({title:`Waiting for ${a}ms`}),new Promise((e,t)=>{setTimeout(()=>{e(!0)},a)})}function compareObjects(a,e){if(a===null||e===null)return!1;for(let t in a)if(a.hasOwnProperty(t)&&e.hasOwnProperty(t)&&a[t]!==e[t])return!1;return Object.keys(a).length===Object.keys(e).length}const saveStructureToCMS=a=>{const e={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)};return fetch(SAVE_CONFIG_ENDPOINT,e)},mobileCheck=function(){let a=!1;return function(e){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4)))&&(a=!0)}(navigator.userAgent||navigator.vendor||window.opera),a};function isIpadOS(){return navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform)}function tabletCheck(){const a=navigator.userAgent.toLowerCase(),e=/(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/.test(a);return e||isIpadOS()}function touchDeviceCheck(){return"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}async function getJSONFromEndpoint(a){let e={data:null,report:"",success:!1};try{const n=await(await fetch(a)).text();e.data=JSON.parse(n),e.success=!0,e.report="Successfully fetched JSON data."}catch(t){e.report=t,CORE_API.alert({alertMsg:"",alertTime:5e3,alertType:"warn",alertLabel:"Preload Failed"})}return e}const addVector=(a,e)=>new Vector3(a[0]+e[0],a[1]+e[1],a[2]+e[2]),Vec3ToArr=a=>[a.x,a.y,a.z],ArrToVec3=a=>new Vector3(a[0],a[1],a[2]),findMeshAndCloneMatFromScene=(a,e=!0)=>{let t=[];const n=coreSceneStore.getState().sceneSettings.outOfStock_EmissiveColor,s=coreSceneStore.getState().sceneSettings.outOfStock_EmissiveIntensity;return a.traverse(o=>{o.isMesh&&(o.material.userData.cloned?o.material.userData.inStock!==e&&(e?(o.material.emissive.set(new Color$1(255,255,255)),o.material.emissiveIntensity=0):(o.material.emissive.set(new Color$1(n.r,n.g,n.b)),o.material.emissiveIntensity=s),o.material.userData.inStock=e):(o.material=o.material.clone(),o.material.userData.inStock=e,o.material.userData.cloned=!0,e?(o.material.emissive.set(new Color$1(255,255,255)),o.material.emissiveIntensity=0):(o.material.emissive.set(new Color$1(n.r,n.g,n.b)),o.material.emissiveIntensity=s)),t.push(o))}),t},filterArrWithCondition=(a,e)=>{let t=0,n=[];for(let s=0;s<a.length;s++){const o=a[s];e(o)?a[t++]=o:n.push(a[s])}return a.length=t,n},degToRad=a=>a*Math.PI/180,resolveAssetUrl=a=>{if(!a)return;if(new RegExp("^(?:[a-z+]+:)?//","i").test(a))return a;let n=a;return n=n.replaceAll("<@all-projects@>",ALL_PROJECTS_ASSET_DATA_ROOT_URL),n=n.replaceAll("<@generic-project@>",GENERIC_PROJECT_ASSET_DATA_ROOT_URL),n};function componentToHex(a){var e=a.toString(16);return e.length==1?"0"+e:e}function rgbToHex(a,e,t){return"#"+componentToHex(a)+componentToHex(e)+componentToHex(t)}function getUrlParameterByName(a,e=window.location.search){const t=new URLSearchParams(e);return Object.fromEntries(t.entries())[a]}const lightStore=create$3((a,e)=>({defaultEnvMapUrl:"<@generic-project@>/env-map/neutral.hdr",envMapUrl:"",actions:{setEnvLightMap:t=>{a(n=>({envMapUrl:t}))},processLookEnvMapOverride:t=>{const{envMapUrl:n,defaultEnvMapUrl:s,actions:o}=e(),v=productDataStore$1.getState().lookData[t],A=v?.envMapOverride;if(!v||!A){o.setEnvLightMap(s);return}if(A===n){LOGGER.info({title:`New Env Map Url is the same as the current ${A}`});return}o.setEnvLightMap(A)}}}));var rngBrowser={exports:{}},getRandomValues=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof window.msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto);if(getRandomValues){var rnds8=new Uint8Array(16);rngBrowser.exports=function(){return getRandomValues(rnds8),rnds8}}else{var rnds=new Array(16);rngBrowser.exports=function(){for(var e=0,t;e<16;e++)e&3||(t=Math.random()*4294967296),rnds[e]=t>>>((e&3)<<3)&255;return rnds}}var rngBrowserExports=rngBrowser.exports,byteToHex=[];for(var i$3=0;i$3<256;++i$3)byteToHex[i$3]=(i$3+256).toString(16).substr(1);function bytesToUuid$2(a,e){var t=e||0,n=byteToHex;return[n[a[t++]],n[a[t++]],n[a[t++]],n[a[t++]],"-",n[a[t++]],n[a[t++]],"-",n[a[t++]],n[a[t++]],"-",n[a[t++]],n[a[t++]],"-",n[a[t++]],n[a[t++]],n[a[t++]],n[a[t++]],n[a[t++]],n[a[t++]]].join("")}var bytesToUuid_1=bytesToUuid$2,rng$1=rngBrowserExports,bytesToUuid$1=bytesToUuid_1,_nodeId,_clockseq,_lastMSecs=0,_lastNSecs=0;function v1$2(a,e,t){var n=e&&t||0,s=e||[];a=a||{};var o=a.node||_nodeId,v=a.clockseq!==void 0?a.clockseq:_clockseq;if(o==null||v==null){var A=rng$1();o==null&&(o=_nodeId=[A[0]|1,A[1],A[2],A[3],A[4],A[5]]),v==null&&(v=_clockseq=(A[6]<<8|A[7])&16383)}var b=a.msecs!==void 0?a.msecs:new Date().getTime(),T=a.nsecs!==void 0?a.nsecs:_lastNSecs+1,ee=b-_lastMSecs+(T-_lastNSecs)/1e4;if(ee<0&&a.clockseq===void 0&&(v=v+1&16383),(ee<0||b>_lastMSecs)&&a.nsecs===void 0&&(T=0),T>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");_lastMSecs=b,_lastNSecs=T,_clockseq=v,b+=122192928e5;var ne=((b&268435455)*1e4+T)%4294967296;s[n++]=ne>>>24&255,s[n++]=ne>>>16&255,s[n++]=ne>>>8&255,s[n++]=ne&255;var re=b/4294967296*1e4&268435455;s[n++]=re>>>8&255,s[n++]=re&255,s[n++]=re>>>24&15|16,s[n++]=re>>>16&255,s[n++]=v>>>8|128,s[n++]=v&255;for(var se=0;se<6;++se)s[n+se]=o[se];return e||bytesToUuid$1(s)}var v1_1=v1$2,rng=rngBrowserExports,bytesToUuid=bytesToUuid_1;function v4$1(a,e,t){var n=e&&t||0;typeof a=="string"&&(e=a==="binary"?new Array(16):null,a=null),a=a||{};var s=a.random||(a.rng||rng)();if(s[6]=s[6]&15|64,s[8]=s[8]&63|128,e)for(var o=0;o<16;++o)e[n+o]=s[o];return e||bytesToUuid(s)}var v4_1=v4$1,v1$1=v1_1,v4=v4_1,uuid=v4;uuid.v1=v1$1;uuid.v4=v4;var uuid_1=uuid;class Plug{constructor(e,t,n=null){this._attachedPlug=null,this._name=e.name,this._acceptedPlugTypes=e.acceptedPlugTypes,this._affectedNodes=e.affectedNodes,this._unvisualizedCount=e.unvisualizedCount,this._weight=e.weight,this._connectsToPlugTypes=e.connectsToPlugTypes,this._dependencySku=e.dependencySku,this._isDependencySkuInteractive=e.isDependencySkuInteractive,this._autoSpawnDependencyIfMissing=e.autoSpawnDependencyIfMissing,this._node=t,n?(this._comboPlugConnector=n.comboPlugConnector,this._guid=n.guid,this._isOpen=n.isOpen,this._type=n.type,this._isReceiverPlug=n.isReceiverPlug,this._attachedPlugGUID=n.attachedPlugGUID):(this._comboPlugConnector=!1,this._guid=uuid_1.v4(),this._isOpen=!0,this._type=e.type,this._isReceiverPlug=!1,this._attachedPlugGUID=null)}export(){return this.isOpen?null:{guid:this._guid,type:this._type,isOpen:this._isOpen,comboPlugConnector:this._comboPlugConnector,attachedPlugGUID:this._attachedPlugGUID,isReceiverPlug:this._isReceiverPlug}}get node(){return this._node}set comboPlugConnector(e){this._comboPlugConnector=e}get comboPlugConnector(){return this._comboPlugConnector}get attachedPlug(){return this._attachedPlug}set attachedPlug(e){this._attachedPlug=e}get attachedPlugGUID(){return this._attachedPlugGUID}set type(e){this._type=e}get type(){return this._type}get weight(){return this._weight}get unvisualizedCount(){return this.__unvisualizedCount}get affectedNodes(){return this._affectedNodes}get guid(){return this._guid}get isReceiverPlug(){return this._isReceiverPlug}get name(){return this._name}get acceptedPlugTypes(){return this._acceptedPlugTypes}set acceptedPlugTypes(e){this._acceptedPlugTypes=e}get connectsToPlugTypes(){return this._connectsToPlugTypes}set connectsToPlugTypes(e){this._connectsToPlugTypes=e}get isOpen(){return this._isOpen}attachPlug(e,t=!1){this._attachedPlug=e,this._attachedPlugGUID=e.guid,this._isOpen=!1,this._isReceiverPlug=t;const n=this,s=this._node;if(s.isConnectedToRoot&&t){const o=s.whichPlugAreWeAttachedUsing();switch(e.type){case"weighted_hider":o.weight<n.weight&&(s.showNodes(o.affectedNodes)||CORE_API.coreWCRef.addEventListener(s.guid+":modelLoaded",function(){s.showNodes(o.affectedNodes)},{once:!0}));break}}if(t&&e.type!==""&&e.type==n._type)switch(e.type){default:case"weighted_hider":n._weight>e.weight?e.node.hideNodes(e.affectedNodes)||CORE_API.coreWCRef.addEventListener(e.node.guid+":modelLoaded",function(){e.node.hideNodes(e.affectedNodes)},{once:!0}):n._weight<e.weight&&(s.hideNodes(n._affectedNodes)||CORE_API.coreWCRef.addEventListener(s.guid+":modelLoaded",function(){s.hideNodes(n._affectedNodes)},{once:!0}));break}t&&(s.isEndNode=!1)}async openPlug(){if(this._comboPlugConnector&&(this._comboPlugConnector=!1),this._node.isConnectedToRoot){const e=this._node.whichPlugAreWeAttachedUsing();if(e&&this._guid!==e.guid)switch(this.type){case"weighted_hider":e.type==="weighted_hider"&&e.weight<this.weight&&this._node.hideNodes(e.affectedNodes);break}}if(this._isReceiverPlug&&this._attachedPlug.type!==""&&this._attachedPlug.type==this._type)switch(this._attachedPlug.type){default:case"weighted_hider":this._weight>this._attachedPlug.weight?this._attachedPlug.node.showNodes(this._attachedPlug.affectedNodes):this._weight<this._attachedPlug.weight&&this._node.showNodes(this._affectedNodes);break}if(this._attachedPlug=null,this._attachedPlugGUID=null,this._isOpen=!0,this._isReceiverPlug&&(this._isReceiverPlug=!1,this._node.checkIfEndNode()),!!this._dependencySku&&!(this._autoSpawnDependencyIfMissing==!1||this._isDependencySkuInteractive||coreSceneStore.getState().configurationLoaded===!1))try{const e=await ghostStore.getState().actions.spawnGhostsForSkuID(this._dependencySku,!0);if(!e)return;const t=e.connectablePlugs;let n=!1;const s=this._isDependencySkuInteractive?this.isDependencySkuInteractive===1:!1;for(const o of t){if(o.receiverPlug.guid!==this._guid)continue;n=!0;const v=await itemStore.getState().actions.addItemBySkuID(this._dependencySku,t.indexOf(o),!0,s);v!==null&&this._node.addMyDependenciesGUID(v)}n||await ghostStore.getState().actions.clearAllGhosts()}catch{LOGGER.info({title:"The Plug has been removed!"})}}canAttachToPlug(e){for(let t=0;t<this._connectsToPlugTypes.length;t++)if(e._acceptedPlugTypes.includes(this._connectsToPlugTypes[t]))return!0;return!1}}let Node$1=class{#t="default";#r=!1;#i=!1;#s=!0;#n={};#o=!1;#c={};#u=[];constructor(e,t=null,n,s){let o=productDataStore$1.getState().productData;this._plugs=[],this._skuID=e,this._ref=null,this._dragging=!1,this._modelData=null,this._transform=null,this.#t="default",this._overrideVariant=null,this._followsParent=o[e].followsParent,this._categoryID=o[e].categoryID,this._replace=o[e].replace,this._swappable=o[e].swappable,this._price=this.#a(),this.#r=o[e]?.ignoreInCart,t?(this._guid=t.guid,this._isEndNode=t.isEndNode,this._overrideVariant=t.overrideVariant,this.generatePlugsWithData(e,t.plugs)):(this._guid=uuid_1.v4(),this._isEndNode=!0,this.generatePlugsForNode(e)),n&&Object.keys(n).map(v=>{if(o[e].looks&&o[e].looks.includes(v)){this.#t=v;return}})}get isRoot(){return this._skuID.toLowerCase()==="root"}updateGeometryVariant(e,t){const s=productDataStore$1.getState().categoryData.geometryVariants;let o=null;if(s.map(ee=>{ee.id==e&&(o=ee)}),!o)return;const v=o.productsInCategory,b=o.variants[t].productsToSwitch,T=itemStore.getState().itemsSpawned;v.map(ee=>{ee.products.map(ne=>{this.skuID===ne&&ee.products.map(re=>{b.map(se=>{if(se==re){const le=productDataStore$1.getState().actions.getProductDataById(se);this.skuID=le.skuID;const pe=T[this.guid];pe&&pe.itemData&&Object.keys(le).map(de=>{pe.itemData[de]=le[de]}),this.hideNodes(le.geometriesToHide),this.showNodes(le.geometriesToShow),this.updatePricing(),this.resetInStock(),inventoryStore.getState().actions.refreshInventory(T)}})})})})}resetInStock(){this.#n={},this.#o=!0}setInStockForRef(e){if(!this.ref)return!1;let t=this.ref.getObjectByName("GRP_RenderGeometry");return t?(t.inStock=e,!0):!1}set inStock({variantName:e,newValue:t}){if(this.#n[e]&&this.#n[e]==t||(this.#n[e]=t,e!==this.#t&&this.#o===!1))return;const n=()=>{this.setInStockForRef(t)};n()||CORE_API.coreWCRef.addEventListener(this.guid+":modelLoaded",n,{once:!0})}get myDependenciesGUID(){return this.#u}set myDependenciesGUID(e){this.#u=e}get dragging(){return this._dragging}set dragging(e){this._dragging=e}addMyDependenciesGUID(e){this.#u.push(e)}get isDependent(){return this.#i}set isDependent(e){this.#i=e}get isInteractive(){return this.#s}set isInteractive(e){this.#s=e}update(e){this._skuID=e;const t=productDataStore$1.getState().productData,n=t[e]?.plugs;if(this.ignoreInCart=t[e].ignoreInCart,!!n)for(let s=0;s<this._plugs.length;s++)for(let o=0;o<n.length;o++)this._plugs[s].name==n[o].name&&(this._plugs[s].acceptedPlugTypes=n[o].acceptedPlugTypes,this._plugs[s].connectsToPlugTypes=n[o].connectsToPlugTypes)}export(){let e={};for(let t=0;t<this._plugs.length;t++){let n=this._plugs[t].export();n&&(e[this._plugs[t].name]=n)}return{skuID:this._skuID,guid:this._guid,isEndNode:this._isEndNode,plugs:e,overrideVariant:this._overrideVariant}}get node(){return this}get swappable(){return this._swappable}get replace(){return this._replace}get ignoreInCart(){return this.#r}set ignoreInCart(e){this.#r=e}get isTypeCombo(){const e=this.whichPlugAreWeAttachedUsing();return e.type=="comboPlug"&&e.connectsToPlugTypes.length>0}get canRotate(){let e=!0;if(this.isTypeCombo)return!1;if(!this._isEndNode){const n=this.whichNodesAreAttachedToUs();if(n.length>0){let s=!0;if(n.map(o=>{o.followsParent===!1&&(s=!1)}),!s)return!1}}let t=!1;for(let n=0;n<this.plugs.length;n++)if(!this.plugs[n].isOpen&&this.plugs[n].attachedPlug.isReceiverPlug){const s=this.plugs[n].attachedPlug.acceptedPlugTypes;for(let o=0;o<this.plugs.length;o++)if(n!=o)for(let v=0;v<this.plugs[o].connectsToPlugTypes.length;v++)s.includes(this.plugs[o].connectsToPlugTypes[v])&&(t=!0)}return e=t,e}hideNodes(e){if(!this.ref)return!1;const t=this.ref.getObjectByName("GRP_RenderGeometry"),n=this.ref.getObjectByName("GRP_ProxyMesh");return e.map(s=>{if(t){const o=t.getObjectByName(s);o&&(o.visible=!1)}if(n){const o=n.getObjectByName(s);o&&(o.visible=!1)}}),!0}showNodes(e){if(!this.ref)return!1;const t=this.ref.getObjectByName("GRP_RenderGeometry"),n=this.ref.getObjectByName("GRP_ProxyMesh");return e.map(s=>{if(t){const o=t.getObjectByName(s);o&&(o.visible=!0)}if(n){const o=n.getObjectByName(s);o&&(o.visible=!0)}}),!0}canConnectToPlugType(e){let t=!1;return this._plugs.map(n=>{n.connectsToPlugTypes.map(s=>{s==e&&(t=!0)})}),t}isConnectedToSkuID(e){let t=!1;return this._plugs.map(n=>{if(n.isOpen||t===!0)return;let s=n.attachedPlug;!s&&n.attachedPlugGUID&&(s=attachmentStore$1.getState().attachmentSystem.currentStructure.getPlugByGUID(n.attachedPlugGUID)),s.node.skuID==e&&(t=!0)}),t}get isConnectedToRoot(){return this.isConnectedToSkuID("Root")}swapRoot(){if(!this.canSwapRoot)return;const t=attachmentStore$1.getState().attachmentSystem.currentStructure,n=this.whichNodesAreAttachedToUs();let s=null;n.map(T=>{T.followsParent===!1&&(s=T)});const o=s.detachNodeFromReceiver();let v=null;this._plugs.map(T=>{T.isOpen||T.attachedPlug.node.skuID=="Root"&&(v=T.attachedPlug)});const A=this.detachNodeFromReceiver();let b=null;return s.plugs.map(T=>{T.connectsToPlugTypes.includes("root")&&(b=T)}),t.connectPlugs({incomingPlug:b,receiverPlug:v}),{neighbourDetachedPlugs:o,rootDetachedPlugs:A,neighbourNode:s}}get canSwapRoot(){if(coreSceneStore.getState().sceneSettings.swappableRoot===!1)return!1;let e=!1;if(this.isConnectedToRoot&&!this._isEndNode){const n=this.whichNodesAreAttachedToUs();let s=0,o=null;n.map(v=>{v.followsParent===!1&&(s++,o=v)}),s==1?o.canConnectToPlugType("root")&&(e=!0):s>0&&(e=!1)}return e}get canRemove(){let e=!0;return this._isEndNode||(this.whichNodesAreAttachedToUs().map(n=>{n.followsParent===!1&&(e=!1)}),e||(e=this.canSwapRoot)),e}getComboPlugNodesAttachedToUs(){let e=[];return this.whichNodesAreAttachedToUs().forEach(n=>{n.isTypeCombo&&e.push(n);const s=n.getComboPlugNodesAttachedToUs();s.length>0&&(e=e.concat(s))}),e}getAllBranchedNodesAttachedToUs(){let e=[];const t=this.whichNodesAreAttachedToUs();for(let n=0;n<t.length;n++){e.push(t[n]);const s=t[n].getAllBranchedNodesAttachedToUs();s.length>0&&(e=e.concat(s))}return e}get canDrag(){let e=!0;if(this.isTypeCombo)return!1;for(let n=0;n<this._plugs.length;n++)if(this._plugs[n].isOpen==!1&&this._plugs[n].attachedPlug.type=="comboPlug")return!1;const t=this.getComboPlugNodesAttachedToUs();if(t.length>0){const n=this.getAllBranchedNodesAttachedToUs();let s=!0;if(t.map(o=>{const v=o.whichNodesIsThisComboPlugAttachedTo();let A=!0;if(v.map(b=>{let T=!1;if(n.map(ee=>{b.guid===ee.guid&&(T=!0)}),T==!1){A=!1;return}}),A==!1){s=!1;return}}),s==!1)return!1}return this._isEndNode||(this.whichNodesAreAttachedToUs().map(s=>{s.followsParent===!1&&(e=!1)}),e||(e=this.canSwapRoot)),e}get followsParent(){return this._followsParent}set followsParent(e){this._followsParent=e}resetFollowsParent(){const e=productDataStore$1.getState().productData;this._followsParent=e[this.skuID].followsParent}get currentVariant(){return this.#t==="default"?productDataStore$1.getState().actions.getProductDataById(this._skuID).lookDetails.default.id:this.#t}get price(){return this._price}set price(e){this._price=e}updatePricing(){this._price=this.#a()}#a(){let t=productDataStore$1.getState().actions.getProductDataById(this._skuID).lookDetails[this.#t]?.price;return t||(t=0),t}set currentVariant(e){this.#t=e,this._price=this.#a()}get overrideVariant(){return this._overrideVariant}set overrideVariant(e){this._overrideVariant=e,this.#t=this._overrideVariant,this._price=this.#a()}get guid(){return this._guid}get skuID(){return this._skuID}set skuID(e){this._skuID=e}get plugs(){return this._plugs}get ref(){return this._ref}set ref(e){this._ref=e}get modelData(){return this._modelData}set modelData(e){this._modelData=e;let t=new CustomEvent(this._guid+":modelLoaded",{bubbles:!0,cancelable:!1,composed:!0});const n=attachmentStore$1.getState().attachmentSystem;n.globalGeometryVariants&&Object.keys(n.globalGeometryVariants).map(s=>{this.updateGeometryVariant(s,n.globalGeometryVariants[s])}),t.data={},CORE_API.coreWCRef?CORE_API.coreWCRef.dispatchEvent(t):LOGGER.warn({title:"core web component not found!"})}get isEndNode(){return this._isEndNode}set isEndNode(e){this._isEndNode=e}get categoryID(){return this._categoryID}get transform(){return this._transform}set transform(e){this._transform=e}setModelVisibility(e){e?this._ref?.scale.set(1,1,1):this._ref.scale.set(0,0,0)}checkIfEndNode(){let e=!0;for(let t=0;t<this._plugs.length;t++)this._plugs[t].isReceiverPlug&&(e=!1);this.isEndNode=e}whichNodesAreAttachedToUs(){const e=[];for(let t=0;t<this._plugs.length;t++)this._plugs[t].isReceiverPlug&&e.push(this._plugs[t].attachedPlug.node);return e}whichPlugsAreAttachedToUs(){const e=[];for(let t=0;t<this._plugs.length;t++)this._plugs[t].isReceiverPlug&&e.push({receiverPlug:this._plugs[t],incomingPlug:this._plugs[t].attachedPlug});return e}whichNodeAreWeAttachedTo(){let e=null;for(const t of this._plugs)t?.attachedPlug?.isReceiverPlug&&(e=t.attachedPlug.node);return e}whichNodesIsThisComboPlugAttachedTo(){if(!this.isTypeCombo)return[];let e=[];for(const t of this._plugs)t?.attachedPlug?.isReceiverPlug&&e.push(t.attachedPlug.node);return e}isReplaceableWithSkuId(e){const n=productDataStore$1.getState().productData[e]?.plugs;let s=0;if(!n)return!1;for(let o=0;o<this._plugs.length;o++)for(let v=0;v<n.length;v++)this._plugs[o].name==n[v].name&&s++;return s==this._plugs.length}whichPlugAreWeAttachedUsing(){for(let e=0;e<this._plugs.length;e++){const t=this._plugs[e];let n=t.attachedPlug;if(!n&&t.attachedPlugGUID&&(n=attachmentStore$1.getState().attachmentSystem.currentStructure.getPlugByGUID(t.attachedPlugGUID)),!t.isOpen&&n.isReceiverPlug)return t}}whichPlugAreWeAttachedTo(){for(let e=0;e<this._plugs.length;e++)if(!this._plugs[e].isOpen&&this._plugs[e].attachedPlug.isReceiverPlug)return this._plugs[e].attachedPlug}getPlugWhichCanConnectToType(e){for(const t of this._plugs)if(t.connectsToPlugTypes.includes(e))return t;return null}getOpenPlugsWeCanAttachFrom(){let e=[];if(this.whichNodeAreWeAttachedTo())return e;for(let t=0;t<this._plugs.length;t++)this.plugs[t].isOpen&&this.plugs[t].connectsToPlugTypes.length>0&&e.push(this._plugs[t]);return e}getOpenPlugsFromNode(){let e=[];for(let t=0;t<this._plugs.length;t++)this._plugs[t].isOpen&&this._plugs[t].acceptedPlugTypes.length>0&&e.push(this._plugs[t]);return e}generatePlugsForNode(e){this._plugs=[];let t=productDataStore$1.getState().productData[e]?.plugs;if(t)for(let n=0;n<t.length;n++)if(t[n].type==="unvisualizedPlug"){const s=t[n]?.unvisualizedCount>=0?t[n].unvisualizedCount:1e3;for(let o=0;o<s;o++){const v=new Plug({...t[n],name:`${t[n].name}_${o}`},this);this._plugs.push(v)}}else{const s=new Plug(t[n],this);this._plugs.push(s)}}generatePlugsWithData(e,t){const n=productDataStore$1.getState().productData[e]?.plugs;n&&n.forEach(s=>{if(s.type==="unvisualizedPlug"){const o=s.unvisualizedCount&&s.unvisualizedCount>=0?s.unvisualizedCount:1e3;for(let v=0;v<o;v++){const A=new Plug({...s,name:`${s.name}_${v}`},this,t[`${s.name}_${v}`]);this._plugs.push(A)}}else{const o=new Plug(s,this,t[s.name]);this._plugs.push(o)}})}detachNodeFromReceiver(){for(let e=0;e<this.plugs.length;e++)if(!this.plugs[e].isOpen&&this.plugs[e].attachedPlug.isReceiverPlug){const t={incomingPlug:this.plugs[e],receiverPlug:this.plugs[e].attachedPlug};return this.plugs[e].attachedPlug.openPlug(),this.plugs[e].openPlug(),t}}detachNodeCompletely(){for(let e=0;e<this._plugs.length;e++)this._plugs[e].isOpen||(this._plugs[e].attachedPlug.openPlug(),this._plugs[e].openPlug())}getPlugByName(e){for(let t=0;t<this._plugs.length;t++)if(this._plugs[t].name==e)return this._plugs[t];return null}getPlugByGUID(e){for(let t=0;t<this._plugs.length;t++)if(this._plugs[t].guid==e)return this._plugs[t];return null}async removeNode(){const e=[];for(const t of this._plugs)if(!t.isOpen){if(t.type==="comboPlug"&&t.connectsToPlugTypes.length>0){t.attachedPlug.openPlug();continue}t.attachedPlug.isReceiverPlug?t.attachedPlug.openPlug():e.push(t.attachedPlug.node.guid)}if(e.length>0)for(const t of e)itemStore.getState().actions.addToRemoveItems(t)}};const EPIGRAPH_CONFIGURATOR_CATEGORY="Epigraph - Configurator",CONFIGURATOR_LOADING={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorLoading",label:"",interaction:{nonInteraction:!0}},CONFIGURATOR_READY={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorReady",label:"",interaction:{nonInteraction:!0}},CONFIGURATOR_FAILED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorFailed",label:"",interaction:{nonInteraction:!0}},CONFIGURATOR_REVIEW_CART_SHOWN={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorReviewCartShown",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_REVIEW_CART_HIDE={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorReviewCartHide",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_CHECKOUT={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorCheckout",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_CHECKOUT_ITEM={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorCheckoutItemDetails",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_GLOBAL_GEOMETRY_VARIANT_SWITCHED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorGlobalGeometryVariantSwitched",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_GLOBAL_VARIANT_SWITCHED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorGlobalVariantSwitched",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_LOCAL_VARIANT_SWITCHED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorLocalVariantSwitched",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_LOAD_FROM_PRECONFIG={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorLoadFromPreConfiguration",label:"",interaction:{nonInteraction:!0}},CONFIGURATOR_PRECONFIGURATION_ITEM_ADDED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"preconfigurationItemAdded",label:"",interaction:{nonInteraction:!0}},CONFIGURATOR_SCENE_RESTARTED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorSceneRestarted",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_AR_REQUESTED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorArRequested",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_ITEM_REMOVED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorItemRemoved",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_ITEM_ADDED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorItemAdded",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_INSTRUCTIONS_BTN_CLICKED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorInstructionsBtnClicked",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_INSTRUCTIONS_COMPLETION_RATE={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorInstructionsStageCompletionRate",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_INSTRUCTIONS_SHOWN={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorInstructionsShow",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_DIMENSION_SHOWN={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorDimensionsBtnShow",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_DIMENSION_HIDE={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorDimensionsBtnHide",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_HOTSPOT_ENTER={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorHotspotEnter",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_HOTSPOT_EXIT={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorHotspotExit",label:"",interaction:{nonInteraction:!1}},CONFIGURATOR_SCENE_SHARED={type:"event",category:EPIGRAPH_CONFIGURATOR_CATEGORY,action:"configuratorSceneShared",label:"",interaction:{nonInteraction:!1}};class Structure{#t=!1;constructor(e=null,t,n){if(this._nodes=[],this._rootNode=null,LOGGER.info({title:"preloadNodes",details:e}),this.setupHookOnSceneItemsUpdated(),e){LOGGER.info({title:"PRELOAD Length-----------------:"+e.length});for(var s=0;s<e.length;s++){LOGGER.info({title:"FOUND PRELOAD-----------------"});const o=e[s].skuID;if(o.toLowerCase()=="root"){const A=itemStore.getState().itemsSpawned;Object.keys(A).length>0&&(e[s].guid=Object.keys(A)[0])}let v=new Node$1(o,e[s],t,n);o.toLowerCase()=="root"&&(this._rootNode=v),this._nodes.push(v)}}else{const o=new Node$1("Root",null,t,n);this._rootNode=o,this._nodes.push(o),itemStore.getState().actions.addItemWithTransform({position:new Vector3(0,0,0),rotation:new Quaternion().identity()},"Root",this._rootNode.guid,!1)}this._boundingBoxLeeway=coreSceneStore.getState().sceneSettings.boundingBoxLeeway}async setupHookOnSceneItemsUpdated(){CORE_API.coreWCRef.addEventListener(CORE_API.EVENTS.SCENE.FittingSkuIds_Updated,()=>{DynamicHooks.hookOnSceneItemsUpdated(this._nodes,CORE_API)})}get nodes(){return this._nodes}get rootNode(){return this._rootNode}updatePricing(){for(let e=0;e<this._nodes.length;e++)this._nodes[e].updatePricing()}getCurrentItemsInReplaceableCategory(){let e={};for(const t of this._nodes)t.replace&&(e[t.categoryID]=t.skuID);return e}recalculateStructureFromNode(e){for(let t=0;t<e.plugs.length;t++)if(!e.plugs[t].isOpen&&e.plugs[t].isReceiverPlug){const n=e.plugs[t].attachedPlug.node,s={receiverPlug:e.plugs[t],incomingPlug:e.plugs[t].attachedPlug};if(s){const o=this.findItemTransform(s);o&&(n.ref.position.set(o.position.x,o.position.y,o.position.z),o.rotation.isQuaternion===!0?n.ref.setRotationFromQuaternion(o.rotation):o.rotation.isEuler===!0&&n.ref.setRotationFromEuler(o.rotation),n.transform={position:o.position,rotation:o.rotation})}this.recalculateStructureFromNode(n)}}rotateNode(e){const t=this.getNodeByGUID(e);let n=null,s=null;for(let A=0;A<t.plugs.length;A++)if(!s&&!t.plugs[A].isOpen&&t.plugs[A].attachedPlug.isReceiverPlug){const b=t.plugs[A].attachedPlug.acceptedPlugTypes;s=t.plugs[A].attachedPlug;let T=[];for(let ee=A+1;ee<t.plugs.length;ee++)T.push(t.plugs[ee]);for(let ee=0;ee<A;ee++)T.push(t.plugs[ee]);for(let ee=0;ee<T.length;ee++)for(let ne=0;ne<T[ee].connectsToPlugTypes.length;ne++)b.includes(T[ee].connectsToPlugTypes[ne])&&(n=T[ee])}if(!n)return;t.detachNodeFromReceiver();const{position:o,rotation:v}=this.findItemTransform({receiverPlug:s,incomingPlug:n});t.ref.position.set(o.x,o.y,o.z),v.isQuaternion===!0?t.ref.setRotationFromQuaternion(v):v.isEuler===!0&&t.ref.setRotationFromEuler(v),t.transform={position:t.ref.position,rotation:v},this.connectPlugs({receiverPlug:s,incomingPlug:n}),this.recalculateStructureFromNode(t)}async load(e){this.resolvePlugConnections(e),await this.respawnItems()}materialOverrideExists(){let e=!1;return this.nodes.map(t=>{if(t.overrideVariant)return e=!0,!0}),e}findGhostTransformForReplacement(e,t){let n=[],s=[],o=[];for(const v of t){if(v.skuID==e)continue;const A=attachmentStore$1.getState().attachmentSystem,b=v.whichPlugAreWeAttachedTo(),T=v.whichPlugAreWeAttachedUsing(),ne=new Node$1(e,null,A.globalVariants,A.globalGeometryVariants).getPlugByName(T.name);if(!ne)continue;const re={incomingPlug:ne,receiverPlug:b},{position:se,rotation:le}=this.findItemTransform(re);se&&le&&(s.push({position:se,rotation:le,incomingPlugName:re.incomingPlug.name,receiverPlugName:re.receiverPlug.name,incomingPlugGUID:re.incomingPlug.guid,receiverPlugGUID:re.receiverPlug.guid}),o.push(re),n.push(v))}return{transforms:s,connectablePlugs:o,newNodes:n}}async findGhostTransforms(e,t){const n=this.getOpenPlugs(),s=coreSceneStore.getState().sceneSettings.comboPlugDistanceThreshold;if(n.length<=0)return{transforms:[]};const o=attachmentStore$1.getState().attachmentSystem,v=productDataStore$1.getState().productData,A=new Node$1(e,null,o.globalVariants,o.globalGeometryVariants),b=this.getConnectablePlugs(A,n);let T=[];if(b.length<=0)return{transforms:[]};let ee=[],ne=[];const re=assetStore.getState().assets.items[e].proxy.data.scene;if(!re)return!1;let se=re.clone();for(let de=0;de<b.length;de++){let fe=t,{incomingPlug:me,receiverPlug:ve}=b[de],_e=this.findItemTransform(b[de]);if(!_e)continue;let{position:De,rotation:Le}=_e;if(!De||!Le)continue;se.position.set(De.x,De.y,De.z),Le.isQuaternion===!0?se.setRotationFromQuaternion(Le):Le.isEuler===!0&&se.setRotationFromEuler(Le);let ke=[],We=[];if(me.type=="comboPlug"){if(me.connectsToPlugTypes.length<=0)continue;const bt=me.connectsToPlugTypes[0];let Ze=!1;if(ne.map(Dr=>{Ze===!0||Dr.length<=0||Dr.map(zn=>{Ze===!0||zn.incomingPlug.guid!==me.guid||zn.incomingPlug.connectsToPlugTypes.includes(bt)&&(Ze=!0)})}),Ze===!0)continue;const hr=me.node.plugs;let cr=!0;if(hr.map(Dr=>{if(Dr.type!=="comboPlug"||Dr.guid===me.guid||!Dr.connectsToPlugTypes.includes(bt))return;let zn=!1;if(n.map(ar=>{if(ve.guid===ar.guid||!ar.acceptedPlugTypes.includes(bt)||!ar.node.ref)return;let zr=new Vector3(0,0,0);const Pn=ar.node.ref.getObjectByName(""+ar.name);if(!Pn)return;Pn.getWorldPosition(zr);let si=new Vector3(0,0,0);const ea=se.getObjectByName(""+Dr.name);if(!ea)return;ea.getWorldPosition(si);const es=zr.distanceTo(si);Math.abs(es)<s&&(ke.push(ve.node.guid),ke.push(ar.node.guid),We.push({receiverPlug:ar,incomingPlug:Dr}),zn=!0)}),zn==!1){cr=!1;return}}),!cr)continue}let Ue=fe;Array.isArray(fe)===!0&&(Ue=!1),ke.length>0&&(Ue=!1,Array.isArray(fe)===!0?ke.map(bt=>{fe.push(bt)}):fe=ke),v[e].hasOwnProperty("ignoreSpawningCollision")&&(Ue=v[e].ignoreSpawningCollision),b[de].receiverPlug.type=="unvisualizedPlug"&&(Ue=!0),(Ue?!1:this.isColliding(A.skuID,_e,b[de].receiverPlug,fe))||(ee.push({position:De,rotation:Le,incomingPlugName:b[de].incomingPlug.name,receiverPlugName:b[de].receiverPlug.name,incomingPlugGUID:b[de].incomingPlug.guid,receiverPlugGUID:b[de].receiverPlug.guid}),T.push(b[de]),ne.push(We))}let le=[];for(let de=0;de<ee.length;de++)le.push(A);let pe={transforms:ee,newNodes:le,connectablePlugs:T,comboPlugs:ne};return pe=await DynamicHooks.hookOnNewItemGhostsCollected(pe,CORE_API),pe}resolvePlugConnections(e){for(let t=0;t<e.length;t++)Object.keys(e[t].plugs).map(n=>{let s=e[t].plugs[n].guid,o=this.getPlugInNodesByGUID(s);if(!o||o.attachedPlug)return;let v=e[t].plugs[n].attachedPlugGUID,A=this.getPlugInNodesByGUID(v);A&&(A.attachedPlug||(o.attachPlug(A,e[t].plugs[n].isReceiverPlug),A.attachPlug(o,!e[t].plugs[n].isReceiverPlug)))});LOGGER.info({title:"RESOLVED PLUG CONNECTION: ",details:this})}async respawnItems(){let e=[this.rootNode];for(let o=0;o<e.length;o++){let A=e[o].whichPlugsAreAttachedToUs();for(let b=0;b<A.length;b++){if(A[b].incomingPlug.type=="comboPlug"&&A[b].incomingPlug.connectsToPlugTypes.length>0&&!A[b].incomingPlug.comboPlugConnector)continue;let T=this.findItemTransformForPreload(A[b],A[b].receiverPlug.node.transform);T?await itemStore.getState().actions.addItemWithTransform(T,A[b].incomingPlug.node.skuID,A[b].incomingPlug.node.guid):LOGGER.warn({title:"Problem finding plug transform! "+A[b].name}),A[b].incomingPlug.node.transform=T,e.push(A[b].incomingPlug.node)}}const t=await CORE_API.getCartItemsAsync();CORE_API.fireEvent(CORE_API.EVENTS.SCENE.SavedConfiguration_Loaded,{...t}),coreSceneStore.getState().actions.triggerAutoFocus(),hotspotStore$1.getState().actions.checkHotspotHealth();const n=coreSceneStore.getState().preconfigurationLoaded==!1&&coreSceneStore.getState().sceneHasDefaultConfigurationID==!1,s=coreSceneStore.getState().configurationLoaded==!1&&coreSceneStore.getState().preconfigurationLoaded==!0&&coreSceneStore.getState().configurationLoadedOnRestart==!0;if(n||s){let o=Object.assign({},CONFIGURATOR_LOAD_FROM_PRECONFIG);o.parameters={project_id:`${CORE_API.projectId}`,...t},CORE_API.sendAnalyticsEvent(o)}}getPlugInNodesByGUID(e){for(let t=0;t<this._nodes.length;t++){let n=this._nodes[t].getPlugByGUID(e);if(n)return n}return null}export(){let e=[];for(let t=0;t<this._nodes.length;t++){let n=this._nodes[t].export();n&&e.push(n)}return e}async clear(){return new Promise(async(e,t)=>{!this._rootNode&&this._rootNode.isEndNode&&e(!0);let n=null;const s=this._rootNode.whichNodesAreAttachedToUs();s.length>0&&(n=s[0]),this.#t=!0,CORE_API.coreWCRef.addEventListener(CORE_API.EVENTS.SCENE.Scene_Cleared,o=>e(o.data),{once:!0}),n?CORE_API.removeItemByGUID(n.guid,!0):(await wait(500),e(!0))})}getNodeByGUID(e){for(let t=0;t<this._nodes.length;t++)if(this._nodes[t].guid==e)return this._nodes[t];return null}getPlugByGUID(e){for(const t of this._nodes){const n=t.getPlugByGUID(e);if(n)return n}return null}findItemTransformForPreload(e,t){let{receiverPlug:n,incomingPlug:s}=e,o=n,v=s;if(o.node.skuID=="Root")return this.findItemTransformRoot(e);let A=null,b=null,T=new Object3D,ee=assetStore.getState().assets.items[o.node.skuID].proxy.data.scene.clone();T.add(ee);let{position:ne,rotation:re}=t;if(ee.position.set(ne.x,ne.y,ne.z),re.isQuaternion===!0?ee.setRotationFromQuaternion(re):re.isEuler===!0&&ee.setRotationFromEuler(re),b=ee,!b||(A=b.getObjectByName(o.name),!A))return;let se=new Vector3(0,0,0);A.getWorldPosition(se);let le=new Quaternion().identity();A.getWorldQuaternion(le);let pe=new Object3D;A.add(pe);let de=assetStore.getState().assets.items[v.node.skuID].proxy.data.scene.clone();de.position.set(se.x,se.y,se.z),de.applyQuaternion(le);let fe=new Vector3;fe.copy(ee.up).applyQuaternion(b.quaternion);let me=new Vector3;me.copy(de.up).applyQuaternion(le),me.negate();let ve=new Quaternion().setFromUnitVectors(fe,me);fe.round(),me.round();let _e=fe.dot(me);_e!==1&&_e!==-1&&de.applyQuaternion(ve);let De=de.getObjectByName(v.name),Le=new Quaternion().identity();De.getWorldQuaternion(Le);let ke=new Vector3(0,1,0);ke.applyQuaternion(Le);let We=new Vector3(0,1,0);We.applyQuaternion(le),We.negate();let Ue=new Quaternion().setFromUnitVectors(ke,We);if(ke.round(),We.round(),ke.dot(We)!==-1)de.applyQuaternion(Ue);else{let hr=new Vector3(0,1,0),cr=We.dot(hr);if(cr!==1&&cr!==-1)de.rotateOnAxis(hr,Math.PI);else{let Dr=new Vector3(0,0,1),zn=We.dot(Dr);if(zn!==1&&zn!==-1)de.rotateOnAxis(Dr,Math.PI);else{let ar=new Vector3(1,0,0),zr=We.dot(ar);zr!==1&&zr!==-1&&de.rotateOnAxis(ar,Math.PI)}}}let sn=de.getObjectByName(v.name),bt=new Vector3(sn.position.x,sn.position.y,sn.position.z);de.translateX(-bt.x),de.translateY(-bt.y),de.translateZ(-bt.z);let Ze=new Vector3(0,0,0);de.getWorldPosition(Ze);let yn=new Quaternion().identity();return de.getWorldQuaternion(yn),de=null,{position:Ze,rotation:yn}}findItemTransformRoot(e){let{receiverPlug:t,incomingPlug:n}=e,s=n;const o=new Object3D;let v=o,A=new Vector3(0,0,0);v.getWorldPosition(A);let b=new Quaternion().identity(),T=new Object3D;T.position.set(0,0,0),o.add(T);let ee=assetStore.getState().assets.items[s.node.skuID].proxy.data.scene.clone();T.attach(ee),ee.translateX(A.x),ee.translateY(A.y),ee.translateZ(A.z);let ne=ee.getObjectByName(s.name),re=new Quaternion().identity();ne&&ne.getWorldQuaternion(re);const se=new Vector3(0,1,0);se.applyQuaternion(re);const le=new Vector3(0,1,0);le.applyQuaternion(b);const pe=le.angleTo(se),de=new Vector3(0,0,0);de.crossVectors(le,se),de.round(),de.length()!==0&&ee.rotateOnAxis(de,pe);var fe=new Matrix4().extractRotation(ee.matrixWorld);let me=new Vector3(0,0,0);ne&&me.set(ne.position.x,ne.position.y,ne.position.z),me.applyMatrix4(fe),ee.translateX(-me.x),ee.translateY(-me.y),ee.translateZ(-me.z);let ve=new Vector3(0,0,0);ee.getWorldPosition(ve);let _e=new Quaternion().identity();return ee.getWorldQuaternion(_e),T.remove(ee),T=null,ee=null,{position:ve,rotation:_e}}findItemTransform(e){let{receiverPlug:t,incomingPlug:n}=e,s=t,o=n;if(s.node.isRoot)return this.findItemTransformRoot(e);const v=s.node.transform;if(!v)return;const A=assetStore.getState().assets.items[s.node.skuID].proxy.data.scene.clone(),b=new Object3D;b.position.set(v.position.x,v.position.y,v.position.z),v.rotation.isQuaternion===!0?b.setRotationFromQuaternion(v.rotation):v.rotation.isEuler===!0&&b.setRotationFromEuler(v.rotation),b.add(A);let T=b.getObjectByName(""+s.name);if(!T){LOGGER.error({title:"Plug: "+s.name+" doesn't exist in "+s.node.skuID});return}let ee=new Vector3(0,1,0);T.getWorldPosition(ee);let ne=new Quaternion().identity();T.getWorldQuaternion(ne);let re=assetStore.getState().assets.items[o.node.skuID].proxy.data.scene.clone();re.position.set(ee.x,ee.y,ee.z),re.applyQuaternion(ne);let se=new Vector3;se.copy(A.up).applyQuaternion(b.quaternion);let le=new Vector3;le.copy(re.up).applyQuaternion(ne),le.negate();let pe=new Quaternion().setFromUnitVectors(se,le);se.round(),le.round();let de=se.dot(le);de!==1&&de!==-1&&re.applyQuaternion(pe);let fe=re.getObjectByName(o.name);if(!fe){LOGGER.error({title:"Plug: "+o.name+" doesn't exist in "+o.node.skuID});return}let me=new Quaternion().identity();fe.getWorldQuaternion(me);let ve=new Vector3(0,1,0);ve.applyQuaternion(me);let _e=new Vector3(0,1,0);_e.applyQuaternion(ne),_e.negate();let De=new Quaternion().setFromUnitVectors(ve,_e);if(ve.round(),_e.round(),ve.dot(_e)!==-1)re.applyQuaternion(De);else{let sn=new Vector3(0,1,0),bt=_e.dot(sn);if(bt!==1&&bt!==-1)re.rotateOnAxis(sn,Math.PI);else{let Ze=new Vector3(0,0,1),yn=_e.dot(Ze);if(yn!==1&&yn!==-1)re.rotateOnAxis(Ze,Math.PI);else{let hr=new Vector3(1,0,0),cr=_e.dot(hr);cr!==1&&cr!==-1&&re.rotateOnAxis(hr,Math.PI)}}}let ke=re.getObjectByName(o.name),We=new Vector3(ke.position.x,ke.position.y,ke.position.z);re.translateX(-We.x),re.translateY(-We.y),re.translateZ(-We.z);let Ue=new Vector3(0,0,0);re.getWorldPosition(Ue);let Ge=new Quaternion().identity();return re.getWorldQuaternion(Ge),b.remove(A),re=null,{position:Ue,rotation:Ge}}getSpawningRequirementForSkuID(e){let t=[];const n=productDataStore$1.getState().productData,s=n[e];if(!s)return t;const o=[];return s.plugs.map(v=>{v.connectsToPlugTypes.map(A=>{o.push(A)})}),Object.keys(n).map(v=>{for(let A=0;A<n[v].plugs.length;A++){const b=n[v].plugs[A].acceptedPlugTypes;for(let T=0;T<b.length;T++)o.map(ee=>{ee==b[T]&&!t.includes(v)&&t.push(v)})}}),t}getConnectablePlugs(e,t){let n=[],s=e.getOpenPlugsWeCanAttachFrom();for(let o=0;o<s.length;o++)for(let v=0;v<t.length;v++){let A=!1;for(let T=0;T<n.length;T++)if(n[T].receiverPlug.guid==t[v].guid&&n[T].incomingPlug.type!="comboPlug"){A=!0;break}if(A)continue;s[o].canAttachToPlug(t[v])&&n.push({incomingPlug:s[o],receiverPlug:t[v]})}return n}getOpenPlugs(){let e=[];return this._nodes.map(t=>{if(t.dragging===!0)return;let n=t.getOpenPlugsFromNode();e=e.concat(n)}),e}checkCollisionforGUID(e,t=[]){if(coreSceneStore.getState().sceneSettings.disableCollider)return!1;const n=itemStore.getState().itemsSpawned,s=productDataStore$1.getState().productData;if(!n[e])return!1;const v=this.getNodeByGUID(e);if(!v||!v.ref||s[v.skuID].disableCollider)return!1;let A=new Vector3;v.ref.getWorldPosition(A);let b=new Quaternion;v.ref.getWorldQuaternion(b);const T={position:A,rotation:b},ee=v.whichPlugAreWeAttachedTo();return ee==null?!1:this.isColliding(v.skuID,T,ee,t)}isColliding(e,{position:t,rotation:n},s,o=[]){const v=assetStore.getState().assets.items[e].proxy.data.scene,A=productDataStore$1.getState().productData;if(!v)return!1;let b=v.clone();b.position.set(t.x,t.y,t.z),n.isQuaternion===!0?b.setRotationFromQuaternion(n):n.isEuler===!0&&b.setRotationFromEuler(n);let T=new Box3().setFromObject(b);var ee=new Vector3;T.getCenter(ee);let ne=new Object3D;ne.position.set(ee.x,ee.y,ee.z),ne.attach(b),ne.scale.set(this._boundingBoxLeeway,this._boundingBoxLeeway,this._boundingBoxLeeway),T=new Box3().setFromObject(ne);const re=[];if(this._nodes.forEach(le=>{if(s.node.guid==le.guid||Array.isArray(o)===!0&&o.includes(le.guid)||!le.ref||(A[le.skuID].hasOwnProperty("disableCollider")?A[le.skuID].disableCollider:coreSceneStore.getState().sceneSettings.disableCollider))return;const pe=le.ref.getObjectByName("GRP_ProxyMesh");pe&&re.push(pe)}),re.length<=0)return!1;let se=!1;return re.forEach(le=>{if(se)return;let pe=new Box3().setFromObject(le);if(T.intersectsBox(pe)){se=!0;return}}),ne.clear(),b=null,ne=null,T=null,se}boxOverlapPercent(e,t){if(e.containsBox(t)||t.containsBox(e))return 100;if(!(e.min.x<t.max.x||t.min.x<e.max.x))return 0;let n=new Vector3(0,0,0);e.getSize(n),n.x*n.y*n.z;let s=new Vector3(0,0,0);t.getSize(s),s.x*s.y*s.z}checkInsideOutCollision(e,t,n){let s=t.position.clone(),o=new Float32Array(n.attributes.position.array),v=o.length/3;for(let A=0;A<v;A++){let b=new Vector3(o[A*3],o[A*3+1],o[A*3+2]),T=b.add(t.position);T=b.applyQuaternion(t.quaternion);let ee=T.sub(t.position);const re=new Raycaster(s,ee.clone().normalize()).intersectObjects(e),se=re.length>0,le=re[0].distance<ee.length();if(se&&le)return!0}return!1}addNode(e){this._nodes.push(e)}getFirstNodeByCategoryID(e){for(var t=0;t<this._nodes.length;t++)if(this._nodes[t]._categoryID==e)return this._nodes[t];return null}getNodesBySKUID(e){let t=[];for(var n=0;n<this._nodes.length;n++)this._nodes[n].skuID==e&&t.push(this._nodes[n]);return t}getNodesByCategoryID(e){let t=[];for(var n=0;n<this._nodes.length;n++)this._nodes[n]._categoryID==e&&t.push(this._nodes[n]);return t}async connectPlugs({incomingPlug:e,receiverPlug:t}){e.attachPlug(t,!1),t.attachPlug(e,!0),await attachmentStore$1.getState().actions.toggleStructureUpdated()}removeNodeByGUID(e){for(let t=0;t<this._nodes.length;t++)if(this._nodes[t].guid==e){this._nodes[t].removeNode(),this._nodes.splice(t,1);break}this._nodes.length==1&&this.#t&&CORE_API.fireEvent(CORE_API.EVENTS.SCENE.Scene_Cleared,!0),attachmentStore$1.getState().actions.updateFittingSkuIds(),attachmentStore$1.getState().actions.toggleStructureUpdated()}async removeNodeFromStructure(e){for(let t=0;t<this._nodes.length;t++)if(this._nodes[t].guid==e.guid){this._nodes.splice(t,1);break}await attachmentStore$1.getState().actions.toggleStructureUpdated()}}class AttachmentSystem{constructor(){this._globalVariants={},this._globalGeometryVariants={},productDataStore$1.getState().categoryData.geometryVariants.map(e=>{this._globalGeometryVariants[e.id]=e.defaultVariant}),productDataStore$1.getState().categoryData.color.map(e=>{this._globalVariants[e.id]=e.defaultLook}),this._currentStructure=new Structure(null,this._globalVariants,this._globalGeometryVariants);for(const[e,t]of Object.entries(this._globalVariants))this.switchGlobalVariant(e,t);for(const[e,t]of Object.entries(this._globalGeometryVariants))this.switchGlobalGeometryVariant(e,t)}get globalGeometryVariants(){return this._globalGeometryVariants}get globalVariants(){return this._globalVariants}get currentStructure(){return this._currentStructure}getClientProductId(e,t){let n;return n=productDataStore$1.getState()?.productData[e]?.lookDetails[t],n?.clientProductId?n?.clientProductId:""}getCartItems(){let e=[];const t=inventoryStore.getState().inventoryData;this.currentStructure.nodes.map(o=>{if(o.skuID=="Root"||o.ignoreInCart===!0)return;let v=!1;if(e.map(T=>{const ee=t[T.skuID];if(T.skuID==o.skuID&&T.currentVariant==o.currentVariant){T.count++,T.countAvailable=ee[o.currentVariant].countAvailable,T.countUnavailable=ee[o.currentVariant].countUnavailable,T.price=o.price*T.count,v=!0;return}}),v===!0)return;let A={};A.skuID=o.skuID,A.currentVariant=o.currentVariant,A.clientProductId=this.getClientProductId(A.skuID,A.currentVariant),A.count=1;const b=t[A.skuID];A.price=o.price,A.countAvailable=b[o.currentVariant].countAvailable,A.countUnavailable=b[o.currentVariant].countUnavailable,e.push(A)});let n=0;for(const o of e)n=n+o.price;return{cartItems:e,details:{total:n.toFixed(2)}}}async getCartItemsAsync(){let e=[];const t=inventoryStore.getState().inventoryData;this.currentStructure.nodes.map(o=>{if(o.skuID=="Root"||o.ignoreInCart===!0)return;let v=!1;if(e.map(T=>{const ee=t[T.skuID];if(T.skuID==o.skuID&&T.currentVariant==o.currentVariant){T.count++,T.countAvailable=ee[o.currentVariant].countAvailable,T.countUnavailable=ee[o.currentVariant].countUnavailable,T.price=o.price*T.count,v=!0;return}}),v===!0)return;let A={};A.skuID=o.skuID,A.currentVariant=o.currentVariant,A.clientProductId=this.getClientProductId(A.skuID,A.currentVariant),A.count=1;const b=t[A.skuID];A.price=o.price,A.countAvailable=b[o.currentVariant].countAvailable,A.countUnavailable=b[o.currentVariant].countUnavailable,e.push(A)}),e=await DynamicHooks.hookOnCartItemsCollected(e,CORE_API);let n=0;for(const o of e)n=n+o.price;return{cartItems:e,details:{total:n.toFixed(2)}}}async getFittingSKUIDs(){const e=productDataStore$1.getState().productData;if(!this.currentStructure)return;const t=coreSceneStore.getState().sceneSettings.draggableUI;let n=this.currentStructure.nodes,s=[],o=[],v=[],A=[];if(n.map(T=>{A.push(T.skuID),T.plugs.map(ee=>{if(!ee.isOpen){ee.attachedPlug.node.replace&&ee.acceptedPlugTypes.map(ne=>{o.includes(ne)||o.push(ne)});return}ee.acceptedPlugTypes.map(ne=>{s.includes(ne)||s.push(ne)})})}),s.length<=0&&o.length<=0)return[];Object.keys(e).map(T=>{!e[T].plugs||v.includes(T)||e[T].plugs.map(ee=>{v.includes(T)||ee.connectsToPlugTypes.map(ne=>{if(!v.includes(T)){if(o.includes(ne)){if(!A.includes(T)||t){let re=this.currentStructure.getNodesByCategoryID(e[T].categoryID);for(const se of re){if(v.includes(T)||se.skuID==T)continue;let le=!0,pe=!1;se?.plugs.map(de=>{!de.isOpen&&de.isReceiverPlug&&(pe=!0,le=!1,e[T].plugs.map(fe=>{fe.name==de.name&&de.attachedPlug.connectsToPlugTypes.map(me=>{fe.acceptedPlugTypes.includes(me)&&(le=!0)})}))}),(le||!pe)&&v.push(T)}}}else if(s.includes(ne)){const re=this.currentStructure.getFirstNodeByCategoryID(e[T].categoryID);if(re&&re.replace)return;v.push(T)}}})})});let b=[];for(const T of v){if(b.includes(T))continue;if(e[T].replace){b.push(T);continue}const{transforms:ee,newNodes:ne,connectablePlugs:re}=await this.currentStructure.findGhostTransforms(T,coreSceneStore.getState().sceneSettings.ignoreSpawningCollision);ee.length>0&&b.push(T)}for(const T of b)e[T].replace;return b}async removeAllVariantOverrides(){let e=this._currentStructure.nodes,t=productDataStore$1.getState().productData,n=itemStore.getState().itemsSpawned;await e.map(async s=>{if(!s.overrideVariant||(s.overrideVariant=null,!t[s.skuID].looks))return;let o=null;Object.keys(this._globalVariants).map(v=>{t[s.skuID].looks.includes(this._globalVariants[v])&&o==null&&(o=this._globalVariants[v])}),o&&await itemStore.getState().actions.switchToVariant(n[s.guid].itemData,o)}),CORE_API.alert({alertMsg:"Changes to individual items in the scene have been cleared",alertTime:6e3,alertType:"info",alertLabel:"Overrides Removed",alertId:"overridesRemoved"}),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.MaterialOverrides_Exists,!1)}async switchGlobalGeometryVariant(e,t){const s=productDataStore$1.getState().categoryData.geometryVariants;let o=null;if(s.map(re=>{re.id==e&&(o=re)}),!o)return;const v=o.productsInCategory,b=o.variants[t].productsToSwitch,T=itemStore.getState().itemsSpawned;let ee=productDataStore$1.getState().categoryData;b.map(re=>{v.map(se=>{let le=!1;se.products.map(pe=>{re==pe&&(le=!0)}),le&&ee.build.map(pe=>{se.products.map(de=>{pe.skus.map((fe,me)=>{pe.skus[me]==de&&(pe.skus[me]=re)})})})})}),this._currentStructure.nodes.map(re=>{v.map(se=>{se.products.map(le=>{re.skuID==le&&re.ref!==null&&se.products.map(pe=>{b.map(de=>{if(de==pe){const fe=productDataStore$1.getState().actions.getProductDataById(de);let me=fe.geometriesToHide;re.plugs.map(_e=>{!_e.isOpen&&_e.attachedPlug&&_e.type=="weighted_hider"&&_e.attachedPlug.weight>_e.weight&&(me=me.concat(_e.affectedNodes))}),re.showNodes(fe.geometriesToShow),re.hideNodes(me),re.skuID=de;const ve=T[re.guid];ve&&ve.itemData&&Object.keys(fe).map(_e=>{ve.itemData[_e]=fe[_e]}),re.resetInStock(),re.updatePricing()}})})})})}),this._globalGeometryVariants[e]=t,hotspotStore$1.getState().actions.checkHotspotHealth(),inventoryStore.getState().actions.refreshInventory(T),productDataStore$1.setState({categoryData:ee}),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.CategoryData_Updated,ee),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.GlobalGeometryVariant_Updated,this._globalGeometryVariants);const ne=await this.getCartItemsAsync();ne&&CORE_API.fireEvent(CORE_API.EVENTS.SCENE.CartItems_Updated,ne)}async switchGlobalVariant(e,t){this._globalVariants[e]=t;const n=itemStore.getState().actions;let s=itemStore.getState().itemsSpawned;for(let b=0;b<Object.keys(s).length;b++){let T=s[Object.keys(s)[b]];if(T.itemData.looks&&T.itemData.looks.includes(t)){let ee=this._currentStructure.getNodeByGUID(T.itemData.guid);ee&&!ee.overrideVariant&&await n.switchToVariant(T.itemData,t)}}const o=productDataStore$1.getState().lookData;lightStore.getState().actions.processLookEnvMapOverride(t);const v=e;Object.keys(s).length>0&&CORE_API.alert({alertMsg:v.charAt(0).toUpperCase()+v.slice(1)+" was successfully switched to "+o[t].label+".",alertTime:3e3,alertType:"success",alertLabel:`${v} Changed`,alertId:"materialVariantChanged"}),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.GlobalVariant_Updated,this._globalVariants),itemStore.setState({variantChangeAlert:!itemStore.getState().variantChangeAlert});const A=await this.getCartItemsAsync();A&&CORE_API.fireEvent(CORE_API.EVENTS.SCENE.CartItems_Updated,A)}async#t(e){if(!e)return;LOGGER.info({title:"Structure to load",details:e}),delete this._currentStructure,this._globalVariants={...e.globalVariants},this._globalGeometryVariants=e.globalGeometryVariants?{...e.globalGeometryVariants}:{};const t=[...e.structure];this._currentStructure=new Structure(t,this._globalVariants,this._globalGeometryVariants);for(const[n,s]of Object.entries(this._globalVariants))this.switchGlobalVariant(n,s);for(const[n,s]of Object.entries(this._globalGeometryVariants))this.switchGlobalGeometryVariant(n,s);LOGGER.info({title:"Structure Loading..."}),await this._currentStructure.load(t),LOGGER.info({title:"Structure Loaded."})}async loadStructure(e){e&&(CORE_API.fireEvent(CORE_API.EVENTS.UI.PreloadScreen_Show),coreSceneStore.setState({configurationLoaded:!1}),await wait(500),await this._currentStructure.clear(),await this.#t(e),coreSceneStore.getState().preconfigurationLoaded?CORE_API.fireEvent(CORE_API.EVENTS.UI.PreloadScreen_Hide):coreSceneStore.setState({preconfigurationLoaded:!0}),coreSceneStore.getState().configurationLoadedOnRestart||coreSceneStore.setState({configurationLoadedOnRestart:!0}),coreSceneStore.setState({configurationLoaded:!0}),await attachmentStore$1.getState().actions.toggleStructureUpdated())}export(){return{structure:this._currentStructure.export(),globalVariants:this._globalVariants,globalGeometryVariants:this._globalGeometryVariants}}async clear(){CORE_API.fireEvent(CORE_API.EVENTS.UI.PreloadScreen_Show),this._currentStructure.clear(),CORE_API.fireEvent(CORE_API.EVENTS.UI.PreloadScreen_Hide)}async restart(){LOGGER.warn({title:"Restarting the Scene!!"}),itemStore.getState().selectedItemData&&itemStore.getState().actions.deselectItem();const e=attachmentStore$1.getState().defaultConfig;coreSceneStore.setState({configurationLoaded:!1,configurationLoadedOnRestart:!1}),CORE_API.fireEvent(CORE_API.EVENTS.UI.PreloadScreen_Show),await wait(500),await this._currentStructure.clear(),await this.#t(e),await attachmentStore$1.getState().actions.toggleStructureUpdated(),coreSceneStore.setState({configurationLoaded:!0,configurationLoadedOnRestart:!0}),CORE_API.fireEvent(CORE_API.EVENTS.UI.PreloadScreen_Hide)}}const attachmentStore=create$3((a,e)=>({attachmentSystem:null,defaultConfig:null,structureUpdated:!1,colliderMeshRef:null,placeholderRef:null,draggingItem:null,snappingThreshold:.5,actions:{initializeAttachmentSystem:async()=>{const{actions:t,defaultConfig:n}=e();LOGGER.info({title:"Initializing Attachment System!"});const s=await new AttachmentSystem;a({attachmentSystem:s}),await t.updateFittingSkuIds(),await t.toggleStructureUpdated()},loadSavedStructureFromConfigID:async t=>{LOGGER.info({title:"Fetching Structure Using ConfigID!"});const n=await getJSONFromEndpoint(FETCH_CONFIG_ENDPOINT+t);return n.success===!1?null:n.data},loadDefaultStructure:async()=>{const{actions:t,defaultConfig:n,attachmentSystem:s}=e();LOGGER.info({title:"Loading Default Structure!"}),await t.loadStructure(n)},updateFittingSkuIds:async()=>{const t=await attachmentStore.getState().attachmentSystem.getFittingSKUIDs();t&&(itemStore.setState({fittingSkuIds:[...t]}),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.FittingSkuIds_Updated,{skuids:t}))},toggleStructureUpdated:async()=>{const{attachmentSystem:t}=e();a(s=>({structureUpdated:!s.structureUpdated})),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.ReplaceableCategory_Updated,t.currentStructure.getCurrentItemsInReplaceableCategory());const n=await t.getCartItemsAsync();n&&CORE_API.fireEvent(CORE_API.EVENTS.SCENE.CartItems_Updated,n)},loadStructure:async t=>{const{attachmentSystem:n}=e();LOGGER.info({title:"Loading Structure!"}),n&&coreSceneStore.getState().configurationLoaded!==!1&&await n.loadStructure(t)},export:()=>{const{attachmentSystem:t}=e();if(t)return t.export()}}})),attachmentStore$1=attachmentStore,productDataStore=create$3((a,e)=>({productData:{},categoryData:{},lookData:{},hotspotsData:{},endpoints:{},assetsData:void 0,actions:{getCurrentPricingInfo:()=>{const{productData:t}=e();let n={};return Object.keys(t).map(s=>{if(s.toLowerCase()==="root")return;let o=t[s].lookDetails,v={};Object.keys(o).map(A=>{A!="default"&&(v[A]=o[A].price)}),n[s]=v}),n},updatePricingForAllProducts:t=>{const{actions:n}=e();Object.keys(t).map(s=>{let o=t[s];Object.keys(o).map(v=>{n.updatePricingForProduct(s,v,o[v])})})},updatePricingForProduct:(t,n,s)=>{const{productData:o}=e();let v=o[t];if(!v||!v.lookDetails)return;let A=v.lookDetails[n];if(!A)return;A.price=s,attachmentStore$1.getState().attachmentSystem.currentStructure.getNodesBySKUID(t).map(ee=>ee.updatePricing())},setProductData:t=>{let n={};t&&Object.keys(t).map(s=>{const o=t[s];if(o.skuID=s,o.skuID.toLowerCase()==="root"){o.lookDetails={default:{title:"",description:"",productPageUrl:"",thumbnails:{high:"",low:""},price:0}},o.defaultVariant="default";return}if(o?.lookDetails){const v=o.lookDetails;let A=Object.keys(o.lookDetails);if(A.includes("default")){const T=A.indexOf("default");A.splice(T,1)}o.looks=A,Object.keys(o.lookDetails).map(T=>{let ee=o.lookDetails[T];ee.inventory===void 0&&(ee.inventory=DEFAULT_INVENTORY),ee.price===void 0&&(ee.price=DEFAULT_PRODUCT_PRICE),n[s]={...n[s],[T]:{inventory:DEFAULT_INVENTORY,inScene:[]}}});let b=o?.defaultVariant;b||(LOGGER.warn({title:`No defaultVariant set for ${o.skuID}. Attempting to auto resolve but the colour variants behaviour might be unexpected!`}),b=Object.keys(o.lookDetails).sort()[0],LOGGER.warn({title:"Auto resolved default look ID: "+b})),A.includes(b)?(o.lookDetails.default=v[b],o.lookDetails.default.id=b):(LOGGER.error({title:`Default look [ ${b} ] doesn't exist for: ${s}. Please make sure to select a default variant in Input Data for this project`}),o.lookDetails.default=null)}}),LOGGER.info({title:"PRODUCT DATA: ",details:t}),inventoryStore.setState({inventoryData:n}),a({productData:t})},setCategoryData:t=>{const{productData:n}=e();t.geometryVariants!==void 0&&t.geometryVariants.map(s=>{s.defaultVariant===void 0&&Object.keys(s.variants).length>0&&(s.defaultVariant=Object.keys(s.variants)[0])}),t.color!==void 0&&t.color.map(s=>{(s.defaultLook===void 0&&s.looks.length>0||!s.looks.includes(s.defaultLook))&&(s.defaultLook=s.looks[0])}),a({categoryData:t}),t.build!==void 0&&t.build.map(s=>{s.skus.map(o=>{n[o].categoryID=s.categoryID,n[o].categoryLabel=s.label,n[o].swappable=s.swappable?s.swappable:!1,n[o].replace=s.replace})})},getProductDataById:t=>{const{productData:n}=e();let s=null;return n[t]&&(s=n[t]),s},setLookData:t=>a({lookData:t}),setHotspotsData:t=>{const{categoryData:n,productData:s}=e();n.geometryVariants&&Object.keys(t).map(o=>{t[o].map(v=>{v.geometryVariantID&&n.geometryVariants.map(A=>{Object.keys(A.variants).map(b=>{v.geometryVariantID==b&&A.productsInCategory.map(T=>{let ee=null;T.products.map(ne=>{t.hasOwnProperty(ne)&&(ee=t[ne])}),T.products.map(ne=>{t.hasOwnProperty(ne)||(t[ne]=ee)})})})})})}),a({hotspotsData:t})},setEndpoints:t=>{a({endpoints:t}),setGlobalEndpoints(t)},setAssetsData:t=>a({assetsData:t})}})),productDataStore$1=productDataStore,UtilityMenu=({handleShareButtonTrigger:a,handleSaveButtonTrigger:e,handleRestartButtonClick:t,handleShowHotspots:n,handleDimensionClick:s,handleInstructionButtonClick:o,utilityMenuVisible:v,hotspotsVisibility:A,viewInYourSpaceMenuBtnVisible:b,restartMenuBtnVisible:T,saveMenuBtnVisible:ee,hotspotsMenuBtnVisible:ne,instructionsMenuBtnVisible:re,dimensionsMenuBtnVisible:se,shareMenuBtnVisible:le,dimensionsVisible:pe,position:de,CORE_API:fe})=>{const[me,ve]=reactExports.useState("bottom"),_e=productDataStore$1(ke=>ke.assetsData),De=coreSceneStore(ke=>ke.sceneSettings),Le={ar:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/AR.svg",restart:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Restart.svg",save:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/save.svg",share:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Share.svg",dimensions:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Ruler.svg",hotspots:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Eye.svg",instructions:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Info.svg"};return reactExports.useEffect(()=>{switch(de){case"top":ve("top");break;case"bottom":ve("bottom");break;case"left":ve("left");break;case"right":ve("right");break}return()=>{}},[de]),jsxDevRuntimeExports.jsxDEV("div",{className:"shellCanvasContainerParent",id:me,children:jsxDevRuntimeExports.jsxDEV("div",{className:(v&&(le||b||T||se||ne||re))==!0?"shellCanvasContainer":"shellCanvasContainer shellCanvasContainerInactive",children:[b&&jsxDevRuntimeExports.jsxDEV(UtilityMenuButton,{buttonAction:()=>{fe.viewInYourSpace()},buttonLabel:De.textSettings.arButtonLabel,hoverLabel:De.textSettings.arHoverLabel,icon:_e?.icons?.utilityMenu?.viewInYourSpace?fe.getResolvedAssetUrl(_e?.icons?.utilityMenu?.viewInYourSpace):Le.ar},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/reactComponents/UtilityMenu.js",lineNumber:83,columnNumber:11},globalThis),T&&jsxDevRuntimeExports.jsxDEV(UtilityMenuButton,{buttonAction:()=>{t()},buttonLabel:De.textSettings.restartButtonLabel,hoverLabel:De.textSettings.restartHoverLabel,icon:_e?.icons?.utilityMenu?.restart?fe.getResolvedAssetUrl(_e?.icons?.utilityMenu?.restart):Le.restart},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/reactComponents/UtilityMenu.js",lineNumber:100,columnNumber:11},globalThis),ee&&jsxDevRuntimeExports.jsxDEV(UtilityMenuButton,{buttonAction:()=>{e()},buttonLabel:De.textSettings.saveButtonLabel,hoverLabel:De.textSettings.saveHoverLabel,icon:_e?.icons?.utilityMenu?.save?fe.getResolvedAssetUrl(_e?.icons?.utilityMenu?.save):Le.save},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/reactComponents/UtilityMenu.js",lineNumber:117,columnNumber:11},globalThis),le&&jsxDevRuntimeExports.jsxDEV(UtilityMenuButton,{buttonAction:()=>{a()},buttonLabel:De.textSettings.shareButtonLabel,hoverLabel:De.textSettings.shareHoverLabel,icon:_e?.icons?.utilityMenu?.share?fe.getResolvedAssetUrl(_e?.icons?.utilityMenu?.share):Le.share},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/reactComponents/UtilityMenu.js",lineNumber:134,columnNumber:11},globalThis),se&&jsxDevRuntimeExports.jsxDEV(UtilityMenuButton,{buttonAction:()=>{s()},buttonLabel:De.textSettings.sizeButtonLabel,hoverLabel:De.textSettings.sizeHoverLabel,icon:_e?.icons?.utilityMenu?.dimensions?fe.getResolvedAssetUrl(_e?.icons?.utilityMenu?.dimensions):Le.dimensions,activeCondition:pe},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/reactComponents/UtilityMenu.js",lineNumber:151,columnNumber:11},globalThis),ne&&jsxDevRuntimeExports.jsxDEV(UtilityMenuButton,{buttonAction:()=>{n()},buttonLabel:De.textSettings.hotspotsButtonLabel,hoverLabel:De.textSettings.hotspotsHoverLabel,icon:_e?.icons?.utilityMenu?.hotspots?fe.getResolvedAssetUrl(_e?.icons?.utilityMenu?.hotspots):Le.hotspots,activeCondition:A},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/reactComponents/UtilityMenu.js",lineNumber:170,columnNumber:11},globalThis),re&&jsxDevRuntimeExports.jsxDEV(UtilityMenuButton,{buttonAction:()=>{o()},buttonLabel:De.textSettings.instructionsButtonLabel,hoverLabel:De.textSettings.instructionsHoverLabel,icon:_e?.icons?.utilityMenu?.instructions?fe.getResolvedAssetUrl(_e?.icons?.utilityMenu?.instructions):Le.instructions},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/reactComponents/UtilityMenu.js",lineNumber:189,columnNumber:11},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/reactComponents/UtilityMenu.js",lineNumber:69,columnNumber:7},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/reactComponents/UtilityMenu.js",lineNumber:68,columnNumber:5},globalThis)};var propTypes$5={exports:{}},reactIs={exports:{}},reactIs_development={};/** @license React v16.13.1
9148
9148
  * react-is.development.js
9149
9149
  *
9150
9150
  * Copyright (c) Facebook, Inc. and its affiliates.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epigraph/configurator",
3
- "version": "1.12.2",
3
+ "version": "1.12.3",
4
4
  "description": "Epigraph Configurator web component.",
5
5
  "keywords": [],
6
6
  "main": "./dist/index.js",