@vertexvis/viewer 1.0.2-canary.1 → 1.0.2-canary.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/dist/cjs/index.cjs.js +1 -1
  2. package/dist/cjs/{multiElementInteractionHandler-DCKBIy58.js → multiElementInteractionHandler-BHvRKVIp.js} +20 -21
  3. package/dist/cjs/multiElementInteractionHandler-BHvRKVIp.js.map +1 -0
  4. package/dist/cjs/{queries-XG1IeRYE.js → queries-Da9I-xMf.js} +12 -12
  5. package/dist/cjs/queries-Da9I-xMf.js.map +1 -0
  6. package/dist/cjs/vertex-viewer-dom-element_2.cjs.entry.js +1 -1
  7. package/dist/cjs/vertex-viewer-teleport-tool.cjs.entry.js +1 -1
  8. package/dist/cjs/vertex-viewer-teleport-tool.cjs.entry.js.map +1 -1
  9. package/dist/cjs/vertex-viewer.cjs.entry.js +27 -18
  10. package/dist/cjs/vertex-viewer.cjs.entry.js.map +1 -1
  11. package/dist/collection/lib/interactions/baseInteractionHandler.js +18 -19
  12. package/dist/collection/lib/interactions/baseInteractionHandler.js.map +1 -1
  13. package/dist/collection/lib/interactions/interactionApi.js +17 -8
  14. package/dist/collection/lib/interactions/interactionApi.js.map +1 -1
  15. package/dist/collection/lib/interactions/mouseInteractions.js +8 -8
  16. package/dist/collection/lib/interactions/mouseInteractions.js.map +1 -1
  17. package/dist/collection/lib/scenes/camera.js +10 -10
  18. package/dist/collection/lib/scenes/camera.js.map +1 -1
  19. package/dist/collection/lib/teleportation/interactions.js +1 -1
  20. package/dist/collection/lib/teleportation/interactions.js.map +1 -1
  21. package/dist/components/index.js +1 -1
  22. package/dist/components/{p-BR7cFxzj.js → p-3DqRAYgO.js} +2 -2
  23. package/dist/components/p-3DqRAYgO.js.map +1 -0
  24. package/dist/components/{p-Bkhr6gno.js → p-BCOD9yfw.js} +2 -2
  25. package/dist/components/p-CAugdB_8.js +5 -0
  26. package/dist/components/p-CAugdB_8.js.map +1 -0
  27. package/dist/components/p-CGCJ5hbJ.js +5 -0
  28. package/dist/components/p-CGCJ5hbJ.js.map +1 -0
  29. package/dist/components/vertex-viewer-dom-renderer.js +1 -1
  30. package/dist/components/vertex-viewer-pin-tool.js +1 -1
  31. package/dist/components/vertex-viewer-teleport-tool.js +1 -1
  32. package/dist/components/vertex-viewer-view-cube.js +1 -1
  33. package/dist/components/vertex-viewer-walk-mode-tool.js +1 -1
  34. package/dist/components/vertex-viewer.js +1 -1
  35. package/dist/components/vertex-viewer.js.map +1 -1
  36. package/dist/esm/index.js +1 -1
  37. package/dist/esm/index.mjs +1 -1
  38. package/dist/esm/{multiElementInteractionHandler-C3A6SPxu.js → multiElementInteractionHandler-DwjL-r55.js} +20 -21
  39. package/dist/esm/multiElementInteractionHandler-DwjL-r55.js.map +1 -0
  40. package/dist/esm/{queries-CsBLqW1v.js → queries-DEzCmbTD.js} +12 -12
  41. package/dist/esm/queries-DEzCmbTD.js.map +1 -0
  42. package/dist/esm/vertex-viewer-dom-element_2.entry.js +1 -1
  43. package/dist/esm/vertex-viewer-teleport-tool.entry.js +1 -1
  44. package/dist/esm/vertex-viewer-teleport-tool.entry.js.map +1 -1
  45. package/dist/esm/vertex-viewer.entry.js +27 -18
  46. package/dist/esm/vertex-viewer.entry.js.map +1 -1
  47. package/dist/types/lib/interactions/baseInteractionHandler.d.ts +1 -1
  48. package/dist/types/lib/interactions/interactionApi.d.ts +2 -2
  49. package/dist/types/lib/interactions/mouseInteractions.d.ts +2 -2
  50. package/dist/types/lib/scenes/camera.d.ts +1 -0
  51. package/dist/viewer/index.esm.js +1 -1
  52. package/dist/viewer/p-07b99ac9.entry.js +5 -0
  53. package/dist/viewer/p-07b99ac9.entry.js.map +1 -0
  54. package/dist/viewer/{p-5ced98d5.entry.js → p-29d14611.entry.js} +2 -2
  55. package/dist/viewer/{p-72a0588f.entry.js → p-89544066.entry.js} +2 -2
  56. package/dist/viewer/p-89544066.entry.js.map +1 -0
  57. package/dist/viewer/p-D6eJC1q4.js +5 -0
  58. package/dist/viewer/p-D6eJC1q4.js.map +1 -0
  59. package/dist/viewer/{p-5U-3M0jx.js → p-EsKoKfmx.js} +2 -2
  60. package/dist/viewer/p-EsKoKfmx.js.map +1 -0
  61. package/dist/viewer/viewer.esm.js +1 -1
  62. package/package.json +7 -7
  63. package/dist/cjs/multiElementInteractionHandler-DCKBIy58.js.map +0 -1
  64. package/dist/cjs/queries-XG1IeRYE.js.map +0 -1
  65. package/dist/components/p-BQrJ-Yrs.js +0 -5
  66. package/dist/components/p-BQrJ-Yrs.js.map +0 -1
  67. package/dist/components/p-BR7cFxzj.js.map +0 -1
  68. package/dist/components/p-DizXmW54.js +0 -5
  69. package/dist/components/p-DizXmW54.js.map +0 -1
  70. package/dist/esm/multiElementInteractionHandler-C3A6SPxu.js.map +0 -1
  71. package/dist/esm/queries-CsBLqW1v.js.map +0 -1
  72. package/dist/viewer/p-5U-3M0jx.js.map +0 -1
  73. package/dist/viewer/p-72a0588f.entry.js.map +0 -1
  74. package/dist/viewer/p-77a0c7b7.entry.js +0 -5
  75. package/dist/viewer/p-77a0c7b7.entry.js.map +0 -1
  76. package/dist/viewer/p-CxLXWk2n.js +0 -5
  77. package/dist/viewer/p-CxLXWk2n.js.map +0 -1
  78. /package/dist/components/{p-Bkhr6gno.js.map → p-BCOD9yfw.js.map} +0 -0
  79. /package/dist/viewer/{p-5ced98d5.entry.js.map → p-29d14611.entry.js.map} +0 -0
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
3
3
  */
