@liveroom-tech/react-immersive 6.1.0 → 6.1.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.
- package/dist/{SequencesTab-RPJAG26Z.mjs → SequencesTab-LWGOVQ6Y.mjs} +1 -1
- package/dist/binding-builder.css +1 -1
- package/dist/binding-builder.d.mts +3 -3
- package/dist/binding-builder.d.ts +3 -3
- package/dist/binding-builder.js +27 -27
- package/dist/binding-builder.mjs +1 -1
- package/dist/chunk-5PJ5MLKE.mjs +1 -0
- package/dist/chunk-644OGSQJ.mjs +83 -0
- package/dist/{chunk-T6AYLPCC.mjs → chunk-DEFZEXTA.mjs} +1 -1
- package/dist/{chunk-PBVBZYOG.mjs → chunk-KNCABWVN.mjs} +1 -1
- package/dist/{chunk-OPZJDP7T.mjs → chunk-MLT4JQAY.mjs} +1 -1
- package/dist/chunk-OPDRK3GS.mjs +1 -0
- package/dist/{chunk-KHN55ZM7.mjs → chunk-Z2VQGUC2.mjs} +2 -2
- package/dist/hosted.css +1 -1
- package/dist/hosted.d.mts +5 -3
- package/dist/hosted.d.ts +5 -3
- package/dist/hosted.js +26 -26
- package/dist/hosted.mjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +24 -24
- package/dist/index.mjs +1 -1
- package/dist/{modelFileResolver-BEW_95id.d.mts → modelFileResolver-B8ADn9Nl.d.mts} +5 -0
- package/dist/{modelFileResolver-BEW_95id.d.ts → modelFileResolver-B8ADn9Nl.d.ts} +5 -0
- package/dist/{modelViewerProps-CbK_4uZj.d.ts → modelViewerProps-BE4D56Ti.d.ts} +1 -1
- package/dist/{modelViewerProps-C7saa0i2.d.mts → modelViewerProps-DBwh-fmu.d.mts} +1 -1
- package/dist/{publicProps-z7cJhUH8.d.ts → publicProps-3LNTAskZ.d.ts} +1 -1
- package/dist/{publicProps-NKTiohZO.d.mts → publicProps-Clr1nSE6.d.mts} +1 -1
- package/dist/simple-model-viewer.css +1 -1
- package/dist/simple-model-viewer.d.mts +2 -2
- package/dist/simple-model-viewer.d.ts +2 -2
- package/dist/simple-model-viewer.js +4 -4
- package/dist/simple-model-viewer.mjs +1 -1
- package/dist/utils.d.mts +4 -4
- package/dist/utils.d.ts +4 -4
- package/dist/utils.js +2 -2
- package/dist/utils.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-2DV2UCQH.mjs +0 -1
- package/dist/chunk-6CTCV2Q5.mjs +0 -1
- package/dist/chunk-OREKYGO3.mjs +0 -83
package/dist/utils.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var Nn=Object.create;var Ce=Object.defineProperty;var Ln=Object.getOwnPropertyDescriptor;var _n=Object.getOwnPropertyNames;var Un=Object.getPrototypeOf,zn=Object.prototype.hasOwnProperty;var Fn=(e,t)=>{for(var r in t)Ce(e,r,{get:t[r],enumerable:!0})},pt=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of _n(t))!zn.call(e,o)&&o!==r&&Ce(e,o,{get:()=>t[o],enumerable:!(n=Ln(t,o))||n.enumerable});return e};var gt=(e,t,r)=>(r=e!=null?Nn(Un(e)):{},pt(t||!e||!e.__esModule?Ce(r,"default",{value:e,enumerable:!0}):r,e)),$n=e=>pt(Ce({},"__esModule",{value:!0}),e);var _r={};Fn(_r,{ACTION_CATALOG:()=>Se,DEFAULT_MODEL_VIEWER_LABELS:()=>at,DEFAULT_SCENE_CONFIG:()=>oe,DEFAULT_SECTION_CONFIG:()=>Pt,MATERIAL_BLENDING_MODES:()=>Rt,MATERIAL_SIDES:()=>It,MAX_VIEWER_STATE_BYTES:()=>te,MEASUREMENT_UNITS:()=>Qe,SEQUENCE_EASINGS:()=>Xe,SEQUENCE_OBJECT_PROPERTIES:()=>We,applyIsolation:()=>Ot,applyProductOptions:()=>an,applyStyleRules:()=>Mt,buildBindingsFromNodes:()=>Tt,calibrateMeasurements:()=>qt,chooseMaterialVariant:()=>ke,collectObjectHierarchy:()=>bn,colorScaleValue:()=>ze,compareViewerConfigurations:()=>Dn,copyBindingStyle:()=>hn,createARHandoffUrl:()=>In,createDefaultBinding:()=>qe,decodeProductSelections:()=>en,defaultProductSelections:()=>ge,defineObjectBindings:()=>bt,encodeProductSelections:()=>it,evaluateProductConfiguration:()=>J,exportConfiguredUSDZ:()=>Mn,findCatalogAction:()=>kt,formatProductPrice:()=>Zt,generateProductSkus:()=>tn,groundAsset:()=>Nt,inferType:()=>$e,inspectAsset:()=>xn,isolatedBindingKeys:()=>Fe,material:()=>St,measurementResult:()=>nt,measurementScale:()=>tt,measurementValue:()=>Re,measurementsToCsv:()=>Ht,parseAssetTransform:()=>pe,parseMeasurements:()=>le,parseProductConfiguration:()=>sn,parseProductDefinition:()=>ot,parseSceneProduct:()=>Ee,parseSectionConfig:()=>xe,parseSelectionSets:()=>Pe,parseSequences:()=>Ie,parseViewerState:()=>be,pasteBindingStyle:()=>yn,patchBindings:()=>je,patchSceneConfig:()=>xt,prepareViewerState:()=>De,productCheckoutUrl:()=>Qt,productDefinitionWarnings:()=>nn,productOptionStates:()=>rn,productPriceFromDefinition:()=>Jt,readARHandoffUrl:()=>Rn,resolveProductSelections:()=>Be,sampleSequenceTrack:()=>Et,sceneLight:()=>wt,sectionSnapshot:()=>Bt,selectBindingKeys:()=>H,selectBindings:()=>yt,serializeMeasurements:()=>Gt,serializeProductConfiguration:()=>on,serializeViewerState:()=>gn,snapAssetToGrid:()=>Vt,upsertSequenceKeyframe:()=>Dt});module.exports=$n(_r);function bt(e){return e}function _e(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function he(e,t){if(!_e(t))return t;let r=_e(e)?{...e}:{};for(let n of Object.keys(t)){let o=t[n];r[n]=_e(o)?he(r[n],o):o}return r}function ht(e,t){if(e[t])return t;let r=Object.entries(e).find(([,o])=>o.id===t)?.[0];return r||(Object.entries(e).find(([,o])=>o.modelObjectId===t)?.[0]??null)}function qn(e){return typeof e=="object"&&!Array.isArray(e)}function Gn(e,t){return"group"in t?e.group===t.group:"tag"in t?e.tags?.includes(t.tag)??!1:(e.type??"other")===t.type}function H(e,t){if(qn(t))return Object.entries(e).filter(([,o])=>Gn(o,t)).map(([o])=>o);let n=(typeof t=="string"?[t]:t).map(o=>ht(e,o)).filter(o=>o!==null);return[...new Set(n)]}function yt(e,t){return H(e,t).map(r=>e[r]).filter(r=>r!==void 0)}function Hn(e){return Array.isArray(e)&&e.length>0&&typeof e[0]!="string"}function je(e,t,r){let n=Hn(t)?t:[{ids:t,patch:r??{}}],o=e;for(let i of n)for(let a of H(o,i.ids)){let s=o[a];if(!s)continue;let c=he(s,i.patch);o===e&&(o={...e}),o[a]=c}return o}function St(e){return{style:{material:e}}}function xt(e,t){return he(e,t)}var Kn={type:"point",color:"#ffffff",intensity:1,position:[0,0,0],distance:0,decay:2,attachedToCamera:!1,castShadow:!1,shadowBias:-5e-4,visible:!0};function wt(e){return{...Kn,...e}}var Wn="#ff3b30",Xn=Object.freeze({}),vt=e=>e;function Yn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Jn(e,t){let r=e.metadata;for(let n of t.split(".")){if(!Yn(r))return;r=r[n]}return r}function Zn(e,t){if("metric"in t){let r=e.metrics?.[t.metric];return!(typeof r!="number"||!Number.isFinite(r)||t.above!==void 0&&!(r>t.above)||t.below!==void 0&&!(r<t.below))}if("status"in t){let r=e.status??"normal";return Array.isArray(t.status)?t.status.includes(r):t.status===r}return Jn(e,t.metadata)===t.equals}function Qn(e){let t=e.trim().replace(/^#/,""),r=t.length===3?t.split("").map(n=>n+n).join(""):t;return/^[0-9a-f]{6}$/i.test(r)?[0,2,4].map(n=>parseInt(r.slice(n,n+2),16)):null}var Ue=e=>`#${e.map(t=>Math.round(t).toString(16).padStart(2,"0")).join("")}`;function ze(e,t){let r=e.map(([c,d])=>({at:c,rgb:Qn(d)})).filter(c=>Number.isFinite(c.at)&&c.rgb!==null).sort((c,d)=>c.at-d.at);if(r.length===0||!Number.isFinite(t))return null;if(t<=r[0].at)return Ue(r[0].rgb);let n=r[r.length-1];if(t>=n.at)return Ue(n.rgb);let o=r.findIndex(c=>c.at>=t),i=r[o-1],a=r[o],s=a.at===i.at?1:(t-i.at)/(a.at-i.at);return Ue(i.rgb.map((c,d)=>c+(a.rgb[d]-c)*s))}function Mt(e,t){if(!t?.length)return{bindings:e,pulses:Xn,sourceOf:vt};let r=new Map,n={};for(let a of t){let s=a.target?H(e,a.target):Object.keys(e),c=a.when?Array.isArray(a.when)?a.when:[a.when]:[];for(let d of s){let l=e[d];if(!c.every(m=>Zn(l,m)))continue;let u={...a.material};if(a.colorScale){let m=l.metrics?.[a.colorScale.metric],f=typeof m=="number"?ze(a.colorScale.stops,m):null;f&&(u={...u,[a.colorScale.channel??"baseColor"]:f})}if(a.pulse){let m=a.pulse===!0?{}:a.pulse;n[d]={color:m.color??Wn,speed:m.speed!==void 0&&m.speed>0?m.speed:1};let f=u.emissiveIntensity??r.get(d)?.emissiveIntensity??l.style?.material?.emissiveIntensity;f!==void 0&&f>0||(u.emissiveIntensity=1)}Object.keys(u).length>0&&r.set(d,{...r.get(d),...u})}}if(r.size===0)return{bindings:e,pulses:n,sourceOf:vt};let o={...e},i=new WeakMap;for(let[a,s]of r){let c=e[a],d={...c,style:{...c.style,material:{...c.style?.material,...s}}};o[a]=d,i.set(d,c)}return{bindings:o,pulses:n,sourceOf:a=>i.get(a)??a}}function ke(e,t,r){let n=r.find(i=>i.variants.some(a=>a.name===t)),o=new Set(n?.variants.map(i=>i.name)??[t]);return[...e.filter(i=>!o.has(i)),t]}var er=.12,At=new Set;function Fe(e,t){return t?new Set(H(e,t.target)):At}function Ot(e,t){let r=Fe(e.bindings,t);if(!t||r.size===0)return{...e,setAside:At};let n=Math.min(Math.max(t.ghostOpacity??er,0),1),o={...e.bindings},i=new WeakMap,a=new Set;for(let[s,c]of Object.entries(e.bindings)){if(r.has(s))continue;a.add(s);let d=t.mode==="hide"?{...c,visible:!1}:{...c,style:{...c.style,material:{...c.style?.material,opacity:Math.min(c.style?.material?.opacity??1,n)}}};o[s]=d,i.set(d,e.sourceOf(c))}return{bindings:o,pulses:e.pulses,sourceOf:s=>i.get(s)??e.sourceOf(s),setAside:a}}var tr=require("three"),Ct=Symbol("react-immersive.model-node-id");function nr(e,t){Object.defineProperty(e,Ct,{value:t,configurable:!0})}function jt(e){let t=new Map;e.traverse(c=>{if(!c.name)return;let d=t.get(c.name);d?d.push(c):t.set(c.name,[c])});let r=Object.create(null),n=new WeakMap,o=new Map,i=new Set(Array.from(t,([c,d])=>d.length===1?c:null).filter(c=>c!==null)),a=new Set,s=(c,d)=>{nr(c,d),r[d]=c,n.set(c,d),a.add(d)};for(let[c,d]of t)d.length===1&&s(d[0],c);for(let[c,d]of t){if(d.length<2)continue;let l=[];d.forEach((u,m)=>{let f=`${c} [${m+1}]`,w=f,C=2;for(;i.has(w)||a.has(w);)w=`${f}.${C++}`;s(u,w),l.push(w)}),o.set(c,l)}return{nodesById:r,idByNode:n,duplicateNames:o}}function ye(e){return e[Ct]??e.name??null}var Se=Object.freeze([{id:"change-color",label:"Change Color",handling:"viewer",description:"Opens a color picker docked under the action and commits the result to style.material.baseColor."},{id:"change-material",label:"Change Material",handling:"viewer",description:"Opens the material picker so the viewer can swap the object's texture."},{id:"add-text",label:"Add Text",handling:"viewer",description:"Opens a text box docked under the action; the viewer's user types, clicks the object to place it, and can resize, turn, move, or remove it. Saved to the binding's decals."},{id:"add-image",label:"Add Image",handling:"viewer",description:"Lets the viewer's user choose an image, click the object to place it, and resize, turn, move, or remove it. Saved to the binding's decals."},{id:"toggle-visibility",label:"Toggle Visibility",handling:"viewer",description:"Flips the binding's visible flag."},{id:"toggle-light",label:"Toggle Light",handling:"viewer",description:"Turns the scene lights attached to this object on or off, or the object's own glow when none is attached."},{id:"change-light-color",label:"Change Light Color",handling:"viewer",description:"Opens a color picker docked under the action for the scene lights attached to this object, or the object's own glow."},{id:"set-brightness",label:"Set Brightness",handling:"viewer",description:"Opens a brightness slider docked under the action for the scene lights attached to this object, or the object's own glow."}]);function kt(e){return Se.find(t=>t.id===e)}var oo=Se.filter(e=>e.handling==="viewer").map(e=>e.id),io=new Set(["","New Action",...Se.map(e=>e.label)]);function rr(e){return e.trim().replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").replace(/[^a-zA-Z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase()}function or(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,t=>t.toUpperCase())}function $e(e){let t=e.toLowerCase();return t.includes("light")?"light":t.includes("wheel")||t.includes("rim")||t.includes("tire")?"wheel":t.includes("glass")||t.includes("window")||t.includes("windshield")||t.includes("sunroof")?"glass":t.includes("seat")||t.includes("dashboard")||t.includes("console")||t.includes("doorpanel")?"interior":t.includes("floor")?"floor":t.includes("wall")?"wall":t.includes("door")?"door":t.includes("chair")||t.includes("table")||t.includes("sofa")||t.includes("bed")?"furniture":"other"}function ir(e,t=!0){return e==="light"||e.endsWith("light")?[{id:"toggle-light",label:"Toggle Light",type:"command"},{id:"change-light-color",label:"Change Light Color",type:"command"},{id:"set-brightness",label:"Set Brightness",type:"command"}]:[{id:"change-color",label:"Change Color",type:"command"},...t?[{id:"change-material",label:"Change Material",type:"command"}]:[],{id:"toggle-visibility",label:"Toggle Visibility",type:"command"}]}function qe(e,t=!0){let r=$e(e);return{id:rr(e),modelObjectId:e,type:r,label:or(e),status:"normal",selectable:!0,hoverable:!0,visible:!0,style:{},actions:ir(r,t),metrics:{},metadata:{}}}function Tt(e,t){return Object.fromEntries(e.map(r=>[r,qe(r,!t?.has(r))]))}var It=["front","back","double"],Rt=["normal","additive"];var Pt={enabled:!1,axis:"y",position:.5,flip:!1},sr={clips:[],autoplayClip:null},ar={autofocus:{enabled:!1,focusDistance:5,focusRange:5,focalLength:.02,bokehScale:6,target:[0,0,0],mouse:!0,debug:0,manual:!1,smoothTime:.25},toneMapping:{enabled:!1,mode:"aces",exposure:1,resolution:256,whitePoint:4,middleGrey:.6,minLuminance:.01,averageLuminance:1,adaptationRate:1},brightnessContrast:{enabled:!1,brightness:0,contrast:0},hueSaturation:{enabled:!1,hue:0,saturation:0},colorAverage:{enabled:!1},dotScreen:{enabled:!1,angle:Math.PI/2,scale:1},glitch:{enabled:!1,mode:"sporadic",delay:[1.5,3.5],duration:[.6,1],strength:[.3,1],chromaticAberrationOffset:[0,0],columns:.05,ratio:.85},ssao:{enabled:!1,samples:30,rings:4,intensity:8,radius:.25,bias:.025,luminanceInfluence:.6,fade:.01,minRadiusScale:.33,worldDistanceThreshold:20,worldDistanceFalloff:5,worldProximityThreshold:6,worldProximityFalloff:3},bloom:{enabled:!1,intensity:.3,luminanceThreshold:.9,luminanceSmoothing:.2,mipmapBlur:!0,radius:0,levels:8},godRays:{enabled:!1,sunPosition:[5,10,5],samples:60,density:.96,decay:.9,weight:.4,exposure:.6,clampMax:1,blur:!0,kernelSize:"small"},grid:{enabled:!1,scale:1,lineWidth:0},noise:{enabled:!1,opacity:1,premultiply:!1},depthOfField:{enabled:!1,focusDistance:5,focusRange:5,focalLength:.02,bokehScale:6},chromaticAberration:{enabled:!1,offsetX:.002,offsetY:.002,radialModulation:!1,modulationOffset:.15},lensflare:{enabled:!1,lensPosition:[-25,6,-60],smoothTime:.07,glareSize:.2,flareSize:.01,flareSpeed:.01,flareShape:.01,animated:!0,anamorphic:!1,colorGain:"#141414",haloScale:.5,secondaryGhosts:!0,aditionalStreaks:!0,ghostScale:0,opacity:1,starBurst:!1},vignette:{enabled:!1,offset:.3,darkness:.3,eskil:!1},smaa:{enabled:!1},sepia:{enabled:!1,intensity:0},scanline:{enabled:!1,density:1.25},pixelation:{enabled:!1,granularity:5},outline:{enabled:!1,selectionLayer:10,edgeStrength:2.5,pulseSpeed:0,visibleEdgeColor:"#ffffff",hiddenEdgeColor:"#22090a",kernelSize:"large",blur:!1,xRay:!0},selectiveBloom:{enabled:!1,selectionLayer:10,intensity:1,luminanceThreshold:.9,luminanceSmoothing:.025,kernelSize:"large",mipmapBlur:!0,inverted:!1,ignoreBackground:!1},ramp:{enabled:!1,rampType:"linear",rampStart:[.5,.5],rampEnd:[1,1],startColor:"#000000",endColor:"#ffffff",opacity:.5,rampBias:.5,rampGain:.5,rampMask:!1,rampInvert:!1}},oe={model:{rotation:[0,0,0],showAdvancedRotation:!1,renderer:"pbr",shading:"lit",autoRotate:!1,autoRotateSpeed:1},camera:{fieldOfView:50,showAdvancedSettings:!1},lighting:{ambient:{intensity:.25,color:"#ffffff"},lights:[{id:"light-hemi",type:"hemisphere",color:"#ffffff",intensity:.3,position:[0,1,0],attachedToCamera:!1,castShadow:!1,shadowBias:-5e-4,visible:!0},{id:"light-key",type:"directional",color:"#ffffff",intensity:2.5,position:[6,12,6],attachedToCamera:!1,castShadow:!0,shadowBias:-5e-4,visible:!0},{id:"light-fill",type:"directional",color:"#ffffff",intensity:0,position:[-6,8,-6],attachedToCamera:!1,castShadow:!1,shadowBias:-5e-4,visible:!0}]},shadows:{enabled:!0,mapSize:2048,bias:-5e-4,normalBias:.02,radius:3},environment:{source:"preset",preset:"apartment",customEnvironmentUrl:"",intensity:.25,rotation:0,shadowLight:{enabled:!1,intensity:2.5,bias:-5e-4}},wireframe:{enabled:!1,color:"#000000",opacity:1},background:{enabled:!1,type:"color",color:"#1c1c1d",imageUrl:""},groundShadows:{enabled:!1,mode:"shadowCatcher",intensity:.7,borderFade:1,height:0,size:10},postProcessing:ar,animations:sr,annotations:[]};function xe(e){let t=l=>{throw new Error(`Invalid section: ${l}`)},r=l=>l&&typeof l=="object"&&!Array.isArray(l)?l:t("expected an object"),n=l=>typeof l=="string"&&l.trim().length>0&&l.length<=200?l:t("expected a nonempty name or id (up to 200 characters)"),o=l=>typeof l=="number"&&Number.isFinite(l)&&l>=0&&l<=1?l:t("position must be between 0 and 1"),i=l=>!Array.isArray(l)||l.length!==3||!l.every(u=>typeof u=="number"&&Number.isFinite(u))||Math.hypot(...l)<1e-8?t("normal must be a finite, nonzero vector"):[...l],a=l=>{let u=r(l);return!["x","y","z"].includes(u.axis)||typeof u.enabled!="boolean"||typeof u.flip!="boolean"?t("invalid plane"):{enabled:u.enabled,axis:u.axis,position:o(u.position),flip:u.flip,...u.normal!==void 0?{normal:i(u.normal)}:{}}},s=l=>{let u=r(l),m=a(u);if(u.mode!==void 0){if(!["plane","planes","box"].includes(u.mode))return t("invalid mode");m.mode=u.mode}if(u.planes!==void 0){if(!Array.isArray(u.planes)||u.planes.length>6)return t("at most six planes are supported");let f=new Set;m.planes=u.planes.map(w=>{let C=r(w),b=n(C.id);return f.has(b)?t("duplicate plane id"):(f.add(b),{...a(C),id:b,name:n(C.name)})})}if(u.activePlaneId!==void 0&&(m.activePlaneId=n(u.activePlaneId)),u.invertBox!==void 0){if(typeof u.invertBox!="boolean")return t("invalid box inversion");m.invertBox=u.invertBox}if(u.box!==void 0){let f=r(u.box),w=p=>!Array.isArray(p)||p.length!==3?t("invalid box bounds"):p.map(o),C=w(f.min),b=w(f.max);if(C.some((p,h)=>p>=b[h]))return t("box minimum must be below its maximum on every axis");m.box={min:C,max:b}}return m},c=r(e),d=s(c);if(c.presets!==void 0){if(!Array.isArray(c.presets)||c.presets.length>32)return t("at most 32 presets are supported");let l=new Set;d.presets=c.presets.map(u=>{let m=r(u),f=n(m.id);return l.has(f)?t("duplicate preset id"):(l.add(f),{id:f,name:n(m.name),settings:s(m.settings)})})}return d}function Bt(e){let{presets:t,...r}=xe(e);return r}var Ke=require("three"),We=["position","rotation","scale","visible","baseColor","emissive","opacity","roughness","metalness","emissiveIntensity"],Xe=["linear","ease-in","ease-out","ease-in-out","step"],cr=new Set(["position","rotation","scale"]),lr=new Set(["baseColor","emissive"]),se=e=>typeof e=="string"&&e.length>0&&e.length<=256,ce=e=>typeof e=="number"&&Number.isFinite(e),Ge=e=>Array.isArray(e)&&e.length===3&&e.every(ce);function we(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function ae(e){throw new Error(`Invalid sequences: ${e}`)}function dr(e){return e.kind==="object"?JSON.stringify([e.kind,e.objectId,e.property]):e.kind==="clip"?JSON.stringify([e.kind,e.clip]):"camera"}function ur(e,t){if(t.kind==="camera")return we(e)&&Ge(e.position)&&Ge(e.target)&&(e.fov===null||ce(e.fov)&&e.fov>0&&e.fov<180)&&ce(e.zoom)&&e.zoom>0;if(t.kind==="clip")return ce(e)&&e>=0;let r=t.property;return cr.has(r)?Ge(e)&&(r!=="scale"||e.every(n=>n!==0)):lr.has(r)?typeof e=="string"&&/^#[\da-f]{6}$/i.test(e):r==="visible"?typeof e=="boolean":ce(e)&&e>=0&&(r==="emissiveIntensity"||e<=1)}function Ie(e){(!Array.isArray(e)||e.length>64)&&ae("expected up to 64 sequences.");let t=new Set,r=0;return e.map(n=>{(!we(n)||!se(n.id)||t.has(n.id)||!(typeof n.name=="string"&&se(n.name.trim()))||!ce(n.duration)||n.duration<.1||n.duration>3600||typeof n.loop!="boolean"||typeof n.autoPlay!="boolean"||!Array.isArray(n.tracks)||n.tracks.length>128)&&ae("each sequence needs a unique id, name, 0.1\u20133600 second duration, loop/autoplay flags and up to 128 tracks."),t.add(n.id);let o=new Set,i=new Set,a=n.tracks.map(s=>{(!we(s)||!se(s.id)||o.has(s.id)||!(typeof s.name=="string"&&se(s.name.trim()))||!we(s.target)||!Array.isArray(s.keyframes)||s.keyframes.length>2048||s.muted!==void 0&&typeof s.muted!="boolean")&&ae("invalid or duplicate track."),o.add(s.id);let c;s.target.kind==="camera"?c={kind:"camera"}:s.target.kind==="clip"&&se(s.target.clip)?c={kind:"clip",clip:s.target.clip}:s.target.kind==="object"&&se(s.target.objectId)&&We.includes(s.target.property)?c={kind:"object",objectId:s.target.objectId,property:s.target.property}:ae("unknown track target or property.");let d=dr(c);i.has(d)&&ae("only one track may own each target property in a sequence."),i.add(d);let l=new Set,u=new Set,m=s.keyframes.map(f=>{++r>2e4&&ae("too many keyframes."),(!we(f)||!se(f.id)||l.has(f.id)||!ce(f.time)||f.time<0||f.time>n.duration||u.has(f.time)||f.easing!==void 0&&!Xe.includes(f.easing)||!ur(f.value,c))&&ae("keyframes need unique ids/times, valid values and times inside the sequence."),l.add(f.id),u.add(f.time);let w=f.value,C=c.kind==="camera"?{position:[...w.position],target:[...w.target],fov:w.fov,zoom:w.zoom}:Array.isArray(f.value)?[...f.value]:f.value;return{id:f.id,time:f.time,value:C,...f.easing?{easing:f.easing}:{}}}).sort((f,w)=>f.time-w.time);return{id:s.id,name:s.name.trim(),target:c,keyframes:m,...s.muted!==void 0?{muted:s.muted}:{}}});return{id:n.id,name:n.name.trim(),duration:n.duration,loop:n.loop,autoPlay:n.autoPlay,tracks:a}})}function mr(e,t="ease-in-out"){let r=Math.max(0,Math.min(1,e));return t==="step"?0:t==="ease-in"?r*r:t==="ease-out"?1-(1-r)**2:t==="ease-in-out"?r*r*(3-2*r):r}var Te=(e,t,r)=>e+(t-e)*r,He=(e,t,r)=>e.map((n,o)=>Te(n,t[o],r));function Et(e,t){if(e.muted||!e.keyframes.length||!Number.isFinite(t))return null;let r=e.keyframes;if(t<r[0].time)return null;let n=r[0],o;for(let c of r)if(c.time<=t)n=c;else{o=c;break}if(!o||typeof n.value=="boolean")return structuredClone(n.value);let i=mr((t-n.time)/(o.time-n.time),n.easing);if(typeof n.value=="number"&&typeof o.value=="number")return Te(n.value,o.value,i);if(typeof n.value=="string"&&typeof o.value=="string")return`#${new Ke.Color(n.value).lerp(new Ke.Color(o.value),i).getHexString()}`;if(Array.isArray(n.value)&&Array.isArray(o.value))return He(n.value,o.value,i);let a=n.value,s=o.value;return{position:He(a.position,s.position,i),target:He(a.target,s.target,i),fov:a.fov!==null&&s.fov!==null?Te(a.fov,s.fov,i):a.fov,zoom:Te(a.zoom,s.zoom,i)}}function Dt(e,t){return{...e,keyframes:[...e.keyframes.filter(r=>r.id!==t.id&&Math.abs(r.time-t.time)>1e-6),t].sort((r,n)=>r.time-n.time)}}var K=require("three");function Ye(e){return e.id??e.url}function pe(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Expected an asset transform object.");let t={};for(let r of["position","rotation","scale"]){let n=e[r];if(n!==void 0){if(!Array.isArray(n)||n.length!==3||!n.every(o=>typeof o=="number"&&Number.isFinite(o))||r==="scale"&&n.some(o=>o===0))throw new Error(`Invalid asset ${r}: expected three finite ${r==="scale"?"nonzero ":""}numbers.`);t[r]=[...n]}}return t}function Vt(e,t){if(!Number.isFinite(t)||t<=0)throw new Error("Grid size must be positive.");let r=pe(e),[n,o,i]=r.position??[0,0,0];return{...r,position:[Math.round(n/t)*t,o,Math.round(i/t)*t]}}function Nt(e,t){let r=pe(e),n=r.position??[0,0,0],o=new K.Matrix4().compose(new K.Vector3(...n),new K.Quaternion().setFromEuler(new K.Euler(...r.rotation??[0,0,0])),new K.Vector3(...r.scale??[1,1,1])),i=new K.Box3(new K.Vector3(...t.min),new K.Vector3(...t.max)).applyMatrix4(o);if(!Number.isFinite(i.min.y))throw new Error("Cannot place an asset with empty bounds.");return{...r,position:[n[0],n[1]-i.min.y,n[2]]}}var Q=require("three"),fr=new Map,Je={color:"#93c5fd",intensity:.07},po=new Q.Color(Je.color).multiplyScalar(Je.intensity),go=new Q.Color(Je.color);var pr=new Map;function Lt(e){return pr.get(e)}function _t(e){for(let t of fr.values())if(t.texture.source===e.source&&(!t.loaded||t.failed))return!0;return!1}var B=require("three");function Ut(e){if(e.length!==3)return null;let t=new B.Vector3(...e[0]).sub(new B.Vector3(...e[1])),r=new B.Vector3(...e[2]).sub(new B.Vector3(...e[1]));return t.lengthSq()===0||r.lengthSq()===0?null:Math.acos(Math.max(-1,Math.min(1,t.normalize().dot(r.normalize()))))*180/Math.PI}function zt(e,t){if(!e.normal)return null;let r=new B.Vector3(...e.normal);if(r.lengthSq()===0)return null;r.normalize();let n=new B.Vector3(...t),o=n.clone().sub(new B.Vector3(...e.position)).dot(r);return{distance:Math.abs(o),projection:n.addScaledVector(r,-o).toArray()}}function Ft(e){if(e.length<3)return{error:"Pick at least three points to finish the area."};let t=new B.Vector3(...e[0]),r=e.map(b=>new B.Vector3(...b).sub(t)),n=Math.max(...r.map(b=>b.length()));if(n===0)return{error:"Area points must be distinct."};let o=new B.Vector3;for(let b=1;b<r.length-1;b+=1){let p=r[b].clone().cross(r[b+1]);p.lengthSq()>o.lengthSq()&&o.copy(p)}if(o.length()<=n*n*1e-10)return{error:"Area points must not lie on one straight line."};o.normalize();let i=Math.max(n*1e-5,Number.EPSILON*Math.max(...e.flat().map(Math.abs))*32);if(r.some(b=>Math.abs(b.dot(o))>i))return{error:"Area points must lie on one plane."};let a=r.find(b=>b.length()>n*1e-10).clone().normalize(),s=o.clone().cross(a).normalize(),c=r.map(b=>new B.Vector2(b.dot(a),b.dot(s))),d=(b,p,h)=>(p.x-b.x)*(h.y-b.y)-(p.y-b.y)*(h.x-b.x),l=n*n*1e-10,u=(b,p,h)=>Math.abs(d(b,p,h))<=l&&h.x>=Math.min(b.x,p.x)-n*1e-10&&h.x<=Math.max(b.x,p.x)+n*1e-10&&h.y>=Math.min(b.y,p.y)-n*1e-10&&h.y<=Math.max(b.y,p.y)+n*1e-10;for(let b=0;b<c.length;b+=1){let p=c[b],h=c[(b+1)%c.length];if(p.distanceTo(h)<=n*1e-10)return{error:"Area points must be distinct."};for(let v=b+1;v<c.length;v+=1){if(v===b+1||b===0&&v===c.length-1)continue;let A=c[v],y=c[(v+1)%c.length],P=d(p,h,A),V=d(p,h,y),re=d(A,y,p),x=d(A,y,h);if(P*V<0&&re*x<0||u(p,h,A)||u(p,h,y)||u(A,y,p)||u(A,y,h))return{error:"Area edges must not cross or touch each other."}}}let m=0,f=0,w=0;for(let b=0;b<c.length;b+=1){let p=c[b],h=c[(b+1)%c.length],v=p.x*h.y-h.x*p.y;m+=v,f+=(p.x+h.x)*v,w+=(p.y+h.y)*v}if(Math.abs(m)<=l)return{error:"The polygon has no measurable area."};let C=t.clone().addScaledVector(a,f/(3*m)).addScaledVector(s,w/(3*m));return{area:Math.abs(m)/2,center:C.toArray(),triangles:B.ShapeUtils.triangulateShape(c,[])}}function $t(e,t){if(e.length<2)return 0;let r=0;for(let n=1;n<e.length;n+=1)r+=new B.Vector3(...e[n]).distanceTo(new B.Vector3(...e[n-1]));return t&&(r+=new B.Vector3(...e[e.length-1]).distanceTo(new B.Vector3(...e[0]))),r}var Qe=["m","cm","mm","in","ft"],Ze={m:1,cm:.01,mm:.001,in:.0254,ft:.3048},gr=["distance","angle","area","pointToPlane","wrap","wrapHorizontal"];function et(e){return Qe.includes(e)}function tt(e={},t="m"){let r=e.displayUnit??t,n=e.metersPerUnit??Ze[e.sourceUnit??"m"];if(!Number.isFinite(n)||n<=0)throw new Error("Measurement scale must be a positive finite number.");return{displayUnit:r,metersPerUnit:n,factor:et(r)?n/Ze[r]:1}}function qt(e,t,r,n={}){if(!et(r)||!Number.isFinite(e)||e<=0||!Number.isFinite(t)||t<=0)throw new Error("Calibration needs two distinct points and a positive known distance.");let o=t*Ze[r]/e;if(!Number.isFinite(o)||o<=0)throw new Error("Calibration scale is outside the supported range.");return{...n,metersPerUnit:o}}function Re(e,t){let r=t.map(n=>n.position);if(e==="angle"){let n=Ut(r);return n===null?null:{value:n,dimension:0}}if(e==="area"){let n=Ft(r);return"error"in n?null:{value:n.area,dimension:2}}if(e==="pointToPlane"){let n=t.length===2?zt(t[0],t[1].position):null;return n?{value:n.distance,dimension:1}:null}return t.length<(e==="distance"?2:3)?null:{value:$t(r,e!=="distance"),dimension:1}}function nt(e,t={},r="m",n=e.points,o=e.approximate?"approximate":"ready"){let i=Re(e.tool,n),{factor:a,displayUnit:s}=tt(t,r),c=o==="ready"||o==="approximate",d=c&&i?i.value*a**i.dimension:null;return{id:e.id,status:c?i&&d!==null&&Number.isFinite(d)?o:"invalid":o,rawValue:c&&i&&Number.isFinite(i.value)?i.value:null,value:d!==null&&Number.isFinite(d)?d:null,unit:e.tool==="angle"?"\xB0":e.tool==="area"?`${s}\xB2`:s}}function le(e){function t(){throw new Error("Invalid measurements: expected settings and valid named measurements with finite points.")}let r=s=>!!s&&typeof s=="object"&&!Array.isArray(s),n=s=>Array.isArray(s)&&s.length===3&&s.every(c=>typeof c=="number"&&Number.isFinite(c));typeof e=="string"&&(e.length>5*1024*1024&&t(),e=JSON.parse(e)),(!r(e)||e.version!==void 0&&e.version!==1||!r(e.settings)||!Array.isArray(e.items)||e.items.length>256)&&t();let o={};for(let s of["sourceUnit","displayUnit"])e.settings[s]!==void 0&&(et(e.settings[s])||t(),o[s]=e.settings[s]);e.settings.metersPerUnit!==void 0&&((typeof e.settings.metersPerUnit!="number"||!Number.isFinite(e.settings.metersPerUnit)||e.settings.metersPerUnit<=0)&&t(),o.metersPerUnit=e.settings.metersPerUnit);let i=new Set,a=e.items.map(s=>{(!r(s)||typeof s.id!="string"||!s.id||i.has(s.id)||typeof s.name!="string"||!s.name.trim()||typeof s.modelId!="string"||!s.modelId||!gr.includes(s.tool)||!Array.isArray(s.points)||s.points.length>8192||typeof s.createdAt!="string"||!Number.isFinite(Date.parse(s.createdAt)))&&t(),i.add(s.id),s.tilesetUrl!==void 0&&s.tilesetUrl!==null&&typeof s.tilesetUrl!="string"&&t(),(s.visible!==void 0&&typeof s.visible!="boolean"||s.approximate!==void 0&&typeof s.approximate!="boolean")&&t();let c=new Set,d=s.points.map(u=>{if((!r(u)||typeof u.id!="number"||!Number.isFinite(u.id)||!n(u.position))&&t(),c.has(u.id)&&t(),c.add(u.id),u.normal!==void 0&&!n(u.normal)&&t(),u.faceVertices!==void 0&&(!Array.isArray(u.faceVertices)||u.faceVertices.length!==3||!u.faceVertices.every(n))&&t(),u.snapped!==void 0&&!["vertex","edge"].includes(u.snapped)&&t(),u.anchor!==void 0){let f=u.anchor;(!r(f)||typeof f.nodeId!="string"||!f.nodeId||!n(f.localPosition)||typeof f.geometrySignature!="string"||typeof f.poseSignature!="string")&&t(),f.localNormal!==void 0&&!n(f.localNormal)&&t(),f.localFaceVertices!==void 0&&(!Array.isArray(f.localFaceVertices)||f.localFaceVertices.length!==3||!f.localFaceVertices.every(n))&&t(),f.instanceId!==void 0&&(!Number.isInteger(f.instanceId)||f.instanceId<0)&&t()}let m=u.anchor;return{id:u.id,position:[...u.position],...u.normal?{normal:[...u.normal]}:{},...u.faceVertices?{faceVertices:u.faceVertices.map(f=>[...f])}:{},...u.snapped?{snapped:u.snapped}:{},...m?{anchor:{nodeId:m.nodeId,localPosition:[...m.localPosition],geometrySignature:m.geometrySignature,poseSignature:m.poseSignature,...m.localNormal?{localNormal:[...m.localNormal]}:{},...m.localFaceVertices?{localFaceVertices:m.localFaceVertices.map(f=>[...f])}:{},...m.instanceId!==void 0?{instanceId:m.instanceId}:{}}}:{}}}),l={id:s.id,name:s.name,modelId:s.modelId,tool:s.tool,points:d,createdAt:s.createdAt,...s.tilesetUrl!==void 0?{tilesetUrl:s.tilesetUrl}:{},...s.visible!==void 0?{visible:s.visible}:{},...s.approximate!==void 0?{approximate:s.approximate}:{}};return Re(l.tool,d)||t(),l});return{settings:o,items:a}}function Gt(e){return JSON.stringify({version:1,...le(e)},null,2)}function Ht(e,t,r="m"){let n=le(e),o=new Map(t?.map(a=>[a.id,a])),i=a=>{let s=String(a??"");return/^[=+@-]/.test(s)&&(s=`'${s}`),`"${s.replace(/"/g,'""')}"`};return[["id","name","modelId","type","status","value","unit","createdAt"],...n.items.map(a=>{let s=o.get(a.id)??nt(a,n.settings,r);return[a.id,a.name,a.modelId,a.tool,s.status,s.value,s.unit,a.createdAt]})].map(a=>a.map(i).join(",")).join(`\r
|
|
2
|
-
`)}function Pe(e){if(!Array.isArray(e)||e.length>128)throw new Error("Invalid selections: expected up to 128 named selection sets.");let t=new Set;return e.map(r=>{if(!r||typeof r!="object"||typeof r.id!="string"||!r.id||t.has(r.id)||typeof r.name!="string"||!r.name.trim()||r.name.length>200||!Array.isArray(r.objectIds)||r.objectIds.length>1e5||r.objectIds.some(n=>typeof n!="string"||!n))throw new Error("Invalid selections: each set needs a unique id, a name, and model object ids.");return t.add(r.id),{id:r.id,name:r.name.trim(),objectIds:[...new Set(r.objectIds)]}})}var Wt=new Set(["__proto__","constructor","prototype"]),rt=(e,t)=>e<t?-1:e>t?1:0;function k(e){throw new Error(`Invalid product: ${e}`)}var U=e=>!!e&&typeof e=="object"&&!Array.isArray(e),ve=e=>typeof e=="string"&&e.length>0&&e.length<=200&&!Wt.has(e),ee=e=>typeof e=="string"&&e.trim().length>0&&e.length<=500;function Xt(e){let t=0;function r(n,o){return(++t>1e5||o>32)&&k("definition is too complex."),n===null||typeof n=="string"||typeof n=="boolean"||typeof n=="number"&&Number.isFinite(n)?n:Array.isArray(n)?n.map(i=>r(i,o+1)):(U(n)||k("expected JSON data."),Object.fromEntries(Object.entries(n).filter(([,i])=>i!==void 0).map(([i,a])=>(Wt.has(i)&&k("reserved property name."),[i,r(a,o+1)]))))}return r(e,0)}function br(e){if(typeof e!="string"||e.length>2048)return!1;try{return["http:","https:"].includes(new URL(e.replace(/\{[a-zA-Z]+\}/g,"x")).protocol)}catch{return!1}}function ot(e){let t=Xt(typeof e=="string"?JSON.parse(e):e);(!U(t)||!ve(t.id)||!ee(t.label)||!ve(t.revision)||!Array.isArray(t.groups)||!t.groups.length||t.groups.length>64)&&k("id, label, revision, and 1\u201364 option groups are required.");let r=new Map;for(let o of t.groups){(!U(o)||!ve(o.id)||r.has(o.id)||!ee(o.label)||o.required!==void 0&&typeof o.required!="boolean"||!Array.isArray(o.options)||!o.options.length||o.options.length>128)&&k("groups need unique ids, labels, and 1\u2013128 options.");let i=new Set;r.set(o.id,i);for(let a of o.options)if((!U(a)||!ve(a.id)||i.has(a.id)||!ee(a.label)||a.sku!==void 0&&!ee(a.sku))&&k("options need unique ids and labels."),i.add(a.id),a.description!==void 0&&!ee(a.description)&&k("an option description must be text."),a.swatch!==void 0&&!(typeof a.swatch=="string"&&/^#[0-9a-f]{3,8}$/i.test(a.swatch))&&k("a swatch must be a hex color."),a.priceDeltaMinor!==void 0&&!Number.isSafeInteger(a.priceDeltaMinor)&&k("a price change must be a whole number of minor units."),a.variants!==void 0&&(!Array.isArray(a.variants)||a.variants.some(s=>!ee(s)))&&k("variant names must be strings."),a.appearance!==void 0){(!Array.isArray(a.appearance)||a.appearance.length>128)&&k("invalid appearance edits.");for(let s of a.appearance){U(s)||k("invalid appearance edit.");let c=s.target;typeof c=="string"&&c||Array.isArray(c)&&c.every(d=>typeof d=="string"&&!!d)||U(c)&&Object.keys(c).length===1&&["group","tag","type"].some(d=>typeof c[d]=="string")||k("appearance needs an object id, id list, or selector."),s.visible!==void 0&&typeof s.visible!="boolean"&&k("visibility must be boolean."),s.material!==void 0&&!U(s.material)&&k("material must be an object.");for(let d of Object.values(s.material??{}))typeof d=="string"||typeof d=="number"||typeof d=="boolean"||d===null||U(d)&&typeof d.path=="string"&&(d.offset===void 0||Array.isArray(d.offset)&&d.offset.length===2&&d.offset.every(l=>typeof l=="number"))||k("invalid material field.")}}o.defaultOptionId!==void 0&&!i.has(o.defaultOptionId)&&k("a default must name an option in its group."),o.display!==void 0&&!["list","chips","swatches"].includes(o.display)&&k("a group's display must be list, chips or swatches.")}t.pricing!==void 0&&!(U(t.pricing)&&/^[A-Z]{3}$/.test(t.pricing.currency)&&Number.isSafeInteger(t.pricing.basePriceMinor)&&t.pricing.basePriceMinor>=0)&&k("pricing needs a 3-letter currency and a base price of zero or more."),t.checkout!==void 0&&(!U(t.checkout)||t.checkout.label!==void 0&&!ee(t.checkout.label)||!br(t.checkout.urlTemplate))&&k("a checkout link needs an http or https URL.");let n=o=>U(o)&&typeof o.groupId=="string"&&typeof o.optionId=="string"&&!!r.get(o.groupId)?.has(o.optionId);if(t.rules!==void 0){(!Array.isArray(t.rules)||t.rules.length>2048)&&k("invalid rules.");let o=new Set;for(let i of t.rules){(!U(i)||!ve(i.id)||o.has(i.id)||!n(i.when)||i.message!==void 0&&!ee(i.message))&&k("rules need unique ids and valid option references."),o.add(i.id),["requires","excludes"].some(a=>Array.isArray(i[a])&&i[a].length>0)||k("a rule needs a requires or excludes constraint.");for(let a of["requires","excludes"])i[a]!==void 0&&(!Array.isArray(i[a])||i[a].length>128||!i[a].every(n))&&k("rule references must name existing options.")}}if(t.skus!==void 0){(!Array.isArray(t.skus)||t.skus.length>4096)&&k("invalid SKU table.");let o=new Set;for(let i of t.skus){(!U(i)||!ee(i.sku)||!U(i.selections)||Object.keys(i.selections).length!==r.size)&&k("SKU mappings need one selection per group.");for(let[s,c]of Object.entries(i.selections))(!r.has(s)||c!==null&&!r.get(s).has(c))&&k("SKU mapping references an unknown option.");let a=JSON.stringify(Object.entries(i.selections).sort(([s],[c])=>rt(s,c)));o.has(a)&&k("a combination can map to only one SKU."),o.add(a)}}return{id:t.id,label:t.label,revision:t.revision,groups:t.groups.map(o=>({id:o.id,label:o.label,...o.required!==void 0?{required:o.required}:{},...o.defaultOptionId!==void 0?{defaultOptionId:o.defaultOptionId}:{},...o.display!==void 0?{display:o.display}:{},options:o.options.map(i=>({id:i.id,label:i.label,...i.sku!==void 0?{sku:i.sku}:{},...i.description!==void 0?{description:i.description}:{},...i.swatch!==void 0?{swatch:i.swatch}:{},...i.priceDeltaMinor!==void 0?{priceDeltaMinor:i.priceDeltaMinor}:{},...i.variants!==void 0?{variants:i.variants}:{},...i.appearance!==void 0?{appearance:i.appearance.map(a=>({target:a.target,...a.material!==void 0?{material:a.material}:{},...a.visible!==void 0?{visible:a.visible}:{}}))}:{}}))})),...t.rules!==void 0?{rules:t.rules.map(o=>({id:o.id,when:o.when,...o.requires?{requires:o.requires}:{},...o.excludes?{excludes:o.excludes}:{},...o.message?{message:o.message}:{}}))}:{},...t.skus!==void 0?{skus:t.skus.map(o=>({sku:o.sku,selections:o.selections}))}:{},...t.pricing!==void 0?{pricing:{currency:t.pricing.currency,basePriceMinor:t.pricing.basePriceMinor}}:{},...t.checkout!==void 0?{checkout:{urlTemplate:t.checkout.urlTemplate,...t.checkout.label!==void 0?{label:t.checkout.label}:{}}}:{}}}function ge(e){return Object.fromEntries(e.groups.map(t=>[t.id,t.defaultOptionId??null]))}function hr(e,t){let r=[];for(let n of e.groups){if(t[n.id]===null)continue;let o=n.options.find(i=>i.id===t[n.id])?.sku;if(!o)return null;r.push(o)}return r.length?r.join("-"):null}function J(e,t=ge(e),r=1){if(!Number.isSafeInteger(r)||r<1||r>9999)throw new Error("Quantity must be an integer from 1 to 9999.");if(!U(t)||Object.values(t).some(l=>l!==null&&typeof l!="string"))throw new Error("Product selections must map group ids to option ids or null.");let n=[],o=[...e.groups].sort((l,u)=>rt(l.id,u.id)),i=Object.fromEntries(o.map(l=>[l.id,!Object.prototype.hasOwnProperty.call(t,l.id)||t[l.id]===void 0?l.defaultOptionId??null:t[l.id]]));for(let l of Object.keys(t).sort())e.groups.some(u=>u.id===l)||n.push({code:"unknown-group",groupIds:[l],message:`Unknown option group: ${l}.`});let a=[];for(let l of o){let u=i[l.id],m=l.options.find(f=>f.id===u);u!==null&&!m?n.push({code:"unknown-option",groupIds:[l.id],message:`Unknown choice for ${l.label}: ${u}.`}):l.required&&u===null&&n.push({code:"required",groupIds:[l.id],message:`Choose ${l.label}.`}),m&&a.push({groupId:l.id,optionId:m.id,label:m.label,...m.sku?{sku:m.sku}:{}})}let s=l=>e.groups.find(u=>u.id===l.groupId)?.options.find(u=>u.id===l.optionId)?.label??l.optionId;for(let l of[...e.rules??[]].sort((u,m)=>rt(u.id,m.id)))if(i[l.when.groupId]===l.when.optionId){for(let u of l.requires??[])i[u.groupId]!==u.optionId&&n.push({code:"requires",ruleId:l.id,groupIds:[...new Set([l.when.groupId,u.groupId])],message:l.message??`${s(l.when)} requires ${s(u)}.`});for(let u of l.excludes??[])i[u.groupId]===u.optionId&&n.push({code:"excludes",ruleId:l.id,groupIds:[...new Set([l.when.groupId,u.groupId])],message:l.message??`${s(l.when)} cannot be combined with ${s(u)}.`})}let c=e.skus?.length?e.skus.find(l=>o.every(u=>l.selections[u.id]===i[u.id]))?.sku??null:hr(e,i);e.skus?.length&&!c&&!n.length&&n.push({code:"sku",groupIds:o.map(l=>l.id),message:"This combination has no product SKU."});let d=JSON.stringify({productId:e.id,revision:e.revision,quantity:r,selections:i});return{version:1,productId:e.id,revision:e.revision,key:d,quantity:r,selections:i,sku:c,items:a,valid:!n.length,issues:n}}var Yt=new Set(["requires","excludes"]);function Be(e,t,r,n,o=1){let i={...J(e,t,o).selections,[r]:n},a=new Set([JSON.stringify(i)]),s=[i];for(let c=0;c<s.length&&c<2e3;c++){let d=s[c],l=J(e,d,o).issues.filter(u=>Yt.has(u.code));if(!l.length)return d;for(let u of new Set(l.flatMap(m=>m.groupIds))){if(u===r)continue;let m=e.groups.find(f=>f.id===u);if(m)for(let f of[...m.options.map(w=>w.id),...m.required?[]:[null]]){let w={...d,[u]:f},C=JSON.stringify(w);a.has(C)||(a.add(C),s.push(w))}}}return null}function yr(e,t,r,n,o){let i=Be(e,t,r,n,o);return i?Object.entries(i).filter(([a,s])=>a!==r&&s!==t[a]&&s!==null).map(([a,s])=>({groupId:a,optionId:s})):null}function Jt(e,t){if(!e.pricing)return null;let r=e.pricing.basePriceMinor;for(let n of t.items)r+=e.groups.find(o=>o.id===n.groupId)?.options.find(o=>o.id===n.optionId)?.priceDeltaMinor??0;return{amountMinor:Math.max(0,r)*t.quantity,currency:e.pricing.currency}}function Zt(e,t,r=!1){try{let n=new Intl.NumberFormat(void 0,{style:"currency",currency:t,...r?{signDisplay:"exceptZero"}:{}});return n.format(e/10**(n.resolvedOptions().maximumFractionDigits??2))}catch{return`${e} ${t}`}}function Qt(e,t){let r=e.checkout?.urlTemplate;if(!r||!t.valid||r.includes("{sku}")&&!t.sku)return null;let n={sku:t.sku??"",quantity:String(t.quantity),productId:e.id,revision:e.revision,selections:it(t.selections)};return r.replace(/\{([a-zA-Z]+)\}/g,(o,i)=>Object.prototype.hasOwnProperty.call(n,i)?encodeURIComponent(n[i]):o)}function it(e){return Object.entries(e).filter(([,t])=>t!==null).map(([t,r])=>`${encodeURIComponent(t)}:${encodeURIComponent(r)}`).join(",")}function en(e,t){let r={...ge(t)};for(let n of e.split(",")){let[o,i]=n.split(":");if(!o||!i)continue;let a,s;try{a=decodeURIComponent(o),s=decodeURIComponent(i)}catch{continue}t.groups.find(c=>c.id===a)?.options.some(c=>c.id===s)&&(r[a]=s)}return r}var Kt=4096;function tn(e,t="-"){let r=[{}];for(let i of e.groups){let a=[...i.options.map(s=>s.id),...i.required?[]:[null]];if(r.length*a.length>Kt*8)throw new Error("This product has too many combinations to list. Use a pricing service to resolve SKUs instead.");r=r.flatMap(s=>a.map(c=>({...s,[i.id]:c})))}let n={...e,skus:void 0},o=[];for(let i of r){if(J(n,i).issues.length)continue;let a=e.groups.flatMap(s=>{let c=i[s.id];return c===null?[]:[s.options.find(d=>d.id===c)?.sku??null]});if(!(!a.length||a.includes(null))&&(o.push({sku:a.join(t),selections:i}),o.length>Kt))throw new Error("This product has too many combinations to list. Use a pricing service to resolve SKUs instead.")}return o}function nn(e,t={},r){let n=[],o=ge(e),i=J({...e,skus:void 0},o).issues.filter(s=>Yt.has(s.code));for(let s of i)n.push({code:"invalid-default",message:`The default choices conflict: ${s.message}`});e.checkout?.urlTemplate.includes("{sku}")&&!e.skus?.length&&e.groups.some(s=>s.options.some(c=>!c.sku))&&n.push({code:"missing-sku",message:"The buy link uses {sku}, but it won't appear until every option has an SKU."});let a=Object.keys(t).length>0;for(let s of e.groups)for(let c of s.options){let d=`${s.label} \u203A ${c.label}`,l={groupId:s.id,optionId:c.id};if(a)for(let m of c.appearance??[])H(t,m.target).length||n.push({code:"no-objects",message:`${d} changes objects that aren't in this model.`,...l});if(r)for(let m of c.variants??[])r.includes(m)||n.push({code:"missing-variant",message:`${d} uses a material variant this model doesn't have: ${m}.`,...l});let u={...o,[s.id]:c.id};Be(e,u,s.id,c.id)||n.push({code:"unreachable",message:`The rules leave no way to choose ${d}.`,...l})}return n}function rn(e,t,r,n=1){return t=J(e,t,n).selections,e.groups.flatMap(o=>o.options.map(i=>{let s=J(e,{...t,[o.id]:i.id},n).issues.filter(l=>l.groupIds.includes(o.id)&&l.code!=="sku").map(l=>l.message),c=r?.options?.find(l=>l.groupId===o.id&&l.optionId===i.id);c?.available===!1&&s.push(c.reason??"Currently unavailable.");let d=s.length&&c?.available!==!1?yr(e,t,o.id,i.id,n):null;return{groupId:o.id,optionId:i.id,selected:t[o.id]===i.id,available:!s.length,...d?{fix:d}:{},reasons:[...new Set(s)]}}))}function Ee(e){U(e)||k("expected a product definition and selections.");let t=ot(e.definition),r=J(t,e.selections??ge(t));return r.issues.some(n=>n.code==="unknown-group"||n.code==="unknown-option")&&k("selections reference unknown options."),{definition:t,selections:r.selections}}function on(e){return JSON.stringify({version:1,productId:e.productId,revision:e.revision,quantity:e.quantity,selections:e.selections})}function sn(e,t){let r=Xt(typeof e=="string"?JSON.parse(e):e);if(!U(r)||r.version!==1||r.productId!==t.id||r.revision!==t.revision)throw new Error("This configuration belongs to a different product or revision.");if(!U(r.selections)||!Number.isSafeInteger(r.quantity))throw new Error("Invalid product configuration selections or quantity.");let n=J(t,r.selections,r.quantity);if(n.issues.some(o=>o.code==="unknown-group"||o.code==="unknown-option"))throw new Error("This configuration references unknown product options.");return n}function an(e,t,r=[],n=[]){let o=e,i=[...r];if(!t)return{objectBindings:o,activeVariants:i};for(let a of t.definition.groups){let s=a.options.find(c=>c.id===(t.selections[a.id]===void 0?a.defaultOptionId:t.selections[a.id]));if(s){for(let c of s.appearance??[])o=je(o,c.target,{...c.material!==void 0?{style:{material:c.material}}:{},...c.visible!==void 0?{visible:c.visible}:{}});if(s.variants?.length){let c=new Set(a.options.flatMap(d=>d.variants??[]));i=i.filter(d=>!c.has(d));for(let d of s.variants)i=ke(i,d,n)}}}return{objectBindings:o,activeVariants:i}}var te=5*1024*1024,Sr=["activeModelId","modelUrl","modelFormat","tilesetUrl","models","mergeModels","sceneConfig","isolation","multiSelectedKeys","activeAnnotation","annotationCategories","backgroundColor","shadows","cinematic","cameraControllerType","objectTransformSpace","arScaleMode","usdzUrl","measurements","measurementSettings","measurementUnit","measurementModelId"];function g(e,t){throw new Error(`Invalid viewer state at ${e}: ${t}`)}function D(e,t){(!e||typeof e!="object"||Array.isArray(e))&&g(t,"expected an object.")}function Me(e,t){(!Array.isArray(e)||!e.every(r=>typeof r=="string"))&&g(t,"expected strings.")}function X(e,t,r){(!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n)))&&g(r,`expected ${t} finite numbers.`)}function xr(e){let t=new Set,r=0;function n(o,i,a){if((++r>2e5||a>64)&&g(i,"configuration is too complex."),o===null||typeof o=="string"||typeof o=="boolean"||typeof o=="number"&&Number.isFinite(o))return o;(typeof o!="object"||!o)&&g(i,"expected JSON data (finite numbers, no functions)."),t.has(o)&&g(i,"cyclic data."),!Array.isArray(o)&&Object.getPrototypeOf(o)!==Object.prototype&&Object.getPrototypeOf(o)!==null&&g(i,"expected plain JSON data."),t.add(o);let s=Array.isArray(o)?[]:{};for(let[c,d]of Object.entries(o))["__proto__","constructor","prototype"].includes(c)&&g(`${i}.${c}`,"reserved property."),d!==void 0?s[c]=n(d,`${i}.${c}`,a+1):Array.isArray(o)&&g(i,"undefined array entry.");return t.delete(o),s}return n(e,"state",0)}function Y(e,t,r,n,o=!1,i){let a=e[t];if(a==null||a==="")return;typeof a!="string"&&g(r,"expected a URL.");let s=o?Lt(a)??a:a;if(s.trim().startsWith("blob:")){if(o&&i){i.set(a,{source:s,path:r});return}g(r,o?"this image is temporary. Use getStateAsync() for JSON or createShareUrl() to include it.":"upload this model/environment asset to a durable URL before saving or sharing.")}if(s!==a&&(a=s,e[t]=s),o&&/^data:image\//i.test(a))return;let c;try{c=new URL(a,n??"https://relative.invalid/")}catch{g(r,"invalid asset URL.")}["http:","https:"].includes(c.protocol)||g(r,"use an HTTP(S) asset URL."),n&&(e[t]=c.href)}function wr(e,t){D(e,t),X(e.position,3,`${t}.position`),X(e.target,3,`${t}.target`),(typeof e.zoom!="number"||e.zoom<=0)&&g(t,"zoom must be positive."),e.fov!==null&&(typeof e.fov!="number"||e.fov<=0||e.fov>=180)&&g(t,"fov must be null or between 0 and 180.");for(let r of["azimuthAngle","polarAngle"])e[r]!==void 0&&typeof e[r]!="number"&&g(t,`${r} must be a number.`)}function dn(e,t,r,n){D(e,t),(typeof e.id!="number"||typeof e.title!="string"||typeof e.description!="string")&&g(t,"expected an annotation id, title and description.");for(let o of["worldPosition","localPosition"])X(e[o],3,`${t}.${o}`);e.images!==void 0&&(Array.isArray(e.images)||g(t,"images must be an array."),e.images.forEach(o=>{D(o,t),Y(o,"src",t,r,!0,n)})),e.links!==void 0&&(Array.isArray(e.links)||g(t,"links must be an array."),e.links.forEach(o=>{D(o,t),Y(o,"href",t,r,!1,n)}))}function un(e,t){D(e,t),e.waypoints!==void 0&&(Array.isArray(e.waypoints)||g(t,"expected waypoints."),e.waypoints.forEach(r=>{D(r,t),X(r.position,3,t),X(r.target,3,t)}));for(let r of["enabled","loop","autoPlay"])e[r]!==void 0&&typeof e[r]!="boolean"&&g(t,`${r} must be boolean.`);e.duration!==void 0&&(typeof e.duration!="number"||e.duration<=0)&&g(t,"duration must be positive.")}function st(e,t,r){if(t!==null)if(Array.isArray(t))Array.isArray(e)||g(r,"expected an array."),t.length&&e.forEach(n=>st(n,t[0],r));else if(typeof t=="object"){D(e,r);for(let[n,o]of Object.entries(t))st(e[n],o,`${r}.${n}`)}else typeof e!=typeof t&&g(r,`expected ${typeof t}.`)}function cn(e,t,r,n){if(st(e,oe,t),e.measurements!==void 0&&(e.measurements=le(e.measurements)),e.sequences!==void 0&&(e.sequences=Ie(e.sequences)),e.selectionSets!==void 0&&(e.selectionSets=Pe(e.selectionSets)),e.product!==void 0&&(e.product=Ee(e.product),e.product.definition.groups.forEach(o=>o.options.forEach(i=>i.appearance?.forEach(a=>{for(let[s,c]of Object.entries(a.material??{}))c&&typeof c=="object"&&!Array.isArray(c)&&"path"in c&&Y(c,"path",`${t}.product.material.${s}.path`,r,!0,n)})))),X(e.model.rotation,3,`${t}.model.rotation`),e.lighting.lights.forEach(o=>X(o.position,3,`${t}.lighting.lights`)),e.annotations.forEach(o=>dn(o,`${t}.annotations`,r,n)),e.animations.autoplayClip!==null&&typeof e.animations.autoplayClip!="string"&&g(t,"invalid autoplay clip."),e.animations.clips.forEach(o=>{D(o,t),(typeof o.sourceName!="string"||typeof o.displayName!="string"||typeof o.hidden!="boolean"||typeof o.speed!="number"||!["repeat","once","ping-pong"].includes(o.loopMode))&&g(t,"invalid animation clip settings.")}),e.cinematic!==void 0&&un(e.cinematic,`${t}.cinematic`),e.styleRules!==void 0&&!Array.isArray(e.styleRules)&&g(t,"styleRules must be an array."),Y(e.environment,"customEnvironmentUrl",`${t}.environment`,r,!1,n),Y(e.background,"imageUrl",`${t}.background`,r,!0,n),e.model.activeVariants!==void 0&&Me(e.model.activeVariants,t),e.section!==void 0)try{e.section=xe(e.section)}catch(o){g(`${t}.section`,o.message)}}function mn(e,t,r,n){D(e,t);for(let[o,i]of Object.entries(e)){let a=`${t}.${o}`;D(i,a),(typeof i.id!="string"||typeof i.modelObjectId!="string")&&g(a,"expected binding id and modelObjectId.");for(let s of["label","group","type","status"])i[s]!==void 0&&typeof i[s]!="string"&&g(a,`${s} must be a string.`);i.tags!==void 0&&Me(i.tags,a),i.metadata!==void 0&&D(i.metadata,`${a}.metadata`),i.metrics!==void 0&&(D(i.metrics,a),Object.values(i.metrics).some(s=>typeof s!="number")&&g(a,"metrics must be numbers.")),i.actions!==void 0&&(Array.isArray(i.actions)||g(a,"actions must be an array."),i.actions.forEach(s=>{D(s,a),(typeof s.id!="string"||typeof s.label!="string"||s.type!=="command"||s.effects!==void 0&&!Array.isArray(s.effects))&&g(a,"invalid action.")}));for(let s of["visible","removed","selectable","hoverable"])i[s]!==void 0&&typeof i[s]!="boolean"&&g(a,`${s} must be boolean.`);if(i.transform!==void 0){D(i.transform,a);for(let s of["position","rotation","scale","shear"])i.transform[s]!==void 0&&X(i.transform[s],3,`${a}.transform.${s}`);i.transform.pivot!==void 0&&(D(i.transform.pivot,a),X(i.transform.pivot.point,3,a),X(i.transform.pivot.offset,3,a))}if(i.style!==void 0&&(D(i.style,a),i.style.material!==void 0)){D(i.style.material,a);for(let[s,c]of Object.entries(i.style.material))c&&typeof c=="object"&&!Array.isArray(c)&&"path"in c&&Y(c,"path",`${a}.style.material.${s}.path`,r,!0,n)}i.decals!==void 0&&(Array.isArray(i.decals)||g(a,"decals must be an array."),i.decals.forEach(s=>{D(s,a),(typeof s.id!="string"||typeof s.size!="number"||s.size<=0)&&g(a,"invalid decal."),X(s.position,3,a),X(s.normal,3,a),Y(s,"image",a,r,!0,n)}))}}function ln(e,t,r,n){Array.isArray(e)||g(t,"expected merge sources."),e.forEach(o=>{D(o,t),(typeof o.url!="string"||!o.url||typeof o.namePrefix!="string")&&g(t,"expected source URL and prefix."),Y(o,"url",t,r,!1,n)})}function vr(e,t,r){D(e,"configuration");let n=Object.fromEntries(Sr.filter(o=>e[o]!==void 0).map(o=>[o,e[o]]));(typeof n.modelUrl!="string"||!n.modelUrl)&&g("configuration.modelUrl","expected the active model URL.");for(let o of["modelUrl","tilesetUrl","usdzUrl"])Y(n,o,`configuration.${o}`,t,!1,r);if(n.sceneConfig!==void 0&&cn(n.sceneConfig,"configuration.sceneConfig",t,r),n.mergeModels!==void 0&&ln(n.mergeModels,"configuration.mergeModels",t,r),n.models!==void 0){(!Array.isArray(n.models)||n.models.length===0)&&g("configuration.models","expected model entries.");let o=new Set,i=new Set;n.models.forEach(a=>{D(a,"model"),(typeof a.url!="string"||!a.url)&&g("model.url","expected a URL."),Y(a,"url","model.url",t,!1,r),a.id!==void 0&&(typeof a.id!="string"||!a.id.trim())&&g("model.id","expected a nonempty instance ID.");let s=Ye({id:a.id,url:a.url});i.has(s)&&g("configuration.models","instance identities must be unique; assign IDs when reusing a URL."),i.add(s),a.transform!==void 0&&(a.transform=pe(a.transform)),a.visible!==void 0&&typeof a.visible!="boolean"&&g("model.visible","expected boolean."),o.add(a.url),mn(a.objectBindings,"model.objectBindings",t,r),a.sceneConfig!==void 0&&cn(a.sceneConfig,"model.sceneConfig",t,r),a.mergeModels!==void 0&&ln(a.mergeModels,"model.mergeModels",t,r)}),n.activeModelId!==void 0&&(typeof n.activeModelId!="string"||!i.has(n.activeModelId))&&g("configuration.activeModelId","active instance is not in models."),n.activeModelId!==void 0&&n.models.find(a=>Ye(a)===n.activeModelId)?.url!==n.modelUrl&&g("configuration.modelUrl","source does not match the active instance."),o.has(n.modelUrl)||g("configuration.modelUrl","active model is not in models.")}if(n.multiSelectedKeys!==void 0&&Me(n.multiSelectedKeys,"configuration.multiSelectedKeys"),n.annotationCategories!==void 0&&n.annotationCategories!==null&&Me(n.annotationCategories,"configuration.annotationCategories"),n.activeAnnotation!==void 0&&n.activeAnnotation!==null&&dn(n.activeAnnotation,"configuration.activeAnnotation",t,r),n.measurements!==void 0||n.measurementSettings!==void 0){let o=le({items:n.measurements??[],settings:n.measurementSettings??{}});n.measurements!==void 0&&(n.measurements=o.items),n.measurementSettings!==void 0&&(n.measurementSettings=o.settings)}n.measurementModelId!==void 0&&typeof n.measurementModelId!="string"&&g("configuration.measurementModelId","expected a stable id."),n.measurementUnit!==void 0&&typeof n.measurementUnit!="string"&&g("configuration.measurementUnit","expected a unit label.");for(let o of["backgroundColor"])n[o]!==void 0&&typeof n[o]!="string"&&g(o,"expected a string.");n.shadows!==void 0&&typeof n.shadows!="boolean"&&g("shadows","expected boolean.");for(let[o,i]of Object.entries({modelFormat:["glb","gltf","obj","fbx","usdz","stl","ply"],cameraControllerType:["orbit","pointerLock"],objectTransformSpace:["world","local"],arScaleMode:["normalized","real-world"]}))n[o]!==void 0&&!i.includes(n[o])&&g(o,"unsupported value.");if(n.cinematic!==void 0&&un(n.cinematic,"cinematic"),n.isolation!==void 0&&n.isolation!==null){let{target:o,mode:i,ghostOpacity:a}=n.isolation;typeof o=="string"||Array.isArray(o)&&o.every(s=>typeof s=="string")||o&&typeof o=="object"&&["group","tag","type"].some(s=>typeof o[s]=="string")||g("configuration.isolation","invalid target."),i!==void 0&&!["ghost","hide"].includes(i)&&g("configuration.isolation","invalid mode."),a!==void 0&&(typeof a!="number"||a<0||a>1)&&g("configuration.isolation","opacity must be between 0 and 1.")}return n}function fn(e,t,r,n){if(!(!e||typeof e!="object"))for(let[o,i]of Object.entries(e))o!=="metadata"&&(typeof i=="string"&&["url","modelUrl","tilesetUrl","usdzUrl","path","image","src","href","imageUrl","customEnvironmentUrl"].includes(o)?Y(e,o,`${t}.${o}`,r,["path","image","src","imageUrl"].includes(o),n):fn(i,`${t}.${o}`,r,n))}function pn(e,t,r){typeof e=="string"&&(new TextEncoder().encode(e).length>te&&g("state","exceeds the 5 MiB limit."),e=JSON.parse(e));let n=xr(e);D(n,"state"),new TextEncoder().encode(JSON.stringify(n)).length>te&&g("state","exceeds the 5 MiB limit."),n.version!==void 0&&n.version!==1&&g("version","unsupported version."),n.version===void 0&&(n.objectBindings!==void 0||n.configuration!==void 0)&&g("version","full configurations require version 1.");let o={};return n.version!==void 0&&(o.version=1),n.camera!==void 0&&(wr(n.camera,"camera"),o.camera=n.camera),n.hidden!==void 0&&(Me(n.hidden,"hidden"),o.hidden=n.hidden),n.selected!==void 0&&(n.selected!==null&&typeof n.selected!="string"&&g("selected","expected an object id or null."),o.selected=n.selected),n.objectBindings!==void 0&&(mn(n.objectBindings,"objectBindings",t,r),o.objectBindings=n.objectBindings),n.configuration!==void 0&&(o.configuration=vr(n.configuration,t,r)),fn(o,"state",t,r),new TextEncoder().encode(JSON.stringify(o)).length>te&&g("state","exceeds the 5 MiB limit."),o}function gn(e,t){return JSON.stringify(be(e,t))}function be(e,t){return pn(e,t)}async function De(e,t){let r=new Map,n=pn(e,t,r),o=new Map,i=new Map;for(let[s,{source:c,path:d}]of r){let l=o.get(c);l||(l=(async()=>{let u;try{u=await fetch(c)}catch{g(d,"this temporary image is no longer available. Reload or reselect it before saving.")}u.ok||g(d,"could not read the temporary image. Reload or reselect it before saving.");let m=await u.blob();m.size>te*3/4&&g(d,"embedded image exceeds the 5 MiB configuration limit. Use a hosted image URL.");let f=new Uint8Array(await m.arrayBuffer()),w=m.type.split(";")[0].toLowerCase(),C=w.startsWith("image/")?w:Mr(f);C||g(d,"temporary asset is not a supported image. Use a hosted asset URL.");let b="";for(let p=0;p<f.length;p+=32768)b+=String.fromCharCode(...f.subarray(p,p+32768));return`data:${C};base64,${btoa(b)}`})(),o.set(c,l)),i.set(s,await l)}function a(s){if(!(!s||typeof s!="object"))for(let[c,d]of Object.entries(s))c!=="metadata"&&(["path","image","src","imageUrl"].includes(c)&&typeof d=="string"&&i.has(d)?s[c]=i.get(d):a(d))}return a(n),be(n,t)}function Mr(e){let t=(r,n)=>String.fromCharCode(...e.subarray(r,n));if(e[0]===137&&t(1,4)==="PNG")return"image/png";if(e[0]===255&&e[1]===216&&e[2]===255)return"image/jpeg";if(t(0,3)==="GIF")return"image/gif";if(t(0,4)==="RIFF"&&t(8,12)==="WEBP")return"image/webp";if(t(4,8)==="ftyp"&&["avif","avis"].includes(t(8,12)))return"image/avif";if(/<svg[\s>]/i.test(new TextDecoder().decode(e.subarray(0,1024))))return"image/svg+xml"}var at={verifyingLicense:"Verifying License",checkingYourLicenseKey:"Checking your license key...",invalidLicense:"Invalid License",licenseHasBeenRevokedOrHasExpired:"License has been revoked or has expired",failedToLoadPleaseContactTheSiteAdministrator:"Failed to load. Please contact the site administrator.",contextRestoringTitle:"Reloading viewer\u2026",contextLostTitle:"3D view interrupted",contextRestoringMessage:"Rebuilding the 3D view. Please wait\u2026",contextLostMessage:"The graphics connection was interrupted. The viewer will rebuild when it returns, or you can reload it now.",reloadViewer:"Reload viewer",texturePositioningHint:"Drag to move \xB7 Scroll to zoom \xB7 Click elsewhere to finish",texturePositioningStartHint:"Double-click to move or zoom",dismiss:"Dismiss",missingUVsAreShownInMagenta:"Missing UVs are shown in magenta.",viewThisModelInARWithAppleQuickLook:"View this model in AR with Apple Quick Look",sequencePlayer:"Sequence player",sequenceSelect:"Sequence",sequencePlay:"Play sequence",sequencePause:"Pause sequence",sequenceStop:"Stop and restore scene",sequencePlayhead:"Sequence playhead",sequenceTime:"Sequence time",sequenceIssues:"Unavailable sequence targets",arConfiguredButton:"AR handoff",arConfiguredTitle:"Take this configuration to AR",arConfiguredDescription:"Your current materials, visible models and placements are included.",arSnapshotStale:"Updating AR to include your latest changes\u2026",arPreparing:"Preparing your scene\u2026",arRefresh:"Refresh AR",arRetry:"Try again",arExportDetails:"Export details",arPrepare:"Prepare AR",arPrepareAgain:"Prepare again",arDownloadUSDZ:"Download USDZ for iPhone/iPad",arScanConfigured:"Scan to open this configuration on your phone.",arOpenConfiguredLink:"Open configuration link",viewInAR:"View in AR",openThisExperienceOnAPhoneForAR:"Open this experience on a phone for AR",openOnPhone:"Open on phone",viewThisModelInYourSpace:"View this model in your space",viewThisModelInVR:"View this model in VR",closePhoneHandoff:"Close phone handoff",arScanCode:"Scan the code and choose AR.",qrCodeToOpenThisModelOnAPhone:"QR code to open this model on a phone",disableUVChecker:"Disable UV checker",enableUVChecker:"Enable UV checker",explodedView:"Exploded view",explodeAmount:"Explode amount",removeSectionCut:"Remove section cut",sectionCut:"Section cut",sectionAxis:"Section axis",sectionPosition:"Section position",keepTheOtherSide:"Keep the other side",pauseCinematic:"Pause cinematic",playCinematic:"Play cinematic",stopCinematicAndResetCamera:"Stop cinematic and reset camera",cancel:"Cancel",annotationCategories:"Annotation categories",annotations:"Annotations",all:"All",uncategorized:"Uncategorized",decalDragHint:"Drag the decal on the object. Release to save; Escape to cancel.",showAll:"Show all",materialVariants:"Material variants",startGuidedTour:"Start guided tour",guidedTour:"Guided Tour",previousAnnotation:"Previous annotation",previous:"Prev",stopGuidedTour:"Stop guided tour",nextAnnotation:"Next annotation",next:"Next",exitFullscreen:"Exit fullscreen",enterFullscreen:"Enter fullscreen",resetCameraView:"Reset camera view",orbitControl:"Orbit Control",pointLock:"Pointer lock",cameraController:"Camera controller",cameraControllerSettings:"Camera controller settings",downloadGLB:"Download GLB",downloadGLBDescription:"All visible models, material edits and animations in one file. No annotations or separate editor model slots. Duplicate mesh names may change on reimport.",downloadCombinedGLB:"Download as one GLB",downloadSeparateGLBs:"Download separate GLBs",downloadSeparateGLBsDescription:"One GLB file per model",downloadPNG:"Download PNG",downloadUVLayout:"Download UV Layout",videoFormat:"Video format",auto:"Auto",recordTurntableVideo:"Record turntable video",recordCinematicVideo:"Record cinematic video",videoUnsupported:"Video recording is not supported in this browser.",downloadOptions:"Download options",exporting:"Exporting\u2026",download:"Download",annotationTitlePlaceholder:"Title *",description:"Description",ok:"OK",arRelocate:"Relocate",tapToPlace:"Tap to place",closeAnnotation:"Close annotation",learnMore:"Learn more",stopMeasuring:"Stop measuring",startMeasuring:"Start measuring",toggleBoundingDimensions:"Toggle bounding dimensions",measurementTool:"Measurement tool",distance:"Distance",angle:"Angle",area:"Area",pointToPlane:"Point to plane",wrap:"Circumference (Edge)",wrapHorizontal:"Circumference (Horizontal)",measurementSnapping:"Measurement snapping",noSnapping:"No snapping",snapAuto:"Snap: auto",snapVertex:"Snap: vertex",snapEdge:"Snap: edge",undoMeasurementPoint:"Undo measurement point",clearMeasurements:"Clear measurements",finishArea:"Finish area",savedMeasurements:"Saved measurements ({count})",noSavedMeasurements:"No saved measurements yet. Pick points in the preview, then save a measurement here.",measurementFiles:"Import / export",measurementSourceUnit:"Model units",measurementDisplayUnit:"Display units",measurementName:"Name",measurementNamePlaceholder:"e.g. Door width",saveMeasurement:"Save",knownMeasurementDistance:"Known length",calibrationUnit:"Calibration unit",calibrateMeasurement:"Calibrate",measurementCalibrationHint:"Pick two distance points, enter their known length, then calibrate.",measurementCalibratedScale:"Calibrated: 1 model unit = {scale} m",resetMeasurementCalibration:"Reset calibration",showSavedMeasurement:"Show {name}",renameSavedMeasurement:"Rename {name}",deleteSavedMeasurement:"Delete {name}",exportMeasurementJson:"Export JSON",exportMeasurementCsv:"Export CSV",importMeasurementJson:"Import JSON",measurementReady:"Ready",measurementApproximate:"Approximate LOD",measurementModelChanged:"Different model",measurementObjectMissing:"Object unavailable",measurementGeometryChanged:"Geometry changed \u2014 measure again",measurementPoseChanged:"Pose changed \u2014 measure again",measurementObjectHidden:"Object hidden",measurementInvalid:"Invalid measurement",measurementWaiting:"Waiting for model",openSceneObjectsPanel:"Open scene objects panel",sceneObjects:"Scene Objects",searchNodesLabels:"Search nodes, labels",closeSceneObjectsPanel:"Close scene objects panel",objectNavigator:"Objects in the 3D view",compareBefore:"Before",compareAfter:"After",compareDivider:"Comparison divider",viewIn3D:"View in 3D",objectNavigatorHint:"Arrow keys browse \xB7 Enter selects \xB7 Esc clears",selectionCleared:"Selection cleared",cameraKeyboardHelp:"3D view. Arrow keys orbit, Shift with Up or Down zooms, and W, A, S, D, Space and C move the camera.",isolate:"Isolate",hide:"Hide",show:"Show",closePanel:"Close panel",actions:"Actions",openPanel:"Open panel",close:"Close",position:"Position",decalNudgeHint:"Click to fine-tune \xB7 Hold to move",decalNudgeControls:"Move decal in small steps",text:"Text",yourText:"Your text",textToAdd:"Text to add",textColour:"Text color",addText:"Add text",image:"Image",chooseImage:"Choose image",imageToAdd:"Image to add",added:"Added",colour:"Color",size:"Size",turn:"Turn",rotation:"Rotation",dragTheDecalAcrossTheObjectsSurface:"Drag the decal across the object's surface",move:"Move",remove:"Remove",noneAddedYet:"None added yet",done:"Done",moveForward:"Move forward",moveLeft:"Move left",moveRight:"Move right",moveBackward:"Move backward",productOptions:"Options",productOptionsFor:"{product} options",productReset:"Reset",productOptional:"optional",productNone:"None",productAlsoChanges:"Also changes: {changes}",productUnavailable:"Currently unavailable.",productQuantity:"Quantity",productCheckingPrice:"Checking price and availability\u2026",productTotal:"Total",productAddToCart:"Add to cart",productAddingToCart:"Adding\u2026",productRequestQuote:"Request quote",productRequestingQuote:"Requesting\u2026",productRefresh:"Refresh",productBuy:"Buy now",productCopyLink:"Copy link",productLinkCopied:"Link copied",productShowOptions:"Show options",productHideOptions:"Hide options",productIssues:"Configuration issues",productRequestDone:"Request completed.",productSaved:"Saved: {id}",sceneSettings:"Scene Settings",background:"Background",backgroundColor:"Background Color",showEnvironmentAsBackground:"Show as background",backgroundBlur:"Background Blur",environmentPreset:"Preset",environmentIntensity:"Intensity",toneMapping:"Tone Mapping",toneMappingAces:"ACES Filmic",toneMappingAgx:"AgX",toneMappingNeutral:"Neutral",toneMappingNone:"None",ground:"Ground",groundShadow:"Ground Shadow",groundShadowOpacity:"Shadow Opacity",floorGrid:"Floor Grid",display:"Display",wireframe:"Wireframe",autoRotateSpeed:"Rotation Speed",fieldOfView:"Field of View",modelInfo:"Model",modelInfoObjects:"Objects",modelInfoTriangles:"Triangles",modelInfoMaterials:"Materials",resetSettings:"Reset Settings",environment:"Environment",autoRotate:"Auto Rotate",lighting:"Lighting",exposure:"Exposure",ambientLightIntensity:"Ambient Light Intensity",ambientLightColor:"Ambient Light Color",directLightIntensity:"Direct Light Intensity",directLightColor:"Direct Light Color",searchObjects:"Search objects",uploadedModel:"Uploaded model",clear:"Clear",chooseModel:"Choose model",loadingModel:"Loading model...",releaseToLoadYourModel:"Release to load your model",arFindSurface:"Move your device over a flat surface",arReleaseToPlace:"Release to place",arGestureHint:"Pinch to resize \xB7 Twist to rotate",angleFirstArmHint:"Pick the first arm",angleVertexHint:"Pick the angle's vertex",angleSecondArmHint:"Pick the second arm",angleNewHint:"Pick a point to start a new angle",areaNewHint:"Pick a point to start a new area",areaCornersHint:"Pick polygon corners in order, then Finish area",pointToPlaneFaceHint:"Pick the reference face",pointToPlanePointHint:"Pick a point to measure its perpendicular distance",pointToPlaneNewHint:"Pick a face to start a new measurement",distanceHint:"Pick points on the model to measure distances",wrapHint:"Click a point on the surface to measure its circumference, following the surface (best for limbs)",wrapHorizontalHint:"Click a point to measure a level circumference around it (best for the torso/waist)",visibleEntries:"{count} visible entries",objectCount:"{count} objects",annotationMarker:"Annotation {id}: {title}",recordingVideo:"Recording video \xB7 {progress}%",isolatedObjects:"Isolated: {count} objects",largeModelWarning:"Very large model ({millions}M triangles) \u2014 it may render and move slowly on this device, and click/hover selection on the model is disabled. Use the objects panel to select parts.",preparingLargeModel:"Preparing large model ({millions}M triangles) \u2014 the first display can take a while on this device...",enterAR:"Enter AR",enterVR:"Enter VR",decalImage:"Image {index}",decalText:"Text {index}",decalAdded:"{count} added",up:"up",down:"down",left:"left",right:"right",moveDecal:"Move decal {direction}",moveDecalOnSurface:"Move {direction} on the visible surface",showAllObject:"Show all {name}",isolateObject:"Isolate {name}",isolatedObject:"Isolated: {name}",hideObject:"Hide {name}",showObject:"Show {name}",objectSelected:"{name} selected",objectNavigatorPosition:"{position} of {count}",compareDividerValue:"{before} {percent}%, {after} {rest}%",bindingMismatchOne:"1 object binding doesn't match this model",bindingMismatchMany:"{count} object bindings don't match this model",simpleLargeModelWarning:"Very large model detected ({millions}M triangles) \u2014 it may render and move slowly on this device, and click/hover selection on the model is disabled. Use the scene objects panel to select parts.",dropModelHint:"Drag and drop {formats} here",loadErrorTitle:"This model couldn't be loaded",loadErrorNotFound:"Nothing was found at this address ({status}). Check that modelUrl points to the file.",loadErrorDenied:"The server refused access to the file ({status}). Check that the file is public, or that a signed URL hasn't expired.",loadErrorStatus:"The server responded with {status} when the file was requested.",loadErrorNetwork:"The download was blocked or failed. Check that the URL is correct and, if the file is on another domain, that its server allows cross-origin requests (CORS) from this site.",loadErrorHtml:"The server sent back a web page instead of a model. There's probably no file at this path: many servers answer a missing file with their index.html.",loadErrorInvalidFile:"The file couldn't be read as {format}. Check that it's a valid {format} file.",loadErrorInvalidExplicitFormat:"The file couldn't be read as {format}. Check that it's a valid {format} file and that modelFormat matches it.",loadErrorMissingFormat:"The file couldn't be read as {format}. The URL has no file extension, so set modelFormat to the file's format.",loadErrorPointCloud:"This PLY file is a point cloud: it has points but no faces, and the viewer shows meshes. Turn it into a mesh first, for example with MeshLab or Blender.",measurementReferenceFaceRequired:"Pick a triangle face to define the reference plane.",measurementTooManyPoints:"Finish or clear this measurement before adding more points.",measurementAngleDistinct:"Pick a point away from the angle's vertex.",areaMinimumPoints:"Pick at least three points to finish the area.",areaDistinctPoints:"Area points must be distinct.",areaStraightLine:"Area points must not lie on one straight line.",areaNotPlanar:"Area points must lie on one plane.",areaEdgesCross:"Area edges must not cross or touch each other.",areaZero:"The polygon has no measurable area.",decalSurfaceMissing:"Could not find a surface on this object for the decal.",decalDirectionMissing:"No visible surface in that direction. Try another arrow or rotate the view.",fullscreenExitFailed:"Could not exit fullscreen. Press Escape to exit.",fullscreenEnterFailed:"Could not enter fullscreen. Check your browser or iframe fullscreen permissions and try again.",uvCoordinatesMissing:"This model does not contain UV coordinates.",uvExportFailed:"Could not create the UV layout archive.",videoExportFailed:"Could not export the video.",videoNotReady:"Viewer not ready for video export.",videoExitXR:"Exit the XR session before recording a video.",videoAlreadyRecording:"A video export is already in progress.",videoPathRequired:"Enable a cinematic camera path before recording it.",videoDurationInvalid:"Video duration must be greater than 0 and at most 300 seconds.",videoFrameRateInvalid:"Video frame rate must be between 1 and 60.",videoBitrateInvalid:"Video bitrate must be a positive number.",videoContextLost:"Video export stopped because the WebGL context was lost.",videoTimedOut:"Video export timed out. Keep the viewer tab visible while recording.",videoEncodingFailed:"The browser could not encode the video.",videoEmpty:"The browser produced an empty video.",videoDidNotStart:"Video recording did not start.",videoWebMUnsupported:"Video recording as WEBM is not supported in this browser.",videoMP4Unsupported:"Video recording as MP4 is not supported in this browser.",videoGIFUnsupported:"Video recording as GIF is not supported in this browser.",videoGifWidthInvalid:"GIF width must be a whole number of pixels from 16 to 4096.",environmentApartment:"apartment",environmentCity:"city",environmentDawn:"dawn",environmentForest:"forest",environmentLobby:"lobby",environmentNight:"night",environmentPark:"park",environmentStudio:"studio",environmentSunset:"sunset",environmentWarehouse:"warehouse",color:"Color",material:"Material",texturePreview:"texture preview",noTextureApplied:"No texture applied",noTextureCoordinates:"This part has no texture coordinates, so an image can't be placed on it.",replaceImage:"Replace image",uploadImage:"Upload image",removeTexture:"Remove texture",texturePosition:"Texture position",offsetX:"Offset X",offsetY:"Offset Y",confirmTexturePosition:"Confirm this texture position and exit positioning mode",donePositioning:"Done positioning",textureOffsetHint:"Double-click the object in the preview to drag its texture directly (scroll to zoom), or edit its offset numerically.",actionToggleLight:"Toggle Light",actionChangeLightColor:"Change Light Color",actionSetBrightness:"Set Brightness",actionChangeColor:"Change Color",actionChangeMaterial:"Change Material",actionToggleVisibility:"Toggle Visibility"};var Eo=new Map(Object.entries(at).map(([e,t])=>[t,e]));function bn(e){jt(e);let t=[],r=[{node:e,path:"0",parentId:null}];for(;r.length;){let{node:o,path:i,parentId:a}=r.pop(),s=`node:${i}`,c=o.isMesh&&o.name?ye(o):null;t.push({id:s,parentId:a,name:o.name||o.type||"Group",...c?{objectId:c}:{}});for(let d=o.children.length-1;d>=0;d--)r.push({node:o.children[d],path:`${i}/${d}`,parentId:s})}let n=new Set;for(let o=t.length-1;o>=0;o--){let i=t[o];(i.objectId||n.has(i.id))&&(n.add(i.id),i.parentId&&n.add(i.parentId))}return t.filter(o=>n.has(o.id))}function hn(e){return structuredClone(e.style??{})}function yn(e,t,r){let n=H(e,t).filter(i=>!e[i].removed);if(!n.length)return e;let o={...e};for(let i of n)o[i]={...e[i],style:structuredClone(r)};return o}var de=require("three"),Ar=new Set(["KHR_binary_glTF","KHR_draco_mesh_compression","KHR_lights_punctual","KHR_materials_clearcoat","KHR_materials_dispersion","KHR_materials_ior","KHR_materials_sheen","KHR_materials_specular","KHR_materials_transmission","KHR_materials_iridescence","KHR_materials_anisotropy","KHR_materials_unlit","KHR_materials_volume","KHR_texture_basisu","KHR_texture_transform","KHR_mesh_quantization","KHR_materials_emissive_strength","KHR_materials_variants","EXT_materials_bump","EXT_texture_webp","EXT_texture_avif","EXT_meshopt_compression","EXT_mesh_gpu_instancing"]),Or=new WeakMap;function Cr(e){let t=Or.get(e);return t?structuredClone(t):void 0}function Sn(e){if(/^(blob|data):/i.test(e))return"Local resource";let t=e.split(/[?#]/,1)[0].replace(/\\/g,"/");return t.slice(t.lastIndexOf("/")+1).slice(0,300)||"Resource"}function jr(e){return/^(blob|data):/i.test(e)?"Local resource":e.split(/[?#]/,1)[0].replace(/\\/g,"/").replace(/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i,"").replace(/^\/+/,"").slice(0,500)||"Resource"}function kr(e){let t=r=>typeof r=="number"&&Number.isFinite(r)&&r>=0?r:null;return{...e.format?{format:e.format}:{},...e.name?{name:Sn(e.name)}:{},sourceBytes:t(e.sourceBytes),loadDurationMs:t(e.loadDurationMs),extensionsUsed:[...new Set(e.extensionsUsed??[])].sort(),extensionsRequired:[...new Set(e.extensionsRequired??[])].sort(),failedResources:[...new Set((e.failedResources??[]).map(jr))].slice(0,50)}}function Tr(e){let t=new Set(e.extensionsRequired);return[...new Set([...e.extensionsUsed??[],...t])].sort().map(r=>({name:r,required:t.has(r),recognized:Ar.has(r)}))}function Ir(e,t){let r=e.image,n=d=>typeof d=="number"&&Number.isSafeInteger(d)&&d>0?d:null,o=n(r?.naturalWidth??r?.width),i=n(r?.naturalHeight??r?.height),a=!!e.isCompressedTexture,s=e.mipmaps.reduce((d,l)=>d+(l.data?.byteLength??0),0),c=o&&i?Math.ceil(o*i*4*(e.generateMipmaps?4/3:1)):null;return{name:e.name?Sn(e.name):t,width:o,height:i,compressed:a,estimatedBytes:a?s||null:c!==null&&Number.isSafeInteger(c)?c:null}}function xn(e,t={}){let r=kr({...Cr(e),...t.source}),n=[],o=new Set,i=new Map,a=new Set,s=new Map,c=new Map,d=new Set,l=new Map,u=0,m=0,f=0,w=0,C=0,b=(x,S)=>{let M=l.get(x)??{count:0,names:[]};M.count++,M.names.length<20&&M.names.push(S||"Unnamed object"),l.set(x,M)},p=x=>{let S=x?.array??x?.data?.array;S?.buffer&&!d.has(S.buffer)&&(d.add(S.buffer),C+=S.buffer.byteLength)};e.traverse(x=>{let S=x;if(!S.isMesh||!S.geometry)return;u++,m+=S.isInstancedMesh?Number.isSafeInteger(S.count)?Math.max(0,S.count??0):0:1;let M=S.geometry,E=M.getAttribute("position"),G=M.getAttribute("uv"),F=S.material?Array.isArray(S.material)?S.material:[S.material]:[];if(!i.has(M)){let _=!!E&&(!Number.isSafeInteger(E.count)||E.count<0);for(let N=0;!_&&E&&N<E.count;N++)if(!Number.isFinite(E.getX(N))||!Number.isFinite(E.getY(N))||!Number.isFinite(E.getZ(N))){_=!0;break}i.set(M,_)}if(i.get(M)&&b("invalid-positions",x.name),E?.count||b("empty-geometry",x.name),G||b("missing-uv",x.name),M.getAttribute("normal")||b("missing-normals",x.name),M.boundingBox&&[...M.boundingBox.min.toArray(),...M.boundingBox.max.toArray()].some(_=>!Number.isFinite(_))&&b("invalid-bounds",x.name),!o.has(M)){o.add(M),f+=Number.isSafeInteger(E?.count)?Math.max(0,E?.count??0):0;let _=M.index?.count??E?.count??0;w+=Number.isSafeInteger(_)?Math.floor(Math.max(0,_)/3):0,Object.values(M.attributes).forEach(p),Object.values(M.morphAttributes).flat().forEach(p),p(M.index)}let z=!1;for(let _ of F){a.add(_);let N=s.get(_);if(!N){N=Object.values(_).filter($=>!!$&&$.isTexture===!0),s.set(_,N);for(let $ of N)c.has($)||c.set($,`Texture ${c.size+1}`)}for(let $ of N){let me=$.channel??0;M.getAttribute(me===0?"uv":`uv${me}`)||(z=!0)}}z&&b("textured-missing-uv",x.name)});let h=(x,S,M,E,G)=>{let F=l.get(x);F&&n.push({code:x,severity:S,title:M,detail:E,suggestion:G,count:F.count,objects:F.names})};h("empty-geometry","error","Empty mesh geometry","Some meshes have no position data.","Remove empty meshes or export their geometry again."),h("invalid-positions","error","Invalid vertex coordinates","Some vertices contain non-finite coordinates.","Repair NaN or infinite vertex positions in the source application, then re-export."),h("invalid-bounds","error","Invalid geometry bounds","Some cached bounds contain non-finite values.","Repair invalid coordinates in the source application and re-export."),h("textured-missing-uv","warning","Textures have no matching UV coordinates","A texture references a UV channel that its mesh does not contain.","Unwrap the affected meshes and export the UV channel used by each texture."),h("missing-uv","info","Meshes without UVs","Solid colors can work without UVs; image textures and surface decals need them.","Add a UV map before applying image textures or decals."),h("missing-normals","info","Meshes without normals","Some loaded meshes lack vertex normals; generated shading may differ from the source.","Export vertex normals to preserve hard edges and smooth surfaces."),u||n.push({code:"no-meshes",severity:"warning",title:"No mesh geometry found",detail:"This scene contains no loaded meshes.",suggestion:"Check that meshes were included in the export. Streamed scenes may still be loading."});let v=[...c].map(([x,S])=>Ir(x,S)),A=v.filter(x=>(x.width??0)>4096||(x.height??0)>4096);A.length&&n.push({code:"large-textures",severity:"warning",title:"Large texture dimensions",detail:"Some textures exceed 4096 pixels on one side.",suggestion:"Resize textures for the visible detail needed; use KTX2/Basis where appropriate.",count:A.length,objects:A.slice(0,20).map(x=>x.name)}),w>1e6&&n.push({code:"high-triangle-count",severity:"warning",title:"High geometry count",detail:"The loaded geometry contains more than one million unique triangles.",suggestion:"Simplify hidden detail, create lower-detail exports, or use streamed assets for large scenes."}),a.size>100&&n.push({code:"many-materials",severity:"warning",title:"Many material definitions",detail:"More than 100 materials can increase rendering work.",suggestion:"Reuse materials and atlas compatible textures; inspect runtime draw calls to confirm the cost."});let y=Tr(r);for(let x of y.filter(S=>!S.recognized))n.push({code:"unrecognized-extension",severity:x.required?"error":"warning",title:`${x.required?"Required":"Optional"} extension not recognized`,detail:x.name,suggestion:"Export with extensions supported by the bundled loader, or verify the asset's fallback appearance."});r.failedResources?.length&&n.push({code:"failed-resources",severity:"error",title:"Some resources failed to load",detail:"The model may be missing textures or other referenced resources.",suggestion:"Include sidecar files in the ZIP, correct their paths, and check HTTP access and CORS.",count:r.failedResources.length,objects:r.failedResources.slice(0,20)});let P=null,V=[...i.values()].some(Boolean)?new de.Box3:new de.Box3().setFromObject(e);!V.isEmpty()&&[...V.min.toArray(),...V.max.toArray(),...V.getSize(new de.Vector3).toArray()].every(Number.isFinite)&&(P={min:V.min.toArray(),max:V.max.toArray(),center:V.getCenter(new de.Vector3).toArray(),size:V.getSize(new de.Vector3).toArray()}),t.scope==="resident-tiles"&&n.unshift({code:"partial-stream",severity:"info",title:"Loaded tiles only",detail:"Geometry and texture counts cover the current resident tiles, not the entire source asset.",suggestion:"Use the live cache/detail statistics to inspect streaming pressure. Rescan after moving the camera."});let re=x=>x.code==="partial-stream"?-1:x.severity==="error"?0:x.severity==="warning"?1:2;return n.sort((x,S)=>re(x)-re(S)),{version:1,status:"ready",scope:t.scope??"asset",source:r,units:r.format==="glb"||r.format==="gltf"?"meters (glTF convention)":"unknown",bounds:P,statistics:{meshes:u,instances:m,geometries:o.size,materials:a.size,textures:c.size,vertices:f,triangles:w,geometryBytes:C,estimatedTextureBytes:v.reduce((x,S)=>x+(S.estimatedBytes??0),0),unknownTextureSizes:v.filter(x=>x.estimatedBytes===null).length,meshesWithoutUvs:l.get("missing-uv")?.count??0,meshesWithoutNormals:l.get("missing-normals")?.count??0},textures:v,extensions:y,issues:n}}var Rr=new WeakMap;function wn(e){e.traverse(t=>{let r=Rr.get(t);if(r)throw new Error(r)})}var I=require("three");var ct=require("three");function Ve(e){return e.isSkinnedMesh===!0}var Pr="reactImmersiveSkinFreeze";function lt(e){return e.userData[Pr]?.frozenInverse??null}function vn(e){let t=e,r=lt(e);r&&t.bindMatrixInverse.copy(r),t.skeleton?.update?.();let n=t.geometry.clone(),o=n.getAttribute("position");if(o){let i=new ct.Vector3;for(let a=0;a<o.count;a++)t.getVertexPosition(a,i),o.setXYZ(a,i.x,i.y,i.z);o.needsUpdate=!0}return n.deleteAttribute("skinIndex"),n.deleteAttribute("skinWeight"),n.morphAttributes={},n.morphTargetsRelative=!1,n.computeVertexNormals(),n.computeBoundingBox(),n.computeBoundingSphere(),n}function Br(e,t={}){t.signal?.throwIfAborted();let r=new I.Group,n=new I.Group;r.add(n);let o=new Set,i=[],a=[],s=[],c=new Map,d=0,l=0,u=()=>{i.forEach(m=>m.dispose()),a.forEach(m=>m.dispose()),s.forEach(m=>m.dispose())};try{for(let{scene:b,objectBindings:p={},materialOverrides:h={}}of e){wn(b),b.updateWorldMatrix(!0,!0);let v=new Map(Object.entries(p).map(([A,y])=>[y.modelObjectId??A,A]));b.traverse(A=>{let y=A;if(!y.isMesh||!y.geometry)return;for(let M=A;M;M=M.parent){let E=ye(M)??M.name??M.uuid;if(!M.visible||p[v.get(E)??E]?.visible===!1||p[v.get(E)??E]?.removed)return}let P=ye(y)??y.name??y.uuid,V=h[v.get(P)??P]??y.material;if(!V)throw new Error(`Material for ${P} is not ready. Wait for the model to finish loading.`);let re=Array.isArray(V)?V:[V],x=y.isInstancedMesh?y.count:1;if(y.userData.riDecal&&Ve(y)&&y.parent){let M=lt(y.parent);M&&y.bindMatrixInverse.copy(M)}let S=Ve(y)?vn(y):y.geometry.clone();try{if(!Ve(y)&&y.morphTargetInfluences?.some(G=>G!==0)){let G=S.getAttribute("position"),F=new I.Vector3;for(let z=0;z<G.count;z++)y.getVertexPosition(z,F),G.setXYZ(z,F.x,F.y,F.z);S.morphAttributes={},S.computeVertexNormals()}if(!S.getAttribute("position"))throw new Error(`Mesh ${P} has no positions.`);let M=S.index?.count??S.getAttribute("position").count,E=Array.isArray(V)?S.groups:[{start:0,count:M,materialIndex:0}];if(!E.length)throw new Error(`Mesh ${P} has multiple materials without geometry groups.`);for(let G=0;G<x;G++){let F=y.matrixWorld.clone();if(y.isInstancedMesh){let z=new I.Matrix4;y.getMatrixAt(G,z),F.multiply(z)}for(let z of E){let _=re[z.materialIndex??0];if(!_)throw new Error(`A material group on ${P} is missing its material.`);if(!_.visible)continue;let N=_;if(!N.isMeshStandardMaterial||N.wireframe||N.vertexColors)throw new Error(`AR snapshot cannot preserve ${_.type}${N.wireframe?" wireframe":N.vertexColors?" vertex colors":""} on ${P}. Use a PBR material or provide arHandoff.createUSDZ.`);let $=Math.max(z.start,S.drawRange.start),me=Math.min(M,z.start+z.count,S.drawRange.start+S.drawRange.count);if(me<=$)continue;if($%3||(me-$)%3)throw new Error(`Mesh ${P} has an incomplete triangle range.`);let L=new I.BufferGeometry;i.push(L);let Z=Array.from({length:me-$},(O,T)=>S.index?S.index.getX($+T):$+T);if(F.determinant()<0)for(let O=0;O<Z.length;O+=3)[Z[O+1],Z[O+2]]=[Z[O+2],Z[O+1]];for(let[O,T]of Object.entries(S.attributes)){let j=new Float32Array(Z.length*T.itemSize);for(let R=0;R<Z.length;R++)for(let W=0;W<T.itemSize;W++)j[R*T.itemSize+W]=T.getComponent(Z[R],W);L.setAttribute(O,new I.BufferAttribute(j,T.itemSize))}L.setIndex(Z.map((O,T)=>T)),L.applyMatrix4(F);let Oe=L.getAttribute("position");for(let O=0;O<Oe.count;O++)if(![Oe.getX(O),Oe.getY(O),Oe.getZ(O)].every(Number.isFinite))throw new Error(`Mesh ${P} contains invalid coordinates.`);L.getAttribute("normal")||L.computeVertexNormals();let q=N.clone();a.push(q);let mt=N.userData.reactImmersiveConfiguredEmissive;if(mt?.isColor&&q.emissive.copy(mt),q.side===I.DoubleSide){let O=L.toNonIndexed();i.push(O);let T=O.getAttribute("position").count,j=new I.BufferGeometry;i.push(j);for(let[R,W]of Object.entries(O.attributes)){let Le=new Float32Array(T*W.itemSize*2);for(let ie=0;ie<T;ie++)for(let fe=0;fe<W.itemSize;fe++){Le[ie*W.itemSize+fe]=W.getComponent(ie,fe);let Vn=Math.floor(ie/3)*3+(2-ie%3);Le[(T+ie)*W.itemSize+fe]=W.getComponent(Vn,fe)*(R==="normal"?-1:1)}j.setAttribute(R,new I.BufferAttribute(Le,W.itemSize))}q.side=I.FrontSide,L.copy(j)}else if(q.side!==I.FrontSide){let O=L.getIndex();for(let j=0;j<O.count;j+=3){let R=O.getX(j+1);O.setX(j+1,O.getX(j+2)),O.setX(j+2,R)}let T=L.getAttribute("normal");for(let j=0;j<T.count;j++)T.setXYZ(j,-T.getX(j),-T.getY(j),-T.getZ(j));q.side=I.FrontSide}if(y.isInstancedMesh&&y.instanceColor){let O=new I.Color;y.getColorAt(G,O),q.color.multiply(O)}for(let[O,T]of Object.entries(q)){if(!T?.isTexture)continue;let j=T;if(_t(j)||!j.image||j.image.complete===!1)throw new Error(`Texture on ${P} is not ready. Wait for image loading or replace failed textures before preparing AR.`);let R=c.get(j);if(R||(R=j.clone(),c.set(j,R),s.push(R)),q[O]=R,!L.getAttribute(R.channel?`uv${R.channel}`:"uv"))throw new Error(`Texture on ${P} needs UV coordinates missing from this geometry.`)}if(y.userData.riDecal){L.computeBoundingBox();let O=Math.max(1e-6,L.boundingBox.getSize(new I.Vector3).length()*1e-4),T=L.getAttribute("position"),j=L.getAttribute("normal");for(let R=0;R<T.count;R++)T.setXYZ(R,T.getX(R)+j.getX(R)*O,T.getY(R)+j.getY(R)*O,T.getZ(R)+j.getZ(R)*O)}let ft=new I.Mesh(L,q);ft.name=`AR_${d++}`,n.add(ft),l+=(L.index?.count??L.getAttribute("position").count)/3,(q.clearcoat||q.transmission||q.iridescence||q.anisotropy)&&o.add("Advanced PBR effects may look different in Quick Look.")}}}finally{S.dispose()}})}if(!d||!l)throw new Error("There is no visible model geometry to send to AR.");let m=new I.Box3().setFromObject(n),f=m.getSize(new I.Vector3),w=m.getCenter(new I.Vector3),C=t.scaleMode==="real-world"?1:1/Math.max(f.x,f.y,f.z,1e-9);return n.position.set(-w.x*C,-m.min.y*C,-w.z*C),n.scale.setScalar(C),r.updateMatrixWorld(!0),o.add("USDZ is a static snapshot. Viewer lighting, background, post-processing, annotations and measurement overlays stay in the web viewer."),{root:r,meshCount:d,triangleCount:l,scale:C,warnings:[...o],textures:s,dispose:u}}catch(m){throw u(),m}}async function Mn(e,t={}){let r=t.maxTextureSize??2048;if(!Number.isInteger(r)||r<256||r>4096)throw new Error("AR maxTextureSize must be an integer from 256 to 4096.");let n=Br(e,t),o=[];try{let{USDZExporter:i}=await import("three/examples/jsm/exporters/USDZExporter.js");t.signal?.throwIfAborted();for(let s of n.textures){if(!s.isCompressedTexture)continue;let{decompress:c}=await import("three/examples/jsm/utils/WebGLTextureUtils.js"),d=c(s,r);o.push(d),n.root.traverse(l=>{let u=l.material;if(u)for(let m of Object.keys(u))u[m]===s&&(u[m]=d)})}let a=await new i().parseAsync(n.root,{onlyVisible:!0,quickLookCompatible:!0,maxTextureSize:r});return t.signal?.throwIfAborted(),{blob:new Blob([new Uint8Array(a)],{type:"model/vnd.usdz+zip"}),meshCount:n.meshCount,triangleCount:n.triangleCount,scale:n.scale,warnings:n.warnings}}catch(i){throw t.signal?.aborted?i:new Error(`Could not prepare the configured USDZ: ${i instanceof Error?i.message:"export failed"}. Textures must allow cross-origin canvas access.`)}finally{n.dispose(),o.forEach(i=>i.dispose())}}var ne=require("fflate");var dt="ri-ar",ut="ri-ar-id",An=4096,Er=2200,Dr=(0,ne.strToU8)(JSON.stringify(oe)).byteLength;function On(e){return e==="localhost"||e.endsWith(".localhost")||/^127\./.test(e)||e==="[::1]"||e==="0.0.0.0"}function Cn(e){if(typeof e=="string"&&/^https?:\/\//i.test(e)&&On(new URL(e).hostname))throw new Error("An asset URL points to this computer. Use model and texture URLs reachable from the phone.");if(e&&typeof e=="object")for(let t of Object.values(e))Cn(t)}function Vr(e,t){let r=new URL(e,t);if(!["https:","http:"].includes(r.protocol))throw new Error("AR handoff requires an HTTP(S) URL.");return r.toString()}function jn(e,t){if(JSON.stringify(e)!==JSON.stringify(t))return e&&t&&typeof e=="object"&&typeof t=="object"&&!Array.isArray(e)&&!Array.isArray(t)?Object.fromEntries(Object.entries(e).map(([r,n])=>[r,jn(n,t[r])]).filter(([,r])=>r!==void 0)):e}function kn(e,t,r=0){if(r>64)throw new Error("AR configuration is too deeply nested.");if(e&&t&&typeof e=="object"&&typeof t=="object"&&!Array.isArray(e)&&!Array.isArray(t)){let n=e,o=t;return Object.fromEntries([...new Set([...Object.keys(o),...Object.keys(n)])].map(i=>[i,Object.prototype.hasOwnProperty.call(n,i)?kn(n[i],o[i],r+1):o[i]]))}return e}function Tn(e,t){let r=structuredClone(e);if(r.configuration){r.configuration.sceneConfig&&(r.configuration.sceneConfig=t(r.configuration.sceneConfig));for(let n of r.configuration.models??[])n.sceneConfig&&(n.sceneConfig=t(n.sceneConfig))}return r}function Ae(e){e?.throwIfAborted()}async function In(e,t,r,n){Ae(n);let o=new URL(Vr(t));if(On(o.hostname))throw new Error("Phone links need a viewer URL reachable from your phone. Download the USDZ for local uploads, or provide a public viewer URL.");let i=await De(e,o.toString());Ae(n),Cn(i);let a=new URLSearchParams(o.hash.slice(1));if(a.delete(dt),a.delete(ut),a.delete("view"),a.delete("viewId"),a.delete("view-id"),r){let s=await r.save(i);if(Ae(n),typeof s!="string"||!s||s.length>512)throw new Error("AR storage returned an invalid configuration ID.");a.set(ut,s)}else{let s=(0,ne.zlibSync)((0,ne.strToU8)(JSON.stringify({ar:1,state:Tn(i,d=>jn(d,oe)??{})})),{level:9});if(s.byteLength>An)throw new Error("This configuration needs an AR storage adapter to share on a phone. The USDZ download is still available.");let c="";for(let d of s)c+=String.fromCharCode(d);a.set(dt,btoa(c).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""))}if(o.hash=a.toString(),o.toString().length>Er)throw new Error("This configuration is too large for a reliable QR code. Use an AR storage adapter or download the USDZ.");return o.toString()}async function Rn(e,t,r){let n=new URL(e),o=new URLSearchParams(n.hash.slice(1)),i=o.get(ut),a=o.get(dt);if(i!==null&&a!==null)throw new Error("AR link contains conflicting configurations.");if(i===null&&a===null)return null;Ae(r);let s;if(i!==null){if(!t)throw new Error("This AR link requires the application's configuration storage adapter.");if(!i||i.length>512)throw new Error("Invalid AR configuration ID.");s=await t.load(i)}else{if(!a||a.length>Math.ceil(An*4/3)||!/^[\w-]+$/.test(a))throw new Error("Invalid or oversized AR link.");let d=atob(a.replace(/-/g,"+").replace(/_/g,"/")),l=Uint8Array.from(d,f=>f.charCodeAt(0)),u=(0,ne.unzlibSync)(l);if(u.byteLength>te)throw new Error("AR configuration exceeds the 5 MiB limit.");let m=JSON.parse((0,ne.strFromU8)(u));if(m?.ar===1&&m.state){let f=m.state.configuration,w=(f?.sceneConfig?1:0)+(Array.isArray(f?.models)?f.models.filter(C=>C?.sceneConfig).length:0);if(u.byteLength+w*Dr>te)throw new Error("Expanded AR configuration exceeds the 5 MiB limit.");s=Tn(m.state,C=>kn(C,oe))}else s=m}Ae(r);let c=be(s,n.toString());if(c.version!==1||!c.configuration)throw new Error("AR handoff requires a complete versioned viewer configuration.");return c}var En={id:"identity",modelObjectId:"identity",label:"identity",type:"identity",group:"identity",tags:"identity",style:"appearance",decals:"appearance",transform:"transform",visible:"visibility",removed:"visibility",status:"visibility",selectable:"behavior",hoverable:"behavior",actions:"behavior",cameraState:"behavior",metadata:"data",metrics:"data"},Nr=Object.keys(En),Lr=new Set(["__proto__","prototype","constructor"]);function ue(e,t=new Set){if(e==null||typeof e=="string"||typeof e=="boolean")return e;if(typeof e=="number"){if(!Number.isFinite(e))throw new Error("Comparison values must be finite JSON data");return e}if(typeof e!="object"||t.has(e))throw new Error("Comparison values must be acyclic JSON data");t.add(e);let r=Array.isArray(e)?e.map(n=>ue(n,t)):Object.fromEntries(Object.entries(e).filter(([n,o])=>!Lr.has(n)&&o!==void 0).map(([n,o])=>[n,ue(o,t)]));return t.delete(e),r}var Pn=e=>e&&typeof e=="object"&&!Array.isArray(e)&&!Object.keys(e).length;function Bn(e,t){let r=ue(e);r.visible=e.visible??!0,r.selectable=e.selectable??!0,r.hoverable=e.hoverable??!0,r.status=e.status??"normal",r.type=e.type??"other",r.tags=[...new Set(e.tags??[])].sort(),Pn(r.transform)&&delete r.transform,r.metadata=Object.fromEntries(Object.entries(e.metadata??{}).filter(([n])=>!t.includes(n)));for(let n of["metrics","style","metadata"])Pn(r[n])&&delete r[n];for(let n of["actions","decals"])Array.isArray(r[n])&&!r[n].length&&delete r[n];return r}function Ne(e,t,r,n,o,i){let a=c=>c===void 0||Array.isArray(c)&&c.length===0;if(Object.is(e,t)||a(e)&&a(t)||typeof e=="number"&&typeof t=="number"&&Math.abs(e-t)<=o)return;let s=c=>!!c&&typeof c=="object"&&!Array.isArray(c);if(s(e)&&s(t)){for(let c of[...new Set([...Object.keys(e),...Object.keys(t)])].sort())Ne(e[c],t[c],`${r}.${c}`,n,o,i);return}if(Array.isArray(e)&&Array.isArray(t)&&e.length===t.length){for(let c=0;c<e.length;c++)Ne(e[c],t[c],`${r}[${c}]`,n,o,i);return}i.push({path:r,category:n,...e!==void 0?{before:ue(e)}:{},...t!==void 0?{after:ue(t)}:{}})}function Dn(e,t,r={}){let n=r.tolerance??1e-6;if(!Number.isFinite(n)||n<0)throw new Error("Comparison tolerance must be finite and nonnegative");let o=Object.entries(e.objectBindings).filter(([,p])=>!p.removed),i=Object.entries(t.objectBindings).filter(([,p])=>!p.removed),a=new Map(o),s=new Map(i),c=new Set,d=new Set,l=[],u=p=>{let h=r.matchBy??"modelObjectId",v=typeof h=="object"?p.metadata?.[h.metadataKey]:p[h];return typeof v=="string"&&v.length>0||typeof v=="number"?`${typeof v}:${v}`:null};function m(p,h,v){let A=p===void 0?void 0:a.get(p),y=h===void 0?void 0:s.get(h),P=[];if(A||y){let re=A?Bn(A,r.ignoreMetadataKeys??[]):{},x=y?Bn(y,r.ignoreMetadataKeys??[]):{};for(let S of Nr)Ne(re[S],x[S],S,En[S],n,P)}let V=A?y?P.length?"modified":"unchanged":"removed":"added";l.push({id:JSON.stringify([p??null,h??null]),identity:v,label:y?.label??A?.label??y?.modelObjectId??A?.modelObjectId??v,status:V,beforeKey:p,afterKey:h,beforeObjectId:A?.modelObjectId,afterObjectId:y?.modelObjectId,changes:P}),p!==void 0&&c.add(p),h!==void 0&&d.add(h)}let f=new Set;for(let[p,h]of Object.entries(r.mapping??{})){if(!a.has(p)||!s.has(h)||f.has(h))throw new Error("Comparison mapping must reference existing, unique binding keys");f.add(h),m(p,h,`mapped:${p}`)}let w=new Map;for(let[p,h,v]of[[o,c,"a"],[i,d,"b"]])for(let[A,y]of p){if(h.has(A))continue;let P=u(y);if(P===null){l.push({id:JSON.stringify([v,A]),identity:"",label:y.label??y.modelObjectId,status:"ambiguous",...v==="a"?{beforeKey:A,beforeObjectId:y.modelObjectId}:{afterKey:A,afterObjectId:y.modelObjectId},changes:[],message:"Missing match identity. Supply an explicit mapping or another match field."});continue}let V=w.get(P)??{a:[],b:[]};V[v].push(A),w.set(P,V)}for(let[p,h]of w){if(h.a.length<=1&&h.b.length<=1){m(h.a[0],h.b[0],p);continue}for(let v of["a","b"])for(let A of h[v]){let y=(v==="a"?a:s).get(A);l.push({id:JSON.stringify([v,A]),identity:p,label:y.label??y.modelObjectId,status:"ambiguous",...v==="a"?{beforeKey:A,beforeObjectId:y.modelObjectId}:{afterKey:A,afterObjectId:y.modelObjectId},changes:[],message:"Duplicate match identity. Supply an explicit one-to-one mapping."})}}l.sort((p,h)=>p.label.localeCompare(h.label)||p.id.localeCompare(h.id));let C=[];Ne(ue(e.sceneConfig??{}),ue(t.sceneConfig??{}),"sceneConfig","scene",n,C);let b={added:0,removed:0,modified:0,unchanged:0,ambiguous:0};for(let p of l)b[p.status]++;return{version:1,objects:l,counts:b,sceneChanges:C}}0&&(module.exports={ACTION_CATALOG,DEFAULT_MODEL_VIEWER_LABELS,DEFAULT_SCENE_CONFIG,DEFAULT_SECTION_CONFIG,MATERIAL_BLENDING_MODES,MATERIAL_SIDES,MAX_VIEWER_STATE_BYTES,MEASUREMENT_UNITS,SEQUENCE_EASINGS,SEQUENCE_OBJECT_PROPERTIES,applyIsolation,applyProductOptions,applyStyleRules,buildBindingsFromNodes,calibrateMeasurements,chooseMaterialVariant,collectObjectHierarchy,colorScaleValue,compareViewerConfigurations,copyBindingStyle,createARHandoffUrl,createDefaultBinding,decodeProductSelections,defaultProductSelections,defineObjectBindings,encodeProductSelections,evaluateProductConfiguration,exportConfiguredUSDZ,findCatalogAction,formatProductPrice,generateProductSkus,groundAsset,inferType,inspectAsset,isolatedBindingKeys,material,measurementResult,measurementScale,measurementValue,measurementsToCsv,parseAssetTransform,parseMeasurements,parseProductConfiguration,parseProductDefinition,parseSceneProduct,parseSectionConfig,parseSelectionSets,parseSequences,parseViewerState,pasteBindingStyle,patchBindings,patchSceneConfig,prepareViewerState,productCheckoutUrl,productDefinitionWarnings,productOptionStates,productPriceFromDefinition,readARHandoffUrl,resolveProductSelections,sampleSequenceTrack,sceneLight,sectionSnapshot,selectBindingKeys,selectBindings,serializeMeasurements,serializeProductConfiguration,serializeViewerState,snapAssetToGrid,upsertSequenceKeyframe});
|
|
1
|
+
"use strict";var Nn=Object.create;var Ce=Object.defineProperty;var Ln=Object.getOwnPropertyDescriptor;var _n=Object.getOwnPropertyNames;var Un=Object.getPrototypeOf,zn=Object.prototype.hasOwnProperty;var Fn=(e,t)=>{for(var r in t)Ce(e,r,{get:t[r],enumerable:!0})},pt=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of _n(t))!zn.call(e,o)&&o!==r&&Ce(e,o,{get:()=>t[o],enumerable:!(n=Ln(t,o))||n.enumerable});return e};var gt=(e,t,r)=>(r=e!=null?Nn(Un(e)):{},pt(t||!e||!e.__esModule?Ce(r,"default",{value:e,enumerable:!0}):r,e)),$n=e=>pt(Ce({},"__esModule",{value:!0}),e);var _r={};Fn(_r,{ACTION_CATALOG:()=>Se,DEFAULT_MODEL_VIEWER_LABELS:()=>at,DEFAULT_SCENE_CONFIG:()=>oe,DEFAULT_SECTION_CONFIG:()=>Pt,MATERIAL_BLENDING_MODES:()=>Rt,MATERIAL_SIDES:()=>It,MAX_VIEWER_STATE_BYTES:()=>te,MEASUREMENT_UNITS:()=>Qe,SEQUENCE_EASINGS:()=>Xe,SEQUENCE_OBJECT_PROPERTIES:()=>We,applyIsolation:()=>Ot,applyProductOptions:()=>an,applyStyleRules:()=>At,buildBindingsFromNodes:()=>Tt,calibrateMeasurements:()=>qt,chooseMaterialVariant:()=>ke,collectObjectHierarchy:()=>bn,colorScaleValue:()=>ze,compareViewerConfigurations:()=>Dn,copyBindingStyle:()=>hn,createARHandoffUrl:()=>In,createDefaultBinding:()=>qe,decodeProductSelections:()=>en,defaultProductSelections:()=>ge,defineObjectBindings:()=>bt,encodeProductSelections:()=>it,evaluateProductConfiguration:()=>J,exportConfiguredUSDZ:()=>An,findCatalogAction:()=>kt,formatProductPrice:()=>Zt,generateProductSkus:()=>tn,groundAsset:()=>Nt,inferType:()=>$e,inspectAsset:()=>xn,isolatedBindingKeys:()=>Fe,material:()=>St,measurementResult:()=>nt,measurementScale:()=>tt,measurementValue:()=>Re,measurementsToCsv:()=>Ht,parseAssetTransform:()=>pe,parseMeasurements:()=>le,parseProductConfiguration:()=>sn,parseProductDefinition:()=>ot,parseSceneProduct:()=>Ee,parseSectionConfig:()=>xe,parseSelectionSets:()=>Pe,parseSequences:()=>Ie,parseViewerState:()=>be,pasteBindingStyle:()=>yn,patchBindings:()=>je,patchSceneConfig:()=>xt,prepareViewerState:()=>De,productCheckoutUrl:()=>Qt,productDefinitionWarnings:()=>nn,productOptionStates:()=>rn,productPriceFromDefinition:()=>Jt,readARHandoffUrl:()=>Rn,resolveProductSelections:()=>Be,sampleSequenceTrack:()=>Et,sceneLight:()=>wt,sectionSnapshot:()=>Bt,selectBindingKeys:()=>H,selectBindings:()=>yt,serializeMeasurements:()=>Gt,serializeProductConfiguration:()=>on,serializeViewerState:()=>gn,snapAssetToGrid:()=>Vt,upsertSequenceKeyframe:()=>Dt});module.exports=$n(_r);function bt(e){return e}function _e(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function he(e,t){if(!_e(t))return t;let r=_e(e)?{...e}:{};for(let n of Object.keys(t)){let o=t[n];r[n]=_e(o)?he(r[n],o):o}return r}function ht(e,t){if(e[t])return t;let r=Object.entries(e).find(([,o])=>o.id===t)?.[0];return r||(Object.entries(e).find(([,o])=>o.modelObjectId===t)?.[0]??null)}function qn(e){return typeof e=="object"&&!Array.isArray(e)}function Gn(e,t){return"group"in t?e.group===t.group:"tag"in t?e.tags?.includes(t.tag)??!1:(e.type??"other")===t.type}function H(e,t){if(qn(t))return Object.entries(e).filter(([,o])=>Gn(o,t)).map(([o])=>o);let n=(typeof t=="string"?[t]:t).map(o=>ht(e,o)).filter(o=>o!==null);return[...new Set(n)]}function yt(e,t){return H(e,t).map(r=>e[r]).filter(r=>r!==void 0)}function Hn(e){return Array.isArray(e)&&e.length>0&&typeof e[0]!="string"}function je(e,t,r){let n=Hn(t)?t:[{ids:t,patch:r??{}}],o=e;for(let i of n)for(let a of H(o,i.ids)){let s=o[a];if(!s)continue;let c=he(s,i.patch);o===e&&(o={...e}),o[a]=c}return o}function St(e){return{style:{material:e}}}function xt(e,t){return he(e,t)}var Kn={type:"point",color:"#ffffff",intensity:1,position:[0,0,0],distance:0,decay:2,attachedToCamera:!1,castShadow:!1,shadowBias:-5e-4,visible:!0};function wt(e){return{...Kn,...e}}var Wn="#ff3b30",Xn=Object.freeze({}),vt=e=>e;function Yn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Jn(e,t){let r=e.metadata;for(let n of t.split(".")){if(!Yn(r))return;r=r[n]}return r}function Zn(e,t){if("metric"in t){let r=e.metrics?.[t.metric];return!(typeof r!="number"||!Number.isFinite(r)||t.above!==void 0&&!(r>t.above)||t.below!==void 0&&!(r<t.below))}if("status"in t){let r=e.status??"normal";return Array.isArray(t.status)?t.status.includes(r):t.status===r}return Jn(e,t.metadata)===t.equals}function Qn(e){let t=e.trim().replace(/^#/,""),r=t.length===3?t.split("").map(n=>n+n).join(""):t;return/^[0-9a-f]{6}$/i.test(r)?[0,2,4].map(n=>parseInt(r.slice(n,n+2),16)):null}var Ue=e=>`#${e.map(t=>Math.round(t).toString(16).padStart(2,"0")).join("")}`;function ze(e,t){let r=e.map(([c,d])=>({at:c,rgb:Qn(d)})).filter(c=>Number.isFinite(c.at)&&c.rgb!==null).sort((c,d)=>c.at-d.at);if(r.length===0||!Number.isFinite(t))return null;if(t<=r[0].at)return Ue(r[0].rgb);let n=r[r.length-1];if(t>=n.at)return Ue(n.rgb);let o=r.findIndex(c=>c.at>=t),i=r[o-1],a=r[o],s=a.at===i.at?1:(t-i.at)/(a.at-i.at);return Ue(i.rgb.map((c,d)=>c+(a.rgb[d]-c)*s))}function At(e,t){if(!t?.length)return{bindings:e,pulses:Xn,sourceOf:vt};let r=new Map,n={};for(let a of t){let s=a.target?H(e,a.target):Object.keys(e),c=a.when?Array.isArray(a.when)?a.when:[a.when]:[];for(let d of s){let l=e[d];if(!c.every(m=>Zn(l,m)))continue;let u={...a.material};if(a.colorScale){let m=l.metrics?.[a.colorScale.metric],f=typeof m=="number"?ze(a.colorScale.stops,m):null;f&&(u={...u,[a.colorScale.channel??"baseColor"]:f})}if(a.pulse){let m=a.pulse===!0?{}:a.pulse;n[d]={color:m.color??Wn,speed:m.speed!==void 0&&m.speed>0?m.speed:1};let f=u.emissiveIntensity??r.get(d)?.emissiveIntensity??l.style?.material?.emissiveIntensity;f!==void 0&&f>0||(u.emissiveIntensity=1)}Object.keys(u).length>0&&r.set(d,{...r.get(d),...u})}}if(r.size===0)return{bindings:e,pulses:n,sourceOf:vt};let o={...e},i=new WeakMap;for(let[a,s]of r){let c=e[a],d={...c,style:{...c.style,material:{...c.style?.material,...s}}};o[a]=d,i.set(d,c)}return{bindings:o,pulses:n,sourceOf:a=>i.get(a)??a}}function ke(e,t,r){let n=r.find(i=>i.variants.some(a=>a.name===t)),o=new Set(n?.variants.map(i=>i.name)??[t]);return[...e.filter(i=>!o.has(i)),t]}var er=.12,Mt=new Set;function Fe(e,t){return t?new Set(H(e,t.target)):Mt}function Ot(e,t){let r=Fe(e.bindings,t);if(!t||r.size===0)return{...e,setAside:Mt};let n=Math.min(Math.max(t.ghostOpacity??er,0),1),o={...e.bindings},i=new WeakMap,a=new Set;for(let[s,c]of Object.entries(e.bindings)){if(r.has(s))continue;a.add(s);let d=t.mode==="hide"?{...c,visible:!1}:{...c,style:{...c.style,material:{...c.style?.material,opacity:Math.min(c.style?.material?.opacity??1,n)}}};o[s]=d,i.set(d,e.sourceOf(c))}return{bindings:o,pulses:e.pulses,sourceOf:s=>i.get(s)??e.sourceOf(s),setAside:a}}var tr=require("three"),Ct=Symbol("react-immersive.model-node-id");function nr(e,t){Object.defineProperty(e,Ct,{value:t,configurable:!0})}function jt(e){let t=new Map;e.traverse(c=>{if(!c.name)return;let d=t.get(c.name);d?d.push(c):t.set(c.name,[c])});let r=Object.create(null),n=new WeakMap,o=new Map,i=new Set(Array.from(t,([c,d])=>d.length===1?c:null).filter(c=>c!==null)),a=new Set,s=(c,d)=>{nr(c,d),r[d]=c,n.set(c,d),a.add(d)};for(let[c,d]of t)d.length===1&&s(d[0],c);for(let[c,d]of t){if(d.length<2)continue;let l=[];d.forEach((u,m)=>{let f=`${c} [${m+1}]`,w=f,C=2;for(;i.has(w)||a.has(w);)w=`${f}.${C++}`;s(u,w),l.push(w)}),o.set(c,l)}return{nodesById:r,idByNode:n,duplicateNames:o}}function ye(e){return e[Ct]??e.name??null}var Se=Object.freeze([{id:"change-color",label:"Change Color",handling:"viewer",description:"Opens a color picker docked under the action and commits the result to style.material.baseColor."},{id:"change-material",label:"Change Material",handling:"viewer",description:"Opens the material picker so the viewer can swap the object's texture."},{id:"add-text",label:"Add Text",handling:"viewer",description:"Opens a text box docked under the action; the viewer's user types, clicks the object to place it, and can resize, turn, move, or remove it. Saved to the binding's decals."},{id:"add-image",label:"Add Image",handling:"viewer",description:"Lets the viewer's user choose an image, click the object to place it, and resize, turn, move, or remove it. Saved to the binding's decals."},{id:"toggle-visibility",label:"Toggle Visibility",handling:"viewer",description:"Flips the binding's visible flag."},{id:"toggle-light",label:"Toggle Light",handling:"viewer",description:"Turns the scene lights attached to this object on or off, or the object's own glow when none is attached."},{id:"change-light-color",label:"Change Light Color",handling:"viewer",description:"Opens a color picker docked under the action for the scene lights attached to this object, or the object's own glow."},{id:"set-brightness",label:"Set Brightness",handling:"viewer",description:"Opens a brightness slider docked under the action for the scene lights attached to this object, or the object's own glow."}]);function kt(e){return Se.find(t=>t.id===e)}var oo=Se.filter(e=>e.handling==="viewer").map(e=>e.id),io=new Set(["","New Action",...Se.map(e=>e.label)]);function rr(e){return e.trim().replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").replace(/[^a-zA-Z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase()}function or(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,t=>t.toUpperCase())}function $e(e){let t=e.toLowerCase();return t.includes("light")?"light":t.includes("wheel")||t.includes("rim")||t.includes("tire")?"wheel":t.includes("glass")||t.includes("window")||t.includes("windshield")||t.includes("sunroof")?"glass":t.includes("seat")||t.includes("dashboard")||t.includes("console")||t.includes("doorpanel")?"interior":t.includes("floor")?"floor":t.includes("wall")?"wall":t.includes("door")?"door":t.includes("chair")||t.includes("table")||t.includes("sofa")||t.includes("bed")?"furniture":"other"}function ir(e,t=!0){return e==="light"||e.endsWith("light")?[{id:"toggle-light",label:"Toggle Light",type:"command"},{id:"change-light-color",label:"Change Light Color",type:"command"},{id:"set-brightness",label:"Set Brightness",type:"command"}]:[{id:"change-color",label:"Change Color",type:"command"},...t?[{id:"change-material",label:"Change Material",type:"command"}]:[],{id:"toggle-visibility",label:"Toggle Visibility",type:"command"}]}function qe(e,t=!0){let r=$e(e);return{id:rr(e),modelObjectId:e,type:r,label:or(e),status:"normal",selectable:!0,hoverable:!0,visible:!0,style:{},actions:ir(r,t),metrics:{},metadata:{}}}function Tt(e,t){return Object.fromEntries(e.map(r=>[r,qe(r,!t?.has(r))]))}var It=["front","back","double"],Rt=["normal","additive"];var Pt={enabled:!1,axis:"y",position:.5,flip:!1},sr={clips:[],autoplayClip:null},ar={autofocus:{enabled:!1,focusDistance:5,focusRange:5,focalLength:.02,bokehScale:6,target:[0,0,0],mouse:!0,debug:0,manual:!1,smoothTime:.25},toneMapping:{enabled:!1,mode:"aces",exposure:1,resolution:256,whitePoint:4,middleGrey:.6,minLuminance:.01,averageLuminance:1,adaptationRate:1},brightnessContrast:{enabled:!1,brightness:0,contrast:0},hueSaturation:{enabled:!1,hue:0,saturation:0},colorAverage:{enabled:!1},dotScreen:{enabled:!1,angle:Math.PI/2,scale:1},glitch:{enabled:!1,mode:"sporadic",delay:[1.5,3.5],duration:[.6,1],strength:[.3,1],chromaticAberrationOffset:[0,0],columns:.05,ratio:.85},ssao:{enabled:!1,samples:30,rings:4,intensity:8,radius:.25,bias:.025,luminanceInfluence:.6,fade:.01,minRadiusScale:.33,worldDistanceThreshold:20,worldDistanceFalloff:5,worldProximityThreshold:6,worldProximityFalloff:3},bloom:{enabled:!1,intensity:.3,luminanceThreshold:.9,luminanceSmoothing:.2,mipmapBlur:!0,radius:0,levels:8},godRays:{enabled:!1,sunPosition:[5,10,5],samples:60,density:.96,decay:.9,weight:.4,exposure:.6,clampMax:1,blur:!0,kernelSize:"small"},grid:{enabled:!1,scale:1,lineWidth:0},noise:{enabled:!1,opacity:1,premultiply:!1},depthOfField:{enabled:!1,focusDistance:5,focusRange:5,focalLength:.02,bokehScale:6},chromaticAberration:{enabled:!1,offsetX:.002,offsetY:.002,radialModulation:!1,modulationOffset:.15},lensflare:{enabled:!1,lensPosition:[-25,6,-60],smoothTime:.07,glareSize:.2,flareSize:.01,flareSpeed:.01,flareShape:.01,animated:!0,anamorphic:!1,colorGain:"#141414",haloScale:.5,secondaryGhosts:!0,aditionalStreaks:!0,ghostScale:0,opacity:1,starBurst:!1},vignette:{enabled:!1,offset:.3,darkness:.3,eskil:!1},smaa:{enabled:!1},sepia:{enabled:!1,intensity:0},scanline:{enabled:!1,density:1.25},pixelation:{enabled:!1,granularity:5},outline:{enabled:!1,selectionLayer:10,edgeStrength:2.5,pulseSpeed:0,visibleEdgeColor:"#ffffff",hiddenEdgeColor:"#22090a",kernelSize:"large",blur:!1,xRay:!0},selectiveBloom:{enabled:!1,selectionLayer:10,intensity:1,luminanceThreshold:.9,luminanceSmoothing:.025,kernelSize:"large",mipmapBlur:!0,inverted:!1,ignoreBackground:!1},ramp:{enabled:!1,rampType:"linear",rampStart:[.5,.5],rampEnd:[1,1],startColor:"#000000",endColor:"#ffffff",opacity:.5,rampBias:.5,rampGain:.5,rampMask:!1,rampInvert:!1}},oe={model:{rotation:[0,0,0],showAdvancedRotation:!1,renderer:"pbr",shading:"lit",autoRotate:!1,autoRotateSpeed:1},camera:{fieldOfView:50,showAdvancedSettings:!1},lighting:{ambient:{intensity:.25,color:"#ffffff"},lights:[{id:"light-hemi",type:"hemisphere",color:"#ffffff",intensity:.3,position:[0,1,0],attachedToCamera:!1,castShadow:!1,shadowBias:-5e-4,visible:!0},{id:"light-key",type:"directional",color:"#ffffff",intensity:2.5,position:[6,12,6],attachedToCamera:!1,castShadow:!0,shadowBias:-5e-4,visible:!0},{id:"light-fill",type:"directional",color:"#ffffff",intensity:0,position:[-6,8,-6],attachedToCamera:!1,castShadow:!1,shadowBias:-5e-4,visible:!0}]},shadows:{enabled:!0,mapSize:2048,bias:-5e-4,normalBias:.02,radius:3},environment:{source:"preset",preset:"apartment",customEnvironmentUrl:"",intensity:.25,rotation:0,shadowLight:{enabled:!1,intensity:2.5,bias:-5e-4}},wireframe:{enabled:!1,color:"#000000",opacity:1},background:{enabled:!1,type:"color",color:"#1c1c1d",imageUrl:""},groundShadows:{enabled:!1,mode:"shadowCatcher",intensity:.7,borderFade:1,height:0,size:10},postProcessing:ar,animations:sr,annotations:[]};function xe(e){let t=l=>{throw new Error(`Invalid section: ${l}`)},r=l=>l&&typeof l=="object"&&!Array.isArray(l)?l:t("expected an object"),n=l=>typeof l=="string"&&l.trim().length>0&&l.length<=200?l:t("expected a nonempty name or id (up to 200 characters)"),o=l=>typeof l=="number"&&Number.isFinite(l)&&l>=0&&l<=1?l:t("position must be between 0 and 1"),i=l=>!Array.isArray(l)||l.length!==3||!l.every(u=>typeof u=="number"&&Number.isFinite(u))||Math.hypot(...l)<1e-8?t("normal must be a finite, nonzero vector"):[...l],a=l=>{let u=r(l);return!["x","y","z"].includes(u.axis)||typeof u.enabled!="boolean"||typeof u.flip!="boolean"?t("invalid plane"):{enabled:u.enabled,axis:u.axis,position:o(u.position),flip:u.flip,...u.normal!==void 0?{normal:i(u.normal)}:{}}},s=l=>{let u=r(l),m=a(u);if(u.mode!==void 0){if(!["plane","planes","box"].includes(u.mode))return t("invalid mode");m.mode=u.mode}if(u.planes!==void 0){if(!Array.isArray(u.planes)||u.planes.length>6)return t("at most six planes are supported");let f=new Set;m.planes=u.planes.map(w=>{let C=r(w),b=n(C.id);return f.has(b)?t("duplicate plane id"):(f.add(b),{...a(C),id:b,name:n(C.name)})})}if(u.activePlaneId!==void 0&&(m.activePlaneId=n(u.activePlaneId)),u.invertBox!==void 0){if(typeof u.invertBox!="boolean")return t("invalid box inversion");m.invertBox=u.invertBox}if(u.box!==void 0){let f=r(u.box),w=p=>!Array.isArray(p)||p.length!==3?t("invalid box bounds"):p.map(o),C=w(f.min),b=w(f.max);if(C.some((p,h)=>p>=b[h]))return t("box minimum must be below its maximum on every axis");m.box={min:C,max:b}}return m},c=r(e),d=s(c);if(c.presets!==void 0){if(!Array.isArray(c.presets)||c.presets.length>32)return t("at most 32 presets are supported");let l=new Set;d.presets=c.presets.map(u=>{let m=r(u),f=n(m.id);return l.has(f)?t("duplicate preset id"):(l.add(f),{id:f,name:n(m.name),settings:s(m.settings)})})}return d}function Bt(e){let{presets:t,...r}=xe(e);return r}var Ke=require("three"),We=["position","rotation","scale","visible","baseColor","emissive","opacity","roughness","metalness","emissiveIntensity"],Xe=["linear","ease-in","ease-out","ease-in-out","step"],cr=new Set(["position","rotation","scale"]),lr=new Set(["baseColor","emissive"]),se=e=>typeof e=="string"&&e.length>0&&e.length<=256,ce=e=>typeof e=="number"&&Number.isFinite(e),Ge=e=>Array.isArray(e)&&e.length===3&&e.every(ce);function we(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function ae(e){throw new Error(`Invalid sequences: ${e}`)}function dr(e){return e.kind==="object"?JSON.stringify([e.kind,e.objectId,e.property]):e.kind==="clip"?JSON.stringify([e.kind,e.clip]):"camera"}function ur(e,t){if(t.kind==="camera")return we(e)&&Ge(e.position)&&Ge(e.target)&&(e.fov===null||ce(e.fov)&&e.fov>0&&e.fov<180)&&ce(e.zoom)&&e.zoom>0;if(t.kind==="clip")return ce(e)&&e>=0;let r=t.property;return cr.has(r)?Ge(e)&&(r!=="scale"||e.every(n=>n!==0)):lr.has(r)?typeof e=="string"&&/^#[\da-f]{6}$/i.test(e):r==="visible"?typeof e=="boolean":ce(e)&&e>=0&&(r==="emissiveIntensity"||e<=1)}function Ie(e){(!Array.isArray(e)||e.length>64)&&ae("expected up to 64 sequences.");let t=new Set,r=0;return e.map(n=>{(!we(n)||!se(n.id)||t.has(n.id)||!(typeof n.name=="string"&&se(n.name.trim()))||!ce(n.duration)||n.duration<.1||n.duration>3600||typeof n.loop!="boolean"||typeof n.autoPlay!="boolean"||!Array.isArray(n.tracks)||n.tracks.length>128)&&ae("each sequence needs a unique id, name, 0.1\u20133600 second duration, loop/autoplay flags and up to 128 tracks."),t.add(n.id);let o=new Set,i=new Set,a=n.tracks.map(s=>{(!we(s)||!se(s.id)||o.has(s.id)||!(typeof s.name=="string"&&se(s.name.trim()))||!we(s.target)||!Array.isArray(s.keyframes)||s.keyframes.length>2048||s.muted!==void 0&&typeof s.muted!="boolean")&&ae("invalid or duplicate track."),o.add(s.id);let c;s.target.kind==="camera"?c={kind:"camera"}:s.target.kind==="clip"&&se(s.target.clip)?c={kind:"clip",clip:s.target.clip}:s.target.kind==="object"&&se(s.target.objectId)&&We.includes(s.target.property)?c={kind:"object",objectId:s.target.objectId,property:s.target.property}:ae("unknown track target or property.");let d=dr(c);i.has(d)&&ae("only one track may own each target property in a sequence."),i.add(d);let l=new Set,u=new Set,m=s.keyframes.map(f=>{++r>2e4&&ae("too many keyframes."),(!we(f)||!se(f.id)||l.has(f.id)||!ce(f.time)||f.time<0||f.time>n.duration||u.has(f.time)||f.easing!==void 0&&!Xe.includes(f.easing)||!ur(f.value,c))&&ae("keyframes need unique ids/times, valid values and times inside the sequence."),l.add(f.id),u.add(f.time);let w=f.value,C=c.kind==="camera"?{position:[...w.position],target:[...w.target],fov:w.fov,zoom:w.zoom}:Array.isArray(f.value)?[...f.value]:f.value;return{id:f.id,time:f.time,value:C,...f.easing?{easing:f.easing}:{}}}).sort((f,w)=>f.time-w.time);return{id:s.id,name:s.name.trim(),target:c,keyframes:m,...s.muted!==void 0?{muted:s.muted}:{}}});return{id:n.id,name:n.name.trim(),duration:n.duration,loop:n.loop,autoPlay:n.autoPlay,tracks:a}})}function mr(e,t="ease-in-out"){let r=Math.max(0,Math.min(1,e));return t==="step"?0:t==="ease-in"?r*r:t==="ease-out"?1-(1-r)**2:t==="ease-in-out"?r*r*(3-2*r):r}var Te=(e,t,r)=>e+(t-e)*r,He=(e,t,r)=>e.map((n,o)=>Te(n,t[o],r));function Et(e,t){if(e.muted||!e.keyframes.length||!Number.isFinite(t))return null;let r=e.keyframes;if(t<r[0].time)return null;let n=r[0],o;for(let c of r)if(c.time<=t)n=c;else{o=c;break}if(!o||typeof n.value=="boolean")return structuredClone(n.value);let i=mr((t-n.time)/(o.time-n.time),n.easing);if(typeof n.value=="number"&&typeof o.value=="number")return Te(n.value,o.value,i);if(typeof n.value=="string"&&typeof o.value=="string")return`#${new Ke.Color(n.value).lerp(new Ke.Color(o.value),i).getHexString()}`;if(Array.isArray(n.value)&&Array.isArray(o.value))return He(n.value,o.value,i);let a=n.value,s=o.value;return{position:He(a.position,s.position,i),target:He(a.target,s.target,i),fov:a.fov!==null&&s.fov!==null?Te(a.fov,s.fov,i):a.fov,zoom:Te(a.zoom,s.zoom,i)}}function Dt(e,t){return{...e,keyframes:[...e.keyframes.filter(r=>r.id!==t.id&&Math.abs(r.time-t.time)>1e-6),t].sort((r,n)=>r.time-n.time)}}var K=require("three");function Ye(e){return e.id??e.url}function pe(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Expected an asset transform object.");let t={};for(let r of["position","rotation","scale"]){let n=e[r];if(n!==void 0){if(!Array.isArray(n)||n.length!==3||!n.every(o=>typeof o=="number"&&Number.isFinite(o))||r==="scale"&&n.some(o=>o===0))throw new Error(`Invalid asset ${r}: expected three finite ${r==="scale"?"nonzero ":""}numbers.`);t[r]=[...n]}}return t}function Vt(e,t){if(!Number.isFinite(t)||t<=0)throw new Error("Grid size must be positive.");let r=pe(e),[n,o,i]=r.position??[0,0,0];return{...r,position:[Math.round(n/t)*t,o,Math.round(i/t)*t]}}function Nt(e,t){let r=pe(e),n=r.position??[0,0,0],o=new K.Matrix4().compose(new K.Vector3(...n),new K.Quaternion().setFromEuler(new K.Euler(...r.rotation??[0,0,0])),new K.Vector3(...r.scale??[1,1,1])),i=new K.Box3(new K.Vector3(...t.min),new K.Vector3(...t.max)).applyMatrix4(o);if(!Number.isFinite(i.min.y))throw new Error("Cannot place an asset with empty bounds.");return{...r,position:[n[0],n[1]-i.min.y,n[2]]}}var Q=require("three"),fr=new Map,Je={color:"#93c5fd",intensity:.07},po=new Q.Color(Je.color).multiplyScalar(Je.intensity),go=new Q.Color(Je.color);var pr=new Map;function Lt(e){return pr.get(e)}function _t(e){for(let t of fr.values())if(t.texture.source===e.source&&(!t.loaded||t.failed))return!0;return!1}var B=require("three");function Ut(e){if(e.length!==3)return null;let t=new B.Vector3(...e[0]).sub(new B.Vector3(...e[1])),r=new B.Vector3(...e[2]).sub(new B.Vector3(...e[1]));return t.lengthSq()===0||r.lengthSq()===0?null:Math.acos(Math.max(-1,Math.min(1,t.normalize().dot(r.normalize()))))*180/Math.PI}function zt(e,t){if(!e.normal)return null;let r=new B.Vector3(...e.normal);if(r.lengthSq()===0)return null;r.normalize();let n=new B.Vector3(...t),o=n.clone().sub(new B.Vector3(...e.position)).dot(r);return{distance:Math.abs(o),projection:n.addScaledVector(r,-o).toArray()}}function Ft(e){if(e.length<3)return{error:"Pick at least three points to finish the area."};let t=new B.Vector3(...e[0]),r=e.map(b=>new B.Vector3(...b).sub(t)),n=Math.max(...r.map(b=>b.length()));if(n===0)return{error:"Area points must be distinct."};let o=new B.Vector3;for(let b=1;b<r.length-1;b+=1){let p=r[b].clone().cross(r[b+1]);p.lengthSq()>o.lengthSq()&&o.copy(p)}if(o.length()<=n*n*1e-10)return{error:"Area points must not lie on one straight line."};o.normalize();let i=Math.max(n*1e-5,Number.EPSILON*Math.max(...e.flat().map(Math.abs))*32);if(r.some(b=>Math.abs(b.dot(o))>i))return{error:"Area points must lie on one plane."};let a=r.find(b=>b.length()>n*1e-10).clone().normalize(),s=o.clone().cross(a).normalize(),c=r.map(b=>new B.Vector2(b.dot(a),b.dot(s))),d=(b,p,h)=>(p.x-b.x)*(h.y-b.y)-(p.y-b.y)*(h.x-b.x),l=n*n*1e-10,u=(b,p,h)=>Math.abs(d(b,p,h))<=l&&h.x>=Math.min(b.x,p.x)-n*1e-10&&h.x<=Math.max(b.x,p.x)+n*1e-10&&h.y>=Math.min(b.y,p.y)-n*1e-10&&h.y<=Math.max(b.y,p.y)+n*1e-10;for(let b=0;b<c.length;b+=1){let p=c[b],h=c[(b+1)%c.length];if(p.distanceTo(h)<=n*1e-10)return{error:"Area points must be distinct."};for(let v=b+1;v<c.length;v+=1){if(v===b+1||b===0&&v===c.length-1)continue;let M=c[v],y=c[(v+1)%c.length],P=d(p,h,M),V=d(p,h,y),re=d(M,y,p),x=d(M,y,h);if(P*V<0&&re*x<0||u(p,h,M)||u(p,h,y)||u(M,y,p)||u(M,y,h))return{error:"Area edges must not cross or touch each other."}}}let m=0,f=0,w=0;for(let b=0;b<c.length;b+=1){let p=c[b],h=c[(b+1)%c.length],v=p.x*h.y-h.x*p.y;m+=v,f+=(p.x+h.x)*v,w+=(p.y+h.y)*v}if(Math.abs(m)<=l)return{error:"The polygon has no measurable area."};let C=t.clone().addScaledVector(a,f/(3*m)).addScaledVector(s,w/(3*m));return{area:Math.abs(m)/2,center:C.toArray(),triangles:B.ShapeUtils.triangulateShape(c,[])}}function $t(e,t){if(e.length<2)return 0;let r=0;for(let n=1;n<e.length;n+=1)r+=new B.Vector3(...e[n]).distanceTo(new B.Vector3(...e[n-1]));return t&&(r+=new B.Vector3(...e[e.length-1]).distanceTo(new B.Vector3(...e[0]))),r}var Qe=["m","cm","mm","in","ft"],Ze={m:1,cm:.01,mm:.001,in:.0254,ft:.3048},gr=["distance","angle","area","pointToPlane","wrap","wrapHorizontal"];function et(e){return Qe.includes(e)}function tt(e={},t="m"){let r=e.displayUnit??t,n=e.metersPerUnit??Ze[e.sourceUnit??"m"];if(!Number.isFinite(n)||n<=0)throw new Error("Measurement scale must be a positive finite number.");return{displayUnit:r,metersPerUnit:n,factor:et(r)?n/Ze[r]:1}}function qt(e,t,r,n={}){if(!et(r)||!Number.isFinite(e)||e<=0||!Number.isFinite(t)||t<=0)throw new Error("Calibration needs two distinct points and a positive known distance.");let o=t*Ze[r]/e;if(!Number.isFinite(o)||o<=0)throw new Error("Calibration scale is outside the supported range.");return{...n,metersPerUnit:o}}function Re(e,t){let r=t.map(n=>n.position);if(e==="angle"){let n=Ut(r);return n===null?null:{value:n,dimension:0}}if(e==="area"){let n=Ft(r);return"error"in n?null:{value:n.area,dimension:2}}if(e==="pointToPlane"){let n=t.length===2?zt(t[0],t[1].position):null;return n?{value:n.distance,dimension:1}:null}return t.length<(e==="distance"?2:3)?null:{value:$t(r,e!=="distance"),dimension:1}}function nt(e,t={},r="m",n=e.points,o=e.approximate?"approximate":"ready"){let i=Re(e.tool,n),{factor:a,displayUnit:s}=tt(t,r),c=o==="ready"||o==="approximate",d=c&&i?i.value*a**i.dimension:null;return{id:e.id,status:c?i&&d!==null&&Number.isFinite(d)?o:"invalid":o,rawValue:c&&i&&Number.isFinite(i.value)?i.value:null,value:d!==null&&Number.isFinite(d)?d:null,unit:e.tool==="angle"?"\xB0":e.tool==="area"?`${s}\xB2`:s}}function le(e){function t(){throw new Error("Invalid measurements: expected settings and valid named measurements with finite points.")}let r=s=>!!s&&typeof s=="object"&&!Array.isArray(s),n=s=>Array.isArray(s)&&s.length===3&&s.every(c=>typeof c=="number"&&Number.isFinite(c));typeof e=="string"&&(e.length>5*1024*1024&&t(),e=JSON.parse(e)),(!r(e)||e.version!==void 0&&e.version!==1||!r(e.settings)||!Array.isArray(e.items)||e.items.length>256)&&t();let o={};for(let s of["sourceUnit","displayUnit"])e.settings[s]!==void 0&&(et(e.settings[s])||t(),o[s]=e.settings[s]);e.settings.metersPerUnit!==void 0&&((typeof e.settings.metersPerUnit!="number"||!Number.isFinite(e.settings.metersPerUnit)||e.settings.metersPerUnit<=0)&&t(),o.metersPerUnit=e.settings.metersPerUnit);let i=new Set,a=e.items.map(s=>{(!r(s)||typeof s.id!="string"||!s.id||i.has(s.id)||typeof s.name!="string"||!s.name.trim()||typeof s.modelId!="string"||!s.modelId||!gr.includes(s.tool)||!Array.isArray(s.points)||s.points.length>8192||typeof s.createdAt!="string"||!Number.isFinite(Date.parse(s.createdAt)))&&t(),i.add(s.id),s.tilesetUrl!==void 0&&s.tilesetUrl!==null&&typeof s.tilesetUrl!="string"&&t(),(s.visible!==void 0&&typeof s.visible!="boolean"||s.approximate!==void 0&&typeof s.approximate!="boolean")&&t();let c=new Set,d=s.points.map(u=>{if((!r(u)||typeof u.id!="number"||!Number.isFinite(u.id)||!n(u.position))&&t(),c.has(u.id)&&t(),c.add(u.id),u.normal!==void 0&&!n(u.normal)&&t(),u.faceVertices!==void 0&&(!Array.isArray(u.faceVertices)||u.faceVertices.length!==3||!u.faceVertices.every(n))&&t(),u.snapped!==void 0&&!["vertex","edge"].includes(u.snapped)&&t(),u.anchor!==void 0){let f=u.anchor;(!r(f)||typeof f.nodeId!="string"||!f.nodeId||!n(f.localPosition)||typeof f.geometrySignature!="string"||typeof f.poseSignature!="string")&&t(),f.localNormal!==void 0&&!n(f.localNormal)&&t(),f.localFaceVertices!==void 0&&(!Array.isArray(f.localFaceVertices)||f.localFaceVertices.length!==3||!f.localFaceVertices.every(n))&&t(),f.instanceId!==void 0&&(!Number.isInteger(f.instanceId)||f.instanceId<0)&&t()}let m=u.anchor;return{id:u.id,position:[...u.position],...u.normal?{normal:[...u.normal]}:{},...u.faceVertices?{faceVertices:u.faceVertices.map(f=>[...f])}:{},...u.snapped?{snapped:u.snapped}:{},...m?{anchor:{nodeId:m.nodeId,localPosition:[...m.localPosition],geometrySignature:m.geometrySignature,poseSignature:m.poseSignature,...m.localNormal?{localNormal:[...m.localNormal]}:{},...m.localFaceVertices?{localFaceVertices:m.localFaceVertices.map(f=>[...f])}:{},...m.instanceId!==void 0?{instanceId:m.instanceId}:{}}}:{}}}),l={id:s.id,name:s.name,modelId:s.modelId,tool:s.tool,points:d,createdAt:s.createdAt,...s.tilesetUrl!==void 0?{tilesetUrl:s.tilesetUrl}:{},...s.visible!==void 0?{visible:s.visible}:{},...s.approximate!==void 0?{approximate:s.approximate}:{}};return Re(l.tool,d)||t(),l});return{settings:o,items:a}}function Gt(e){return JSON.stringify({version:1,...le(e)},null,2)}function Ht(e,t,r="m"){let n=le(e),o=new Map(t?.map(a=>[a.id,a])),i=a=>{let s=String(a??"");return/^[=+@-]/.test(s)&&(s=`'${s}`),`"${s.replace(/"/g,'""')}"`};return[["id","name","modelId","type","status","value","unit","createdAt"],...n.items.map(a=>{let s=o.get(a.id)??nt(a,n.settings,r);return[a.id,a.name,a.modelId,a.tool,s.status,s.value,s.unit,a.createdAt]})].map(a=>a.map(i).join(",")).join(`\r
|
|
2
|
+
`)}function Pe(e){if(!Array.isArray(e)||e.length>128)throw new Error("Invalid selections: expected up to 128 named selection sets.");let t=new Set;return e.map(r=>{if(!r||typeof r!="object"||typeof r.id!="string"||!r.id||t.has(r.id)||typeof r.name!="string"||!r.name.trim()||r.name.length>200||!Array.isArray(r.objectIds)||r.objectIds.length>1e5||r.objectIds.some(n=>typeof n!="string"||!n))throw new Error("Invalid selections: each set needs a unique id, a name, and model object ids.");return t.add(r.id),{id:r.id,name:r.name.trim(),objectIds:[...new Set(r.objectIds)]}})}var Wt=new Set(["__proto__","constructor","prototype"]),rt=(e,t)=>e<t?-1:e>t?1:0;function k(e){throw new Error(`Invalid product: ${e}`)}var U=e=>!!e&&typeof e=="object"&&!Array.isArray(e),ve=e=>typeof e=="string"&&e.length>0&&e.length<=200&&!Wt.has(e),ee=e=>typeof e=="string"&&e.trim().length>0&&e.length<=500;function Xt(e){let t=0;function r(n,o){return(++t>1e5||o>32)&&k("definition is too complex."),n===null||typeof n=="string"||typeof n=="boolean"||typeof n=="number"&&Number.isFinite(n)?n:Array.isArray(n)?n.map(i=>r(i,o+1)):(U(n)||k("expected JSON data."),Object.fromEntries(Object.entries(n).filter(([,i])=>i!==void 0).map(([i,a])=>(Wt.has(i)&&k("reserved property name."),[i,r(a,o+1)]))))}return r(e,0)}function br(e){if(typeof e!="string"||e.length>2048)return!1;try{return["http:","https:"].includes(new URL(e.replace(/\{[a-zA-Z]+\}/g,"x")).protocol)}catch{return!1}}function ot(e){let t=Xt(typeof e=="string"?JSON.parse(e):e);(!U(t)||!ve(t.id)||!ee(t.label)||!ve(t.revision)||!Array.isArray(t.groups)||!t.groups.length||t.groups.length>64)&&k("id, label, revision, and 1\u201364 option groups are required.");let r=new Map;for(let o of t.groups){(!U(o)||!ve(o.id)||r.has(o.id)||!ee(o.label)||o.required!==void 0&&typeof o.required!="boolean"||!Array.isArray(o.options)||!o.options.length||o.options.length>128)&&k("groups need unique ids, labels, and 1\u2013128 options.");let i=new Set;r.set(o.id,i);for(let a of o.options)if((!U(a)||!ve(a.id)||i.has(a.id)||!ee(a.label)||a.sku!==void 0&&!ee(a.sku))&&k("options need unique ids and labels."),i.add(a.id),a.description!==void 0&&!ee(a.description)&&k("an option description must be text."),a.swatch!==void 0&&!(typeof a.swatch=="string"&&/^#[0-9a-f]{3,8}$/i.test(a.swatch))&&k("a swatch must be a hex color."),a.priceDeltaMinor!==void 0&&!Number.isSafeInteger(a.priceDeltaMinor)&&k("a price change must be a whole number of minor units."),a.variants!==void 0&&(!Array.isArray(a.variants)||a.variants.some(s=>!ee(s)))&&k("variant names must be strings."),a.appearance!==void 0){(!Array.isArray(a.appearance)||a.appearance.length>128)&&k("invalid appearance edits.");for(let s of a.appearance){U(s)||k("invalid appearance edit.");let c=s.target;typeof c=="string"&&c||Array.isArray(c)&&c.every(d=>typeof d=="string"&&!!d)||U(c)&&Object.keys(c).length===1&&["group","tag","type"].some(d=>typeof c[d]=="string")||k("appearance needs an object id, id list, or selector."),s.visible!==void 0&&typeof s.visible!="boolean"&&k("visibility must be boolean."),s.material!==void 0&&!U(s.material)&&k("material must be an object.");for(let d of Object.values(s.material??{}))typeof d=="string"||typeof d=="number"||typeof d=="boolean"||d===null||U(d)&&typeof d.path=="string"&&(d.offset===void 0||Array.isArray(d.offset)&&d.offset.length===2&&d.offset.every(l=>typeof l=="number"))||k("invalid material field.")}}o.defaultOptionId!==void 0&&!i.has(o.defaultOptionId)&&k("a default must name an option in its group."),o.display!==void 0&&!["list","chips","swatches"].includes(o.display)&&k("a group's display must be list, chips or swatches.")}t.pricing!==void 0&&!(U(t.pricing)&&/^[A-Z]{3}$/.test(t.pricing.currency)&&Number.isSafeInteger(t.pricing.basePriceMinor)&&t.pricing.basePriceMinor>=0)&&k("pricing needs a 3-letter currency and a base price of zero or more."),t.checkout!==void 0&&(!U(t.checkout)||t.checkout.label!==void 0&&!ee(t.checkout.label)||!br(t.checkout.urlTemplate))&&k("a checkout link needs an http or https URL.");let n=o=>U(o)&&typeof o.groupId=="string"&&typeof o.optionId=="string"&&!!r.get(o.groupId)?.has(o.optionId);if(t.rules!==void 0){(!Array.isArray(t.rules)||t.rules.length>2048)&&k("invalid rules.");let o=new Set;for(let i of t.rules){(!U(i)||!ve(i.id)||o.has(i.id)||!n(i.when)||i.message!==void 0&&!ee(i.message))&&k("rules need unique ids and valid option references."),o.add(i.id),["requires","excludes"].some(a=>Array.isArray(i[a])&&i[a].length>0)||k("a rule needs a requires or excludes constraint.");for(let a of["requires","excludes"])i[a]!==void 0&&(!Array.isArray(i[a])||i[a].length>128||!i[a].every(n))&&k("rule references must name existing options.")}}if(t.skus!==void 0){(!Array.isArray(t.skus)||t.skus.length>4096)&&k("invalid SKU table.");let o=new Set;for(let i of t.skus){(!U(i)||!ee(i.sku)||!U(i.selections)||Object.keys(i.selections).length!==r.size)&&k("SKU mappings need one selection per group.");for(let[s,c]of Object.entries(i.selections))(!r.has(s)||c!==null&&!r.get(s).has(c))&&k("SKU mapping references an unknown option.");let a=JSON.stringify(Object.entries(i.selections).sort(([s],[c])=>rt(s,c)));o.has(a)&&k("a combination can map to only one SKU."),o.add(a)}}return{id:t.id,label:t.label,revision:t.revision,groups:t.groups.map(o=>({id:o.id,label:o.label,...o.required!==void 0?{required:o.required}:{},...o.defaultOptionId!==void 0?{defaultOptionId:o.defaultOptionId}:{},...o.display!==void 0?{display:o.display}:{},options:o.options.map(i=>({id:i.id,label:i.label,...i.sku!==void 0?{sku:i.sku}:{},...i.description!==void 0?{description:i.description}:{},...i.swatch!==void 0?{swatch:i.swatch}:{},...i.priceDeltaMinor!==void 0?{priceDeltaMinor:i.priceDeltaMinor}:{},...i.variants!==void 0?{variants:i.variants}:{},...i.appearance!==void 0?{appearance:i.appearance.map(a=>({target:a.target,...a.material!==void 0?{material:a.material}:{},...a.visible!==void 0?{visible:a.visible}:{}}))}:{}}))})),...t.rules!==void 0?{rules:t.rules.map(o=>({id:o.id,when:o.when,...o.requires?{requires:o.requires}:{},...o.excludes?{excludes:o.excludes}:{},...o.message?{message:o.message}:{}}))}:{},...t.skus!==void 0?{skus:t.skus.map(o=>({sku:o.sku,selections:o.selections}))}:{},...t.pricing!==void 0?{pricing:{currency:t.pricing.currency,basePriceMinor:t.pricing.basePriceMinor}}:{},...t.checkout!==void 0?{checkout:{urlTemplate:t.checkout.urlTemplate,...t.checkout.label!==void 0?{label:t.checkout.label}:{}}}:{}}}function ge(e){return Object.fromEntries(e.groups.map(t=>[t.id,t.defaultOptionId??null]))}function hr(e,t){let r=[];for(let n of e.groups){if(t[n.id]===null)continue;let o=n.options.find(i=>i.id===t[n.id])?.sku;if(!o)return null;r.push(o)}return r.length?r.join("-"):null}function J(e,t=ge(e),r=1){if(!Number.isSafeInteger(r)||r<1||r>9999)throw new Error("Quantity must be an integer from 1 to 9999.");if(!U(t)||Object.values(t).some(l=>l!==null&&typeof l!="string"))throw new Error("Product selections must map group ids to option ids or null.");let n=[],o=[...e.groups].sort((l,u)=>rt(l.id,u.id)),i=Object.fromEntries(o.map(l=>[l.id,!Object.prototype.hasOwnProperty.call(t,l.id)||t[l.id]===void 0?l.defaultOptionId??null:t[l.id]]));for(let l of Object.keys(t).sort())e.groups.some(u=>u.id===l)||n.push({code:"unknown-group",groupIds:[l],message:`Unknown option group: ${l}.`});let a=[];for(let l of o){let u=i[l.id],m=l.options.find(f=>f.id===u);u!==null&&!m?n.push({code:"unknown-option",groupIds:[l.id],message:`Unknown choice for ${l.label}: ${u}.`}):l.required&&u===null&&n.push({code:"required",groupIds:[l.id],message:`Choose ${l.label}.`}),m&&a.push({groupId:l.id,optionId:m.id,label:m.label,...m.sku?{sku:m.sku}:{}})}let s=l=>e.groups.find(u=>u.id===l.groupId)?.options.find(u=>u.id===l.optionId)?.label??l.optionId;for(let l of[...e.rules??[]].sort((u,m)=>rt(u.id,m.id)))if(i[l.when.groupId]===l.when.optionId){for(let u of l.requires??[])i[u.groupId]!==u.optionId&&n.push({code:"requires",ruleId:l.id,groupIds:[...new Set([l.when.groupId,u.groupId])],message:l.message??`${s(l.when)} requires ${s(u)}.`});for(let u of l.excludes??[])i[u.groupId]===u.optionId&&n.push({code:"excludes",ruleId:l.id,groupIds:[...new Set([l.when.groupId,u.groupId])],message:l.message??`${s(l.when)} cannot be combined with ${s(u)}.`})}let c=e.skus?.length?e.skus.find(l=>o.every(u=>l.selections[u.id]===i[u.id]))?.sku??null:hr(e,i);e.skus?.length&&!c&&!n.length&&n.push({code:"sku",groupIds:o.map(l=>l.id),message:"This combination has no product SKU."});let d=JSON.stringify({productId:e.id,revision:e.revision,quantity:r,selections:i});return{version:1,productId:e.id,revision:e.revision,key:d,quantity:r,selections:i,sku:c,items:a,valid:!n.length,issues:n}}var Yt=new Set(["requires","excludes"]);function Be(e,t,r,n,o=1){let i={...J(e,t,o).selections,[r]:n},a=new Set([JSON.stringify(i)]),s=[i];for(let c=0;c<s.length&&c<2e3;c++){let d=s[c],l=J(e,d,o).issues.filter(u=>Yt.has(u.code));if(!l.length)return d;for(let u of new Set(l.flatMap(m=>m.groupIds))){if(u===r)continue;let m=e.groups.find(f=>f.id===u);if(m)for(let f of[...m.options.map(w=>w.id),...m.required?[]:[null]]){let w={...d,[u]:f},C=JSON.stringify(w);a.has(C)||(a.add(C),s.push(w))}}}return null}function yr(e,t,r,n,o){let i=Be(e,t,r,n,o);return i?Object.entries(i).filter(([a,s])=>a!==r&&s!==t[a]&&s!==null).map(([a,s])=>({groupId:a,optionId:s})):null}function Jt(e,t){if(!e.pricing)return null;let r=e.pricing.basePriceMinor;for(let n of t.items)r+=e.groups.find(o=>o.id===n.groupId)?.options.find(o=>o.id===n.optionId)?.priceDeltaMinor??0;return{amountMinor:Math.max(0,r)*t.quantity,currency:e.pricing.currency}}function Zt(e,t,r=!1){try{let n=new Intl.NumberFormat(void 0,{style:"currency",currency:t,...r?{signDisplay:"exceptZero"}:{}});return n.format(e/10**(n.resolvedOptions().maximumFractionDigits??2))}catch{return`${e} ${t}`}}function Qt(e,t){let r=e.checkout?.urlTemplate;if(!r||!t.valid||r.includes("{sku}")&&!t.sku)return null;let n={sku:t.sku??"",quantity:String(t.quantity),productId:e.id,revision:e.revision,selections:it(t.selections)};return r.replace(/\{([a-zA-Z]+)\}/g,(o,i)=>Object.prototype.hasOwnProperty.call(n,i)?encodeURIComponent(n[i]):o)}function it(e){return Object.entries(e).filter(([,t])=>t!==null).map(([t,r])=>`${encodeURIComponent(t)}:${encodeURIComponent(r)}`).join(",")}function en(e,t){let r={...ge(t)};for(let n of e.split(",")){let[o,i]=n.split(":");if(!o||!i)continue;let a,s;try{a=decodeURIComponent(o),s=decodeURIComponent(i)}catch{continue}t.groups.find(c=>c.id===a)?.options.some(c=>c.id===s)&&(r[a]=s)}return r}var Kt=4096;function tn(e,t="-"){let r=[{}];for(let i of e.groups){let a=[...i.options.map(s=>s.id),...i.required?[]:[null]];if(r.length*a.length>Kt*8)throw new Error("This product has too many combinations to list. Use a pricing service to resolve SKUs instead.");r=r.flatMap(s=>a.map(c=>({...s,[i.id]:c})))}let n={...e,skus:void 0},o=[];for(let i of r){if(J(n,i).issues.length)continue;let a=e.groups.flatMap(s=>{let c=i[s.id];return c===null?[]:[s.options.find(d=>d.id===c)?.sku??null]});if(!(!a.length||a.includes(null))&&(o.push({sku:a.join(t),selections:i}),o.length>Kt))throw new Error("This product has too many combinations to list. Use a pricing service to resolve SKUs instead.")}return o}function nn(e,t={},r){let n=[],o=ge(e),i=J({...e,skus:void 0},o).issues.filter(s=>Yt.has(s.code));for(let s of i)n.push({code:"invalid-default",message:`The default choices conflict: ${s.message}`});e.checkout?.urlTemplate.includes("{sku}")&&!e.skus?.length&&e.groups.some(s=>s.options.some(c=>!c.sku))&&n.push({code:"missing-sku",message:"The buy link uses {sku}, but it won't appear until every option has an SKU."});let a=Object.keys(t).length>0;for(let s of e.groups)for(let c of s.options){let d=`${s.label} \u203A ${c.label}`,l={groupId:s.id,optionId:c.id};if(a)for(let m of c.appearance??[])H(t,m.target).length||n.push({code:"no-objects",message:`${d} changes objects that aren't in this model.`,...l});if(r)for(let m of c.variants??[])r.includes(m)||n.push({code:"missing-variant",message:`${d} uses a material variant this model doesn't have: ${m}.`,...l});let u={...o,[s.id]:c.id};Be(e,u,s.id,c.id)||n.push({code:"unreachable",message:`The rules leave no way to choose ${d}.`,...l})}return n}function rn(e,t,r,n=1){return t=J(e,t,n).selections,e.groups.flatMap(o=>o.options.map(i=>{let s=J(e,{...t,[o.id]:i.id},n).issues.filter(l=>l.groupIds.includes(o.id)&&l.code!=="sku").map(l=>l.message),c=r?.options?.find(l=>l.groupId===o.id&&l.optionId===i.id);c?.available===!1&&s.push(c.reason??"Currently unavailable.");let d=s.length&&c?.available!==!1?yr(e,t,o.id,i.id,n):null;return{groupId:o.id,optionId:i.id,selected:t[o.id]===i.id,available:!s.length,...d?{fix:d}:{},reasons:[...new Set(s)]}}))}function Ee(e){U(e)||k("expected a product definition and selections.");let t=ot(e.definition),r=J(t,e.selections??ge(t));return r.issues.some(n=>n.code==="unknown-group"||n.code==="unknown-option")&&k("selections reference unknown options."),{definition:t,selections:r.selections}}function on(e){return JSON.stringify({version:1,productId:e.productId,revision:e.revision,quantity:e.quantity,selections:e.selections})}function sn(e,t){let r=Xt(typeof e=="string"?JSON.parse(e):e);if(!U(r)||r.version!==1||r.productId!==t.id||r.revision!==t.revision)throw new Error("This configuration belongs to a different product or revision.");if(!U(r.selections)||!Number.isSafeInteger(r.quantity))throw new Error("Invalid product configuration selections or quantity.");let n=J(t,r.selections,r.quantity);if(n.issues.some(o=>o.code==="unknown-group"||o.code==="unknown-option"))throw new Error("This configuration references unknown product options.");return n}function an(e,t,r=[],n=[]){let o=e,i=[...r];if(!t)return{objectBindings:o,activeVariants:i};for(let a of t.definition.groups){let s=a.options.find(c=>c.id===(t.selections[a.id]===void 0?a.defaultOptionId:t.selections[a.id]));if(s){for(let c of s.appearance??[])o=je(o,c.target,{...c.material!==void 0?{style:{material:c.material}}:{},...c.visible!==void 0?{visible:c.visible}:{}});if(s.variants?.length){let c=new Set(a.options.flatMap(d=>d.variants??[]));i=i.filter(d=>!c.has(d));for(let d of s.variants)i=ke(i,d,n)}}}return{objectBindings:o,activeVariants:i}}var te=5*1024*1024,Sr=["activeModelId","modelUrl","modelFormat","tilesetUrl","models","mergeModels","sceneConfig","isolation","multiSelectedKeys","activeAnnotation","annotationCategories","backgroundColor","shadows","cinematic","cameraControllerType","objectTransformSpace","arScaleMode","usdzUrl","measurements","measurementSettings","measurementUnit","measurementModelId"];function g(e,t){throw new Error(`Invalid viewer state at ${e}: ${t}`)}function D(e,t){(!e||typeof e!="object"||Array.isArray(e))&&g(t,"expected an object.")}function Ae(e,t){(!Array.isArray(e)||!e.every(r=>typeof r=="string"))&&g(t,"expected strings.")}function X(e,t,r){(!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n)))&&g(r,`expected ${t} finite numbers.`)}function xr(e){let t=new Set,r=0;function n(o,i,a){if((++r>2e5||a>64)&&g(i,"configuration is too complex."),o===null||typeof o=="string"||typeof o=="boolean"||typeof o=="number"&&Number.isFinite(o))return o;(typeof o!="object"||!o)&&g(i,"expected JSON data (finite numbers, no functions)."),t.has(o)&&g(i,"cyclic data."),!Array.isArray(o)&&Object.getPrototypeOf(o)!==Object.prototype&&Object.getPrototypeOf(o)!==null&&g(i,"expected plain JSON data."),t.add(o);let s=Array.isArray(o)?[]:{};for(let[c,d]of Object.entries(o))["__proto__","constructor","prototype"].includes(c)&&g(`${i}.${c}`,"reserved property."),d!==void 0?s[c]=n(d,`${i}.${c}`,a+1):Array.isArray(o)&&g(i,"undefined array entry.");return t.delete(o),s}return n(e,"state",0)}function Y(e,t,r,n,o=!1,i){let a=e[t];if(a==null||a==="")return;typeof a!="string"&&g(r,"expected a URL.");let s=o?Lt(a)??a:a;if(s.trim().startsWith("blob:")){if(o&&i){i.set(a,{source:s,path:r});return}g(r,o?"this image is temporary. Use getStateAsync() for JSON or createShareUrl() to include it.":"upload this model/environment asset to a durable URL before saving or sharing.")}if(s!==a&&(a=s,e[t]=s),o&&/^data:image\//i.test(a))return;let c;try{c=new URL(a,n??"https://relative.invalid/")}catch{g(r,"invalid asset URL.")}["http:","https:"].includes(c.protocol)||g(r,"use an HTTP(S) asset URL."),n&&(e[t]=c.href)}function wr(e,t){D(e,t),X(e.position,3,`${t}.position`),X(e.target,3,`${t}.target`),(typeof e.zoom!="number"||e.zoom<=0)&&g(t,"zoom must be positive."),e.fov!==null&&(typeof e.fov!="number"||e.fov<=0||e.fov>=180)&&g(t,"fov must be null or between 0 and 180.");for(let r of["azimuthAngle","polarAngle"])e[r]!==void 0&&typeof e[r]!="number"&&g(t,`${r} must be a number.`)}function dn(e,t,r,n){D(e,t),(typeof e.id!="number"||typeof e.title!="string"||typeof e.description!="string")&&g(t,"expected an annotation id, title and description.");for(let o of["worldPosition","localPosition"])X(e[o],3,`${t}.${o}`);e.images!==void 0&&(Array.isArray(e.images)||g(t,"images must be an array."),e.images.forEach(o=>{D(o,t),Y(o,"src",t,r,!0,n)})),e.links!==void 0&&(Array.isArray(e.links)||g(t,"links must be an array."),e.links.forEach(o=>{D(o,t),Y(o,"href",t,r,!1,n)}))}function un(e,t){D(e,t),e.waypoints!==void 0&&(Array.isArray(e.waypoints)||g(t,"expected waypoints."),e.waypoints.forEach(r=>{D(r,t),X(r.position,3,t),X(r.target,3,t)}));for(let r of["enabled","loop","autoPlay"])e[r]!==void 0&&typeof e[r]!="boolean"&&g(t,`${r} must be boolean.`);e.duration!==void 0&&(typeof e.duration!="number"||e.duration<=0)&&g(t,"duration must be positive.")}function st(e,t,r){if(t!==null)if(Array.isArray(t))Array.isArray(e)||g(r,"expected an array."),t.length&&e.forEach(n=>st(n,t[0],r));else if(typeof t=="object"){D(e,r);for(let[n,o]of Object.entries(t))st(e[n],o,`${r}.${n}`)}else typeof e!=typeof t&&g(r,`expected ${typeof t}.`)}function cn(e,t,r,n){if(st(e,oe,t),e.measurements!==void 0&&(e.measurements=le(e.measurements)),e.sequences!==void 0&&(e.sequences=Ie(e.sequences)),e.selectionSets!==void 0&&(e.selectionSets=Pe(e.selectionSets)),e.product!==void 0&&(e.product=Ee(e.product),e.product.definition.groups.forEach(o=>o.options.forEach(i=>i.appearance?.forEach(a=>{for(let[s,c]of Object.entries(a.material??{}))c&&typeof c=="object"&&!Array.isArray(c)&&"path"in c&&Y(c,"path",`${t}.product.material.${s}.path`,r,!0,n)})))),X(e.model.rotation,3,`${t}.model.rotation`),e.lighting.lights.forEach(o=>X(o.position,3,`${t}.lighting.lights`)),e.annotations.forEach(o=>dn(o,`${t}.annotations`,r,n)),e.animations.autoplayClip!==null&&typeof e.animations.autoplayClip!="string"&&g(t,"invalid autoplay clip."),e.animations.clips.forEach(o=>{D(o,t),(typeof o.sourceName!="string"||typeof o.displayName!="string"||typeof o.hidden!="boolean"||typeof o.speed!="number"||!["repeat","once","ping-pong"].includes(o.loopMode))&&g(t,"invalid animation clip settings.")}),e.cinematic!==void 0&&un(e.cinematic,`${t}.cinematic`),e.styleRules!==void 0&&!Array.isArray(e.styleRules)&&g(t,"styleRules must be an array."),Y(e.environment,"customEnvironmentUrl",`${t}.environment`,r,!1,n),Y(e.background,"imageUrl",`${t}.background`,r,!0,n),e.model.activeVariants!==void 0&&Ae(e.model.activeVariants,t),e.section!==void 0)try{e.section=xe(e.section)}catch(o){g(`${t}.section`,o.message)}}function mn(e,t,r,n){D(e,t);for(let[o,i]of Object.entries(e)){let a=`${t}.${o}`;D(i,a),(typeof i.id!="string"||typeof i.modelObjectId!="string")&&g(a,"expected binding id and modelObjectId.");for(let s of["label","group","type","status"])i[s]!==void 0&&typeof i[s]!="string"&&g(a,`${s} must be a string.`);i.tags!==void 0&&Ae(i.tags,a),i.metadata!==void 0&&D(i.metadata,`${a}.metadata`),i.metrics!==void 0&&(D(i.metrics,a),Object.values(i.metrics).some(s=>typeof s!="number")&&g(a,"metrics must be numbers.")),i.actions!==void 0&&(Array.isArray(i.actions)||g(a,"actions must be an array."),i.actions.forEach(s=>{D(s,a),(typeof s.id!="string"||typeof s.label!="string"||s.type!=="command"||s.effects!==void 0&&!Array.isArray(s.effects))&&g(a,"invalid action.")}));for(let s of["visible","removed","selectable","hoverable"])i[s]!==void 0&&typeof i[s]!="boolean"&&g(a,`${s} must be boolean.`);if(i.transform!==void 0){D(i.transform,a);for(let s of["position","rotation","scale","shear"])i.transform[s]!==void 0&&X(i.transform[s],3,`${a}.transform.${s}`);i.transform.pivot!==void 0&&(D(i.transform.pivot,a),X(i.transform.pivot.point,3,a),X(i.transform.pivot.offset,3,a))}if(i.style!==void 0&&(D(i.style,a),i.style.material!==void 0)){D(i.style.material,a);for(let[s,c]of Object.entries(i.style.material))c&&typeof c=="object"&&!Array.isArray(c)&&"path"in c&&Y(c,"path",`${a}.style.material.${s}.path`,r,!0,n)}i.decals!==void 0&&(Array.isArray(i.decals)||g(a,"decals must be an array."),i.decals.forEach(s=>{D(s,a),(typeof s.id!="string"||typeof s.size!="number"||s.size<=0)&&g(a,"invalid decal."),X(s.position,3,a),X(s.normal,3,a),Y(s,"image",a,r,!0,n)}))}}function ln(e,t,r,n){Array.isArray(e)||g(t,"expected merge sources."),e.forEach(o=>{D(o,t),(typeof o.url!="string"||!o.url||typeof o.namePrefix!="string")&&g(t,"expected source URL and prefix."),Y(o,"url",t,r,!1,n)})}function vr(e,t,r){D(e,"configuration");let n=Object.fromEntries(Sr.filter(o=>e[o]!==void 0).map(o=>[o,e[o]]));(typeof n.modelUrl!="string"||!n.modelUrl)&&g("configuration.modelUrl","expected the active model URL.");for(let o of["modelUrl","tilesetUrl","usdzUrl"])Y(n,o,`configuration.${o}`,t,!1,r);if(n.sceneConfig!==void 0&&cn(n.sceneConfig,"configuration.sceneConfig",t,r),n.mergeModels!==void 0&&ln(n.mergeModels,"configuration.mergeModels",t,r),n.models!==void 0){(!Array.isArray(n.models)||n.models.length===0)&&g("configuration.models","expected model entries.");let o=new Set,i=new Set;n.models.forEach(a=>{D(a,"model"),(typeof a.url!="string"||!a.url)&&g("model.url","expected a URL."),Y(a,"url","model.url",t,!1,r),a.id!==void 0&&(typeof a.id!="string"||!a.id.trim())&&g("model.id","expected a nonempty instance ID.");let s=Ye({id:a.id,url:a.url});i.has(s)&&g("configuration.models","instance identities must be unique; assign IDs when reusing a URL."),i.add(s),a.transform!==void 0&&(a.transform=pe(a.transform)),a.visible!==void 0&&typeof a.visible!="boolean"&&g("model.visible","expected boolean."),o.add(a.url),mn(a.objectBindings,"model.objectBindings",t,r),a.sceneConfig!==void 0&&cn(a.sceneConfig,"model.sceneConfig",t,r),a.mergeModels!==void 0&&ln(a.mergeModels,"model.mergeModels",t,r)}),n.activeModelId!==void 0&&(typeof n.activeModelId!="string"||!i.has(n.activeModelId))&&g("configuration.activeModelId","active instance is not in models."),n.activeModelId!==void 0&&n.models.find(a=>Ye(a)===n.activeModelId)?.url!==n.modelUrl&&g("configuration.modelUrl","source does not match the active instance."),o.has(n.modelUrl)||g("configuration.modelUrl","active model is not in models.")}if(n.multiSelectedKeys!==void 0&&Ae(n.multiSelectedKeys,"configuration.multiSelectedKeys"),n.annotationCategories!==void 0&&n.annotationCategories!==null&&Ae(n.annotationCategories,"configuration.annotationCategories"),n.activeAnnotation!==void 0&&n.activeAnnotation!==null&&dn(n.activeAnnotation,"configuration.activeAnnotation",t,r),n.measurements!==void 0||n.measurementSettings!==void 0){let o=le({items:n.measurements??[],settings:n.measurementSettings??{}});n.measurements!==void 0&&(n.measurements=o.items),n.measurementSettings!==void 0&&(n.measurementSettings=o.settings)}n.measurementModelId!==void 0&&typeof n.measurementModelId!="string"&&g("configuration.measurementModelId","expected a stable id."),n.measurementUnit!==void 0&&typeof n.measurementUnit!="string"&&g("configuration.measurementUnit","expected a unit label.");for(let o of["backgroundColor"])n[o]!==void 0&&typeof n[o]!="string"&&g(o,"expected a string.");n.shadows!==void 0&&typeof n.shadows!="boolean"&&g("shadows","expected boolean.");for(let[o,i]of Object.entries({modelFormat:["glb","gltf","obj","fbx","usdz","stl","ply"],cameraControllerType:["orbit","pointerLock"],objectTransformSpace:["world","local"],arScaleMode:["normalized","real-world"]}))n[o]!==void 0&&!i.includes(n[o])&&g(o,"unsupported value.");if(n.cinematic!==void 0&&un(n.cinematic,"cinematic"),n.isolation!==void 0&&n.isolation!==null){let{target:o,mode:i,ghostOpacity:a}=n.isolation;typeof o=="string"||Array.isArray(o)&&o.every(s=>typeof s=="string")||o&&typeof o=="object"&&["group","tag","type"].some(s=>typeof o[s]=="string")||g("configuration.isolation","invalid target."),i!==void 0&&!["ghost","hide"].includes(i)&&g("configuration.isolation","invalid mode."),a!==void 0&&(typeof a!="number"||a<0||a>1)&&g("configuration.isolation","opacity must be between 0 and 1.")}return n}function fn(e,t,r,n){if(!(!e||typeof e!="object"))for(let[o,i]of Object.entries(e))o!=="metadata"&&(typeof i=="string"&&["url","modelUrl","tilesetUrl","usdzUrl","path","image","src","href","imageUrl","customEnvironmentUrl"].includes(o)?Y(e,o,`${t}.${o}`,r,["path","image","src","imageUrl"].includes(o),n):fn(i,`${t}.${o}`,r,n))}function pn(e,t,r){typeof e=="string"&&(new TextEncoder().encode(e).length>te&&g("state","exceeds the 5 MiB limit."),e=JSON.parse(e));let n=xr(e);D(n,"state"),new TextEncoder().encode(JSON.stringify(n)).length>te&&g("state","exceeds the 5 MiB limit."),n.version!==void 0&&n.version!==1&&g("version","unsupported version."),n.version===void 0&&(n.objectBindings!==void 0||n.configuration!==void 0)&&g("version","full configurations require version 1.");let o={};return n.version!==void 0&&(o.version=1),n.camera!==void 0&&(wr(n.camera,"camera"),o.camera=n.camera),n.hidden!==void 0&&(Ae(n.hidden,"hidden"),o.hidden=n.hidden),n.selected!==void 0&&(n.selected!==null&&typeof n.selected!="string"&&g("selected","expected an object id or null."),o.selected=n.selected),n.objectBindings!==void 0&&(mn(n.objectBindings,"objectBindings",t,r),o.objectBindings=n.objectBindings),n.configuration!==void 0&&(o.configuration=vr(n.configuration,t,r)),fn(o,"state",t,r),new TextEncoder().encode(JSON.stringify(o)).length>te&&g("state","exceeds the 5 MiB limit."),o}function gn(e,t){return JSON.stringify(be(e,t))}function be(e,t){return pn(e,t)}async function De(e,t){let r=new Map,n=pn(e,t,r),o=new Map,i=new Map;for(let[s,{source:c,path:d}]of r){let l=o.get(c);l||(l=(async()=>{let u;try{u=await fetch(c)}catch{g(d,"this temporary image is no longer available. Reload or reselect it before saving.")}u.ok||g(d,"could not read the temporary image. Reload or reselect it before saving.");let m=await u.blob();m.size>te*3/4&&g(d,"embedded image exceeds the 5 MiB configuration limit. Use a hosted image URL.");let f=new Uint8Array(await m.arrayBuffer()),w=m.type.split(";")[0].toLowerCase(),C=w.startsWith("image/")?w:Ar(f);C||g(d,"temporary asset is not a supported image. Use a hosted asset URL.");let b="";for(let p=0;p<f.length;p+=32768)b+=String.fromCharCode(...f.subarray(p,p+32768));return`data:${C};base64,${btoa(b)}`})(),o.set(c,l)),i.set(s,await l)}function a(s){if(!(!s||typeof s!="object"))for(let[c,d]of Object.entries(s))c!=="metadata"&&(["path","image","src","imageUrl"].includes(c)&&typeof d=="string"&&i.has(d)?s[c]=i.get(d):a(d))}return a(n),be(n,t)}function Ar(e){let t=(r,n)=>String.fromCharCode(...e.subarray(r,n));if(e[0]===137&&t(1,4)==="PNG")return"image/png";if(e[0]===255&&e[1]===216&&e[2]===255)return"image/jpeg";if(t(0,3)==="GIF")return"image/gif";if(t(0,4)==="RIFF"&&t(8,12)==="WEBP")return"image/webp";if(t(4,8)==="ftyp"&&["avif","avis"].includes(t(8,12)))return"image/avif";if(/<svg[\s>]/i.test(new TextDecoder().decode(e.subarray(0,1024))))return"image/svg+xml"}var at={verifyingLicense:"Verifying License",checkingYourLicenseKey:"Checking your license key...",invalidLicense:"Invalid License",licenseHasBeenRevokedOrHasExpired:"License has been revoked or has expired",failedToLoadPleaseContactTheSiteAdministrator:"Failed to load. Please contact the site administrator.",contextRestoringTitle:"Reloading viewer\u2026",contextLostTitle:"3D view interrupted",contextRestoringMessage:"Rebuilding the 3D view. Please wait\u2026",contextLostMessage:"The graphics connection was interrupted. The viewer will rebuild when it returns, or you can reload it now.",reloadViewer:"Reload viewer",texturePositioningHint:"Drag to move \xB7 Scroll to zoom \xB7 Click elsewhere to finish",texturePositioningStartHint:"Double-click to move or zoom",dismiss:"Dismiss",missingUVsAreShownInMagenta:"Missing UVs are shown in magenta.",viewThisModelInARWithAppleQuickLook:"View this model in AR with Apple Quick Look",sequencePlayer:"Sequence player",sequenceSelect:"Sequence",sequencePlay:"Play sequence",sequencePause:"Pause sequence",sequenceStop:"Stop and restore scene",sequencePlayhead:"Sequence playhead",sequenceTime:"Sequence time",sequenceIssues:"Unavailable sequence targets",arConfiguredButton:"AR handoff",arConfiguredTitle:"Take this configuration to AR",arConfiguredDescription:"Your current materials, visible models and placements are included.",arSnapshotStale:"Updating AR to include your latest changes\u2026",arPreparing:"Preparing your scene\u2026",arStart:"Start AR",arStarting:"Starting AR\u2026",arCheckingSupport:"Checking AR support\u2026",arUnavailable:"AR is unavailable in this browser. Open this link in an AR-capable browser on your phone.",arStartFailed:"Could not start AR. Check camera permissions and try again.",arRefresh:"Refresh AR",arRetry:"Try again",arExportDetails:"Export details",arPrepare:"Prepare AR",arPrepareAgain:"Prepare again",arDownloadUSDZ:"Download USDZ for iPhone/iPad",arScanConfigured:"Scan to open this configuration on your phone.",arOpenConfiguredLink:"Open configuration link",viewInAR:"View in AR",openThisExperienceOnAPhoneForAR:"Open this experience on a phone for AR",openOnPhone:"Open on phone",viewThisModelInYourSpace:"View this model in your space",viewThisModelInVR:"View this model in VR",closePhoneHandoff:"Close phone handoff",arScanCode:"Scan the code and choose AR.",qrCodeToOpenThisModelOnAPhone:"QR code to open this model on a phone",disableUVChecker:"Disable UV checker",enableUVChecker:"Enable UV checker",explodedView:"Exploded view",explodeAmount:"Explode amount",removeSectionCut:"Remove section cut",sectionCut:"Section cut",sectionAxis:"Section axis",sectionPosition:"Section position",keepTheOtherSide:"Keep the other side",pauseCinematic:"Pause cinematic",playCinematic:"Play cinematic",stopCinematicAndResetCamera:"Stop cinematic and reset camera",cancel:"Cancel",annotationCategories:"Annotation categories",annotations:"Annotations",all:"All",uncategorized:"Uncategorized",decalDragHint:"Drag the decal on the object. Release to save; Escape to cancel.",showAll:"Show all",materialVariants:"Material variants",startGuidedTour:"Start guided tour",guidedTour:"Guided Tour",previousAnnotation:"Previous annotation",previous:"Prev",stopGuidedTour:"Stop guided tour",nextAnnotation:"Next annotation",next:"Next",exitFullscreen:"Exit fullscreen",enterFullscreen:"Enter fullscreen",resetCameraView:"Reset camera view",orbitControl:"Orbit Control",pointLock:"Pointer lock",cameraController:"Camera controller",cameraControllerSettings:"Camera controller settings",downloadGLB:"Download GLB",downloadGLBDescription:"All visible models, material edits and animations in one file. No annotations or separate editor model slots. Duplicate mesh names may change on reimport.",downloadCombinedGLB:"Download as one GLB",downloadSeparateGLBs:"Download separate GLBs",downloadSeparateGLBsDescription:"One GLB file per model",downloadPNG:"Download PNG",downloadUVLayout:"Download UV Layout",videoFormat:"Video format",auto:"Auto",recordTurntableVideo:"Record turntable video",recordCinematicVideo:"Record cinematic video",videoUnsupported:"Video recording is not supported in this browser.",downloadOptions:"Download options",exporting:"Exporting\u2026",download:"Download",annotationTitlePlaceholder:"Title *",description:"Description",ok:"OK",arRelocate:"Relocate",tapToPlace:"Tap to place",closeAnnotation:"Close annotation",learnMore:"Learn more",stopMeasuring:"Stop measuring",startMeasuring:"Start measuring",toggleBoundingDimensions:"Toggle bounding dimensions",measurementTool:"Measurement tool",distance:"Distance",angle:"Angle",area:"Area",pointToPlane:"Point to plane",wrap:"Circumference (Edge)",wrapHorizontal:"Circumference (Horizontal)",measurementSnapping:"Measurement snapping",noSnapping:"No snapping",snapAuto:"Snap: auto",snapVertex:"Snap: vertex",snapEdge:"Snap: edge",undoMeasurementPoint:"Undo measurement point",clearMeasurements:"Clear measurements",finishArea:"Finish area",savedMeasurements:"Saved measurements ({count})",noSavedMeasurements:"No saved measurements yet. Pick points in the preview, then save a measurement here.",measurementFiles:"Import / export",measurementSourceUnit:"Model units",measurementDisplayUnit:"Display units",measurementName:"Name",measurementNamePlaceholder:"e.g. Door width",saveMeasurement:"Save",knownMeasurementDistance:"Known length",calibrationUnit:"Calibration unit",calibrateMeasurement:"Calibrate",measurementCalibrationHint:"Pick two distance points, enter their known length, then calibrate.",measurementCalibratedScale:"Calibrated: 1 model unit = {scale} m",resetMeasurementCalibration:"Reset calibration",showSavedMeasurement:"Show {name}",renameSavedMeasurement:"Rename {name}",deleteSavedMeasurement:"Delete {name}",exportMeasurementJson:"Export JSON",exportMeasurementCsv:"Export CSV",importMeasurementJson:"Import JSON",measurementReady:"Ready",measurementApproximate:"Approximate LOD",measurementModelChanged:"Different model",measurementObjectMissing:"Object unavailable",measurementGeometryChanged:"Geometry changed \u2014 measure again",measurementPoseChanged:"Pose changed \u2014 measure again",measurementObjectHidden:"Object hidden",measurementInvalid:"Invalid measurement",measurementWaiting:"Waiting for model",openSceneObjectsPanel:"Open scene objects panel",sceneObjects:"Scene Objects",searchNodesLabels:"Search nodes, labels",closeSceneObjectsPanel:"Close scene objects panel",objectNavigator:"Objects in the 3D view",compareBefore:"Before",compareAfter:"After",compareDivider:"Comparison divider",viewIn3D:"View in 3D",objectNavigatorHint:"Arrow keys browse \xB7 Enter selects \xB7 Esc clears",selectionCleared:"Selection cleared",cameraKeyboardHelp:"3D view. Arrow keys orbit, Shift with Up or Down zooms, and W, A, S, D, Space and C move the camera.",isolate:"Isolate",hide:"Hide",show:"Show",closePanel:"Close panel",actions:"Actions",openPanel:"Open panel",close:"Close",position:"Position",decalNudgeHint:"Click to fine-tune \xB7 Hold to move",decalNudgeControls:"Move decal in small steps",text:"Text",yourText:"Your text",textToAdd:"Text to add",textColour:"Text color",addText:"Add text",image:"Image",chooseImage:"Choose image",imageToAdd:"Image to add",added:"Added",colour:"Color",size:"Size",turn:"Turn",rotation:"Rotation",dragTheDecalAcrossTheObjectsSurface:"Drag the decal across the object's surface",move:"Move",remove:"Remove",noneAddedYet:"None added yet",done:"Done",moveForward:"Move forward",moveLeft:"Move left",moveRight:"Move right",moveBackward:"Move backward",productOptions:"Options",productOptionsFor:"{product} options",productReset:"Reset",productOptional:"optional",productNone:"None",productAlsoChanges:"Also changes: {changes}",productUnavailable:"Currently unavailable.",productQuantity:"Quantity",productCheckingPrice:"Checking price and availability\u2026",productTotal:"Total",productAddToCart:"Add to cart",productAddingToCart:"Adding\u2026",productRequestQuote:"Request quote",productRequestingQuote:"Requesting\u2026",productRefresh:"Refresh",productBuy:"Buy now",productCopyLink:"Copy link",productLinkCopied:"Link copied",productShowOptions:"Show options",productHideOptions:"Hide options",productIssues:"Configuration issues",productRequestDone:"Request completed.",productSaved:"Saved: {id}",sceneSettings:"Scene Settings",background:"Background",backgroundColor:"Background Color",showEnvironmentAsBackground:"Show as background",backgroundBlur:"Background Blur",environmentPreset:"Preset",environmentIntensity:"Intensity",toneMapping:"Tone Mapping",toneMappingAces:"ACES Filmic",toneMappingAgx:"AgX",toneMappingNeutral:"Neutral",toneMappingNone:"None",ground:"Ground",groundShadow:"Ground Shadow",groundShadowOpacity:"Shadow Opacity",floorGrid:"Floor Grid",display:"Display",wireframe:"Wireframe",autoRotateSpeed:"Rotation Speed",fieldOfView:"Field of View",modelInfo:"Model",modelInfoObjects:"Objects",modelInfoTriangles:"Triangles",modelInfoMaterials:"Materials",resetSettings:"Reset Settings",environment:"Environment",autoRotate:"Auto Rotate",lighting:"Lighting",exposure:"Exposure",ambientLightIntensity:"Ambient Light Intensity",ambientLightColor:"Ambient Light Color",directLightIntensity:"Direct Light Intensity",directLightColor:"Direct Light Color",searchObjects:"Search objects",uploadedModel:"Uploaded model",clear:"Clear",chooseModel:"Choose model",loadingModel:"Loading model...",releaseToLoadYourModel:"Release to load your model",arFindSurface:"Move your device over a flat surface",arReleaseToPlace:"Release to place",arGestureHint:"Pinch to resize \xB7 Twist to rotate",angleFirstArmHint:"Pick the first arm",angleVertexHint:"Pick the angle's vertex",angleSecondArmHint:"Pick the second arm",angleNewHint:"Pick a point to start a new angle",areaNewHint:"Pick a point to start a new area",areaCornersHint:"Pick polygon corners in order, then Finish area",pointToPlaneFaceHint:"Pick the reference face",pointToPlanePointHint:"Pick a point to measure its perpendicular distance",pointToPlaneNewHint:"Pick a face to start a new measurement",distanceHint:"Pick points on the model to measure distances",wrapHint:"Click a point on the surface to measure its circumference, following the surface (best for limbs)",wrapHorizontalHint:"Click a point to measure a level circumference around it (best for the torso/waist)",visibleEntries:"{count} visible entries",objectCount:"{count} objects",annotationMarker:"Annotation {id}: {title}",recordingVideo:"Recording video \xB7 {progress}%",isolatedObjects:"Isolated: {count} objects",largeModelWarning:"Very large model ({millions}M triangles) \u2014 it may render and move slowly on this device, and click/hover selection on the model is disabled. Use the objects panel to select parts.",preparingLargeModel:"Preparing large model ({millions}M triangles) \u2014 the first display can take a while on this device...",enterAR:"Enter AR",enterVR:"Enter VR",decalImage:"Image {index}",decalText:"Text {index}",decalAdded:"{count} added",up:"up",down:"down",left:"left",right:"right",moveDecal:"Move decal {direction}",moveDecalOnSurface:"Move {direction} on the visible surface",showAllObject:"Show all {name}",isolateObject:"Isolate {name}",isolatedObject:"Isolated: {name}",hideObject:"Hide {name}",showObject:"Show {name}",objectSelected:"{name} selected",objectNavigatorPosition:"{position} of {count}",compareDividerValue:"{before} {percent}%, {after} {rest}%",bindingMismatchOne:"1 object binding doesn't match this model",bindingMismatchMany:"{count} object bindings don't match this model",simpleLargeModelWarning:"Very large model detected ({millions}M triangles) \u2014 it may render and move slowly on this device, and click/hover selection on the model is disabled. Use the scene objects panel to select parts.",dropModelHint:"Drag and drop {formats} here",loadErrorTitle:"This model couldn't be loaded",loadErrorNotFound:"Nothing was found at this address ({status}). Check that modelUrl points to the file.",loadErrorDenied:"The server refused access to the file ({status}). Check that the file is public, or that a signed URL hasn't expired.",loadErrorStatus:"The server responded with {status} when the file was requested.",loadErrorNetwork:"The download was blocked or failed. Check that the URL is correct and, if the file is on another domain, that its server allows cross-origin requests (CORS) from this site.",loadErrorHtml:"The server sent back a web page instead of a model. There's probably no file at this path: many servers answer a missing file with their index.html.",loadErrorInvalidFile:"The file couldn't be read as {format}. Check that it's a valid {format} file.",loadErrorInvalidExplicitFormat:"The file couldn't be read as {format}. Check that it's a valid {format} file and that modelFormat matches it.",loadErrorMissingFormat:"The file couldn't be read as {format}. The URL has no file extension, so set modelFormat to the file's format.",loadErrorPointCloud:"This PLY file is a point cloud: it has points but no faces, and the viewer shows meshes. Turn it into a mesh first, for example with MeshLab or Blender.",measurementReferenceFaceRequired:"Pick a triangle face to define the reference plane.",measurementTooManyPoints:"Finish or clear this measurement before adding more points.",measurementAngleDistinct:"Pick a point away from the angle's vertex.",areaMinimumPoints:"Pick at least three points to finish the area.",areaDistinctPoints:"Area points must be distinct.",areaStraightLine:"Area points must not lie on one straight line.",areaNotPlanar:"Area points must lie on one plane.",areaEdgesCross:"Area edges must not cross or touch each other.",areaZero:"The polygon has no measurable area.",decalSurfaceMissing:"Could not find a surface on this object for the decal.",decalDirectionMissing:"No visible surface in that direction. Try another arrow or rotate the view.",fullscreenExitFailed:"Could not exit fullscreen. Press Escape to exit.",fullscreenEnterFailed:"Could not enter fullscreen. Check your browser or iframe fullscreen permissions and try again.",uvCoordinatesMissing:"This model does not contain UV coordinates.",uvExportFailed:"Could not create the UV layout archive.",videoExportFailed:"Could not export the video.",videoNotReady:"Viewer not ready for video export.",videoExitXR:"Exit the XR session before recording a video.",videoAlreadyRecording:"A video export is already in progress.",videoPathRequired:"Enable a cinematic camera path before recording it.",videoDurationInvalid:"Video duration must be greater than 0 and at most 300 seconds.",videoFrameRateInvalid:"Video frame rate must be between 1 and 60.",videoBitrateInvalid:"Video bitrate must be a positive number.",videoContextLost:"Video export stopped because the WebGL context was lost.",videoTimedOut:"Video export timed out. Keep the viewer tab visible while recording.",videoEncodingFailed:"The browser could not encode the video.",videoEmpty:"The browser produced an empty video.",videoDidNotStart:"Video recording did not start.",videoWebMUnsupported:"Video recording as WEBM is not supported in this browser.",videoMP4Unsupported:"Video recording as MP4 is not supported in this browser.",videoGIFUnsupported:"Video recording as GIF is not supported in this browser.",videoGifWidthInvalid:"GIF width must be a whole number of pixels from 16 to 4096.",environmentApartment:"apartment",environmentCity:"city",environmentDawn:"dawn",environmentForest:"forest",environmentLobby:"lobby",environmentNight:"night",environmentPark:"park",environmentStudio:"studio",environmentSunset:"sunset",environmentWarehouse:"warehouse",color:"Color",material:"Material",texturePreview:"texture preview",noTextureApplied:"No texture applied",noTextureCoordinates:"This part has no texture coordinates, so an image can't be placed on it.",replaceImage:"Replace image",uploadImage:"Upload image",removeTexture:"Remove texture",texturePosition:"Texture position",offsetX:"Offset X",offsetY:"Offset Y",confirmTexturePosition:"Confirm this texture position and exit positioning mode",donePositioning:"Done positioning",textureOffsetHint:"Double-click the object in the preview to drag its texture directly (scroll to zoom), or edit its offset numerically.",actionToggleLight:"Toggle Light",actionChangeLightColor:"Change Light Color",actionSetBrightness:"Set Brightness",actionChangeColor:"Change Color",actionChangeMaterial:"Change Material",actionToggleVisibility:"Toggle Visibility"};var Eo=new Map(Object.entries(at).map(([e,t])=>[t,e]));function bn(e){jt(e);let t=[],r=[{node:e,path:"0",parentId:null}];for(;r.length;){let{node:o,path:i,parentId:a}=r.pop(),s=`node:${i}`,c=o.isMesh&&o.name?ye(o):null;t.push({id:s,parentId:a,name:o.name||o.type||"Group",...c?{objectId:c}:{}});for(let d=o.children.length-1;d>=0;d--)r.push({node:o.children[d],path:`${i}/${d}`,parentId:s})}let n=new Set;for(let o=t.length-1;o>=0;o--){let i=t[o];(i.objectId||n.has(i.id))&&(n.add(i.id),i.parentId&&n.add(i.parentId))}return t.filter(o=>n.has(o.id))}function hn(e){return structuredClone(e.style??{})}function yn(e,t,r){let n=H(e,t).filter(i=>!e[i].removed);if(!n.length)return e;let o={...e};for(let i of n)o[i]={...e[i],style:structuredClone(r)};return o}var de=require("three"),Mr=new Set(["KHR_binary_glTF","KHR_draco_mesh_compression","KHR_lights_punctual","KHR_materials_clearcoat","KHR_materials_dispersion","KHR_materials_ior","KHR_materials_sheen","KHR_materials_specular","KHR_materials_transmission","KHR_materials_iridescence","KHR_materials_anisotropy","KHR_materials_unlit","KHR_materials_volume","KHR_texture_basisu","KHR_texture_transform","KHR_mesh_quantization","KHR_materials_emissive_strength","KHR_materials_variants","EXT_materials_bump","EXT_texture_webp","EXT_texture_avif","EXT_meshopt_compression","EXT_mesh_gpu_instancing"]),Or=new WeakMap;function Cr(e){let t=Or.get(e);return t?structuredClone(t):void 0}function Sn(e){if(/^(blob|data):/i.test(e))return"Local resource";let t=e.split(/[?#]/,1)[0].replace(/\\/g,"/");return t.slice(t.lastIndexOf("/")+1).slice(0,300)||"Resource"}function jr(e){return/^(blob|data):/i.test(e)?"Local resource":e.split(/[?#]/,1)[0].replace(/\\/g,"/").replace(/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i,"").replace(/^\/+/,"").slice(0,500)||"Resource"}function kr(e){let t=r=>typeof r=="number"&&Number.isFinite(r)&&r>=0?r:null;return{...e.format?{format:e.format}:{},...e.name?{name:Sn(e.name)}:{},sourceBytes:t(e.sourceBytes),loadDurationMs:t(e.loadDurationMs),extensionsUsed:[...new Set(e.extensionsUsed??[])].sort(),extensionsRequired:[...new Set(e.extensionsRequired??[])].sort(),failedResources:[...new Set((e.failedResources??[]).map(jr))].slice(0,50)}}function Tr(e){let t=new Set(e.extensionsRequired);return[...new Set([...e.extensionsUsed??[],...t])].sort().map(r=>({name:r,required:t.has(r),recognized:Mr.has(r)}))}function Ir(e,t){let r=e.image,n=d=>typeof d=="number"&&Number.isSafeInteger(d)&&d>0?d:null,o=n(r?.naturalWidth??r?.width),i=n(r?.naturalHeight??r?.height),a=!!e.isCompressedTexture,s=e.mipmaps.reduce((d,l)=>d+(l.data?.byteLength??0),0),c=o&&i?Math.ceil(o*i*4*(e.generateMipmaps?4/3:1)):null;return{name:e.name?Sn(e.name):t,width:o,height:i,compressed:a,estimatedBytes:a?s||null:c!==null&&Number.isSafeInteger(c)?c:null}}function xn(e,t={}){let r=kr({...Cr(e),...t.source}),n=[],o=new Set,i=new Map,a=new Set,s=new Map,c=new Map,d=new Set,l=new Map,u=0,m=0,f=0,w=0,C=0,b=(x,S)=>{let A=l.get(x)??{count:0,names:[]};A.count++,A.names.length<20&&A.names.push(S||"Unnamed object"),l.set(x,A)},p=x=>{let S=x?.array??x?.data?.array;S?.buffer&&!d.has(S.buffer)&&(d.add(S.buffer),C+=S.buffer.byteLength)};e.traverse(x=>{let S=x;if(!S.isMesh||!S.geometry)return;u++,m+=S.isInstancedMesh?Number.isSafeInteger(S.count)?Math.max(0,S.count??0):0:1;let A=S.geometry,E=A.getAttribute("position"),G=A.getAttribute("uv"),F=S.material?Array.isArray(S.material)?S.material:[S.material]:[];if(!i.has(A)){let _=!!E&&(!Number.isSafeInteger(E.count)||E.count<0);for(let N=0;!_&&E&&N<E.count;N++)if(!Number.isFinite(E.getX(N))||!Number.isFinite(E.getY(N))||!Number.isFinite(E.getZ(N))){_=!0;break}i.set(A,_)}if(i.get(A)&&b("invalid-positions",x.name),E?.count||b("empty-geometry",x.name),G||b("missing-uv",x.name),A.getAttribute("normal")||b("missing-normals",x.name),A.boundingBox&&[...A.boundingBox.min.toArray(),...A.boundingBox.max.toArray()].some(_=>!Number.isFinite(_))&&b("invalid-bounds",x.name),!o.has(A)){o.add(A),f+=Number.isSafeInteger(E?.count)?Math.max(0,E?.count??0):0;let _=A.index?.count??E?.count??0;w+=Number.isSafeInteger(_)?Math.floor(Math.max(0,_)/3):0,Object.values(A.attributes).forEach(p),Object.values(A.morphAttributes).flat().forEach(p),p(A.index)}let z=!1;for(let _ of F){a.add(_);let N=s.get(_);if(!N){N=Object.values(_).filter($=>!!$&&$.isTexture===!0),s.set(_,N);for(let $ of N)c.has($)||c.set($,`Texture ${c.size+1}`)}for(let $ of N){let me=$.channel??0;A.getAttribute(me===0?"uv":`uv${me}`)||(z=!0)}}z&&b("textured-missing-uv",x.name)});let h=(x,S,A,E,G)=>{let F=l.get(x);F&&n.push({code:x,severity:S,title:A,detail:E,suggestion:G,count:F.count,objects:F.names})};h("empty-geometry","error","Empty mesh geometry","Some meshes have no position data.","Remove empty meshes or export their geometry again."),h("invalid-positions","error","Invalid vertex coordinates","Some vertices contain non-finite coordinates.","Repair NaN or infinite vertex positions in the source application, then re-export."),h("invalid-bounds","error","Invalid geometry bounds","Some cached bounds contain non-finite values.","Repair invalid coordinates in the source application and re-export."),h("textured-missing-uv","warning","Textures have no matching UV coordinates","A texture references a UV channel that its mesh does not contain.","Unwrap the affected meshes and export the UV channel used by each texture."),h("missing-uv","info","Meshes without UVs","Solid colors can work without UVs; image textures and surface decals need them.","Add a UV map before applying image textures or decals."),h("missing-normals","info","Meshes without normals","Some loaded meshes lack vertex normals; generated shading may differ from the source.","Export vertex normals to preserve hard edges and smooth surfaces."),u||n.push({code:"no-meshes",severity:"warning",title:"No mesh geometry found",detail:"This scene contains no loaded meshes.",suggestion:"Check that meshes were included in the export. Streamed scenes may still be loading."});let v=[...c].map(([x,S])=>Ir(x,S)),M=v.filter(x=>(x.width??0)>4096||(x.height??0)>4096);M.length&&n.push({code:"large-textures",severity:"warning",title:"Large texture dimensions",detail:"Some textures exceed 4096 pixels on one side.",suggestion:"Resize textures for the visible detail needed; use KTX2/Basis where appropriate.",count:M.length,objects:M.slice(0,20).map(x=>x.name)}),w>1e6&&n.push({code:"high-triangle-count",severity:"warning",title:"High geometry count",detail:"The loaded geometry contains more than one million unique triangles.",suggestion:"Simplify hidden detail, create lower-detail exports, or use streamed assets for large scenes."}),a.size>100&&n.push({code:"many-materials",severity:"warning",title:"Many material definitions",detail:"More than 100 materials can increase rendering work.",suggestion:"Reuse materials and atlas compatible textures; inspect runtime draw calls to confirm the cost."});let y=Tr(r);for(let x of y.filter(S=>!S.recognized))n.push({code:"unrecognized-extension",severity:x.required?"error":"warning",title:`${x.required?"Required":"Optional"} extension not recognized`,detail:x.name,suggestion:"Export with extensions supported by the bundled loader, or verify the asset's fallback appearance."});r.failedResources?.length&&n.push({code:"failed-resources",severity:"error",title:"Some resources failed to load",detail:"The model may be missing textures or other referenced resources.",suggestion:"Include sidecar files in the ZIP, correct their paths, and check HTTP access and CORS.",count:r.failedResources.length,objects:r.failedResources.slice(0,20)});let P=null,V=[...i.values()].some(Boolean)?new de.Box3:new de.Box3().setFromObject(e);!V.isEmpty()&&[...V.min.toArray(),...V.max.toArray(),...V.getSize(new de.Vector3).toArray()].every(Number.isFinite)&&(P={min:V.min.toArray(),max:V.max.toArray(),center:V.getCenter(new de.Vector3).toArray(),size:V.getSize(new de.Vector3).toArray()}),t.scope==="resident-tiles"&&n.unshift({code:"partial-stream",severity:"info",title:"Loaded tiles only",detail:"Geometry and texture counts cover the current resident tiles, not the entire source asset.",suggestion:"Use the live cache/detail statistics to inspect streaming pressure. Rescan after moving the camera."});let re=x=>x.code==="partial-stream"?-1:x.severity==="error"?0:x.severity==="warning"?1:2;return n.sort((x,S)=>re(x)-re(S)),{version:1,status:"ready",scope:t.scope??"asset",source:r,units:r.format==="glb"||r.format==="gltf"?"meters (glTF convention)":"unknown",bounds:P,statistics:{meshes:u,instances:m,geometries:o.size,materials:a.size,textures:c.size,vertices:f,triangles:w,geometryBytes:C,estimatedTextureBytes:v.reduce((x,S)=>x+(S.estimatedBytes??0),0),unknownTextureSizes:v.filter(x=>x.estimatedBytes===null).length,meshesWithoutUvs:l.get("missing-uv")?.count??0,meshesWithoutNormals:l.get("missing-normals")?.count??0},textures:v,extensions:y,issues:n}}var Rr=new WeakMap;function wn(e){e.traverse(t=>{let r=Rr.get(t);if(r)throw new Error(r)})}var I=require("three");var ct=require("three");function Ve(e){return e.isSkinnedMesh===!0}var Pr="reactImmersiveSkinFreeze";function lt(e){return e.userData[Pr]?.frozenInverse??null}function vn(e){let t=e,r=lt(e);r&&t.bindMatrixInverse.copy(r),t.skeleton?.update?.();let n=t.geometry.clone(),o=n.getAttribute("position");if(o){let i=new ct.Vector3;for(let a=0;a<o.count;a++)t.getVertexPosition(a,i),o.setXYZ(a,i.x,i.y,i.z);o.needsUpdate=!0}return n.deleteAttribute("skinIndex"),n.deleteAttribute("skinWeight"),n.morphAttributes={},n.morphTargetsRelative=!1,n.computeVertexNormals(),n.computeBoundingBox(),n.computeBoundingSphere(),n}function Br(e,t={}){t.signal?.throwIfAborted();let r=new I.Group,n=new I.Group;r.add(n);let o=new Set,i=[],a=[],s=[],c=new Map,d=0,l=0,u=()=>{i.forEach(m=>m.dispose()),a.forEach(m=>m.dispose()),s.forEach(m=>m.dispose())};try{for(let{scene:b,objectBindings:p={},materialOverrides:h={}}of e){wn(b),b.updateWorldMatrix(!0,!0);let v=new Map(Object.entries(p).map(([M,y])=>[y.modelObjectId??M,M]));b.traverse(M=>{let y=M;if(!y.isMesh||!y.geometry)return;for(let A=M;A;A=A.parent){let E=ye(A)??A.name??A.uuid;if(!A.visible||p[v.get(E)??E]?.visible===!1||p[v.get(E)??E]?.removed)return}let P=ye(y)??y.name??y.uuid,V=h[v.get(P)??P]??y.material;if(!V)throw new Error(`Material for ${P} is not ready. Wait for the model to finish loading.`);let re=Array.isArray(V)?V:[V],x=y.isInstancedMesh?y.count:1;if(y.userData.riDecal&&Ve(y)&&y.parent){let A=lt(y.parent);A&&y.bindMatrixInverse.copy(A)}let S=Ve(y)?vn(y):y.geometry.clone();try{if(!Ve(y)&&y.morphTargetInfluences?.some(G=>G!==0)){let G=S.getAttribute("position"),F=new I.Vector3;for(let z=0;z<G.count;z++)y.getVertexPosition(z,F),G.setXYZ(z,F.x,F.y,F.z);S.morphAttributes={},S.computeVertexNormals()}if(!S.getAttribute("position"))throw new Error(`Mesh ${P} has no positions.`);let A=S.index?.count??S.getAttribute("position").count,E=Array.isArray(V)?S.groups:[{start:0,count:A,materialIndex:0}];if(!E.length)throw new Error(`Mesh ${P} has multiple materials without geometry groups.`);for(let G=0;G<x;G++){let F=y.matrixWorld.clone();if(y.isInstancedMesh){let z=new I.Matrix4;y.getMatrixAt(G,z),F.multiply(z)}for(let z of E){let _=re[z.materialIndex??0];if(!_)throw new Error(`A material group on ${P} is missing its material.`);if(!_.visible)continue;let N=_;if(!N.isMeshStandardMaterial||N.wireframe||N.vertexColors)throw new Error(`AR snapshot cannot preserve ${_.type}${N.wireframe?" wireframe":N.vertexColors?" vertex colors":""} on ${P}. Use a PBR material or provide arHandoff.createUSDZ.`);let $=Math.max(z.start,S.drawRange.start),me=Math.min(A,z.start+z.count,S.drawRange.start+S.drawRange.count);if(me<=$)continue;if($%3||(me-$)%3)throw new Error(`Mesh ${P} has an incomplete triangle range.`);let L=new I.BufferGeometry;i.push(L);let Z=Array.from({length:me-$},(O,T)=>S.index?S.index.getX($+T):$+T);if(F.determinant()<0)for(let O=0;O<Z.length;O+=3)[Z[O+1],Z[O+2]]=[Z[O+2],Z[O+1]];for(let[O,T]of Object.entries(S.attributes)){let j=new Float32Array(Z.length*T.itemSize);for(let R=0;R<Z.length;R++)for(let W=0;W<T.itemSize;W++)j[R*T.itemSize+W]=T.getComponent(Z[R],W);L.setAttribute(O,new I.BufferAttribute(j,T.itemSize))}L.setIndex(Z.map((O,T)=>T)),L.applyMatrix4(F);let Oe=L.getAttribute("position");for(let O=0;O<Oe.count;O++)if(![Oe.getX(O),Oe.getY(O),Oe.getZ(O)].every(Number.isFinite))throw new Error(`Mesh ${P} contains invalid coordinates.`);L.getAttribute("normal")||L.computeVertexNormals();let q=N.clone();a.push(q);let mt=N.userData.reactImmersiveConfiguredEmissive;if(mt?.isColor&&q.emissive.copy(mt),q.side===I.DoubleSide){let O=L.toNonIndexed();i.push(O);let T=O.getAttribute("position").count,j=new I.BufferGeometry;i.push(j);for(let[R,W]of Object.entries(O.attributes)){let Le=new Float32Array(T*W.itemSize*2);for(let ie=0;ie<T;ie++)for(let fe=0;fe<W.itemSize;fe++){Le[ie*W.itemSize+fe]=W.getComponent(ie,fe);let Vn=Math.floor(ie/3)*3+(2-ie%3);Le[(T+ie)*W.itemSize+fe]=W.getComponent(Vn,fe)*(R==="normal"?-1:1)}j.setAttribute(R,new I.BufferAttribute(Le,W.itemSize))}q.side=I.FrontSide,L.copy(j)}else if(q.side!==I.FrontSide){let O=L.getIndex();for(let j=0;j<O.count;j+=3){let R=O.getX(j+1);O.setX(j+1,O.getX(j+2)),O.setX(j+2,R)}let T=L.getAttribute("normal");for(let j=0;j<T.count;j++)T.setXYZ(j,-T.getX(j),-T.getY(j),-T.getZ(j));q.side=I.FrontSide}if(y.isInstancedMesh&&y.instanceColor){let O=new I.Color;y.getColorAt(G,O),q.color.multiply(O)}for(let[O,T]of Object.entries(q)){if(!T?.isTexture)continue;let j=T;if(_t(j)||!j.image||j.image.complete===!1)throw new Error(`Texture on ${P} is not ready. Wait for image loading or replace failed textures before preparing AR.`);let R=c.get(j);if(R||(R=j.clone(),c.set(j,R),s.push(R)),q[O]=R,!L.getAttribute(R.channel?`uv${R.channel}`:"uv"))throw new Error(`Texture on ${P} needs UV coordinates missing from this geometry.`)}if(y.userData.riDecal){L.computeBoundingBox();let O=Math.max(1e-6,L.boundingBox.getSize(new I.Vector3).length()*1e-4),T=L.getAttribute("position"),j=L.getAttribute("normal");for(let R=0;R<T.count;R++)T.setXYZ(R,T.getX(R)+j.getX(R)*O,T.getY(R)+j.getY(R)*O,T.getZ(R)+j.getZ(R)*O)}let ft=new I.Mesh(L,q);ft.name=`AR_${d++}`,n.add(ft),l+=(L.index?.count??L.getAttribute("position").count)/3,(q.clearcoat||q.transmission||q.iridescence||q.anisotropy)&&o.add("Advanced PBR effects may look different in Quick Look.")}}}finally{S.dispose()}})}if(!d||!l)throw new Error("There is no visible model geometry to send to AR.");let m=new I.Box3().setFromObject(n),f=m.getSize(new I.Vector3),w=m.getCenter(new I.Vector3),C=t.scaleMode==="real-world"?1:1/Math.max(f.x,f.y,f.z,1e-9);return n.position.set(-w.x*C,-m.min.y*C,-w.z*C),n.scale.setScalar(C),r.updateMatrixWorld(!0),o.add("USDZ is a static snapshot. Viewer lighting, background, post-processing, annotations and measurement overlays stay in the web viewer."),{root:r,meshCount:d,triangleCount:l,scale:C,warnings:[...o],textures:s,dispose:u}}catch(m){throw u(),m}}async function An(e,t={}){let r=t.maxTextureSize??2048;if(!Number.isInteger(r)||r<256||r>4096)throw new Error("AR maxTextureSize must be an integer from 256 to 4096.");let n=Br(e,t),o=[];try{let{USDZExporter:i}=await import("three/examples/jsm/exporters/USDZExporter.js");t.signal?.throwIfAborted();for(let s of n.textures){if(!s.isCompressedTexture)continue;let{decompress:c}=await import("three/examples/jsm/utils/WebGLTextureUtils.js"),d=c(s,r);o.push(d),n.root.traverse(l=>{let u=l.material;if(u)for(let m of Object.keys(u))u[m]===s&&(u[m]=d)})}let a=await new i().parseAsync(n.root,{onlyVisible:!0,quickLookCompatible:!0,maxTextureSize:r});return t.signal?.throwIfAborted(),{blob:new Blob([new Uint8Array(a)],{type:"model/vnd.usdz+zip"}),meshCount:n.meshCount,triangleCount:n.triangleCount,scale:n.scale,warnings:n.warnings}}catch(i){throw t.signal?.aborted?i:new Error(`Could not prepare the configured USDZ: ${i instanceof Error?i.message:"export failed"}. Textures must allow cross-origin canvas access.`)}finally{n.dispose(),o.forEach(i=>i.dispose())}}var ne=require("fflate");var dt="ri-ar",ut="ri-ar-id",Mn=4096,Er=2200,Dr=(0,ne.strToU8)(JSON.stringify(oe)).byteLength;function On(e){return e==="localhost"||e.endsWith(".localhost")||/^127\./.test(e)||e==="[::1]"||e==="0.0.0.0"}function Cn(e){if(typeof e=="string"&&/^https?:\/\//i.test(e)&&On(new URL(e).hostname))throw new Error("An asset URL points to this computer. Use model and texture URLs reachable from the phone.");if(e&&typeof e=="object")for(let t of Object.values(e))Cn(t)}function Vr(e,t){let r=new URL(e,t);if(!["https:","http:"].includes(r.protocol))throw new Error("AR handoff requires an HTTP(S) URL.");return r.toString()}function jn(e,t){if(JSON.stringify(e)!==JSON.stringify(t))return e&&t&&typeof e=="object"&&typeof t=="object"&&!Array.isArray(e)&&!Array.isArray(t)?Object.fromEntries(Object.entries(e).map(([r,n])=>[r,jn(n,t[r])]).filter(([,r])=>r!==void 0)):e}function kn(e,t,r=0){if(r>64)throw new Error("AR configuration is too deeply nested.");if(e&&t&&typeof e=="object"&&typeof t=="object"&&!Array.isArray(e)&&!Array.isArray(t)){let n=e,o=t;return Object.fromEntries([...new Set([...Object.keys(o),...Object.keys(n)])].map(i=>[i,Object.prototype.hasOwnProperty.call(n,i)?kn(n[i],o[i],r+1):o[i]]))}return e}function Tn(e,t){let r=structuredClone(e);if(r.configuration){r.configuration.sceneConfig&&(r.configuration.sceneConfig=t(r.configuration.sceneConfig));for(let n of r.configuration.models??[])n.sceneConfig&&(n.sceneConfig=t(n.sceneConfig))}return r}function Me(e){e?.throwIfAborted()}async function In(e,t,r,n){Me(n);let o=new URL(Vr(t));if(On(o.hostname))throw new Error("Phone links need a viewer URL reachable from your phone. Download the USDZ for local uploads, or provide a public viewer URL.");let i=await De(e,o.toString());Me(n),Cn(i);let a=new URLSearchParams(o.hash.slice(1));if(a.delete(dt),a.delete(ut),a.delete("view"),a.delete("viewId"),a.delete("view-id"),r){let s=await r.save(i);if(Me(n),typeof s!="string"||!s||s.length>512)throw new Error("AR storage returned an invalid configuration ID.");a.set(ut,s)}else{let s=(0,ne.zlibSync)((0,ne.strToU8)(JSON.stringify({ar:1,state:Tn(i,d=>jn(d,oe)??{})})),{level:9});if(s.byteLength>Mn)throw new Error("This configuration needs an AR storage adapter to share on a phone. The USDZ download is still available.");let c="";for(let d of s)c+=String.fromCharCode(d);a.set(dt,btoa(c).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""))}if(o.hash=a.toString(),o.toString().length>Er)throw new Error("This configuration is too large for a reliable QR code. Use an AR storage adapter or download the USDZ.");return o.toString()}async function Rn(e,t,r){let n=new URL(e),o=new URLSearchParams(n.hash.slice(1)),i=o.get(ut),a=o.get(dt);if(i!==null&&a!==null)throw new Error("AR link contains conflicting configurations.");if(i===null&&a===null)return null;Me(r);let s;if(i!==null){if(!t)throw new Error("This AR link requires the application's configuration storage adapter.");if(!i||i.length>512)throw new Error("Invalid AR configuration ID.");s=await t.load(i)}else{if(!a||a.length>Math.ceil(Mn*4/3)||!/^[\w-]+$/.test(a))throw new Error("Invalid or oversized AR link.");let d=atob(a.replace(/-/g,"+").replace(/_/g,"/")),l=Uint8Array.from(d,f=>f.charCodeAt(0)),u=(0,ne.unzlibSync)(l);if(u.byteLength>te)throw new Error("AR configuration exceeds the 5 MiB limit.");let m=JSON.parse((0,ne.strFromU8)(u));if(m?.ar===1&&m.state){let f=m.state.configuration,w=(f?.sceneConfig?1:0)+(Array.isArray(f?.models)?f.models.filter(C=>C?.sceneConfig).length:0);if(u.byteLength+w*Dr>te)throw new Error("Expanded AR configuration exceeds the 5 MiB limit.");s=Tn(m.state,C=>kn(C,oe))}else s=m}Me(r);let c=be(s,n.toString());if(c.version!==1||!c.configuration)throw new Error("AR handoff requires a complete versioned viewer configuration.");return c}var En={id:"identity",modelObjectId:"identity",label:"identity",type:"identity",group:"identity",tags:"identity",style:"appearance",decals:"appearance",transform:"transform",visible:"visibility",removed:"visibility",status:"visibility",selectable:"behavior",hoverable:"behavior",actions:"behavior",cameraState:"behavior",metadata:"data",metrics:"data"},Nr=Object.keys(En),Lr=new Set(["__proto__","prototype","constructor"]);function ue(e,t=new Set){if(e==null||typeof e=="string"||typeof e=="boolean")return e;if(typeof e=="number"){if(!Number.isFinite(e))throw new Error("Comparison values must be finite JSON data");return e}if(typeof e!="object"||t.has(e))throw new Error("Comparison values must be acyclic JSON data");t.add(e);let r=Array.isArray(e)?e.map(n=>ue(n,t)):Object.fromEntries(Object.entries(e).filter(([n,o])=>!Lr.has(n)&&o!==void 0).map(([n,o])=>[n,ue(o,t)]));return t.delete(e),r}var Pn=e=>e&&typeof e=="object"&&!Array.isArray(e)&&!Object.keys(e).length;function Bn(e,t){let r=ue(e);r.visible=e.visible??!0,r.selectable=e.selectable??!0,r.hoverable=e.hoverable??!0,r.status=e.status??"normal",r.type=e.type??"other",r.tags=[...new Set(e.tags??[])].sort(),Pn(r.transform)&&delete r.transform,r.metadata=Object.fromEntries(Object.entries(e.metadata??{}).filter(([n])=>!t.includes(n)));for(let n of["metrics","style","metadata"])Pn(r[n])&&delete r[n];for(let n of["actions","decals"])Array.isArray(r[n])&&!r[n].length&&delete r[n];return r}function Ne(e,t,r,n,o,i){let a=c=>c===void 0||Array.isArray(c)&&c.length===0;if(Object.is(e,t)||a(e)&&a(t)||typeof e=="number"&&typeof t=="number"&&Math.abs(e-t)<=o)return;let s=c=>!!c&&typeof c=="object"&&!Array.isArray(c);if(s(e)&&s(t)){for(let c of[...new Set([...Object.keys(e),...Object.keys(t)])].sort())Ne(e[c],t[c],`${r}.${c}`,n,o,i);return}if(Array.isArray(e)&&Array.isArray(t)&&e.length===t.length){for(let c=0;c<e.length;c++)Ne(e[c],t[c],`${r}[${c}]`,n,o,i);return}i.push({path:r,category:n,...e!==void 0?{before:ue(e)}:{},...t!==void 0?{after:ue(t)}:{}})}function Dn(e,t,r={}){let n=r.tolerance??1e-6;if(!Number.isFinite(n)||n<0)throw new Error("Comparison tolerance must be finite and nonnegative");let o=Object.entries(e.objectBindings).filter(([,p])=>!p.removed),i=Object.entries(t.objectBindings).filter(([,p])=>!p.removed),a=new Map(o),s=new Map(i),c=new Set,d=new Set,l=[],u=p=>{let h=r.matchBy??"modelObjectId",v=typeof h=="object"?p.metadata?.[h.metadataKey]:p[h];return typeof v=="string"&&v.length>0||typeof v=="number"?`${typeof v}:${v}`:null};function m(p,h,v){let M=p===void 0?void 0:a.get(p),y=h===void 0?void 0:s.get(h),P=[];if(M||y){let re=M?Bn(M,r.ignoreMetadataKeys??[]):{},x=y?Bn(y,r.ignoreMetadataKeys??[]):{};for(let S of Nr)Ne(re[S],x[S],S,En[S],n,P)}let V=M?y?P.length?"modified":"unchanged":"removed":"added";l.push({id:JSON.stringify([p??null,h??null]),identity:v,label:y?.label??M?.label??y?.modelObjectId??M?.modelObjectId??v,status:V,beforeKey:p,afterKey:h,beforeObjectId:M?.modelObjectId,afterObjectId:y?.modelObjectId,changes:P}),p!==void 0&&c.add(p),h!==void 0&&d.add(h)}let f=new Set;for(let[p,h]of Object.entries(r.mapping??{})){if(!a.has(p)||!s.has(h)||f.has(h))throw new Error("Comparison mapping must reference existing, unique binding keys");f.add(h),m(p,h,`mapped:${p}`)}let w=new Map;for(let[p,h,v]of[[o,c,"a"],[i,d,"b"]])for(let[M,y]of p){if(h.has(M))continue;let P=u(y);if(P===null){l.push({id:JSON.stringify([v,M]),identity:"",label:y.label??y.modelObjectId,status:"ambiguous",...v==="a"?{beforeKey:M,beforeObjectId:y.modelObjectId}:{afterKey:M,afterObjectId:y.modelObjectId},changes:[],message:"Missing match identity. Supply an explicit mapping or another match field."});continue}let V=w.get(P)??{a:[],b:[]};V[v].push(M),w.set(P,V)}for(let[p,h]of w){if(h.a.length<=1&&h.b.length<=1){m(h.a[0],h.b[0],p);continue}for(let v of["a","b"])for(let M of h[v]){let y=(v==="a"?a:s).get(M);l.push({id:JSON.stringify([v,M]),identity:p,label:y.label??y.modelObjectId,status:"ambiguous",...v==="a"?{beforeKey:M,beforeObjectId:y.modelObjectId}:{afterKey:M,afterObjectId:y.modelObjectId},changes:[],message:"Duplicate match identity. Supply an explicit one-to-one mapping."})}}l.sort((p,h)=>p.label.localeCompare(h.label)||p.id.localeCompare(h.id));let C=[];Ne(ue(e.sceneConfig??{}),ue(t.sceneConfig??{}),"sceneConfig","scene",n,C);let b={added:0,removed:0,modified:0,unchanged:0,ambiguous:0};for(let p of l)b[p.status]++;return{version:1,objects:l,counts:b,sceneChanges:C}}0&&(module.exports={ACTION_CATALOG,DEFAULT_MODEL_VIEWER_LABELS,DEFAULT_SCENE_CONFIG,DEFAULT_SECTION_CONFIG,MATERIAL_BLENDING_MODES,MATERIAL_SIDES,MAX_VIEWER_STATE_BYTES,MEASUREMENT_UNITS,SEQUENCE_EASINGS,SEQUENCE_OBJECT_PROPERTIES,applyIsolation,applyProductOptions,applyStyleRules,buildBindingsFromNodes,calibrateMeasurements,chooseMaterialVariant,collectObjectHierarchy,colorScaleValue,compareViewerConfigurations,copyBindingStyle,createARHandoffUrl,createDefaultBinding,decodeProductSelections,defaultProductSelections,defineObjectBindings,encodeProductSelections,evaluateProductConfiguration,exportConfiguredUSDZ,findCatalogAction,formatProductPrice,generateProductSkus,groundAsset,inferType,inspectAsset,isolatedBindingKeys,material,measurementResult,measurementScale,measurementValue,measurementsToCsv,parseAssetTransform,parseMeasurements,parseProductConfiguration,parseProductDefinition,parseSceneProduct,parseSectionConfig,parseSelectionSets,parseSequences,parseViewerState,pasteBindingStyle,patchBindings,patchSceneConfig,prepareViewerState,productCheckoutUrl,productDefinitionWarnings,productOptionStates,productPriceFromDefinition,readARHandoffUrl,resolveProductSelections,sampleSequenceTrack,sceneLight,sectionSnapshot,selectBindingKeys,selectBindings,serializeMeasurements,serializeProductConfiguration,serializeViewerState,snapAssetToGrid,upsertSequenceKeyframe});
|
package/dist/utils.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ce,b as se,c as pe}from"./chunk-F5QSXMME.mjs";import{$ as f,Aa as oe,Ba as ne,C as a,Ca as re,D as c,Da as ie,E as s,F as p,Ha as ae,Ja as ue,K as u,Ka as de,La as me,M as d,Ma as Se,N as m,Na as le,X as S,Z as l,aa as g,ba as C,ca as y,da as x,ea as P,fa as A,ga as H,ha as F,ia as K,ja as W,oa as z,pa as Q,sa as J,ta as Y,va as Z,za as te}from"./chunk-5FLX45O5.mjs";import{b as $,c as ee}from"./chunk-CCBFMNAU.mjs";import{a as e,b as t,e as o,f as n,g as r}from"./chunk-LX3GXQNU.mjs";import{b,c as E,d as h,e as j,f as R,g as T,h as V,i as I,j as L,k as w,l as D,m as _,n as N,o as q,p as k,q as v,r as U,s as G}from"./chunk-7JCFNZJM.mjs";import{b as O,c as B}from"./chunk-GV4ZRXL6.mjs";import{n as X}from"./chunk-EV6THDXD.mjs";import{a as i}from"./chunk-
|
|
1
|
+
import{a as ce,b as se,c as pe}from"./chunk-F5QSXMME.mjs";import{$ as f,Aa as oe,Ba as ne,C as a,Ca as re,D as c,Da as ie,E as s,F as p,Ha as ae,Ja as ue,K as u,Ka as de,La as me,M as d,Ma as Se,N as m,Na as le,X as S,Z as l,aa as g,ba as C,ca as y,da as x,ea as P,fa as A,ga as H,ha as F,ia as K,ja as W,oa as z,pa as Q,sa as J,ta as Y,va as Z,za as te}from"./chunk-5FLX45O5.mjs";import{b as $,c as ee}from"./chunk-CCBFMNAU.mjs";import{a as e,b as t,e as o,f as n,g as r}from"./chunk-LX3GXQNU.mjs";import{b,c as E,d as h,e as j,f as R,g as T,h as V,i as I,j as L,k as w,l as D,m as _,n as N,o as q,p as k,q as v,r as U,s as G}from"./chunk-7JCFNZJM.mjs";import{b as O,c as B}from"./chunk-GV4ZRXL6.mjs";import{n as X}from"./chunk-EV6THDXD.mjs";import{a as i}from"./chunk-OPDRK3GS.mjs";import{c as M}from"./chunk-BNKTI3CY.mjs";import"./chunk-JR557W27.mjs";export{Y as ACTION_CATALOG,i as DEFAULT_MODEL_VIEWER_LABELS,c as DEFAULT_SCENE_CONFIG,a as DEFAULT_SECTION_CONFIG,de as MATERIAL_BLENDING_MODES,ue as MATERIAL_SIDES,H as MAX_VIEWER_STATE_BYTES,S as MEASUREMENT_UNITS,t as SEQUENCE_EASINGS,e as SEQUENCE_OBJECT_PROPERTIES,oe as applyIsolation,G as applyProductOptions,ee as applyStyleRules,ie as buildBindingsFromNodes,f as calibrateMeasurements,M as chooseMaterialVariant,me as collectObjectHierarchy,$ as colorScaleValue,ae as compareViewerConfigurations,Se as copyBindingStyle,z as createARHandoffUrl,re as createDefaultBinding,D as decodeProductSelections,j as defaultProductSelections,pe as defineObjectBindings,w as encodeProductSelections,R as evaluateProductConfiguration,J as exportConfiguredUSDZ,Z as findCatalogAction,I as formatProductPrice,_ as generateProductSkus,m as groundAsset,ne as inferType,X as inspectAsset,te as isolatedBindingKeys,E as material,C as measurementResult,l as measurementScale,g as measurementValue,P as measurementsToCsv,u as parseAssetTransform,y as parseMeasurements,U as parseProductConfiguration,h as parseProductDefinition,k as parseSceneProduct,s as parseSectionConfig,A as parseSelectionSets,o as parseSequences,K as parseViewerState,le as pasteBindingStyle,b as patchBindings,ce as patchSceneConfig,W as prepareViewerState,L as productCheckoutUrl,N as productDefinitionWarnings,q as productOptionStates,V as productPriceFromDefinition,Q as readARHandoffUrl,T as resolveProductSelections,n as sampleSequenceTrack,se as sceneLight,p as sectionSnapshot,O as selectBindingKeys,B as selectBindings,x as serializeMeasurements,v as serializeProductConfiguration,F as serializeViewerState,d as snapAssetToGrid,r as upsertSequenceKeyframe};
|
package/package.json
CHANGED
package/dist/chunk-2DV2UCQH.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as n}from"./chunk-MMO7KCYU.mjs";import{w as i}from"./chunk-OREKYGO3.mjs";var a={licenseKey:!0,arHandoff:!0,mobileHandoffUrl:!0,dracoDecoderPath:!0,ktx2TranscoderPath:!0,meshopt:!0,hideLicenseCheckingOverlay:!0},d={licenseValidationUrl:!0,gizmoTool:!0,showFloorGrid:!0,onObjectEditLeaseChange:!0,onSelectionClear:!0,onSceneLoaded:!0,onTexturePositioningChange:!0,endTexturePositioningRef:!0};function f(e,t){let o={};for(let r of Object.keys(t))r in e&&(o[r]=e[r]);return o}function s(e,t){let o={...e};for(let r of Object.keys(t))delete o[r];return o}import{jsx as c}from"react/jsx-runtime";function l(e){return n("model-viewer","ModelViewer"),c(i,{...s(e,d)})}export{a,f as b,l as c};
|