@selvajs/compute 3.0.1-beta.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/chunk-6LCAIDQV.cjs +4 -0
  2. package/dist/chunk-6LCAIDQV.cjs.map +1 -0
  3. package/dist/chunk-CFBKO3HX.cjs +2 -0
  4. package/dist/chunk-CFBKO3HX.cjs.map +1 -0
  5. package/dist/chunk-JF5MZTOU.cjs +55 -0
  6. package/dist/{chunk-MBCMFI2R.cjs.map → chunk-JF5MZTOU.cjs.map} +1 -1
  7. package/dist/chunk-LUP3B2DK.js +55 -0
  8. package/dist/{chunk-G3SQHFDY.js.map → chunk-LUP3B2DK.js.map} +1 -1
  9. package/dist/chunk-O55PTKMV.js +4 -0
  10. package/dist/chunk-O55PTKMV.js.map +1 -0
  11. package/dist/chunk-UAL4YXRX.js +2 -0
  12. package/dist/chunk-UAL4YXRX.js.map +1 -0
  13. package/dist/core.cjs +1 -1
  14. package/dist/core.d.cts +1 -10
  15. package/dist/core.d.ts +1 -10
  16. package/dist/core.js +1 -1
  17. package/dist/grasshopper.cjs +1 -1
  18. package/dist/grasshopper.d.cts +2 -2
  19. package/dist/grasshopper.d.ts +2 -2
  20. package/dist/grasshopper.js +1 -1
  21. package/dist/{handle-files-9pkEgDIp.d.ts → handle-files-Bu2qmaPj.d.cts} +2 -2
  22. package/dist/{handle-files-9pkEgDIp.d.cts → handle-files-Bu2qmaPj.d.ts} +2 -2
  23. package/dist/index.cjs +1 -1
  24. package/dist/index.d.cts +1 -1
  25. package/dist/index.d.ts +1 -1
  26. package/dist/index.js +1 -1
  27. package/dist/visualization-LZ4XZPYZ.cjs +2 -0
  28. package/dist/visualization-LZ4XZPYZ.cjs.map +1 -0
  29. package/dist/visualization-SV4BTHXJ.js +2 -0
  30. package/dist/visualization.cjs +1 -1
  31. package/dist/visualization.js +1 -1
  32. package/package.json +3 -3
  33. package/dist/chunk-AUAMZCIL.cjs +0 -2
  34. package/dist/chunk-AUAMZCIL.cjs.map +0 -1
  35. package/dist/chunk-FMMK2QTR.js +0 -4
  36. package/dist/chunk-FMMK2QTR.js.map +0 -1
  37. package/dist/chunk-G3SQHFDY.js +0 -55
  38. package/dist/chunk-G5XWFITM.js +0 -2
  39. package/dist/chunk-G5XWFITM.js.map +0 -1
  40. package/dist/chunk-LBRCTJ7W.cjs +0 -4
  41. package/dist/chunk-LBRCTJ7W.cjs.map +0 -1
  42. package/dist/chunk-MBCMFI2R.cjs +0 -55
  43. package/dist/visualization-LTWBUHLN.cjs +0 -2
  44. package/dist/visualization-LTWBUHLN.cjs.map +0 -1
  45. package/dist/visualization-SU3XQ35P.js +0 -2
  46. /package/dist/{visualization-SU3XQ35P.js.map → visualization-SV4BTHXJ.js.map} +0 -0