4
- import{r as t,c as n,h as e,H as s,a as i}from"./p-CCVkga9Q.js";import{v as o,q as h,m as a,h as r}from"./p-CkIzrpO0.js";import{o as l}from"./p-Ct0GdHoc.js";import{M as d}from"./p-5U-3M0jx.js";import"./p-Dp56p_jX.js";import"./p-BAhfr1Nx.js";import{V as c}from"./p-BsBIynwj.js";import"./p-CG9AChtV.js";import"./p-C7dYsPFU.js";import"./p-Og6pwwEB.js";const u=()=>`:host{position:absolute;pointer-events:none;visibility:hidden}:host([hydrated]){visibility:hidden}:host(.ready){visibility:inherit}:host(:not([interactions-off]))>*{pointer-events:auto}`;const f=class{constructor(e){t(this,e);this.occlusionStateChanged=n(this,"occlusionStateChanged");this.detachedStateChanged=n(this,"detachedStateChanged");this.propertyChange=n(this,"propertyChange");this.position=o.origin();this.positionJson="";this.quaternion=h.create();this.quaternionJson="";this.scale=o.create(1,1,1);this.scaleJson="";this.matrix=a.makeIdentity();this.occlusionOff=false;this.occluded=false;this.detachedOff=true;this.detached=false;this.billboardOff=false;this.interactionsOff=false}handlePositionChange(){this.syncMatrix()}handlePositionJsonChanged(){this.syncPosition()}handleRotationChanged(){this.syncQuaternionWithRotation()}handleRotationJsonChanged(){this.syncRotation()}handleQuaternionChange(){this.syncMatrix()}handleQuaternionJsonChanged(){this.syncQuaternion()}handleScaleChange(){this.syncMatrix()}handleScaleJsonChanged(){this.syncScale()}handleMatrixChanged(t,n){if(!l.isEqual(t,n)){this.propertyChange.emit()}}connectedCallback(){this.syncProperties()}componentShouldUpdate(t,n,e){return e==="occluded"}handleOcclusionStateChanged(){this.occlusionStateChanged.emit(this.occluded)}handleDetachedStateChanged(){this.detachedStateChanged.emit(this.detached)}syncProperties(){this.syncPosition();this.syncRotation();this.syncQuaternion();this.syncScale();this.syncMatrix()}syncPosition(){this.position=this.positionJson.length>0?this.parseJson("positionJson",this.positionJson,o.fromJson):this.position}syncRotation(){this.rotation=this.rotationJson!=null&&this.rotationJson.length>0?this.parseJson("rotationJson",this.rotationJson,r.fromJson):this.rotation;this.syncQuaternionWithRotation()}syncQuaternionWithRotation(){this.quaternion=this.rotation!=null?h.fromEuler(this.rotation):this.quaternion}syncQuaternion(){this.quaternion=this.quaternionJson.length>0?this.parseJson("quaternionJson",this.quaternionJson,h.fromJson):this.quaternion}syncScale(){this.scale=this.scaleJson.length>0?this.parseJson("scaleJson",this.scaleJson,o.fromJson):this.scale}syncMatrix(){if(this.position!=null&&this.quaternion!=null&&this.scale!=null){this.matrix=a.makeTRS(this.position,this.quaternion,this.scale)}}parseJson(t,n,e){try{return e(n)}catch(n){console.warn(`Could not parse \`${t}\`. Invalid JSON.`);throw n}}render(){return e(s,{key:"bf50fa97cdf5d144f262f721d3adc778340dc913"},e("slot",{key:"46d2e88b7d3ec6daae905d8c509cbe1a2b0d0a12"}))}static get watchers(){return{position:[{handlePositionChange:1}],positionJson:[{handlePositionJsonChanged:1}],rotation:[{handleRotationChanged:1}],rotationJson:[{handleRotationJsonChanged:1}],quaternion:[{handleQuaternionChange:1}],quaternionJson:[{handleQuaternionJsonChanged:1}],scale:[{handleScaleChange:1}],scaleJson:[{handleScaleJsonChanged:1}],matrix:[{handleMatrixChanged:0}],occluded:[{handleOcclusionStateChanged:0}],detached:[{handleDetachedStateChanged:0}]}}};f.style=u();function p(t){return t instanceof HTMLElement&&t.nodeName==="VERTEX-VIEWER-DOM-ELEMENT"&&t.matrix!=null}function v(t){return(t instanceof HTMLElement&&t.nodeName==="VERTEX-VIEWER-DOM-GROUP"||t instanceof HTMLElement&&t.dataset.isDomGroupElement!=null)&&t.matrix!=null}const m=(t,n)=>e("div",{class:"root-2d"},n);function C(t,n,e,s,i){const o=g(t,n,s).sort(((t,n)=>t.distanceToCamera-n.distanceToCamera));for(let t=0;t<o.length;t++){const{element:n,worldMatrix:h,worldPosition:a}=o[t];const r=i==null;const l=r||!n.occlusionOff&&(i===null||i===void 0?void 0:i.isOccluded(a,e));const d=r||!n.detachedOff&&(i===null||i===void 0?void 0:i.isDetached(a,e));const c=x(a,s.projectionViewMatrix,e);w(n,c);y(n,t,o.length);C(n,h,e,s,i);n.occluded=l!==null&&l!==void 0?l:false;n.detached=d!==null&&d!==void 0?d:false;n.classList.add("ready")}}function g(t,n,e){const s=[];for(let i=0;i<t.children.length;i++){const h=t.children[i];if(v(h)){const t=a.multiply(n,h.matrix);s.push(...g(h,t,e))}else if(p(h)){const t=a.multiply(n,h.matrix);const i=o.fromMatrixPosition(t);const r=o.distanceSquared(e.position,i);s.push({element:h,worldMatrix:t,worldPosition:i,distanceToCamera:r})}else{s.push(...g(h,n,e))}}return s}function w(t,n){t.style.transform=[`translate(-50%, -50%)`,`translate(${n.x}px, ${n.y}px)`].join(" ")}function y(t,n,e){t.style.zIndex=`${e-n}`}function x(t,n,e){const s=o.transformMatrix(t,n);return e.transformVectorToViewport(s)}const E=({camera:t,viewport:n},s)=>{const i=a.toObject(t.projectionMatrix);const o=t.isOrthographic()?t.far*2/(t.fovHeight*2)*(n.height/2):i.m22*(n.height/2);const h=[`translateZ(${o}px)`,b(t.viewMatrix),`translate(${n.width/2}px, ${n.height/2}px)`].join(" ");return e("div",{class:"root-3d",style:{perspective:`${o}px`}},e("div",{class:"camera",style:{transform:h}},s))};function J(t,n,e,s,i){for(let o=0;o<t.children.length;o++){const h=t.children[o];if(p(h)){M(h,n,e,s,i)}else if(v(h)){R(h,n,e,s,i)}else{J(h,n,e,s,i)}}}function M(t,n,e,s,i){const h=a.multiply(n,t.matrix);const r=o.fromMatrixPosition(h);const l=i==null;const d=l||!t.occlusionOff&&(i===null||i===void 0?void 0:i.isOccluded(r,e));t.occluded=d!==null&&d!==void 0?d:false;const c=l||!t.detachedOff&&(i===null||i===void 0?void 0:i.isDetached(r,e));t.detached=c!==null&&c!==void 0?c:false;t.classList.add("ready");if(t.billboardOff){t.style.transform=j(h)}else{let n=s.viewMatrix;n=a.transpose(n);n=a.position(n,h);n=a.scale(n,t.scale);n[3]=0;n[7]=0;n[11]=0;n[15]=1;t.style.transform=j(n)}J(t,h,e,s,i)}function R(t,n,e,s,i){const o=a.multiply(n,t.matrix);J(t,o,e,s,i)}function b(t){const n=[P(t[0]),P(-t[1]),P(t[2]),P(t[3]),P(t[4]),P(-t[5]),P(t[6]),P(t[7]),P(t[8]),P(-t[9]),P(t[10]),P(t[11]),P(t[12]),P(-t[13]),P(t[14]),P(t[15])].join(", ");return`matrix3d(${n})`}function j(t){const n=[P(t[0]),P(t[1]),P(t[2]),P(t[3]),P(-t[4]),P(-t[5]),P(-t[6]),P(-t[7]),P(t[8]),P(t[9]),P(t[10]),P(t[11]),P(t[12]),P(t[13]),P(t[14]),P(t[15])].join(", ");return[`translate(-50%, -50%)`,`matrix3d(${n})`].join(" ")}function P(t){return Math.abs(t)<1e-10?0:t}const S=()=>`.sc-vertex-viewer-dom-renderer-h{position:absolute;top:0;bottom:0;left:0;right:0;overflow:hidden;pointer-events:none}.root-3d.sc-vertex-viewer-dom-renderer{width:100%;height:100%;pointer-events:inherit}.camera.sc-vertex-viewer-dom-renderer{transform-style:preserve-3d;pointer-events:inherit;width:100%;height:100%}`;const V=class{constructor(n){t(this,n);this.drawMode="3d";this.propagateEventsToViewer=true;this.viewport=new c(0,0);this.invalidateFrameCounter=0;this.interactionDisposables=[];this.handleViewerFrameDrawn=async()=>{this.updatePropsFromViewer()}}componentWillLoad(){var t;const n=new ResizeObserver((()=>this.handleResize()));n.observe(this.hostEl);const e=new MutationObserver((()=>this.handleChildrenChange()));e.observe(this.hostEl,{childList:true});this.handleViewerChange(this.viewer,undefined);if(((t=this.viewer)===null||t===void 0?void 0:t.frame)!=null){this.handleViewerFrameDrawn()}}render(){if(this.camera!=null){if(this.drawMode==="2d"){return e(s,null,e(m,null,e("slot",null)))}else{return e(s,null,e(E,{camera:this.camera,viewport:this.viewport},e("slot",null)))}}else{return e(s,null)}}componentWillRender(){this.updateElements()}handleViewerChange(t,n){n===null||n===void 0?void 0:n.removeEventListener("frameDrawn",this.handleViewerFrameDrawn);t===null||t===void 0?void 0:t.addEventListener("frameDrawn",this.handleViewerFrameDrawn);if(this.propagateEventsToViewer&&t!=null){this.handleEventPropagationToViewer(t)}}handlePropertyChange(){this.invalidateFrame()}invalidateFrame(){this.invalidateFrameCounter=this.invalidateFrameCounter+1}handleEventPropagationToViewer(t){this.interactionDisposables.forEach((t=>{t.dispose()}));this.interactionDisposables=[];t.getInteractionHandlers().then((t=>{t.forEach((t=>{if(t instanceof d){const n=t.registerAdditionalElement(this.hostEl);this.interactionDisposables=[...this.interactionDisposables,n]}}))}))}async updateElements(){const{viewport:t,camera:n}=this;const e=a.makeIdentity();if(n!=null){if(this.drawMode==="3d"){J(this.hostEl,e,t,n,this.depthBuffer)}else{C(this.hostEl,e,t,n,this.depthBuffer)}}}handleResize(){const t=this.hostEl.getBoundingClientRect();this.viewport=new c(t.width,t.height)}handleChildrenChange(){this.invalidateFrame()}async updatePropsFromViewer(){const{frame:t}=this.viewer||{};this.depthBuffer=await(t===null||t===void 0?void 0:t.depthBuffer());this.camera=t===null||t===void 0?void 0:t.scene.camera}get hostEl(){return i(this)}static get watchers(){return{viewer:[{handleViewerChange:0}]}}};V.style=S();export{f as vertex_viewer_dom_element,V as vertex_viewer_dom_renderer};
5
- //# sourceMappingURL=p-5ced98d5.entry.js.map
4
+ import{r as t,c as n,h as e,H as s,a as i}from"./p-CCVkga9Q.js";import{v as o,q as h,m as a,h as r}from"./p-CkIzrpO0.js";import{o as l}from"./p-Ct0GdHoc.js";import{M as d}from"./p-EsKoKfmx.js";import"./p-Dp56p_jX.js";import"./p-BAhfr1Nx.js";import{V as c}from"./p-BsBIynwj.js";import"./p-CG9AChtV.js";import"./p-C7dYsPFU.js";import"./p-Og6pwwEB.js";const u=()=>`:host{position:absolute;pointer-events:none;visibility:hidden}:host([hydrated]){visibility:hidden}:host(.ready){visibility:inherit}:host(:not([interactions-off]))>*{pointer-events:auto}`;const f=class{constructor(e){t(this,e);this.occlusionStateChanged=n(this,"occlusionStateChanged");this.detachedStateChanged=n(this,"detachedStateChanged");this.propertyChange=n(this,"propertyChange");this.position=o.origin();this.positionJson="";this.quaternion=h.create();this.quaternionJson="";this.scale=o.create(1,1,1);this.scaleJson="";this.matrix=a.makeIdentity();this.occlusionOff=false;this.occluded=false;this.detachedOff=true;this.detached=false;this.billboardOff=false;this.interactionsOff=false}handlePositionChange(){this.syncMatrix()}handlePositionJsonChanged(){this.syncPosition()}handleRotationChanged(){this.syncQuaternionWithRotation()}handleRotationJsonChanged(){this.syncRotation()}handleQuaternionChange(){this.syncMatrix()}handleQuaternionJsonChanged(){this.syncQuaternion()}handleScaleChange(){this.syncMatrix()}handleScaleJsonChanged(){this.syncScale()}handleMatrixChanged(t,n){if(!l.isEqual(t,n)){this.propertyChange.emit()}}connectedCallback(){this.syncProperties()}componentShouldUpdate(t,n,e){return e==="occluded"}handleOcclusionStateChanged(){this.occlusionStateChanged.emit(this.occluded)}handleDetachedStateChanged(){this.detachedStateChanged.emit(this.detached)}syncProperties(){this.syncPosition();this.syncRotation();this.syncQuaternion();this.syncScale();this.syncMatrix()}syncPosition(){this.position=this.positionJson.length>0?this.parseJson("positionJson",this.positionJson,o.fromJson):this.position}syncRotation(){this.rotation=this.rotationJson!=null&&this.rotationJson.length>0?this.parseJson("rotationJson",this.rotationJson,r.fromJson):this.rotation;this.syncQuaternionWithRotation()}syncQuaternionWithRotation(){this.quaternion=this.rotation!=null?h.fromEuler(this.rotation):this.quaternion}syncQuaternion(){this.quaternion=this.quaternionJson.length>0?this.parseJson("quaternionJson",this.quaternionJson,h.fromJson):this.quaternion}syncScale(){this.scale=this.scaleJson.length>0?this.parseJson("scaleJson",this.scaleJson,o.fromJson):this.scale}syncMatrix(){if(this.position!=null&&this.quaternion!=null&&this.scale!=null){this.matrix=a.makeTRS(this.position,this.quaternion,this.scale)}}parseJson(t,n,e){try{return e(n)}catch(n){console.warn(`Could not parse \`${t}\`. Invalid JSON.`);throw n}}render(){return e(s,{key:"bf50fa97cdf5d144f262f721d3adc778340dc913"},e("slot",{key:"46d2e88b7d3ec6daae905d8c509cbe1a2b0d0a12"}))}static get watchers(){return{position:[{handlePositionChange:1}],positionJson:[{handlePositionJsonChanged:1}],rotation:[{handleRotationChanged:1}],rotationJson:[{handleRotationJsonChanged:1}],quaternion:[{handleQuaternionChange:1}],quaternionJson:[{handleQuaternionJsonChanged:1}],scale:[{handleScaleChange:1}],scaleJson:[{handleScaleJsonChanged:1}],matrix:[{handleMatrixChanged:0}],occluded:[{handleOcclusionStateChanged:0}],detached:[{handleDetachedStateChanged:0}]}}};f.style=u();function p(t){return t instanceof HTMLElement&&t.nodeName==="VERTEX-VIEWER-DOM-ELEMENT"&&t.matrix!=null}function v(t){return(t instanceof HTMLElement&&t.nodeName==="VERTEX-VIEWER-DOM-GROUP"||t instanceof HTMLElement&&t.dataset.isDomGroupElement!=null)&&t.matrix!=null}const m=(t,n)=>e("div",{class:"root-2d"},n);function C(t,n,e,s,i){const o=g(t,n,s).sort(((t,n)=>t.distanceToCamera-n.distanceToCamera));for(let t=0;t<o.length;t++){const{element:n,worldMatrix:h,worldPosition:a}=o[t];const r=i==null;const l=r||!n.occlusionOff&&(i===null||i===void 0?void 0:i.isOccluded(a,e));const d=r||!n.detachedOff&&(i===null||i===void 0?void 0:i.isDetached(a,e));const c=x(a,s.projectionViewMatrix,e);w(n,c);y(n,t,o.length);C(n,h,e,s,i);n.occluded=l!==null&&l!==void 0?l:false;n.detached=d!==null&&d!==void 0?d:false;n.classList.add("ready")}}function g(t,n,e){const s=[];for(let i=0;i<t.children.length;i++){const h=t.children[i];if(v(h)){const t=a.multiply(n,h.matrix);s.push(...g(h,t,e))}else if(p(h)){const t=a.multiply(n,h.matrix);const i=o.fromMatrixPosition(t);const r=o.distanceSquared(e.position,i);s.push({element:h,worldMatrix:t,worldPosition:i,distanceToCamera:r})}else{s.push(...g(h,n,e))}}return s}function w(t,n){t.style.transform=[`translate(-50%, -50%)`,`translate(${n.x}px, ${n.y}px)`].join(" ")}function y(t,n,e){t.style.zIndex=`${e-n}`}function x(t,n,e){const s=o.transformMatrix(t,n);return e.transformVectorToViewport(s)}const E=({camera:t,viewport:n},s)=>{const i=a.toObject(t.projectionMatrix);const o=t.isOrthographic()?t.far*2/(t.fovHeight*2)*(n.height/2):i.m22*(n.height/2);const h=[`translateZ(${o}px)`,b(t.viewMatrix),`translate(${n.width/2}px, ${n.height/2}px)`].join(" ");return e("div",{class:"root-3d",style:{perspective:`${o}px`}},e("div",{class:"camera",style:{transform:h}},s))};function J(t,n,e,s,i){for(let o=0;o<t.children.length;o++){const h=t.children[o];if(p(h)){M(h,n,e,s,i)}else if(v(h)){R(h,n,e,s,i)}else{J(h,n,e,s,i)}}}function M(t,n,e,s,i){const h=a.multiply(n,t.matrix);const r=o.fromMatrixPosition(h);const l=i==null;const d=l||!t.occlusionOff&&(i===null||i===void 0?void 0:i.isOccluded(r,e));t.occluded=d!==null&&d!==void 0?d:false;const c=l||!t.detachedOff&&(i===null||i===void 0?void 0:i.isDetached(r,e));t.detached=c!==null&&c!==void 0?c:false;t.classList.add("ready");if(t.billboardOff){t.style.transform=P(h)}else{let n=s.viewMatrix;n=a.transpose(n);n=a.position(n,h);n=a.scale(n,t.scale);n[3]=0;n[7]=0;n[11]=0;n[15]=1;t.style.transform=P(n)}J(t,h,e,s,i)}function R(t,n,e,s,i){const o=a.multiply(n,t.matrix);J(t,o,e,s,i)}function b(t){const n=[S(t[0]),S(-t[1]),S(t[2]),S(t[3]),S(t[4]),S(-t[5]),S(t[6]),S(t[7]),S(t[8]),S(-t[9]),S(t[10]),S(t[11]),S(t[12]),S(-t[13]),S(t[14]),S(t[15])].join(", ");return`matrix3d(${n})`}function P(t){const n=[S(t[0]),S(t[1]),S(t[2]),S(t[3]),S(-t[4]),S(-t[5]),S(-t[6]),S(-t[7]),S(t[8]),S(t[9]),S(t[10]),S(t[11]),S(t[12]),S(t[13]),S(t[14]),S(t[15])].join(", ");return[`translate(-50%, -50%)`,`matrix3d(${n})`].join(" ")}function S(t){return Math.abs(t)<1e-10?0:t}const j=()=>`.sc-vertex-viewer-dom-renderer-h{position:absolute;top:0;bottom:0;left:0;right:0;overflow:hidden;pointer-events:none}.root-3d.sc-vertex-viewer-dom-renderer{width:100%;height:100%;pointer-events:inherit}.camera.sc-vertex-viewer-dom-renderer{transform-style:preserve-3d;pointer-events:inherit;width:100%;height:100%}`;const V=class{constructor(n){t(this,n);this.drawMode="3d";this.propagateEventsToViewer=true;this.viewport=new c(0,0);this.invalidateFrameCounter=0;this.interactionDisposables=[];this.handleViewerFrameDrawn=async()=>{this.updatePropsFromViewer()}}componentWillLoad(){var t;const n=new ResizeObserver((()=>this.handleResize()));n.observe(this.hostEl);const e=new MutationObserver((()=>this.handleChildrenChange()));e.observe(this.hostEl,{childList:true});this.handleViewerChange(this.viewer,undefined);if(((t=this.viewer)===null||t===void 0?void 0:t.frame)!=null){this.handleViewerFrameDrawn()}}render(){if(this.camera!=null){if(this.drawMode==="2d"){return e(s,null,e(m,null,e("slot",null)))}else{return e(s,null,e(E,{camera:this.camera,viewport:this.viewport},e("slot",null)))}}else{return e(s,null)}}componentWillRender(){this.updateElements()}handleViewerChange(t,n){n===null||n===void 0?void 0:n.removeEventListener("frameDrawn",this.handleViewerFrameDrawn);t===null||t===void 0?void 0:t.addEventListener("frameDrawn",this.handleViewerFrameDrawn);if(this.propagateEventsToViewer&&t!=null){this.handleEventPropagationToViewer(t)}}handlePropertyChange(){this.invalidateFrame()}invalidateFrame(){this.invalidateFrameCounter=this.invalidateFrameCounter+1}handleEventPropagationToViewer(t){this.interactionDisposables.forEach((t=>{t.dispose()}));this.interactionDisposables=[];t.getInteractionHandlers().then((t=>{t.forEach((t=>{if(t instanceof d){const n=t.registerAdditionalElement(this.hostEl);this.interactionDisposables=[...this.interactionDisposables,n]}}))}))}async updateElements(){const{viewport:t,camera:n}=this;const e=a.makeIdentity();if(n!=null){if(this.drawMode==="3d"){J(this.hostEl,e,t,n,this.depthBuffer)}else{C(this.hostEl,e,t,n,this.depthBuffer)}}}handleResize(){const t=this.hostEl.getBoundingClientRect();this.viewport=new c(t.width,t.height)}handleChildrenChange(){this.invalidateFrame()}async updatePropsFromViewer(){const{frame:t}=this.viewer||{};this.depthBuffer=await(t===null||t===void 0?void 0:t.depthBuffer());this.camera=t===null||t===void 0?void 0:t.scene.camera}get hostEl(){return i(this)}static get watchers(){return{viewer:[{handleViewerChange:0}]}}};V.style=j();export{f as vertex_viewer_dom_element,V as vertex_viewer_dom_renderer};
5
+ //# sourceMappingURL=p-29d14611.entry.js.map
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
3
3
  */
