1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9716],{15358:(e,t,r)=>{r.d(t,{A:()=>a});let a=(0,r(9547).A)("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]])},48842:(e,t,r)=>{r.d(t,{A:()=>a});let a=(0,r(9547).A)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])},59716:(e,t,r)=>{r.r(t),r.d(t,{default:()=>eU});var a=r(40986),n=r(34482),i=r(86652),o=r(48842),l=r(88843),s=r(93197),c=r(69394),d=r(15358),u=r(78880),h=r(41565),m=r(17971),p=r(32309),f=r(67038),w=r(91351),x=r(21760),g=r(48919),b=r(51526),v=r(39799),y=r(47196),M=r(10824),k=r(76685),j=r(86215);let S=({text:e,speed:t=50,initialDelay:r=0,waitTime:i=2e3,deleteSpeed:o=30,loop:l=!0,className:s,showCursor:c=!0,hideCursorOnType:d=!1,cursorChar:u="|",cursorClassName:h="ml-1",cursorAnimationVariants:m={initial:{opacity:0},animate:{opacity:1,transition:{duration:.01,repeat:1/0,repeatDelay:.4,repeatType:"reverse"}}}})=>{let p=(0,n.useMemo)(()=>Array.isArray(e)?e:[e],[e]),[f,w]=(0,n.useState)(""),[x,g]=(0,n.useState)(0),[b,v]=(0,n.useState)(!1),[y,M]=(0,n.useState)(0);return(0,n.useEffect)(()=>{let e,a=p[y]??"",n=()=>{if(b){if(""===f){if(v(!1),y===p.length-1&&!l)return;M(e=>(e+1)%p.length),g(0)}else e=setTimeout(()=>{w(e=>e.slice(0,-1))},o);return}x<a.length?e=setTimeout(()=>{w(e=>e+a[x]),g(e=>e+1)},t):p.length>1&&(e=setTimeout(()=>{v(!0)},i))};return 0!==x||b||""!==f?n():e=setTimeout(n,r),()=>{e&&clearTimeout(e)}},[x,y,o,f,r,b,l,t,p,i]),(0,a.jsxs)("div",{className:(0,j.cn)("inline whitespace-pre-wrap tracking-tight",s),children:[(0,a.jsx)("span",{children:f}),c?(0,a.jsx)(k.P.span,{variants:m,className:(0,j.cn)(h,d&&(x<(p[y]?.length??0)||b)?"hidden":""),initial:"initial",animate:"animate",children:u}):null]})};var C=r(46788);let P=.46*Math.PI,R={"2k":2560,"4k":3840,"8k":7680},E={position:"top-center",duration:2400};function z(){return window.matchMedia("(max-width: 767px)").matches?E:void 0}let L={"360p":{id:"360p",width:640,height:360,fps:12,durationMs:3200},"540p":{id:"540p",width:960,height:540,fps:18,durationMs:4200},"720p":{id:"720p",width:1280,height:720,fps:24,durationMs:5200},"1080p":{id:"1080p",width:1920,height:1080,fps:24,durationMs:6200},"2k":{id:"2k",width:2048,height:1152,fps:24,durationMs:6200}},N=["360p","540p","720p","1080p","2k"],I={active:!1,x:0,y:0};function D(e,t,r){return Math.min(r,Math.max(t,e))}function T(e){return Math.round(1e3*("number"==typeof e&&Number.isFinite(e)?e:0))/1e3}function H(){return 1500+1500*Math.random()}function A(e){return D(e,-P,P)}function _(e){e.keys.forward=!1,e.keys.backward=!1,e.keys.left=!1,e.keys.right=!1,e.touchMove.set(0,0),e.touchLook.set(0,0),e.lastFrameMs=null}function F(e,t,r){var a,n;let i,o,l,s,c,d,u,h,m;r.initialized||(i=eb(t),o=.01*(0,v.RB)(t.viewerHeightCm),l=i.subjects.map(e=>e.dimensions.heightM).filter(e=>e<=Math.max(8,5*o)),c=D(Math.max(4.2,2.6*(s=Math.max(o,...l.length?l:[Math.min(i.maxHeightM,8)])),Math.min(.34*i.width,18)),4.2,28),d=D(Math.max(.9,Math.min(.88*s,o+Math.max(.8,.32*s))),.5,Math.max(2.4,Math.min(i.maxHeightM,s+2.2))),u=new p.Pq0(i.center,d,0),r.position.set(i.center,o,c),h=u.sub(r.position).normalize(),r.yaw=Math.atan2(h.x,-h.z),r.pitch=A(Math.asin(D(h.y,-1,1))),r.initialized=!0,r.lastFrameMs=null);let f=performance.now(),w=null===r.lastFrameMs?0:Math.min(.05,(f-r.lastFrameMs)/1e3);if(r.lastFrameMs=f,w>0){r.touchLook.length()>.02&&(r.yaw+=1.5*r.touchLook.x*w,r.pitch=A(r.pitch+1.5*r.touchLook.y*.72*w));let e=!!r.keys.forward-!!r.keys.backward+r.touchMove.y,a=!!r.keys.right-!!r.keys.left+r.touchMove.x,n=Math.hypot(e,a);if(n>.01){let i=e/Math.max(1,n),o=a/Math.max(1,n),l=new p.Pq0(Math.sin(r.yaw),0,-Math.cos(r.yaw)),s=new p.Pq0(Math.cos(r.yaw),0,Math.sin(r.yaw)),c=(0,v.Zc)(t.walkSpeedMps,v.fp)*w;r.position.addScaledVector(l,i*c),r.position.addScaledVector(s,o*c)}}r.position.y=.01*(0,v.RB)(t.viewerHeightCm),e.position.copy(r.position),e.lookAt(r.position.clone().add((a=r.yaw,m=Math.cos(n=r.pitch),new p.Pq0(Math.sin(a)*m,Math.sin(n),-Math.cos(a)*m))))}async function O(e){if(!("caches"in window))return{url:e};try{let t=new URL(e,window.location.href),r=t.toString(),a=t.origin===window.location.origin,n=await window.caches.open("howheight-3d-models-v20260522"),i=await n.match(r);if(!i){if(!(i=await fetch(r,{cache:"no-store",credentials:a?"same-origin":"omit",mode:a?"same-origin":"cors"})).ok)throw Error(`Model request failed with ${i.status}`);try{await n.put(r,i.clone())}catch{}}let o=URL.createObjectURL(await i.blob());return{url:o,revoke:()=>URL.revokeObjectURL(o)}}catch{return{url:e,preloadFailed:!0}}}function $(e,t,r){let a=t.trim().replace(/\s+/g," ")||"-",n=r.fontSize,i=()=>{e.font=`${r.weight} ${n}px Inter, system-ui, sans-serif`};for(i();n>r.minFontSize&&e.measureText(a).width>r.maxWidth;)n-=1,i();let o=a;for(;o.length>4&&e.measureText(o).width>r.maxWidth;)o=`${o.slice(0,-4).trimEnd()}...`;e.fillStyle=r.color,r.strokeColor&&r.strokeWidth&&(e.lineJoin="round",e.lineWidth=r.strokeWidth,e.strokeStyle=r.strokeColor,e.strokeText(o,r.x,r.y)),e.fillText(o,r.x,r.y)}function W(e){return e instanceof DOMException&&"AbortError"===e.name}function U(e){return"u">typeof DOMException?new DOMException(e,"AbortError"):Error(e)}function q(){if("u"<typeof navigator)return{isTouchDevice:!1,requiresInlineSavePreview:!1};let e=(window.matchMedia?.("(pointer: coarse)")?.matches??!1)||navigator.maxTouchPoints>0,t=navigator.userAgent,r=e&&(/iPad|iPhone|iPod/.test(t)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1),a=/MicroMessenger/i.test(t);return{isTouchDevice:e,requiresInlineSavePreview:e&&(r||a)}}function Y(){return(window.matchMedia?.("(pointer: coarse)")?.matches??!1)||navigator.maxTouchPoints>0}async function B(e,t,r){let a=null;
1try{return await Promise.race([e,new Promise((e,n)=>{a=window.setTimeout(()=>n(Error(r)),t)})])}finally{null!==a&&window.clearTimeout(a)}}function V(e){return new Promise((t,r)=>{let a=new FileReader;a.onload=()=>{"string"==typeof a.result?t(a.result):r(Error("Preview unavailable."))},a.onerror=()=>r(a.error??Error("Preview unavailable.")),a.readAsDataURL(e)})}async function X(e,t){let r=new AbortController,a=window.setTimeout(()=>r.abort(),25e3);try{let a=await fetch("/api/height-assets/video-exports",{method:"POST",cache:"no-store",headers:{"content-type":e.type||"video/mp4","x-height-export-filename":encodeURIComponent(t)},body:e,signal:r.signal}),n=await a.json().catch(()=>null);if(!a.ok||!n?.url)throw Error("Hosted video export failed.");let i=new URL(n.url);if("https:"!==i.protocol&&"http:"!==i.protocol)throw Error("Hosted video export returned an invalid URL.");return{src:i.toString(),downloadSrc:function(e){if(!e.key)return;let t=new URLSearchParams({key:e.key,filename:e.filename||e.fallbackFilename});return`/api/height-assets/video-exports/download?${t.toString()}`}({key:n.key,filename:n.filename,fallbackFilename:t})}}finally{window.clearTimeout(a)}}async function Z(e,t,r,a){return"image"===r?{src:await V(e),filename:t,kind:r,revokeObjectUrl:!1,blob:e,mimeType:e.type||"image/png"}:a?{src:a.src,filename:t,kind:r,revokeObjectUrl:!1,isHosted:!0,downloadSrc:a.downloadSrc,blob:e,mimeType:e.type||"video/mp4"}:q().requiresInlineSavePreview?{src:await V(e),filename:t,kind:r,revokeObjectUrl:!1,blob:e,mimeType:e.type||"video/mp4"}:{src:URL.createObjectURL(e),filename:t,kind:r,revokeObjectUrl:!0,blob:e,mimeType:e.type||"video/mp4"}}async function J(e){let t,{blob:r,filename:a,kind:n,messages:i,showPreview:o}=e,{isTouchDevice:l,requiresInlineSavePreview:s}=q(),c=r.type||("video"===n?"video/webm":"image/png"),d=s||l&&"video"===n;if(l&&!d&&"function"==typeof navigator.share&&"u">typeof File)try{let e=new File([r],a,{type:c}),t={title:i.metadata.title,text:i.scene.exportShareText,files:[e]};if("function"==typeof navigator.canShare&&!navigator.canShare({files:[e]}))throw Error("Native file share unavailable.");return await B(navigator.share(t),12e3,"Native share did not finish."),"shared"}catch(e){if(W(e))return"aborted"}if(d)return o(await Z(r,a,n)),"preview";let u=URL.createObjectURL(r);return(t=document.createElement("a")).href=u,t.download=a,t.rel="noopener noreferrer",t.style.position="fixed",t.style.left="-9999px",t.style.top="-9999px",t.style.width="1px",t.style.height="1px",t.style.opacity="0",t.setAttribute("aria-hidden","true"),document.body.appendChild(t),t.click(),t.remove(),window.setTimeout(()=>URL.revokeObjectURL(u),l?12e4:1e3),"downloaded"}async function G(e,t){if(!e.blob||"function"!=typeof navigator.share||"u"<typeof File)return!1;let r=new File([e.blob],e.filename,{type:e.mimeType||e.blob.type||("video"===e.kind?"video/mp4":"image/png")}),a={title:t.metadata.title,text:t.scene.exportShareText,files:[r]};return("function"!=typeof navigator.canShare||!!navigator.canShare({files:[r]}))&&(await B(navigator.share(a),12e3,"Native share did not finish."),!0)}function K(e){return"auto"===e||"2k"===e||"4k"===e||"8k"===e||"custom"===e}function Q(e){let t="number"==typeof e?e:Number(e);return Number.isFinite(t)?Math.max(1024,256*Math.ceil(t/256)):8192}function ee(e,t,r,a){let n=a.scene.watermark,i=Math.max(24,Math.round(.035*Math.min(t,r))),o=Math.max(20,Math.round(.014*t));e.save(),e.setTransform(1,0,0,1,0,0),e.textAlign="right",e.textBaseline="top",e.font=`700 ${o}px Inter, system-ui, sans-serif`,e.shadowColor="rgba(0, 0, 0, 0.85)",e.shadowBlur=Math.max(8,Math.round(.35*o)),e.shadowOffsetX=0,e.shadowOffsetY=Math.max(2,Math.round(.08*o)),e.fillStyle="rgba(224, 242, 254, 0.96)",e.fillText(n,t-i,i),e.restore()}async function et(e,t,r){let a=e.getContext("2d");if(!a)throw Error("PNG canvas is not supported.");return ee(a,e.width,e.height,t),new Promise((t,a)=>{e.toBlob(e=>{e?t(e):a(Error(r))},"image/png")})}async function er(e,t,r,a){let n=a.getContext("2d");if(!n)throw Error("Screenshot canvas is not supported.");let i=a.width,o=a.height,l=Math.max(512,Math.min(2048,e.capabilities.maxTextureSize||2048));if(!(i*o>14e6||i>l||o>l)){e.setSize(i,o,!1),e.render(t,r),n.drawImage(e.domElement,0,0,i,o);return}for(let a=0;a<o;a+=l){let s=Math.min(l,o-a);for(let c=0;c<i;c+=l){let d=Math.min(l,i-c);e.setSize(d,s,!1),r.setViewOffset(i,o,c,a,d,s),r.updateProjectionMatrix(),e.render(t,r),n.drawImage(e.domElement,c,a,d,s)}await new Promise(e=>{window.setTimeout(e,16)})}r.clearViewOffset(),r.updateProjectionMatrix()}async function ea(e,t,r,a,n,i,o){var l;let s,c,d,u,h,m,w,x="walk"===e.view?{...e,view:"front"}
1:e,g=eT(x,t,r,a),b=(l=g.contentBounds,u="custom"===(d="auto"===(s=K(n?.qualityId)?n.qualityId:"auto")?(c=eb(x),x.subjects.length>=7||c.width>=16||c.maxHeightM>=12?"4k":"2k"):s)?Q(n?.customLongEdge):R[d],m=(h=function(e,t,r){if("front"===e.view||"side"===e.view){let t=eA(eH(e,"export"),r),a=t.width/Math.max(t.verticalSpan,1),n=t.layout.maxHeightM>=24;return D(a,e.subjects.length<=1?.48:n?.42:.72,e.subjects.length>=8?3:2.45)}return D(Number.isFinite(t)&&t>0?t:16/9,1,4)}(x,i,l))>=1?u:Math.max(1,Math.round(u*h)),{width:m+m%2,height:(w=h>=1?Math.max(1,Math.round(u/h)):u)+w%2}),v=document.createElement("canvas");v.width=b.width,v.height=b.height;let y=document.createElement("canvas"),{scene:M,layout:k}=g,j=new f.WebGLRenderer({canvas:y,antialias:!0,alpha:!1,powerPreference:"high-performance",preserveDrawingBuffer:!0}),S="side"===x.view||"front"===x.view?new p.qUd:new p.ubm(42,b.width/Math.max(b.height,1),.02,ej(k,Math.max(2.9,k.width)));try{return j.setPixelRatio(1),j.outputColorSpace=p.er$,!function(e,t,r,a,n,i){let o=r/Math.max(a,1),l=eA(eH(t,"export"),i);if(e instanceof p.qUd){let r=Math.max(l.verticalSpan,l.width/o,2.6),a=eR(t,l.centerHorizontal,l.centerY);e.left=-r*o/2,e.right=r*o/2,e.top=r/2,e.bottom=-r/2,e.near=.01,e.far=140,"side"===t.view?e.position.set(Math.max(4.1,.45*l.width),a.y,a.z):e.position.set(a.x,a.y,Math.max(4.2,.45*l.width)),e.lookAt(a),e.updateProjectionMatrix();return}eD(e,t,r,a,n,null,!0)}(S,x,b.width,b.height,o,g.contentBounds),await er(j,M,S,v),await et(v,a,"Screenshot export failed.")}finally{j.dispose(),eo(M)}}async function en(e,t){let r=e.width,a=e.height;if(!r||!a)throw Error("Export canvas is not ready.");let n=document.createElement("canvas");n.width=r,n.height=a;let i=n.getContext("2d");if(!i)throw Error("PNG canvas is not supported.");return i.drawImage(e,0,0,r,a),et(n,t,"PNG export failed.")}function ei(e,t="#7dd3fc",r={}){let a=new p.LoY().setFromPoints(e),n=r.dashed?new p.Fvt({color:t,transparent:!0,opacity:r.opacity??.85,depthTest:r.depthTest??!0,dashSize:r.dashSize??.08,gapSize:r.gapSize??.06}):new p.mrM({color:t,transparent:!0,opacity:r.opacity??.85,depthTest:r.depthTest??!0}),i=new p.N1A(a,n);return r.dashed&&i.computeLineDistances(),!1===r.depthTest&&(i.renderOrder=30),i}function eo(e){e.traverse(e=>{if(e instanceof p.eaF){e.geometry.dispose();let t=e.material;Array.isArray(t)?t.forEach(e=>e.dispose()):t.dispose()}(e instanceof p.N1A||e instanceof p.DXC)&&(e.geometry.dispose(),Array.isArray(e.material)?e.material.forEach(e=>e.dispose()):e.material.dispose()),e instanceof p.kxk&&(e.material.map?.dispose(),e.material.dispose())})}function el(e){let t=e.userData.howHeightBaseline;if(t){e.position.copy(t.position),e.scale.copy(t.scale);return}e.userData.howHeightBaseline={position:e.position.clone(),scale:e.scale.clone()}}function es(e,t){if(e instanceof p.$Kf&&e.name===t)return e;for(let r of e.children){let e=es(r,t);if(e)return e}return null}function ec(e,t,r){t.forEach(t=>{let a=es(e,t);a&&(el(a),a.scale.y*=r)})}function ed(e,t,r){t.forEach(t=>{let a=es(e,t);a&&(el(a),a.scale.multiplyScalar(r))})}function eu(e,t,r){if("fit-height"===t.heightMode){e.scale.setScalar(1),e.position.y=0,e.updateMatrixWorld(!0);let a=new p.NRn().setFromObject(e),n=a.max.y-a.min.y,i=.01*r/(Number.isFinite(n)&&n>0?n:.01*t.baseHeightCm);e.scale.setScalar(i),e.userData.groundOffsetM=-a.min.y*i,e.userData.heightCm=r;return}if("morph-human"===t.heightMode){let t;return void(t=function(e){let t=v.xd[0],r=v.xd[v.xd.length-1],a=Math.min(r,Math.max(t,e)),n=t,i=r;for(let e=0;e<v.xd.length-1;e+=1){let t=v.xd[e],r=v.xd[e+1];if(a>=t&&a<=r){n=t,i=r;break}}if(n===i)return new Map([[`height_cm_${n}`,1]]);let o=(a-n)/(i-n);return new Map([[`height_cm_${n}`,1-o],[`height_cm_${i}`,o]])}(r),e.scale.setScalar(1),e.userData.groundOffsetM=0,e.traverse(e=>{if(e instanceof p.eaF&&e.morphTargetInfluences&&e.morphTargetDictionary)for(let[r,a]of(e.morphTargetInfluences.fill(0),t)){let t=e.morphTargetDictionary[r];void 0!==t&&(e.morphTargetInfluences[t]=a)}}),e.userData.heightCm=r)}if("scaled-human"===t.heightMode){let a,n,i,o,l,s;return void(e.scale.setScalar(1),e.position.y=0,e.userData.groundOffsetM=0,function(e,t,r){var a;
1let n,i,o=(n=D(((a=t.defaultHeightCm)-r)/Math.max(a-80,1),0,1),{upperLeg:1+.14*(i=D((r-a)/Math.max(300-a,1),0,1))-.09*n,lowerLeg:1+.18*i-.12*n,torso:1+.045*i-.04*n,neck:1+.025*i-.02*n,head:1-.055*i+.11*n,upperArm:1+.075*i-.055*n,foreArm:1+.1*i-.065*n,hand:1+.025*i-.015*n,foot:1+.035*i-.02*n});e.traverse(e=>{e instanceof p.$Kf&&el(e)}),ec(e,["LeftUpLeg","RightUpLeg"],o.upperLeg),ec(e,["LeftLeg","RightLeg"],o.lowerLeg),ec(e,["Spine","Spine1","Spine2"],o.torso),ec(e,["Neck"],o.neck),ec(e,["LeftArm","RightArm"],o.upperArm),ec(e,["LeftForeArm","RightForeArm"],o.foreArm),ed(e,["Head"],o.head),ed(e,["LeftHand","RightHand"],o.hand),ed(e,["LeftFoot","RightFoot","LeftToeBase","RightToeBase"],o.foot)}(e,t,r),a=new p.NRn,n=new p.Pq0,i=!1,e.updateMatrixWorld(!0),e.traverse(e=>{if(!(e instanceof p.I46))return;let t=e.geometry.attributes.position;if(t){i=!0,e.skeleton.update();for(let r=0;r<t.count;r+=1)n.fromBufferAttribute(t,r),e.applyBoneTransform(r,n),n.applyMatrix4(e.matrixWorld),a.expandByPoint(n)}}),s=.01*r/(Number.isFinite(l=(o=i&&!a.isEmpty()?a:null)?o.max.y-o.min.y:.01*t.baseHeightCm)&&l>0?l:.01*t.baseHeightCm),e.scale.setScalar(s),e.userData.groundOffsetM=o?-o.min.y*s:0,e.userData.heightCm=r)}let a=r/t.baseHeightCm;if(t.defaultAxisSizeM){e.scale.setScalar(1),e.updateMatrixWorld(!0);let n=new p.NRn().setFromObject(e),i=new p.Pq0;n.getSize(i);let o=.01*r,l=r/t.defaultHeightCm,s=t.defaultAxisSizeM.x*l,c=t.defaultAxisSizeM.z*l;e.scale.set(i.x>0?s/i.x:a,i.y>0?o/i.y:a,i.z>0?c/i.z:a)}else e.scale.setScalar(a);e.userData.groundOffsetM=0,e.userData.heightCm=r}function eh(e){return!!e.bodyVisualizerParams}function em(e){return e.bodyVisualizerParams??null}function ep(e){let t=em(e);return t?[t.bodyType,t.unit,T(e.heightCm),T(t.weightKg),T(t.chestCm??0),T(t.waistCm??0),T(t.hipsCm??0),T(t.inseamCm??0),Number.isFinite(t.fitnessHours)?T(t.fitnessHours):"none",(0,y.W5)(t)].join(":"):"none"}function ef(e){if(e.bodyVisualizerParams){let t,r,a,n,i,o,l,s,c;return t=em(e),r=Math.max(e.heightCm,1),a=t?.chestCm??96,n=t?.waistCm??82,o=Math.max(a,n,i=t?.hipsCm??98),l=Math.max(n,.72*i,.68*a),s=D(.01*o*.39,.36,.86),c=D(.01*l*.24,.19,.52),{id:t?.bodyType==="male"?"adult-male":"adult-female",labelKey:t?.bodyType==="male"?"adultMale":"adultFemale",category:"people",modelUrl:"body-visualizer:mesh",heightMode:"fit-height",baseHeightCm:r,defaultHeightCm:r,footprintWidthM:s,footprintDepthM:c,minHeightCm:1,maxHeightCm:5e4}}return e.customModel?function(e){let t=e.customModel?.modelUrl;if(!t)return(0,v.dm)(e.assetId);let r=Math.max(.55,.42*Math.max(.01*e.heightCm,.01));return{id:e.assetId,labelKey:"adultMale",category:"objects",modelUrl:t,heightMode:"fit-height",baseHeightCm:Math.max(e.heightCm,1),defaultHeightCm:Math.max(e.heightCm,1),footprintWidthM:r,footprintDepthM:r,minHeightCm:1,maxHeightCm:5e4}}(e):(0,v.dm)(e.assetId)}function ew(e){return e.bodyVisualizerParams?`body-visualizer:${e.bodyVisualizerParams.bodyType}`:e.customModel?.modelUrl??e.assetId}function ex(e){let t=new Set;return e.subjects.filter(e=>!eh(e)).map(e=>{let r=ew(e);return t.has(r)?null:(t.add(r),{key:r,url:ef(e).modelUrl})}).filter(Boolean)}function eg(e){return e.subjects.some(eh)}function eb(e){let t=e.subjects.map(t=>{let r=ef(t),a=function(e,t){let r=.01*t;if(void 0!==e.defaultFootprintWidthM&&void 0!==e.defaultFootprintDepthM){let a=t/e.defaultHeightCm;return{heightM:r,widthM:e.defaultFootprintWidthM*a,depthM:e.defaultFootprintDepthM*a}}let a=t/e.baseHeightCm;return{heightM:r,widthM:e.footprintWidthM*a,depthM:e.footprintDepthM*a}}(r,t.heightCm),n="animals"===r.category||"prehistoric"===r.category,i="side"!==e.view||n?a.widthM:a.depthM;return{subject:t,asset:r,dimensions:a,axisWidth:i}}),r=Math.max(...t.map(e=>e.dimensions.heightM),null===e.referenceLineCm?0:.01*e.referenceLineCm,1.85),a=Math.max(.7,Math.min(.12*Math.max(...t.map(e=>e.axisWidth),.6),2.2),r>=36?Math.min(.035*r,4.4):0),n=t.reduce((e,t)=>e+t.axisWidth,0)+Math.max(0,t.length-1)*a,i=-n/2,o=t.map(e=>{let t=i+e.axisWidth/2+e.subject.lateralOffsetM;return i+=e.axisWidth+a,{...e,horizontal:t}}),l=Math.min(...o.map(e=>e.horizontal-e.axisWidth/2),-n/2),s=Math.max(...o.map(e=>e.horizontal+e.axisWidth/2),n/2);return{subjects:o,left:l,right:s,center:(l+s)/2,width:Math.max(s-l,n,2.4),maxHeightM:r}}function ev(e){let t=e.maxHeightM>=36,r=Math.max(1.35,Math.min(t?Math.min(22,Math.max(8.2,.23*e.maxHeightM)):9.6,Math.max(e.maxHeightM*(t?.2:.62),.092*e.width))),a=132/460*r,n=Math.max(.62*a,Math.min(1.4,.07*e.maxHeightM)),i=Math.max(1.2,.16*e.maxHeightM,n+1.2*a);return{usesTallSceneLabels:t,subjectLabelWidthM:r,subjectLabelHeightM:a,labelLiftM:n,labelGapM:.08*a,laneStepM:.82*a,labelHeadroomM:i}}function ey(e,t,r,a){if(!(r&&e.dimensions.heightM>=.65*t.maxHeightM))return e.horizontal;let n=e.horizontal<t.center?-1:1,i=Math.max(.8,.12*a);return e.horizontal+n*i}function eM(e){let{usesTallSceneLabels:t,subjectLabelWidthM:r,subjectLabelHeightM:a,labelLiftM:n,labelGapM:i,laneStepM:o,labelHeadroomM:l}=ev(e),s=e.maxHeightM+l-Math.max(.16,Math.min(.18*a,.22*l))-a/2,c=a/2+.12,d=t?function(e){let t=e.subjects.filter(t=>t.dimensions.heightM>=.65*e.maxHeightM);if(!t.length)return null;let r=Math.min(...t.map(e=>e.horizontal-Math.max(e.axisWidth/2,.4))),a=Math.max(...t.map(e=>e.horizontal+Math.max(e.axisWidth/2,.4))),n=Math.max(.5,.018*e.width);return{center:(r+a)/2,left:r-n,right:a+n}}(e):null,u=t?[0,-.42,.42,-.84,.84,-1.22,1.22]:[0,-.32,.32,-.64,.64],h=t?9:6,m=new Map,p=[],f=(e,t)=>{let r=e.dimensions.heightM+n+t*o;return r<=s?r:Math.max(c,s-t*o)};return[...e.subjects].sort((e,t)=>
1e.horizontal-t.horizontal||t.dimensions.heightM-e.dimensions.heightM).forEach(n=>{let o=t&&n.dimensions.heightM>=.65*e.maxHeightM,l=ey(n,e,t,r),s=null,c=1/0;for(let t=0;t<h;t+=1){let h=f(n,t);if(u.forEach(u=>{let m=l+u*r,f={bottom:h-a/2,left:m-r/2,right:m+r/2,top:h+a/2},w=p.reduce((e,t)=>{var r,a;return e+(r=f,a={bottom:t.bottom-i,left:t.left-i,right:t.right+i,top:t.top+i},Math.max(0,Math.min(r.right,a.right)-Math.max(r.left,a.left))*Math.max(0,Math.min(r.top,a.top)-Math.max(r.bottom,a.bottom)))},0),x=d&&!o&&f.bottom<.72*e.maxHeightM&&f.left<d.right&&f.right>d.left,g=100*w+1.3*Math.abs(m-n.horizontal)+.42*t+.18*Math.abs(u)+6*!!x;g<c&&(c=g,s={box:f,horizontal:m,showPlate:o,y:h})}),s&&c<.001)break}if(!s){let e=f(n,0);s={box:{bottom:e-a/2,left:l-r/2,right:l+r/2,top:e+a/2},horizontal:l,showPlate:o,y:e}}m.set(n.subject.slotId,s),p.push(s.box)}),m}function ek(e,t){let r=Math.max(96,t.width+24),a=Math.max(72,4*t.maxHeightM,.48*r),n="walk"===e.view?Math.max(5e3,r,a):null;return"side"===e.view?{widthM:n??a,depthM:n??r,centerX:0,centerZ:t.center}:{widthM:n??r,depthM:n??a,centerX:t.center,centerZ:0}}function ej(e,t){return Math.max(220,3.2*e.maxHeightM,3.5*t)}function eS(e,t){let r=eb(e).subjects.find(e=>e.subject.slotId===t),a=r?.horizontal??0;return"side"===e.view?{x:0,z:a}:{x:a,z:0}}function eC(e,t,r){let a,n=ef(r),i="side"===t.view?n.sideRotationY??n.frontRotationY??0:n.frontRotationY??0;a=eS(t,r.slotId),e.position.set(a.x,e.userData.groundOffsetM??0,a.z),e.userData.view=t.view,e.rotation.y=i+r.rotationYDeg*Math.PI/180+(r.flipped?Math.PI:0),e.userData.lateralOffsetM=r.lateralOffsetM,e.userData.rotationYDeg=r.rotationYDeg,e.userData.flipped=r.flipped}function eP(e,t,r,a,n,i){let o=t.getBoundingClientRect();if(i.x=(e.clientX-o.left)/Math.max(o.width,1)*2-1,i.y=-((e.clientY-o.top)/Math.max(o.height,1)*2-1),r instanceof p.qUd){let e=new p.Pq0(i.x,i.y,0).unproject(r);return"side"===a.view?e.z:e.x}let l=function(e,t,r,a,n){let i=t.getBoundingClientRect();n.x=(e.clientX-i.left)/Math.max(i.width,1)*2-1,n.y=-((e.clientY-i.top)/Math.max(i.height,1)*2-1),a.setFromCamera(n,r);let o=a.ray.direction.y;if(1e-4>Math.abs(o))return null;let l=-a.ray.origin.y/o;return!Number.isFinite(l)||l<0?null:a.ray.origin.clone().add(a.ray.direction.clone().multiplyScalar(l))}(e,t,r,n,i);return l?"side"===a.view?l.z:l.x:null}function eR(e,t,r){return"side"===e.view?new p.Pq0(0,r,t):new p.Pq0(t,r,0)}function eE(e,t,r,a=.04){return"side"===e?new p.Pq0(a,r,t):new p.Pq0(t,r,a)}function ez(e,t,r,a=!1){var n;let i,o,l,s,c=em(t),d=e.userData.bodyVisualizerMeshState,u=e.userData.bodyVisualizerMaterial;if(!c||!d||!u)return;let h=ep(t),m=a||e.userData.bodyVisualizerParamsSignature!==h;m&&((0,y.WY)(d,u,{...c,heightCm:t.heightCm},null,{immediate:!0}),e.userData.bodyVisualizerParamsSignature=h),(m||e.userData.heightCm!==t.heightCm)&&(n=t.heightCm,e.position.set(0,0,0),e.rotation.set(0,0,0),e.scale.setScalar(1),e.updateMatrixWorld(!0),l=Number.isFinite(o=(i=new p.NRn().setFromObject(e)).max.y-i.min.y)&&o>0?o:Math.max(.01*n,.01),s=.01*n/l,e.scale.setScalar(s),e.userData.groundOffsetM=-i.min.y*s,e.userData.heightCm=n),e.userData.assetId=ef(t).id,e.userData.slotId=t.slotId,eC(e,r,t)}function eL(e,t,r,a){let n,i,o;if(eh(e))return a?function(e,t,r){let a=em(t);if(!a)return null;let n=new p._4j({color:(0,y.W5)(a),roughness:.84,metalness:.02}),i=(0,y.XZ)(e,a.bodyType,n),o=new p.YJl;return o.add(i.mesh),o.userData.bodyVisualizerMeshState=i,o.userData.bodyVisualizerMaterial=n,ez(o,t,r,!0),o}(a,e,t):null;let l=ef(e),s=r[ew(e)];return s?((n=(0,b.o8)(s)).traverse(e=>{e instanceof p.eaF&&(e.geometry=e.geometry.clone(),Array.isArray(e.material)?e.material=e.material.map(e=>e.clone()):e.material=e.material.clone())}),eu(i=n,l,e.heightCm),(o=(0,v.S6)(l,e.materialColorId))&&i.traverse(e=>{if(!(e instanceof p.eaF))return;let t=()=>new p._4j({color:o,roughness:.82,metalness:.02});Array.isArray(e.material)?(e.material.forEach(e=>e.dispose()),e.material=e.material.map(t)):(e.material.dispose(),e.material=t())}),eC(i,t,e),i.userData.assetId=l.id,i.userData.slotId=e.slotId,i):null}function eN(e,t,r=72,a=36,n=0,i=0){let o=new p.YJl,l="day"===t,s=Math.max(r,a,320),c=l?Math.max(r,900):s,d=l?Math.max(a,900):s,u=Math.max(320,.75*Math.max(r,a));e.background=new p.Q1f(l?"#dff2ff":"#070b11"),e.fog=l?new p.jUj("#dff2ff",70,u):null;let h=new p.eaF(new p.bdM(c,d),new p.V9B({color:l?"#eef1f4":"#09111d"}));h.rotation.x=-Math.PI/2,h.position.set(n,-.002,i),o.add(h);{let e=Math.max(c,d),t=Math.max(64,Math.min(1e3,Math.round(e/2))),r=new p.fTw(e,t,l?"#c8d1dd":"#38bdf8",l?"#e1e7ef":"#1f2937");r.position.set(n,.001,i);let a=l?.78:.48;
1Array.isArray(r.material)?r.material.forEach(e=>{e.transparent=!0,e.opacity=a}):(r.material.transparent=!0,r.material.opacity=a),o.add(r)}let m=new p.$p8("#ffffff",l?.92:.62);o.add(m);let f=new p.ZyN(l?"#fff6dc":"#dbeafe",l?1.34:1.05);f.position.set(-2.2,5.2,3.4),o.add(f);let w=new p.ZyN(l?"#b9dcff":"#7dd3fc",l?.56:.42);return w.position.set(2.6,2.4,-2.2),o.add(w),e.add(o),o}function eI(e,t,r){let a=eb(t);if(e.add(ei([eE(t.view,a.left-.2,0),eE(t.view,a.right+.2,0)],"#e2e8f0")),null!==t.referenceLineCm){let r=.01*t.referenceLineCm,n=Math.max(.7,.08*a.width);e.add(ei([eE(t.view,a.left-n,r),eE(t.view,a.right+n,r)],"#64748b",{opacity:.38,depthTest:!1,dashed:!0,dashSize:.1,gapSize:.07}))}if(t.showSubjectLabels){let{subjectLabelWidthM:r,subjectLabelHeightM:n}=ev(a),i=eM(a);a.subjects.forEach(a=>{let o=(0,v.KJ)(a.subject.heightCm,t.preferredUnit),l=i.get(a.subject.slotId),s=function(e,t,r=!1){let a=document.createElement("canvas"),n=a.getContext("2d");a.width=920,a.height=264,n&&(n.scale(2,2),n.clearRect(0,0,460,132),n.textAlign="center",n.textBaseline="middle",r&&(n.fillStyle="rgba(255, 255, 255, 0.86)",n.shadowBlur=10,n.shadowColor="rgba(15, 23, 42, 0.14)",n.beginPath(),n.roundRect(34,14,392,104,18),n.fill(),n.shadowBlur=0,n.shadowColor="transparent"),$(n,e,{x:230,y:44,maxWidth:384,fontSize:42,minFontSize:26,weight:800,color:"#0f172a",strokeColor:"rgba(255, 255, 255, 0.96)",strokeWidth:9}),$(n,t,{x:230,y:86,maxWidth:368,fontSize:36,minFontSize:24,weight:750,color:"#475569",strokeColor:"rgba(255, 255, 255, 0.96)",strokeWidth:8}));let i=new p.GOR(a);
1i.colorSpace=p.er$;let o=new p.RoJ({map:i,transparent:!0,depthTest:!1,depthWrite:!1}),l=new p.kxk(o);return l.frustumCulled=!1,l.renderOrder=50,l}(a.subject.name,o,l?.showPlate??!1),c="side"===t.view?2.2:1.2;s.position.copy(eE(t.view,l?.horizontal??a.horizontal,l?.y??a.dimensions.heightM+Math.max(.62*n,.3),c)),s.scale.set(r,n,1),e.add(s)})}}function eD(e,t,r,a,n,i,o=!1){var l;let s,c=r/Math.max(a,1),d=eb(t),u=d.maxHeightM,h=eH(t,"screen"),m=Math.max(d.width+Math.max(1.2,.08*d.width),2.9),f=(l=.44*u,s=eb(t),"side"===t.view?new p.Pq0(0,l,s.center):new p.Pq0(s.center,l,0));if(e instanceof p.qUd){let r=Math.max(h.verticalSpan,2.6,h.width/c),a=eR(t,h.centerHorizontal,h.centerY);e.left=-r*c/2,e.right=r*c/2,e.top=r/2,e.bottom=-r/2,e.near=.01,e.far=140,"side"===t.view?e.position.set(Math.max(4.1,.45*h.width),a.y,a.z):e.position.set(a.x,a.y,Math.max(4.2,.45*h.width)),e.lookAt(a),e.updateProjectionMatrix();return}if(e.aspect=c,e.near=.02,e.far=ej(d,m),e.fov="walk"===t.view?62:42,"walk"===t.view)return void e.updateProjectionMatrix();if("free"===t.view){if(o){let t=Math.max(3.5,.62*m,1.18*u);e.position.set(f.x+.72*t,.62*u,f.z+t),e.lookAt(f),i&&(i.target.copy(f),i.update())}}else{let t=.006*n,r=Math.max(4.8,.82*m,1.78*u)*(c<.75?Math.min(3.6,1.15/Math.max(c,.32)):1);e.position.set(f.x+Math.sin(t)*r,.58*u,f.z+Math.cos(t)*r),e.lookAt(f)}e.updateProjectionMatrix()}function eT(e,t,r,a){let n;if(!ex(e).every(e=>t[e.key])||eg(e)&&!r)throw Error("Export models are not ready.");let i=eb(e),o=ek(e,i),l=new p.Z58;eN(l,e.environment,o.widthM,o.depthM,o.centerX,o.centerZ);let s=new p.YJl;e.subjects.forEach(a=>{let n=eL(a,e,t,r);n&&s.add(n)});let c=(s.updateMatrixWorld(!0),(n=new p.NRn().setFromObject(s)).isEmpty()?null:"side"===e.view?{bottom:n.min.y,left:n.min.z,right:n.max.z,top:n.max.y}:{bottom:n.min.y,left:n.min.x,right:n.max.x,top:n.max.y});l.add(s);let d=new p.YJl;return eI(d,e,a),l.add(d),{contentBounds:c,scene:l,layout:i}}function eH(e,t){let r=eb(e),a=function(e,t){if(!e.showSubjectLabels)return null;let{usesTallSceneLabels:r,subjectLabelWidthM:a}=ev(t),n=eM(t),i=t.left,o=t.right;return t.subjects.forEach(e=>{let l=n.get(e.subject.slotId),s=l?.horizontal??ey(e,t,r,a);i=Math.min(i,s-a/2),o=Math.max(o,s+a/2)}),{left:i,right:o,width:Math.max(o-i,t.width)}}(e,r),n=a?.left??r.left,i=a?.right??r.right,o=Math.max(i-n,r.width),l=Math.max("export"===t?.35:1.2,o*("export"===t?.035:.08)),s=Math.max(o+l,2.9),c=(n+i)/2,d=e.showSubjectLabels?ev(r).labelHeadroomM:"export"===t?Math.max(.45,.045*r.maxHeightM):Math.max(.9,.12*r.maxHeightM),u=-("screen"===t?Math.max(1.1,.24*r.maxHeightM):Math.max(.18,.018*r.maxHeightM)),h=r.maxHeightM+d;return{bottom:u,centerHorizontal:c,centerY:(h+u)/2,left:c-s/2,layout:r,right:c+s/2,top:h,verticalSpan:h-u,width:s}}function eA(e,t){if(!t)return e;let r=Math.max(t.right-t.left,0),a=Math.max(t.top-t.bottom,0),n=Math.max(.35,.035*r),i=Math.max(.18,.018*a),o=Math.min(e.left,t.left-n/2),l=Math.max(e.right,t.right+n/2),s=Math.min(e.bottom,t.bottom-i),c=Math.max(e.top,t.top+i),d=Math.max(l-o,2.9),u=Math.max(c-s,2.6);return{...e,bottom:s,centerHorizontal:(o+l)/2,centerY:(c+s)/2,left:o,right:l,top:c,verticalSpan:u,width:d}}async function e_(e,t,r,a){let n={...e,view:"front"},i=document.createElement("canvas"),{scene:o}=eT(n,t,r,a),l=new p.qUd,s=new f.WebGLRenderer({canvas:i,antialias:!0,alpha:!1,powerPreference:"high-performance",preserveDrawingBuffer:!0});s.setPixelRatio(1),s.setSize(3840,1440,!1),s.outputColorSpace=p.er$,eD(l,n,3840,1440,0,null,!0),s.render(o,l);try{return await en(i,a)}finally{s.dispose(),eo(o)}}async function eF(e,t,r,a,n,i,o){if("u"<typeof MediaRecorder)throw Error("360 video export is not supported.");if(o?.aborted)throw U("360 video export was cancelled.");let l=document.createElement("canvas");l.width=n.width,l.height=n.height;let s=l.getContext("2d");if(!s||"function"!=typeof l.captureStream)throw Error("360 video canvas export is not supported.");let c={...e,view:"front"},d=document.createElement("canvas"),{contentBounds:u,scene:h,layout:m}=eT(c,t,r,a),w=eA(eH(c,"export"),u),x=n.width/Math.max(n.height,1),g=new f.WebGLRenderer({canvas:d,antialias:!0,alpha:!1,powerPreference:"high-performance",preserveDrawingBuffer:!0}),b=new p.ubm(42,x,.02,ej(m,Math.max(2.9,w.width))),v=l.captureStream(n.fps),y=v.getVideoTracks(),M=y[0],k=null;try{var j;let e,t;g.setPixelRatio(1),g.setSize(n.width,n.height,!1),g.outputColorSpace
1=p.er$;let r=[],l=new MediaRecorder(v,{mimeType:i.mimeType,videoBitsPerSecond:n.width>=2048?95e5:n.width>=1920?65e5:42e5});k=l;let u=new Promise((e,t)=>{let a=()=>{o?.removeEventListener("abort",n)},n=()=>{a(),t(U("360 video export was cancelled."))},s=e=>{a(),e()};o?.addEventListener("abort",n,{once:!0}),l.ondataavailable=e=>{e.data.size>0&&r.push(e.data)},l.onerror=()=>{s(()=>t(Error("360 video recorder failed.")))},l.onstop=()=>{s(()=>e(new Blob(r,{type:i.mimeType})))}});u.catch(()=>void 0);let f=eR(c,w.centerHorizontal,w.centerY),y=Math.max(w.width,2.9),S=(j=w.verticalSpan,e=42*Math.PI/180,t=2*Math.atan(Math.tan(e/2)*Math.max(x,.1)),Math.max(j/2/Math.max(.08,Math.tan(e/2)),y/2/Math.max(.08,Math.tan(t/2)))),C=Math.max(4.8,1.18*S,.92*y,m.maxHeightM*(c.showSubjectLabels?2.05:1.78));b.far=Math.max(b.far,2.4*C+m.maxHeightM+y),b.updateProjectionMatrix();let P=Math.max(24,Math.round(n.durationMs/1e3*n.fps)),R=1e3/n.fps;l.start(1e3);for(let e=0;e<P;e+=1){if(o?.aborted)throw U("360 video export was cancelled.");let t=e/P*Math.PI*2;b.position.set(f.x+Math.sin(t)*C,f.y,f.z+Math.cos(t)*C),b.lookAt(f),b.updateProjectionMatrix(),g.render(h,b),s.clearRect(0,0,n.width,n.height),s.drawImage(d,0,0,n.width,n.height),ee(s,n.width,n.height,a),M?.requestFrame?.(),await function(e,t){return new Promise((r,a)=>{if(t?.aborted)return void a(U("Operation aborted."));let n=window.setTimeout(()=>{t?.removeEventListener("abort",i),r()},e),i=()=>{window.clearTimeout(n),a(U("Operation aborted."))};t?.addEventListener("abort",i,{once:!0})})}(R,o)}try{l.requestData()}catch{}"inactive"!==l.state&&l.stop();let E=await B(u,12e3,"360 video recorder did not finish.");if(E.size<=0)throw Error("360 video export produced an empty file.");return E}finally{if(k&&"inactive"!==k.state)try{k.stop()}catch{}y.forEach(e=>e.stop()),g.dispose(),eo(h)}}function eO({rootRef:e,knobRef:t,ariaLabel:r,onPointerDown:n,onPointerMove:i,onPointerEnd:o}){return(0,a.jsxs)("div",{ref:e,role:"application","aria-label":r,className:(0,j.cn)("pointer-events-auto relative grid size-28 place-items-center rounded-full border border-sky-200/20 bg-slate-950/32 shadow-[0_18px_60px_rgba(0,0,0,0.36)] backdrop-blur-md transition-colors data-[active=true]:bg-sky-500/14"),"data-active":"false",style:{touchAction:"none"},onPointerDown:n,onPointerMove:i,onPointerUp:o,onPointerCancel:o,children:[(0,a.jsx)("span",{className:"sr-only",children:r}),(0,a.jsx)("span",{className:"absolute size-[4.5rem] rounded-full border border-white/10"}),(0,a.jsx)("span",{ref:t,className:"relative size-11 rounded-full border border-sky-100/30 bg-sky-200/24 shadow-[0_10px_30px_rgba(14,165,233,0.26)]",style:{transform:"translate(0px, 0px)"}})]})}function e$(e){return e.toFixed(+(e%1!=0))}function eW({value:e,messages:t,onChange:r}){let[c,d]=(0,n.useState)(!1),u=(0,v.Zc)(e,v.fp),h=e=>{r?.((0,v.Zc)(e,u))};return c?(0,a.jsxs)("button",{type:"button",className:"absolute left-4 top-4 z-40 flex h-11 items-center gap-2 rounded-full border border-slate-200 bg-white/92 px-3 text-sm font-semibold text-slate-900 shadow-[0_16px_40px_rgba(15,23,42,0.12)] backdrop-blur transition hover:bg-violet-50 hover:text-violet-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-violet-300 lg:left-6 lg:top-6","aria-label":t.controls.showWalkSpeedControls,"aria-expanded":!1,onPointerDown:e=>e.stopPropagation(),onPointerMove:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation(),d(!1)},children:[(0,a.jsx)(i.A,{className:"size-4 text-violet-600"}),e$(u)," m/s"]}):(0,a.jsxs)("div",{className:"absolute left-4 top-4 z-40 w-[min(16rem,calc(100%_-_2rem))] rounded-xl border border-slate-200 bg-white/92 p-3 text-slate-900 shadow-[0_16px_40px_rgba(15,23,42,0.12)] backdrop-blur lg:left-6 lg:top-6",onPointerDown:e=>e.stopPropagation(),onPointerMove:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,a.jsx)(i.A,{className:"size-4 shrink-0 text-violet-600"}),(0,a.jsx)("p",{className:"truncate text-xs font-semibold uppercase tracking-[0.14em] text-slate-700",children:t.controls.walkSpeed})]}),(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5",children:[(0,a.jsxs)("span",{className:"rounded-md bg-slate-100 px-2 py-1 text-xs font-bold text-slate-900",children:[e$(u)," m/s"]}),(0,a.jsx)("button",{type:"button",className:"grid size-8 place-items-center rounded-lg border border-slate-200 bg-white text-slate-500 transition hover:border-violet-200 hover:bg-violet-50 hover:text-violet-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-violet-300","aria-label":t.controls.collapseWalkSpeedControls,"aria-expanded":!0,onClick:()=>d(!0),children:(0,a.jsx)(o.A,{className:"size-4"})})]})]}),(0,a.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,a.jsx)("button",{type:"button",className:"inline-flex size-9 shrink-0 items-center justify-center rounded-lg border border-slate-200 bg-white text-slate-600 transition hover:border-violet-200 hover:bg-violet-50 hover:text-violet-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-violet-300","aria-label":t.controls.walkSpeedSlower,onClick:()=>h(u-1),children:(0,a.jsx)(l.A,{className:"size-4"})}),(0,a.jsx)("input",{type:"range",className:"h-2 min-w-0 flex-1 accent-violet-600",min:v.gN,max:v.MA,step:"0.5",value:u,"aria-label":t.controls.walkSpeed,onChange:e=>h(Number(e.target.value))}),(0,a.jsx)("button",{type:"button",className:"inline-flex size-9 shrink-0 items-center justify-center rounded-lg border border-slate-200 bg-white text-slate-600 transition hover:border-violet-200 hover:bg-violet-50 hover:text-violet-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-violet-300","aria-label":t.controls.walkSpeedFaster,onClick:()=>h(u+1),children:(0,a.jsx)(s.A,{className:"size-4"})})]}),(0,a.jsx)("p",{className:"mt-2 text-xs leading-5 text-slate-500",children:t.controls.walkSpeedHint})]})}function eU({model:e,messages:t,locale:r,showInlineExportControls:i=!0,onSubjectTransform:o,onWalkSpeedChange:l,onExportHandlersReady:s}){let b=(0,n.useRef)(null),k=(0,n.useRef)(null),P=(0,n.useRef)(null),R=(0,n.useRef)({}),E=(0,n.useRef)(null),D=(0,n.useRef)(null),T=(0,n.useRef)(new Set),$=(0,n.useRef)(null),U=(0,n.useRef)(""),q=(0,n.useRef)(""),B=(0,n.useRef)(null),V=(0,n.useRef)(""),ee=(0,n.useRef)(null),et=(0,n.useRef)(""),er=(0,n.useRef)(""),en=(0,n.useRef)(!0),ei=(0,n.useRef)(null),el=(0,n.useRef)(H()),es=(0,n.useRef)(null),ec=(0,n.useRef)(null),ed=(0,n.useRef)(0),em=(0,n.useRef)(e),ev=(0,n.useRef)(null),ey=(0,n.useRef)(""),eM=(0,n.useRef)(e.view
1),ej=(0,n.useRef)(o),eR=(0,n.useRef)(null),eE=(0,n.useRef)(null),eT=(0,n.useRef)({keys:{forward:!1,backward:!1,left:!1,right:!1},touchMove:new p.I9Y,touchLook:new p.I9Y,position:new p.Pq0,yaw:0,pitch:0,initialized:!1,lastFrameMs:null}),eH=(0,n.useRef)(null),eA=(0,n.useRef)(null),e$=(0,n.useRef)(null),eq=(0,n.useRef)(null),eY=(0,n.useRef)(null),eB=(0,n.useRef)(null),[eV,eX]=(0,n.useState)(null),[eZ,eJ]=(0,n.useState)(!0),[eG,eK]=(0,n.useState)(0),[eQ,e0]=(0,n.useState)(null),[e1,e2]=(0,n.useState)(null),[e4,e5]=(0,n.useState)(!1),[e3,e6]=(0,n.useState)(!1),[e8,e9]=(0,n.useState)(!1),[e7,te]=(0,n.useState)(()=>window.innerWidth<768?"540p":"720p"),[tt,tr]=(0,n.useState)(!1),ta=(0,n.useMemo)(()=>(0,v.Tc)(e),[e]),tn=t.scene.loadingSteps,ti=tn[Math.min(eG,tn.length-1)]??t.scene.loading;(0,n.useEffect)(()=>{em.current=e},[e]),(0,n.useEffect)(()=>{ej.current=o},[o]),(0,n.useEffect)(()=>{let e=e=>{var t;let r=e instanceof CustomEvent&&(t=e.detail)&&"object"==typeof t?{qualityId:K(t.qualityId)?t.qualityId:"auto",customLongEdge:Q(t.customLongEdge)}:{qualityId:"auto"};eY.current?.(r)},t=e=>{var t;let r=e instanceof CustomEvent&&"string"==typeof(t=e.detail?.qualityId)&&Object.prototype.hasOwnProperty.call(L,t)?e.detail.qualityId:void 0;eB.current?.(r)};return window.addEventListener("howheight:3d-export-screenshot",e),window.addEventListener("howheight:3d-export-video",t),()=>{window.removeEventListener("howheight:3d-export-screenshot",e),window.removeEventListener("howheight:3d-export-video",t)}},[]),(0,n.useEffect)(()=>{if(s)return s({screenshot:e=>eY.current?.(e)??Promise.resolve(),video:e=>eB.current?.(e)??Promise.resolve()}),()=>s(null)},[s]);let to=(0,n.useCallback)(()=>{eR.current&&(URL.revokeObjectURL(eR.current),eR.current=null)},[]),tl=(0,n.useCallback)(e=>{to(),e.revokeObjectUrl&&(eR.current=e.src),eE.current=e,e6(!1),e2(e)},[to]),ts=(0,n.useCallback)(()=>{to(),eE.current=null,e6(!1),e2(null)},[to]),tc=(0,n.useCallback)((e,t)=>{let r="move"===e?eH.current:e$.current,a="move"===e?eA.current:eq.current;r&&(r.dataset.active=t.active?"true":"false"),a&&(a.style.transform=`translate(${t.x}px, ${t.y}px)`)},[]),td=(0,n.useCallback)((e,t)=>{e.preventDefault(),e.stopPropagation();let r=e.currentTarget.getBoundingClientRect(),a=e.clientX-r.left-r.width/2,n=e.clientY-r.top-r.height/2,i=Math.hypot(a,n),o=i>44?44/i:1,l=a*o,s=n*o,c=l/44,d=s/44,u=eT.current;"move"===t?u.touchMove.set(c,-d):u.touchLook.set(c,-d),tc(t,{active:!0,x:l,y:s}),er.current=""},[tc]),tu=(0,n.useCallback)((e,t)=>{try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}td(e,t)},[td]),th=(0,n.useCallback)((e,t)=>{e.preventDefault(),e.stopPropagation();try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}"move"===t?eT.current.touchMove.set(0,0):eT.current.touchLook.set(0,0),tc(t,I),er.current=""},[tc]),tm=(0,n.useCallback)(async()=>{if(e1&&!e4){e5(!0);try{if(await G(e1,t))return void m.oR.success("video"===e1.kind?t.scene.spin360Saved:t.scene.screenshotSaved,z());"video"===e1.kind?(e6(!0),m.oR.error(t.scene.mobileSaveVideoCompatibilityHint,z())):m.oR.error(t.scene.mobileSaveImageShareUnavailable,z())}catch(e){if(W(e))return;console.error(e),"video"===e1.kind?(e6(!0),m.oR.error(t.scene.mobileSaveVideoCompatibilityHint,z())):m.oR.error(t.scene.mobileSaveImageShareUnavailable,z())}finally{e5(!1)}}},[t,e4,e1]),tp=(0,n.useCallback)(async()=>{if(e1?.blob&&"video"===e1.kind&&!e1.isHosted&&!e8){e9(!0);try{let e=await X(e1.blob,e1.filename);if(eE.current!==e1)return;tl(await Z(e1.blob,e1.filename,"video",e)),m.oR.success(t.scene.mobileSaveVideoCompatibilityReady,z())}catch(e){if(eE.current!==e1)return;console.error(e),m.oR.error(t.scene.mobileSaveVideoCompatibilityFailed,z())}finally{e9(!1)}}},[t,e1,e8,tl]);if((0,n.useEffect)(()=>()=>to(),[to]),(0,n.useEffect)(()=>{if("walk"!==e.view||!Y())return;let t=document.documentElement,r=document.body,a=t.style.overscrollBehavior,n=r.style.overscrollBehavior;return t.style.overscrollBehavior="none",r.style.overscrollBehavior="none",()=>{t.style.overscrollBehavior=a,r.style.overscrollBehavior=n}},[e.view]),(0,n.useEffect)(()=>
1{if(!eZ)return;let e=window.setTimeout(()=>{eK(e=>Math.min(e+1,tn.length-1))},520);return()=>window.clearTimeout(e)},[tn.length,eG,eZ]),(0,n.useEffect)(()=>{let e;if(!k.current||!b.current||!function(){if("u"<typeof document)return!1;let e=document.createElement("canvas");return!!(e.getContext("webgl2")||e.getContext("webgl"))}()){eX("webgl"),eJ(!1);return}let r=k.current,a=new p.Z58,n=eb(em.current),i=ek(em.current,n);ee.current=eN(a,em.current.environment,i.widthM,i.depthM,i.centerX,i.centerZ);try{e=new f.WebGLRenderer({canvas:r,antialias:!0,alpha:!1,powerPreference:"high-performance",preserveDrawingBuffer:!0})}catch{eX("webgl"),eJ(!1);return}eX(null),e.outputColorSpace=p.er$,P.current=e;let o=new p.qUd,l=new p.ubm,s=new g.N(l,r);r.style.touchAction="pan-y",s.enabled=!1,s.enableDamping=!0,s.dampingFactor=.08,s.rotateSpeed=.65,s.zoomSpeed=.75,s.panSpeed=.5,s.addEventListener("change",()=>{er.current=""}),ev.current=s;let c=new w.B;c.setCrossOrigin("anonymous"),c.setMeshoptDecoder(x.f);let d=T.current,u=new p.tBo,h=new p.I9Y,m={current:null},v={current:null},M=eT.current,j=new Map,S=new Set,C=!1,z=!1,L=()=>{null!==es.current&&(window.clearTimeout(es.current),es.current=null)},N=()=>{en.current=!1,ei.current=null,es.current=null,eJ(!1)},W=(e,t=!1)=>{if(e){if(L(),(t||null===ei.current)&&(ei.current=performance.now(),el.current=H(),eK(0)),en.current)return;en.current=!0,eJ(!0);return}if(!en.current||null!==es.current)return;let r=ei.current??performance.now(),a=Math.max(0,el.current-(performance.now()-r));if(L(),a>0){es.current=window.setTimeout(N,a);return}N()},X=e=>{let t=j.get(e);t&&(t.forEach(e=>window.clearTimeout(e)),j.delete(e))},Z=e=>{var t;let r,a;
1if(R.current[e.key]||d.has(e.key)||S.has(e.key))return;let n=(r=[t=e.url],(a=function(e){try{let t=new URL(e,window.location.href);if(t.origin!==window.location.origin||!t.pathname.startsWith("/models/"))return null;return`${t.pathname}${t.search}`}catch{return e.startsWith("/models/")?e:null}}(t))&&!r.includes(a)&&r.push(a),r),i=new Set,o=new Set;d.add(e.key),W(!0,!0);let l=()=>{R.current[e.key]||S.has(e.key)||(X(e.key),d.delete(e.key),S.add(e.key),W(!0))},s=t=>{if(C||R.current[e.key]||i.has(t))return;let r=n[t];if(!r)return;i.add(t);let a=window.setTimeout(()=>{(o.add(t),t+1<n.length)?s(t+1):o.size>=n.length&&l()},7e3);j.set(e.key,[...j.get(e.key)??[],a]),O(r).then(r=>{if(C||R.current[e.key])return void r.revoke?.();if(r.preloadFailed&&t+1<n.length){o.add(t),s(t+1);return}c.load(r.url,t=>{(r.revoke?.(),C||R.current[e.key])?eo(t.scene):(X(e.key),S.delete(e.key),d.delete(e.key),R.current[e.key]=t.scene,U.current="",er.current="",W(!1))},void 0,()=>{if(r.revoke?.(),o.add(t),!C&&!R.current[e.key]){if(t+1<n.length)return void s(t+1);o.size>=n.length&&l()}})})};s(0)},J=null,G=()=>{let t,r=b.current?.getBoundingClientRect();if(!r)return;let a=Math.max(1,Math.floor(r.width)),n=Math.max(1,Math.floor(r.height));e.setPixelRatio((t=Math.max(1,window.devicePixelRatio||1),Math.max(1,Math.min(t,Y()?2:1.75,Math.sqrt(28e5/Math.max(a*n,1)))))),e.setSize(r.width,r.height,!1),er.current="","free"!==em.current.view&&(ey.current="")},K=new ResizeObserver(()=>{null===J&&(J=window.requestAnimationFrame(()=>{J=null,G()}))});K.observe(b.current),G();let Q=e=>{let t=em.current;if("walk"===t.view&&"mouse"===e.pointerType){e.preventDefault(),e.stopPropagation(),r.focus(),v.current={pointerId:e.pointerId,lastX:e.clientX,lastY:e.clientY};try{r.setPointerCapture(e.pointerId)}catch{}if(r.style.cursor="grabbing",document.pointerLockElement!==r&&"function"==typeof r.requestPointerLock)try{let e=r.requestPointerLock();e instanceof Promise&&e.catch(()=>void 0)}catch{}return}if("free"!==t.view&&"front"!==t.view&&"side"!==t.view||!$.current)return;let a="side"===t.view?o:l,n=r.getBoundingClientRect();h.x=(e.clientX-n.left)/Math.max(n.width,1)*2-1,h.y=-((e.clientY-n.top)/Math.max(n.height,1)*2-1),u.setFromCamera(h,a);let i=u.intersectObjects($.current.children,!0)[0],c=function(e){let t=e;for(;t;){if("string"==typeof t.userData.slotId)return t;t=t.parent}return null}(i?.object??null);if(!c)return;let d=t.subjects.find(e=>e.slotId===c.userData.slotId);if(!d)return;let p=eP(e,r,a,t,u,h);if(null!==p){e.preventDefault(),e.stopPropagation();try{r.setPointerCapture(e.pointerId)}catch{}s.enabled=!1,m.current={pointerId:e.pointerId,slotId:d.slotId,startOffsetM:d.lateralOffsetM,startAxisM:p,currentOffsetM:d.lateralOffsetM,target:c},r.style.cursor="grabbing"}},ea=e=>{var t;let a,n=v.current;if(n&&n.pointerId===e.pointerId&&"walk"===em.current.view&&document.pointerLockElement!==r){e.preventDefault(),e.stopPropagation();let t=e.clientX-n.lastX,r=e.clientY-n.lastY;n.lastX=e.clientX,n.lastY=e.clientY,M.yaw+=.00154*t,M.pitch=A(M.pitch-.00154*r),er.current="";return}let i=m.current;if(!i||i.pointerId!==e.pointerId)return;let s=em.current,c=eP(e,r,"side"===s.view?o:l,s,u,h);if(null===c)return;e.preventDefault(),e.stopPropagation();let d="free"===s.view?.55:1,p=Math.min(30,Math.max(-30,Math.round(10*(i.startOffsetM+(c-i.startAxisM)*d))/10));i.currentOffsetM=p;let f=eS((t=i.slotId,{...a=em.current,subjects:a.subjects.map(e=>e.slotId===t?{...e,lateralOffsetM:p}:e)}),i.slotId);i.target.position.set(f.x,i.target.userData.groundOffsetM??0,f.z),i.target.userData.lateralOffsetM=p,er.current=""},eR=e=>{let t=v.current;if(t&&t.pointerId===e.pointerId){e.preventDefault(),v.current=null,r.style.cursor="";try{r.releasePointerCapture(e.pointerId)}catch{}return}let a=m.current;if(!a||a.pointerId!==e.pointerId)return;e.preventDefault(),m.current=null,r.style.cursor="",s.enabled="free"===em.current.view;try{r.releasePointerCapture(e.pointerId)}catch{}let n=em.current.subjects.find(e=>e.slotId===a.slotId);n&&ej.current?.(a.slotId,{lateralOffsetM:a.currentOffsetM,flipped:n.flipped,rotationYDeg:n.rotationYDeg})},eE=e=>{"walk"===em.current.view&&document.pointerLockElement===r&&(M.yaw+=.00154*e.movementX,M.pitch=A(M.pitch-.00154*e.movementY),er.current="")},eH=()=>{let e=document.pointerLockElement===r;tr(e),e||(_(M),tc("move",I),tc("look",I))},eA=(e,t)=>
1{if("walk"!==em.current.view||function(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toLowerCase();return"input"===t||"textarea"===t||"select"===t||e.isContentEditable}(e.target))return;let r=function(e){switch(e.toLowerCase()){case"w":case"arrowup":return"forward";case"s":case"arrowdown":return"backward";case"a":case"arrowleft":return"left";case"d":case"arrowright":return"right";default:return null}}(e.key);r&&(e.preventDefault(),M.keys[r]=t,er.current="")},e_=e=>{eA(e,!0)},eF=e=>{eA(e,!1)},eO=()=>{_(M),tc("move",I),tc("look",I),v.current=null,r.style.cursor="",er.current=""};r.addEventListener("pointerdown",Q,{capture:!0}),document.addEventListener("mousemove",eE),document.addEventListener("pointerlockchange",eH),window.addEventListener("keydown",e_,{passive:!1}),window.addEventListener("keyup",eF,{passive:!1}),window.addEventListener("blur",eO),window.addEventListener("pointermove",ea,{passive:!1}),window.addEventListener("pointerup",eR,{passive:!1}),window.addEventListener("pointercancel",eR,{passive:!1});let e$=()=>{if(ec.current=window.requestAnimationFrame(e$),"hidden"===document.visibilityState)return;let n=em.current,i=b.current?.getBoundingClientRect();if(!i)return;let c=eb(n),d=ek(n,c),u=[n.environment,Math.round(10*d.widthM),Math.round(10*d.depthM),Math.round(10*d.centerX),Math.round(10*d.centerZ)].join(":");et.current!==u&&(ee.current&&(a.remove(ee.current),eo(ee.current)),ee.current=eN(a,n.environment,d.widthM,d.depthM,d.centerX,d.centerZ),et.current=u,er.current="");let h=ex(n);h.forEach(Z);let f=eg(n);f&&(E.current||z||(z=!0,W(!0,!0),D.current||(D.current=(0,y.qG)()),D.current.then(e=>{C||(E.current=e,U.current="",er.current="",W(!1))}).catch(e=>{C||(z=!1,D.current=null,eX("model-assets"),W(!1))})));let w=R.current,x=h.every(e=>!!w[e.key])&&(!f||!!E.current);W(!x);let g="side"===n.view?o:l,v="free"!==eM.current&&"free"===n.view,k="walk"===eM.current&&"walk"!==n.view;if(s.enabled="free"===n.view&&!m.current,k&&(M.initialized=!1,eO(),document.pointerLockElement===r&&document.exitPointerLock?.()),!x){eD(g,n,i.width,i.height,ed.current,s,!0),"walk"===n.view&&F(l,n,M),e.render(a,g),eM.current=n.view;return}let j=n.subjects.map(e=>`${e.slotId}:${ew(e)}:${e.assetId}:${e.materialColorId??""}`).join("|"),S=[n.subjects.map(e=>`${e.slotId}:${e.heightCm}:${ew(e)}:${e.lateralOffsetM}:${e.rotationYDeg}:${e.flipped}:${ep(e)}`).join("|"),n.view].join("|"),P=q.current!==S;if(!$.current||U.current!==j){$.current&&(a.remove($.current),eo($.current)),B.current&&(a.remove(B.current),eo(B.current));let e=new p.YJl;n.subjects.forEach(t=>{let r=eL(t,n,w,E.current);r&&e.add(r)}),$.current=e,a.add(e),U.current=j,q.current=S;let r=new p.YJl;eI(r,n,t),B.current=r,a.add(r),er.current="",ey.current=""}$.current&&($.current.children.forEach(e=>{let t=n.subjects.find(t=>t.slotId===e.userData.slotId);if(!t)return;let r=e.userData.lateralOffsetM!==t.lateralOffsetM||e.userData.rotationYDeg!==t.rotationYDeg||e.userData.flipped!==t.flipped;if(eh(t)){let a=e.userData.bodyVisualizerParamsSignature!==ep(t);(a||r||P||e.userData.view!==n.view)&&ez(e,t,n,a);return}let a=ef(t),i=e.userData.heightCm!==t.heightCm;i&&eu(e,a,t.heightCm),(i||r||P||e.userData.view!==n.view)&&eC(e,n,t)}),q.current=S);let L=[n.subjects.map(e=>`${e.slotId}:${e.name}:${e.heightCm}:${ew(e)}:${e.assetId}:${e.lateralOffsetM}:${e.rotationYDeg}:${e.flipped}:${ep(e)}`).join(";"),n.preferredUnit,n.view,n.referenceLineCm??"none",n.showSubjectLabels?"labels":"no-labels"].join("|");if(B.current&&V.current!==L){a.remove(B.current),eo(B.current);let e=new p.YJl;eI(e,n,t),B.current=e,a.add(e),V.current=L}ed.current+=+("orbit"===n.view||"walk"===n.view);let N="free"===n.view?[n.subjects.map(e=>`${e.slotId}:${ew(e)}:${e.assetId}:${e.heightCm}:${ep(e)}`).join(";")].join("|"):"",I="free"===n.view&&!m.current&&(v||ey.current!==N);eD(g,n,i.width,i.height,ed.current,s,I),"free"===n.view?(s.minDistance=Math.max(1.2,.28*c.maxHeightM,.045*c.width),s.maxDistance=Math.max(14,9*c.maxHeightM,2.8*c.width),s.minPolarAngle=.04,s.maxPolarAngle=.49*Math.PI,s.update(),m.current||(ey.current=N)):"walk"===n.view?F(l,n,M):M.lastFrameMs=null;let T=[L,Math.round(i.width),Math.round(i.height),$.current?"ready":"empty","orbit"===n.view||"free"===n.view||"walk"===n.view?ed.current:"static"].join("|");if("orbit"!==n.view&&"free"!==n.view&&er.current===T){eM.current=n.view;return}e.render(a,g),er.current=T,eM.current=n.view};return e$(),()=>{C=!0,K.disconnect(),null!==J&&window.cancelAnimationFrame(J),ec.current&&window.cancelAnimationFrame(ec.current),L(),j.forEac
1h(e=>{e.forEach(e=>window.clearTimeout(e))}),j.clear(),s.dispose(),ev.current=null,r.removeEventListener("pointerdown",Q,{capture:!0}),document.removeEventListener("mousemove",eE),document.removeEventListener("pointerlockchange",eH),window.removeEventListener("keydown",e_),window.removeEventListener("keyup",eF),window.removeEventListener("blur",eO),window.removeEventListener("pointermove",ea),window.removeEventListener("pointerup",eR),window.removeEventListener("pointercancel",eR),document.pointerLockElement===r&&document.exitPointerLock?.(),Object.values(R.current).forEach(e=>{e&&eo(e)}),R.current={},d.clear(),e.dispose(),eo(a),P.current=null}},[tc,r,t]),eV){let e="model-assets"===eV?t.scene.modelFallbackTitle:t.scene.webglFallbackTitle,n="model-assets"===eV?t.scene.modelFallbackDescription:t.scene.webglFallbackDescription;return(0,a.jsxs)("div",{className:"flex min-h-[62svh] flex-col items-center justify-center gap-4 border border-sky-400/10 bg-[#070b11] p-6 text-center text-slate-100 md:min-h-[680px] lg:min-h-[calc(100vh_-_56px)]",children:[(0,a.jsxs)("div",{className:"max-w-md space-y-2",children:[(0,a.jsx)("h2",{className:"text-xl font-semibold tracking-tight",children:e}),(0,a.jsx)("p",{className:"text-sm leading-6 text-slate-400",children:n})]}),(0,a.jsx)(M.$,{asChild:!0,className:"bg-sky-500 text-white hover:bg-sky-400",children:(0,a.jsx)("a",{href:(0,C.dS)("/",r),children:t.scene.open2D})})]})}let tf=async e=>{if(!k.current||eZ||eQ)return void m.oR.error(t.scene.screenshotFailed,z());e0("screenshot");try{var r;let a,n=await ea(em.current,R.current,E.current,t,e,((r=k.current).clientWidth||r.width)/Math.max(r.clientHeight||r.height,1),ed.current),i=await J({blob:n,filename:(a=new Date().toISOString().replace(/[:.]/g,"-"),`howheight-3d-height-comparison-${a}.png`),kind:"image",messages:t,showPreview:tl});if("aborted"===i)return;m.oR.success("preview"===i?t.scene.mobileSavePreviewReady:t.scene.screenshotSaved,z())}catch{m.oR.error(t.scene.screenshotFailed,z())}finally{e0(null)}};eY.current=tf;let tw=async()=>{if(!eZ&&!eQ){e0("panorama");try{let e,r=await e_(em.current,R.current,E.current,t),a=await J({blob:r,filename:(e=new Date().toISOString().replace(/[:.]/g,"-"),`howheight-3d-panorama-${e}.png`),kind:"image",messages:t,showPreview:tl});if("aborted"===a)return;m.oR.success("preview"===a?t.scene.mobileSavePreviewReady:t.scene.panoramaSaved,z())}catch{m.oR.error(t.scene.panoramaFailed,z())}finally{e0(null)}}},tx=async e=>{var r;if(eZ||eQ)return void m.oR.error(t.scene.spin360Failed,z());let a=function(){if("u"<typeof MediaRecorder)return null;let e=[{mimeType:"video/mp4;codecs=avc1.42E01E,mp4a.40.2",extension:"mp4"},{mimeType:"video/mp4;codecs=h264",extension:"mp4"},{mimeType:"video/mp4",extension:"mp4"}],t=[{mimeType:"video/webm;codecs=vp9",extension:"webm"},{mimeType:"video/webm;codecs=vp8",extension:"webm"},{mimeType:"video/webm",extension:"webm"}];return("u">typeof navigator&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1)?[...e,...t]:[...t,...e]).find(e=>MediaRecorder.isTypeSupported(e.mimeType))??null}();if(!a||"function"!=typeof HTMLCanvasElement.prototype.captureStream)return void m.oR.error(t.scene.spin360Unsupported,z());let n=e??e7;e&&e!==e7&&te(e);let i=L[n],o=new AbortController,l=window.setTimeout(()=>o.abort(),i.durationMs+3e4),s="recording";e0("spin360");try{let e,n=await eF(em.current,R.current,E.current,t,i,a,o.signal);s="delivery";let l=await J({blob:n,filename:(r=a.extension,e=new Date().toISOString().replace(/[:.]/g,"-"),`howheight-3d-360-${i.id}-${e}.${r}`),kind:"video",messages:t,showPreview:tl});if("aborted"===l)return;m.oR.success("preview"===l?t.scene.mobileSavePreviewReady:t.scene.spin360Saved,z())}catch(e){e instanceof DOMException&&"AbortError"===e.name||console.error("HowHeight 3D video export failed",{error:e,format:a.mimeType,quality:i.id,stage:s}),m.oR.error(t.scene.spin360Failed,z())}finally{window.clearTimeout(l),e0(null)}};return eB.current=tx,(0,a.jsxs)("div",{className:"relative h-full min-h-[420px] overflow-hidden overscroll-contain bg-sky-100",children:[(0,a.jsx)("div",{ref:b,className:"absolute inset-0",children:(0,a.jsx)("canvas",{ref:k,className:"block size-full touch-p
1an-y select-none",style:{WebkitUserSelect:"none",WebkitTouchCallout:"none"},tabIndex:0,"aria-label":t.metadata.title})}),eZ?(0,a.jsx)("div",{className:"absolute inset-0 z-10 grid place-items-center bg-white/65 px-4 text-center backdrop-blur-sm",children:(0,a.jsxs)("div",{className:"w-full max-w-md rounded-2xl border border-slate-200 bg-white/95 p-5 shadow-[0_24px_80px_rgba(15,23,42,0.16)]",children:[(0,a.jsx)("p",{className:"mb-2 text-[11px] font-semibold uppercase tracking-[0.2em] text-violet-700",children:t.scene.loadingTitle}),(0,a.jsx)("div",{className:"min-h-9 text-xl font-semibold text-slate-950",children:(0,a.jsx)(S,{text:ti,loop:!1,speed:34,cursorChar:"_",className:"text-violet-700"},eG)}),(0,a.jsx)("div",{className:"mt-4 grid grid-cols-4 gap-2",children:tn.map((e,t)=>(0,a.jsx)("span",{className:(0,j.cn)("h-1 rounded-full transition-colors",t<=eG?"bg-violet-600":"bg-slate-200")},e))}),(0,a.jsx)("p",{className:"mt-4 text-sm leading-6 text-slate-500",children:t.scene.loadingHint})]})}):null,i?(0,a.jsx)("div",{className:"pointer-events-none absolute left-6 top-6 max-w-[calc(100%_-_12rem)] truncate rounded-lg border border-slate-200 bg-white/92 px-3 py-2 text-xs font-semibold text-slate-900 shadow-[0_16px_40px_rgba(15,23,42,0.12)] backdrop-blur sm:max-w-none",children:ta.sameHeight?t.result.sameHeight:`${ta.tallerName} +${ta.differenceCm} cm`}):null,"walk"===e.view?(0,a.jsx)("div",{className:"pointer-events-none absolute left-1/2 top-6 z-30 hidden max-w-[calc(100%_-_2rem)] -translate-x-1/2 truncate rounded-lg border border-slate-200 bg-white/90 px-3 py-2 text-xs font-semibold text-slate-800 shadow-[0_16px_40px_rgba(15,23,42,0.12)] backdrop-blur sm:block sm:max-w-none",children:t.scene.walkExitHint}):null,"walk"!==e.view||eZ?null:(0,a.jsx)(eW,{value:e.walkSpeedMps,messages:t,onChange:l}),"walk"!==e.view||eZ||tt?null:(0,a.jsx)("div",{className:"pointer-events-none absolute bottom-20 left-1/2 z-20 hidden -translate-x-1/2 rounded-lg border border-slate-200 bg-white/88 px-3 py-2 text-xs font-semibold text-slate-700 shadow-[0_16px_40px_rgba(15,23,42,0.12)] backdrop-blur lg:block",children:t.scene.walkDesktopHint}),"walk"!==e.view||eZ?null:(0,a.jsxs)("div",{className:"pointer-events-none absolute inset-x-0 bottom-[calc(5.25rem+env(safe-area-inset-bottom))] z-20 flex items-end justify-between px-5 lg:hidden",children:[(0,a.jsx)(eO,{rootRef:eH,knobRef:eA,ariaLabel:t.scene.walkMoveJoystick,onPointerDown:e=>tu(e,"move"),onPointerMove:e=>td(e,"move"),onPointerEnd:e=>th(e,"move")}),(0,a.jsx)(eO,{rootRef:e$,knobRef:eq,ariaLabel:t.scene.walkLookJoystick,onPointerDown:e=>tu(e,"look"),onPointerMove:e=>td(e,"look"),onPointerEnd:e=>th(e,"look")})]}),i?(0,a.jsxs)("div",{className:"absolute right-6 top-6 z-20 flex max-w-[52vw] flex-wrap justify-end gap-2 sm:max-w-none lg:right-72",children:[(0,a.jsx)("label",{className:"sr-only",htmlFor:"spin-360-quality",children:t.scene.spin360Resolution}),(0,a.jsx)("select",{id:"spin-360-quality",value:e7,disabled:eZ||null!==eQ,onChange:e=>te(e.target.value),"aria-label":t.scene.spin360Resolution,className:"h-10 rounded-lg border border-slate-200 bg-white/92 px-2 text-xs font-semibold text-slate-800 shadow-[0_16px_40px_rgba(15,23,42,0.12)] outline-none backdrop-blur hover:bg-white disabled:cursor-not-allowed disabled:opacity-55",children:N.map(e=>{let t=L[e];return(0,a.jsx)("option",{value:t.id,children:t.id},t.id)})}),(0,a.jsxs)(M.$,{type:"button",size:"sm",disabled:eZ||null!==eQ,className:"gap-2 border border-slate-200 bg-white/92 px-2 text-xs font-semibold text-slate-800 shadow-[0_16px_40px_rgba(15,23,42,0.12)] backdrop-blur hover:bg-violet-600 hover:text-white disabled:cursor-not-allowed disabled:opacity-55 sm:px-3",onClick:()=>tf(),"aria-label":t.scene.screenshot,children:[(0,a.jsx)(c.A,{className:"size-4"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"screenshot"===eQ?t.scene.screenshotPreparing:t.scene.screenshot})]}),(0,a.jsxs)(M.$,{type:"button",size:"sm",disabled:eZ||null!==eQ,className:"gap-2 border border-slate-200 bg-white/92 px-2 text-xs font-semibold text-slate-800 shadow-[0_16px_40px_rgba(15,23,42,0.12)] backdrop-blur hover:bg-violet-600 hover:text-white disabled:cursor-not-allowed disabled:opacity-55 sm:px-3",onClick:tw,"aria-label":t.scene.panorama,children:[(0,a.jsx)(d.A,{className:"size-4"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"panorama"===eQ?t.scene.panoramaPreparing:t.scene.panorama})]}),(0,a.jsxs)(M.$,{type:"button",size:"sm",disabled:eZ||null!==eQ,className:"gap-2 border border-violet-200 bg-white/92 px-2 text-xs font-semibold text-violet-700 shadow-[0_16px_40px_rgba(15,23,42,0.12)] backdrop-blur hover:bg-violet-600 hover:text-white disabled:cursor-not-allowed disabled:opacity-55 sm:px-3",onClick:()=>tx(),"aria-label":t.scene.spin360,children:[(0,a.jsxs)("span",{className:"relative grid size-4 shrink-0 place-items-center",children:[(0,a.jsx)(u.A,{className:"size-4"}),(0,a.jsx)(h.A,{className:"absolute -bottom-1 -right-1 size-2.5 rounded-full bg-sky-500 text-white"})]}),(0,a.jsx)("span",{className:"sm:hidden",children:"spin360"===eQ?t.scene.spin360PreparingShort:t.scene.spin360Short}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"spin360"===eQ?t.scene.spin360Preparing:t.scene.spin360})]})]}):null,e1?(0,a.jsx)("div",{className:"fixed inset-0 z-50 grid place-items-center bg-slate-950/86 px-4 py-[max(1rem,env(safe-area-inset-top))] backdrop-blur-md",role:"dialog","aria-modal":"true","aria-label":t.scene.mobileSavePreviewTitle,onClick:ts,children:(0,a.jsxs)("div",{className:"grid w-full max-w-[min(92vw,32rem)] gap-3",onClick:e=>e.stopPropagation(),children:[(0,a.jsx)("button",{type:"button",className:"justify-self-end rounded-full border border-white/20 bg-white/8 px-4 py-2 text-sm font-semibold text-slate-100 shadow-[0_12px_36px_rgba(0,0,0,0.3)] backdrop-blur hover:bg-white/14",onClick:ts,children:t.scene.mobileSavePreviewClose}),(0,a.jsx)("p",{className:"rounded-lg border border-sky-300/20 bg-[#08111d]/92 px-4 py-3 text-center text-sm leading-6 text-sky-50 shadow-[0_18px_60px_rgba(0,0,0,0.34)]",children:"video"===e1.kind?e1.isHosted?t.scene.mobileSaveVideoCompatibilityReady:e3?t.scene.mobileSaveVideoCompatibilityHint:t.scene.mobileSaveVideoHint:t.scene.mobileSaveImageHint}),(0,a.jsx)("div",{className:"overflow-hidden rounded-xl border border-sky-300/18 bg-[#070b11] shadow-[0_24px_90px_rgba(0,0,0,0.5)]",children:"video"===e1.kind?(0,a.jsx)("video",{src:e1.src,controls:!0,playsInl
1ine:!0,className:"block max-h-[72svh] w-full bg-black",style:{WebkitTouchCallout:"default",WebkitUserSelect:"auto",userSelect:"auto"}}):(0,a.jsx)("img",{src:e1.src,alt:e1.filename,className:"block max-h-[72svh] w-full object-contain",style:{WebkitTouchCallout:"default",WebkitUserSelect:"auto",userSelect:"auto",touchAction:"manipulation"}})}),(0,a.jsxs)("div",{className:"grid gap-2 sm:grid-cols-2",children:[(0,a.jsx)("button",{type:"button",disabled:e4,onClick:tm,className:"inline-flex min-h-11 items-center justify-center rounded-lg border border-sky-300/30 bg-sky-500 px-4 text-sm font-semibold text-white shadow-[0_18px_50px_rgba(14,165,233,0.28)] hover:bg-sky-400 disabled:cursor-wait disabled:opacity-70",children:"video"===e1.kind?t.scene.mobileSaveVideoAction:t.scene.mobileSaveImageAction}),"video"===e1.kind&&e3&&!e1.isHosted?(0,a.jsx)("button",{type:"button",disabled:e8,onClick:tp,className:"inline-flex min-h-11 items-center justify-center rounded-lg border border-white/20 bg-white/8 px-4 text-sm font-semibold text-slate-100 hover:bg-white/14 disabled:cursor-wait disabled:opacity-70",children:e8?t.scene.mobileSaveVideoCompatibilityPreparing:t.scene.mobileSaveVideoCompatibilityAction}):null,"video"===e1.kind&&e1.isHosted?(0,a.jsx)("a",{href:e1.downloadSrc??e1.src,download:e1.filename,className:"inline-flex min-h-11 items-center justify-center rounded-lg border border-white/20 bg-white/8 px-4 text-sm font-semibold text-slate-100 hover:bg-white/14",children:t.scene.mobileSaveVideoDownloadAction}):null]})]})}):null]})}},69394:(e,t,r)=>{r.d(t,{A:()=>a});let a=(0,r(9547).A)("camera",[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]])},86652:(e,t,r)=>{r.d(t,{A:()=>a});let a=(0,r(9547).A)("gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]])},88843:(e,t,r)=>{r.d(t,{A:()=>a});let a=(0,r(9547).A)("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]])}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.