@epigraph/solutions 1.1.11 → 1.1.12
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.
|
@@ -12992,7 +12992,7 @@ void main() {
|
|
|
12992
12992
|
center = quatVec(quat, center) + translate;
|
|
12993
12993
|
quaternion = quatQuat(quat, quaternion);
|
|
12994
12994
|
}
|
|
12995
|
-
`);new Mn(new Q(-1,-1,-1),new Q(1,1,1)),new Q(-1,-3,1).normalize(),new we(1,1,1),new we(.5,.5,1),new Q(1,1,1);new Mn(new Q(-2,-1,-2),new Q(2,5,2)),new Q(0,-1,0),new we(1,1,1),new we(.25,.25,.5),new Q(.1,1,.1);const H2=class lv{static createButton(e,t={}){const n=navigator.xr;if(!n)return null;const s=n,r=document.createElement("button");e.xr.enabled=!0,e.xr.setReferenceSpaceType("local");function a(){let h=null;async function A(g){console.log("onSessionStarted"),g.addEventListener("end",d),await e.xr.setSession(g),r.textContent="EXIT VR",h=g}function d(){console.log("onSessionEnded"),h?.removeEventListener("end",d),r.textContent="ENTER VR",h=null}r.style.display="",r.style.cursor="pointer",r.style.left="calc(50% - 100px)",r.style.width="200px",r.style.height="100px",r.textContent="ENTER VR";const p={...t,optionalFeatures:[...t.optionalFeatures||[]]};r.onmouseenter=()=>{r.style.opacity="1.0"},r.onmouseleave=()=>{r.style.opacity="0.5"},r.onclick=()=>{h===null?(console.log("requesting session"),s.requestSession("immersive-vr",p).then(A)):(console.log("ending session"),h.end())}}function o(){r.style.display="none",r.style.cursor="auto",r.style.left="calc(50% - 75px)",r.style.width="150px",r.onmouseenter=null,r.onmouseleave=null,r.onclick=null}function l(){o(),r.textContent="VR NOT SUPPORTED"}function c(h){o(),console.warn("Exception when trying to call xr.isSessionSupported",h),r.textContent="VR NOT ALLOWED"}function u(h){h.style.position="absolute",h.style.bottom="20px",h.style.padding="12px 6px",h.style.border="1px solid #fff",h.style.borderRadius="4px",h.style.background="rgba(0,0,0,0.1)",h.style.color="#fff",h.style.font="normal 13px sans-serif",h.style.textAlign="center",h.style.opacity="0.5",h.style.outline="none",h.style.zIndex="999"}return r.id="VRButton",r.style.display="none",u(r),s.isSessionSupported("immersive-vr").then(h=>{h?a():l(),h&&lv.xrSessionIsGranted&&r.click()}).catch(c),r}static registerSessionGrantedListener(){const e=navigator.xr;if(!e)return null;const t=e;/WebXRViewer\//i.test(navigator.userAgent)||t.addEventListener("sessiongranted",()=>{lv.xrSessionIsGranted=!0})}};H2.xrSessionIsGranted=!1;let a6=H2;a6.registerSessionGrantedListener();var $2=(i=>(i.w="wrist",i.t0="thumb-metacarpal",i.t1="thumb-phalanx-proximal",i.t2="thumb-phalanx-distal",i.t3="thumb-tip",i.i0="index-finger-metacarpal",i.i1="index-finger-phalanx-proximal",i.i2="index-finger-phalanx-intermediate",i.i3="index-finger-phalanx-distal",i.i4="index-finger-tip",i.m0="middle-finger-metacarpal",i.m1="middle-finger-phalanx-proximal",i.m2="middle-finger-phalanx-intermediate",i.m3="middle-finger-phalanx-distal",i.m4="middle-finger-tip",i.r0="ring-finger-metacarpal",i.r1="ring-finger-phalanx-proximal",i.r2="ring-finger-phalanx-intermediate",i.r3="ring-finger-phalanx-distal",i.r4="ring-finger-tip",i.p0="pinky-finger-metacarpal",i.p1="pinky-finger-phalanx-proximal",i.p2="pinky-finger-phalanx-intermediate",i.p3="pinky-finger-phalanx-distal",i.p4="pinky-finger-tip",i))($2||{});const o6=Object.keys($2);o6.length;new Q(0,0,-1),new Q(0,0,1),new Q(-1,0,0),new Q(1,0,0),new Q(0,1,0),new Q(0,-1,0);new Q(0,0,-1),new Q(0,0,1),new Q(-1,0,0),new Q(1,0,0),new Q(0,1,0),new Q(0,-1,0);new Q(0,0,1),new Q(0,0,-1);new Q(0,-1,0),new Q(0,1,0),new Q(-1,0,0),new Q(1,0,0);class ft{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 n=document.createElement("style");return n.setAttribute("id",e),n.innerHTML=t,n}static generateHtmlDivElem(e,t=""){const n=document.createElement("div");return n.setAttribute("id",e),n.innerHTML=t,n}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 n=new URLSearchParams(t);return Object.fromEntries(n.entries())[e]}static getBaseUrl(){const e=ft.getUrlParameterByName("parentUrl");return e||window.location.href}static normalizeRadian(e){return Math.atan2(Math.sin(e),Math.cos(e))}static isBetweenOnCircle(e,t,n){return e=ft.normalizeRadian(e),t=ft.normalizeRadian(t),n=ft.normalizeRadian(n),t<=n?e>=t&&e<=n:e>=t||e<=n}static getPointInBetweenByPercentage(e,t,n){let s=t.clone().sub(e);const r=s.length();return s=s.normalize().multiplyScalar(r*n),e.clone().add(s)}static clampAzimuth(e,t,n){if(Math.abs(t)==1/0||n==1/0)return e;const s=ft.normalizeRadian(e),r=ft.normalizeRadian(t),a=ft.normalizeRadian(n);if(ft.isBetweenOnCircle(s,r,a))return s;const o=Math.abs(ft.normalizeRadian(s-r)),l=Math.abs(ft.normalizeRadian(s-a));return o<l?r:a}static resolveNexusEndpoint(e){let t=gd.PRODUCTION;switch(e){case"local":t=gd.LOCAL;break;case"staging":t=gd.STAGING;break;case"staging-canary":t=gd.STAGING_CANARY;break}return t}static parseUrlForEpigraphParams(e){const t=new Map,n=new $_(e);t.set(ti.epigraphSessionId,n.getParameterInUrl(ti.epigraphSessionId)),t.set(ti.identifier,n.getParameterInUrl(ti.identifier)),t.set(ti.identifierType,n.getParameterInUrl(ti.identifierType)),t.set(ti.type,n.getParameterInUrl(ti.type));const s=n.getParameterInUrl(ti.action);return s&&t.set(Nd.AR,JSON.parse(s)[Nd.AR]),t}static generateShareableUrl({baseUrl:e,identifier:t,identifierType:n,sharedConfig:s,arCompatible:r=!1}){const a=new Map;return a.set(ti.epigraphSessionId,window.epigraph.epigraphSessionId),a.set(ti.identifier,t),a.set(ti.identifierType,n),s&&a.set(ti.sharedConfig,s),r&&a.set(ti.action,`{"${Nd.AR}":true}`),new $_(e).generateQrCodeUrl(Object.fromEntries(a.entries()),!1)}static{this.__textureProperties=["map","normalMap","roughnessMap","metalnessMap","aoMap","emissiveMap","alphaMap","lightMap","bumpMap","displacementMap","envMap"]}static disposeMaterialTextures(e){for(const t of ft.__textureProperties){const n=e[t];n instanceof cn&&n.dispose()}}static _dispose3(e){if(e instanceof Ke&&e.geometry.dispose(),e instanceof Ke){const t=Array.isArray(e.material)?e.material:[e.material];for(const n of t)ft.disposeMaterialTextures(n),n.dispose()}}static dispose3(e){e.traverse(t=>{(t instanceof Ke||t instanceof $h)&&ft._dispose3(t)}),(e instanceof Ke||e instanceof $h||e instanceof gs)&&ft._dispose3(e)}static animateValue(e,t,n,s){const r=performance.now();function a(o){const l=o-r,c=Math.min(l/n,1),u=e+(t-e)*c;s(u),c<1&&requestAnimationFrame(a)}requestAnimationFrame(a)}static getCustomStylesTemplate(){if(ft.epigraphCustomStylesTemplate===void 0){const t=document.querySelector("#epigraphCustomStyles").content;t&&t.children.length>0&&(ft.epigraphCustomStylesTemplate=re`<style>${t.children[0].textContent}</style>`)}return ft.epigraphCustomStylesTemplate}}class Zd{constructor(e){this._success=e}get success(){return this._success}set success(e){this._success=e}get failed(){return!this._success}}class l6 extends Zd{constructor(e=!1,t=void 0){super(e),this.__payload=t}get payload(){return this.__payload}set payload(e){this.__payload=e}}var V2=(i=>(i.Empty="entity-empty",i.Gltf="entity-mesh",i.Render="entity-render",i.Proxy="entity-proxy",i.Collider="entity-collider",i.Asset="entity-asset",i))(V2||{});class c6 extends In{constructor(){super(),this._entityType=V2.Empty}get entityType(){return this._entityType}dispose(){let e;const t=new l6(!1,e);return e=void 0,t.success=!0,t.payload=e,t}}var La=(i=>(i.GEO="geo",i.SPLAT="splat",i))(La||{});class Vp{constructor(e){this.__name=e}getName(){return this.__name}}var er=(i=>(i.declared="declared",i.Loading="loading",i.Loaded="loaded",i.Unloaded="unloaded",i.Failed="failed",i))(er||{}),Co=(i=>(i.None="epg-resource-none",i.Gltf="epg-resource-gltf",i.Proxy="epg-resource-gltf-proxy",i.Render="epg-resource-gltf-render",i.Splat="epg-resource-splat",i))(Co||{});class Y2{constructor({id:e,uri:t,appWcRef:n}){this._loggerContext="EPG RESOURCE",this._type="epg-resource-none",this._id=crypto.randomUUID(),this._loadingProgress=0,this._state="declared",this._resource=null,e&&(this._id=e),this._appWcRef=n,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(){return window.epigraph.logger.info({title:"Loading EPG Resource. Override to define how a resource should be loaded.",contextOverride:this._loggerContext}),Promise.resolve(!0)}unload(){return this._resource={},Promise.resolve(!0)}}class Mo extends Dt{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 n=e.rotation;this.rotation.set(n.x,n.y,n.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 Mo(this.__config).copy(this,e)}showDebug(){const e=new Q().setFromEuler(this.rotation).normalize(),t=this.position,n=.2,s=16711680;this.__debugGeo=new VM(e,t,n,s,.06,.06);const r=document.createElement("div");r.textContent=this.name;const a=new Qb(r);r.style.pointerEvents="none";const o=new Q;this.getWorldDirection(o),o.normalize();const l=this.position.clone().addScaledVector(o,Math.random());a.position.set(l.x,l.y,l.z),this.__debugGeo.add(a),this.add(this.__debugGeo)}hideDebug(){this.__debugGeo&&(this.__debugGeo.clear(),this.__debugGeo?.removeFromParent(),ft.dispose3(this.__debugGeo))}}class Ua extends Dt{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 n=e.rotation;this.rotation.set(n.x,n.y,n.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 Ua(this.__config).copy(this,e)}showDebug(){const e=new Q().setFromEuler(this.rotation.clone()).normalize(),t=this.position,n=.1,s=65280;this.__debugGeo=new VM(e,t,n,s,.01,.08);const r=document.createElement("div");r.textContent=this.name,r.style.color="green";const a=new Qb(r);r.style.pointerEvents="none",this.__debugGeo.add(a),this.add(this.__debugGeo)}hideDebug(){this.__debugGeo&&(this.__debugGeo.clear(),this.__debugGeo?.removeFromParent(),ft.dispose3(this.__debugGeo))}}var cv=(i=>(i.Plug="plug",i.Receiver="receiver",i))(cv||{});class q2 extends Y2{constructor({id:e,uri:t,appWcRef:n}){super({id:e,uri:t,appWcRef:n}),this._type=Co.Gltf,this._resource=null,this._loggerContext="EPG RESOURCE GLTF"}get resource(){return this._resource}highlight(){}updateLoadingProgress(e){this._loadingProgress=e,this._appWcRef.eventsManager.assetLoadProgress.fire({progress:e})}async load(){if(this._state===er.Loaded||this._state===er.Loading)return Promise.resolve(!0);this._state=er.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:"",contextOverride:this._loggerContext}),window.epigraph.logger.error({title:"An error occurred while trying to load an asset!",details:t,contextOverride:this._loggerContext}),this._state=er.Failed,Promise.reject()));return e===void 0?Promise.reject(!1):(this._resource=e,await this._parseLoadedGltf(),this._state=er.Loaded,Promise.resolve(!0))}async _parseLoadedGltf(){window.epigraph.logger.info({title:"Parsing GLTF data",details:this._resource,contextOverride:this._loggerContext})}unload(){return this._resource?.scene&&ft.dispose3(this._resource.scene),this._resource={},Promise.resolve(!0)}}class h6 extends q2{constructor({id:e,uri:t,appWcRef:n}){super({id:e,uri:t,appWcRef:n}),this._loggerContext="EPG RESOURCE PROXY",this._type=Co.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===cv.Receiver){const n=new Ua({name:t.name,connectionId:t.userData.connectionId,position:t.position.clone(),rotation:t.rotation.clone()});this.__receivers.push(n),e.push(t)}else if(t.userData.epgType===cv.Plug){const n=new Mo({name:t.name,isPrimary:t.userData.isPrimary,connectionId:t.userData.connectionId,position:t.position.clone(),rotation:t.rotation.clone()});this.__plugs.push(n),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(),ft.dispose3(t)}unload(){return this._resource={},this.__plugs=[],this.__receivers=[],Promise.resolve(!0)}}class W2 extends q2{constructor({id:e,uri:t,appWcRef:n}){super({id:e,uri:t,appWcRef:n}),this._loggerContext="EPG RESOURCE RENDER",this._type=Co.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 Ke&&(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?.scene&&ft.dispose3(this._resource.scene),this._resource={},this.__variantsExtension={},this.__finishNamesFromAsset=[],Promise.resolve(!0)}}class u6 extends Y2{constructor({id:e,uri:t,appWcRef:n}){super({id:e,uri:t,appWcRef:n}),this._type=Co.Splat,this._resource=null,this.__splatMesh=null,this._loggerContext="EPG RESOURCE SPLAT",this._appWcRef.renderEngine.setupSparkRendererIfNotExists()}get resource(){return this._resource}get splatMesh(){return this.__splatMesh}__parseLoadedSplat(){this._resource&&(this.__splatMesh=new $h({packedSplats:this._resource}),this.__splatMesh.quaternion.set(1,0,0,0))}async load(){if(this._state===er.Loaded||this._state===er.Loading)return Promise.resolve(!0);this._state=er.Loading;const e=await this._appWcRef.loaders.splatLoader.loadAsync(this._uri,t=>{this.updateLoadingProgress(t.loaded/t.total*100)}).catch(t=>(window.epigraph.logger.groupCollapsed({title:"",contextOverride:this._loggerContext}),window.epigraph.logger.error({title:"An error occurred while trying to load a render splat resource!",details:t,contextOverride:this._loggerContext}),this._state=er.Failed,Promise.reject()));return e===void 0?Promise.reject(!1):(this._resource=e,this.__parseLoadedSplat(),this._state=er.Loaded,Promise.resolve(!0))}}class j2{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 h6({id:`${String(e.id)}-${Co.Proxy}`,uri:e.proxyGeo,appWcRef:this.__appWcRef}),this.__autoGenerateProxyEntity=e.autoGenerateProxyEntity,!this.isRootAsset&&this.__appWcRef.experienceData.currentAssetVersion<=0&&(this.__autoGenerateProxyEntity=!0),this.__appWcRef.productSettings.render.mode===La.SPLAT?this.__renderSplat=new u6({id:`${String(e.id)}-${Co.Splat}`,uri:e.renderSplat,appWcRef:this.__appWcRef}):this.__renderGltf=new W2({id:`${String(e.id)}-${Co.Render}`,uri:e.renderGeo,appWcRef:this.__appWcRef});for(const n in e.finishes)this.__finishes.set(n,new Vp(n));e.brandMaterialLibraries||(e.brandMaterialLibraries=[]),e.hotspots&&(this.__hotspots=e.hotspots)}get isRootAsset(){return this.__id===0}get id(){return this.__id}get name(){return this.__name}get assetRootDir(){const e=this.__appWcRef.productSettings.render.mode===La.SPLAT?this.__renderSplat?.uri:this.__renderGltf?.uri;return new URL(e+"/../../").href}get assetOverrides(){return this.__assetOverrides}get proxyGltf(){return this.__proxyGltf}get autoGenerateProxyEntity(){return this.__autoGenerateProxyEntity}get renderSplat(){return this.__renderSplat}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 loadRenderSplat(){await this.__renderSplat?.load(),this.__finishes.set("default",new Vp("default"))}async loadProxyGltf(){return!this.__proxyGltf||this.__proxyGltf.isLoaded?Promise.resolve(!0):await this.__proxyGltf.load()}pullFinishesFromRenderGltf(){this.__finishes.clear(),this.__renderGltf&&this.__renderGltf.finishNamesFromAsset.forEach(e=>{this.__finishes.has(e)||this.__finishes.set(e,new Vp(e))})}async parseAssetOverrideJson(){if(!this.__renderGltf)return null;let e=this.__renderGltf.resource?.asset.extras?.epgOverrides;if(!e)return null;e=e.replace("./","");const t=new URL(e,this.assetRootDir),n=await fetch(t).catch(s=>{window.epigraph.logger.error({title:`Failed to load asset override file: ${t}`,details:s,contextOverride:this._loggerContext})});n&&(this.__assetOverrides=await n.json())}async loadRenderGltf(e=!1){if(this.__renderGltf===void 0||this.__renderGltf.uri==="")return Promise.resolve(!0);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 n=this.__appWcRef.experienceData.materialLibraryCollection.materialLibraries.get(t);if(await n?.load(),!n){window.epigraph.logger.warn({title:`Material library ${t} not found in brand material libraries.`,contextOverride:this._loggerContext});continue}this.__brandMaterialLibraries.set(n.id,n);for(const s of n.finishNamesFromAsset)this.finishes.has(s)||this.__finishes.set(s,new Vp(s))}return e&&this.pullFinishesFromRenderGltf(),await this.parseAssetOverrideJson(),Promise.resolve(!0)}async load(e=!1){return Promise.all([this.loadRenderSplat(),this.loadRenderGltf(e),this.loadProxyGltf()])}}var d6=Object.defineProperty,X2=(i,e,t,n)=>{for(var s=void 0,r=i.length-1,a;r>=0;r--)(a=i[r])&&(s=a(e,t,s)||s);return s&&d6(e,t,s),s};class J2{constructor({appWcRef:e}){this._loggerContext="SOLUTION MANAGER",this._appWcRef=e}initialize(){window.epigraph.logger.info({title:"Initializing...",contextOverride:this._loggerContext})}}const Gb=class Uf extends ph{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(Uf.webComponentName)||window.customElements.define(Uf.webComponentName,Uf)}render(){return re`
|
|
12995
|
+
`);new Mn(new Q(-1,-1,-1),new Q(1,1,1)),new Q(-1,-3,1).normalize(),new we(1,1,1),new we(.5,.5,1),new Q(1,1,1);new Mn(new Q(-2,-1,-2),new Q(2,5,2)),new Q(0,-1,0),new we(1,1,1),new we(.25,.25,.5),new Q(.1,1,.1);const H2=class lv{static createButton(e,t={}){const n=navigator.xr;if(!n)return null;const s=n,r=document.createElement("button");e.xr.enabled=!0,e.xr.setReferenceSpaceType("local");function a(){let h=null;async function A(g){console.log("onSessionStarted"),g.addEventListener("end",d),await e.xr.setSession(g),r.textContent="EXIT VR",h=g}function d(){console.log("onSessionEnded"),h?.removeEventListener("end",d),r.textContent="ENTER VR",h=null}r.style.display="",r.style.cursor="pointer",r.style.left="calc(50% - 100px)",r.style.width="200px",r.style.height="100px",r.textContent="ENTER VR";const p={...t,optionalFeatures:[...t.optionalFeatures||[]]};r.onmouseenter=()=>{r.style.opacity="1.0"},r.onmouseleave=()=>{r.style.opacity="0.5"},r.onclick=()=>{h===null?(console.log("requesting session"),s.requestSession("immersive-vr",p).then(A)):(console.log("ending session"),h.end())}}function o(){r.style.display="none",r.style.cursor="auto",r.style.left="calc(50% - 75px)",r.style.width="150px",r.onmouseenter=null,r.onmouseleave=null,r.onclick=null}function l(){o(),r.textContent="VR NOT SUPPORTED"}function c(h){o(),console.warn("Exception when trying to call xr.isSessionSupported",h),r.textContent="VR NOT ALLOWED"}function u(h){h.style.position="absolute",h.style.bottom="20px",h.style.padding="12px 6px",h.style.border="1px solid #fff",h.style.borderRadius="4px",h.style.background="rgba(0,0,0,0.1)",h.style.color="#fff",h.style.font="normal 13px sans-serif",h.style.textAlign="center",h.style.opacity="0.5",h.style.outline="none",h.style.zIndex="999"}return r.id="VRButton",r.style.display="none",u(r),s.isSessionSupported("immersive-vr").then(h=>{h?a():l(),h&&lv.xrSessionIsGranted&&r.click()}).catch(c),r}static registerSessionGrantedListener(){const e=navigator.xr;if(!e)return null;const t=e;/WebXRViewer\//i.test(navigator.userAgent)||t.addEventListener("sessiongranted",()=>{lv.xrSessionIsGranted=!0})}};H2.xrSessionIsGranted=!1;let a6=H2;a6.registerSessionGrantedListener();var $2=(i=>(i.w="wrist",i.t0="thumb-metacarpal",i.t1="thumb-phalanx-proximal",i.t2="thumb-phalanx-distal",i.t3="thumb-tip",i.i0="index-finger-metacarpal",i.i1="index-finger-phalanx-proximal",i.i2="index-finger-phalanx-intermediate",i.i3="index-finger-phalanx-distal",i.i4="index-finger-tip",i.m0="middle-finger-metacarpal",i.m1="middle-finger-phalanx-proximal",i.m2="middle-finger-phalanx-intermediate",i.m3="middle-finger-phalanx-distal",i.m4="middle-finger-tip",i.r0="ring-finger-metacarpal",i.r1="ring-finger-phalanx-proximal",i.r2="ring-finger-phalanx-intermediate",i.r3="ring-finger-phalanx-distal",i.r4="ring-finger-tip",i.p0="pinky-finger-metacarpal",i.p1="pinky-finger-phalanx-proximal",i.p2="pinky-finger-phalanx-intermediate",i.p3="pinky-finger-phalanx-distal",i.p4="pinky-finger-tip",i))($2||{});const o6=Object.keys($2);o6.length;new Q(0,0,-1),new Q(0,0,1),new Q(-1,0,0),new Q(1,0,0),new Q(0,1,0),new Q(0,-1,0);new Q(0,0,-1),new Q(0,0,1),new Q(-1,0,0),new Q(1,0,0),new Q(0,1,0),new Q(0,-1,0);new Q(0,0,1),new Q(0,0,-1);new Q(0,-1,0),new Q(0,1,0),new Q(-1,0,0),new Q(1,0,0);class ft{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 n=document.createElement("style");return n.setAttribute("id",e),n.innerHTML=t,n}static generateHtmlDivElem(e,t=""){const n=document.createElement("div");return n.setAttribute("id",e),n.innerHTML=t,n}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 n=new URLSearchParams(t);return Object.fromEntries(n.entries())[e]}static getBaseUrl(){const e=ft.getUrlParameterByName("parentUrl");return e||window.location.href}static normalizeRadian(e){return Math.atan2(Math.sin(e),Math.cos(e))}static isBetweenOnCircle(e,t,n){return e=ft.normalizeRadian(e),t=ft.normalizeRadian(t),n=ft.normalizeRadian(n),t<=n?e>=t&&e<=n:e>=t||e<=n}static getPointInBetweenByPercentage(e,t,n){let s=t.clone().sub(e);const r=s.length();return s=s.normalize().multiplyScalar(r*n),e.clone().add(s)}static clampAzimuth(e,t,n){if(Math.abs(t)==1/0||n==1/0)return e;const s=ft.normalizeRadian(e),r=ft.normalizeRadian(t),a=ft.normalizeRadian(n);if(ft.isBetweenOnCircle(s,r,a))return s;const o=Math.abs(ft.normalizeRadian(s-r)),l=Math.abs(ft.normalizeRadian(s-a));return o<l?r:a}static resolveNexusEndpoint(e){let t=gd.PRODUCTION;switch(e){case"local":t=gd.LOCAL;break;case"staging":t=gd.STAGING;break;case"staging-canary":t=gd.STAGING_CANARY;break}return t}static parseUrlForEpigraphParams(e){const t=new Map,n=new $_(e);t.set(ti.epigraphSessionId,n.getParameterInUrl(ti.epigraphSessionId)),t.set(ti.identifier,n.getParameterInUrl(ti.identifier)),t.set(ti.identifierType,n.getParameterInUrl(ti.identifierType)),t.set(ti.type,n.getParameterInUrl(ti.type));const s=n.getParameterInUrl(ti.action);return s&&t.set(Nd.AR,JSON.parse(s)[Nd.AR]),t}static generateShareableUrl({baseUrl:e,identifier:t,identifierType:n,sharedConfig:s,arCompatible:r=!1}){const a=new Map;return a.set(ti.epigraphSessionId,window.epigraph.epigraphSessionId),a.set(ti.identifier,t),a.set(ti.identifierType,n),s&&a.set(ti.sharedConfig,s),r&&a.set(ti.action,`{"${Nd.AR}":true}`),new $_(e).generateQrCodeUrl(Object.fromEntries(a.entries()),!1)}static{this.__textureProperties=["map","normalMap","roughnessMap","metalnessMap","aoMap","emissiveMap","alphaMap","lightMap","bumpMap","displacementMap","envMap"]}static disposeMaterialTextures(e){for(const t of ft.__textureProperties){const n=e[t];n instanceof cn&&n.dispose()}}static _dispose3(e){if(e instanceof Ke&&e.geometry.dispose(),e instanceof Ke){const t=Array.isArray(e.material)?e.material:[e.material];for(const n of t)ft.disposeMaterialTextures(n),n.dispose()}}static dispose3(e){e.traverse(t=>{(t instanceof Ke||t instanceof $h)&&ft._dispose3(t)}),(e instanceof Ke||e instanceof $h||e instanceof gs)&&ft._dispose3(e)}static animateValue(e,t,n,s){const r=performance.now();function a(o){const l=o-r,c=Math.min(l/n,1),u=e+(t-e)*c;s(u),c<1&&requestAnimationFrame(a)}requestAnimationFrame(a)}static getCustomStylesTemplate(){if(ft.epigraphCustomStylesTemplate===void 0){const t=document.querySelector("#epigraphCustomStyles")?.content;t&&t.children.length>0&&(ft.epigraphCustomStylesTemplate=re`<style>${t.children[0].textContent}</style>`)}return ft.epigraphCustomStylesTemplate}}class Zd{constructor(e){this._success=e}get success(){return this._success}set success(e){this._success=e}get failed(){return!this._success}}class l6 extends Zd{constructor(e=!1,t=void 0){super(e),this.__payload=t}get payload(){return this.__payload}set payload(e){this.__payload=e}}var V2=(i=>(i.Empty="entity-empty",i.Gltf="entity-mesh",i.Render="entity-render",i.Proxy="entity-proxy",i.Collider="entity-collider",i.Asset="entity-asset",i))(V2||{});class c6 extends In{constructor(){super(),this._entityType=V2.Empty}get entityType(){return this._entityType}dispose(){let e;const t=new l6(!1,e);return e=void 0,t.success=!0,t.payload=e,t}}var La=(i=>(i.GEO="geo",i.SPLAT="splat",i))(La||{});class Vp{constructor(e){this.__name=e}getName(){return this.__name}}var er=(i=>(i.declared="declared",i.Loading="loading",i.Loaded="loaded",i.Unloaded="unloaded",i.Failed="failed",i))(er||{}),Co=(i=>(i.None="epg-resource-none",i.Gltf="epg-resource-gltf",i.Proxy="epg-resource-gltf-proxy",i.Render="epg-resource-gltf-render",i.Splat="epg-resource-splat",i))(Co||{});class Y2{constructor({id:e,uri:t,appWcRef:n}){this._loggerContext="EPG RESOURCE",this._type="epg-resource-none",this._id=crypto.randomUUID(),this._loadingProgress=0,this._state="declared",this._resource=null,e&&(this._id=e),this._appWcRef=n,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(){return window.epigraph.logger.info({title:"Loading EPG Resource. Override to define how a resource should be loaded.",contextOverride:this._loggerContext}),Promise.resolve(!0)}unload(){return this._resource={},Promise.resolve(!0)}}class Mo extends Dt{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 n=e.rotation;this.rotation.set(n.x,n.y,n.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 Mo(this.__config).copy(this,e)}showDebug(){const e=new Q().setFromEuler(this.rotation).normalize(),t=this.position,n=.2,s=16711680;this.__debugGeo=new VM(e,t,n,s,.06,.06);const r=document.createElement("div");r.textContent=this.name;const a=new Qb(r);r.style.pointerEvents="none";const o=new Q;this.getWorldDirection(o),o.normalize();const l=this.position.clone().addScaledVector(o,Math.random());a.position.set(l.x,l.y,l.z),this.__debugGeo.add(a),this.add(this.__debugGeo)}hideDebug(){this.__debugGeo&&(this.__debugGeo.clear(),this.__debugGeo?.removeFromParent(),ft.dispose3(this.__debugGeo))}}class Ua extends Dt{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 n=e.rotation;this.rotation.set(n.x,n.y,n.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 Ua(this.__config).copy(this,e)}showDebug(){const e=new Q().setFromEuler(this.rotation.clone()).normalize(),t=this.position,n=.1,s=65280;this.__debugGeo=new VM(e,t,n,s,.01,.08);const r=document.createElement("div");r.textContent=this.name,r.style.color="green";const a=new Qb(r);r.style.pointerEvents="none",this.__debugGeo.add(a),this.add(this.__debugGeo)}hideDebug(){this.__debugGeo&&(this.__debugGeo.clear(),this.__debugGeo?.removeFromParent(),ft.dispose3(this.__debugGeo))}}var cv=(i=>(i.Plug="plug",i.Receiver="receiver",i))(cv||{});class q2 extends Y2{constructor({id:e,uri:t,appWcRef:n}){super({id:e,uri:t,appWcRef:n}),this._type=Co.Gltf,this._resource=null,this._loggerContext="EPG RESOURCE GLTF"}get resource(){return this._resource}highlight(){}updateLoadingProgress(e){this._loadingProgress=e,this._appWcRef.eventsManager.assetLoadProgress.fire({progress:e})}async load(){if(this._state===er.Loaded||this._state===er.Loading)return Promise.resolve(!0);this._state=er.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:"",contextOverride:this._loggerContext}),window.epigraph.logger.error({title:"An error occurred while trying to load an asset!",details:t,contextOverride:this._loggerContext}),this._state=er.Failed,Promise.reject()));return e===void 0?Promise.reject(!1):(this._resource=e,await this._parseLoadedGltf(),this._state=er.Loaded,Promise.resolve(!0))}async _parseLoadedGltf(){window.epigraph.logger.info({title:"Parsing GLTF data",details:this._resource,contextOverride:this._loggerContext})}unload(){return this._resource?.scene&&ft.dispose3(this._resource.scene),this._resource={},Promise.resolve(!0)}}class h6 extends q2{constructor({id:e,uri:t,appWcRef:n}){super({id:e,uri:t,appWcRef:n}),this._loggerContext="EPG RESOURCE PROXY",this._type=Co.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===cv.Receiver){const n=new Ua({name:t.name,connectionId:t.userData.connectionId,position:t.position.clone(),rotation:t.rotation.clone()});this.__receivers.push(n),e.push(t)}else if(t.userData.epgType===cv.Plug){const n=new Mo({name:t.name,isPrimary:t.userData.isPrimary,connectionId:t.userData.connectionId,position:t.position.clone(),rotation:t.rotation.clone()});this.__plugs.push(n),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(),ft.dispose3(t)}unload(){return this._resource={},this.__plugs=[],this.__receivers=[],Promise.resolve(!0)}}class W2 extends q2{constructor({id:e,uri:t,appWcRef:n}){super({id:e,uri:t,appWcRef:n}),this._loggerContext="EPG RESOURCE RENDER",this._type=Co.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 Ke&&(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?.scene&&ft.dispose3(this._resource.scene),this._resource={},this.__variantsExtension={},this.__finishNamesFromAsset=[],Promise.resolve(!0)}}class u6 extends Y2{constructor({id:e,uri:t,appWcRef:n}){super({id:e,uri:t,appWcRef:n}),this._type=Co.Splat,this._resource=null,this.__splatMesh=null,this._loggerContext="EPG RESOURCE SPLAT",this._appWcRef.renderEngine.setupSparkRendererIfNotExists()}get resource(){return this._resource}get splatMesh(){return this.__splatMesh}__parseLoadedSplat(){this._resource&&(this.__splatMesh=new $h({packedSplats:this._resource}),this.__splatMesh.quaternion.set(1,0,0,0))}async load(){if(this._state===er.Loaded||this._state===er.Loading)return Promise.resolve(!0);this._state=er.Loading;const e=await this._appWcRef.loaders.splatLoader.loadAsync(this._uri,t=>{this.updateLoadingProgress(t.loaded/t.total*100)}).catch(t=>(window.epigraph.logger.groupCollapsed({title:"",contextOverride:this._loggerContext}),window.epigraph.logger.error({title:"An error occurred while trying to load a render splat resource!",details:t,contextOverride:this._loggerContext}),this._state=er.Failed,Promise.reject()));return e===void 0?Promise.reject(!1):(this._resource=e,this.__parseLoadedSplat(),this._state=er.Loaded,Promise.resolve(!0))}}class j2{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 h6({id:`${String(e.id)}-${Co.Proxy}`,uri:e.proxyGeo,appWcRef:this.__appWcRef}),this.__autoGenerateProxyEntity=e.autoGenerateProxyEntity,!this.isRootAsset&&this.__appWcRef.experienceData.currentAssetVersion<=0&&(this.__autoGenerateProxyEntity=!0),this.__appWcRef.productSettings.render.mode===La.SPLAT?this.__renderSplat=new u6({id:`${String(e.id)}-${Co.Splat}`,uri:e.renderSplat,appWcRef:this.__appWcRef}):this.__renderGltf=new W2({id:`${String(e.id)}-${Co.Render}`,uri:e.renderGeo,appWcRef:this.__appWcRef});for(const n in e.finishes)this.__finishes.set(n,new Vp(n));e.brandMaterialLibraries||(e.brandMaterialLibraries=[]),e.hotspots&&(this.__hotspots=e.hotspots)}get isRootAsset(){return this.__id===0}get id(){return this.__id}get name(){return this.__name}get assetRootDir(){const e=this.__appWcRef.productSettings.render.mode===La.SPLAT?this.__renderSplat?.uri:this.__renderGltf?.uri;return new URL(e+"/../../").href}get assetOverrides(){return this.__assetOverrides}get proxyGltf(){return this.__proxyGltf}get autoGenerateProxyEntity(){return this.__autoGenerateProxyEntity}get renderSplat(){return this.__renderSplat}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 loadRenderSplat(){await this.__renderSplat?.load(),this.__finishes.set("default",new Vp("default"))}async loadProxyGltf(){return!this.__proxyGltf||this.__proxyGltf.isLoaded?Promise.resolve(!0):await this.__proxyGltf.load()}pullFinishesFromRenderGltf(){this.__finishes.clear(),this.__renderGltf&&this.__renderGltf.finishNamesFromAsset.forEach(e=>{this.__finishes.has(e)||this.__finishes.set(e,new Vp(e))})}async parseAssetOverrideJson(){if(!this.__renderGltf)return null;let e=this.__renderGltf.resource?.asset.extras?.epgOverrides;if(!e)return null;e=e.replace("./","");const t=new URL(e,this.assetRootDir),n=await fetch(t).catch(s=>{window.epigraph.logger.error({title:`Failed to load asset override file: ${t}`,details:s,contextOverride:this._loggerContext})});n&&(this.__assetOverrides=await n.json())}async loadRenderGltf(e=!1){if(this.__renderGltf===void 0||this.__renderGltf.uri==="")return Promise.resolve(!0);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 n=this.__appWcRef.experienceData.materialLibraryCollection.materialLibraries.get(t);if(await n?.load(),!n){window.epigraph.logger.warn({title:`Material library ${t} not found in brand material libraries.`,contextOverride:this._loggerContext});continue}this.__brandMaterialLibraries.set(n.id,n);for(const s of n.finishNamesFromAsset)this.finishes.has(s)||this.__finishes.set(s,new Vp(s))}return e&&this.pullFinishesFromRenderGltf(),await this.parseAssetOverrideJson(),Promise.resolve(!0)}async load(e=!1){return Promise.all([this.loadRenderSplat(),this.loadRenderGltf(e),this.loadProxyGltf()])}}var d6=Object.defineProperty,X2=(i,e,t,n)=>{for(var s=void 0,r=i.length-1,a;r>=0;r--)(a=i[r])&&(s=a(e,t,s)||s);return s&&d6(e,t,s),s};class J2{constructor({appWcRef:e}){this._loggerContext="SOLUTION MANAGER",this._appWcRef=e}initialize(){window.epigraph.logger.info({title:"Initializing...",contextOverride:this._loggerContext})}}const Gb=class Uf extends ph{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(Uf.webComponentName)||window.customElements.define(Uf.webComponentName,Uf)}render(){return re`
|
|
12996
12996
|
${ft.getCustomStylesTemplate()}
|
|
12997
12997
|
`}};X2([H({type:Boolean,attribute:"enabled"})],Gb.prototype,"enabled");X2([H({attribute:!1})],Gb.prototype,"appWcRef");let Do=Gb;class A6{constructor({id:e,name:t,receiver:n,plug:s}){this.__name=t,this.__plug=s,this.__receiver=n,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 p6{constructor({id:e,receiver:t,plug:n}){this.__id=e,this.__plug=n,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 f6 extends In{constructor(e){super(),this.name="ENTITIES",this._loggerContext="SCENE STRUCTURE",this.__appWcRef=e,this.__eventsManager=this.__appWcRef.eventsManager}async setupRootEntity(e,t){const n=await new j2({id:0,name:"Root",proxyGeo:e??"https://asset.myepigraph.com/solutions-assets/__PIPELINE__/assets/3d-assets/proxyGeo/root-proxy.glb",autoGenerateProxyEntity:!1,renderGeo:t??"https://asset.myepigraph.com/solutions-assets/__PIPELINE__/assets/3d-assets/renderGeo/root-render.glb",renderSplat:"",finishes:{},hotspots:[],brandMaterialLibraries:[]},this.__appWcRef);await n.load().catch(()=>Promise.reject(!1));const s=new Pl(n,this.__appWcRef);await s.initialize(),this.add(s),this.__rootEntity=s}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 n;for(const s of t)if(s.asset.name===e){n=s;break}return n}getEntityForAssetId(e){const t=this.getSceneEntities();let n;for(const s of t)if(s.asset.id===e){n=s;break}return n}getSceneEntities(e=!1){const t=[];return this.__rootEntity.traverse(n=>{!e&&n.uuid===this.__rootEntity.uuid||n instanceof Pl&&t.push(n)}),t}getPossibleConnectionsForAssetInScene(e){const t=[];window.epigraph.logger.info({title:"Getting connections for asset in scene:",details:e,contextOverride:this._loggerContext});for(const n of this.getSceneEntities(!0)){const s=n.findPossibleConnectionsForAsset(e);s.length>0&&t.push(...s)}return window.epigraph.logger.table({title:"Possible Connections",details:t,contextOverride:this._loggerContext}),t}getAllConnectionsInScene(){const e=new Map;return this.traverse(t=>{if(t instanceof Ua||t instanceof Mo){if(t.connectionId===""||e.has(t.connectionId))return;let s=null,r=null;if(t instanceof Ua?(s=t,r=t.plug):t instanceof Mo&&(s=t.receiver,r=t),s!==null&&r!==null){const a=new p6({id:t.connectionId,receiver:s,plug:r});e.set(t.connectionId,a)}}}),e}}class g6 extends J2{constructor(e){super({appWcRef:e}),this._loggerContext="SCENE MANAGER",this.__sceneBounds=new Mn,this.__sceneCenter=new Q,this.__sceneSphericalBounds=new Ji,this.__sceneStructure=new f6(this._appWcRef)}get sceneStructure(){return this.__sceneStructure}get sceneBounds(){return this.__sceneBounds}get sceneBoundsCenter(){return this.__sceneCenter}get currentSceneSphericalBounds(){return this.__sceneSphericalBounds}recalculateSceneBounds(){this.__sceneBounds.makeEmpty(),this.__sceneStructure.isNotEmpty()&&this.__sceneStructure.rootEntity.traverse(e=>{e instanceof Ke&&e.userData.isProxyMesh&&this.__sceneBounds.expandByObject(e)}),this.__sceneBounds.getCenter(this.__sceneCenter),this.__sceneSphericalBounds.center=this.sceneBoundsCenter,this.__sceneBounds.getBoundingSphere(this.__sceneSphericalBounds),this._appWcRef.eventsManager.sceneBoundsChanged.fire()}}class m6 extends In{constructor(e,t){super(),this._loggerContext="RENDER ENTITY",this.__autoGeneratedBoundsBox=new Mn,this.__autoGeneratedBoundsSize=new Q,this.__activeFinish="",this.name="RENDER",this.__assetEntity=e,this.__textureLoader=t}get asset(){return this.__assetEntity.asset}get activeFinish(){return this.__activeFinish}get allAssetFinishes(){return this.asset.finishes}get allFinishIds(){return this.asset.allFinishIds}get autoGeneratedBoundsBox(){return this.__autoGeneratedBoundsBox}get autoGeneratedBoundsSize(){return this.__autoGeneratedBoundsSize}async initializeRenderGeoEntity(){const e=this.asset?.renderGltf?.resource?.scene?.clone(!0);if(!e)return Promise.reject();this.add(e),this.__autoGeneratedBoundsBox.setFromObject(e,!0),this.__autoGeneratedBoundsBox.getSize(this.__autoGeneratedBoundsSize);const t=new Q;if(this.__autoGeneratedBoundsBox.getCenter(t),this.asset.autoGenerateProxyEntity){window.epigraph.logger.group({title:"",contextOverride:this._loggerContext}),window.epigraph.logger.info({title:"Attempting to place render geo at the grid for AssetEntity...",details:this.asset,contextOverride:this._loggerContext});const n=new In;n.name="rendergeopivot";const s=new Gs(.01,.01,.01),r=new zs({color:65280,depthTest:!1}),a=new Ke(s,r);n.add(a),this.add(n),n.position.set(t.x,this.__autoGeneratedBoundsBox.min.y,t.z),n.attach(e),n.position.set(0,0,0),this.attach(e),n.removeFromParent(),ft.dispose3(n),window.epigraph.logger.info({title:"Done!!",contextOverride:this._loggerContext}),window.epigraph.logger.groupEnd()}}async initializeSplatEntity(){const e=this.asset.renderSplat?.splatMesh;if(!e)return;this.add(e),this.__autoGeneratedBoundsBox.copy(e.getBoundingBox(!1)),this.__autoGeneratedBoundsBox.getSize(this.__autoGeneratedBoundsSize);const t=new Q;if(this.__autoGeneratedBoundsBox.getCenter(t),this.asset.autoGenerateProxyEntity){window.epigraph.logger.group({title:"",contextOverride:this._loggerContext}),window.epigraph.logger.info({title:"Attempting to place render geo at the grid for AssetEntity...",details:this.asset,contextOverride:"ASSET ENTITY"});const n=new In;n.name="splatmeshpivot",this.attach(n),n.position.set(t.x,this.__autoGeneratedBoundsBox.max.y,t.z),e.position.set(-t.x,this.__autoGeneratedBoundsBox.max.y,-t.z),n.add(e),n.position.set(0,0,0),this.add(e),n.removeFromParent(),ft.dispose3(n),window.epigraph.logger.info({title:"Done!!",contextOverride:this._loggerContext}),window.epigraph.logger.groupEnd()}}async selectAssetFinish(e){window.epigraph.logger.info({title:`Switching to asset finish: ${e}`,contextOverride:this._loggerContext});const t=new Zd(!1);if(this.__assetEntity.isRenderingSplats())return t.success=!0,Promise.resolve(t);const n=this.asset.renderGltf;if(!n)return Promise.reject(t);const s=n.khrVariantsExtension,r=n.khrVariantsExtensionName;if(!s?.variants)return window.epigraph.logger.warn({title:"No KHR_Materials_Variants found in asset. Using default material.",contextOverride:this._loggerContext}),this.allFinishIds.length===1&&this.allFinishIds.includes(e)&&(this.__activeFinish=e),t.success=!0,Promise.resolve(t);let a=!0;if(await this.__selectFinishByKHRMaterialsVariantsExtension(s,r,e,n).catch(()=>{a=!1}),!a){const o=await this.__selectFinishByMaterialLibrary(s,r,e);t.success=o.success}return this.__activeFinish=e,Promise.resolve(t)}async __switchMaterial(e,t,n,s,r){const a=new Zd(!1);if(!(e instanceof Ke)||!e.isMesh)return Promise.resolve(a);if(!e.userData.gltfExtensions)return Promise.reject(a);const o=e.userData.gltfExtensions[t];if(!o)return window.epigraph.logger.error({title:"No variants extension found in mesh.",details:o,contextOverride:this._loggerContext}),Promise.reject(a);e.userData.originalMaterial||(e.userData.originalMaterial=e.material);const l=o.mappings.find(c=>c.variants.includes(s));if(l&&n.resource){const c=n.resource.parser;e.material=await c.getDependency("material",l.material),c.assignFinalMaterial(e),a.success=!0}else window.epigraph.logger.info({title:"Variant has no effect on this Object.",details:{object:e,finishId:r},contextOverride:this._loggerContext}),e.material=e.userData.originalMaterial,a.success=!0;return e.material.needsUpdate=!0,Promise.resolve(a)}__selectFinishByKHRMaterialsVariantsExtension(e,t,n,s){window.epigraph.logger.info({title:"Attempting to load finish using KHR Materials Variants",details:n,contextOverride:this._loggerContext});const r=e.variants.findIndex(o=>o.name===n),a=[];return this.traverse(o=>{a.push(this.__switchMaterial(o,t,s,r,n))}),Promise.all(a)}async __selectFinishByMaterialLibrary(e,t,n){const s=new Zd(!1);window.epigraph.logger.info({title:"Attempting to load finish by material library",details:n,contextOverride:this._loggerContext});for(const r of this.asset.brandMaterialLibraries.values()){const a=await r.getMaterialForFinishId(n);if(a===null)continue;const o=[];this.traverse(l=>{l instanceof Ke&&o.push((async()=>{l.material=a,await this.__processAnyOverridesForAsset(n,l),l.material.needsUpdate=!0})())}),await Promise.all(o)}return s.success=!1,s}async __processAnyOverridesForAsset(e,t){const n=this.asset.assetOverrides;if(!n)return;const s=n.brandMaterialLibrary;if(s){const r=s[e];if(r){r.sort((a,o)=>{const l=a.name.includes("."),c=o.name.includes(".");return l&&!c?1:!l&&c?-1:0});for(const a of r){const o=a.name,l=a.value,c=a.type,u=t.material;switch(window.epigraph.logger.info({title:`Override Property on asset: ${this.asset.id} MLIB: ${o} -> overrides[override]`,contextOverride:this._loggerContext}),c){case"image":await this.__processImageOverride(o,l,u);break;case"color":await this.__processColorOverride(o,l,u);break;case"number":await this.__processNumberOverride(o,l,u);break}}}}}__applyFinalPropertyValue(e,t,n){let s=n;const r=e.split(".");r.length===2&&(s=s[r[0]],e=r[1]),!(!s||!(e in s))&&(s[e]=t)}async __processImageOverride(e,t,n){const s=new URL(t,`${this.asset.assetRootDir}overrides/`).href,r=await this.__textureLoader.loadAsync(s).catch(a=>{window.epigraph.logger.error({title:`Couldn't load texture: ${s}`,details:a,contextOverride:"ASSET ENTITY"})});if(r){const a=e.split(".")[0],o=n[a];o?.userData?.__isOverrideTexture&&o.dispose(),r.flipY=!1,r.userData.__isOverrideTexture=!0,this.__applyFinalPropertyValue(e,r,n)}}__processColorOverride(e,t,n){const s=JSON.parse(t),r=new we(s[0],s[1],s[2]);this.__applyFinalPropertyValue(e,r,n)}__processNumberOverride(e,t,n){this.__applyFinalPropertyValue(e,parseFloat(t),n)}highlight(){this.traverseVisible(e=>{const t=e;if(t.isMesh){const n=t.material;if(!n.emissive)return;(n.emissive.r>0||n.emissive.g>0||n.emissive.b>0)&&(n.userData.epgData={orignalEmissive:n.emissive.clone(),originalEmissiveIntensity:n.emissiveIntensity}),n.emissive.r=1,n.emissive.g=1,n.emissive.b=1,n.emissiveIntensity=1}})}unhighlight(){this.traverseVisible(e=>{const t=e;if(t.isMesh){const n=t.material;if(!n.emissive)return;const s=n?.userData?.epgData?.orignalEmissive;s?(n.emissive.r=s.r,n.emissive.g=s.g,n.emissive.b=s.b):(n.emissive.r=0,n.emissive.g=0,n.emissive.b=0);const r=n?.userData?.epgData?.orignalEmissiveIntensity;n.emissiveIntensity=r!==void 0?r:0}})}}class y6 extends In{constructor(e){super(),this.name="PROXY",this.__assetEntity=e}get asset(){return this.__assetEntity.asset}}class _6 extends In{constructor(e){super(),this.name="HOTSPOTS",this.__assetEntity=e}get asset(){return this.__assetEntity.asset}}class E6 extends In{constructor(e){super(),this.name="COMMENTS",this.__assetEntity=e}get asset(){return this.__assetEntity.asset}}class Pl extends c6{constructor(e,t){super(),this.epgType="ENTITY_ASSET",this._loggerContext="ASSET ENTITY",this.__autoGeneratedProxy=new In,this.__animationMixer=null,this.__animations=new Map,this.name=e.name,this.__appWcRef=t,this.__proxyEntity=new y6(this),this.add(this.__proxyEntity),this.__renderEntity=new m6(this,this.__appWcRef.loaders.textureLoader),this.add(this.__renderEntity),this.__hotspotsEntity=new _6(this),this.add(this.__hotspotsEntity),this.__commentsEntity=new E6(this),this.add(this.__commentsEntity),this.__asset=e}get asset(){return this.__asset}get isRoot(){return this.name.toLowerCase()==="root"}get proxyEntity(){return this.__proxyEntity}get renderEntity(){return this.__renderEntity}get activeFinish(){return this.__renderEntity.activeFinish}get allAssetFinishes(){return this.__renderEntity.allAssetFinishes}get allFinishIds(){return this.__renderEntity.allFinishIds}highlight(){this.__renderEntity.highlight()}unhighlight(){this.__renderEntity.unhighlight()}addComment(e){e.entity.name=`COMMENT-${this.asset.name}-${crypto.randomUUID()}`,e.entity.userData.epgId=e.commentId,e.entity.position.set(e.config.position.x,e.config.position.y,e.config.position.z),this.__commentsEntity.add(e.entity)}removeComment(e){let t;this.__commentsEntity.traverse(n=>{n.userData.epgId===e&&(t=n)}),t&&(t.removeFromParent(),ft.dispose3(t))}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.__hotspotsEntity.add(e.entity)}removeHotspot(e){let t;this.__hotspotsEntity.traverse(n=>{n.userData.epgId===e&&(t=n)}),t&&(t.removeFromParent(),ft.dispose3(t))}isRenderingMesh(){return this.__appWcRef.productSettings.render.mode===La.GEO}isRenderingSplats(){return this.__appWcRef.productSettings.render.mode===La.SPLAT}async selectAssetFinish(e){return this.__renderEntity.selectAssetFinish(e)}findPossibleConnectionsForAsset(e){const t=[];return window.epigraph.logger.info({title:"Getting connections for asset in scene:",details:e,contextOverride:this._loggerContext}),this.__proxyEntity.traverse(n=>{if(!(n instanceof Ua))return;const s=n,r=e.proxyGltf?.plugs??[];for(const a of r)a.connectionId===s.connectionId&&t.push(new A6({name:a.connectionId,receiver:s,plug:a}))}),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(){this.__appWcRef.productSettings.render.mode===La.GEO?(await this.__renderEntity.initializeRenderGeoEntity(),this.__updateAnimations()):await this.__renderEntity.initializeSplatEntity()}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 Ke&&(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 Gs,t=new zs({color:65280,opacity:.5,transparent:!0}),n=new Ke(e,t);n.name="AutoGeneratedProxyMesh",n.scale.set(this.__renderEntity.autoGeneratedBoundsSize.x,this.__renderEntity.autoGeneratedBoundsSize.y,this.__renderEntity.autoGeneratedBoundsSize.z);const s=new In;s.name="proxygeopivot";const r=new Nh(.01,10,10),a=new zs({color:255,depthTest:!1}),o=new Ke(r,a);s.add(o),this.__proxyEntity.add(s),s.translateY(-this.__renderEntity.autoGeneratedBoundsSize.y*.5),s.attach(n),s.position.set(0,0,0),this.__proxyEntity.add(n),s.removeFromParent(),ft.dispose3(s),this.__autoGeneratedProxy.add(n)}__updateAnimations(){if(this.__asset.renderGltf&&(this.__animationMixer=null,this.__animations.clear(),this.__renderEntity.animations&&this.__asset.renderGltf.resource&&this.__asset.renderGltf.resource.animations.length>0)){this.__animationMixer=new HM(this.__renderEntity.children[0]);for(const e of this.__asset.renderGltf.resource.animations)this.__animations.set(e.name,this.__animationMixer.clipAction(e))}}}function K2(i,e,t,n){const s=Object.entries(i);class r extends Fn{static key=Sr.generateUUID();constructor(o){super({uniforms:s.reduce((l,[c,u])=>{const h=ab.clone({[c]:{value:u}});return{...l,...h}},{}),vertexShader:e,fragmentShader:t});for(const[l]of s)Object.defineProperty(this,l,{get:()=>this.uniforms[l].value,set:c=>this.uniforms[l].value=c});Object.assign(this,o)}}return r}const v6=K2({},"void main() { }","void main() { gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); discard; }");function b6(i){return i.isLight}function x6(i){return!!i.geometry}const C6=K2({color:new we(0),blend:2,alphaTest:.75,opacity:0,map:null},`varying vec2 vUv;
|
|
12998
12998
|
void main() {
|