4
- import{r as i,c as t,h as s,H as n}from"./p-CCVkga9Q.js";import{p as o,v as e,c as h,b as l,r as a}from"./p-CkIzrpO0.js";import{g as d}from"./p-C7dYsPFU.js";import{E as r}from"./p-CFus3r7d.js";import{W as u,a as c}from"./p-DUX5FvBC.js";import"./p-Ct0GdHoc.js";import"./p-CG9AChtV.js";class v{constructor(i,t){this.model=i;this.animationConfiguration=t;this.rectObserver=new r;this.handlePointerDown=this.handlePointerDown.bind(this);this.handlePointerUp=this.handlePointerUp.bind(this);this.handleEnabledChange=this.handleEnabledChange.bind(this);this.handleTeleportModeChange=this.handleTeleportModeChange.bind(this);this.enabledChangeDisposable=this.model.onEnabledChange(this.handleEnabledChange)}dispose(){var i;this.disable();(i=this.enabledChangeDisposable)===null||i===void 0?void 0:i.dispose();this.element=undefined;this.api=undefined;this.rectObserver.disconnect()}initialize(i,t){this.element=i;this.api=t;this.rectObserver.observe(i);this.handleEnabledChange(this.model.getEnabled())}setAnimations(i){this.animationConfiguration=i}enable(){var i;this.disable();this.teleportModeChangeDisposable=this.model.onTeleportModeChange(this.handleTeleportModeChange);(i=this.element)===null||i===void 0?void 0:i.addEventListener("pointerdown",this.handlePointerDown);this.handleTeleportModeChange(this.model.getTeleportMode())}disable(){var i,t,s;(i=this.teleportModeChangeDisposable)===null||i===void 0?void 0:i.dispose();(t=this.cursorDisposable)===null||t===void 0?void 0:t.dispose();(s=this.element)===null||s===void 0?void 0:s.removeEventListener("pointerdown",this.handlePointerDown)}async handlePointerDown(i){this.downPosition=d(i,this.rectObserver.rect);this.downButtons=i.buttons;window.addEventListener("pointerup",this.handlePointerUp)}async handlePointerUp(i){var t,s;const n=this.model.getTeleportMode();const e=(s=(t=this.api)===null||t===void 0?void 0:t.pixelThreshold())!==null&&s!==void 0?s:2;const h=d(i,this.rectObserver.rect);const l=this.downButtons===2;const a=i.shiftKey||i.altKey||i.metaKey||i.ctrlKey;if(n!=null&&this.downPosition!=null&&o.distance(this.downPosition,h)<=e&&!l&&!a){switch(n){case"teleport":return this.teleportToHit(h);case"teleport-toward":return this.teleportTowardHit(h);case"teleport-and-align":return this.teleportAndAlign(h)}}this.downPosition=undefined;window.removeEventListener("pointerup",this.handlePointerUp)}async beginInteraction(){var i,t;if(!((i=this.api)===null||i===void 0?void 0:i.isInteracting())){await((t=this.api)===null||t===void 0?void 0:t.beginInteraction())}}async endInteraction(){var i;await((i=this.api)===null||i===void 0?void 0:i.endInteraction())}async teleportTowardHit(i){var t,s;const n=await((t=this.api)===null||t===void 0?void 0:t.getWorldPointFromViewport(i));const o=(s=this.api)===null||s===void 0?void 0:s.getRayFromPoint(i);if(o!=null){const{teleportDistancePercentage:i,teleportCollisionDistance:t}=this.model.getConfiguration();const s=i/100;return this.performInteraction((({camera:i,boundingBox:d})=>{const r=Math.max(...e.toArray(h.lengths(d)))*s;const u=l.fromNormalAndCoplanarPoint(i.up,i.position);const c=l.projectPoint(u,n!==null&&n!==void 0?n:i.position);const v=e.distance(i.position,c);if(v<r&&v>t*1.1){const s=a.create({...o,origin:c});const n=l.projectPoint(u,a.at(s,-t));return i.update({position:n,lookAt:e.add(i.lookAt,e.subtract(n,i.position))})}else{const t=l.projectPoint(u,a.at(o,r));return i.update({position:t,lookAt:e.add(i.lookAt,e.subtract(t,i.position))})}}))}}async teleportToHit(i){const t=await this.getWorldPointWithFallback(i);if(t!=null){return this.performInteraction((({camera:i,boundingBox:s})=>{const n=this.shortestLength(s);const o=this.model.getTeleportHeightPercentage()/100;const h=l.fromNormalAndCoplanarPoint(i.up,i.position);const d=l.projectPoint(h,t);const r=a.create({origin:i.position,direction:e.normalize(e.subtract(d,i.position))});const u=e.distance(i.position,d);const c=e.distance(i.position,i.lookAt);const v=a.at(r,u-n*o);const p=a.create({origin:v,direction:e.normalize(i.viewVector)});return i.update({position:v,lookAt:a.at(p,c)})}))}}async teleportAndAlign(i){var t;const s=await((t=this.api)===null||t===void 0?void 0:t.hitItems(i));const n=s!=null?s[0]:undefined;if((n===null||n===void 0?void 0:n.hitNormal)!=null&&(n===null||n===void 0?void 0:n.hitPoint)){await this.performInteraction((({camera:i,boundingBox:t})=>{const s=this.shortestLength(t);const o=this.model.getTeleportHeightPercentage()/100;const e=a.create({origin:n.hitPoint,direction:n.hitNormal});return i.alignTo(a.at(e,s*o),n.hitNormal)}))}}async performInteraction(i){var t;await this.beginInteraction();await((t=this.api)===null||t===void 0?void 0:t.transformCamera(i,this.renderConfiguration()));await this.endInteraction()}async getWorldPointWithFallback(i){var t,s;const n=await((t=this.api)===null||t===void 0?void 0:t.getWorldPointFromViewport(i));if(n==null){const t=await((s=this.api)===null||s===void 0?void 0:s.hitItems(i));const o=t!=null?t[0]:undefined;return(o===null||o===void 0?void 0:o.hitPoint)!=null?o.hitPoint:n}return n}handleEnabledChange(i){if(i){this.enable()}else{this.disable()}}handleTeleportModeChange(i){var t,s;(t=this.cursorDisposable)===null||t===void 0?void 0:t.dispose();if(i!=null){this.cursorDisposable=(s=this.api)===null||s===void 0?void 0:s.addCursor("crosshair")}}shortestLength(i){return Math.min(...e.toArray(h.lengths(i)))}renderConfiguration(){return this.animationConfiguration!=null?{animation:{milliseconds:this.animationConfiguration.durationMs}}:undefined}}const p=()=>`:host{position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none}`;const f=class{constructor(s){i(this,s);this.controllerChanged=t(this,"controllerChanged");this.animationsDisabled=false;this.animationMs=500;this.model=new u;this.stateMap={}}componentWillLoad(){this.setupController();this.setupInteractionHandler();this.setDepthBuffers()}connectedCallback(){this.setupInteractionHandler();this.setDepthBuffers()}disconnectedCallback(){this.clearInteractionHandler();this.resetDepthBuffers()}handleModeChange(){var i;(i=this.controller)===null||i===void 0?void 0:i.setTeleportMode(this.mode);if(this.mode!=null){this.setDepthBuffers()}else{this.resetDepthBuffers()}}handleViewerChanged(){this.clearInteractionHandler();this.setupInteractionHandler();this.setDepthBuffers()}handleAnimationMsChanged(){var i;if(this.animationMs!=null){(i=this.interactionHandler)===null||i===void 0?void 0:i.setAnimations({durationMs:this.animationMs})}}handleAnimationsDisabledChanged(){var i,t;if(this.animationsDisabled){(i=this.interactionHandler)===null||i===void 0?void 0:i.setAnimations(undefined)}else if(this.animationMs!=null){(t=this.interactionHandler)===null||t===void 0?void 0:t.setAnimations({durationMs:this.animationMs})}}handleControllerChanged(){this.setupInteractionHandler();this.setupController();this.controllerChanged.emit(this.controller)}handleModelChanged(){this.setupController();this.clearInteractionHandler();this.setupInteractionHandler()}render(){return s(n,{key:"c8a6512176d203d38ae647ccddcfa8adf307f977"})}setupController(){if(this.controller==null){this.controller=new c(this.model);this.controller.setTeleportMode(this.mode);this.controllerChanged.emit(this.controller)}else{this.controller.setTeleportMode(this.mode);this.controller.updateModel(this.model)}}setDepthBuffers(){if(this.mode!=null&&this.viewer!=null&&this.viewer.depthBuffers==null){this.stateMap.shouldClearDepthBuffers=true;this.viewer.depthBuffers="final"}}resetDepthBuffers(){if(this.stateMap.shouldClearDepthBuffers&&this.viewer!=null){this.viewer.depthBuffers=undefined;this.stateMap.shouldClearDepthBuffers=undefined}}clearInteractionHandler(){var i,t;(i=this.interactionHandlerDisposable)===null||i===void 0?void 0:i.dispose();this.interactionHandlerDisposable=undefined;(t=this.interactionHandler)===null||t===void 0?void 0:t.dispose();this.interactionHandler=undefined}async setupInteractionHandler(){var i;if(this.interactionHandler==null){this.interactionHandler=new v(this.model,!this.animationsDisabled&&this.animationMs!=null?{durationMs:this.animationMs}:undefined);this.interactionHandlerDisposable=await((i=this.viewer)===null||i===void 0?void 0:i.registerInteractionHandler(this.interactionHandler))}}static get watchers(){return{mode:[{handleModeChange:0}],viewer:[{handleViewerChanged:0}],animationMs:[{handleAnimationMsChanged:0}],animationsDisabled:[{handleAnimationsDisabledChanged:0}],controller:[{handleControllerChanged:0}],model:[{handleModelChanged:0}]}}};f.style=p();export{f as vertex_viewer_teleport_tool};
5
- //# sourceMappingURL=p-72a0588f.entry.js.map
4
+ import{r as i,c as t,h as s,H as n}from"./p-CCVkga9Q.js";import{p as o,v as e,c as h,b as l,r as a}from"./p-CkIzrpO0.js";import{g as d}from"./p-C7dYsPFU.js";import{E as r}from"./p-CFus3r7d.js";import{W as u,a as c}from"./p-DUX5FvBC.js";import"./p-Ct0GdHoc.js";import"./p-CG9AChtV.js";class v{constructor(i,t){this.model=i;this.animationConfiguration=t;this.rectObserver=new r;this.handlePointerDown=this.handlePointerDown.bind(this);this.handlePointerUp=this.handlePointerUp.bind(this);this.handleEnabledChange=this.handleEnabledChange.bind(this);this.handleTeleportModeChange=this.handleTeleportModeChange.bind(this);this.enabledChangeDisposable=this.model.onEnabledChange(this.handleEnabledChange)}dispose(){var i;this.disable();(i=this.enabledChangeDisposable)===null||i===void 0?void 0:i.dispose();this.element=undefined;this.api=undefined;this.rectObserver.disconnect()}initialize(i,t){this.element=i;this.api=t;this.rectObserver.observe(i);this.handleEnabledChange(this.model.getEnabled())}setAnimations(i){this.animationConfiguration=i}enable(){var i;this.disable();this.teleportModeChangeDisposable=this.model.onTeleportModeChange(this.handleTeleportModeChange);(i=this.element)===null||i===void 0?void 0:i.addEventListener("pointerdown",this.handlePointerDown);this.handleTeleportModeChange(this.model.getTeleportMode())}disable(){var i,t,s;(i=this.teleportModeChangeDisposable)===null||i===void 0?void 0:i.dispose();(t=this.cursorDisposable)===null||t===void 0?void 0:t.dispose();(s=this.element)===null||s===void 0?void 0:s.removeEventListener("pointerdown",this.handlePointerDown)}async handlePointerDown(i){this.downPosition=d(i,this.rectObserver.rect);this.downButtons=i.buttons;window.addEventListener("pointerup",this.handlePointerUp)}async handlePointerUp(i){var t,s;const n=this.model.getTeleportMode();const e=(s=(t=this.api)===null||t===void 0?void 0:t.pixelThreshold())!==null&&s!==void 0?s:2;const h=d(i,this.rectObserver.rect);const l=this.downButtons===2;const a=i.shiftKey||i.altKey||i.metaKey||i.ctrlKey;if(n!=null&&this.downPosition!=null&&o.distance(this.downPosition,h)<=e&&!l&&!a){switch(n){case"teleport":return this.teleportToHit(h);case"teleport-toward":return this.teleportTowardHit(h);case"teleport-and-align":return this.teleportAndAlign(h)}}this.downPosition=undefined;window.removeEventListener("pointerup",this.handlePointerUp)}async beginInteraction(){var i,t;if(!((i=this.api)===null||i===void 0?void 0:i.isInteracting())){await((t=this.api)===null||t===void 0?void 0:t.beginInteraction())}}async endInteraction(){var i;await((i=this.api)===null||i===void 0?void 0:i.endInteraction())}async teleportTowardHit(i){var t,s;const n=await((t=this.api)===null||t===void 0?void 0:t.getWorldPointFromViewport(i));const o=(s=this.api)===null||s===void 0?void 0:s.getRayFromPoint(i);if(o!=null){const{teleportDistancePercentage:i,teleportCollisionDistance:t}=this.model.getConfiguration();const s=i/100;return this.performInteraction((({camera:i,boundingBox:d})=>{const r=Math.max(...e.toArray(h.lengths(d)))*s;const u=l.fromNormalAndCoplanarPoint(i.up,i.position);const c=l.projectPoint(u,n!==null&&n!==void 0?n:i.position);const v=e.distance(i.position,c);if(v<r&&v>t*1.1){const s=a.create({...o,origin:c});const n=l.projectPoint(u,a.at(s,-t));return i.update({position:n,lookAt:e.add(i.lookAt,e.subtract(n,i.position))})}else{const t=l.projectPoint(u,a.at(o,r));return i.update({position:t,lookAt:e.add(i.lookAt,e.subtract(t,i.position))})}}))}}async teleportToHit(i){const t=await this.getWorldPointWithFallback(i);if(t!=null){return this.performInteraction((({camera:i,boundingBox:s})=>{const n=this.shortestLength(s);const o=this.model.getTeleportHeightPercentage()/100;const h=l.fromNormalAndCoplanarPoint(i.up,i.position);const d=l.projectPoint(h,t);const r=a.create({origin:i.position,direction:e.normalize(e.subtract(d,i.position))});const u=e.distance(i.position,d);const c=e.distance(i.position,i.lookAt);const v=a.at(r,u-n*o);const p=a.create({origin:v,direction:e.normalize(i.viewVector)});return i.update({position:v,lookAt:a.at(p,c)})}))}}async teleportAndAlign(i){var t;const s=await((t=this.api)===null||t===void 0?void 0:t.hitItems(i));const n=s!=null?s[0]:undefined;if((n===null||n===void 0?void 0:n.hitNormal)!=null&&(n===null||n===void 0?void 0:n.hitPoint)){await this.performInteraction((({camera:i,boundingBox:t})=>{const s=this.shortestLength(t);const o=this.model.getTeleportHeightPercentage()/100;const e=a.create({origin:n.hitPoint,direction:n.hitNormal});return i.alignTo(a.at(e,s*o),n.hitNormal)}))}}async performInteraction(i){var t;await this.beginInteraction();await((t=this.api)===null||t===void 0?void 0:t.transformCamera(i,this.renderConfiguration()));await this.endInteraction()}async getWorldPointWithFallback(i){var t,s;const n=await((t=this.api)===null||t===void 0?void 0:t.getWorldPointFromViewport(i));if(n==null){const t=await((s=this.api)===null||s===void 0?void 0:s.hitItems(i));const o=t!=null?t[0]:undefined;return(o===null||o===void 0?void 0:o.hitPoint)!=null?o.hitPoint:n}return n}handleEnabledChange(i){if(i){this.enable()}else{this.disable()}}handleTeleportModeChange(i){var t,s;(t=this.cursorDisposable)===null||t===void 0?void 0:t.dispose();if(i!=null){this.cursorDisposable=(s=this.api)===null||s===void 0?void 0:s.addCursor("crosshair")}}shortestLength(i){return Math.min(...e.toArray(h.lengths(i)))}renderConfiguration(){return this.animationConfiguration!=null?{animation:{milliseconds:this.animationConfiguration.durationMs}}:{}}}const p=()=>`:host{position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none}`;const f=class{constructor(s){i(this,s);this.controllerChanged=t(this,"controllerChanged");this.animationsDisabled=false;this.animationMs=500;this.model=new u;this.stateMap={}}componentWillLoad(){this.setupController();this.setupInteractionHandler();this.setDepthBuffers()}connectedCallback(){this.setupInteractionHandler();this.setDepthBuffers()}disconnectedCallback(){this.clearInteractionHandler();this.resetDepthBuffers()}handleModeChange(){var i;(i=this.controller)===null||i===void 0?void 0:i.setTeleportMode(this.mode);if(this.mode!=null){this.setDepthBuffers()}else{this.resetDepthBuffers()}}handleViewerChanged(){this.clearInteractionHandler();this.setupInteractionHandler();this.setDepthBuffers()}handleAnimationMsChanged(){var i;if(this.animationMs!=null){(i=this.interactionHandler)===null||i===void 0?void 0:i.setAnimations({durationMs:this.animationMs})}}handleAnimationsDisabledChanged(){var i,t;if(this.animationsDisabled){(i=this.interactionHandler)===null||i===void 0?void 0:i.setAnimations(undefined)}else if(this.animationMs!=null){(t=this.interactionHandler)===null||t===void 0?void 0:t.setAnimations({durationMs:this.animationMs})}}handleControllerChanged(){this.setupInteractionHandler();this.setupController();this.controllerChanged.emit(this.controller)}handleModelChanged(){this.setupController();this.clearInteractionHandler();this.setupInteractionHandler()}render(){return s(n,{key:"c8a6512176d203d38ae647ccddcfa8adf307f977"})}setupController(){if(this.controller==null){this.controller=new c(this.model);this.controller.setTeleportMode(this.mode);this.controllerChanged.emit(this.controller)}else{this.controller.setTeleportMode(this.mode);this.controller.updateModel(this.model)}}setDepthBuffers(){if(this.mode!=null&&this.viewer!=null&&this.viewer.depthBuffers==null){this.stateMap.shouldClearDepthBuffers=true;this.viewer.depthBuffers="final"}}resetDepthBuffers(){if(this.stateMap.shouldClearDepthBuffers&&this.viewer!=null){this.viewer.depthBuffers=undefined;this.stateMap.shouldClearDepthBuffers=undefined}}clearInteractionHandler(){var i,t;(i=this.interactionHandlerDisposable)===null||i===void 0?void 0:i.dispose();this.interactionHandlerDisposable=undefined;(t=this.interactionHandler)===null||t===void 0?void 0:t.dispose();this.interactionHandler=undefined}async setupInteractionHandler(){var i;if(this.interactionHandler==null){this.interactionHandler=new v(this.model,!this.animationsDisabled&&this.animationMs!=null?{durationMs:this.animationMs}:undefined);this.interactionHandlerDisposable=await((i=this.viewer)===null||i===void 0?void 0:i.registerInteractionHandler(this.interactionHandler))}}static get watchers(){return{mode:[{handleModeChange:0}],viewer:[{handleViewerChanged:0}],animationMs:[{handleAnimationMsChanged:0}],animationsDisabled:[{handleAnimationsDisabledChanged:0}],controller:[{handleControllerChanged:0}],model:[{handleModelChanged:0}]}}};f.style=p();export{f as vertex_viewer_teleport_tool};
5
+ //# sourceMappingURL=p-89544066.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["TeleportInteractionHandler","constructor","model","animationConfiguration","this","rectObserver","ElementRectObserver","handlePointerDown","bind","handlePointerUp","handleEnabledChange","handleTeleportModeChange","enabledChangeDisposable","onEnabledChange","dispose","disable","_a","element","undefined","api","disconnect","initialize","observe","getEnabled","setAnimations","config","enable","teleportModeChangeDisposable","onTeleportModeChange","addEventListener","getTeleportMode","_b","cursorDisposable","_c","removeEventListener","event","downPosition","getMouseClientPosition","rect","downButtons","buttons","window","mode","threshold","pixelThreshold","point","isRightClick","hasModifier","shiftKey","altKey","metaKey","ctrlKey","Point","distance","teleportToHit","teleportTowardHit","teleportAndAlign","beginInteraction","isInteracting","endInteraction","worldPoint","getWorldPointFromViewport","mouseRay","getRayFromPoint","teleportDistancePercentage","teleportCollisionDistance","getConfiguration","teleportDistanceScalar","performInteraction","camera","boundingBox","stepDistance","Math","max","Vector3","toArray","BoundingBox","lengths","positionPlane","Plane","fromNormalAndCoplanarPoint","up","position","projectedWorldPoint","projectPoint","distanceToWorldPoint","mouseRayAtWorldPoint","Ray","create","origin","nextPosition","at","update","lookAt","add","subtract","projectedNextStep","getWorldPointWithFallback","shortestBoundingBoxLength","shortestLength","heightScalar","getTeleportHeightPercentage","cameraPlane","projectedHitPosition","rayToHitPosition","direction","normalize","distanceToHitPosition","distanceToLookAt","newPosition","newPositionViewVectorRay","viewVector","hits","hitItems","hit","hitNormal","hitPoint","upRay","alignTo","fn","transformCamera","renderConfiguration","enabled","addCursor","min","animation","milliseconds","durationMs","viewerTeleportToolCss","ViewerTeleportTool","hostRef","animationsDisabled","animationMs","WalkModeModel","stateMap","componentWillLoad","setupController","setupInteractionHandler","setDepthBuffers","connectedCallback","disconnectedCallback","clearInteractionHandler","resetDepthBuffers","handleModeChange","controller","setTeleportMode","handleViewerChanged","handleAnimationMsChanged","interactionHandler","handleAnimationsDisabledChanged","handleControllerChanged","controllerChanged","emit","handleModelChanged","render","h","Host","key","WalkModeController","updateModel","viewer","depthBuffers","shouldClearDepthBuffers","interactionHandlerDisposable","registerInteractionHandler"],"sources":["src/lib/teleportation/interactions.ts","src/components/viewer-teleport-tool/viewer-teleport-tool.css?tag=vertex-viewer-teleport-tool&encapsulation=shadow","src/components/viewer-teleport-tool/viewer-teleport-tool.tsx"],"sourcesContent":["import { BoundingBox, Plane, Point, Ray, Vector3 } from '@vertexvis/geometry';\nimport { Disposable } from '@vertexvis/utils';\n\nimport { getMouseClientPosition } from '../dom';\nimport { ElementRectObserver } from '../elementRectObserver';\nimport {\n CameraTransform,\n InteractionApi,\n InteractionHandler,\n} from '../interactions';\nimport { Camera, CameraRenderOptions } from '../scenes';\nimport { ViewerTeleportMode, WalkModeModel } from '../walk-mode/model';\n\nexport interface AnimationConfiguration {\n durationMs: number;\n}\n\nexport class TeleportInteractionHandler implements InteractionHandler {\n private api?: InteractionApi;\n private element?: HTMLElement;\n\n private rectObserver = new ElementRectObserver();\n\n private downPosition?: Point.Point;\n private downButtons?: number;\n\n private enabledChangeDisposable?: Disposable;\n private teleportModeChangeDisposable?: Disposable;\n private cursorDisposable?: Disposable;\n\n public constructor(\n private model: WalkModeModel,\n private animationConfiguration?: AnimationConfiguration\n ) {\n this.handlePointerDown = this.handlePointerDown.bind(this);\n this.handlePointerUp = this.handlePointerUp.bind(this);\n this.handleEnabledChange = this.handleEnabledChange.bind(this);\n this.handleTeleportModeChange = this.handleTeleportModeChange.bind(this);\n\n this.enabledChangeDisposable = this.model.onEnabledChange(\n this.handleEnabledChange\n );\n }\n\n public dispose(): void {\n this.disable();\n this.enabledChangeDisposable?.dispose();\n\n this.element = undefined;\n this.api = undefined;\n\n this.rectObserver.disconnect();\n }\n\n public initialize(element: HTMLElement, api: InteractionApi): void {\n this.element = element;\n this.api = api;\n\n this.rectObserver.observe(element);\n\n this.handleEnabledChange(this.model.getEnabled());\n }\n\n public setAnimations(config?: AnimationConfiguration): void {\n this.animationConfiguration = config;\n }\n\n public enable(): void {\n this.disable();\n\n this.teleportModeChangeDisposable = this.model.onTeleportModeChange(\n this.handleTeleportModeChange\n );\n this.element?.addEventListener('pointerdown', this.handlePointerDown);\n\n this.handleTeleportModeChange(this.model.getTeleportMode());\n }\n\n public disable(): void {\n this.teleportModeChangeDisposable?.dispose();\n this.cursorDisposable?.dispose();\n\n this.element?.removeEventListener('pointerdown', this.handlePointerDown);\n }\n\n private async handlePointerDown(event: PointerEvent): Promise<void> {\n this.downPosition = getMouseClientPosition(event, this.rectObserver.rect);\n this.downButtons = event.buttons;\n\n window.addEventListener('pointerup', this.handlePointerUp);\n }\n\n private async handlePointerUp(event: PointerEvent): Promise<void> {\n const mode = this.model.getTeleportMode();\n const threshold = this.api?.pixelThreshold() ?? 2;\n const point = getMouseClientPosition(event, this.rectObserver.rect);\n const isRightClick = this.downButtons === 2;\n const hasModifier =\n event.shiftKey || event.altKey || event.metaKey || event.ctrlKey;\n\n if (\n mode != null &&\n this.downPosition != null &&\n Point.distance(this.downPosition, point) <= threshold &&\n !isRightClick &&\n !hasModifier\n ) {\n switch (mode) {\n case 'teleport':\n return this.teleportToHit(point);\n case 'teleport-toward':\n return this.teleportTowardHit(point);\n case 'teleport-and-align':\n return this.teleportAndAlign(point);\n }\n }\n\n this.downPosition = undefined;\n\n window.removeEventListener('pointerup', this.handlePointerUp);\n }\n\n private async beginInteraction(): Promise<void> {\n if (!this.api?.isInteracting()) {\n await this.api?.beginInteraction();\n }\n }\n\n private async endInteraction(): Promise<void> {\n await this.api?.endInteraction();\n }\n\n private async teleportTowardHit(point: Point.Point): Promise<void> {\n const worldPoint = await this.api?.getWorldPointFromViewport(point);\n const mouseRay = this.api?.getRayFromPoint(point);\n\n if (mouseRay != null) {\n const { teleportDistancePercentage, teleportCollisionDistance } =\n this.model.getConfiguration();\n const teleportDistanceScalar = teleportDistancePercentage / 100;\n\n return this.performInteraction(({ camera, boundingBox }) => {\n const stepDistance =\n Math.max(...Vector3.toArray(BoundingBox.lengths(boundingBox))) *\n teleportDistanceScalar;\n\n const positionPlane = Plane.fromNormalAndCoplanarPoint(\n camera.up,\n camera.position\n );\n const projectedWorldPoint = Plane.projectPoint(\n positionPlane,\n worldPoint ?? camera.position\n );\n const distanceToWorldPoint = Vector3.distance(\n camera.position,\n projectedWorldPoint\n );\n\n if (\n distanceToWorldPoint < stepDistance &&\n distanceToWorldPoint > teleportCollisionDistance * 1.1\n ) {\n const mouseRayAtWorldPoint = Ray.create({\n ...mouseRay,\n origin: projectedWorldPoint,\n });\n const nextPosition = Plane.projectPoint(\n positionPlane,\n Ray.at(mouseRayAtWorldPoint, -teleportCollisionDistance)\n );\n\n return camera.update({\n position: nextPosition,\n lookAt: Vector3.add(\n camera.lookAt,\n Vector3.subtract(nextPosition, camera.position)\n ),\n });\n } else {\n const projectedNextStep = Plane.projectPoint(\n positionPlane,\n Ray.at(mouseRay, stepDistance)\n );\n\n return camera.update({\n position: projectedNextStep,\n lookAt: Vector3.add(\n camera.lookAt,\n Vector3.subtract(projectedNextStep, camera.position)\n ),\n });\n }\n });\n }\n }\n\n private async teleportToHit(point: Point.Point): Promise<void> {\n const worldPoint = await this.getWorldPointWithFallback(point);\n\n if (worldPoint != null) {\n return this.performInteraction(({ camera, boundingBox }) => {\n const shortestBoundingBoxLength = this.shortestLength(boundingBox);\n const heightScalar = this.model.getTeleportHeightPercentage() / 100;\n\n const cameraPlane = Plane.fromNormalAndCoplanarPoint(\n camera.up,\n camera.position\n );\n const projectedHitPosition = Plane.projectPoint(\n cameraPlane,\n worldPoint\n );\n\n const rayToHitPosition = Ray.create({\n origin: camera.position,\n direction: Vector3.normalize(\n Vector3.subtract(projectedHitPosition, camera.position)\n ),\n });\n const distanceToHitPosition = Vector3.distance(\n camera.position,\n projectedHitPosition\n );\n const distanceToLookAt = Vector3.distance(\n camera.position,\n camera.lookAt\n );\n\n const newPosition = Ray.at(\n rayToHitPosition,\n distanceToHitPosition - shortestBoundingBoxLength * heightScalar\n );\n const newPositionViewVectorRay = Ray.create({\n origin: newPosition,\n direction: Vector3.normalize(camera.viewVector),\n });\n\n return camera.update({\n position: newPosition,\n lookAt: Ray.at(newPositionViewVectorRay, distanceToLookAt),\n });\n });\n }\n }\n\n private async teleportAndAlign(point: Point.Point): Promise<void> {\n const hits = await this.api?.hitItems(point);\n const hit = hits != null ? hits[0] : undefined;\n\n if (hit?.hitNormal != null && hit?.hitPoint) {\n await this.performInteraction(({ camera, boundingBox }) => {\n const shortestBoundingBoxLength = this.shortestLength(boundingBox);\n const heightScalar = this.model.getTeleportHeightPercentage() / 100;\n\n const upRay = Ray.create({\n origin: hit.hitPoint as Vector3.Vector3,\n direction: hit.hitNormal as Vector3.Vector3,\n });\n\n return camera.alignTo(\n Ray.at(upRay, shortestBoundingBoxLength * heightScalar),\n hit.hitNormal as Vector3.Vector3\n );\n });\n }\n }\n\n private async performInteraction(fn: CameraTransform<Camera>): Promise<void> {\n await this.beginInteraction();\n await this.api?.transformCamera(fn, this.renderConfiguration());\n await this.endInteraction();\n }\n\n private async getWorldPointWithFallback(\n point: Point.Point\n ): Promise<Vector3.Vector3 | undefined> {\n const worldPoint = await this.api?.getWorldPointFromViewport(point);\n\n if (worldPoint == null) {\n const hits = await this.api?.hitItems(point);\n const hit = hits != null ? hits[0] : undefined;\n\n return hit?.hitPoint != null\n ? (hit.hitPoint as Vector3.Vector3)\n : worldPoint;\n }\n return worldPoint;\n }\n\n private handleEnabledChange(enabled: boolean): void {\n if (enabled) {\n this.enable();\n } else {\n this.disable();\n }\n }\n\n private handleTeleportModeChange(mode?: ViewerTeleportMode): void {\n this.cursorDisposable?.dispose();\n\n if (mode != null) {\n this.cursorDisposable = this.api?.addCursor('crosshair');\n }\n }\n\n private shortestLength(boundingBox: BoundingBox.BoundingBox): number {\n return Math.min(...Vector3.toArray(BoundingBox.lengths(boundingBox)));\n }\n\n private renderConfiguration(): CameraRenderOptions {\n return this.animationConfiguration != null\n ? { animation: { milliseconds: this.animationConfiguration.durationMs } }\n : {};\n }\n}\n",":host {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n pointer-events: none;\n}\n","import {\n Component,\n Event,\n EventEmitter,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n h,\n Host,\n JSX,\n Prop,\n Watch,\n} from '@stencil/core';\nimport { Disposable } from '@vertexvis/utils';\n\nimport { TeleportInteractionHandler } from '../../lib/teleportation/interactions';\nimport { WalkModeController } from '../../lib/walk-mode/controller';\nimport { ViewerTeleportMode, WalkModeModel } from '../../lib/walk-mode/model';\n\ninterface StateMap {\n shouldClearDepthBuffers?: boolean;\n}\n\n/**\n * The `<vertex-viewer-teleport-tool>` allows for click-based \"teleportation\"\n * around a model, which is particularly useful for walking through a model.\n * This tool is automatically included as part of the <vertex-viewer-walk-mode-tool>.\n */\n@Component({\n tag: 'vertex-viewer-teleport-tool',\n styleUrl: 'viewer-teleport-tool.css',\n shadow: true,\n})\nexport class ViewerTeleportTool {\n /**\n * The viewer that this component is bound to. This is automatically assigned\n * if added to the light-dom of a parent viewer element.\n */\n @Prop()\n public viewer?: HTMLVertexViewerElement;\n\n /**\n * The type of teleportation to perform when clicking.\n *\n * `teleport` - the camera's `position` is moved to the location of the hit result\n * constrained by the plane represented by the camera's current `position` and `up`\n * vectors.\n *\n * `teleport-and-align` - the camera's `position`, `lookAt`, and `up` vectors are updated\n * to align to the plane represented by the hit result's position and normal.\n *\n * `teleport-toward` - the camera's `position` is moved a fixed distance toward the location of the\n * hit result constrained by the plane represented by the camera's current `position` and `up`\n * vectors.\n *\n * `undefined` - no teleportation will occur when clicking.\n *\n * Defaults to `undefined`.\n */\n @Prop({ mutable: true })\n public mode?: ViewerTeleportMode;\n\n /**\n * Indicates whether animations will be used when performing camera\n * operations. Defaults to `false`.\n */\n @Prop()\n public animationsDisabled = false;\n\n /**\n * The duration of animations, in milliseconds. Defaults to `500`.\n */\n @Prop()\n public animationMs?: number = 500;\n\n @Prop({ mutable: true })\n public controller?: WalkModeController;\n\n @Prop({ mutable: true })\n public model: WalkModeModel = new WalkModeModel();\n\n /**\n * Event emitted when the `WalkModeController` associated with this tool changes.\n */\n @Event()\n public controllerChanged!: EventEmitter<WalkModeController>;\n\n private interactionHandlerDisposable?: Disposable;\n private interactionHandler?: TeleportInteractionHandler;\n\n private stateMap: StateMap = {};\n\n /**\n * @ignore\n */\n protected componentWillLoad(): void {\n this.setupController();\n this.setupInteractionHandler();\n this.setDepthBuffers();\n }\n\n /**\n * @ignore\n */\n protected connectedCallback(): void {\n this.setupInteractionHandler();\n this.setDepthBuffers();\n }\n\n /**\n * @ignore\n */\n protected disconnectedCallback(): void {\n this.clearInteractionHandler();\n this.resetDepthBuffers();\n }\n\n /**\n * @ignore\n */\n @Watch('mode')\n protected handleModeChange(): void {\n this.controller?.setTeleportMode(this.mode);\n\n if (this.mode != null) {\n this.setDepthBuffers();\n } else {\n this.resetDepthBuffers();\n }\n }\n\n /**\n * @ignore\n */\n @Watch('viewer')\n protected handleViewerChanged(): void {\n this.clearInteractionHandler();\n this.setupInteractionHandler();\n this.setDepthBuffers();\n }\n\n /**\n * @ignore\n */\n @Watch('animationMs')\n protected handleAnimationMsChanged(): void {\n if (this.animationMs != null) {\n this.interactionHandler?.setAnimations({ durationMs: this.animationMs });\n }\n }\n\n /**\n * @ignore\n */\n @Watch('animationsDisabled')\n protected handleAnimationsDisabledChanged(): void {\n if (this.animationsDisabled) {\n this.interactionHandler?.setAnimations(undefined);\n } else if (this.animationMs != null) {\n this.interactionHandler?.setAnimations({ durationMs: this.animationMs });\n }\n }\n\n /**\n * @ignore\n */\n @Watch('controller')\n protected handleControllerChanged(): void {\n this.setupInteractionHandler();\n this.setupController();\n this.controllerChanged.emit(this.controller);\n }\n\n @Watch('model')\n protected handleModelChanged(): void {\n this.setupController();\n this.clearInteractionHandler();\n this.setupInteractionHandler();\n }\n\n protected render(): JSX.Element {\n return <Host></Host>;\n }\n\n private setupController(): void {\n if (this.controller == null) {\n this.controller = new WalkModeController(this.model);\n this.controller.setTeleportMode(this.mode);\n this.controllerChanged.emit(this.controller);\n } else {\n this.controller.setTeleportMode(this.mode);\n this.controller.updateModel(this.model);\n }\n }\n\n private setDepthBuffers(): void {\n if (\n this.mode != null &&\n this.viewer != null &&\n this.viewer.depthBuffers == null\n ) {\n this.stateMap.shouldClearDepthBuffers = true;\n this.viewer.depthBuffers = 'final';\n }\n }\n\n private resetDepthBuffers(): void {\n if (this.stateMap.shouldClearDepthBuffers && this.viewer != null) {\n this.viewer.depthBuffers = undefined;\n this.stateMap.shouldClearDepthBuffers = undefined;\n }\n }\n\n private clearInteractionHandler(): void {\n this.interactionHandlerDisposable?.dispose();\n this.interactionHandlerDisposable = undefined;\n this.interactionHandler?.dispose();\n this.interactionHandler = undefined;\n }\n\n private async setupInteractionHandler(): Promise<void> {\n if (this.interactionHandler == null) {\n this.interactionHandler = new TeleportInteractionHandler(\n this.model,\n !this.animationsDisabled && this.animationMs != null\n ? { durationMs: this.animationMs }\n : undefined\n );\n\n this.interactionHandlerDisposable =\n await this.viewer?.registerInteractionHandler(this.interactionHandler);\n }\n }\n}\n"],"mappings":";;;kSAiBaA,EAaX,WAAAC,CACUC,EACAC,GADAC,KAAAF,QACAE,KAAAD,yBAXFC,KAAAC,aAAe,IAAIC,EAazBF,KAAKG,kBAAoBH,KAAKG,kBAAkBC,KAAKJ,MACrDA,KAAKK,gBAAkBL,KAAKK,gBAAgBD,KAAKJ,MACjDA,KAAKM,oBAAsBN,KAAKM,oBAAoBF,KAAKJ,MACzDA,KAAKO,yBAA2BP,KAAKO,yBAAyBH,KAAKJ,MAEnEA,KAAKQ,wBAA0BR,KAAKF,MAAMW,gBACxCT,KAAKM,oB,CAIF,OAAAI,G,MACLV,KAAKW,WACLC,EAAAZ,KAAKQ,2BAAuB,MAAAI,SAAA,SAAAA,EAAEF,UAE9BV,KAAKa,QAAUC,UACfd,KAAKe,IAAMD,UAEXd,KAAKC,aAAae,Y,CAGb,UAAAC,CAAWJ,EAAsBE,GAC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Nd,KAAK+J,oCACGnJ,EAAAZ,KAAK4J,UAAM,MAAAhJ,SAAA,SAAAA,EAAEoJ,2BAA2BhK,KAAKgJ,oB","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ /*!
2
+ * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
3
+ */
4
+ import{c as e,u as t,b as s,a as n}from"./p-Ct0GdHoc.js";import{c as i,d as r,e as a}from"./p--8q6LyIm.js";import{u as o,m as u,a as h,p as c,b as l,r as d}from"./p-BDvACHun.js";import{s as p,w}from"./p-BNuMPeJ8.js";import{r as v,c as f}from"./p-CjG1fMh1.js";import{c as m,v as y,m as x,q as I,r as g,f as b,p as S,e as B}from"./p-CkIzrpO0.js";import{N as A,t as E,P as R,Q as V,R as q,u as T,e as k,f as C}from"./p-Dp56p_jX.js";import"./p-BAhfr1Nx.js";import{t as P,v as O,L as M}from"./p-Og6pwwEB.js";const j={opacity:255,glossiness:4,diffuse:{r:0,g:0,b:0,a:0},ambient:{r:0,g:0,b:0,a:0},specular:{r:0,g:0,b:0,a:0},emissive:{r:0,g:0,b:0,a:0}};const _=(e,t,s,n)=>({...j,opacity:n!==null&&n!==void 0?n:j.opacity,diffuse:{r:e,g:t,b:s,a:0}});const D=(t,s)=>{const n=e.fromHexString(t);return{...j,opacity:s!==null&&s!==void 0?s:j.opacity,diffuse:n!=null?{...n}:{...j.diffuse}}};var N=Object.freeze({__proto__:null,create:_,defaultColor:j,fromHex:D});function U(e){var s;const n=t.parse(e);if(n.scheme!=="urn"||n.path==null){throw new Error("Invalid URN. Expected URN scheme.")}const[r,a,o,...u]=n.path.split(/[:/]/);if(r!=="vertexvis"&&r!=="vertex"){throw new Error("Invalid URN. Expected URN to be vertex namespace")}if(r==="vertexvis"){console.warn("vertexvis namespace is deprecated. Use 'vertex' for the namespace urn instead")}switch(a){case"stream-key":const e=z(n.query);const t=(s=F(u.join("/")))!==null&&s!==void 0?s:e.find((e=>e.type==="scene-view-state"));return{resource:{type:"stream-key",id:o},subResource:t,queries:e.filter((e=>e.type!=="scene-view-state"))};default:throw new i(`Invalid URN. Unknown resource type ${a}`)}}function F(e){if(e!=null){const[t,s]=e.split("/");switch(t){case"scene-view-states":return{type:"scene-view-state",id:s};default:return undefined}}}function z(e){if(e!=null){return e.split("&").map((e=>{const[t,s]=e.split("=");switch(t){case"supplied-id":return{type:"supplied-id",id:s};case"scene-view-state":return{type:"scene-view-state",id:s};default:throw new Error("Invalid URN. Unknown query value type")}}))}else{return[]}}var H=Object.freeze({__proto__:null,fromUrn:U});function L(e){return e.id!=null}function Q(e){return e.suppliedId!=null}var Y=Object.freeze({__proto__:null,isSceneViewStateId:L,isSceneViewStateSuppliedId:Q});class G{constructor(e,t=new Date){this.knownRemoteTime=e;this.knownLocalTime=t}localOffset(){return this.duration(this.knownLocalTime,this.localNow())}localTime(e){const t=typeof e==="number"?new Date(this.knownLocalTime.getTime()+e):e;const s=this.duration(this.knownRemoteTime,t);return this.addDuration(this.knownLocalTime,s)}remoteOffset(e=new Date){return this.duration(this.remoteTime(this.knownLocalTime),this.remoteTime(e))}remoteNow(){return this.remoteTime(this.localNow())}remoteTime(e){const t=typeof e==="number"?new Date(this.knownLocalTime.getTime()+e):e;const s=this.duration(this.knownLocalTime,t);return this.addDuration(this.knownRemoteTime,s)}addDuration(e,t){return new Date(e.getTime()+t)}duration(e,t){return t.getTime()-e.getTime()}localNow(){return new Date(Date.now())}}function J(e){const t=s.toMsbLsb(e);const n=new o.Uuid2l;n.setMsb(t.msb);n.setLsb(t.lsb);return n}class W{constructor(e,t,s,n){this.client=e;this.stream=t;this.jwtProvider=s;this.deviceIdProvider=n}async listByItem(e,{hasAnnotations:t,cursor:s,size:n=50}={}){const i=await v((async i=>{const r=this.deviceIdProvider();const a=await f(this.jwtProvider,r);const o=new p.ListItemModelViewsRequest;const u=J(e);o.setItemId(u);if(t!=null){const e=new w.BoolValue;e.setValue(t);o.setHasAnnotations(e)}const h=new c.Pager;h.setLimit(n);if(s!=null){h.setCursor(s)}o.setPage(h);this.client.listItemModelViews(o,a,i)}));return u(i.toObject())}async load(e,t){const s=h({modelViewId:t,sceneItemId:e});this.stream.updateModelView({itemModelView:s},true)}async unload(){await this.stream.updateModelView({},true)}}class X{constructor(e,t,s){this.client=e;this.jwtProvider=t;this.deviceIdProvider=s}async listAnnotations({modelViewId:e,cursor:t,size:s=50}={}){const n=await v((async n=>{const i=this.deviceIdProvider();const r=await f(this.jwtProvider,i);const a=new p.ListPmiAnnotationsRequest;if(e!=null){const t=J(e);a.setModelViewId(t)}const o=new c.Pager;o.setLimit(s);if(t!=null){o.setCursor(t)}a.setPage(o);this.client.listPmiAnnotations(a,r,n)}));return l(n.toObject())}}const $=1e3*10;class K{constructor(e,t,s,n=$){this.stream=e;this.predicate=t;this.transform=s;this.timeout=n;this.listeners=[];this.handleMessage=this.handleMessage.bind(this)}on(e){this.listeners=[...this.listeners,e];if(this.eventDisposable==null||this.requestDisposable==null){this.addListeners()}}off(e){this.listeners=this.listeners.filter((t=>t!==e));if(this.listeners.length===0){this.removeListeners()}}once(){let e;return n.timeout(this.timeout,new Promise((t=>{e=s=>{t(s);this.off(e)};this.on(e)}))).finally((()=>{this.off(e)}))}handleMessage(e){if(this.predicate(e)){const t=this.transform(e);if(t!=null){this.listeners.forEach((e=>e(t)))}}}addListeners(){this.eventDisposable=this.stream.onEvent(this.handleMessage);this.requestDisposable=this.stream.onRequest(this.handleMessage)}removeListeners(){var e,t;(e=this.eventDisposable)===null||e===void 0?void 0:e.dispose();(t=this.requestDisposable)===null||t===void 0?void 0:t.dispose()}}class Z{constructor(e,t,{animationId:s,correlationId:n},i){this.data=undefined;this.onAnimationCompleted=new K(e,(e=>{var t,n,i;return((i=(n=(t=e.event)===null||t===void 0?void 0:t.animationCompleted)===null||n===void 0?void 0:n.animationId)===null||i===void 0?void 0:i.hex)===s}),(e=>{var t,s,n;return((n=(s=(t=e.event)===null||t===void 0?void 0:t.animationCompleted)===null||s===void 0?void 0:s.animationId)===null||n===void 0?void 0:n.hex)||undefined}),i);this.onFrameReceived=new K(e,(e=>{var t,s,i;return!!((i=(s=(t=e.request)===null||t===void 0?void 0:t.drawFrame)===null||s===void 0?void 0:s.frameCorrelationIds)===null||i===void 0?void 0:i.some((e=>e===n)))}),(e=>{var s;return((s=e.request)===null||s===void 0?void 0:s.drawFrame)!=null?t(e.request.drawFrame):undefined}),i)}}function ee(e){if(typeof e==="string"){return{sceneViewStateId:{hex:e}}}else if(L(e)){return{sceneViewStateId:{hex:e.id}}}else if(Q(e)){return{sceneViewStateSuppliedId:{value:e.suppliedId}}}else{throw new Error("Unable to build scene view state identifier, input must be a string or `SceneViewStateIdentifier`.")}}function te(e,t){switch(e.type){case"and":case"or":return{operand:{itemCollection:{queries:e.expressions.map((e=>({sceneItemQuery:re(e)})))}}};case"not":return{not:{expression:te(e.query,t)}};case"item-id":case"supplied-id":return{operand:{item:{sceneItemQuery:re(e)}}};case"all":return{operand:{root:{}}};case"scene-tree-range":return{operand:{sceneTreeRange:{start:e.range.start,end:e.range.end}}};case"metadata":if(e.removeHiddenItems){return{and:{first:{operand:{metadata:{valueFilter:e.filter,keys:e.keys,exactMatch:e.exactMatch}}},second:{operand:{override:{visibility:{visibilityState:true}}}}}}}else{return{operand:{metadata:{valueFilter:e.filter,keys:e.keys,exactMatch:e.exactMatch}}}}case"all-selected":return{operand:{override:{selection:{}}}};case"all-visible":return{operand:{override:{visibility:{visibilityState:true}}}};case"point":return{operand:{point:{point:e.point,viewport:t.dimensions}}};case"volume-intersection":return{operand:{volume:{frustumByRectangle:{rectangle:e.rectangle},exclusive:e.exclusive,viewport:t.dimensions}}};default:return{}}}function se(e,t){switch(e.type){case"and":const t=e.expressions.length;if(t===1){return se({type:"annotation-id",value:e.expressions[0].value})}else if(t!==2){throw new Error("Incorrect number of query expressions provided.")}return{and:{first:se(e.expressions[0]),second:se(e.expressions[1])}};case"or":const n=e.expressions.length;if(n===1){return se({type:"annotation-id",value:e.expressions[0].value})}else if(n!==2){throw new Error("Incorrect number of query expressions provided.")}return{or:{first:se(e.expressions[0]),second:se(e.expressions[1])}};case"not":return{not:{expression:se(e.query)}};case"annotation-id":const{msb:i,lsb:r}=s.toMsbLsb(e.value);return{operand:{annotation:{id:new O.protobuf.core.Uuid2l({msb:M.fromString(i),lsb:M.fromString(r)})}}};case"all":return{operand:{all:{}}};default:return{}}}function ne(e,t,s){const n=oe(t);const i=te(e,s);return{sceneItemOperation:{queryExpression:i,operationTypes:n}}}function ie(e,t,s){const n=ue(t);const i=se(e);return{pmiAnnotationOperation:{queryExpression:i,operationTypes:n}}}function re(e){switch(e.type){case"item-id":return{id:new O.protobuf.core.Uuid({hex:e.value})};case"supplied-id":return{suppliedId:e.value};default:return{}}}function ae(e,t,s,n){const i={frameCorrelationId:{value:e},animation:s?{duration:P(s.milliseconds)}:undefined,baseCamera:n!=null&&A(n)?E(n):undefined};switch(t.flyTo.type){case"supplied":{return{...i,itemSuppliedId:t.flyTo.data}}case"internal":{return{...i,itemId:new O.protobuf.core.Uuid({hex:t.flyTo.data})}}case"camera":{return{...i,camera:E(t.flyTo.data)}}case"scene-item-query":return{...i,sceneItemQueryExpression:t.flyTo.data};case"bounding-box":{return{...i,boundingBox:{xmin:t.flyTo.data.min.x,xmax:t.flyTo.data.max.x,ymin:t.flyTo.data.min.y,ymax:t.flyTo.data.max.y,zmin:t.flyTo.data.min.z,zmax:t.flyTo.data.max.z}}}default:return{}}}function oe(e){return e.map((e=>{var t,s;switch(e.type){case"change-material":return{changeMaterial:{materialOverride:{colorMaterial:{d:e.material.opacity,ns:e.material.glossiness,ka:e.material.ambient,kd:e.material.diffuse,ks:e.material.specular,ke:e.material.emissive}}}};case"clear-override":return{clearMaterial:{}};case"change-transform":return{changeTransform:{transform:{...e.transform}}};case"clear-transform":return{clearTransform:{cascade:e.cascade}};case"hide":return{changeVisibility:{visible:false}};case"show":return{changeVisibility:{visible:true}};case"select":return{changeSelection:{selected:true}};case"deselect":return{changeSelection:{selected:false}};case"change-phantom":return{changePhantom:{phantom:(t=e.phantomState)!==null&&t!==void 0?t:true}};case"clear-phantom":return{changePhantom:{phantom:false}};case"change-end-item":return{changeEndItem:{endItem:(s=e.endItemState)!==null&&s!==void 0?s:true}};case"clear-end-item":return{changeEndItem:{endItem:false}};case"view-rendition-by-id":return{viewRendition:{id:new O.protobuf.core.Uuid({hex:e.id})}};case"view-rendition-by-supplied-id":return{viewRendition:{suppliedId:e.suppliedId}};case"view-default-rendition":return{viewDefaultRendition:{}};case"clear-rendition":return{clearRendition:{}};case"view-representation":if(e.id==="empty"){return{viewRepresentation:{predefinedId:d.RepresentationPredefinedId.REPRESENTATION_PREDEFINED_ID_EMPTY}}}else if(e.id==="entire-part"){return{viewRepresentation:{predefinedId:d.RepresentationPredefinedId.REPRESENTATION_PREDEFINED_ID_ENTIRE_PART}}}else{return{viewRepresentation:{id:new O.protobuf.core.Uuid({hex:e.id})}}}case"clear-representation":return{clearRepresentation:{}};default:return{}}}))}function ue(e){return e.map((e=>{switch(e.type){case"show":return{changeVisibility:{visible:true}};case"hide":return{changeVisibility:{visible:false}};case"select":return{changeSelection:{selected:true}};case"deselect":return{changeSelection:{selected:false}};default:return{}}}))}function he(e){return e.map((e=>{switch(e){case"camera":return O.protobuf.stream.SceneViewStateFeature.SCENE_VIEW_STATE_FEATURE_CAMERA;case"material_overrides":return O.protobuf.stream.SceneViewStateFeature.SCENE_VIEW_STATE_FEATURE_MATERIAL_OVERRIDE;case"selection":return O.protobuf.stream.SceneViewStateFeature.SCENE_VIEW_STATE_FEATURE_SELECTION;case"visibility":return O.protobuf.stream.SceneViewStateFeature.SCENE_VIEW_STATE_FEATURE_VISIBILITY;case"transforms":return O.protobuf.stream.SceneViewStateFeature.SCENE_VIEW_STATE_FEATURE_TRANSFORM;case"cross_section":return O.protobuf.stream.SceneViewStateFeature.SCENE_VIEW_STATE_FEATURE_CROSS_SECTION;case"phantom":return O.protobuf.stream.SceneViewStateFeature.SCENE_VIEW_STATE_FEATURE_PHANTOM;case"shading":return O.protobuf.stream.SceneViewStateFeature.SCENE_VIEW_STATE_FEATURE_SHADING;default:return O.protobuf.stream.SceneViewStateFeature.SCENE_VIEW_STATE_FEATURE_INVALID}}))}class ce{constructor(e){this.flyToOptions=e}build(){return this.flyToOptions}}class le{withItemId(e){return new ce({flyTo:{type:"internal",data:e}})}withSuppliedId(e){return new ce({flyTo:{type:"supplied",data:e}})}withCamera(e){return new ce({flyTo:{type:"camera",data:e}})}withBoundingBox(e){return new ce({flyTo:{type:"bounding-box",data:e}})}build(){return this.flyToOptions}}class de{constructor(e,t,s,n,i,r){this.stream=e;this.aspect=t;this.data=s;this.boundingBox=n;this.decodeFrame=i;this.flyToOptions=r}fitToBoundingBox(e){return this.flyTo({boundingBox:e})}signedDistanceToBoundingBoxCenter(e){const{position:t,viewVector:s}=R(this.data);const n=m.center(e!==null&&e!==void 0?e:this.boundingBox);const i=y.subtract(n,t);return y.dot(s,i)/y.magnitude(s)}flyTo(e){if(typeof e!=="function"){return this.updateFlyToOptions({flyTo:this.buildFlyToType(e)})}else{return this.updateFlyToOptions(e(new le).build())}}viewAll(){return this.fitToBoundingBox(this.boundingBox)}async render(e={}){var t,n,i,r;if(this.flyToOptions==null&&e.animation){this.flyToOptions={flyTo:{type:"camera",data:this.data}}}try{(t=e.correlationId)!==null&&t!==void 0?t:e.correlationId=s.create();if(this.flyToOptions!=null){const t=ae(e.correlationId,this.flyToOptions,e.animation,this.toFrameCamera());const s=await this.stream.flyTo(t,true);return new Z(this.stream,this.decodeFrame,{correlationId:e.correlationId,animationId:((i=(n=s.flyTo)===null||n===void 0?void 0:n.animationId)===null||i===void 0?void 0:i.hex)||undefined},((r=e.animation)===null||r===void 0?void 0:r.milliseconds)!=null?e.animation.milliseconds+$:undefined)}else{this.stream.replaceCamera({camera:E(this.data),frameCorrelationId:{value:e.correlationId}});return new Z(this.stream,this.decodeFrame,{correlationId:e.correlationId})}}catch(e){console.warn("Error when performing render: ",e);throw e}}rotateAroundAxis(e,t){return this.rotateAroundAxisAtPoint(e,this.data.lookAt,t)}alignTo(e,t){const s=y.normalize(y.cross(this.up,y.normalize(this.viewVector)));const n=y.normalize(y.cross(y.normalize(this.viewVector),s));const i=y.angleTo(t,n)>Math.PI/2?y.negate(n):n;const r=y.isEqual(i,t)?s:y.normalize(y.cross(i,t));const a=y.transformMatrix(this.viewVector,x.makeRotation(I.fromAxisAngle(r,y.angleTo(t,i))));const o=g.create({origin:e,direction:y.normalize(a)});const u=g.at(o,y.magnitude(this.viewVector));return this.update({position:e,lookAt:u,up:t})}standardView(e){return this.update({position:e.position,viewVector:y.subtract(y.origin(),e.position),lookAt:y.origin(),up:e.up})}standardViewFixedLookAt(e){const t=g.create({origin:this.lookAt,direction:y.normalize(e.position)});const s=g.at(t,y.magnitude(this.viewVector));return this.update({up:e.up,position:s,viewVector:y.subtract(this.lookAt,s)})}buildFlyToType(e){if(e.boundingBox!=null){return{type:"bounding-box",data:e.boundingBox}}else if(e.camera!=null){return{type:"camera",data:e.camera}}else if(e.itemId!=null){return{type:"internal",data:e.itemId}}else if(e.itemSuppliedId!=null){return{type:"supplied",data:e.itemSuppliedId}}else if(e.sceneItemQueryExpression!=null){return{type:"scene-item-query",data:e.sceneItemQueryExpression}}else{throw new Error("Fly to must specify at least one option.")}}computeClippingPlanes(e){return V(this.boundingBox,e)}}class pe extends de{constructor(e,t,s,n,i,r){super(e,t,s,n,i,r);this.perspectiveData=s}moveBy(e){return this.update({position:y.add(this.position,e),lookAt:y.add(this.lookAt,e)})}rotateAroundAxisAtPoint(e,t,s){return this.update({position:y.rotateAboutAxis(e,this.position,s,t),lookAt:y.rotateAboutAxis(e,this.lookAt,s,t),up:y.rotateAboutAxis(e,this.up,s,y.origin())})}update(e){var t;const s=(t=e.fovY)!==null&&t!==void 0?t:this.fovY;return new pe(this.stream,this.aspect,{...this.perspectiveData,...e,fovY:s},this.boundingBox,this.decodeFrame,this.flyToOptions)}toFrameCamera(){var e;return new C(this.position,this.lookAt,this.up,this.near,this.far,this.aspectRatio,(e=this.fovY)!==null&&e!==void 0?e:45)}get viewVector(){return y.subtract(this.lookAt,this.position)}get position(){return{...this.perspectiveData.position}}get up(){return{...this.perspectiveData.up}}get lookAt(){return{...this.perspectiveData.lookAt}}get fovY(){return this.perspectiveData.fovY}get aspectRatio(){return this.aspect}get near(){const{near:e}=this.computeClippingPlanes(this.perspectiveData);return e}get far(){const{far:e}=this.computeClippingPlanes(this.perspectiveData);return e}updateFlyToOptions(e){return new pe(this.stream,this.aspect,this.perspectiveData,this.boundingBox,this.decodeFrame,e)}}class we extends de{constructor(e,t,s,n,i,r){super(e,t,s,n,i,r);this.orthographicData=s}moveBy(e){const t=y.add(this.lookAt,e);return this.update({lookAt:t,rotationPoint:t})}rotateAroundAxisAtPoint(e,t,s){const n=y.rotateAboutAxis(e,this.lookAt,s,t);const i=y.rotateAboutAxis(e,this.position,s,t);const r=q(y.subtract(n,i),b.create(this.boundingBox));return this.update({viewVector:r,lookAt:n,up:y.rotateAboutAxis(e,this.up,s,y.origin())})}update(e){return new we(this.stream,this.aspect,{...this.orthographicData,...e},this.boundingBox,this.decodeFrame,this.flyToOptions)}toFrameCamera(){const e=b.create(this.boundingBox);const t=q(this.viewVector,e);const s=T(this.lookAt,t,e.center);return new k(t,s,this.up,this.near,this.far,this.aspectRatio,this.fovHeight,this.rotationPoint)}get viewVector(){return{...this.orthographicData.viewVector}}get position(){return y.add(this.lookAt,y.negate(this.viewVector))}get rotationPoint(){const e=this.orthographicData.rotationPoint;if(e!=null){return e}else{return undefined}}get up(){return{...this.orthographicData.up}}get lookAt(){return{...this.orthographicData.lookAt}}get fovHeight(){return this.orthographicData.fovHeight}get aspectRatio(){return this.aspect}get near(){const{near:e}=this.computeClippingPlanes(this.orthographicData);return e}get far(){const{far:e}=this.computeClippingPlanes(this.orthographicData);return e}updateFlyToOptions(e){return new we(this.stream,this.aspect,this.orthographicData,this.boundingBox,this.decodeFrame,e)}}class ve{constructor(e,t){this.stream=e;this.data=t}async update(e){const t=await this.stream.updateCrossSectioning({crossSectioning:{sectionPlanes:e.sectionPlanes,highlightColor:e.highlightColor,lineWidth:(e===null||e===void 0?void 0:e.lineWidth)!=null?{value:e.lineWidth}:null}},true);return t.updateCrossSectioning||undefined}current(){return this.data}}class fe{constructor(e=[]){this.operations=e}build(){return this.operations.concat()}materialOverride(e){return new fe(this.operations.concat([{type:"change-material",material:e}]))}show(){return new fe(this.operations.concat([{type:"show"}]))}hide(){return new fe(this.operations.concat([{type:"hide"}]))}select(){return new fe(this.operations.concat([{type:"select"}]))}deselect(){return new fe(this.operations.concat([{type:"deselect"}]))}clearMaterialOverrides(){return new fe(this.operations.concat([{type:"clear-override"}]))}transform(e){return new fe(this.operations.concat([{type:"change-transform",transform:e}]))}clearTransforms(e=true){return new fe(this.operations.concat([{type:"clear-transform",cascade:e}]))}setPhantom(e){return new fe(this.operations.concat([{type:"change-phantom",phantomState:e}]))}clearPhantom(){return new fe(this.operations.concat([{type:"clear-phantom"}]))}setEndItem(e){return new fe(this.operations.concat([{type:"change-end-item",endItemState:e}]))}clearEndItem(){return new fe(this.operations.concat([{type:"clear-end-item"}]))}viewRenditionById(e){return new fe(this.operations.concat([{type:"view-rendition-by-id",id:e}]))}viewRenditionBySuppliedId(e){return new fe(this.operations.concat([{type:"view-rendition-by-supplied-id",suppliedId:e}]))}viewDefaultRendition(){return new fe(this.operations.concat([{type:"view-default-rendition"}]))}clearRendition(){return new fe(this.operations.concat([{type:"clear-rendition"}]))}viewRepresentation(e){return new fe(this.operations.concat({type:"view-representation",id:e}))}clearRepresentation(){return new fe(this.operations.concat({type:"clear-representation"}))}}class me{constructor(e=[]){this.operations=e}build(){return this.operations.concat()}show(){return new me(this.operations.concat([{type:"show"}]))}hide(){return new me(this.operations.concat([{type:"hide"}]))}select(){return new me(this.operations.concat([{type:"select"}]))}deselect(){return new me(this.operations.concat([{type:"deselect"}]))}}class ye{constructor(e,t){this.stream=e;this.imageScaleProvider=t}async hitItems(e,t){const s=this.imageScaleProvider();const n=await this.stream.hitItems({point:S.scale(e,(s===null||s===void 0?void 0:s.x)||1,(s===null||s===void 0?void 0:s.y)||1),includeMetadata:t===null||t===void 0?void 0:t.includeMetadata},true);return n.hitItems||undefined}}const xe=1e3*30;class Ie{constructor(e,t,s,n){this.onFrameDrawn=new K(e,(e=>{var t,n,i;return!!((i=(n=(t=e.request)===null||t===void 0?void 0:t.drawFrame)===null||n===void 0?void 0:n.frameCorrelationIds)===null||i===void 0?void 0:i.some((e=>e===s)))}),(e=>{var s;return((s=e.request)===null||s===void 0?void 0:s.drawFrame)!=null?t(e.request.drawFrame):undefined}),n!==null&&n!==void 0?n:xe)}}class ge{constructor(e,t,s,n,i){this.stream=e;this.decodeFrame=t;this.encodeCameraType=s;this.sceneId=n;this.sceneViewId=i}async applySceneViewState(e,t={}){const s=ee(e);await this.animateToSceneViewState(s,t);return await this.stream.loadSceneViewState({...s,frameCorrelationId:t.suppliedCorrelationId?{value:t.suppliedCorrelationId}:undefined,cameraType:t.cameraTypeOverride?this.encodeCameraType(t.cameraTypeOverride):undefined},true)}async applyPartialSceneViewState(e,t,s={}){const n=ee(e);const i=he(t);if(t.includes("camera")){await this.animateToSceneViewState(n,s)}return await this.stream.loadSceneViewState({...n,frameCorrelationId:s.suppliedCorrelationId?{value:s.suppliedCorrelationId}:undefined,sceneViewStateFeatureSubset:i,cameraType:s.cameraTypeOverride?this.encodeCameraType(s.cameraTypeOverride):undefined},true)}async animateToSceneViewState(e,t){var n,i,r;if(t.animation!=null){const a=s.create();const o=await this.stream.flyTo({sceneViewStateIdentifier:e,animation:{duration:P(t.animation.milliseconds)},frameCorrelationId:{value:a}},true);if(t.waitForAnimation==null||t.waitForAnimation){const e=new Z(this.stream,this.decodeFrame,{animationId:(r=(i=(n=o.flyTo)===null||n===void 0?void 0:n.animationId)===null||i===void 0?void 0:i.hex)!==null&&r!==void 0?r:undefined,correlationId:a},t.animation.milliseconds+$);await e.onAnimationCompleted.once()}}}}class be{constructor(e,t){this.query=e;this.builder=t!==null&&t!==void 0?t:new fe}isItemBuilder(){return true}isAnnotationBuilder(){return false}materialOverride(e){if(typeof e==="string"){return new be(this.query,this.builder.materialOverride(D(e)))}else{return new be(this.query,this.builder.materialOverride(e))}}hide(){return new be(this.query,this.builder.hide())}show(){return new be(this.query,this.builder.show())}select(){return new be(this.query,this.builder.select())}deselect(){return new be(this.query,this.builder.deselect())}clearMaterialOverrides(){return new be(this.query,this.builder.clearMaterialOverrides())}transform(e){if(Array.isArray(e)){if(e.length!==16){throw new a("Matrix provided must contain exactly 16 values (4x4).")}return new be(this.query,this.builder.transform({r0:{x:e[0],y:e[1],z:e[2],w:e[3]},r1:{x:e[4],y:e[5],z:e[6],w:e[7]},r2:{x:e[8],y:e[9],z:e[10],w:e[11]},r3:{x:e[12],y:e[13],z:e[14],w:e[15]}}))}else{return new be(this.query,this.builder.transform(e))}}clearTransforms(e=true){return new be(this.query,this.builder.clearTransforms(e))}setPhantom(e){return new be(this.query,this.builder.setPhantom(e))}clearPhantom(){return new be(this.query,this.builder.clearPhantom())}setEndItem(e){return new be(this.query,this.builder.setEndItem(e))}clearEndItem(){return new be(this.query,this.builder.clearEndItem())}viewRenditionById(e){return new be(this.query,this.builder.viewRenditionById(e))}viewRenditionBySuppliedId(e){return new be(this.query,this.builder.viewRenditionBySuppliedId(e))}viewDefaultRendition(){return new be(this.query,this.builder.viewDefaultRendition())}clearRendition(){return new be(this.query,this.builder.clearRendition())}viewRepresentation(e){return new be(this.query,this.builder.viewRepresentation(e))}clearRepresentation(){return new be(this.query,this.builder.clearRepresentation())}build(){return{query:this.query,operations:this.builder.build()}}}class Se{constructor(e,t){this.query=e;this.builder=t!==null&&t!==void 0?t:new me}isItemBuilder(){return false}isAnnotationBuilder(){return true}hide(){return new Se(this.query,this.builder.hide())}show(){return new Se(this.query,this.builder.show())}select(){return new Se(this.query,this.builder.select())}deselect(){return new Se(this.query,this.builder.deselect())}build(){return{query:this.query,operations:this.builder.build()}}}class Be{constructor(e,t,s,n,i,r){this.sceneViewId=e;this.stream=t;this.decodeFrame=s;this.dimensions=n;this.sceneItemQueryOperations=i;this.pmiAnnotationQueryOperations=r}async execute(e){var t;const n=this.sceneItemQueryOperations.map((e=>ne(e.query,e.operations,{dimensions:this.dimensions})));const i=this.pmiAnnotationQueryOperations.map((e=>ie(e.query,e.operations)));const r=(t=e===null||e===void 0?void 0:e.suppliedCorrelationId)!==null&&t!==void 0?t:s.create();const a={sceneViewId:{hex:this.sceneViewId},elementOperations:[...n,...i],suppliedCorrelationId:{value:r}};await this.stream.createSceneAlteration(a)}}class Ae extends Be{async execute(e){var t;if(e===null||e===void 0?void 0:e.awaitCorrelatedFrame){const n=(t=e.suppliedCorrelationId)!==null&&t!==void 0?t:s.create();const i=new Ie(this.stream,this.decodeFrame,n);await super.execute({...e,suppliedCorrelationId:n});await i.onFrameDrawn.once()}else{await super.execute(e)}}}class Ee extends Be{async execute(e){var t;if(e===null||e===void 0?void 0:e.skipAwaitCorrelatedFrame){await super.execute(e)}else{const n=(t=e===null||e===void 0?void 0:e.suppliedCorrelationId)!==null&&t!==void 0?t:s.create();const i=new Ie(this.stream,this.decodeFrame,n);await super.execute({...e,suppliedCorrelationId:n});await i.onFrameDrawn.once()}}}class Re{constructor(e,t,s,n,i,r,a,o){this.stream=e;this.frame=t;this.decodeFrame=s;this.encodeCameraType=n;this.imageScaleProvider=i;this.dimensions=r;this.sceneId=a;this.sceneViewId=o;this.sceneViewStateLoader=new ge(e,s,n,a,o)}async applySceneViewState(e,t={}){return await this.sceneViewStateLoader.applySceneViewState(e,t)}async applyPartialSceneViewState(e,t,s={}){return await this.sceneViewStateLoader.applyPartialSceneViewState(e,t,s)}async reset(e={}){return await this.stream.resetSceneView({includeCamera:e.includeCamera,frameCorrelationId:e.suppliedCorrelationId?{value:e.suppliedCorrelationId}:undefined,cameraType:e.cameraTypeOverride?this.encodeCameraType(e.cameraTypeOverride):undefined},true)}items(e){const t=e(new We);const s=Array.isArray(t)?t:[t];const n=s.filter((e=>e.isItemBuilder()));const i=n.reduce(((e,t)=>e.concat(t.build())),[]);return new Ae(this.sceneViewId,this.stream,this.decodeFrame,this.dimensions,i,[])}elements(e){const t=e(new Ge);const s=Array.isArray(t)?t:[t];const n=s.filter((e=>e.isItemBuilder()));const i=n.reduce(((e,t)=>e.concat(t.build())),[]);const r=s.filter((e=>e.isAnnotationBuilder()));const a=r.reduce(((e,t)=>e.concat(t.build())),[]);return new Ee(this.sceneViewId,this.stream,this.decodeFrame,this.dimensions,i,a)}camera(){const{scene:e}=this.frame;if(e.camera.isOrthographic()){return new we(this.stream,B.aspectRatio(this.viewport()),{viewVector:e.camera.viewVector,lookAt:e.camera.lookAt,up:e.camera.up,fovHeight:e.camera.fovHeight,rotationPoint:e.camera.lookAt},this.frame.scene.boundingBox,this.decodeFrame)}else if(e.camera.isPerspective()){return new pe(this.stream,B.aspectRatio(this.viewport()),{position:e.camera.position,lookAt:e.camera.lookAt,up:e.camera.up,fovY:e.camera.fovY},this.frame.scene.boundingBox,this.decodeFrame)}else{throw new r("Cannot retrieve camera. Scene has an unknown or invalid camera type.")}}isOrthographic(){const{scene:e}=this.frame;return e.camera.isOrthographic()}boundingBox(){return this.frame.scene.boundingBox}crossSectioning(){return new ve(this.stream,this.frame.scene.crossSection)}raycaster(){return new ye(this.stream,this.imageScaleProvider)}viewport(){return this.frame.dimensions}scale(){return this.imageScaleProvider()||S.create(1,1)}}class Ve{constructor(e){this.inverted=e}build(){if(this.inverted){return{type:"not",query:this.queryExpressionBuilder()}}else{return this.queryExpressionBuilder()}}}class qe{constructor(e=false){this.inverted=e}all(){return new Pe}not(){return new Te(!this.inverted)}withItemIds(e){return new Ue(e,"item-id",this.inverted)}withSuppliedIds(e){return new Ue(e,"supplied-id",this.inverted)}withItemId(e){return new Fe({type:"item-id",value:e},this.inverted)}withSuppliedId(e){return new Fe({type:"supplied-id",value:e},this.inverted)}withSceneTreeRange(e){return new Oe(e,this.inverted)}withMetadata(e,t,s,n){return new Me(e,t,s,this.inverted,n)}withSelected(){return new je(this.inverted)}withVisible(){return new _e(this.inverted)}withPoint(e){return new De(e,this.inverted)}withVolumeIntersection(e,t){return new Ne(e,this.inverted,t)}}class Te extends qe{constructor(e){super(e)}}class ke{constructor(e=false){this.inverted=e}all(){return new Pe}not(){return new Ce(!this.inverted)}withAnnotationIds(e){return new Ue(e,"annotation-id",this.inverted)}withAnnotationId(e){return new Le({type:"annotation-id",value:e},this.inverted)}}class Ce extends ke{constructor(e){super(e)}}class Pe extends Ve{constructor(e=false){super(e)}queryExpressionBuilder(){return{type:"all"}}}class Oe extends Ve{constructor(e,t){super(t);this.range=e}queryExpressionBuilder(){return{type:"scene-tree-range",range:this.range}}}class Me extends Ve{constructor(e,t,s,n,i){super(n);this.filter=e;this.keys=t;this.exactMatch=s;this.removeHiddenItems=i}queryExpressionBuilder(){return{type:"metadata",filter:this.filter,keys:this.keys,exactMatch:this.exactMatch,removeHiddenItems:this.removeHiddenItems}}}class je extends Ve{constructor(e){super(e)}queryExpressionBuilder(){return{type:"all-selected"}}}class _e extends Ve{constructor(e){super(e)}queryExpressionBuilder(){return{type:"all-visible"}}}class De extends Ve{constructor(e,t){super(t);this.point=e}queryExpressionBuilder(){return{type:"point",point:this.point}}}class Ne extends Ve{constructor(e,t,s){super(t);this.rectangle=e;this.exclusive=s}queryExpressionBuilder(){return{type:"volume-intersection",rectangle:this.rectangle,exclusive:!!this.exclusive}}}class Ue extends Ve{constructor(e,t,s){super(s);this.ids=e;this.type=t}queryExpressionBuilder(){return{type:"or",expressions:this.ids.map((e=>({type:this.type,value:e})))}}}class Fe extends Ve{constructor(e,t){super(t);this.query=e}queryExpressionBuilder(){return{...this.query}}and(){return new He([this.query],this.inverted)}or(){return new ze([this.query],this.inverted)}}class ze extends Ve{constructor(e,t){super(t);this.expressions=e}queryExpressionBuilder(){return{type:"or",expressions:[...this.expressions]}}withItemId(e){return new ze([...this.expressions,{type:"item-id",value:e}],this.inverted)}withSuppliedId(e){return new ze([...this.expressions,{type:"supplied-id",value:e}],this.inverted)}or(){return this}}class He extends Ve{constructor(e,t){super(t);this.expressions=e}queryExpressionBuilder(){return{type:"and",expressions:[...this.expressions]}}withItemId(e){return new He([...this.expressions,{type:"item-id",value:e}],this.inverted)}withSuppliedId(e){return new He([...this.expressions,{type:"supplied-id",value:e}],this.inverted)}and(){return this}}class Le extends Ve{constructor(e,t){super(t);this.query=e}queryExpressionBuilder(){return{...this.query}}and(){return new Ye([this.query],this.inverted)}or(){return new Qe([this.query],this.inverted)}}class Qe extends Ve{constructor(e,t){super(t);this.expressions=e}queryExpressionBuilder(){return{type:"or",expressions:[...this.expressions]}}withAnnotationId(e){return new Qe([...this.expressions,{type:"annotation-id",value:e}],this.inverted)}or(){return this}}class Ye extends Ve{constructor(e,t){super(t);this.expressions=e}queryExpressionBuilder(){return{type:"and",expressions:[...this.expressions]}}withAnnotationId(e){return new Ye([...this.expressions,{type:"annotation-id",value:e}],this.inverted)}and(){return this}}class Ge{get items(){return new We}get annotations(){return new Je}}class Je{where(e){const t=e(new ke).build();return new Se(t)}}class We{where(e){const t=e(new qe).build();return new be(t)}}export{de as C,fe as I,W as M,Se as P,ye as R,Re as S,ve as a,Je as b,N as c,qe as d,Ge as e,Ee as f,be as g,We as h,Ae as i,G as j,X as k,H as l,j as m,U as n,Y as s,J as t};
5
+ //# sourceMappingURL=p-D6eJC1q4.js.map