@@ -1,55 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkLBRCTJ7Wcjs = require('./chunk-LBRCTJ7W.cjs');var _three = require('three'); var z = _interopRequireWildcard(_three); var j = _interopRequireWildcard(_three); var I = _interopRequireWildcard(_three); var k = _interopRequireWildcard(_three); var Z = _interopRequireWildcard(_three); var ye = _interopRequireWildcard(_three); var S = _interopRequireWildcard(_three); var f = _interopRequireWildcard(_three); var L = _interopRequireWildcard(_three); var _ = _interopRequireWildcard(_three); var U = _interopRequireWildcard(_three);var W={HUGE_THRESHOLD:1e4,LARGE_THRESHOLD:1e3,SCALE_RATIO_THRESHOLD:100,NEAR_PLANE_FACTOR:{TINY:1e-4,SMALL:.001,NORMAL:.01},FAR_PLANE_FACTOR:{HUGE:100,LARGE:50,NORMAL:20},INITIAL_DISTANCE_MULTIPLIER:4};function zn(e,r,t,n,a){if(Fe(e),r.length===0)return;r.forEach(d=>{e.add(d)});let o=J(r),i=o.getCenter(new z.Vector3),l=o.getSize(new z.Vector3),s=Math.max(l.x,l.y,l.z);if(s/Math.min(l.x||1,l.y||1,l.z||1)>W.SCALE_RATIO_THRESHOLD||s>W.HUGE_THRESHOLD?(t.near=s*W.NEAR_PLANE_FACTOR.TINY,t.far=s*W.FAR_PLANE_FACTOR.HUGE):s>W.LARGE_THRESHOLD?(t.near=s*W.NEAR_PLANE_FACTOR.SMALL,t.far=s*W.FAR_PLANE_FACTOR.LARGE):(t.near=Math.max(.01,s*W.NEAR_PLANE_FACTOR.NORMAL),t.far=Math.max(2e3,s*W.FAR_PLANE_FACTOR.NORMAL)),t.updateProjectionMatrix(),a)n.minDistance=t.near*2,n.maxDistance=t.far*.9;else{let d=s*W.INITIAL_DISTANCE_MULTIPLIER;t.position.set(i.x+d*.8,i.y+d,i.z+d*1.2),n.target.copy(i),n.minDistance=t.near*2,n.maxDistance=t.far*.9,n.update()}}function ue(e){if(!e||typeof e!="string")return _chunkLBRCTJ7Wcjs.e.call(void 0, ).warn(`Invalid color input: ${e}, using white`),new z.Color(16777215);let r=e.trim();if(/^#?[0-9A-Fa-f]{6}$/.test(r))try{let t=r.startsWith("#")?r:`#${r}`;return new z.Color(t)}catch (e2){return _chunkLBRCTJ7Wcjs.e.call(void 0, ).warn(`Invalid hex color: ${e}, using white`),new z.Color(16777215)}if(r.includes(",")){let t=r.split(",").map(n=>parseInt(n.trim(),10));if(t.length===3&&t.every(n=>!isNaN(n)&&n>=0&&n<=255))return new z.Color(t[0]/255,t[1]/255,t[2]/255)}try{return new z.Color(r.toLowerCase())}catch (e3){return _chunkLBRCTJ7Wcjs.e.call(void 0, ).warn(`Invalid color string: ${e}, using white`),new z.Color(16777215)}}function de(e,r,t="z"){e.forEach(n=>{n.position[t]-=r})}function J(e){let r=new z.Box3;return e.length===0||e.forEach(t=>{t.updateMatrixWorld(!0);let n=new z.Box3().setFromObject(t);r.union(n)}),r}var Be=new Set(["floor","grid","label-layer"]);function Fe(e){[...e.children].forEach(t=>{Be.has(t.userData.id)||t.userData.source!=="user"&&(t.traverse(n=>{let a=n;if(!a.geometry&&!a.material)return;_optionalChain([a, 'access', _2 => _2.geometry, 'optionalAccess', _3 => _3.dispose, 'call', _4 => _4()]);let o=a.material;if(!o)return;(Array.isArray(o)?o:[o]).forEach(l=>{for(let s of Object.values(l))s instanceof z.Texture&&s.dispose();l.dispose()})}),t.removeFromParent())})}function ze(e){let r=e.clone().normalize(),t=new j.Vector3(0,0,1),n=new j.Vector3(0,1,0),a=Math.abs(r.dot(t))>.9?n:t,o=new j.Vector3().crossVectors(r,a).normalize(),i=new j.Vector3().crossVectors(o,r).normalize();return{top:r.clone(),bottom:r.clone().negate(),front:i.clone(),back:i.clone().negate(),right:o.clone(),left:o.clone().negate(),iso:i.clone().multiplyScalar(1.2).add(o.clone()).add(r.clone()).normalize()}}function me(e){let{scene:r,perspective:t,controls:n,onActiveCameraChange:a}=e,o=(_nullishCoalesce(e.up, () => (t.up))).clone().normalize(),i=ze(o),l=new j.OrthographicCamera(-1,1,1,-1,t.near,t.far);l.up.copy(o);let s="perspective",c=t.aspect,d=()=>s==="perspective"?t:l,u=()=>{let R=t.position.distanceTo(n.target)*Math.tan(t.fov*Math.PI/360),y=R*c;l.left=-y,l.right=y,l.top=R,l.bottom=-R,l.near=t.near,l.far=t.far,l.updateProjectionMatrix()},m=g=>{g!==s&&(g==="orthographic"?(l.position.copy(t.position),l.up.copy(t.up),l.lookAt(n.target),u()):t.position.copy(l.position),s=g,n.object=d(),n.update(),a(d()))},p=(g,R=!0)=>{let y=ke(r),H=y.isEmpty()?n.target.clone():y.getCenter(new j.Vector3),O=y.isEmpty()?new j.Vector3(1,1,1):y.getSize(new j.Vector3),b=Math.max(O.x,O.y,O.z)||1,T=t.fov*(Math.PI/180),x=b/(2*Math.tan(T/2))*1.5,P=_e(g,o),D=H.clone().add(P.clone().multiplyScalar(x)),F=d();R?Ne(F,n,D,H,()=>{s==="orthographic"&&u()}):(F.position.copy(D),n.target.copy(H),s==="orthographic"&&u(),n.update())};return{getActiveCamera:d,getProjection:()=>s,setProjection:m,toggleProjection:()=>(m(s==="perspective"?"orthographic":"perspective"),s),setView:(g,R=!0)=>{p(i[g],R)},setViewDirection:p,setRotateEnabled:g=>{n.enableRotate=g},isRotateEnabled:()=>n.enableRotate,updateAspect:(g,R)=>{c=R===0?c:g/R,s==="orthographic"&&u()}}}var Ue=new Set(["grid","floor","label-layer","measure"]);function je(e){let r=e;for(;r;){if(typeof r.userData.id=="string"&&Ue.has(r.userData.id))return!0;r=r.parent}return!1}function ke(e){let r=[];return e.traverse(t=>{let n=t;t.visible&&!je(t)&&n.geometry&&r.push(t)}),J(r)}function _e(e,r){let t=r.clone().normalize(),n=e.clone().normalize();if(Math.abs(n.dot(t))<.9999)return e;let a=Math.abs(t.dot(new j.Vector3(0,0,1)))>.9?new j.Vector3(0,1,0):new j.Vector3(0,0,1),o=new j.Vector3().crossVectors(t,a).normalize(),i=.5*Math.PI/180;return n.multiplyScalar(Math.cos(i)).add(o.multiplyScalar(Math.sin(i))).normalize()}var Ge=e=>1-Math.pow(1-e,3);function Ne(e,r,t,n,a,o=250){let i=e.position.clone(),l=r.target.clone(),s=performance.now(),c=()=>{let d=Ge(Math.min((performance.now()-s)/o,1));e.position.lerpVectors(i,t,d),r.target.lerpVectors(l,n,d),a(),r.update(),d<1&&requestAnimationFrame(c)};requestAnimationFrame(c)}var We=`
2
- varying vec3 vWorldPos;
3
- void main() {
4
- vec4 world = modelMatrix * vec4(position, 1.0);
5
- vWorldPos = world.xyz;
6
- gl_Position = projectionMatrix * viewMatrix * world;
7
- }
8
- `,$e=`
9
- precision highp float;
10
- varying vec3 vWorldPos;
11
-
12
- uniform vec2 uAxes; // indices (0=x,1=y,2=z) of the two in-plane world axes
13
- uniform float uCell;
14
- uniform float uMajor;
15
- uniform vec3 uCellColor;
16
- uniform vec3 uMajorColor;
17
- uniform vec3 uCenter; // fade center (camera position), projected onto plane
18
- uniform float uFade;
19
-
20
- // Antialiased grid line intensity for a given spacing, using screen-space derivatives so lines
21
- // stay ~1px regardless of zoom (the standard "pristine grid" technique).
22
- float gridLine(vec2 coord, float spacing) {
23
- vec2 c = coord / spacing;
24
- vec2 d = fwidth(c);
25
- vec2 g = abs(fract(c - 0.5) - 0.5) / max(d, 1e-6);
26
- float line = min(g.x, g.y);
27
- return 1.0 - clamp(line, 0.0, 1.0);
28
- }
29
-
30
- // Index a vec3 by a float axis id (0/1/2) without dynamic indexing (WebGL1-safe).
31
- float axis(vec3 v, float i) {
32
- return i < 0.5 ? v.x : (i < 1.5 ? v.y : v.z);
33
- }
34
-
35
- void main() {
36
- // Pick the two in-plane world coordinates.
37
- vec2 coord = vec2(axis(vWorldPos, uAxes.x), axis(vWorldPos, uAxes.y));
38
-
39
- float minor = gridLine(coord, uCell);
40
- float major = gridLine(coord, uCell * uMajor);
41
-
42
- vec3 color = mix(uCellColor, uMajorColor, major);
43
- float alpha = max(minor, major);
44
-
45
- // Radial fade from the camera-projected center.
46
- float dist = distance(vWorldPos, uCenter);
47
- float fade = 1.0 - clamp(dist / uFade, 0.0, 1.0);
48
- alpha *= fade * fade;
49
-
50
- if (alpha < 0.001) discard;
51
- gl_FragColor = vec4(color, alpha);
52
- }
53
- `;function pe(e={}){let{cellSize:r=1,majorEvery:t=10,cellColor:n=8947848,majorColor:a=4473924,fadeDistance:o=100,plane:i="y"}=e,l=i==="y"?new I.Vector2(0,2):i==="z"?new I.Vector2(0,1):new I.Vector2(1,2),s=o*2.5,c=new I.PlaneGeometry(s,s);i==="y"?c.rotateX(-Math.PI/2):i==="x"&&c.rotateY(Math.PI/2);let d=new I.ShaderMaterial({vertexShader:We,fragmentShader:$e,transparent:!0,depthWrite:!1,side:I.DoubleSide,uniforms:{uAxes:{value:l},uCell:{value:r},uMajor:{value:t},uCellColor:{value:new I.Color(n)},uMajorColor:{value:new I.Color(a)},uCenter:{value:new I.Vector3},uFade:{value:o}}}),u=new I.Mesh(c,d);u.name="grid",u.userData.id="grid",u.renderOrder=-1;let m=new I.Vector3;return{object:u,update:p=>{i==="y"?(u.position.set(p.x,0,p.z),m.set(p.x,0,p.z)):i==="z"?(u.position.set(p.x,p.y,0),m.set(p.x,p.y,0)):(u.position.set(0,p.y,p.z),m.set(0,p.y,p.z)),d.uniforms.uCenter.value.copy(m)},setVisible:p=>{u.visible=p},dispose:()=>{c.dispose(),d.dispose()}}}var _ViewHelperjs = require('three/addons/helpers/ViewHelper.js');function fe(e){let{camera:r,domElement:t,controller:n}=e,a=new (0, _ViewHelperjs.ViewHelper)(r,t);a.setLabels("X","Y","Z");let o=!0,i=128,l=new k.Raycaster,s=new k.OrthographicCamera(-2,2,2,-2,0,4);s.position.set(0,0,2);let c={posX:new k.Vector3(1,0,0),negX:new k.Vector3(-1,0,0),posY:new k.Vector3(0,1,0),negY:new k.Vector3(0,-1,0),posZ:new k.Vector3(0,0,1),negZ:new k.Vector3(0,0,-1)},d=m=>{let p=t.getBoundingClientRect(),E=p.left+t.offsetWidth-i-a.location.right,A=p.top+t.offsetHeight-i-a.location.bottom,v=new k.Vector2((m.clientX-E)/i*2-1,-((m.clientY-A)/i)*2+1);if(Math.abs(v.x)>1||Math.abs(v.y)>1)return null;a.quaternion.copy(r.quaternion).invert(),a.updateMatrixWorld(),l.setFromCamera(v,s);let g=l.intersectObjects(a.children,!1);for(let R of g){let y=_optionalChain([R, 'access', _5 => _5.object, 'access', _6 => _6.userData, 'optionalAccess', _7 => _7.type]);if(typeof y=="string"&&y in c)return y}return null};return{render:m=>{if(!o)return;let p=m.autoClear;m.autoClear=!1,a.render(m),m.autoClear=p},update:m=>{a.animating&&a.update(m)},handleClick:m=>{if(!o)return!1;let p=d(m);return p?(n.getProjection()==="orthographic"&&n.setProjection("perspective"),n.setViewDirection(c[p],!1),!0):!1},get isAnimating(){return a.animating},setVisible:m=>{o=m},isVisible:()=>o,dispose:()=>a.dispose()}}var _LineSegmentsGeometryjs = require('three/addons/lines/LineSegmentsGeometry.js');var _LineSegments2js = require('three/addons/lines/LineSegments2.js');var _LineMaterialjs = require('three/addons/lines/LineMaterial.js');var ee="edge-overlay",Ze=2236962,Je=1.5,Ke=30;function he(e,r={}){let t=new Z.Color(_nullishCoalesce(r.color, () => (Ze))),n=_nullishCoalesce(r.width, () => (Je)),a=_nullishCoalesce(r.thresholdAngle, () => (Ke)),o=[];return e.traverse(i=>{if(!(i instanceof Z.Mesh)||i.userData.id==="floor"||i.userData.id==="grid"||i.userData.kind===ee||i.children.some(s=>_optionalChain([s, 'access', _8 => _8.userData, 'optionalAccess', _9 => _9.kind])===ee)||!i.geometry)return;let l=Qe(i.geometry,t,n,a);i.add(l),o.push(l)}),o}function Qe(e,r,t,n){let a=new Z.EdgesGeometry(e,n),o=new _LineSegmentsGeometryjs.LineSegmentsGeometry;o.setPositions(Array.from(a.attributes.position.array)),a.dispose();let i=new (0, _LineMaterialjs.LineMaterial)({color:r});i.linewidth=t,i.polygonOffset=!0,i.polygonOffsetFactor=-1,i.polygonOffsetUnits=-1;let l=new (0, _LineSegments2js.LineSegments2)(o,i);return l.userData.kind=ee,l.raycast=()=>{},l}function et(e){return _optionalChain([e, 'access', _10 => _10.userData, 'optionalAccess', _11 => _11.kind])===ee}function Xn(e){let r=[];e.traverse(t=>{t instanceof _LineSegments2js.LineSegments2&&et(t)&&r.push(t)});for(let t of r)t.geometry.dispose(),t.material.dispose(),t.removeFromParent();return r.length}var _EffectComposerjs = require('three/addons/postprocessing/EffectComposer.js');var _RenderPassjs = require('three/addons/postprocessing/RenderPass.js');var _GTAOPassjs = require('three/addons/postprocessing/GTAOPass.js');var _OutputPassjs = require('three/addons/postprocessing/OutputPass.js');function ge(e,r,t,n,a,o){let i=new (0, _EffectComposerjs.EffectComposer)(e),l=new (0, _RenderPassjs.RenderPass)(r,t);i.addPass(l);let s=new (0, _GTAOPassjs.GTAOPass)(r,t,n,a);s.blendIntensity=_nullishCoalesce(o.aoIntensity, () => (1)),s.updateGtaoMaterial({screenSpaceRadius:!0}),i.addPass(s);let c=new _OutputPassjs.OutputPass;return i.addPass(c),e.toneMapping=o.toneMapping,e.toneMappingExposure=o.toneMappingExposure,i.setSize(n,a),{render:d=>i.render(d),setSize:(d,u,m)=>{i.setPixelRatio(m),i.setSize(d,u),s.setSize(d,u)},setCamera:d=>{l.camera=d,s.camera=d},dispose:()=>{i.dispose(),s.dispose(),c.dispose()}}}var _CSS2DRendererjs = require('three/addons/renderers/CSS2DRenderer.js');function be(e,r){let t=new _CSS2DRendererjs.CSS2DRenderer,n=t.domElement;n.style.position="absolute",n.style.top="0",n.style.left="0",n.style.width="100%",n.style.height="100%",n.style.overflow="hidden",n.style.pointerEvents="none",n.style.zIndex="30",getComputedStyle(e).position==="static"&&(e.style.position="relative"),e.appendChild(n);let a={width:e.clientWidth||1,height:e.clientHeight||1};t.setSize(a.width,a.height);let o=new ye.Group;o.name="label-layer",o.userData.id="label-layer",r.add(o);let i=new Set;return{addLabel:(s,c,d)=>{let u=document.createElement("div");u.textContent=s,d?u.className=d:Object.assign(u.style,{padding:"2px 6px",borderRadius:"4px",background:"rgba(20, 20, 20, 0.78)",color:"#fff",font:"12px/1.3 system-ui, sans-serif",whiteSpace:"pre",textAlign:"center",userSelect:"none"}),u.style.pointerEvents="none";let m=new (0, _CSS2DRendererjs.CSS2DObject)(u);return m.position.copy(c),o.add(m),i.add(m),{object:m,setPosition:p=>m.position.copy(p),setText:p=>{u.textContent=p},remove:()=>{m.removeFromParent(),u.remove(),i.delete(m)}}},render:(s,c)=>t.render(s,c),setSize:(s,c)=>t.setSize(s,c),dispose:()=>{i.forEach(s=>{s.removeFromParent(),s.element.remove()}),i.clear(),o.removeFromParent(),n.remove()}}}var _Line2js = require('three/addons/lines/Line2.js');var _LineGeometryjs = require('three/addons/lines/LineGeometry.js');var ut=12,dt=16763904,mt=.015,Re={Millimeters:{metersPerUnit:1/1e3,suffix:"mm"},Centimeters:{metersPerUnit:1/100,suffix:"cm"},Meters:{metersPerUnit:1,suffix:"m"},Inches:{metersPerUnit:1/39.37,suffix:"in"},Feet:{metersPerUnit:1/3.28084,suffix:"ft"}};function pt(e){let r=e&&Re[e]||Re.Meters;return t=>`${(t/r.metersPerUnit).toPrecision(3)} ${r.suffix}`}function ft(e){let r=e.object;return r instanceof S.Mesh?e.face?[e.face.a,e.face.b,e.face.c]:null:r instanceof S.Points?e.index!=null?[e.index]:null:r instanceof S.Line&&e.index!=null?[e.index,e.index+1]:null}function Et(e,r,t,n){let a=e.point.clone(),o=e.object,i=ft(e);if(!i||!o.geometry)return a;let l=o.geometry.attributes.position;if(!l)return a;let s=m=>{let p=m.clone().project(r);return new S.Vector2((p.x+1)/2*t.width,(1-p.y)/2*t.height)},c=s(a),d=a,u=n;for(let m of i){if(m>=l.count)continue;let E=new S.Vector3().fromBufferAttribute(l,m).applyMatrix4(o.matrixWorld),A=s(E).distanceTo(c);A<u&&(u=A,d=E)}return d}function Te(e){let{canvas:r,scene:t,getActiveCamera:n,labelLayer:a,options:o={}}=e,i=_nullishCoalesce(o.snapPixels, () => (ut)),l=new S.Color(_nullishCoalesce(o.color, () => (dt))),s=pt(o.displayUnit),c=(h,w)=>`${s(h)}
54
- \u0394x ${s(w.x)} \u0394y ${s(w.y)} \u0394z ${s(w.z)}`,d=_nullishCoalesce(o.format, () => (c)),u=new S.Raycaster,m=new S.Vector2,p=!1,E=[],A=[],v=null,g=null,R=new S.PointsMaterial({color:l,size:8,sizeAttenuation:!1,depthTest:!1}),y=new S.PointsMaterial({color:l,size:11,sizeAttenuation:!1,depthTest:!1,transparent:!0,opacity:.5}),H=null,O=h=>{if(!h){H&&(H.visible=!1);return}if(!H){let w=new S.BufferGeometry;w.setAttribute("position",new S.Float32BufferAttribute([0,0,0],3)),H=new S.Points(w,y),H.renderOrder=1e3,H.userData.id="measure",H.raycast=()=>{},t.add(H)}H.position.copy(h),H.visible=!0},b=h=>{let w=new S.BufferGeometry;w.setAttribute("position",new S.Float32BufferAttribute([h.x,h.y,h.z],3));let V=new S.Points(w,R);return V.renderOrder=999,V.userData.id="measure",V.raycast=()=>{},t.add(V),V},T=()=>{E.length=0,A.forEach(h=>{h.geometry.dispose(),h.removeFromParent()}),A.length=0,v&&(v.geometry.dispose(),v.material.dispose(),v.removeFromParent(),v=null),_optionalChain([g, 'optionalAccess', _12 => _12.remove, 'call', _13 => _13()]),g=null},x=()=>{if(E.length!==2)return;let[h,w]=E,V=new _LineGeometryjs.LineGeometry;V.setPositions([h.x,h.y,h.z,w.x,w.y,w.z]);let Y=new (0, _LineMaterialjs.LineMaterial)({color:l});Y.linewidth=2,Y.depthTest=!1,v=new (0, _Line2js.Line2)(V,Y),v.renderOrder=998,v.userData.id="measure",v.raycast=()=>{},t.add(v);let X=h.clone().add(w).multiplyScalar(.5),$=new S.Vector3(Math.abs(w.x-h.x),Math.abs(w.y-h.y),Math.abs(w.z-h.z));g=a.addLabel(d(h.distanceTo(w),$),X,o.labelClassName)},P=h=>{let w=r.getBoundingClientRect();m.x=(h.clientX-w.left)/w.width*2-1,m.y=-((h.clientY-w.top)/w.height)*2+1;let V=n();u.setFromCamera(m,V);let X=V.position.length()*mt;u.params.Line.threshold=X,u.params.Points.threshold=X;let $=u.intersectObjects(t.children,!0).filter(q=>q.object.userData.id!=="measure"&&q.object.userData.id!=="grid");return $.length===0?null:Et($[0],V,{width:w.width,height:w.height},i)};return{setEnabled:h=>{p=h,h||(T(),O(null))},isEnabled:()=>p,handleClick:h=>{if(!p)return!1;E.length===2&&T();let w=P(h);return w===null||(E.push(w),A.push(b(w)),E.length===2&&x()),!0},handleMove:h=>{p&&O(P(h))},clear:T,dispose:()=>{T(),H&&(H.geometry.dispose(),H.removeFromParent(),H=null),R.dispose(),y.dispose()}}}var _OrbitControlsjs = require('three/addons/controls/OrbitControls.js');var _HDRLoaderjs = require('three/addons/loaders/HDRLoader.js');var te=new f.Vector3(0,0,1);function yt(e){let r=Math.abs(e.x),t=Math.abs(e.y),n=Math.abs(e.z);return n>=r&&n>=t?"z":t>=r&&t>=n?"y":"x"}var gr=function(e,r){let t=bt(r||{}),n=_optionalChain([t, 'access', _14 => _14.environment, 'optionalAccess', _15 => _15.sceneUp])||te,a=Ht(t),o=St(t,e);o.up.copy(n);let i=Dt(e,t),l=Pt(o,e,t),s=me({scene:a,perspective:o,controls:l,onActiveCameraChange:()=>{},up:n}),c=()=>s.getActiveCamera();xt(a,t);let d=Ct(a,t),u=()=>{d&&wt(d,ae(a))};_optionalChain([t, 'access', _16 => _16.floor, 'optionalAccess', _17 => _17.enabled])&&At(a,t);let m=t.grid.enabled?pe({cellSize:t.grid.cellSize,majorEvery:t.grid.majorEvery,cellColor:t.grid.cellColor,majorColor:t.grid.majorColor,fadeDistance:t.grid.fadeDistance,plane:t.grid.plane}):null;m&&a.add(m.object);let p=t.gizmo.enabled?fe({camera:o,domElement:e,controller:s}):null,E=_nullishCoalesce(e.parentElement, () => (e)),A=t.measure.enabled?be(E,a):null,v=t.measure.enabled&&A?Te({canvas:e,scene:a,getActiveCamera:c,labelLayer:A,options:{snapPixels:t.measure.snapPixels,color:t.measure.color,labelClassName:t.measure.labelClassName,displayUnit:t.measure.displayUnit,format:t.measure.format}}):null,g=t.events.enableEventHandlers!==!1?Lt(e,a,c,o,l,t):{dispose:()=>{},fitToView:()=>{},clearSelection:()=>{}},R=5,y=0,H=0,O=M=>{y=M.clientX,H=M.clientY},b=M=>Math.hypot(M.clientX-y,M.clientY-H)>R,T=M=>{if(!b(M)){if(_optionalChain([v, 'optionalAccess', _18 => _18.handleClick, 'call', _19 => _19(M)])){M.stopImmediatePropagation();return}_optionalChain([p, 'optionalAccess', _20 => _20.handleClick, 'call', _21 => _21(M)])&&M.stopImmediatePropagation()}};(p||v)&&(e.addEventListener("mousedown",O,{capture:!0}),e.addEventListener("click",T,{capture:!0}));let x=M=>_optionalChain([v, 'optionalAccess', _22 => _22.handleMove, 'call', _23 => _23(M)]);v&&e.addEventListener("mousemove",x,{passive:!0});let P=M=>{he(M,{color:t.edges.color,width:t.edges.width,thresholdAngle:t.edges.thresholdAngle})},D=e.parentElement,F=()=>D?{width:D.clientWidth,height:D.clientHeight}:{width:window.innerWidth,height:window.innerHeight},h=null,w=()=>{let{width:M,height:B}=F(),N=Math.min(window.devicePixelRatio,2),Q=ge(i,a,c(),Math.max(1,M),Math.max(1,B),{toneMapping:_nullishCoalesce(t.render.toneMapping, () => (f.NeutralToneMapping)),toneMappingExposure:_nullishCoalesce(t.render.toneMappingExposure, () => (1)),aoIntensity:t.render.aoIntensity});return Q.setSize(Math.max(1,M),Math.max(1,B),N),Q},V=M=>{M&&!h?h=w():!M&&h&&(h.dispose(),h=null)};t.render.ambientOcclusion&&(h=w());let{animate:Y,dispose:X}=Mt(i,a,o,c,s,l,F,t.events.onFrame,m,p,()=>h,A);Y(),a.up.set(n.x,n.y,n.z),u();let $=M=>{M.traverse(B=>{let N=B;!N.geometry&&!N.material||(_optionalChain([N, 'access', _24 => _24.geometry, 'optionalAccess', _25 => _25.dispose, 'call', _26 => _26()]),Array.isArray(N.material)?N.material.forEach(Q=>Q.dispose()):_optionalChain([N, 'access', _27 => _27.material, 'optionalAccess', _28 => _28.dispose, 'call', _29 => _29()]))})},q=M=>{M.userData.source="user",a.add(M)},Oe=M=>{M.removeFromParent(),$(M)},Ie=()=>{a.children.filter(B=>B.userData.source==="user").forEach(B=>{B.removeFromParent(),$(B)})};return{scene:a,camera:o,controls:l,renderer:i,cameraController:s,grid:m,gizmo:p,measureTool:v,applyEdges:P,setAmbientOcclusion:V,updateShadowBounds:u,dispose:()=>{X(),g.dispose(),(p||v)&&(e.removeEventListener("mousedown",O,{capture:!0}),e.removeEventListener("click",T,{capture:!0})),v&&e.removeEventListener("mousemove",x),_optionalChain([v, 'optionalAccess', _30 => _30.dispose, 'call', _31 => _31()]),_optionalChain([A, 'optionalAccess', _32 => _32.dispose, 'call', _33 => _33()]),_optionalChain([p, 'optionalAccess', _34 => _34.dispose, 'call', _35 => _35()]),_optionalChain([m, 'optionalAccess', _36 => _36.dispose, 'call', _37 => _37()]),_optionalChain([h, 'optionalAccess', _38 => _38.dispose, 'call', _39 => _39()]),l.dispose(),i.dispose(),a.traverse(M=>{let B=M;!B.geometry&&!B.material||(_optionalChain([B, 'access', _40 => _40.geometry, 'optionalAccess', _41 => _41.dispose, 'call', _42 => _42()]),Array.isArray(B.material)?B.material.forEach(N=>N.dispose()):_optionalChain([B, 'access', _43 => _43.material, 'optionalAccess', _44 => _44.dispose, 'call', _45 => _45()]))}),_optionalChain([a, 'access', _46 => _46.environment, 'optionalAccess', _47 => _47.dispose, 'call', _48 => _48()]),a.background instanceof f.Texture&&a.background.dispose()},fitToView:g.fitToView,clearSelection:g.clearSelection,addUserGeometry:q,removeUserGeometry:Oe,clearUserGeometry:Ie}};function bt(e){let r=e.sceneScale||"m",n={mm:{cameraDistance:20,near:.1,far:2e3,floorSize:100,lightDistance:10,lightHeight:20,minDistance:.1,shadowSize:100,scaleFactor:1e3},cm:{cameraDistance:20,near:.1,far:2e3,floorSize:100,lightDistance:25,lightHeight:50,minDistance:.1,shadowSize:100,scaleFactor:100},m:{cameraDistance:10,near:.01,far:2e3,floorSize:50,lightDistance:25,lightHeight:50,minDistance:.001,shadowSize:100,scaleFactor:1},inches:{cameraDistance:15,near:.1,far:2e3,floorSize:80,lightDistance:20,lightHeight:40,minDistance:.1,shadowSize:80,scaleFactor:39.37},feet:{cameraDistance:8,near:.1,far:2e3,floorSize:40,lightDistance:15,lightHeight:30,minDistance:.1,shadowSize:60,scaleFactor:3.28084}}[r];return{sceneScale:r,camera:{position:_optionalChain([e, 'access', _49 => _49.camera, 'optionalAccess', _50 => _50.position])||new f.Vector3(-n.cameraDistance,-n.cameraDistance,n.cameraDistance),fov:_optionalChain([e, 'access', _51 => _51.camera, 'optionalAccess', _52 => _52.fov])||20,near:_optionalChain([e, 'access', _53 => _53.camera, 'optionalAccess', _54 => _54.near])||n.near,far:_optionalChain([e, 'access', _55 => _55.camera, 'optionalAccess', _56 => _56.far])||n.far,target:_optionalChain([e, 'access', _57 => _57.camera, 'optionalAccess', _58 => _58.target])||new f.Vector3(0,0,0)},lighting:{enableSunlight:_nullishCoalesce(_optionalChain([e, 'access', _59 => _59.lighting, 'optionalAccess', _60 => _60.enableSunlight]), () => (!0)),sunlightIntensity:_nullishCoalesce(_optionalChain([e, 'access', _61 => _61.lighting, 'optionalAccess', _62 => _62.sunlightIntensity]), () => (1)),sunlightPosition:_optionalChain([e, 'access', _63 => _63.lighting, 'optionalAccess', _64 => _64.sunlightPosition])||new f.Vector3(n.lightDistance,n.lightDistance,n.lightHeight),ambientLightColor:_optionalChain([e, 'access', _65 => _65.lighting, 'optionalAccess', _66 => _66.ambientLightColor])||new f.Color(4210752),ambientLightIntensity:_nullishCoalesce(_optionalChain([e, 'access', _67 => _67.lighting, 'optionalAccess', _68 => _68.ambientLightIntensity]), () => (1)),sunlightColor:_optionalChain([e, 'access', _69 => _69.lighting, 'optionalAccess', _70 => _70.sunlightColor])||16777215},environment:{hdrPath:_optionalChain([e, 'access', _71 => _71.environment, 'optionalAccess', _72 => _72.hdrPath])||"/baseHDR.hdr",backgroundColor:_optionalChain([e, 'access', _73 => _73.environment, 'optionalAccess', _74 => _74.backgroundColor])||new f.Color(15790320),enableEnvironmentLighting:_nullishCoalesce(_optionalChain([e, 'access', _75 => _75.environment, 'optionalAccess', _76 => _76.enableEnvironmentLighting]), () => (!0)),sceneUp:_optionalChain([e, 'access', _77 => _77.environment, 'optionalAccess', _78 => _78.sceneUp])||te,showEnvironment:_nullishCoalesce(_optionalChain([e, 'access', _79 => _79.environment, 'optionalAccess', _80 => _80.showEnvironment]), () => (!1))},floor:{enabled:_nullishCoalesce(_optionalChain([e, 'access', _81 => _81.floor, 'optionalAccess', _82 => _82.enabled]), () => (!1)),size:_optionalChain([e, 'access', _83 => _83.floor, 'optionalAccess', _84 => _84.size])||n.floorSize,color:_optionalChain([e, 'access', _85 => _85.floor, 'optionalAccess', _86 => _86.color])||new f.Color(8421504),roughness:_nullishCoalesce(_optionalChain([e, 'access', _87 => _87.floor, 'optionalAccess', _88 => _88.roughness]), () => (.7)),metalness:_nullishCoalesce(_optionalChain([e, 'access', _89 => _89.floor, 'optionalAccess', _90 => _90.metalness]), () => (0)),receiveShadow:_nullishCoalesce(_optionalChain([e, 'access', _91 => _91.floor, 'optionalAccess', _92 => _92.receiveShadow]), () => (!0))},render:{enableShadows:_nullishCoalesce(_optionalChain([e, 'access', _93 => _93.render, 'optionalAccess', _94 => _94.enableShadows]), () => (!0)),shadowMapSize:_optionalChain([e, 'access', _95 => _95.render, 'optionalAccess', _96 => _96.shadowMapSize])||2048,antialias:_nullishCoalesce(_optionalChain([e, 'access', _97 => _97.render, 'optionalAccess', _98 => _98.antialias]), () => (!0)),pixelRatio:_optionalChain([e, 'access', _99 => _99.render, 'optionalAccess', _100 => _100.pixelRatio])||Math.min(window.devicePixelRatio,2),toneMapping:_optionalChain([e, 'access', _101 => _101.render, 'optionalAccess', _102 => _102.toneMapping])||f.NeutralToneMapping,toneMappingExposure:_nullishCoalesce(_optionalChain([e, 'access', _103 => _103.render, 'optionalAccess', _104 => _104.toneMappingExposure]), () => (1)),preserveDrawingBuffer:_nullishCoalesce(_optionalChain([e, 'access', _105 => _105.render, 'optionalAccess', _106 => _106.preserveDrawingBuffer]), () => (!1)),ambientOcclusion:_nullishCoalesce(_optionalChain([e, 'access', _107 => _107.render, 'optionalAccess', _108 => _108.ambientOcclusion]), () => (!1)),aoIntensity:_nullishCoalesce(_optionalChain([e, 'access', _109 => _109.render, 'optionalAccess', _110 => _110.aoIntensity]), () => (1))},controls:{enableDamping:_nullishCoalesce(_optionalChain([e, 'access', _111 => _111.controls, 'optionalAccess', _112 => _112.enableDamping]), () => (!1)),dampingFactor:_optionalChain([e, 'access', _113 => _113.controls, 'optionalAccess', _114 => _114.dampingFactor])||.05,autoRotate:_nullishCoalesce(_optionalChain([e, 'access', _115 => _115.controls, 'optionalAccess', _116 => _116.autoRotate]), () => (!1)),autoRotateSpeed:_optionalChain([e, 'access', _117 => _117.controls, 'optionalAccess', _118 => _118.autoRotateSpeed])||.5,enableZoom:_nullishCoalesce(_optionalChain([e, 'access', _119 => _119.controls, 'optionalAccess', _120 => _120.enableZoom]), () => (!0)),enablePan:_nullishCoalesce(_optionalChain([e, 'access', _121 => _121.controls, 'optionalAccess', _122 => _122.enablePan]), () => (!0)),minDistance:_optionalChain([e, 'access', _123 => _123.controls, 'optionalAccess', _124 => _124.minDistance])||n.minDistance,maxDistance:_optionalChain([e, 'access', _125 => _125.controls, 'optionalAccess', _126 => _126.maxDistance])||1/0},grid:{enabled:_nullishCoalesce(_optionalChain([e, 'access', _127 => _127.grid, 'optionalAccess', _128 => _128.enabled]), () => (!1)),cellSize:_nullishCoalesce(_optionalChain([e, 'access', _129 => _129.grid, 'optionalAccess', _130 => _130.cellSize]), () => (1)),majorEvery:_nullishCoalesce(_optionalChain([e, 'access', _131 => _131.grid, 'optionalAccess', _132 => _132.majorEvery]), () => (10)),cellColor:_nullishCoalesce(_optionalChain([e, 'access', _133 => _133.grid, 'optionalAccess', _134 => _134.cellColor]), () => (8947848)),majorColor:_nullishCoalesce(_optionalChain([e, 'access', _135 => _135.grid, 'optionalAccess', _136 => _136.majorColor]), () => (4473924)),fadeDistance:_nullishCoalesce(_optionalChain([e, 'access', _137 => _137.grid, 'optionalAccess', _138 => _138.fadeDistance]), () => (100)),plane:_nullishCoalesce(_optionalChain([e, 'access', _139 => _139.grid, 'optionalAccess', _140 => _140.plane]), () => (yt(_nullishCoalesce(_optionalChain([e, 'access', _141 => _141.environment, 'optionalAccess', _142 => _142.sceneUp]), () => (te)))))},gizmo:{enabled:_nullishCoalesce(_optionalChain([e, 'access', _143 => _143.gizmo, 'optionalAccess', _144 => _144.enabled]), () => (!1))},edges:{enabled:_nullishCoalesce(_optionalChain([e, 'access', _145 => _145.edges, 'optionalAccess', _146 => _146.enabled]), () => (!1)),color:_nullishCoalesce(_optionalChain([e, 'access', _147 => _147.edges, 'optionalAccess', _148 => _148.color]), () => (2236962)),width:_nullishCoalesce(_optionalChain([e, 'access', _149 => _149.edges, 'optionalAccess', _150 => _150.width]), () => (1.5)),thresholdAngle:_nullishCoalesce(_optionalChain([e, 'access', _151 => _151.edges, 'optionalAccess', _152 => _152.thresholdAngle]), () => (30))},measure:{enabled:_nullishCoalesce(_optionalChain([e, 'access', _153 => _153.measure, 'optionalAccess', _154 => _154.enabled]), () => (!1)),snapPixels:_optionalChain([e, 'access', _155 => _155.measure, 'optionalAccess', _156 => _156.snapPixels]),color:_optionalChain([e, 'access', _157 => _157.measure, 'optionalAccess', _158 => _158.color]),labelClassName:_optionalChain([e, 'access', _159 => _159.measure, 'optionalAccess', _160 => _160.labelClassName]),displayUnit:_optionalChain([e, 'access', _161 => _161.measure, 'optionalAccess', _162 => _162.displayUnit]),format:_optionalChain([e, 'access', _163 => _163.measure, 'optionalAccess', _164 => _164.format])},events:{onBackgroundClicked:_optionalChain([e, 'access', _165 => _165.events, 'optionalAccess', _166 => _166.onBackgroundClicked]),onObjectSelected:_optionalChain([e, 'access', _167 => _167.events, 'optionalAccess', _168 => _168.onObjectSelected]),onMeshMetadataClicked:_optionalChain([e, 'access', _169 => _169.events, 'optionalAccess', _170 => _170.onMeshMetadataClicked]),onMeshDoubleClicked:_optionalChain([e, 'access', _171 => _171.events, 'optionalAccess', _172 => _172.onMeshDoubleClicked]),selectionColor:_optionalChain([e, 'access', _173 => _173.events, 'optionalAccess', _174 => _174.selectionColor])||"#ff0000",enableEventHandlers:_nullishCoalesce(_optionalChain([e, 'access', _175 => _175.events, 'optionalAccess', _176 => _176.enableEventHandlers]), () => (!0)),enableKeyboardControls:_nullishCoalesce(_optionalChain([e, 'access', _177 => _177.events, 'optionalAccess', _178 => _178.enableKeyboardControls]), () => (!0)),enableClickToFocus:_nullishCoalesce(_optionalChain([e, 'access', _179 => _179.events, 'optionalAccess', _180 => _180.enableClickToFocus]), () => (!0)),enableDoubleClickZoom:_nullishCoalesce(_optionalChain([e, 'access', _181 => _181.events, 'optionalAccess', _182 => _182.enableDoubleClickZoom]), () => (!0)),onReady:_optionalChain([e, 'access', _183 => _183.events, 'optionalAccess', _184 => _184.onReady]),onFrame:_optionalChain([e, 'access', _185 => _185.events, 'optionalAccess', _186 => _186.onFrame])}}}var Rt=new Set(["grid","floor","label-layer","measure"]);function Tt(e){let r=e;for(;r;){if(typeof r.userData.id=="string"&&Rt.has(r.userData.id))return!0;r=r.parent}return!1}function ae(e){let r=new f.Box3;return e.traverse(t=>{let n=t;t.visible&&!Tt(t)&&n.geometry&&r.expandByObject(t)}),r}function wt(e,r){if(r.isEmpty())return;let t=r.getCenter(new f.Vector3),n=r.getSize(new f.Vector3).length()*.5*1.2,a=e.shadow.camera;a.left=-n,a.right=n,a.top=n,a.bottom=-n,e.target.position.copy(t),e.target.updateMatrixWorld();let o=e.position.distanceTo(t);a.near=Math.max(n*.01,o-n),a.far=o+n,a.updateProjectionMatrix()}function Ht(e){let r=new f.Scene,t=typeof e.environment.backgroundColor=="string"?new f.Color(e.environment.backgroundColor):e.environment.backgroundColor;return r.background=t||null,r}function vt(e,r,t,n,a=200){let o=e.position.clone(),i=r.target.clone(),l=performance.now(),s=d=>1-Math.pow(1-d,3),c=()=>{let d=performance.now()-l,u=s(Math.min(d/a,1));e.position.lerpVectors(o,t,u),r.target.lerpVectors(i,n,u),r.update(),u<1&&requestAnimationFrame(c)};requestAnimationFrame(c)}function Mt(e,r,t,n,a,o,i,l,s,c,d,u){let m=null,p=performance.now(),E=()=>{let{width:g,height:R}=i();if(g===0||R===0)return;let y=Math.min(window.devicePixelRatio,2),H=Math.round(g*y),O=Math.round(R*y);(e.domElement.width!==H||e.domElement.height!==O)&&(e.setPixelRatio(y),e.setSize(g,R,!1),t.aspect=g/R,t.updateProjectionMatrix(),a.updateAspect(g,R),_optionalChain([d, 'optionalCall', _187 => _187(), 'optionalAccess', _188 => _188.setSize, 'call', _189 => _189(g,R,y)]),_optionalChain([u, 'optionalAccess', _190 => _190.setSize, 'call', _191 => _191(g,R)]))},A=function(){m=requestAnimationFrame(A);let g=performance.now(),R=(g-p)/1e3;p=g,E(),(o.enableDamping||o.autoRotate)&&o.update(),s&&s.update(n().position),c&&c.update(R),_optionalChain([l, 'optionalCall', _192 => _192(R)]);let y=n(),H=_optionalChain([d, 'optionalCall', _193 => _193()]);H?(H.setCamera(y),H.render(R)):e.render(r,y),u&&u.render(r,y),c&&c.render(e)};return{animate:A,dispose:()=>{m!==null&&(cancelAnimationFrame(m),m=null)}}}function xt(e,r){r.environment.enableEnvironmentLighting?new (0, _HDRLoaderjs.HDRLoader)().load(r.environment.hdrPath||"/baseHDR.hdr",function(t){if(!_optionalChain([t, 'optionalAccess', _194 => _194.image])){_chunkLBRCTJ7Wcjs.e.call(void 0, ).warn("HDR loaded without image data; skipping environment map."),_optionalChain([r, 'access', _195 => _195.events, 'access', _196 => _196.onReady, 'optionalCall', _197 => _197()]);return}t.mapping=f.EquirectangularReflectionMapping,e.environment=t,r.environment.showEnvironment&&(e.background=t),_optionalChain([r, 'access', _198 => _198.events, 'access', _199 => _199.onReady, 'optionalCall', _200 => _200()])},void 0,function(t){_chunkLBRCTJ7Wcjs.e.call(void 0, ).warn("HDR texture could not be loaded, falling back to basic lighting:",t),_optionalChain([r, 'access', _201 => _201.events, 'access', _202 => _202.onReady, 'optionalCall', _203 => _203()])}):_optionalChain([r, 'access', _204 => _204.events, 'access', _205 => _205.onReady, 'optionalCall', _206 => _206()])}function Ct(e,r){let t=new f.AmbientLight(r.lighting.ambientLightColor,r.lighting.ambientLightIntensity);if(e.add(t),!r.lighting.enableSunlight)return null;let n=new f.DirectionalLight(_nullishCoalesce(r.lighting.sunlightColor, () => (16777215)),r.lighting.sunlightIntensity),a=r.lighting.sunlightPosition;return a&&n.position.set(a.x,a.y,a.z),r.render.enableShadows?(n.castShadow=!0,n.shadow.mapSize.width=r.render.shadowMapSize||2048,n.shadow.mapSize.height=r.render.shadowMapSize||2048,n.shadow.bias=-1e-4,n.shadow.normalBias=.02,n.shadow.radius=4,e.add(n),e.add(n.target),n):(e.add(n),null)}function At(e,r){let t=r.floor.size,n=new f.PlaneGeometry(t,t),a=typeof r.floor.color=="string"?new f.Color(r.floor.color):r.floor.color,o=new f.MeshStandardMaterial({color:a,roughness:r.floor.roughness,metalness:r.floor.metalness,side:f.DoubleSide}),i=new f.Mesh(n,o);i.userData.id="floor",i.name="floor";let l=(_optionalChain([r, 'access', _207 => _207.environment, 'optionalAccess', _208 => _208.sceneUp])||te).clone().normalize();i.quaternion.setFromUnitVectors(new f.Vector3(0,0,1),l),i.position.set(0,0,0),r.floor.receiveShadow&&r.render.enableShadows&&(i.receiveShadow=!0),e.add(i)}function St(e,r){let t=r.parentElement,n=t?t.clientWidth:window.innerWidth,a=t?t.clientHeight:window.innerHeight,o=new f.PerspectiveCamera(e.camera.fov,n/a,e.camera.near,e.camera.far),i=e.camera.position;return i&&o.position.set(i.x,i.y,i.z),o}function Dt(e,r){let t=new f.WebGLRenderer({antialias:r.render.antialias,canvas:e,alpha:!0,powerPreference:"high-performance",preserveDrawingBuffer:r.render.preserveDrawingBuffer,logarithmicDepthBuffer:!0}),n=e.parentElement,a=n?n.clientWidth:window.innerWidth,o=n?n.clientHeight:window.innerHeight;return n&&(e.style.width="100%",e.style.height="100%",e.style.display="block"),t.setSize(a,o,!1),t.setPixelRatio(r.render.pixelRatio||Math.min(window.devicePixelRatio,2)),r.render.enableShadows&&(t.shadowMap.enabled=!0,t.shadowMap.type=f.VSMShadowMap),t.toneMapping=r.render.toneMapping,t.toneMappingExposure=_nullishCoalesce(r.render.toneMappingExposure, () => (1)),t.outputColorSpace=f.SRGBColorSpace,t.sortObjects=!0,t}function Lt(e,r,t,n,a,o){let i=new Set,l=new Map,s=new f.Raycaster,c=new f.Vector2,d=new f.Vector2,u=b=>{let T=b;for(;T;){if(!T.visible)return!1;T=T.parent}return!0},m=()=>{let b=ae(r);if(b.isEmpty()){_chunkLBRCTJ7Wcjs.e.call(void 0, ).warn("No objects to fit to view");return}let T=b.getCenter(new f.Vector3),x=b.getSize(new f.Vector3),P=Math.max(x.x,x.y,x.z),D=n.fov*(Math.PI/180),F=P/(2*Math.tan(D/2));F*=1.5;let h=n.position.clone().sub(a.target);h.lengthSq()<1e-12&&h.set(.8,1,1.2),h.normalize(),n.position.copy(T.clone().add(h.multiplyScalar(F))),a.target.copy(T),a.update()},p=typeof o.events.selectionColor=="string"?new f.Color(o.events.selectionColor):o.events.selectionColor instanceof f.Color?o.events.selectionColor:new f.Color("#ff0000"),E=()=>{i.forEach(b=>{let T=b;if(l.has(b)){let x=l.get(b),P=T.material;P instanceof f.Material?P.dispose():Array.isArray(P)&&P.forEach(D=>D.dispose()),T.material=x,l.delete(b)}}),i.clear()},A=b=>{let T=b;if(!(T.material instanceof f.Material))return!1;l.set(b,T.material);let x=T.material.clone();return b instanceof f.Mesh&&"emissive"in x?x.emissive=p.clone():"color"in x&&(x.color=p.clone()),T.material=x,!0},v=()=>{let b=ae(r),T=b.isEmpty()?1:b.getSize(new f.Vector3).length();s.params.Points.threshold=T*.01},g=b=>{d.set(b.clientX,b.clientY)},R=b=>{let T=new f.Vector2(b.clientX,b.clientY);if(d.distanceTo(T)>5)return;let x=e.getBoundingClientRect();c.x=(b.clientX-x.left)/x.width*2-1,c.y=-((b.clientY-x.top)/x.height)*2+1,v(),s.setFromCamera(c,t());let P=s.intersectObjects(r.children,!0).filter(D=>u(D.object));if(P.length>0){let D=P[0].object;i.has(D)||(E(),i.add(D),A(D),_optionalChain([o, 'access', _209 => _209.events, 'optionalAccess', _210 => _210.onObjectSelected, 'optionalCall', _211 => _211(D)]),D instanceof f.Mesh&&Object.keys(D.userData).length>0&&_optionalChain([o, 'access', _212 => _212.events, 'optionalAccess', _213 => _213.onMeshMetadataClicked, 'optionalCall', _214 => _214(D.userData)]))}else E(),_optionalChain([o, 'access', _215 => _215.events, 'optionalAccess', _216 => _216.onBackgroundClicked, 'optionalCall', _217 => _217({x:c.x,y:c.y})])},y=b=>{let T=e.getBoundingClientRect();c.x=(b.clientX-T.left)/T.width*2-1,c.y=-((b.clientY-T.top)/T.height)*2+1,v(),s.setFromCamera(c,t());let x=s.intersectObjects(r.children,!0).filter(q=>u(q.object));if(x.length===0)return;let P=x[0].object;if(_optionalChain([o, 'access', _218 => _218.events, 'optionalAccess', _219 => _219.onMeshDoubleClicked, 'optionalCall', _220 => _220(P)]),!_optionalChain([o, 'access', _221 => _221.events, 'optionalAccess', _222 => _222.enableDoubleClickZoom]))return;let D=new f.Box3().setFromObject(P);if(D.isEmpty())return;let F=D.getCenter(new f.Vector3),h=D.getSize(new f.Vector3),w=Math.max(h.x,h.y,h.z),V=n.fov*(Math.PI/180),Y=w/(2*Math.tan(V/2))*1.5,X=n.position.clone().sub(a.target).normalize(),$=F.clone().add(X.multiplyScalar(Y));vt(n,a,$,F)},H=b=>{if(_optionalChain([o, 'access', _223 => _223.events, 'optionalAccess', _224 => _224.enableKeyboardControls]))switch(b.key.toLowerCase()){case"f":b.preventDefault(),m();break;case"escape":b.preventDefault(),E();break;case" ":b.preventDefault(),m();break}};return _optionalChain([o, 'access', _225 => _225.events, 'optionalAccess', _226 => _226.enableClickToFocus])&&(e.addEventListener("mousedown",g),e.addEventListener("click",R),e.addEventListener("dblclick",y)),_optionalChain([o, 'access', _227 => _227.events, 'optionalAccess', _228 => _228.enableKeyboardControls])&&(e.setAttribute("tabindex","0"),e.addEventListener("keydown",H)),{dispose:()=>{e.removeEventListener("mousedown",g),e.removeEventListener("click",R),e.removeEventListener("dblclick",y),e.removeEventListener("keydown",H),E()},fitToView:m,clearSelection:E}}function Pt(e,r,t){let n=new (0, _OrbitControlsjs.OrbitControls)(e,r),a=t.camera.target;return a&&n.target.set(a.x,a.y,a.z),n.enableDamping=t.controls.enableDamping||!1,n.dampingFactor=t.controls.dampingFactor||.05,n.autoRotate=t.controls.autoRotate||!1,n.autoRotateSpeed=t.controls.autoRotateSpeed||.5,n.enableZoom=_nullishCoalesce(t.controls.enableZoom, () => (!0)),n.enablePan=_nullishCoalesce(t.controls.enablePan, () => (!0)),n.minDistance=t.controls.minDistance||.001,n.maxDistance=t.controls.maxDistance||1/0,n.screenSpacePanning=!1,n.maxPolarAngle=Math.PI,n.update(),n}var jt={};_chunkLBRCTJ7Wcjs.a.call(void 0, jt,{CONCRETE_MATERIAL:()=>Vt,EMISSIVE_MATERIAL:()=>Ot,GLASS_MATERIAL:()=>Ft,METAL_MATERIAL:()=>It,PLASTIC_MATERIAL:()=>Bt,RUBBER_MATERIAL:()=>zt,WOOD_MATERIAL:()=>Ut});var Ot=new L.MeshPhysicalMaterial({color:0,emissive:new L.Color(16777215),emissiveIntensity:5,metalness:0,roughness:.2,clearcoat:.3,clearcoatRoughness:.2,depthWrite:!0,depthTest:!0,transparent:!1,alphaTest:0,polygonOffset:!0,side:L.FrontSide,dithering:!0}),It=new L.MeshPhysicalMaterial({color:new L.Color(0),metalness:.9,roughness:.3,envMapIntensity:1.2,clearcoat:.3,clearcoatRoughness:.2,reflectivity:1,ior:2.5,thickness:1,depthWrite:!0,transparent:!1,alphaTest:0,depthTest:!0,polygonOffset:!0,side:L.FrontSide,dithering:!0}),Vt=new L.MeshPhysicalMaterial({color:new L.Color(13421772),metalness:0,roughness:.92,envMapIntensity:.15,clearcoat:.05,clearcoatRoughness:.9,reflectivity:.15,transmission:0,ior:1.45,thickness:0,depthWrite:!0,transparent:!1,alphaTest:.5,depthTest:!0,polygonOffset:!0,side:L.FrontSide,dithering:!0}),Bt=new L.MeshPhysicalMaterial({color:new L.Color(16777215),metalness:0,roughness:.3,envMapIntensity:.5,clearcoat:.5,clearcoatRoughness:.1,reflectivity:.5,ior:1.4,transmission:0,transparent:!1,depthWrite:!0,side:L.FrontSide,dithering:!0,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1}),Ft=new L.MeshPhysicalMaterial({color:new L.Color(16777215),metalness:0,roughness:0,transmission:.95,transparent:!0,opacity:.3,envMapIntensity:1,clearcoat:1,clearcoatRoughness:0,ior:1.52,reflectivity:.9,thickness:1,side:L.DoubleSide,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1}),zt=new L.MeshPhysicalMaterial({color:new L.Color(1710618),metalness:0,roughness:.9,envMapIntensity:.2,clearcoat:.1,clearcoatRoughness:.8,reflectivity:.2,ior:1.3,transmission:0,depthWrite:!0,side:L.FrontSide,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1}),Ut=new L.MeshPhysicalMaterial({color:new L.Color(8934707),metalness:0,roughness:.7,envMapIntensity:.3,clearcoat:.3,clearcoatRoughness:.4,reflectivity:.3,ior:1.3,transmission:0,depthWrite:!0,side:L.FrontSide,dithering:!0,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1});function ne(e,r,t,n=!0){return{x:e,y:r,z:t}}var Nt="#ffffff",we=12,Wt=4e-4,$t=12,Yt=.05;function He(e,r={}){if(!e||e.length===0)return[];let{rhino:t,applyTransforms:n=!0}=r,a=[];for(let o of e)switch(o.kind){case"curve":{let i=qt(o,t,n);i&&a.push(i);break}case"point":{a.push(Zt(o,n));break}default:{let i=o;_chunkLBRCTJ7Wcjs.e.call(void 0, ).warn(`Skipping unknown display item kind: ${String(i.kind)}`);break}}return a}var Xt=2;function qt(e,r,t){if(!r)return _chunkLBRCTJ7Wcjs.e.call(void 0, ).warn("No rhino3dm instance provided; skipping curve display item."),null;let n=Jt(e.json,r);if(!n)return null;let a=Kt(n,t);if(a.length<2)return null;let o=[];for(let u of a)o.push(u.x,u.y,u.z);let i=new _LineGeometryjs.LineGeometry;i.setPositions(o);let l=ve(e.color,e.opacity),s=new (0, _LineMaterialjs.LineMaterial)({color:l.color}),c=s;c.linewidth=_nullishCoalesce(e.width, () => (Xt)),c.transparent=l.transparent,c.opacity=l.opacity;let d=new (0, _Line2js.Line2)(i,s);return d.computeLineDistances(),d.name=e.name,d.userData={source:"compute",id:e.id,layer:e.layer,kind:"curve",metadata:e.metadata},d}function Zt(e,r){let{x:t,y:n,z:a}=ne(e.position.X,e.position.Y,e.position.Z,r),o=new _.BufferGeometry;o.setAttribute("position",new _.Float32BufferAttribute([t,n,a],3));let i=new _.PointsMaterial({...ve(e.color,e.opacity),size:6,sizeAttenuation:!1}),l=new _.Points(o,i);return l.name=e.name,l.userData={source:"compute",id:e.id,layer:e.layer,kind:"point",metadata:e.metadata},l}function Jt(e,r){try{let t=JSON.parse(e),n=r.CommonObject.decode(t);return n&&typeof n.pointAt=="function"?n:(_chunkLBRCTJ7Wcjs.e.call(void 0, ).warn("Decoded display-item JSON is not a curve; skipping."),null)}catch(t){return _chunkLBRCTJ7Wcjs.e.call(void 0, ).warn("Failed to decode curve display item JSON:",t),null}}function Kt(e,r){let t=Qt(e,r);return t||en(e,r)}function Qt(e,r){if(!e.isPolyline())return null;let t=e.tryGetPolyline(),n=Array.isArray(t)?t[1]:t;if(!n||typeof n.count!="number"||n.count<2)return null;let a=[];for(let o=0;o<n.count;o++){let i=n.get(o),{x:l,y:s,z:c}=ne(i[0],i[1],i[2],r);a.push(new _.Vector3(l,s,c))}return a}function en(e,r){let t=e.domain,n=t[0],o=t[1]-n,i=u=>{let m=e.pointAt(u),{x:p,y:E,z:A}=ne(m[0],m[1],m[2],r);return new _.Vector3(p,E,A)},l=tn(e),s=n,c=i(n),d=[c];for(let u=0;u<we;u++){let m=n+o*(u+1)/we,p=i(m);ie(s,c,m,p,i,l,$t,d),d.push(p),s=m,c=p}return d}function ie(e,r,t,n,a,o,i,l){if(i<=0)return;let s=(e+t)/2,c=a(s),d=rn(c,r,n),u=nn(r,c,n);d<=o&&u<=Yt||(ie(e,r,s,c,a,o,i-1,l),l.push(c),ie(s,c,t,n,a,o,i-1,l))}function tn(e){let r=e.getBoundingBox(),t=r.min,n=r.max,a=Math.hypot(n[0]-t[0],n[1]-t[1],n[2]-t[2]);return Math.max(a*Wt,1e-6)}function nn(e,r,t){let n=r.clone().sub(e),a=t.clone().sub(r),o=n.length(),i=a.length();if(o===0||i===0)return 0;let l=Math.max(-1,Math.min(1,n.dot(a)/(o*i)));return Math.acos(l)}function rn(e,r,t){let n=t.clone().sub(r),a=n.lengthSq();if(a===0)return e.distanceTo(r);let o=Math.max(0,Math.min(1,e.clone().sub(r).dot(n)/a)),i=r.clone().addScaledVector(n,o);return e.distanceTo(i)}function ve(e,r){let t=_nullishCoalesce(r, () => (1));return{color:new _.Color(_nullishCoalesce(e, () => (Nt))),transparent:t<1,opacity:t}}var _fflate = require('fflate');var Me=1096174675,an=1515605075,xe= exports.t =3,Ce=1,se= exports.u =1,sn=2,ln= exports.v =4,Ae=12,Se=56;function le(e){let r=un(cn(e)),t=new DataView(r.buffer,r.byteOffset,r.byteLength);if(r.byteLength<Ae)throw G("Blob too small to contain SLVA header.",{expectedBytes:Ae,availableBytes:r.byteLength});let n=0,a=t.getUint32(n,!0);if(n+=4,a!==Me)throw G(`Invalid SLVA magic: 0x${a.toString(16)}`,{expectedMagic:`0x${Me.toString(16)}`,actualMagic:`0x${a.toString(16)}`});let o=t.getUint32(n,!0);if(n+=4,o<Ce||o>xe)throw G(`Unsupported SLVA version: ${o}`,{minSupportedVersion:Ce,maxSupportedVersion:xe,actualVersion:o});let i=t.getUint32(n,!0);if(n+=4,n+i>r.byteLength)throw G("Insufficient data to read metadata JSON.",{expectedBytes:i,availableBytes:r.byteLength-n,offset:n});let l=r.subarray(n,n+i);n+=i;let s;try{s=JSON.parse(dn(l))}catch(w){throw G(`Failed to parse metadata JSON: ${w instanceof Error?w.message:String(w)}`,{metadataLen:i})}if(n+Se>r.byteLength)throw G("Insufficient data to read geometry header.",{expectedBytes:Se,availableBytes:r.byteLength-n,offset:n});let c=t.getUint32(n,!0);n+=4;let d=t.getFloat64(n,!0);n+=8;let u=t.getFloat64(n,!0);n+=8;let m=t.getFloat64(n,!0);n+=8;let p=t.getFloat64(n,!0);n+=8;let E=t.getFloat64(n,!0);n+=8;let A=t.getFloat64(n,!0);n+=8;let v=t.getUint32(n,!0);n+=4;let g=(c&se)!==0,R=(c&ln)!==0,y=v*3,O=y*(g?4:2);if(n+O>r.byteLength)throw G("Insufficient data to read vertices.",{expectedBytes:O,availableBytes:r.byteLength-n,offset:n,useFloat32:g,vertexCount:v});let b=r.byteOffset+n,T;if(g?T=pn(r.buffer,b,y):R?T=En(De(r.buffer,b,y)):T=mn(r.buffer,b,y),n+=O,n+4>r.byteLength)throw G("Insufficient data to read index count.",{expectedBytes:4,availableBytes:r.byteLength-n,offset:n});let x=t.getUint32(n,!0);n+=4;let P=(c&sn)!==0,F=x*(P?2:4);if(n+F>r.byteLength)throw G("Insufficient data to read indices.",{expectedBytes:F,availableBytes:r.byteLength-n,offset:n,indexCount:x,useUint16Indices:P});let h=P?De(r.buffer,r.byteOffset+n,x):fn(r.buffer,r.byteOffset+n,x);return R&&(h=h instanceof Uint16Array?hn(h):gn(h)),{metadata:s,flags:c,vertices:T,indices:h,origin:[d,u,m],scale:[p,E,A]}}function cn(e){return typeof e=="string"?_chunkLBRCTJ7Wcjs.j.call(void 0, e):e instanceof Uint8Array?e:new Uint8Array(e)}function un(e){if(e.byteLength<8)return e;let r=new DataView(e.buffer,e.byteOffset,e.byteLength);if(r.getUint32(0,!0)!==an)return e;let t=r.getUint32(4,!0),n=e.subarray(8),a=Math.max(n.byteLength*1032+1024,1<<20);if(t>a)throw G("SLVZ header declares an implausible uncompressed length",{uncompressedLen:t,deflatedBytes:n.byteLength,maxPlausibleLen:a});try{return _fflate.inflateSync.call(void 0, n,{out:new Uint8Array(t)})}catch(o){throw G(`Failed to inflate SLVZ blob: ${o instanceof Error?o.message:String(o)}`,{uncompressedLen:t,deflatedBytes:n.byteLength})}}function dn(e){if(typeof TextDecoder<"u")return new TextDecoder("utf-8").decode(e);if(typeof globalThis.Buffer<"u")return globalThis.Buffer.from(e).toString("utf-8");throw new (0, _chunkLBRCTJ7Wcjs.d)("No UTF-8 decoder available in this environment.",_chunkLBRCTJ7Wcjs.c.INVALID_STATE)}function mn(e,r,t){if(t===0)return new Int16Array(0);if(r%2===0)return new Int16Array(e,r,t);let n=new Uint8Array(t*2);return n.set(new Uint8Array(e,r,t*2)),new Int16Array(n.buffer)}function pn(e,r,t){if(t===0)return new Float32Array(0);if(r%4===0)return new Float32Array(e,r,t);let n=new Uint8Array(t*4);return n.set(new Uint8Array(e,r,t*4)),new Float32Array(n.buffer)}function De(e,r,t){if(t===0)return new Uint16Array(0);if(r%2===0)return new Uint16Array(e,r,t);let n=new Uint8Array(t*2);return n.set(new Uint8Array(e,r,t*2)),new Uint16Array(n.buffer)}function fn(e,r,t){if(t===0)return new Uint32Array(0);if(r%4===0)return new Uint32Array(e,r,t);let n=new Uint8Array(t*4);return n.set(new Uint8Array(e,r,t*4)),new Uint32Array(n.buffer)}function K(e){return e>>>1^-(e&1)}function En(e){let r=new Int16Array(e.length),t=0,n=0,a=0;for(let o=0;o<e.length;o+=3)t=t+K(e[o])<<16>>16,n=n+K(e[o+1])<<16>>16,a=a+K(e[o+2])<<16>>16,r[o]=t,r[o+1]=n,r[o+2]=a;return r}function hn(e){let r=new Uint16Array(e.length),t=0;for(let n=0;n<e.length;n++)t=t+K(e[n])&65535,r[n]=t;return r}function gn(e){let r=new Uint32Array(e.length),t=0;for(let n=0;n<e.length;n++)t=t+K(e[n])>>>0,r[n]=t;return r}function G(e,r){return new (0, _chunkLBRCTJ7Wcjs.d)(e,_chunkLBRCTJ7Wcjs.c.VALIDATION_ERROR,{context:r})}async function Le(e,r){let{debug:t=!1}=_nullishCoalesce(r, () => ({})),n=t?performance.now():0;try{let a=performance.now(),o=JSON.parse(e),i=performance.now()-a;return await yn(o,r,{parseTime:i,perfStart:n})}catch(a){return _chunkLBRCTJ7Wcjs.e.call(void 0, ).error("Error parsing mesh batch:",a),[]}}async function yn(e,r,t){let{mergeByMaterial:n=!0,applyTransforms:a=!0,debug:o=!1}=_nullishCoalesce(r, () => ({})),{parseTime:i=0,perfStart:l=o?performance.now():0}=_nullishCoalesce(t, () => ({}));try{let s=performance.now(),c=le(e.compressedData),d=performance.now()-s,u=o?vn(e.compressedData):0;return Pe(c,{mergeByMaterial:n,applyTransforms:a,debug:o,parseTime:i,decodeTime:d,perfStart:l,blobBytes:u,fallback:{materials:e.materials,groups:e.groups,sourceComponentId:e.sourceComponentId}})}catch(s){return _chunkLBRCTJ7Wcjs.e.call(void 0, ).error("Error parsing mesh batch object:",s),[]}}async function Or(e,r){let{mergeByMaterial:t=!0,applyTransforms:n=!0,debug:a=!1}=_nullishCoalesce(r, () => ({})),o=a?performance.now():0;try{let i=performance.now(),l=le(e),s=performance.now()-i,c=e.byteLength;return Pe(l,{mergeByMaterial:t,applyTransforms:n,debug:a,parseTime:0,decodeTime:s,perfStart:o,blobBytes:c})}catch(i){return _chunkLBRCTJ7Wcjs.e.call(void 0, ).error("Error parsing mesh batch blob:",i),[]}}function Pe(e,r){let{mergeByMaterial:t,applyTransforms:n,debug:a,parseTime:o,decodeTime:i,perfStart:l,blobBytes:s,fallback:c}=r,d=_nullishCoalesce(_nullishCoalesce(e.metadata.materials, () => (_optionalChain([c, 'optionalAccess', _229 => _229.materials]))), () => ([])),u=_nullishCoalesce(_nullishCoalesce(e.metadata.groups, () => (_optionalChain([c, 'optionalAccess', _230 => _230.groups]))), () => ([])),m=_nullishCoalesce(_optionalChain([c, 'optionalAccess', _231 => _231.sourceComponentId]), () => (e.metadata.sourceComponentId)),p=(e.flags&se)!==0,E=p?Rn(e.vertices,n):bn(e.vertices,e.origin,e.scale,n);if(a){let y=e.vertices.byteLength+e.indices.byteLength;_chunkLBRCTJ7Wcjs.e.call(void 0, ).debug("Mesh Batch Stats:"),_chunkLBRCTJ7Wcjs.e.call(void 0, ).debug(` Materials: ${d.length} | Groups: ${u.length}`),_chunkLBRCTJ7Wcjs.e.call(void 0, ).debug(` Vertices: ${e.vertices.length/3} | Indices: ${e.indices.length}`),_chunkLBRCTJ7Wcjs.e.call(void 0, ).debug(` Format: ${p?"float32":"int16 quantized"}`),_chunkLBRCTJ7Wcjs.e.call(void 0, ).debug(` Blob: ${(s/1024/1024).toFixed(2)} MB | Geometry on wire: ${(y/1024/1024).toFixed(2)} MB`)}let A=performance.now(),v=d.map(Tn),g=[];for(let y of u)if(t&&y.meshes.length>1){let H=wn(y,E,e.indices,v);H.userData.sourceComponentId=_nullishCoalesce(m, () => (null)),g.push(H)}else{let H=Hn(y,E,e.indices,v);for(let O of H)O.userData.sourceComponentId=_nullishCoalesce(m, () => (null));g.push(...H)}let R=performance.now()-A;if(a){let y=performance.now()-l;_chunkLBRCTJ7Wcjs.e.call(void 0, ).debug("Performance:"),o>0&&_chunkLBRCTJ7Wcjs.e.call(void 0, ).debug(` Parse JSON: ${o.toFixed(2)}ms`),_chunkLBRCTJ7Wcjs.e.call(void 0, ).debug(` Decode binary: ${i.toFixed(2)}ms`),_chunkLBRCTJ7Wcjs.e.call(void 0, ).debug(` Create Meshes: ${R.toFixed(2)}ms`),_chunkLBRCTJ7Wcjs.e.call(void 0, ).debug(` Total: ${y.toFixed(2)}ms`)}return Promise.resolve(g)}function bn(e,r,t,n){let a=new Float32Array(e.length),o=r[0],i=r[1],l=r[2],s=t[0],c=t[1],d=t[2];for(let u=0;u<e.length;u+=3)a[u]=o+(e[u]+32767)*s,a[u+1]=i+(e[u+1]+32767)*c,a[u+2]=l+(e[u+2]+32767)*d;return a}function Rn(e,r){return e}function Tn(e){let r=ue(e.color);return new U.MeshPhysicalMaterial({color:r,metalness:e.metalness,roughness:e.roughness,opacity:e.opacity,transparent:e.transparent,side:U.DoubleSide,polygonOffset:!0,polygonOffsetFactor:.5,polygonOffsetUnits:.5,depthWrite:!0,depthTest:!0})}function wn(e,r,t,n){let a=0,o=0;for(let E of e.meshes)a+=E.vertexCount,o+=E.indexCount;let i=new Float32Array(a*3),l=new Uint32Array(o),s=0,c=0;for(let E of e.meshes){let A=E.vertexStart*3,v=E.vertexCount*3;i.set(r.subarray(A,A+v),s*3);let g=t.subarray(E.indexStart,E.indexStart+E.indexCount),R=s-E.vertexStart;if(R===0)l.set(g,c);else for(let y=0;y<g.length;y++)l[c+y]=g[y]+R;s+=E.vertexCount,c+=E.indexCount}let d=new U.BufferGeometry;d.setAttribute("position",new U.BufferAttribute(i,3)),d.setIndex(new U.BufferAttribute(l,1)),d.computeVertexNormals();let u=new U.Mesh(d,n[e.materialId]),m=e.meshes[0],p=e.meshes.map(E=>E.name).filter(E=>E&&E.length>0);return u.name=p.length>0?p[0]:`merged_material_${e.materialId}`,u.castShadow=!0,u.receiveShadow=!0,u.userData={source:"compute",name:u.name,layer:_nullishCoalesce(_optionalChain([m, 'optionalAccess', _232 => _232.layer]), () => ("")),originalIndex:_nullishCoalesce(_optionalChain([m, 'optionalAccess', _233 => _233.originalIndex]), () => (0)),metadata:_nullishCoalesce(_optionalChain([m, 'optionalAccess', _234 => _234.metadata]), () => ({})),mergedFrom:e.meshes.slice(1).map(E=>({name:E.name,layer:E.layer,originalIndex:E.originalIndex}))},u}function Hn(e,r,t,n){let a=[];for(let o of e.meshes){let i=o.vertexStart*3,l=o.vertexCount*3,s=r.slice(i,i+l),c=t.subarray(o.indexStart,o.indexStart+o.indexCount),d=new Uint32Array(c.length),u=o.vertexStart;for(let E=0;E<c.length;E++)d[E]=c[E]-u;let m=new U.BufferGeometry;m.setAttribute("position",new U.BufferAttribute(s,3)),m.setIndex(new U.BufferAttribute(d,1)),m.computeVertexNormals();let p=new U.Mesh(m,n[e.materialId]);p.name=o.name,p.userData={source:"compute",name:o.name,layer:_nullishCoalesce(o.layer, () => ("")),originalIndex:o.originalIndex,metadata:_nullishCoalesce(o.metadata, () => ({}))},p.castShadow=!0,p.receiveShadow=!0,a.push(p)}return a}function vn(e){return Math.floor(e.length*3/4)}var Mn={Millimeters:1/1e3,Centimeters:1/100,Meters:1,Inches:1/39.37,Feet:1/3.28084},xn="Display";async function Ur(e,r){let t=performance.now(),n=[],{allowScaling:a=!0,allowAutoPosition:o=!0,rhino:i,debug:l=!1,parsing:s={}}=_nullishCoalesce(r, () => ({}));try{let c=a?Cn(e.modelunits):1;return await An(e,n,c,s,i,l),o&&Pn(n),n}catch(c){throw On(c,n),c}finally{l&&Vn(t)}}function Cn(e){return _nullishCoalesce(Mn[e], () => (1))}async function An(e,r,t,n,a,o){for(let i of e.values){let l=i.InnerTree;for(let s in l){let c=l[s];c&&await Sn(c,r,t,n,a,o)}}}async function Sn(e,r,t,n,a,o){for(let i of e){if(!i.type.includes(xn))continue;let l={mergeByMaterial:!0,applyTransforms:!0,debug:!1,...n},s=await Le(i.data,l),c=He(Dn(i.data),{rhino:a,applyTransforms:l.applyTransforms}),d=[...s,...c];if(t!==1)for(let u of d)u.scale.set(t,t,t);r.push(...d),o&&_chunkLBRCTJ7Wcjs.e.call(void 0, ).debug(`Extracted ${s.length} meshes and ${c.length} items from batch`)}}function Dn(e){return_optionalChain([(typeof e=="string"?Ln(e):e), 'optionalAccess', _235 => _235.items])}function Ln(e){try{return JSON.parse(e)}catch (e4){return}}function Pn(e){if(e.length===0)return;let r=J(e);de(e,r.min.z,"z")}function On(e,r){_chunkLBRCTJ7Wcjs.e.call(void 0, ).error("An unexpected error occurred:",e),In(r)}function In(e){for(let r of e){let t=r;t.geometry&&t.geometry.dispose(),t.material&&(Array.isArray(t.material)?t.material.forEach(n=>n.dispose()):t.material.dispose())}}function Vn(e){let r=performance.now()-e;_chunkLBRCTJ7Wcjs.e.call(void 0, ).info("Time to process meshes:",`${r.toFixed(2)}ms`)}exports.a = zn; exports.b = ue; exports.c = de; exports.d = J; exports.e = me; exports.f = pe; exports.g = fe; exports.h = ee; exports.i = he; exports.j = et; exports.k = Xn; exports.l = ge; exports.m = be; exports.n = Et; exports.o = Te; exports.p = gr; exports.q = jt; exports.r = He; exports.s = Me; exports.t = xe; exports.u = se; exports.v = ln; exports.w = le; exports.x = Le; exports.y = yn; exports.z = Or; exports.A = Mn; exports.B = Ur;
55
- //# sourceMappingURL=chunk-MBCMFI2R.cjs.map
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkMBCMFI2Rcjs = require('./chunk-MBCMFI2R.cjs');require('./chunk-LBRCTJ7W.cjs');exports.BINARY_MESH_MAGIC = _chunkMBCMFI2Rcjs.s; exports.BINARY_MESH_VERSION = _chunkMBCMFI2Rcjs.t; exports.EDGE_USERDATA_KIND = _chunkMBCMFI2Rcjs.h; exports.FLAG_DELTA_ENCODED = _chunkMBCMFI2Rcjs.v; exports.FLAG_FLOAT32 = _chunkMBCMFI2Rcjs.u; exports.Materials = _chunkMBCMFI2Rcjs.q; exports.SCALE_FACTORS = _chunkMBCMFI2Rcjs.A; exports.addEdges = _chunkMBCMFI2Rcjs.i; exports.applyOffset = _chunkMBCMFI2Rcjs.c; exports.computeCombinedBoundingBox = _chunkMBCMFI2Rcjs.d; exports.createCameraController = _chunkMBCMFI2Rcjs.e; exports.createGrid = _chunkMBCMFI2Rcjs.f; exports.createLabelLayer = _chunkMBCMFI2Rcjs.m; exports.createMeasureTool = _chunkMBCMFI2Rcjs.o; exports.createRenderPipeline = _chunkMBCMFI2Rcjs.l; exports.createViewGizmo = _chunkMBCMFI2Rcjs.g; exports.getThreeMeshesFromComputeResponse = _chunkMBCMFI2Rcjs.B; exports.initThree = _chunkMBCMFI2Rcjs.p; exports.isEdgeOverlay = _chunkMBCMFI2Rcjs.j; exports.parseBinaryMeshBatch = _chunkMBCMFI2Rcjs.w; exports.parseColor = _chunkMBCMFI2Rcjs.b; exports.parseDisplayItems = _chunkMBCMFI2Rcjs.r; exports.parseMeshBatch = _chunkMBCMFI2Rcjs.x; exports.parseMeshBatchBlob = _chunkMBCMFI2Rcjs.z; exports.parseMeshBatchObject = _chunkMBCMFI2Rcjs.y; exports.removeEdges = _chunkMBCMFI2Rcjs.k; exports.snapToVertex = _chunkMBCMFI2Rcjs.n; exports.updateScene = _chunkMBCMFI2Rcjs.a;
2
- //# sourceMappingURL=visualization-LTWBUHLN.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/home/runner/work/selva-compute/selva-compute/dist/visualization-LTWBUHLN.cjs"],"names":[],"mappings":"AAAA,iIAAqO,gCAA6B,szCAAumB","file":"/home/runner/work/selva-compute/selva-compute/dist/visualization-LTWBUHLN.cjs"}
@@ -1,2 +0,0 @@
1
- import{A as b,B as u,a as e,b as r,c as o,d as t,e as a,f as s,g as i,h as p,i as n,j as m,k as l,l as f,m as y,n as d,o as h,p as x,q as C,r as g,s as M,t as c,u as E,v as B,w as j,x as D,y as O,z as G}from"./chunk-G3SQHFDY.js";import"./chunk-FMMK2QTR.js";export{M as BINARY_MESH_MAGIC,c as BINARY_MESH_VERSION,p as EDGE_USERDATA_KIND,B as FLAG_DELTA_ENCODED,E as FLAG_FLOAT32,C as Materials,b as SCALE_FACTORS,n as addEdges,o as applyOffset,t as computeCombinedBoundingBox,a as createCameraController,s as createGrid,y as createLabelLayer,h as createMeasureTool,f as createRenderPipeline,i as createViewGizmo,u as getThreeMeshesFromComputeResponse,x as initThree,m as isEdgeOverlay,j as parseBinaryMeshBatch,r as parseColor,g as parseDisplayItems,D as parseMeshBatch,G as parseMeshBatchBlob,O as parseMeshBatchObject,l as removeEdges,d as snapToVertex,e as updateScene};
2
- //# sourceMappingURL=visualization-SU3XQ35P.js.map