@epigraph/solutions 1.0.5-alpha → 1.0.6
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.
|
@@ -4165,7 +4165,7 @@ ${l.join(`
|
|
|
4165
4165
|
${y.fragmentShader.replace("gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );","gl_FragColor = vec4( vec3( 0.0 ), ( 1.0 - fragCoordZ ) * darkness );")}
|
|
4166
4166
|
`},this.__depthMaterial.depthTest=!1,this.__depthMaterial.depthWrite=!1,this.__horizontalBlurMaterial=new Ni(p1),this.__horizontalBlurMaterial.depthTest=!1,this.__verticalBlurMaterial=new Ni(g1),this.__verticalBlurMaterial.depthTest=!1}reCalculate(){const e=this.__scene.background;this.__scene.background=null,this.__scene.overrideMaterial=this.__depthMaterial;const t=this.__targetRenderer.getClearAlpha();this.__targetRenderer.setClearAlpha(0),this.__targetRenderer.setRenderTarget(this.__renderTarget),this.__targetRenderer.render(this.__sceneHierarchyToCastShadow,this.__shadowCamera),this.__scene.overrideMaterial=null,this.__blurShadow(this.__shadowState.shadow.blur),this.__blurShadow(this.__shadowState.shadow.blur*.4),this.__targetRenderer.setRenderTarget(null),this.__targetRenderer.setClearAlpha(t),this.__scene.background=e}}class Et{static isTouchDevice(){try{return document.createEvent("TouchEvent"),!0}catch{return!1}}static async wait(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}static generateStylesDomElem(e,t=""){const i=document.createElement("style");return i.setAttribute("id",e),i.innerHTML=t,i}static generateHtmlDivElem(e,t=""){const i=document.createElement("div");return i.setAttribute("id",e),i.innerHTML=t,i}static getRandomIntegerInRange(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e}static getUrlParameterByName(e,t=window.location.search){const i=new URLSearchParams(t);return Object.fromEntries(i.entries())[e]}static getBaseUrl(){const e=Et.getUrlParameterByName("parentUrl");return e||window.location.href}static normalizeRadian(e){return Math.atan2(Math.sin(e),Math.cos(e))}static isBetweenOnCircle(e,t,i){return e=Et.normalizeRadian(e),t=Et.normalizeRadian(t),i=Et.normalizeRadian(i),t<=i?e>=t&&e<=i:e>=t||e<=i}static getPointInBetweenByPercentage(e,t,i){let a=t.clone().sub(e);const l=a.length();return a=a.normalize().multiplyScalar(l*i),e.clone().add(a)}static clampAzimuth(e,t,i){if(Math.abs(t)==1/0||i==1/0)return e;const a=Et.normalizeRadian(e),l=Et.normalizeRadian(t),h=Et.normalizeRadian(i);if(Et.isBetweenOnCircle(a,l,h))return a;const d=Math.abs(Et.normalizeRadian(a-l)),p=Math.abs(Et.normalizeRadian(a-h));return d<p?l:h}static resolveNexusEndpoint(e){let t=Md.PRODUCTION;return e=="local"?t=Md.LOCAL:e==="staging"&&(t=Md.STAGING),t}static parseUrlForEpigraphParams(e){const t=new Map,i=new Jm(e);t.set(Mi.epigraphSessionId,i.getParameterInUrl(Mi.epigraphSessionId)),t.set(Mi.identifier,i.getParameterInUrl(Mi.identifier)),t.set(Mi.identifierType,i.getParameterInUrl(Mi.identifierType)),t.set(Mi.type,i.getParameterInUrl(Mi.type));const a=i.getParameterInUrl(Mi.action);return a&&t.set(lh.AR,JSON.parse(a)[lh.AR]),t}static generateShareableUrl({baseUrl:e,identifier:t,identifierType:i,sharedConfig:a,arCompatible:l=!1}){const h=new Map;return h.set(Mi.epigraphSessionId,window.epigraph.epigraphSessionId),h.set(Mi.identifier,t),h.set(Mi.identifierType,i),a&&h.set(Mi.sharedConfig,a),l&&h.set(Mi.action,`{"${lh.AR}":true}`),new Jm(e).generateQrCodeUrl(Object.fromEntries(h.entries()),!1)}static _dispose3(e){e instanceof at&&e.geometry.dispose(),e instanceof at&&(Array.isArray(e.material)?e.material.forEach(t=>t.dispose()):e.material.dispose(),e.material?.map?.dispose())}static dispose3(e){e.traverse(t=>{t instanceof at&&Et._dispose3(t)}),(e instanceof at||e instanceof Dn)&&Et._dispose3(e)}static animateValue(e,t,i,a){const l=performance.now();function h(d){const p=d-l,g=Math.min(p/i,1),A=e+(t-e)*g;a(A),g<1&&requestAnimationFrame(h)}requestAnimationFrame(h)}static getCustomStylesTemplate(){const t=document.querySelector("#epigraphCustomStyles")?.content?.cloneNode(!0);return t||$e}}class vh{constructor(e){this._success=e}get success(){return this._success}set success(e){this._success=e}get failed(){return!this._success}}class DU extends vh{constructor(e=!1,t=void 0){super(e),this.__payload=t}get payload(){return this.__payload}set payload(e){this.__payload=e}}var A1=(o=>(o.Empty="entity-empty",o.Gltf="entity-mesh",o.Render="entity-render",o.Proxy="entity-proxy",o.Collider="entity-collider",o.Asset="entity-asset",o))(A1||{});class NU extends li{constructor(){super(),this._entityType=A1.Empty}get entityType(){return this._entityType}destroy(){let e;const t=new DU(!1,e);return e=void 0,t.success=!0,t.payload=e,t}}class wg{constructor(e){this.__name=e}getName(){return this.__name}}class Jr extends Lt{constructor(e){super(),this.epgType="PLUG",this.__connectionId="",this.__isPrimary=!1,this.__receiver=null,this.__debugGeo=null,this.__config=e,this.name=e.name,this.__connectionId=e.connectionId,this.__isPrimary=e.isPrimary;const t=e.position;this.position.set(t.x,t.y,t.z);const i=e.rotation;this.rotation.set(i.x,i.y,i.z)}get config(){return this.__config}get connectionId(){return this.__connectionId}get isPrimary(){return this.__isPrimary}get isOpen(){return this.__receiver===null}get receiver(){return this.__receiver}connect(e){this.__receiver=e.receiver}disconnect(){this.__receiver=null}clone(e){return new Jr(this.__config).copy(this,e)}showDebug(){const e=new se().setFromEuler(this.rotation).normalize(),t=this.position,i=.2,a=16711680;this.__debugGeo=new iC(e,t,i,a,.06,.06);const l=document.createElement("div");l.textContent=this.name;const h=new S_(l);l.style.pointerEvents="none";const d=new se;this.getWorldDirection(d),d.normalize();const p=this.position.clone().addScaledVector(d,Math.random());h.position.set(p.x,p.y,p.z),this.__debugGeo.add(h),this.add(this.__debugGeo)}hideDebug(){this.__debugGeo&&(this.__debugGeo.clear(),this.__debugGeo?.removeFromParent(),Et.dispose3(this.__debugGeo))}}class ur extends Lt{constructor(e){super(),this.epgType="RECEIVER",this.__connectionId="",this.__plug=null,this.__debugGeo=null,this.__config=e,this.name=e.name,this.__connectionId=e.connectionId;const t=e.position;this.position.set(t.x,t.y,t.z);const i=e.rotation;this.rotation.set(i.x,i.y,i.z)}get config(){return this.__config}get connectionId(){return this.__connectionId}get isOpen(){return this.__plug===null}get plug(){return this.__plug}connect(e){this.__plug=e.plug}disconnect(){this.__plug=null}clone(e){return new ur(this.__config).copy(this,e)}showDebug(){const e=new se().setFromEuler(this.rotation.clone()).normalize(),t=this.position,i=.1,a=65280;this.__debugGeo=new iC(e,t,i,a,.01,.08);const l=document.createElement("div");l.textContent=this.name,l.style.color="green";const h=new S_(l);l.style.pointerEvents="none",this.__debugGeo.add(h),this.add(this.__debugGeo)}hideDebug(){this.__debugGeo&&(this.__debugGeo.clear(),this.__debugGeo?.removeFromParent(),Et.dispose3(this.__debugGeo))}}var C_=(o=>(o.Gltf="media-asset-gltf",o.Proxy="media-asset-proxy",o.Render="media-asset-render",o))(C_||{}),e0=(o=>(o.Plug="plug",o.Receiver="receiver",o))(e0||{});class _1{constructor({id:e,uri:t,appWcRef:i}){this._type="media-asset-gltf",this._id=crypto.randomUUID(),this._loadingProgress=0,this._state="declared",this._resource=null,e&&(this._id=e),this._appWcRef=i,this._uri=t}get id(){return this._id}get uri(){return this._uri}get loadingProgress(){return this._loadingProgress}get state(){return this._state}get isLoaded(){return this._state==="loaded"}get type(){return this._type}get resource(){return this._resource}highlight(){}updateLoadingProgress(e){this._loadingProgress=e,this._appWcRef.eventsManager.assetLoadProgress.fire({progress:e})}async load(){if(this._state==="loaded"||this._state==="loading")return Promise.resolve(!0);this._state="loading";const e=await this._appWcRef.loaders.gltfLoader.loadAsync(this._uri,t=>{this.updateLoadingProgress(t.loaded/t.total*100)}).catch(t=>(window.epigraph.logger.groupCollapsed({title:""}),window.epigraph.logger.error({title:"An error occurred while trying to load an asset!",details:t}),this._state="failed",Promise.reject()));return e===void 0?Promise.reject(!1):(this._resource=e,await this._parseLoadedGltf(),this._state="loaded",Promise.resolve(!0))}async _parseLoadedGltf(){window.epigraph.logger.info({title:"Parsing GLTF data",details:this._resource})}unload(){return this._resource={},Promise.resolve(!0)}}class OU extends _1{constructor({id:e,uri:t,appWcRef:i}){super({id:e,uri:t,appWcRef:i}),this._type=C_.Proxy,this.__plugs=[],this.__receivers=[]}get plugs(){return this.__plugs}get receivers(){return this.__receivers}async _parseLoadedGltf(){if(!this._resource?.scene)return;const e=[];this._resource.scene.traverse(t=>{if(t.userData.epgType===e0.Receiver){const i=new ur({name:t.name,connectionId:t.userData.connectionId,position:t.position.clone(),rotation:t.rotation.clone()});this.__receivers.push(i),e.push(t)}else if(t.userData.epgType===e0.Plug){const i=new Jr({name:t.name,isPrimary:t.userData.isPrimary,connectionId:t.userData.connectionId,position:t.position.clone(),rotation:t.rotation.clone()});this.__plugs.push(i),e.push(t)}});for(const t of this.__receivers)this._resource.scene.add(t);for(const t of this.__plugs)this._resource.scene.add(t);for(const t of e)t.removeFromParent(),Et.dispose3(t)}unload(){return this._resource={},this.__plugs=[],this.__receivers=[],Promise.resolve(!0)}}class b1 extends _1{constructor({id:e,uri:t,appWcRef:i}){super({id:e,uri:t,appWcRef:i}),this._loggerContext="GLTF RENDER",this._type=C_.Render,this.__variantsExtensionName="KHR_materials_variants",this.__finishNamesFromAsset=[]}get khrVariantsExtensionName(){return this.__variantsExtensionName}get khrVariantsExtension(){return this.__variantsExtension}get finishNamesFromAsset(){return this.__finishNamesFromAsset}async _parseLoadedGltf(){this._resource?.scene.traverse(t=>{t instanceof at&&(t.castShadow=!0)});const e=this._resource?.userData?.gltfExtensions;if(!e){this.__variantsExtension=null,this.__finishNamesFromAsset=["default"];return}if(this.__variantsExtension=e[this.__variantsExtensionName],this.__variantsExtension?.variants)for(const t of this.__variantsExtension.variants)this.__finishNamesFromAsset.push(t.name)}unload(){return this._resource={},this.__variantsExtension={},this.__finishNamesFromAsset=[],Promise.resolve(!0)}}class y1{constructor(e,t){this._loggerContext="ASSET",this.__autoGenerateProxyEntity=!1,this.__finishes=new Map,this.__brandMaterialLibraries=new Map,this.__hotspots=[],this.__assetOverrides=null,this.__id=e.id,this.__name=e.name,this.__config=e,this.__appWcRef=t,this.__proxyGltf=new OU({id:String(e.id),uri:e.proxyGeo,appWcRef:this.__appWcRef}),this.__autoGenerateProxyEntity=e.autoGenerateProxyEntity,this.__renderGltf=new b1({id:String(e.id),uri:e.renderGeo,appWcRef:this.__appWcRef});for(const i in e.finishes)this.__finishes.set(i,new wg(i));e.brandMaterialLibraries||(e.brandMaterialLibraries=[]),e.hotspots&&(this.__hotspots=e.hotspots)}get id(){return this.__id}get name(){return this.__name}get assetRootDir(){return new URL(this.__renderGltf.uri+"/../../").href}get assetOverrides(){return this.__assetOverrides}get proxyGltf(){return this.__proxyGltf}get autoGenerateProxyEntity(){return this.__autoGenerateProxyEntity}get renderGltf(){return this.__renderGltf}get finishes(){return this.__finishes}get hotspots(){return this.__hotspots}get brandMaterialLibraries(){return this.__brandMaterialLibraries}get allFinishIds(){const e=[];for(const t of this.__finishes.keys())e.push(t);return e}async loadProxyGltf(){return this.__proxyGltf?await this.__proxyGltf.load():Promise.resolve(!0)}pullFinishesFromRenderGltf(){this.__renderGltf.finishNamesFromAsset.forEach(e=>{this.__finishes.has(e)||this.__finishes.set(e,new wg(e))})}async parseAssetOverrideJson(){let e=this.__renderGltf.resource?.asset.extras?.epgOverrides;if(!e)return null;e=e.replace("./","");const t=new URL(e,this.assetRootDir),i=await fetch(t).catch(a=>{window.epigraph.logger.error({title:`Failed to load asset override file: ${t}`,details:a})});i&&(this.__assetOverrides=await i.json())}async loadRenderGltf(e=!1){await this.__renderGltf.load().catch(t=>(window.epigraph.logger.error({title:`Failed to load asset: ${this.__id}`,details:t,contextOverride:this._loggerContext}),Promise.reject(!1)));for(const t of this.__config.brandMaterialLibraries){const i=this.__appWcRef.experienceData.materialLibraryCollection.materialLibraries.get(t);if(await i?.load(),!i){window.epigraph.logger.warn({title:`Material library ${t} not found in brand material libraries.`,contextOverride:this._loggerContext});continue}this.__brandMaterialLibraries.set(i.id,i);for(const a of i.finishNamesFromAsset)this.finishes.has(a)||this.__finishes.set(a,new wg(a))}return e&&this.pullFinishesFromRenderGltf(),await this.parseAssetOverrideJson(),Promise.resolve(!0)}async load(e=!1){return Promise.all([this.loadRenderGltf(e),this.loadProxyGltf()])}}var kU=Object.defineProperty,v1=(o,e,t,i)=>{for(var a=void 0,l=o.length-1,h;l>=0;l--)(h=o[l])&&(a=h(e,t,a)||a);return a&&kU(e,t,a),a};class w1{constructor({appWcRef:e}){this._loggerContext="SOLUTION MANAGER",this._appWcRef=e}initialize(){window.epigraph.logger.info({title:"Initializing...",contextOverride:this._loggerContext})}}const T_=class Od extends dl{constructor(){super(),this._loggerContext="SOLUTION MANAGER",this.enabled=!1}static{this.webComponentName="solution-manager"}connectedCallback(){super.connectedCallback(),window.epigraph.logger.info({title:"Initializing...",contextOverride:this._loggerContext})}firstUpdated(e){super.firstUpdated(e)}static setupWebComponent(){window.customElements.get(Od.webComponentName)||window.customElements.define(Od.webComponentName,Od)}render(){return Ee`
|
|
4167
4167
|
${Et.getCustomStylesTemplate()}
|
|
4168
|
-
`}};v1([he({type:Boolean,attribute:"enabled"})],T_.prototype,"enabled");v1([he({attribute:!1})],T_.prototype,"appWcRef");let Xf=T_;class UU{constructor({id:e,name:t,receiver:i,plug:a}){this.__name=t,this.__plug=a,this.__receiver=i,e?this.__id=e:this.__id=`${this.__receiver.uuid}-${this.__plug.uuid}`}get id(){return this.__id}get name(){return this.__name}get plug(){return this.__plug}isPrimary(){return this.__plug?.isPrimary}get receiver(){return this.__receiver}connect(){this.__receiver.connect(this),this.__plug.connect(this)}disconnect(){this.__plug&&this.__plug.disconnect(),this.__receiver&&this.__receiver.disconnect()}}class FU{constructor({id:e,receiver:t,plug:i}){this.__id=e,this.__plug=i,this.__receiver=t}get id(){return this.__id}get plug(){return this.__plug}set plug(e){this.__plug=e}get receiver(){return this.__receiver}set receiver(e){this.__receiver=e}disconnect(){this.__receiver.disconnect(),this.__plug.disconnect()}}class $U extends li{constructor(e){super(),this.name="ENTITIES",this._loggerContext="SCENE STRUCTURE",this.__appWcRef=e,this.__eventsManager=this.__appWcRef.eventsManager}async setupRootEntity(e,t){const i=await new y1({id:0,name:"Root",proxyGeo:e??"https://asset.myepigraph.com/configurator-assets/epigraph-solution-assets/staging-assets/pipeline-assets/3d-assets/proxies/root-proxy.glb",autoGenerateProxyEntity:!1,renderGeo:t??"https://asset.myepigraph.com/configurator-assets/epigraph-solution-assets/staging-assets/pipeline-assets/3d-assets/render/root-render.glb",finishes:{},hotspots:[],brandMaterialLibraries:[]},this.__appWcRef);await i.load().catch(()=>Promise.reject(!1));const a=new Va(i,this.__appWcRef);await a.initialize(),this.add(a),this.__rootEntity=a}get rootEntity(){return this.__rootEntity}isEmpty(){return this.__rootEntity===void 0||this.__rootEntity.children.length===0}isNotEmpty(){return!this.isEmpty()}addEntity(e){this.__rootEntity.add(e),this.__eventsManager.structureNodeAddedEvent.fire({node:e})}getFirstEntity(){return this.isEmpty()?null:this.getSceneEntities()[0]}getEntityForAssetName(e){const t=this.getSceneEntities();let i;for(const a of t)if(a.asset.name===e){i=a;break}return i}getEntityForAssetId(e){const t=this.getSceneEntities();let i;for(const a of t)if(a.asset.id===e){i=a;break}return i}getSceneEntities(e=!1){const t=[];return this.__rootEntity.traverse(i=>{!e&&i.uuid===this.__rootEntity.uuid||i instanceof Va&&t.push(i)}),t}getPossibleConnectionsForAssetInScene(e){const t=[];window.epigraph.logger.info({title:"Getting connections for asset in scene:",details:e,contextOverride:this._loggerContext});for(const i of this.getSceneEntities(!0)){const a=i.findPossibleConnectionsForAsset(e);a.length>0&&t.push(...a)}return window.epigraph.logger.table({title:"Possible Connections",details:t}),t}getAllConnectionsInScene(){const e=new Map;return this.traverse(t=>{if(t instanceof ur||t instanceof Jr){if(t.connectionId===""||e.has(t.connectionId))return;let a=null,l=null;if(t instanceof ur?(a=t,l=t.plug):t instanceof Jr&&(a=t.receiver,l=t),a!==null&&l!==null){const h=new FU({id:t.connectionId,receiver:a,plug:l});e.set(t.connectionId,h)}}}),e}}class zU extends w1{constructor(e){super({appWcRef:e}),this._loggerContext="SCENE MANAGER",this.__currentSceneBounds=new vi,this.__sceneStructure=new $U(this._appWcRef)}get sceneStructure(){return this.__sceneStructure}get currentSceneBounds(){return this.__currentSceneBounds}recalculateSceneBounds(){this.currentSceneBounds.setFromPoints([new se]),this.__sceneStructure.isNotEmpty()&&this.__sceneStructure.rootEntity.traverse(e=>{e instanceof at&&e.userData.isProxyMesh&&this.currentSceneBounds.expandByObject(e)}),this._appWcRef.eventsManager.sceneBoundsChanged.fire()}}class Va extends NU{constructor(e,t){super(),this.epgType="ENTITY_ASSET",this.__autoGeneratedProxy=new li,this.__proxyEntity=new li,this.__renderEntity=new li,this.__activeFinish="",this.__hotspots=new li,this.__renderEntityBoundsBox=new vi,this.__renderEntityBoundsSize=new se,this.__animationMixer=null,this.__animations=new Map,this.name=e.name,this.__appWcRef=t,this.__proxyEntity.name="PROXY",this.add(this.__proxyEntity),this.__renderEntity.name="RENDER",this.add(this.__renderEntity),this.__hotspots.name="HOTSPOTS",this.add(this.__hotspots),this.__asset=e}get asset(){return this.__asset}get isRoot(){return this.name.toLowerCase()==="root"}get proxy(){return this.__proxyEntity}get render(){return this.__renderEntity}get activeFinish(){return this.__activeFinish}get allAssetFinishes(){return this.__asset.finishes}get allFinishIds(){return this.__asset.allFinishIds}highlight(){this.__renderEntity.traverseVisible(e=>{const t=e;if(t.isMesh){const i=t.material;if(!i.emissive)return;(i.emissive.r>0||i.emissive.g>0||i.emissive.b>0)&&(i.userData.epgData={orignalEmissive:i.emissive.clone(),originalEmissiveIntensity:i.emissiveIntensity}),i.emissive.r=1,i.emissive.g=1,i.emissive.b=1,i.emissiveIntensity=1}})}unhighlight(){this.__renderEntity.traverseVisible(e=>{const t=e;if(t.isMesh){const i=t.material;if(!i.emissive)return;const a=i?.userData?.epgData?.orignalEmissive;a?(i.emissive.r=a.r,i.emissive.g=a.g,i.emissive.b=a.b):(i.emissive.r=0,i.emissive.g=0,i.emissive.b=0);const l=i?.userData?.epgData?.orignalEmissiveIntensity;i.emissiveIntensity=l!==void 0?l:0}})}addHotspot(e){e.entity.name=`HOTSPOT-${this.asset.name}-${crypto.randomUUID()}`,e.entity.userData.epgId=e.hotspotId,e.entity.position.set(e.config.position.x,e.config.position.y,e.config.position.z),this.__hotspots.add(e.entity)}removeHotspot(e){let t;this.__hotspots.traverse(i=>{i.userData.epgId===e&&(t=i)}),t&&(t.removeFromParent(),Et.dispose3(t))}__selectFinishByKHRMaterialsVariantsExtension(e,t,i,a){const l=new vh(!1);window.epigraph.logger.info({title:"Loading finish by KHR Materials Variants",details:i});const h=e.variants.findIndex(d=>d.name===i);return this.__renderEntity.traverse(async d=>{if(!(d instanceof at)||!d.isMesh||!d.userData.gltfExtensions)return;const p=d.userData.gltfExtensions[t];if(!p)return window.epigraph.logger.error({title:"No variants extension found in mesh.",details:p}),Promise.reject(l);d.userData.originalMaterial||(d.userData.originalMaterial=d.material);const g=p.mappings.find(A=>A.variants.includes(h));if(g&&a.resource){const A=a.resource.parser;d.material=await A.getDependency("material",g.material),A.assignFinalMaterial(d),l.success=!0}else window.epigraph.logger.info({title:"Variant has no effect on this Object.",details:{object:d,finishId:i}}),d.material=d.userData.originalMaterial,l.success=!1}),l}async __selectFinishByMaterialLibrary(e,t,i){const a=new vh(!1);window.epigraph.logger.info({title:"Loading finish by material library",details:i});for(const l of this.asset.brandMaterialLibraries.values()){const h=l.resource?.scene.children[0];if(!h)continue;const d=l.finishNamesFromAsset,p={};for(const A of h.userData.gltfExtensions[t].mappings){const _=d[A.variants[0]];p[_]=A.material}if(!p[i])continue;const g=await l.resource.parser.getDependency("material",p[i]);this.__renderEntity.traverse(async A=>{A instanceof at&&(A.material=g,await this.__processAnyOverridesForAsset(i,A),A.material.needsUpdate=!0)})}return a.success=!1,a}async __processAnyOverridesForAsset(e,t){const i=this.__asset.assetOverrides;if(!i)return;const a=i.brandMaterialLibrary;if(a){const l=a[e];if(l)for(const h of l){const d=h.name,p=h.value,g=h.type,A=t.material;if(d in A)switch(window.epigraph.logger.info({title:`Override Property on asset: ${this.asset.id} MLIB: ${d} -> overrides[override]`}),g){case"image":await this.__processImageOverride(d,p,A);break;case"color":await this.__processColorOverride(d,p,A);break;case"number":await this.__processNumberOverride(d,p,A);break}}}}async __processImageOverride(e,t,i){const a=new URL(t,`${this.__asset.assetRootDir}overrides/`).href,l=await this.__appWcRef.loaders.textureLoader.loadAsync(a).catch(h=>{window.epigraph.logger.error({title:`Couldn't load texture: ${a}`,details:h,contextOverride:"ASSET ENTITY"})});l&&(i[e]=l)}__processColorOverride(e,t,i){const a=JSON.parse(t);i[e]=new je(a[0],a[1],a[2])}__processNumberOverride(e,t,i){i[e]=t}async selectAssetFinish(e){window.epigraph.logger.info({title:`Switching to asset finish: ${e}`});const t=new vh(!1),i=this.__asset.renderGltf;if(!i)return Promise.reject(t);const a=i.khrVariantsExtension,l=i.khrVariantsExtensionName;if(!a?.variants)return window.epigraph.logger.warn({title:"No KHR_Materials_Variants found in asset. Using default material."}),this.allFinishIds.length===1&&this.allFinishIds.includes(e)&&(this.__activeFinish=e),t.success=!0,Promise.resolve(t);const h=await this.__selectFinishByKHRMaterialsVariantsExtension(a,l,e,i);if(t.success=h.success,t.failed===!0){const d=await this.__selectFinishByMaterialLibrary(a,l,e);t.success=d.success}return this.__activeFinish=e,Promise.resolve(t)}findPossibleConnectionsForAsset(e){const t=[];return window.epigraph.logger.info({title:"Getting connections for asset in scene:",details:e}),this.__proxyEntity.traverse(i=>{if(!(i instanceof ur))return;const a=i,l=e.proxyGltf?.plugs??[];for(const h of l)h.connectionId===a.connectionId&&t.push(new UU({name:h.connectionId,receiver:a,plug:h}))}),t}getAnimationMixer(){return this.__animationMixer}getAllAnimations(){return this.__animations}async initialize(){this.__asset.autoGenerateProxyEntity?(await this.__initializeRenderEntity(),await this.__initializeProxyEntity()):(await this.__initializeProxyEntity(),await this.__initializeRenderEntity())}async __initializeRenderEntity(){const e=this.__asset?.renderGltf?.resource?.scene?.clone(!0);if(!e)return Promise.reject();this.__renderEntity.add(e),this.__renderEntityBoundsBox.setFromObject(e,!0),this.__renderEntityBoundsBox.getSize(this.__renderEntityBoundsSize);const t=new se;if(this.__renderEntityBoundsBox.getCenter(t),this.__asset.autoGenerateProxyEntity){window.epigraph.logger.group({title:""}),window.epigraph.logger.info({title:"Attempting to place render geo at the grid for AssetEntity...",details:this.__asset,contextOverride:"ASSET ENTITY"});const i=new li;i.name="rendergeopivot";const a=new Wn(.01,.01,.01),l=new wi({color:65280,depthTest:!1}),h=new at(a,l);i.add(h),this.__renderEntity.add(i),i.position.set(t.x,this.__renderEntityBoundsBox.min.y,t.z),i.attach(e),i.position.set(0,0,0),this.__renderEntity.attach(e),i.removeFromParent(),Et.dispose3(i),window.epigraph.logger.info({title:"Done!!"}),window.epigraph.logger.groupEnd()}this.__updateAnimations()}async __initializeProxyEntity(){let e=this.__asset.proxyGltf.resource?.scene.clone();if((!e||this.__asset.autoGenerateProxyEntity)&&(this.__autoGenerateProxyScene(),e=this.__autoGeneratedProxy),!e)return window.epigraph.logger.error({title:"Failed to load OR auto generate proxy asset",details:this.__asset,contextOverride:"ASSET ENTITY"}),Promise.reject();this.__proxyEntity.add(e),this.__proxyEntity.traverse(t=>{t instanceof at&&(t.userData.isProxyMesh=!0,t.visible=!1)})}__autoGenerateProxyScene(){window.epigraph.logger.info({title:"Attempting to auto generate proxy for asset...",details:this.__asset,contextOverride:"ASSET ENTITY"});const e=new Wn,t=new wi({color:65280,opacity:.5,transparent:!0}),i=new at(e,t);i.name="AutoGeneratedProxyMesh",i.scale.set(this.__renderEntityBoundsSize.x,this.__renderEntityBoundsSize.y,this.__renderEntityBoundsSize.z);const a=new se;this.__renderEntityBoundsBox.getCenter(a);const l=new li;l.name="proxygeopivot";const h=new Gf(.01,10,10),d=new wi({color:255,depthTest:!1}),p=new at(h,d);l.add(p),this.__proxyEntity.add(l),l.translateY(-this.__renderEntityBoundsSize.y*.5),l.attach(i),l.position.set(0,0,0),this.__proxyEntity.add(i),l.removeFromParent(),Et.dispose3(l),this.__autoGeneratedProxy.add(i)}__updateAnimations(){if(this.__animationMixer=null,this.__animations.clear(),this.__renderEntity.animations&&this.__asset.renderGltf.resource&&this.__asset.renderGltf.resource.animations.length>0){this.__animationMixer=new eC(this.__renderEntity.children[0]);for(const e of this.__asset.renderGltf.resource.animations)this.__animations.set(e.name,this.__animationMixer.clipAction(e))}}}function E1(o,e,t,i){const a=Object.entries(o);class l extends Ni{static key=Ms.generateUUID();constructor(d){super({uniforms:a.reduce((p,[g,A])=>{const _=X0.clone({[g]:{value:A}});return{...p,..._}},{}),vertexShader:e,fragmentShader:t});for(const[p]of a)Object.defineProperty(this,p,{get:()=>this.uniforms[p].value,set:g=>this.uniforms[p].value=g});Object.assign(this,d)}}return l}const GU=E1({},"void main() { }","void main() { gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); discard; }");function HU(o){return o.isLight}function VU(o){return!!o.geometry}const QU=E1({color:new je(0),blend:2,alphaTest:.75,opacity:0,map:null},`varying vec2 vUv;
|
|
4168
|
+
`}};v1([he({type:Boolean,attribute:"enabled"})],T_.prototype,"enabled");v1([he({attribute:!1})],T_.prototype,"appWcRef");let Xf=T_;class UU{constructor({id:e,name:t,receiver:i,plug:a}){this.__name=t,this.__plug=a,this.__receiver=i,e?this.__id=e:this.__id=`${this.__receiver.uuid}-${this.__plug.uuid}`}get id(){return this.__id}get name(){return this.__name}get plug(){return this.__plug}isPrimary(){return this.__plug?.isPrimary}get receiver(){return this.__receiver}connect(){this.__receiver.connect(this),this.__plug.connect(this)}disconnect(){this.__plug&&this.__plug.disconnect(),this.__receiver&&this.__receiver.disconnect()}}class FU{constructor({id:e,receiver:t,plug:i}){this.__id=e,this.__plug=i,this.__receiver=t}get id(){return this.__id}get plug(){return this.__plug}set plug(e){this.__plug=e}get receiver(){return this.__receiver}set receiver(e){this.__receiver=e}disconnect(){this.__receiver.disconnect(),this.__plug.disconnect()}}class $U extends li{constructor(e){super(),this.name="ENTITIES",this._loggerContext="SCENE STRUCTURE",this.__appWcRef=e,this.__eventsManager=this.__appWcRef.eventsManager}async setupRootEntity(e,t){const i=await new y1({id:0,name:"Root",proxyGeo:e??"https://asset.myepigraph.com/configurator-assets/epigraph-solution-assets/staging-assets/pipeline-assets/3d-assets/proxies/root-proxy.glb",autoGenerateProxyEntity:!1,renderGeo:t??"https://asset.myepigraph.com/configurator-assets/epigraph-solution-assets/staging-assets/pipeline-assets/3d-assets/render/root-render.glb",finishes:{},hotspots:[],brandMaterialLibraries:[]},this.__appWcRef);await i.load().catch(()=>Promise.reject(!1));const a=new Va(i,this.__appWcRef);await a.initialize(),this.add(a),this.__rootEntity=a}get rootEntity(){return this.__rootEntity}isEmpty(){return this.__rootEntity===void 0||this.__rootEntity.children.length===0}isNotEmpty(){return!this.isEmpty()}addEntity(e){this.__rootEntity.add(e),this.__eventsManager.structureNodeAddedEvent.fire({node:e})}getFirstEntity(){return this.isEmpty()?null:this.getSceneEntities()[0]}getEntityForAssetName(e){const t=this.getSceneEntities();let i;for(const a of t)if(a.asset.name===e){i=a;break}return i}getEntityForAssetId(e){const t=this.getSceneEntities();let i;for(const a of t)if(a.asset.id===e){i=a;break}return i}getSceneEntities(e=!1){const t=[];return this.__rootEntity.traverse(i=>{!e&&i.uuid===this.__rootEntity.uuid||i instanceof Va&&t.push(i)}),t}getPossibleConnectionsForAssetInScene(e){const t=[];window.epigraph.logger.info({title:"Getting connections for asset in scene:",details:e,contextOverride:this._loggerContext});for(const i of this.getSceneEntities(!0)){const a=i.findPossibleConnectionsForAsset(e);a.length>0&&t.push(...a)}return window.epigraph.logger.table({title:"Possible Connections",details:t}),t}getAllConnectionsInScene(){const e=new Map;return this.traverse(t=>{if(t instanceof ur||t instanceof Jr){if(t.connectionId===""||e.has(t.connectionId))return;let a=null,l=null;if(t instanceof ur?(a=t,l=t.plug):t instanceof Jr&&(a=t.receiver,l=t),a!==null&&l!==null){const h=new FU({id:t.connectionId,receiver:a,plug:l});e.set(t.connectionId,h)}}}),e}}class zU extends w1{constructor(e){super({appWcRef:e}),this._loggerContext="SCENE MANAGER",this.__currentSceneBounds=new vi,this.__sceneStructure=new $U(this._appWcRef)}get sceneStructure(){return this.__sceneStructure}get currentSceneBounds(){return this.__currentSceneBounds}recalculateSceneBounds(){this.currentSceneBounds.setFromPoints([new se]),this.__sceneStructure.isNotEmpty()&&this.__sceneStructure.rootEntity.traverse(e=>{e instanceof at&&e.userData.isProxyMesh&&this.currentSceneBounds.expandByObject(e)}),this._appWcRef.eventsManager.sceneBoundsChanged.fire()}}class Va extends NU{constructor(e,t){super(),this.epgType="ENTITY_ASSET",this.__autoGeneratedProxy=new li,this.__proxyEntity=new li,this.__renderEntity=new li,this.__activeFinish="",this.__hotspots=new li,this.__renderEntityBoundsBox=new vi,this.__renderEntityBoundsSize=new se,this.__animationMixer=null,this.__animations=new Map,this.name=e.name,this.__appWcRef=t,this.__proxyEntity.name="PROXY",this.add(this.__proxyEntity),this.__renderEntity.name="RENDER",this.add(this.__renderEntity),this.__hotspots.name="HOTSPOTS",this.add(this.__hotspots),this.__asset=e}get asset(){return this.__asset}get isRoot(){return this.name.toLowerCase()==="root"}get proxy(){return this.__proxyEntity}get render(){return this.__renderEntity}get activeFinish(){return this.__activeFinish}get allAssetFinishes(){return this.__asset.finishes}get allFinishIds(){return this.__asset.allFinishIds}highlight(){this.__renderEntity.traverseVisible(e=>{const t=e;if(t.isMesh){const i=t.material;if(!i.emissive)return;(i.emissive.r>0||i.emissive.g>0||i.emissive.b>0)&&(i.userData.epgData={orignalEmissive:i.emissive.clone(),originalEmissiveIntensity:i.emissiveIntensity}),i.emissive.r=1,i.emissive.g=1,i.emissive.b=1,i.emissiveIntensity=1}})}unhighlight(){this.__renderEntity.traverseVisible(e=>{const t=e;if(t.isMesh){const i=t.material;if(!i.emissive)return;const a=i?.userData?.epgData?.orignalEmissive;a?(i.emissive.r=a.r,i.emissive.g=a.g,i.emissive.b=a.b):(i.emissive.r=0,i.emissive.g=0,i.emissive.b=0);const l=i?.userData?.epgData?.orignalEmissiveIntensity;i.emissiveIntensity=l!==void 0?l:0}})}addHotspot(e){e.entity.name=`HOTSPOT-${this.asset.name}-${crypto.randomUUID()}`,e.entity.userData.epgId=e.hotspotId,e.entity.position.set(e.config.position.x,e.config.position.y,e.config.position.z),this.__hotspots.add(e.entity)}removeHotspot(e){let t;this.__hotspots.traverse(i=>{i.userData.epgId===e&&(t=i)}),t&&(t.removeFromParent(),Et.dispose3(t))}__selectFinishByKHRMaterialsVariantsExtension(e,t,i,a){const l=new vh(!1);window.epigraph.logger.info({title:"Loading finish by KHR Materials Variants",details:i});const h=e.variants.findIndex(d=>d.name===i);return this.__renderEntity.traverse(async d=>{if(!(d instanceof at)||!d.isMesh||!d.userData.gltfExtensions)return;const p=d.userData.gltfExtensions[t];if(!p)return window.epigraph.logger.error({title:"No variants extension found in mesh.",details:p}),Promise.reject(l);d.userData.originalMaterial||(d.userData.originalMaterial=d.material);const g=p.mappings.find(A=>A.variants.includes(h));if(g&&a.resource){const A=a.resource.parser;d.material=await A.getDependency("material",g.material),A.assignFinalMaterial(d),l.success=!0}else window.epigraph.logger.info({title:"Variant has no effect on this Object.",details:{object:d,finishId:i}}),d.material=d.userData.originalMaterial,l.success=!1}),l}async __selectFinishByMaterialLibrary(e,t,i){const a=new vh(!1);window.epigraph.logger.info({title:"Loading finish by material library",details:i});for(const l of this.asset.brandMaterialLibraries.values()){const h=l.resource?.scene.children[0];if(!h)continue;const d=l.finishNamesFromAsset,p={};for(const A of h.userData.gltfExtensions[t].mappings){const _=d[A.variants[0]];p[_]=A.material}if(!p[i])continue;const g=await l.resource.parser.getDependency("material",p[i]);this.__renderEntity.traverse(async A=>{A instanceof at&&(A.material=g,await this.__processAnyOverridesForAsset(i,A),A.material.needsUpdate=!0)})}return a.success=!1,a}async __processAnyOverridesForAsset(e,t){const i=this.__asset.assetOverrides;if(!i)return;const a=i.brandMaterialLibrary;if(a){const l=a[e];if(l)for(const h of l){const d=h.name,p=h.value,g=h.type,A=t.material;if(d in A)switch(window.epigraph.logger.info({title:`Override Property on asset: ${this.asset.id} MLIB: ${d} -> overrides[override]`}),g){case"image":await this.__processImageOverride(d,p,A);break;case"color":await this.__processColorOverride(d,p,A);break;case"number":await this.__processNumberOverride(d,p,A);break}}}}async __processImageOverride(e,t,i){const a=new URL(t,`${this.__asset.assetRootDir}overrides/`).href,l=await this.__appWcRef.loaders.textureLoader.loadAsync(a).catch(h=>{window.epigraph.logger.error({title:`Couldn't load texture: ${a}`,details:h,contextOverride:"ASSET ENTITY"})});l&&(l.flipY=!1,i[e]=l)}__processColorOverride(e,t,i){const a=JSON.parse(t);i[e]=new je(a[0],a[1],a[2])}__processNumberOverride(e,t,i){i[e]=t}async selectAssetFinish(e){window.epigraph.logger.info({title:`Switching to asset finish: ${e}`});const t=new vh(!1),i=this.__asset.renderGltf;if(!i)return Promise.reject(t);const a=i.khrVariantsExtension,l=i.khrVariantsExtensionName;if(!a?.variants)return window.epigraph.logger.warn({title:"No KHR_Materials_Variants found in asset. Using default material."}),this.allFinishIds.length===1&&this.allFinishIds.includes(e)&&(this.__activeFinish=e),t.success=!0,Promise.resolve(t);const h=await this.__selectFinishByKHRMaterialsVariantsExtension(a,l,e,i);if(t.success=h.success,t.failed===!0){const d=await this.__selectFinishByMaterialLibrary(a,l,e);t.success=d.success}return this.__activeFinish=e,Promise.resolve(t)}findPossibleConnectionsForAsset(e){const t=[];return window.epigraph.logger.info({title:"Getting connections for asset in scene:",details:e}),this.__proxyEntity.traverse(i=>{if(!(i instanceof ur))return;const a=i,l=e.proxyGltf?.plugs??[];for(const h of l)h.connectionId===a.connectionId&&t.push(new UU({name:h.connectionId,receiver:a,plug:h}))}),t}getAnimationMixer(){return this.__animationMixer}getAllAnimations(){return this.__animations}async initialize(){this.__asset.autoGenerateProxyEntity?(await this.__initializeRenderEntity(),await this.__initializeProxyEntity()):(await this.__initializeProxyEntity(),await this.__initializeRenderEntity())}async __initializeRenderEntity(){const e=this.__asset?.renderGltf?.resource?.scene?.clone(!0);if(!e)return Promise.reject();this.__renderEntity.add(e),this.__renderEntityBoundsBox.setFromObject(e,!0),this.__renderEntityBoundsBox.getSize(this.__renderEntityBoundsSize);const t=new se;if(this.__renderEntityBoundsBox.getCenter(t),this.__asset.autoGenerateProxyEntity){window.epigraph.logger.group({title:""}),window.epigraph.logger.info({title:"Attempting to place render geo at the grid for AssetEntity...",details:this.__asset,contextOverride:"ASSET ENTITY"});const i=new li;i.name="rendergeopivot";const a=new Wn(.01,.01,.01),l=new wi({color:65280,depthTest:!1}),h=new at(a,l);i.add(h),this.__renderEntity.add(i),i.position.set(t.x,this.__renderEntityBoundsBox.min.y,t.z),i.attach(e),i.position.set(0,0,0),this.__renderEntity.attach(e),i.removeFromParent(),Et.dispose3(i),window.epigraph.logger.info({title:"Done!!"}),window.epigraph.logger.groupEnd()}this.__updateAnimations()}async __initializeProxyEntity(){let e=this.__asset.proxyGltf.resource?.scene.clone();if((!e||this.__asset.autoGenerateProxyEntity)&&(this.__autoGenerateProxyScene(),e=this.__autoGeneratedProxy),!e)return window.epigraph.logger.error({title:"Failed to load OR auto generate proxy asset",details:this.__asset,contextOverride:"ASSET ENTITY"}),Promise.reject();this.__proxyEntity.add(e),this.__proxyEntity.traverse(t=>{t instanceof at&&(t.userData.isProxyMesh=!0,t.visible=!1)})}__autoGenerateProxyScene(){window.epigraph.logger.info({title:"Attempting to auto generate proxy for asset...",details:this.__asset,contextOverride:"ASSET ENTITY"});const e=new Wn,t=new wi({color:65280,opacity:.5,transparent:!0}),i=new at(e,t);i.name="AutoGeneratedProxyMesh",i.scale.set(this.__renderEntityBoundsSize.x,this.__renderEntityBoundsSize.y,this.__renderEntityBoundsSize.z);const a=new se;this.__renderEntityBoundsBox.getCenter(a);const l=new li;l.name="proxygeopivot";const h=new Gf(.01,10,10),d=new wi({color:255,depthTest:!1}),p=new at(h,d);l.add(p),this.__proxyEntity.add(l),l.translateY(-this.__renderEntityBoundsSize.y*.5),l.attach(i),l.position.set(0,0,0),this.__proxyEntity.add(i),l.removeFromParent(),Et.dispose3(l),this.__autoGeneratedProxy.add(i)}__updateAnimations(){if(this.__animationMixer=null,this.__animations.clear(),this.__renderEntity.animations&&this.__asset.renderGltf.resource&&this.__asset.renderGltf.resource.animations.length>0){this.__animationMixer=new eC(this.__renderEntity.children[0]);for(const e of this.__asset.renderGltf.resource.animations)this.__animations.set(e.name,this.__animationMixer.clipAction(e))}}}function E1(o,e,t,i){const a=Object.entries(o);class l extends Ni{static key=Ms.generateUUID();constructor(d){super({uniforms:a.reduce((p,[g,A])=>{const _=X0.clone({[g]:{value:A}});return{...p,..._}},{}),vertexShader:e,fragmentShader:t});for(const[p]of a)Object.defineProperty(this,p,{get:()=>this.uniforms[p].value,set:g=>this.uniforms[p].value=g});Object.assign(this,d)}}return l}const GU=E1({},"void main() { }","void main() { gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); discard; }");function HU(o){return o.isLight}function VU(o){return!!o.geometry}const QU=E1({color:new je(0),blend:2,alphaTest:.75,opacity:0,map:null},`varying vec2 vUv;
|
|
4169
4169
|
void main() {
|
|
4170
4170
|
gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.);
|
|
4171
4171
|
vUv = uv;
|
|
@@ -8360,7 +8360,7 @@ void main() {
|
|
|
8360
8360
|
`:Ee`
|
|
8361
8361
|
${super.render()}
|
|
8362
8362
|
${this.__renderQrModal()}
|
|
8363
|
-
`}};ho([Ut("#modelViewer")],ia.prototype,"modelViewerElem");ho([Ut("#arModal")],ia.prototype,"arModalElem");ho([Ut("#qrModal")],ia.prototype,"qrModalElem");ho([he({attribute:!1})],ia.prototype,"appWcRef");ho([he({type:String,attribute:"glb-src"})],ia.prototype,"glbSrc");ho([he({type:String,attribute:"usdz-src"})],ia.prototype,"usdzSrc");ho([he({type:Boolean,attribute:"debug"})],ia.prototype,"debug");let SH=ia;class wt{constructor(e,t,i=""){this.__name="app:generic:event",this.__eventsManager=e,this.__name=t,this.__detail=i}get name(){return this.__name}get detail(){return this.__detail}fire(e){const t=new CustomEvent(this.__name,{detail:e??this.__detail});this.__eventsManager.eventHubRef.dispatchEvent(t)}}class CH extends EventTarget{constructor(e){super(),this._loggerContext="EVENTS MANAGER",window.epigraph.logger.info({title:"Initializing...",contextOverride:this._loggerContext}),e?this.eventHubRef=e:this.eventHubRef=this,this.assetLoadProgress=new wt(this,"assetLoadProgress",""),this.experienceUpdatedEvent=new wt(this,"experienceUpdated",""),this.appReadyEvent=new wt(this,"appReady",""),this.appFailedEvent=new wt(this,"appFailed",""),this.productClassChangedEvent=new wt(this,"productClassChanged",""),this.productChangedEvent=new wt(this,"productChanged",""),this.variantChangedEvent=new wt(this,"variantChanged",""),this.structureNodeAddedEvent=new wt(this,"structureNodeAdded",""),this.structureNodeRemovedEvent=new wt(this,"structureNodeRemoved",""),this.structureChangedEvent=new wt(this,"structureChanged",""),this.showNodeLoadingIcon=new wt(this,"nodeLoadingShow",""),this.hideNodeLoadingIcon=new wt(this,"nodeLoadingHide",""),this.cameraFitEvent=new wt(this,"cameraFit",""),this.hotspotsUpdatedEvent=new wt(this,"hotspotsUpdated",""),this.hotspotsVisibilityChanged=new wt(this,"hotspotsVisibilityChanged",""),this.hotspotClickedEvent=new wt(this,"hotspotClicked",""),this.hotspotOpenEvent=new wt(this,"hotspotOpen",""),this.hotspotClosedEvent=new wt(this,"hotspotClosed",""),this.hotspotNextEvent=new wt(this,"hotspotNext",""),this.hotspotPreviousEvent=new wt(this,"hotspotPrevious",""),this.sceneBoundsChanged=new wt(this,"sceneBoundsChanged",""),this.dimensionsPositionChanged=new wt(this,"dimensionsPositionChanged",""),this.dimensionsValueChanged=new wt(this,"dimensionsValueChanged",""),this.dimensionsVisibilityChanged=new wt(this,"dimensionsVisibilityChanged",""),this.arModelReadyEvent=new wt(this,"arGlbReady",""),this.cartChangedEvent=new wt(this,"cartChanged",""),this.sceneRestartedEvent=new wt(this,"sceneRestarted",""),this.pickerFoundPosition=new wt(this,"pickerFoundPosition",""),this.frameUpdated=new wt(this,"frameUpdated",""),this.cameraControlsStart=new wt(this,"cameraControlsStart",""),this.inputStart=new wt(this,"inputStart",""),this.inputMove=new wt(this,"inputMove",""),this.inputEnd=new wt(this,"inputEnd",""),this.cameraMoveToTransform=new wt(this,"cameraMoveToTransform",""),this.debugChanged=new wt(this,"debugChanged","")}}class TH{constructor(e,t){this.__assets=new Map,this.__appWcRef=t,this.__config=e}async initialize(){for(const e in this.__config){const t=new y1(this.__config[e],this.__appWcRef);await t.load(),this.__assets.set(e,t)}}async loadAllProxies(){for(const e of this.__assets.values())await e.loadProxyGltf()}async loadAllRenderAssets(){for(const e of this.__assets.values())await e.loadRenderGltf(!0)}getAssetByName(e){return this.__assets.get(e)}getFirstAsset(){return this.__assets.values().next().value}}class MH{constructor(e){this.__assetClass=e.assetClass,this.__asset=e.asset,this.__assetId=e.assetId,this.__finish=e.finish,this.__productOptionValue=e.productOptionValue}get assetClass(){return this.__assetClass}get asset(){return this.__asset}get assetId(){return this.__assetId}get finish(){return this.__finish}get productOptionValue(){return this.__productOptionValue}}class IH{constructor(e,t){this.__productParts=[],this.__id=e.id,this.__name=e.name,this.__productId=t,this.__sku=e.sku,this.__upc=e.upc,this.__asin=e.asin,this.__shopifyVariantId=e.shopifyVariantId,this.__uuid=e.uuid,this.parseProductParts(e.productParts)}get id(){return this.__id}get name(){return this.__name}get productId(){return this.__productId}get sku(){return this.__sku}get upc(){return this.__upc}get asin(){return this.__asin}get shopifyVariantId(){return this.__shopifyVariantId}get uuid(){return this.__uuid}get productParts(){return this.__productParts}parseProductParts(e){for(const t of e){const i=new MH(t);this.__productParts.push(i)}}}class RH{constructor(e,t){this.__productVariants=new Map,this.__productVariantNames=new Map,this.__productVariantSkus=new Map,this.__productVariantUpcs=new Map,this.__productVariantAsins=new Map,this.__productVariantShopifyVariantIds=new Map,this.__productVariantUuids=new Map,this.__productId=t;for(const i of e){const a=new IH(i,this.__productId);a&&this.addProductVariant(a)}}addProductVariant(e){this.__productVariants.set(e.id,e),this.__productVariantNames.set(e.name,e),e.sku&&this.__productVariantSkus.set(e.sku,e),e.upc&&this.__productVariantUpcs.set(e.upc,e),e.asin&&this.__productVariantAsins.set(e.asin,e),e.shopifyVariantId&&this.__productVariantShopifyVariantIds.set(e.shopifyVariantId,e),e.uuid&&this.__productVariantUuids.set(e.uuid,e)}removeProductVariant(e){e.sku&&this.__productVariantSkus.delete(e.sku),e.upc&&this.__productVariantUpcs.delete(e.upc),e.asin&&this.__productVariantAsins.delete(e.asin),e.shopifyVariantId&&this.__productVariantShopifyVariantIds.delete(e.shopifyVariantId),this.__productVariantNames.delete(e.name),this.__productVariants.delete(e.id)}getAllProductVariants(){return Array.from(this.__productVariants.values())}getAllProductVariantIds(){return Array.from(this.__productVariants.keys())}getAllProductVariantNames(){return Array.from(this.__productVariantNames.keys())}getProductVariantById(e){return this.__productVariants.get(e)}getProductVariantByName(e){return this.__productVariantNames.get(e)}getProductVariantBySku(e){return this.__productVariantSkus.get(e)}getProductVariantByUpc(e){return this.__productVariantUpcs.get(e)}getProductVariantByAsin(e){return this.__productVariantAsins.get(e)}getProductVariantByShopifyVariantId(e){return this.__productVariantShopifyVariantIds.get(e)}getProductVariantByUuid(e){return this.__productVariantUuids.get(e)}getProductVariantByIdentifierAndType(e,t){switch(t){case Ta.SKU:return this.getProductVariantBySku(e);case Ta.SHOPIFY_VARIANT_ID:return this.getProductVariantByShopifyVariantId(e);case Ta.ASIN:return this.getProductVariantByAsin(e);case Ta.UPC:return this.getProductVariantByUpc(e);case Ta.EXPERIENCE_ID:return;case Ta.PRODUCT_VARIANT_UUID:return this.getProductVariantByUuid(e);default:return}}}class BH extends b1{constructor(e){super(e)}}class PH{constructor(e){this.__appWcRef=e,this.__materialLibraries=new Map}get materialLibraries(){return this.__materialLibraries}makeEmpty(){this.__materialLibraries.clear()}async addMaterialLibrary(e,t){const i=new BH({id:e,uri:t,preload:!1,appWcRef:this.__appWcRef});return this.__materialLibraries.set(i.id,i),i}}class $T{constructor(){this.productSettings={postEffect:{ao:!1},camera:{initial:null,backgroundColor:"#ffffff",backgroundAlpha:1,focalLength:35,nearClip:.01,farClip:1e3,canPan:!0,canZoom:!0,minDistance:2,maxDistance:8,minPolarAngle:null,maxPolarAngle:null,minAzimuthAngle:null,maxAzimuthAngle:null},renderQuality:{antiAlias:!0},screenshots:{enabled:!1},shadows:{shadowType:x1.NONE,accumulativeShadows:{shadowMaterial:{opacity:.8,alphaTest:.75,color:"#000000",blend:1},shadowParams:{frames:30,scale:10,radius:.8,ambient:.5},light:{direction:{x:3,y:5,z:3}}},contactShadows:{planeLength:3,planeWidth:3,cameraHeight:1,intensity:1,softness:1}},hotspots:{showNavigationButtons:!0}}}_deepCopyProductSettings(e){const t=this.productSettings;e.camera&&(e.camera.initial&&(t.camera.initial=e.camera.initial),e.camera.backgroundColor&&(t.camera.backgroundColor=e.camera.backgroundColor),e.camera.backgroundAlpha&&(t.camera.backgroundAlpha=e.camera.backgroundAlpha),e.camera.focalLength&&(t.camera.focalLength=e.camera.focalLength),e.camera.canPan!==void 0&&(t.camera.canPan=e.camera.canPan),e.camera.canZoom!==void 0&&(t.camera.canZoom=e.camera.canZoom),e.camera.minDistance&&(t.camera.minDistance=e.camera.minDistance),e.camera.maxDistance&&(t.camera.maxDistance=e.camera.maxDistance),e.camera.minPolarAngle&&(t.camera.minPolarAngle=e.camera.minPolarAngle),e.camera.maxPolarAngle&&(t.camera.maxPolarAngle=e.camera.maxPolarAngle),e.camera.minAzimuthAngle&&(t.camera.minAzimuthAngle=e.camera.minAzimuthAngle),e.camera.maxAzimuthAngle&&(t.camera.maxAzimuthAngle=e.camera.maxAzimuthAngle)),e.postEffect&&(t.postEffect=e.postEffect),e.renderQuality&&(t.renderQuality=e.renderQuality),e.screenshots&&(t.screenshots=e.screenshots),e.shadows?.shadowType&&(t.shadows.shadowType=e.shadows.shadowType),e.shadows?.accumulativeShadows&&(t.shadows.accumulativeShadows=e.shadows.accumulativeShadows),e.shadows?.contactShadows&&(e.shadows.contactShadows.cameraHeight&&(t.shadows.contactShadows.cameraHeight=e.shadows.contactShadows.cameraHeight),e.shadows.contactShadows.intensity&&(t.shadows.contactShadows.intensity=e.shadows.contactShadows.intensity),e.shadows.contactShadows.planeLength&&(t.shadows.contactShadows.planeLength=e.shadows.contactShadows.planeLength),e.shadows.contactShadows.planeWidth&&(t.shadows.contactShadows.planeWidth=e.shadows.contactShadows.planeWidth),e.shadows.contactShadows.softness&&(t.shadows.contactShadows.softness=e.shadows.contactShadows.softness)),e.hotspots?.showNavigationButtons!==void 0&&(t.hotspots.showNavigationButtons=e.hotspots.showNavigationButtons)}}class LH extends $T{constructor({nexusApiResultPayload:e,appWcRef:t}){super(),this.__needsRootPlug=!1,window.epigraph.logger.info({title:"nexusApiPayload",details:e}),this._appWcRef=t,this._data=e,this.__materialLibraryCollection=new PH(this._appWcRef),this._data.product_data.settings&&this._deepCopyProductSettings(this._data.product_data.settings);const i=this._data.product_data.assets;if(Object.values(i).length===1){const a=Object.values(i)[0];a?.proxyGeo?window.epigraph.logger.warn({title:"Single asset experience detected and a proxy was provided. Please ensure that the proxy provided has a root plug in it. Expand for the asset config used...",details:a,contextOverride:"ASSET COLLECTION"}):(a.proxyGeo="https://asset.myepigraph.com/configurator-assets/epigraph-solution-assets/staging-assets/pipeline-assets/3d-assets/proxies/null-proxy.glb",this.__needsRootPlug=!0,a.autoGenerateProxyEntity=!0)}}get materialLibraryCollection(){return this.__materialLibraryCollection}get experienceSettings(){return this._data.experience_settings}async __parseMaterialLibraries(){this.__materialLibraryCollection.makeEmpty();for(const[e,t]of Object.entries(this._data.brand.material_libraries))await this.__materialLibraryCollection.addMaterialLibrary(e,t.url)}async __parseAssets(){return this.__assetCollection=new TH(this._data.product_data.assets,this._appWcRef),await this.__assetCollection.initialize(),this.__needsRootPlug&&this.__assetCollection.getFirstAsset()?.proxyGltf?.plugs.push(new Jr({name:"root@plug",isPrimary:!0,connectionId:"root",position:new se,rotation:new yn})),this.__assetCollection}getAssetCollection(){return this.__assetCollection}__parseProductVariants(){this.__productVariantCollection=new RH(this._data.product_data.product.productVariants,this._data.product_data.product.id)}get productVariantCollection(){return this.__productVariantCollection}async initialize(){await this.__parseMaterialLibraries(),await this.__parseAssets(),await this.__parseProductVariants()}}var Sh=function(){var o=0,e=document.createElement("div");e.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",e.addEventListener("click",function(A){A.preventDefault(),i(++o%e.children.length)},!1);function t(A){return e.appendChild(A.dom),A}function i(A){for(var _=0;_<e.children.length;_++)e.children[_].style.display=_===A?"block":"none";o=A}var a=(performance||Date).now(),l=a,h=0,d=t(new Sh.Panel("FPS","#0ff","#002")),p=t(new Sh.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var g=t(new Sh.Panel("MB","#f08","#201"));return i(0),{REVISION:16,dom:e,addPanel:t,showPanel:i,begin:function(){a=(performance||Date).now()},end:function(){h++;var A=(performance||Date).now();if(p.update(A-a,200),A>=l+1e3&&(d.update(h*1e3/(A-l),100),l=A,h=0,g)){var _=performance.memory;g.update(_.usedJSHeapSize/1048576,_.jsHeapSizeLimit/1048576)}return A},update:function(){a=this.end()},domElement:e,setMode:i}};Sh.Panel=function(o,e,t){var i=1/0,a=0,l=Math.round,h=l(window.devicePixelRatio||1),d=80*h,p=48*h,g=3*h,A=2*h,_=3*h,y=15*h,w=74*h,E=30*h,C=document.createElement("canvas");C.width=d,C.height=p,C.style.cssText="width:80px;height:48px";var T=C.getContext("2d");return T.font="bold "+9*h+"px Helvetica,Arial,sans-serif",T.textBaseline="top",T.fillStyle=t,T.fillRect(0,0,d,p),T.fillStyle=e,T.fillText(o,g,A),T.fillRect(_,y,w,E),T.fillStyle=t,T.globalAlpha=.9,T.fillRect(_,y,w,E),{dom:C,update:function(x,P){i=Math.min(i,x),a=Math.max(a,x),T.fillStyle=t,T.globalAlpha=1,T.fillRect(0,0,d,y),T.fillStyle=e,T.fillText(l(x)+" "+o+" ("+l(i)+"-"+l(a)+")",g,A),T.drawImage(C,_+h,y,w-h,E,_,y,w-h,E),T.fillRect(_+w-h,y,h,E),T.fillStyle=t,T.globalAlpha=.9,T.fillRect(_+w-h,y,h,l((1-x/P)*E))}}};class as extends Xf{constructor(){super(),this._loggerContext="DEBUG MANAGER",this.stats=new Sh}static{this.webComponentName="debug-manager"}static setupWebComponent(){window.customElements.get(as.webComponentName)||window.customElements.define(as.webComponentName,as)}static{this.styles=ct`
|
|
8363
|
+
`}};ho([Ut("#modelViewer")],ia.prototype,"modelViewerElem");ho([Ut("#arModal")],ia.prototype,"arModalElem");ho([Ut("#qrModal")],ia.prototype,"qrModalElem");ho([he({attribute:!1})],ia.prototype,"appWcRef");ho([he({type:String,attribute:"glb-src"})],ia.prototype,"glbSrc");ho([he({type:String,attribute:"usdz-src"})],ia.prototype,"usdzSrc");ho([he({type:Boolean,attribute:"debug"})],ia.prototype,"debug");let SH=ia;class wt{constructor(e,t,i=""){this.__name="app:generic:event",this.__eventsManager=e,this.__name=t,this.__detail=i}get name(){return this.__name}get detail(){return this.__detail}fire(e){const t=new CustomEvent(this.__name,{detail:e??this.__detail});this.__eventsManager.eventHubRef.dispatchEvent(t)}}class CH extends EventTarget{constructor(e){super(),this._loggerContext="EVENTS MANAGER",window.epigraph.logger.info({title:"Initializing...",contextOverride:this._loggerContext}),e?this.eventHubRef=e:this.eventHubRef=this,this.assetLoadProgress=new wt(this,"assetLoadProgress",""),this.experienceUpdatedEvent=new wt(this,"experienceUpdated",""),this.appReadyEvent=new wt(this,"appReady",""),this.appFailedEvent=new wt(this,"appFailed",""),this.productClassChangedEvent=new wt(this,"productClassChanged",""),this.productChangedEvent=new wt(this,"productChanged",""),this.variantChangedEvent=new wt(this,"variantChanged",""),this.structureNodeAddedEvent=new wt(this,"structureNodeAdded",""),this.structureNodeRemovedEvent=new wt(this,"structureNodeRemoved",""),this.structureChangedEvent=new wt(this,"structureChanged",""),this.showNodeLoadingIcon=new wt(this,"nodeLoadingShow",""),this.hideNodeLoadingIcon=new wt(this,"nodeLoadingHide",""),this.cameraFitEvent=new wt(this,"cameraFit",""),this.hotspotsUpdatedEvent=new wt(this,"hotspotsUpdated",""),this.hotspotsVisibilityChanged=new wt(this,"hotspotsVisibilityChanged",""),this.hotspotClickedEvent=new wt(this,"hotspotClicked",""),this.hotspotOpenEvent=new wt(this,"hotspotOpen",""),this.hotspotClosedEvent=new wt(this,"hotspotClosed",""),this.hotspotNextEvent=new wt(this,"hotspotNext",""),this.hotspotPreviousEvent=new wt(this,"hotspotPrevious",""),this.sceneBoundsChanged=new wt(this,"sceneBoundsChanged",""),this.dimensionsPositionChanged=new wt(this,"dimensionsPositionChanged",""),this.dimensionsValueChanged=new wt(this,"dimensionsValueChanged",""),this.dimensionsVisibilityChanged=new wt(this,"dimensionsVisibilityChanged",""),this.arModelReadyEvent=new wt(this,"arGlbReady",""),this.cartChangedEvent=new wt(this,"cartChanged",""),this.sceneRestartedEvent=new wt(this,"sceneRestarted",""),this.pickerFoundPosition=new wt(this,"pickerFoundPosition",""),this.frameUpdated=new wt(this,"frameUpdated",""),this.cameraControlsStart=new wt(this,"cameraControlsStart",""),this.inputStart=new wt(this,"inputStart",""),this.inputMove=new wt(this,"inputMove",""),this.inputEnd=new wt(this,"inputEnd",""),this.cameraMoveToTransform=new wt(this,"cameraMoveToTransform",""),this.debugChanged=new wt(this,"debugChanged","")}}class TH{constructor(e,t){this.__assets=new Map,this.__appWcRef=t,this.__config=e}async initialize(){for(const e in this.__config){const t=new y1(this.__config[e],this.__appWcRef);await t.load(),this.__assets.set(e,t)}}async loadAllProxies(){for(const e of this.__assets.values())await e.loadProxyGltf()}async loadAllRenderAssets(){for(const e of this.__assets.values())await e.loadRenderGltf(!0)}getAssetByName(e){return this.__assets.get(e)}getFirstAsset(){return this.__assets.values().next().value}}class MH{constructor(e){this.__assetClass=e.assetClass,this.__asset=e.asset,this.__assetId=e.assetId,this.__finish=e.finish,this.__productOptionValue=e.productOptionValue}get assetClass(){return this.__assetClass}get asset(){return this.__asset}get assetId(){return this.__assetId}get finish(){return this.__finish}get productOptionValue(){return this.__productOptionValue}}class IH{constructor(e,t){this.__productParts=[],this.__id=e.id,this.__name=e.name,this.__productId=t,this.__sku=e.sku,this.__upc=e.upc,this.__asin=e.asin,this.__shopifyVariantId=e.shopifyVariantId,this.__uuid=e.uuid,this.parseProductParts(e.productParts)}get id(){return this.__id}get name(){return this.__name}get productId(){return this.__productId}get sku(){return this.__sku}get upc(){return this.__upc}get asin(){return this.__asin}get shopifyVariantId(){return this.__shopifyVariantId}get uuid(){return this.__uuid}get productParts(){return this.__productParts}parseProductParts(e){for(const t of e){const i=new MH(t);this.__productParts.push(i)}}}class RH{constructor(e,t){this.__productVariants=new Map,this.__productVariantNames=new Map,this.__productVariantSkus=new Map,this.__productVariantUpcs=new Map,this.__productVariantAsins=new Map,this.__productVariantShopifyVariantIds=new Map,this.__productVariantUuids=new Map,this.__productId=t;for(const i of e){const a=new IH(i,this.__productId);a&&this.addProductVariant(a)}}addProductVariant(e){this.__productVariants.set(e.id,e),this.__productVariantNames.set(e.name,e),e.sku&&this.__productVariantSkus.set(e.sku,e),e.upc&&this.__productVariantUpcs.set(e.upc,e),e.asin&&this.__productVariantAsins.set(e.asin,e),e.shopifyVariantId&&this.__productVariantShopifyVariantIds.set(e.shopifyVariantId,e),e.uuid&&this.__productVariantUuids.set(e.uuid,e)}removeProductVariant(e){e.sku&&this.__productVariantSkus.delete(e.sku),e.upc&&this.__productVariantUpcs.delete(e.upc),e.asin&&this.__productVariantAsins.delete(e.asin),e.shopifyVariantId&&this.__productVariantShopifyVariantIds.delete(e.shopifyVariantId),this.__productVariantNames.delete(e.name),this.__productVariants.delete(e.id)}getAllProductVariants(){return Array.from(this.__productVariants.values())}getAllProductVariantIds(){return Array.from(this.__productVariants.keys())}getAllProductVariantNames(){return Array.from(this.__productVariantNames.keys())}getProductVariantById(e){return this.__productVariants.get(e)}getProductVariantByName(e){return this.__productVariantNames.get(e)}getProductVariantBySku(e){return this.__productVariantSkus.get(e)}getProductVariantByUpc(e){return this.__productVariantUpcs.get(e)}getProductVariantByAsin(e){return this.__productVariantAsins.get(e)}getProductVariantByShopifyVariantId(e){return this.__productVariantShopifyVariantIds.get(e)}getProductVariantByUuid(e){return this.__productVariantUuids.get(e)}getProductVariantByIdentifierAndType(e,t){switch(t){case Ta.SKU:return this.getProductVariantBySku(e);case Ta.SHOPIFY_VARIANT_ID:return this.getProductVariantByShopifyVariantId(e);case Ta.ASIN:return this.getProductVariantByAsin(e);case Ta.UPC:return this.getProductVariantByUpc(e);case Ta.EXPERIENCE_ID:return;case Ta.PRODUCT_VARIANT_UUID:return this.getProductVariantByUuid(e);default:return}}}class BH extends b1{constructor(e){super(e)}}class PH{constructor(e){this.__appWcRef=e,this.__materialLibraries=new Map}get materialLibraries(){return this.__materialLibraries}makeEmpty(){this.__materialLibraries.clear()}async addMaterialLibrary(e,t){const i=new BH({id:e,uri:t,preload:!1,appWcRef:this.__appWcRef});return this.__materialLibraries.set(i.id,i),i}}class $T{constructor(){this.productSettings={postEffect:{ao:!1},camera:{initial:null,backgroundColor:"#ffffff",backgroundAlpha:1,focalLength:35,nearClip:.01,farClip:1e3,canPan:!0,canZoom:!0,minDistance:2,maxDistance:8,minPolarAngle:null,maxPolarAngle:null,minAzimuthAngle:null,maxAzimuthAngle:null},renderQuality:{antiAlias:!0},screenshots:{enabled:!1},shadows:{shadowType:x1.NONE,accumulativeShadows:{shadowMaterial:{opacity:.8,alphaTest:.75,color:"#000000",blend:1},shadowParams:{frames:30,scale:10,radius:.8,ambient:.5},light:{direction:{x:3,y:5,z:3}}},contactShadows:{planeLength:3,planeWidth:3,cameraHeight:1,intensity:1,softness:1}},hotspots:{showNavigationButtons:!0}}}_deepCopyProductSettings(e){const t=this.productSettings;e.camera&&(e.camera.initial&&(t.camera.initial=e.camera.initial),e.camera.backgroundColor&&(t.camera.backgroundColor=e.camera.backgroundColor),e.camera.backgroundAlpha&&(t.camera.backgroundAlpha=e.camera.backgroundAlpha),e.camera.focalLength&&(t.camera.focalLength=e.camera.focalLength),e.camera.canPan!==void 0&&(t.camera.canPan=e.camera.canPan),e.camera.canZoom!==void 0&&(t.camera.canZoom=e.camera.canZoom),e.camera.minDistance&&(t.camera.minDistance=e.camera.minDistance),e.camera.maxDistance&&(t.camera.maxDistance=e.camera.maxDistance),e.camera.minPolarAngle&&(t.camera.minPolarAngle=e.camera.minPolarAngle),e.camera.maxPolarAngle&&(t.camera.maxPolarAngle=e.camera.maxPolarAngle),e.camera.minAzimuthAngle&&(t.camera.minAzimuthAngle=e.camera.minAzimuthAngle),e.camera.maxAzimuthAngle&&(t.camera.maxAzimuthAngle=e.camera.maxAzimuthAngle)),e.postEffect&&(t.postEffect=e.postEffect),e.renderQuality&&(t.renderQuality=e.renderQuality),e.screenshots&&(t.screenshots=e.screenshots),e.shadows?.shadowType&&(t.shadows.shadowType=e.shadows.shadowType),e.shadows?.accumulativeShadows&&(t.shadows.accumulativeShadows=e.shadows.accumulativeShadows),e.shadows?.contactShadows&&(e.shadows.contactShadows.cameraHeight&&(t.shadows.contactShadows.cameraHeight=e.shadows.contactShadows.cameraHeight),e.shadows.contactShadows.intensity&&(t.shadows.contactShadows.intensity=e.shadows.contactShadows.intensity),e.shadows.contactShadows.planeLength&&(t.shadows.contactShadows.planeLength=e.shadows.contactShadows.planeLength),e.shadows.contactShadows.planeWidth&&(t.shadows.contactShadows.planeWidth=e.shadows.contactShadows.planeWidth),e.shadows.contactShadows.softness&&(t.shadows.contactShadows.softness=e.shadows.contactShadows.softness)),e.hotspots?.showNavigationButtons!==void 0&&(t.hotspots.showNavigationButtons=e.hotspots.showNavigationButtons)}}class LH extends $T{constructor({nexusApiResultPayload:e,appWcRef:t}){super(),this.__needsRootPlug=!1,window.epigraph.logger.info({title:"nexusApiPayload",details:e}),this._appWcRef=t,this._data=e,this.__materialLibraryCollection=new PH(this._appWcRef),this._data.product_data.settings&&this._deepCopyProductSettings(this._data.product_data.settings);const i=this._data.product_data.assets;if(Object.values(i).length===1){const a=Object.values(i)[0];a?.proxyGeo?window.epigraph.logger.warn({title:"Single asset experience detected and a proxy was provided. Please ensure that the proxy provided has a root plug in it. Expand for the asset config used...",details:a,contextOverride:"ASSET COLLECTION"}):(a.proxyGeo="https://asset.myepigraph.com/configurator-assets/epigraph-solution-assets/staging-assets/pipeline-assets/3d-assets/proxies/null-proxy.glb",this.__needsRootPlug=!0,a.autoGenerateProxyEntity=!0)}}get materialLibraryCollection(){return this.__materialLibraryCollection}get experienceSettings(){return this._data.experience_settings}async __parseMaterialLibraries(){this.__materialLibraryCollection.makeEmpty();const e=this._data?.brand?.material_libraries;if(e)for(const[t,i]of Object.entries(e))await this.__materialLibraryCollection.addMaterialLibrary(t,i.url)}async __parseAssets(){return this.__assetCollection=new TH(this._data.product_data.assets,this._appWcRef),await this.__assetCollection.initialize(),this.__needsRootPlug&&this.__assetCollection.getFirstAsset()?.proxyGltf?.plugs.push(new Jr({name:"root@plug",isPrimary:!0,connectionId:"root",position:new se,rotation:new yn})),this.__assetCollection}getAssetCollection(){return this.__assetCollection}__parseProductVariants(){this.__productVariantCollection=new RH(this._data.product_data.product.productVariants,this._data.product_data.product.id)}get productVariantCollection(){return this.__productVariantCollection}async initialize(){await this.__parseMaterialLibraries(),await this.__parseAssets(),await this.__parseProductVariants()}}var Sh=function(){var o=0,e=document.createElement("div");e.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",e.addEventListener("click",function(A){A.preventDefault(),i(++o%e.children.length)},!1);function t(A){return e.appendChild(A.dom),A}function i(A){for(var _=0;_<e.children.length;_++)e.children[_].style.display=_===A?"block":"none";o=A}var a=(performance||Date).now(),l=a,h=0,d=t(new Sh.Panel("FPS","#0ff","#002")),p=t(new Sh.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var g=t(new Sh.Panel("MB","#f08","#201"));return i(0),{REVISION:16,dom:e,addPanel:t,showPanel:i,begin:function(){a=(performance||Date).now()},end:function(){h++;var A=(performance||Date).now();if(p.update(A-a,200),A>=l+1e3&&(d.update(h*1e3/(A-l),100),l=A,h=0,g)){var _=performance.memory;g.update(_.usedJSHeapSize/1048576,_.jsHeapSizeLimit/1048576)}return A},update:function(){a=this.end()},domElement:e,setMode:i}};Sh.Panel=function(o,e,t){var i=1/0,a=0,l=Math.round,h=l(window.devicePixelRatio||1),d=80*h,p=48*h,g=3*h,A=2*h,_=3*h,y=15*h,w=74*h,E=30*h,C=document.createElement("canvas");C.width=d,C.height=p,C.style.cssText="width:80px;height:48px";var T=C.getContext("2d");return T.font="bold "+9*h+"px Helvetica,Arial,sans-serif",T.textBaseline="top",T.fillStyle=t,T.fillRect(0,0,d,p),T.fillStyle=e,T.fillText(o,g,A),T.fillRect(_,y,w,E),T.fillStyle=t,T.globalAlpha=.9,T.fillRect(_,y,w,E),{dom:C,update:function(x,P){i=Math.min(i,x),a=Math.max(a,x),T.fillStyle=t,T.globalAlpha=1,T.fillRect(0,0,d,y),T.fillStyle=e,T.fillText(l(x)+" "+o+" ("+l(i)+"-"+l(a)+")",g,A),T.drawImage(C,_+h,y,w-h,E,_,y,w-h,E),T.fillRect(_+w-h,y,h,E),T.fillStyle=t,T.globalAlpha=.9,T.fillRect(_+w-h,y,h,l((1-x/P)*E))}}};class as extends Xf{constructor(){super(),this._loggerContext="DEBUG MANAGER",this.stats=new Sh}static{this.webComponentName="debug-manager"}static setupWebComponent(){window.customElements.get(as.webComponentName)||window.customElements.define(as.webComponentName,as)}static{this.styles=ct`
|
|
8364
8364
|
.debug-label {
|
|
8365
8365
|
position: absolute;
|
|
8366
8366
|
top: 0%;
|