u-space 0.0.16 → 0.0.18

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.
@@ -83,4 +83,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
83
83
  `+u.linebrk(j.toString("base64"),70)+`
84
84
  `+r+`
85
85
  `},privateImport:function(a,n,e){e=e||{};var s;if(e.type!=="der")if(Buffer.isBuffer(n)&&(n=n.toString("utf8")),t.isString(n)){var l=u.trimSurroundingText(n,d,r).replace(/\s+|\n\r|\n|\r$/gm,"");s=Buffer.from(l,"base64")}else throw Error("Unsupported key format");else if(Buffer.isBuffer(n))s=n;else throw Error("Unsupported key format");const v={buf:s,off:0};if(s.slice(0,14).toString("ascii")!=="openssh-key-v1")throw"Invalid file format.";if(v.off+=15,h(v).toString("ascii")!=="none"||h(v).toString("ascii")!=="none"||h(v).toString("ascii")!==""||(v.off+=4,v.off+=4,h(v).toString("ascii")!=="ssh-rsa")||(h(v),h(v),v.off+=12,h(v).toString("ascii")!=="ssh-rsa"))throw Error("Unsupported key type");const b=h(v),m=h(v),q=h(v),E=h(v),S=h(v),O=h(v),D=new o(q),j=new o(O),$=new o(S),J=D.mod($.subtract(o.ONE)),ie=D.mod(j.subtract(o.ONE));a.setPrivate(b,m,q,S,O,J.toBuffer(),ie.toBuffer(),E),a.sshcomment=h(v).toString("ascii")},publicExport:function(a,n){let e=Buffer.alloc(4);for(e.writeUInt32BE(a.e,0);e[0]===0;)e=e.slice(1);const s=a.n.toBuffer(),l=Buffer.alloc(e.byteLength+4+s.byteLength+4+7+4),v={buf:l,off:0};f(v,Buffer.from("ssh-rsa")),f(v,e),f(v,s);let b=a.sshcomment||"";return n.type==="der"?v.buf:"ssh-rsa "+l.toString("base64")+" "+b+`
86
- `},publicImport:function(a,n,e){e=e||{};var s;if(e.type!=="der")if(Buffer.isBuffer(n)&&(n=n.toString("utf8")),t.isString(n)){if(n.substring(0,8)!=="ssh-rsa ")throw Error("Unsupported key format");let q=n.indexOf(" ",8);q===-1?q=n.length:a.sshcomment=n.substring(q+1).replace(/\s+|\n\r|\n|\r$/gm,"");const E=n.substring(8,q).replace(/\s+|\n\r|\n|\r$/gm,"");s=Buffer.from(E,"base64")}else throw Error("Unsupported key format");else if(Buffer.isBuffer(n))s=n;else throw Error("Unsupported key format");const l={buf:s,off:0},v=h(l).toString("ascii");if(v!=="ssh-rsa")throw Error("Invalid key type: "+v);const b=h(l),m=h(l);a.setPublic(m,b)},autoImport:function(a,n){return/^[\S\s]*-----BEGIN OPENSSH PRIVATE KEY-----\s*(?=(([A-Za-z0-9+/=]+\s*)+))\1-----END OPENSSH PRIVATE KEY-----[\S\s]*$/g.test(n)?(c.exports.privateImport(a,n),!0):/^[\S\s]*ssh-rsa \s*(?=(([A-Za-z0-9+/=]+\s*)+))\1[\S\s]*$/g.test(n)?(c.exports.publicImport(a,n),!0):!1}};function h(a){const n=a.buf.readInt32BE(a.off);a.off+=4;const e=a.buf.slice(a.off,a.off+n);return a.off+=n,e}function f(a,n){a.buf.writeInt32BE(n.byteLength,a.off),a.off+=4,a.off+=n.copy(a.buf,a.off)}})(openssh)),openssh.exports}var hasRequiredFormats;function requireFormats(){return hasRequiredFormats||(hasRequiredFormats=1,(function(c){requireUtils()._;function t(u){u=u.split("-");for(var o="private",d={type:"default"},r=1;r<u.length;r++)if(u[r])switch(u[r]){case"public":o=u[r];break;case"private":o=u[r];break;case"pem":d.type=u[r];break;case"der":d.type=u[r];break}return{scheme:u[0],keyType:o,keyOpt:d}}c.exports={pkcs1:requirePkcs1(),pkcs8:requirePkcs8(),components:requireComponents(),openssh:requireOpenssh(),isPrivateExport:function(u){return c.exports[u]&&typeof c.exports[u].privateExport=="function"},isPrivateImport:function(u){return c.exports[u]&&typeof c.exports[u].privateImport=="function"},isPublicExport:function(u){return c.exports[u]&&typeof c.exports[u].publicExport=="function"},isPublicImport:function(u){return c.exports[u]&&typeof c.exports[u].publicImport=="function"},detectAndImport:function(u,o,d){if(d===void 0){for(var r in c.exports)if(typeof c.exports[r].autoImport=="function"&&c.exports[r].autoImport(u,o))return!0}else if(d){var h=t(d);if(c.exports[h.scheme])h.keyType==="private"?c.exports[h.scheme].privateImport(u,o,h.keyOpt):c.exports[h.scheme].publicImport(u,o,h.keyOpt);else throw Error("Unsupported key format")}return!1},detectAndExport:function(u,o){if(o){var d=t(o);if(c.exports[d.scheme])if(d.keyType==="private"){if(!u.isPrivate())throw Error("This is not private key");return c.exports[d.scheme].privateExport(u,d.keyOpt)}else{if(!u.isPublic())throw Error("This is not public key");return c.exports[d.scheme].publicExport(u,d.keyOpt)}else throw Error("Unsupported key format")}}}})(formats)),formats.exports}var NodeRSA$1,hasRequiredNodeRSA;function requireNodeRSA(){if(hasRequiredNodeRSA)return NodeRSA$1;hasRequiredNodeRSA=1;var c=requireRsa();requireCryptoBrowserify(),requireLib().Ber;var t=requireUtils()._,u=requireUtils(),o=requireSchemes(),d=requireFormats();return NodeRSA$1=(function(){var r={node10:["md4","md5","ripemd160","sha1","sha224","sha256","sha384","sha512"],node:["md4","md5","ripemd160","sha1","sha224","sha256","sha384","sha512"],iojs:["md4","md5","ripemd160","sha1","sha224","sha256","sha384","sha512"],browser:["md5","ripemd160","sha1","sha256","sha512"]},h="pkcs1_oaep",f="pkcs1",a="private",n={private:"pkcs1-private-pem","private-der":"pkcs1-private-der",public:"pkcs8-public-pem","public-der":"pkcs8-public-der"};function e(s,l,v){if(!(this instanceof e))return new e(s,l,v);t.isObject(l)&&(v=l,l=void 0),this.$options={signingScheme:f,signingSchemeOptions:{hash:"sha256",saltLength:null},encryptionScheme:h,encryptionSchemeOptions:{hash:"sha1",label:null},environment:u.detectEnvironment(),rsaUtils:this},this.keyPair=new c.Key,this.$cache={},Buffer.isBuffer(s)||t.isString(s)?this.importKey(s,l):t.isObject(s)&&this.generateKeyPair(s.b,s.e),this.setOptions(v)}return e.prototype.setOptions=function(s){if(s=s||{},s.environment&&(this.$options.environment=s.environment),s.signingScheme){if(t.isString(s.signingScheme)){var l=s.signingScheme.toLowerCase().split("-");l.length==1?r.node.indexOf(l[0])>-1?(this.$options.signingSchemeOptions={hash:l[0]},this.$options.signingScheme=f):(this.$options.signingScheme=l[0],this.$options.signingSchemeOptions={hash:null}):(this.$options.signingSchemeOptions={hash:l[1]},this.$options.signingScheme=l[0])}else t.isObject(s.signingScheme)&&(this.$options.signingScheme=s.signingScheme.scheme||f,this.$options.signingSchemeOptions=t.omit(s.signingScheme,"scheme"));if(!o.isSignature(this.$options.signingScheme))throw Error("Unsupported signing scheme");if(this.$options.signingSchemeOptions.hash&&r[this.$options.environment].indexOf(this.$options.signingSchemeOptions.hash)===-1)throw Error("Unsupported hashing algorithm for "+this.$options.environment+" environment")}if(s.encryptionScheme){if(t.isString(s.encryptionScheme)?(this.$options.encryptionScheme=s.encryptionScheme.toLowerCase(),this.$options.encryptionSchemeOptions={}):t.isObject(s.encryptionScheme)&&(this.$options.encryptionScheme=s.encryptionScheme.scheme||h,this.$options.encryptionSchemeOptions=t.omit(s.encryptionScheme,"scheme")),!o.isEncryption(this.$options.encryptionScheme))throw Error("Unsupported encryption scheme");if(this.$options.encryptionSchemeOptions.hash&&r[this.$options.environment].indexOf(this.$options.encryptionSchemeOptions.hash)===-1)throw Error("Unsupported hashing algorithm for "+this.$options.environment+" environment")}this.keyPair.setOptions(this.$options)},e.prototype.generateKeyPair=function(s,l){if(s=s||2048,l=l||65537,s%8!==0)throw Error("Key size must be a multiple of 8.");return this.keyPair.generate(s,l.toString(16)),this.$cache={},this},e.prototype.importKey=function(s,l){if(!s)throw Error("Empty key given");if(l&&(l=n[l]||l),!d.detectAndImport(this.keyPair,s,l)&&l===void 0)throw Error("Key format must be specified");return this.$cache={},this},e.prototype.exportKey=function(s){return s=s||a,s=n[s]||s,this.$cache[s]||(this.$cache[s]=d.detectAndExport(this.keyPair,s)),this.$cache[s]},e.prototype.isPrivate=function(){return this.keyPair.isPrivate()},e.prototype.isPublic=function(s){return this.keyPair.isPublic(s)},e.prototype.isEmpty=function(s){return!(this.keyPair.n||this.keyPair.e||this.keyPair.d)},e.prototype.encrypt=function(s,l,v){return this.$$encryptKey(!1,s,l,v)},e.prototype.decrypt=function(s,l){return this.$$decryptKey(!1,s,l)},e.prototype.encryptPrivate=function(s,l,v){return this.$$encryptKey(!0,s,l,v)},e.prototype.decryptPublic=function(s,l){return this.$$decryptKey(!0,s,l)},e.prototype.$$encryptKey=function(s,l,v,b){try{var m=this.keyPair.encrypt(this.$getDataForEncrypt(l,b),s);return v=="buffer"||!v?m:m.toString(v)}catch(q){throw Error("Error during encryption. Original error: "+q)}},e.prototype.$$decryptKey=function(s,l,v){try{l=t.isString(l)?Buffer.from(l,"base64"):l;var b=this.keyPair.decrypt(l,s);if(b===null)throw Error("Key decrypt method returns null.");return this.$getDecryptedData(b,v)}catch(m){throw Error("Error during decryption (probably incorrect key). Original error: "+m)}},e.prototype.sign=function(s,l,v){if(!this.isPrivate())throw Error("This is not private key");var b=this.keyPair.sign(this.$getDataForEncrypt(s,v));return l&&l!="buffer"&&(b=b.toString(l)),b},e.prototype.verify=function(s,l,v,b){if(!this.isPublic())throw Error("This is not public key");return b=!b||b=="buffer"?null:b,this.keyPair.verify(this.$getDataForEncrypt(s,v),l,b)},e.prototype.getKeySize=function(){return this.keyPair.keySize},e.prototype.getMaxMessageSize=function(){return this.keyPair.maxMessageLength},e.prototype.$getDataForEncrypt=function(s,l){if(t.isString(s)||t.isNumber(s))return Buffer.from(""+s,l||"utf8");if(Buffer.isBuffer(s))return s;if(t.isObject(s))return Buffer.from(JSON.stringify(s));throw Error("Unexpected data type")},e.prototype.$getDecryptedData=function(s,l){return l=l||"buffer",l=="buffer"?s:l=="json"?JSON.parse(s.toString()):s.toString(l)},e})(),NodeRSA$1}var NodeRSAExports=requireNodeRSA();const NodeRSA=getDefaultExportFromCjs$1(NodeRSAExports),debugKey="NJHgNB1HDTrHTJc4ERFCBRVBB5HOBEDCjRLChRDIdn8K7EUJD,Vm4C6vC8BpZ6n6G,hxOjYZ{,wYhnJize2rlm9m,6bUcRVbP6sjNbKU8juOWUpukkcV6Cw,Bk2io7{YWJcPnG{1o3GUTpnO:z{kCYHL14HjO8noH1sp[J78k3Y3IcbOSSk97evccx0MdW2uR0f5qhZFQV8e2JCRxxJEBRBC";function decryptWithDebugKey(c){return decryptWithKey(c,decodeString(debugKey))}function decryptWithKey(c,t){const{content:u,sign:o}=c,d=new NodeRSA(t,"pkcs8-public",{environment:"browser",signingScheme:"pkcs1-md5",encryptionScheme:"pkcs1"});if(!d.verify(u,o,"utf8","base64"))throw new Error("u-space: license verify failed");const h=decryptInternal(u,d);return JSON.parse(h)}function decryptInternal(c,t){const u=c.charCodeAt(0),o=c.substring(1,u),d=c.substring(u),r=parseHeader(o);let h="";for(const f of r){const a=d.substring(f.start,f.end);let n;f.encrypt?n=t.decryptPublic(a,"utf8"):n=decodeString(a),h+=n}return h}function parseHeader(c){const t=decodeToBytes(c),o=new DataView(t.buffer).getInt16(0);if(o===1)return parseHeaderV1(t.buffer);throw new Error(`u-space: content version error, version=${o}`)}function parseHeaderV1(c){const t=new DataView(c);let u=2;const o=t.getInt16(u);u+=2;const d=[];for(let r=0;r<o;r++){const h=t.getInt16(u);u+=2;const f=t.getInt16(u);u+=2;const a=t.getInt32(u);u+=4;const n=t.getInt32(u);u+=4;const e={index:h,encrypt:f>0,start:a,end:n};d.push(e)}return d.sort((r,h)=>r.index<=h.index?-1:1),d}const _base64KeyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function decodeToBytes(c){const t=[];let u,o,d,r,h,f,a,n=0;for(c=c.replace(/[^A-Za-z0-9+/=]/g,"");n<c.length;)r=_base64KeyStr.indexOf(c.charAt(n++)),h=_base64KeyStr.indexOf(c.charAt(n++)),f=_base64KeyStr.indexOf(c.charAt(n++)),a=_base64KeyStr.indexOf(c.charAt(n++)),u=r<<2|h>>4,o=(h&15)<<4|f>>2,d=(f&3)<<6|a,t.push(u),f!==64&&t.push(o),a!==64&&t.push(d);return new Int8Array(t)}function decodeString(c){let t="";for(let u=0;u<c.length;u++){const d=c.charCodeAt(u)-1;t+=String.fromCharCode(d)}return t}const logo="data:image/webp;base64,UklGRswmAABXRUJQVlA4TMAmAAAvAIVnEA+imJEkqF4DtQTrz3QpKGjbhjHsQhiui4tMGGI1fJLp/2pgpmGafmQX+FcJCpbA5zH0qRRk4CBkwumBoU/XQR7YOg4Ctg2bWk7Mn3Pd/RAiYgLOrwIBqGKLe/j8QQ8k9LxcT5WABkhGMBpgnw8+SRIUpZ93E4h/br9UEHckCdBoBPs8hU9QViMEdtsrD6UAYqu2nufuZiZJxnecsVPL7pbjycwkYzu3E7sk1A+Z23Vsz4d3UTL5kiS2Ezjbz23buR+2Y4/tGW+rtmfNtm3bvsd1r/ZN+///7v5yvC3Lkhxb/ZYgc6gwi0H0gzQR/Z8Ab8+2121s29Zv6N095XZIr6T///9ZaLniGL2qPlHQCxH6IEgfJBAkSET0fwIou7ZVR5I+woqKfkRX5v9/aKcrOPeauB5h+cpXHlhmAEIgUET/J8C3a1t1bdu25W/q1/qEyv//Vu/j4ppTdqrt0Q+gJCHzYIEQFsIR/Z8AWs62120j72FOd7OIpAdPL4juf1uxpf8V2zndcQASP0KIQAUSAol/qIj+T4AkadujNpr2fYgQO8HIGHpadd//ZhJIgi/ZqUS39Tv1US5CJsoZIvo/Ab5d26pr27at8k213fqVXsf/f1a/OuI6hOsbD6AsIfNggRBWEo7o/wT89h99Pq6p+8OXvymldK/1hdHA4/vzu683+Zvq8O53tPR/l7/H/La3ngyG577Ob3jrycAYv/173RQZIrf9eJ9LDJbnd3qLK5lBM67l7W3aGDq37/zeNm0MoZf6xjZtDKS5vqtNG8Nprn7wn/+av1xpq3ktkX/9vX70/adF2RhU8+wB0//Uv91ood7L49/v8fGvQN1HiDdjHvu532T/V+SnPxUZWvdivsF0N3ZGKxeWTUT+CnAFzkA7W5JydfTwJzqGV3cz3kuwtxuTk3hQ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MEnokX9AEg9NVtlyDx1Cmm1gzkGjeWANd1wc7z2kHPTFqFF/QxIGsHOkzeAUOhQerCD0gWLeCuwpw/lSraTEfPQrHJn18+BFK9moby/CyJTBXY1O8CzCRHxNsOkDjxfSzgzZuEa1br8PiaS7tq+V72iUBLtFtxsCUguMCy3GVZ9oYX6xg3rN0o1/MWUdOrPg6SYwne5n/UCKvdJXYBfUyjJBYOcnrDs+kA6zyvdUYh/YtTEsyRX6qHf9yMjqed0tn3q/RTbWakxujCnZgnAffG/ZklPmHd9JZwj/1PYUyYO8zEn0ZxP/e6PtH/27F9XTtcZ/1WPMT9l2A7PtP7KUb/h/U27ZwQo6+J8Lea0PvGLffn7ZIFxriktB5jblNJaK97wAQ==";class Watermarker extends webgpu.Scene{viewer;camera;mesh;overlayPass;#t=!1;#r=null;constructor(t){super(),this.viewer=t,this.camera=new webgpu.OrthographicCamera(-1,1,1,-1,0,1),this.camera.position.z=.5,this.mesh=new webgpu.Mesh(new webgpu.PlaneGeometry(1.8,1.8),new webgpu.MeshBasicNodeMaterial({color:16777215,opacity:.5,transparent:!0})),this.add(this.mesh),this.overlayPass=tsl.pass(this,this.camera)}enable(){this.#t=!0,this.#i().then(t=>{this.#t&&(this.mesh.material.map!==t&&(this.mesh.material.map=t,this.mesh.material.needsUpdate=!0),this.viewer.renderPipeline.addOverlayPass(this.overlayPass))}).catch(t=>{this.#r=null,console.warn("u-space Watermarker: failed to load watermark texture.",t)})}disable(){this.#t=!1,this.viewer.renderPipeline.removeOverlayPass(this.overlayPass)}dispose(){this.disable(),this.overlayPass.dispose(),this.mesh.geometry.dispose(),this.mesh.material.dispose(),this.mesh.material.map?.dispose()}#i(){return this.mesh.material.map?Promise.resolve(this.mesh.material.map):(this.#r??=uSpace.TextureLoaderManager.loadAsyncTexture(logo).then(t=>(t.colorSpace=webgpu.SRGBColorSpace,t)),this.#r)}}const _m4=new webgpu.Matrix4;class SceneParser{viewer;path;manager;constructor(t,u,o){this.viewer=t,this.path=u,this.manager=o}async parseAsync(t,u,o){const d=new webgpu.Group,r=async(h,f=null)=>{const a=await this.parseTreeNode(h);if(a){const{id:n,sid:e}=h;this.viewer.objectManager.add(n,a),this.viewer.objectManager.add(e,a),u.add(n),u.add(e),f?f.add(a):d.add(a)}await Promise.all(h.children.map(n=>r(n,a)))};return await Promise.all(t.map(h=>r(h,d))),d}async parseTreeNode(t){const{name:u,renderType:o,path:d,visible:r,matrix:h,shape:f,extra:a}=t;let n=null;if(o==="3D"&&d){const e=this.path+d,s=new uSpace.Model;this.manager.itemStart(e),await s.loadAsync({url:e}),this.manager.itemEnd(e),n=s}else if(o==="GROUP"||o==="STUB")n=new webgpu.Group;else if(o==="POLYGON"&&f?.points){const e=uSpace.ShapeMesh.createFromPoints(f.points);e.material.color.set("blue"),e.material.transparent=!0,e.material.opacity=.5,n=e}else if(o==="CIRCLE"&&f?.radius){const e=new uSpace.CircleMesh({geometryParameters:{radius:f.radius}});e.material.color.set("blue"),e.material.transparent=!0,e.material.opacity=.5,n=e}else if(o==="AREA"||o==="FLOOR"||o==="ROOM"){const e=uSpace.ExtrudeMesh.createFromPoints(f?.points,{geometryParameters:{options:{depth:f?.depth,bevelEnabled:!1}}});e.material.color.set(a?.color??"blue"),e.material.transparent=!0,e.material.opacity=a?.opacity??.5,n=e}if(n){n.name=u,n.visible=r,_m4.fromArray(h).decompose(n.position,n.quaternion,n.scale);const s={...t};Reflect.deleteProperty(s,"children"),Object.assign(n.userData,s)}return n}}class SceneLoader extends webgpu.Loader{viewer;key="";cachedIds=new Set;_resourceData=null;_treeData=[];#t;constructor(t){super(),this.viewer=t,this.#t=new Watermarker(t),this.manager=new webgpu.LoadingManager}setKey(t){return this.key=t,this}async _preareTreeData(){if(!this.path)throw new Error("u-space SceneLoader: path is not set");const t=new BaseFileLoader(this),u=await t.loadAsync(META_DATA_FILE_PATH);if(u.version<1.5)throw new Error("u-space SceneLoader: Only support version 1.5 and above");if(!this.key&&u.authority==="OFFICIAL")throw new Error("u-space SceneLoader: options.key is required when authority is OFFICIAL");this.key&&u.authority==="TRIAL"&&console.warn("u-space SceneLoader: options.key is not used when authority is TRIAL");const o=await t.loadAsync(u.resource),d=this._resourceData!==o;if(this._resourceData=o,d)if(u.encryptWith==="DEBUG")try{this._treeData=decryptWithDebugKey(o),this.#t.enable()}catch{throw new Error("u-space SceneLoader: decrypt with debug key failed")}else if(u.encryptWith==="SCENE"||u.encryptWith==="COMPANY")try{this._treeData=decryptWithKey(o,this.key)}catch{throw new Error("u-space SceneLoader: decrypt with authorized key failed")}else u.encryptWith||(this._treeData=o)}async loadAsync(t={}){if(!this.path)throw new Error("u-space SceneLoader: path is not set");this.manager.itemStart(this.path);try{return await this._preareTreeData(),await new SceneParser(this.viewer,this.path,this.manager).parseAsync(this._treeData,this.cachedIds,t)}catch(u){throw this.manager.itemError(this.path),u}finally{this.manager.itemEnd(this.path)}}clearCache(){this.cachedIds.forEach(t=>{this.viewer.objectManager.removeById(t)}),this.cachedIds.clear()}dispose(){this.clearCache(),this.#t.dispose()}}class AnimationsLoader extends webgpu.Loader{constructor(){super(),this.manager=new webgpu.LoadingManager}async loadAsync(){return await new BaseFileLoader(this).loadAsync(ANIMATIONS_DATA_FILE_PATH)}}class AnimationsParser extends webgpu.EventDispatcher{viewer;target;tweenSet;_initialTransformSymbol=Symbol("initialTransform");constructor(t,u){super(),this.viewer=t,this.target=u,this.tweenSet=new Set}initTransform(t){const{position:u,rotation:o,scale:d}=this.target,r=t??{x:u.x,y:u.y,z:u.z,rotationX:o.x,rotationY:o.y,rotationZ:o.z,scaleX:d.x,scaleY:d.y,scaleZ:d.z};return Reflect.set(this.target,this._initialTransformSymbol,r),r}getInitialTransform(){return Reflect.get(this.target,this._initialTransformSymbol)}async play(t){let u=this.getInitialTransform();u||(u=this.initTransform());for(let o=0;o<t.length;o++){let d=t[o-1];d||(d=u);const r=t[o],h=r.delay??0,f=r.duration??1e3,a=r.easing,n=r.repeat===-1?1/0:r.repeat??0,e=r.yoyo??!1;await uSpace.tweenAnimation(this.viewer,{...d},{...r},{delay:h,duration:f,mode:a,repeat:n,yoyo:e},(s,l)=>{const{x:v,y:b,z:m,rotationX:q,rotationY:E,rotationZ:S,scaleX:O,scaleY:D,scaleZ:j}=s;this.target.position.set(v,b,m),this.target.rotation.set(q,E,S),this.target.scale.set(O,D,j),this.dispatchEvent({type:"update",source:s,tween:l})},s=>{this.tweenSet.add(s),this.dispatchEvent({type:"start",tween:s})})}}stop(){this.tweenSet.forEach(t=>t.stop()),this.tweenSet.clear()}reset(){const t=this.getInitialTransform();if(t){const{x:u,y:o,z:d,rotationX:r,rotationY:h,rotationZ:f,scaleX:a,scaleY:n,scaleZ:e}=t;this.target.position.set(u,o,d),this.target.rotation.set(r,h,f),this.target.scale.set(a,n,e),this.viewer.render()}}dispose(){this.stop(),this.reset(),Reflect.deleteProperty(this.target,this._initialTransformSymbol)}}class TopologyParser{parse(t){const{name:u,position:o,rotation:d,scale:r,nodes:h,nodeRadius:f=.2,nodeColor:a="#0000ff",linkWidth:n=.1,linkColor:e=["#00ff00"]}=t,s=new uSpace.Topology({nodeRadius:f,nodeColor:a,edgeRadius:n,edgeColor:e[0],pathRadius:n+.05});return s.name=u,s.position.set(o.x,o.y,o.z),s.rotation.set(d.x,d.y,d.z),s.scale.set(r.x,r.y,r.z),h.forEach(l=>{const v=new webgpu.Vector3().copy(l.position);s.addNode(l.id,v)}),h.forEach(l=>{l.graphs.forEach(v=>{s.addEdge(l.id,v.targetNodeId)})}),s.renderGraph(),Object.assign(s.userData,t),s}}class TopologiesLoader extends webgpu.Loader{constructor(){super(),this.manager=new webgpu.LoadingManager}async loadAsync(){if(!this.path)throw new Error("u-manager TopologiesLoader: path is not set");const u=await new BaseFileLoader(this).loadAsync(TOPOLOGY_DATA_FILE_PATH),o=new TopologyParser,d=[];return u.forEach(r=>{const h=o.parse(r);d.push(h)}),d}}class PropertiesLoader extends webgpu.Loader{constructor(){super(),this.manager=new webgpu.LoadingManager}async loadAsync(){return await new BaseFileLoader(this).loadAsync(PROPERTIES_DATA_FILE_PATH)}}class VisionsLoader extends webgpu.Loader{constructor(){super(),this.manager=new webgpu.LoadingManager}async loadAsync(){return await new BaseFileLoader(this).loadAsync(VISIONS_DATA_FILE_PATH)}}class VisionsParser{viewer;constructor(t){this.viewer=t}async flyToPrimary(t,u=!0){const o=t.find(d=>d.primary);return o?(await this.flyTo(o,u),!0):!1}async flyTo(t,u=!0){const{camera:o,position:d,target:r,zoom:h=this.viewer.camera.zoom}=t;o==="P"?this.viewer.setCameraByType("perspective"):o==="O"&&this.viewer.setCameraByType("orthographic");const{x:f,y:a,z:n}=d,{x:e,y:s,z:l}=r;await Promise.all([this.viewer.controls.setLookAt(f,a,n,e,s,l,u),this.viewer.controls.zoomTo(h,u)])}}const PLANISH_SCALE_Y=.01,_box=new webgpu.Box3,_pivot=new webgpu.Vector3,_raycastHits=[],_dummyPosition=new webgpu.Vector3,_dummyQuaternion=new webgpu.Quaternion,_dummyScale=new webgpu.Vector3,_boundsMatrix=new webgpu.Matrix4,_boundsSphere=new webgpu.Sphere;function getStateTextureSize(c,t=1){return Math.max(1,Math.ceil(Math.sqrt(Math.max(1,c*t))))}function getMatrixTextureSize(c){const t=Math.sqrt(Math.max(1,c)*4);return Math.max(4,Math.ceil(t/4)*4)}function createStateTexture(c){const t=new webgpu.DataTexture(new Float32Array(c*c*4),c,c,webgpu.RGBAFormat,webgpu.FloatType);return t.magFilter=webgpu.NearestFilter,t.minFilter=webgpu.NearestFilter,t.generateMipmaps=!1,t.needsUpdate=!0,t}function copyAttributeComponents(c,t,u,o){for(let d=0;d<u;d++)o.push(c?.getComponent(t,d)??0)}function createSemanticMaterial(c,t,u){const o=tsl.attribute("semanticIndex","float").toInt(),d=e=>tsl.int(tsl.textureSize(tsl.textureLoad(e),tsl.int(0)).x).toConst(),r=e=>{const s=d(e),l=o.mod(s).toConst(),v=o.div(s).toConst();return tsl.textureLoad(e,tsl.ivec2(l,v))},h=()=>{const e=d(u),s=o.mul(4).toConst(),l=s.mod(e).toConst(),v=s.div(e).toConst();return tsl.mat4(tsl.textureLoad(u,tsl.ivec2(l,v)),tsl.textureLoad(u,tsl.ivec2(l.add(1),v)),tsl.textureLoad(u,tsl.ivec2(l.add(2),v)),tsl.textureLoad(u,tsl.ivec2(l.add(3),v)))},f=r(c),a=r(t).x,n=new webgpu.MeshStandardNodeMaterial({transparent:!0,depthWrite:!1});return n.colorNode=tsl.vec4(f.rgb,1),n.opacityNode=f.a.mul(a),n.maskNode=a.greaterThan(.5).and(f.a.greaterThan(.001)),n.positionNode=h().mul(tsl.vec4(tsl.positionLocal,1)).xyz,n}function copySemanticColor(c,t){if(c instanceof webgpu.Color){t.x=c.r,t.y=c.g,t.z=c.b;return}t.x=c.x,t.y=c.y,t.z=c.z,c instanceof webgpu.Vector4&&(t.w=c.w)}function buildMergedSemanticGeometry(c){const t=[],u=[],o=[],d=[],r=[],h=[];c.forEach((a,n)=>{const e=a.geometry,s=e.getAttribute("position"),l=e.getAttribute("normal"),v=e.getAttribute("uv"),b=e.getIndex();if(!s)return;e.computeBoundingBox(),_box.copy(e.boundingBox??_box.makeEmpty()),_box.getCenter(_pivot),_pivot.y=_box.min.y;const m=t.length/3,q=[],E=[],S=[],O=[];for(let $=0;$<s.count;$++){const J=s.getX($)-_pivot.x,ie=s.getY($)-_pivot.y,ne=s.getZ($)-_pivot.z;t.push(J,ie,ne),q.push(J,ie,ne),d.push(n),copyAttributeComponents(l,$,3,u),copyAttributeComponents(l,$,3,E),copyAttributeComponents(v,$,2,o),copyAttributeComponents(v,$,2,S)}if(b)for(let $=0;$<b.count;$++){const J=b.getX($);r.push(m+J),O.push(J)}else for(let $=0;$<s.count;$++)r.push(m+$),O.push($);const D=new webgpu.BufferGeometry;D.setAttribute("position",new webgpu.Float32BufferAttribute(q,3)),l&&D.setAttribute("normal",new webgpu.Float32BufferAttribute(E,3)),v&&D.setAttribute("uv",new webgpu.Float32BufferAttribute(S,2)),D.setIndex(O),D.computeBoundingBox(),D.computeBoundingSphere();const j=new webgpu.Matrix4().makeTranslation(_pivot.x,_pivot.y,_pivot.z);h.push({id:a.id,kind:a.kind,name:a.name,index:n,baseMatrix:j,matrix:new webgpu.Matrix4,finalMatrix:j.clone(),geometry:D,color:a.color.clone(),visible:!0})});const f=new webgpu.BufferGeometry;return f.setAttribute("position",new webgpu.Float32BufferAttribute(t,3)),u.length>0&&f.setAttribute("normal",new webgpu.Float32BufferAttribute(u,3)),o.length>0&&f.setAttribute("uv",new webgpu.Float32BufferAttribute(o,2)),f.setAttribute("semanticIndex",new webgpu.Float32BufferAttribute(d,1)),f.setIndex(r),f.computeBoundingBox(),f.computeBoundingSphere(),{geometry:f,states:h}}class FloorMesh extends uSpace.BaseMesh{isFloorMergedSemanticMesh=!0;type="FloorMesh";boundingBox=null;boundingSphere=null;wallsInstances=new Map;columnsInstances=new Map;spacesInstances=new Map;doorsInstances=new Map;windowsInstances=new Map;semanticInstances=new Map;#t;#r;#i;#a;#o;#n;constructor(t){const{geometry:u,states:o}=buildMergedSemanticGeometry(t),d=getStateTextureSize(o.length),r=getMatrixTextureSize(o.length),h=createStateTexture(d),f=createStateTexture(d),a=createStateTexture(r),n=createSemanticMaterial(h,f,a);super(u,n),this.#r=o,this.#t={Walls:this.wallsInstances,Columns:this.columnsInstances,Spaces:this.spacesInstances,Doors:this.doorsInstances,Windows:this.windowsInstances},this.#i=h,this.#a=f,this.#o=a,this.#n=new webgpu.Mesh,this.#n.matrixAutoUpdate=!1,this.frustumCulled=!1,this.#r.forEach(e=>{this.semanticInstances.set(e.id,e.index),this.#t[e.kind].set(e.id,e.index),this.#s(e.index),this.#l(e.index),this.#f(e.index)}),this.userData.semanticEntries=this.#r.map(({id:e,kind:s,name:l,index:v})=>({id:e,kind:s,name:l,index:v}))}planish(t){return this.#c(t,u=>this.setScaleYAt(u,PLANISH_SCALE_Y)),this}unplanish(t){return this.#c(t,u=>this.setScaleYAt(u,1)),this}get semanticCount(){return this.#r.length}get instanceCount(){return this.semanticCount}getSemanticIndexById(t){return this.semanticInstances.get(t)}getSemanticIdAt(t){return this.#e(t).id}getSemanticKindAt(t){return this.#e(t).kind}getSemanticNameAt(t){return this.#e(t).name}setColorAt(t,u){const o=this.#e(t);return copySemanticColor(u,o.color),this.#s(t),this}getColorAt(t,u=new webgpu.Vector4){const o=this.#e(t).color;return u.copy(o),u}setOpacityAt(t,u){const o=this.#e(t);return o.color.w=Math.max(0,Math.min(1,u)),this.#s(t),this}getOpacityAt(t){return this.#e(t).color.w}setVisibleAt(t,u){const o=this.#e(t);return o.visible=u,this.#l(t),this}getVisibleAt(t){return this.#e(t).visible}setMatrixAt(t,u){const o=this.#e(t);return o.matrix.copy(u),o.finalMatrix.multiplyMatrices(o.baseMatrix,o.matrix),this.#u(),this.#f(t),this}setScaleAt(t,u,o,d){return this.#h(t,r=>{u instanceof webgpu.Vector3?r.copy(u):r.set(u,o??u,d??u)})}setScaleYAt(t,u){return this.#h(t,o=>{o.y=u})}getMatrixAt(t,u=new webgpu.Matrix4){return u.copy(this.#e(t).matrix),u}getFinalMatrixAt(t,u=new webgpu.Matrix4){return u.copy(this.#e(t).finalMatrix),u}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new webgpu.Box3),this.boundingBox.makeEmpty();for(const t of this.#r)this.getBoundingBoxAt(t.index,_box,!1)&&this.boundingBox.union(_box)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new webgpu.Sphere),this.boundingSphere.makeEmpty();for(const t of this.#r)this.getBoundingSphereAt(t.index,_boundsSphere,!1)&&this.boundingSphere.union(_boundsSphere)}getBoundingBoxAt(t,u=new webgpu.Box3,o=!0){const d=this.#e(t);return d.geometry.boundingBox||d.geometry.computeBoundingBox(),d.geometry.boundingBox?(u.copy(d.geometry.boundingBox).applyMatrix4(d.finalMatrix),o&&(this.updateWorldMatrix(!0,!1),u.applyMatrix4(this.matrixWorld)),u):null}getBoundingSphereAt(t,u=new webgpu.Sphere,o=!0){const d=this.#e(t);return d.geometry.boundingSphere||d.geometry.computeBoundingSphere(),d.geometry.boundingSphere?(u.copy(d.geometry.boundingSphere),o?(this.updateWorldMatrix(!0,!1),_boundsMatrix.multiplyMatrices(this.matrixWorld,d.finalMatrix),u.applyMatrix4(_boundsMatrix)):u.applyMatrix4(d.finalMatrix),u):null}raycast(t,u){if(this.visible===!1&&this.ignoreInvisibleWhenRaycast===!0)return!1;this.updateWorldMatrix(!0,!1),this.#n.material=this.material;for(const o of this.#r)if(!(!o.visible||o.color.w<=.001)){this.#n.geometry=o.geometry,this.#n.matrixWorld.multiplyMatrices(this.matrixWorld,o.finalMatrix),_raycastHits.length=0,this.#n.raycast(t,_raycastHits);for(const d of _raycastHits)d.object=this,d.instanceId=o.index,Object.assign(d,{semanticId:o.id,semanticKind:o.kind,semanticName:o.name,semanticIndex:o.index}),u.push(d)}}dispose(){this.geometry.dispose(),Array.isArray(this.material)?this.material.forEach(t=>t.dispose()):this.material.dispose(),this.#i.dispose(),this.#a.dispose(),this.#o.dispose(),this.#r.forEach(t=>t.geometry.dispose())}#e(t){const u=this.#r[t];if(!u)throw new Error(`u-space FloorMesh: invalid semantic index ${t}.`);return u}#u(){this.boundingBox=null,this.boundingSphere=null}#c(t,u){if(t===void 0){this.#r.forEach(o=>u(o.index));return}for(const o of this.#t[t].values())u(o)}#h(t,u){const o=this.#e(t);return o.matrix.decompose(_dummyPosition,_dummyQuaternion,_dummyScale),u(_dummyScale),o.matrix.compose(_dummyPosition,_dummyQuaternion,_dummyScale),o.finalMatrix.multiplyMatrices(o.baseMatrix,o.matrix),this.#u(),this.#f(t),this}#s(t){this.#e(t).color.toArray(this.#i.image.data,t*4),this.#i.needsUpdate=!0}#l(t){const u=this.#e(t),o=this.#a.image.data;o[t*4]=u.visible?1:0,o[t*4+1]=0,o[t*4+2]=0,o[t*4+3]=1,this.#a.needsUpdate=!0}#f(t){this.#e(t).finalMatrix.toArray(this.#o.image.data,t*16),this.#o.needsUpdate=!0}}class BuildingGroup extends uSpace.BaseGroup{isBuildingGroup=!0;type="BuildingGroup";floorMeshes=[];constructor(){super()}addFloor(t){return this.floorMeshes.includes(t)||(this.add(t),this.floorMeshes.push(t)),this}getFloorAt(t){return this.floorMeshes[t]}removeFloor(t){const u=this.floorMeshes.indexOf(t);return u!==-1&&this.floorMeshes.splice(u,1),this.remove(t),this}isolateFloor(t){const u=typeof t=="number"?this.getFloorAt(t):t;if(!u||!this.floorMeshes.includes(u))throw new Error("u-space BuildingGroup: the floor is not in this building group.");return this.floorMeshes.forEach(o=>{o.visible=o===u}),this}showAllFloors(){return this.floorMeshes.forEach(t=>{t.visible=!0}),this}planishFloors(t){return this.floorMeshes.forEach(u=>u.planish(t)),this}unplanishFloors(t){return this.floorMeshes.forEach(u=>u.unplanish(t)),this}}const SEMANTIC_INITIAL_COLORS={Walls:new webgpu.Vector4(.86,.86,.82,1),Columns:new webgpu.Vector4(.62,.65,.68,1),Spaces:new webgpu.Vector4(.36,.7,.5,.45),Doors:new webgpu.Vector4(.9,.52,.2,1),Windows:new webgpu.Vector4(.28,.62,.95,.65)};function getInitialColor(c){return SEMANTIC_INITIAL_COLORS[c].clone()}function getValidPolygonShape(c,t,u){return!Array.isArray(c)||c.length<4||c.length%2!==0?(console.warn(`u-space SemanticLoader: invalid ${t} polygon shape for id ${u}.`),null):c}function convertToPlaneIVector2(c){const t=[];for(let u=0;u<c.length;u+=2)t.push({x:c[u],z:c[u+1]});return t}class SemanticParser{parse(t){const u=[];return t.Buildings?.forEach(o=>{const d=new BuildingGroup;d.name=o.Name||"",d.userData.id=o.ID,o.Stories.forEach(r=>{const h=t.Stories?.[r];if(h&&h.ID){const f=[];if(h.Walls?.forEach(n=>{const e=t.Walls?.[n];if(!e||!e.Polygon)return;const s=getValidPolygonShape(e.Polygon.shape,"Walls",e.ID);if(!s)return;const l=uSpace.ExtrudeMesh.createFromPoints(convertToPlaneIVector2(s),{geometryParameters:{options:{depth:e.Height,bevelEnabled:!1}}}).geometry;l.translate(0,e.Elevation,0),l.userData.id=e.ID,f.push({id:e.ID,kind:"Walls",geometry:l,color:getInitialColor("Walls")})}),h.Columns?.forEach(n=>{const e=t.Columns?.[n];if(!e||!e.Polygon)return;const s=getValidPolygonShape(e.Polygon.shape,"Columns",e.ID);if(!s)return;const l=uSpace.ExtrudeMesh.createFromPoints(convertToPlaneIVector2(s),{geometryParameters:{options:{depth:e.Height,bevelEnabled:!1}}}).geometry;l.translate(0,e.Elevation,0),l.userData.id=e.ID,f.push({id:e.ID,kind:"Columns",geometry:l,color:getInitialColor("Columns")})}),h.Doors?.forEach(n=>{const e=t.Doors?.[n];if(!e||!e.Polygon)return;const s=getValidPolygonShape(e.Polygon.shape,"Doors",e.ID);if(!s)return;const l=uSpace.ExtrudeMesh.createFromPoints(convertToPlaneIVector2(s),{geometryParameters:{options:{depth:e.Height,bevelEnabled:!1}}}).geometry;l.translate(0,e.Elevation,0),l.userData.id=e.ID,f.push({id:e.ID,kind:"Doors",geometry:l,color:getInitialColor("Doors")})}),h.Windows?.forEach(n=>{const e=t.Windows?.[n];if(!e||!e.Polygon)return;const s=getValidPolygonShape(e.Polygon.shape,"Windows",e.ID);if(!s)return;const l=uSpace.ExtrudeMesh.createFromPoints(convertToPlaneIVector2(s),{geometryParameters:{options:{depth:e.Height,bevelEnabled:!1}}}).geometry;l.translate(0,e.Elevation,0),l.userData.id=e.ID,f.push({id:e.ID,kind:"Windows",geometry:l,color:getInitialColor("Windows")})}),h.Spaces?.forEach(n=>{const e=t.Spaces?.[n];if(!e||!e.Polygon)return;const s=getValidPolygonShape(e.Polygon.shape,"Spaces",e.ID);if(!s)return;const l=e.CeilingHeight-e.GroundHeight,v=uSpace.ExtrudeMesh.createFromPoints(convertToPlaneIVector2(s),{geometryParameters:{options:{depth:l,bevelEnabled:!1}}}).geometry;v.translate(0,e.GroundHeight,0),v.userData.id=e.ID,f.push({id:e.ID,kind:"Spaces",name:e.Name,geometry:v,color:getInitialColor("Spaces")})}),f.length===0)return;const a=new FloorMesh(f);a.name=h.Name||"",a.userData.id=h.ID,a.pivot=new webgpu.Vector3(0,h.Elevation||0,0),d.addFloor(a)}}),u.push(d)}),u}}class SemanticLoader extends webgpu.Loader{viewer;constructor(t){super(),this.viewer=t,this.manager=new webgpu.LoadingManager}async loadAsync(){if(!this.path)throw new Error("u-space SemanticLoader: path is not set");this.manager.itemStart(this.path);try{const u=await new BaseFileLoader(this).loadAsync(SEMANTIC_DATA_FILE_PATH);return new SemanticParser().parse(u)}catch(t){throw this.manager.itemError(this.path),t}finally{this.manager.itemEnd(this.path)}}}class Edge{id;source;target;sourceHandle;constructor(t){this.id=t.id,this.source=t.source,this.target=t.target,this.sourceHandle=t.sourceHandle}}function objectHandle(c,t){return Array.isArray(c)?c.map(t):t(c)}function sleep(c){return new Promise(t=>setTimeout(t,c))}function parseNodeByType(c,t){switch(t.type){case"START":return new StartNode(c,t);case"COLOR":return new ColorNode(c,t);case"NUMBER":return new NumberNode(c,t);case"HIGHLIGHT":return new HighlightNode(c,t);case"UN_HIGHLIGHT":return new UnHighlightNode(c,t);case"OPACITY":return new OpacityNode(c,t);case"UN_OPACITY":return new UnOpacityNode(c,t);case"EMISSIVE":return new EmissiveNode(c,t);case"UN_EMISSIVE":return new UnEmissiveNode(c,t);case"MESH":return new MeshNode(c,t);case"MESHES":return new MeshesNode(c,t);case"MODEL":return new ModelNode(c,t);case"MODELS":return new ModelsNode(c,t);case"SPACE":return new SpaceNode(c,t);case"SPACES":return new SpacesNode(c,t);case"POIS":return new POIsNode(c,t);case"POI":return new POINode(c,t);case"PATH":return new PathNode(c,t);case"PATHS":return new PathsNode(c,t);case"DELAY":return new DelayNode(c,t);case"CONDITION_NODE":return new ConditionNode(c,t);case"SHOW":return new ShowNode(c,t);case"HIDE":return new HideNode(c,t);case"CLIP_ANIMATION":return new ClipAnimationNode(c,t);case"UN_CLIP_ANIMATION":return new UnClipAnimationNode(c,t);case"TWEEN_ANIMATION":return new TweenAnimationNode(c,t);case"UN_TWEEN_ANIMATION":return new UnTweenAnimationNode(c,t);case"COMPONENT_TWEEN_ANIMATION":return new ComponentTweenAnimationNode(c,t);case"UN_COMPONENT_TWEEN_ANIMATION":return new UnComponentTweenAnimationNode(c,t);case"TRANSLATE":return new TranslateNode(c,t);case"ROTATE":return new RotateNode(c,t);case"SCALE":return new ScaleNode(c,t);case"FLY_TO":return new FlyToNode(c,t);case"DATA_EXTRACTION":return new DataExtractionNode(c,t);case"DATA_FILTER":return new DataFilterNode(c,t);case"USER_DATA_NODE":return new UserDataNode(c,t);default:return new Node(c,t)}}function parseValue(c){return JSON.parse(c)}async function waitFor(c,t){t?await c():c()}function getObjectByIds(c,t){return t.map(u=>c.objectManager.getById(u)).filter(Boolean)}function getObjectById(c,t,u){const o=c.objectManager.getById(t);if(o)return o;{const d=c.scene;return getMeshByUserDataUuid(u??d,t)}}function getMeshByUserDataUuid(c,t){if(c.userData.key===t||c.uuid===t)return c;for(let u=0,o=c.children.length;u<o;u++){const d=c.children[u],r=getMeshByUserDataUuid(d,t);if(r!==null)return r}return null}let count=0;const preloadNodes=["MESH","MESHES","MODEL","MODELS","POI","POIS","SPACE","SPACES","PATH","PATHS","COLOR","NUMBER","DATA_EXTRACTION","DATA_FILTER","USER_DATA_NODE","CONDITION_NODE","START"];class Node{parser;viewer;id;type;props;prevNodes=[];postNodes=[];execOrder=0;ctx;promise;resolve;reject;cleanSets=new Set;onBefore=null;onAfter=null;rejected;constructor(t,u){this.parser=t,this.viewer=t.viewer,this.id=u.id,this.type=u.type,this.props=u.props,this.rejected=!1,this.init()}init(){this.ctx={},this.promise=new Promise((t,u)=>{this.resolve=t,this.reject=o=>{this.rejected=!0,u(o)}})}readContext(t){return this.ctx[t]}writeContext(t,u){this.ctx[t]=u}findProp(t,u){if(u instanceof Array)for(const o of u){const d=this.findProp(t,o);if(d)return d}else return this.props.find(o=>o.name===t&&o.type===u)}async waitForPrevNodes(){return await Promise.all(this.prevNodes.map(t=>t.promise))}mergeContext(){this.prevNodes.forEach(t=>{Object.assign(this.ctx,t.ctx)}),this._mergeUserDataMap()}async exec(t){}async run(t,u={preload:!1}){const{preload:o}=u;try{if(await this.waitForPrevNodes(),this.rejected)throw new Error;this.mergeContext(),await(this.onBefore??this.parser.onNodeBefore)?.(this);try{(!o||preloadNodes.includes(this.type))&&(this.execOrder=++count,await this.exec(t))}catch(d){throw this.reject(d),d}await(this.onAfter??this.parser.onNodeAfter)?.(this),this.resolve()}catch(d){this.reject(d)}}cleanup(){this.cleanSets.forEach(t=>t()),this.cleanSets.clear()}getValue(t,u){if(t.type==="READ_CTX")return this.readContext(parseValue(t.value));if(t.type==="LOCAL"){const{scene:o}=this.viewer;return t.name==="objects"||t.name==="models"||t.name==="meshs"?parseValue(t.value).map(d=>getObjectById(this.viewer,d,u??o)):t.name==="object"||t.name==="model"||t.name==="mesh"?getObjectById(this.viewer,parseValue(t.value),u??o):parseValue(t.value)}}_mergeUserDataMap(){if(this.prevNodes.some(t=>t.ctx._userDataMap))this.ctx._userDataMap=new Map;else return;this.prevNodes.forEach(t=>{t.ctx._userDataMap&&t.ctx._userDataMap.forEach((u,o)=>{this.ctx._userDataMap.set(o,Object.assign({},u))})})}}class StartNode extends Node{constructor(t,u){super(t,u)}}class ColorNode extends Node{constructor(t,u){super(t,u)}async exec(){const t=this.findProp("color","LOCAL"),u=this.findProp("out","WRITE_CTX");t&&u&&this.writeContext(parseValue(u.value),parseValue(t.value))}}class NumberNode extends Node{constructor(t,u){super(t,u)}async exec(){const t=this.findProp("number","LOCAL"),u=this.findProp("out","WRITE_CTX");t&&u&&this.writeContext(parseValue(u.value),parseValue(t.value))}}class HighlightNode extends Node{constructor(t,u){super(t,u)}async exec(t){const u=this.findProp("objects",["READ_CTX","LOCAL"]),o=this.findProp("color",["READ_CTX","LOCAL"]),d=this.findProp("opacity",["READ_CTX","LOCAL"]),r=await t.getTarget?.(this);if(u&&o&&d){const h=this.getValue(u,r),f=this.getValue(o),a=this.getValue(d);h&&(index.MaterialEffects.highlightColor(h,{color:f,opacity:a}),this.cleanSets.add(()=>{index.MaterialEffects.removeHighlightColor(h)}))}}}class UnHighlightNode extends Node{constructor(t,u){super(t,u)}filterUnHighlightObject(t){const u=[];return objectHandle(t,o=>{u.push(o)}),u}async exec(t){const u=this.findProp("objects",["READ_CTX","LOCAL"]),o=await t.getTarget?.(this);if(u){const d=this.getValue(u,o);d&&uSpace.MaterialEffects.removeHighlightColor(d)}}}class OpacityNode extends Node{constructor(t,u){super(t,u)}async exec(t){const u=this.findProp("objects",["READ_CTX","LOCAL"]),o=this.findProp("color",["READ_CTX","LOCAL"]),d=this.findProp("opacity",["READ_CTX","LOCAL"]),r=await t.getTarget?.(this);if(u&&o&&d){const h=this.getValue(u,r),f=this.getValue(o),a=this.getValue(d);if(h){const n=objectHandle(h,e=>e);index.MaterialEffects.highlightColor(n,{color:f,opacity:a,overwrite:!0}),this.cleanSets.add(()=>{index.MaterialEffects.removeHighlightColor(n)})}}}}class UnOpacityNode extends Node{constructor(t,u){super(t,u)}async exec(t){const u=this.findProp("objects",["READ_CTX","LOCAL"]),o=await t.getTarget?.(this);if(u){const d=this.getValue(u,o);d&&uSpace.MaterialEffects.removeHighlightColor(d)}}}class EmissiveNode extends Node{constructor(t,u){super(t,u)}async exec(t){const u=this.findProp("objects",["READ_CTX","LOCAL"]),o=this.findProp("color",["READ_CTX","LOCAL"]),d=this.findProp("baseColor",["READ_CTX","LOCAL"]),r=this.findProp("minOpacity",["READ_CTX","LOCAL"]),h=this.findProp("maxOpacity",["READ_CTX","LOCAL"]),f=this.findProp("duration",["READ_CTX","LOCAL"]),a=await t.getTarget?.(this);if(u&&o&&d&&r&&h&&f){const n=this.getValue(u,a),e=this.getValue(o),s=this.getValue(h);n&&(uSpace.MaterialEffects.breatheColor(n,{color:e,intensity:s}),this.cleanSets.add(()=>{uSpace.MaterialEffects.removeBreatheColor(n)}))}}}class UnEmissiveNode extends Node{constructor(t,u){super(t,u)}filterUnEmissiveObject(t){const u=[];return objectHandle(t,o=>{u.push(o)}),u}async exec(t){const u=this.findProp("objects",["READ_CTX","LOCAL"]),o=await t.getTarget?.(this);u&&this.getValue(u,o)}}const meshCacheSymbol=Symbol("meshCache");class MeshNode extends Node{constructor(t,u){super(t,u)}async exec(t){const{scene:u}=this.viewer,o=await t.getTarget?.(this)||u;t[meshCacheSymbol]||(t[meshCacheSymbol]={});const d=this.findProp("mesh","LOCAL"),r=this.findProp("out","WRITE_CTX");if(d&&r){let h=null;const f=parseValue(d.value),a=parseValue(r.value),n=t[meshCacheSymbol][f];if(n){h=n;return}const e=getMeshByUserDataUuid(o,f);e&&(h=e,t[meshCacheSymbol][f]=e),this.writeContext(a,h)}}}const meshesCacheSymbol=Symbol("meshesCache");class MeshesNode extends Node{constructor(t,u){super(t,u)}async exec(t){const{scene:u}=this.viewer,o=await t.getTarget?.(this)||u;t[meshesCacheSymbol]||(t[meshesCacheSymbol]={});const d=this.findProp("meshes","LOCAL"),r=this.findProp("out","WRITE_CTX");if(d&&r){const h=[],f=parseValue(d.value),a=parseValue(r.value);f.forEach(n=>{const e=t[meshesCacheSymbol][n];if(e){h.push(e);return}const s=getMeshByUserDataUuid(o,n);s&&(h.push(s),t[meshesCacheSymbol][n]=s)}),this.writeContext(a,h)}}}class ModelNode extends Node{constructor(t,u){super(t,u)}async exec(){const t=this.findProp("model","LOCAL"),u=this.findProp("out","WRITE_CTX");if(t&&u){const o=parseValue(t.value),d=parseValue(u.value);this.writeContext(d,getObjectById(this.viewer,o))}}}class ModelsNode extends Node{constructor(t,u){super(t,u)}async exec(){const t=this.findProp("models","LOCAL"),u=this.findProp("out","WRITE_CTX");if(t&&u){const o=parseValue(t.value),d=parseValue(u.value);this.writeContext(d,getObjectByIds(this.viewer,o))}}}class DelayNode extends Node{constructor(t,u){super(t,u)}async exec(){const t=this.findProp("delay","LOCAL");if(t){const u=parseValue(t.value);await sleep(u)}}}class ConditionNode extends Node{constructor(t,u){super(t,u)}execFn(t){return new Function("sourceData",t)(this.ctx)}async exec(){const t=this.findProp("conditaion_node","LOCAL");if(t){const u=parseValue(t.value),o=this.parser.edges.filter(d=>d.source===this.id);u.forEach(d=>{try{if(this.execFn(d.value)!==!0)throw new Error}catch{const h=o.find(a=>a.sourceHandle==String(d.id));if(!h)return;this.postNodes.find(a=>a.id===h.target)?.reject()}})}}}class ShowNode extends Node{constructor(t,u){super(t,u)}filterShowObject(t){const u=[];return objectHandle(t,o=>{o.visible===!1&&u.push(o)}),u}async exec(t){const u=this.findProp("objects",["READ_CTX","LOCAL"]),o=await t.getTarget?.(this);if(u){const d=this.getValue(u,o);if(d){const r=this.filterShowObject(d),h=f=>{objectHandle(r,a=>{a.visible=f}),this.viewer.render()};h(!0),this.cleanSets.add(()=>h(!1))}}}}class HideNode extends Node{constructor(t,u){super(t,u)}filterHideObject(t){const u=[];return objectHandle(t,o=>{o.visible===!0&&u.push(o)}),u}async exec(t){const u=this.findProp("objects",["READ_CTX","LOCAL"]),o=await t.getTarget?.(this);if(u){const d=this.getValue(u,o);if(d){const r=this.filterHideObject(d),h=f=>{objectHandle(r,a=>{a.visible=f}),this.viewer.render()};h(!1),this.cleanSets.add(()=>h(!0))}}}}class TranslateNode extends Node{constructor(t,u){super(t,u)}async exec(t){const u=this.findProp("objects",["READ_CTX","LOCAL"]),o=this.findProp("axis",["READ_CTX","LOCAL"]),d=this.findProp("translate",["READ_CTX","LOCAL"]),r=await t.getTarget?.(this);if(u&&o&&d){const h=this.getValue(u,r),f=this.getValue(o),a=this.getValue(d);if(h){const n=[];objectHandle(h,v=>{n.push(v.position.clone())});const s=(v,b)=>{switch(f){case"x":v.setX(b.x);break;case"y":v.setY(b.y);break;case"z":v.setZ(b.z);break}};await(async()=>{const v=objectHandle(h,async b=>{const m=b.position.clone();switch(f){case"x":await uSpace.tweenAnimation(this.viewer,m,new webgpu.Vector3().set(m.x+a,m.y,m.z),{duration:800},q=>s(b.position,q));break;case"y":await uSpace.tweenAnimation(this.viewer,m,new webgpu.Vector3().set(m.x,m.y+a,m.z),{duration:800},q=>s(b.position,q));break;case"z":await uSpace.tweenAnimation(this.viewer,m,new webgpu.Vector3().set(m.x,m.y,m.z+a),{duration:800},q=>s(b.position,q));break}});v instanceof Array?await Promise.all(v):await v,this.viewer.render()})(),this.cleanSets.add(()=>{let v=0;objectHandle(h,b=>{b.position.copy(n[v++])})})}}}}class ScaleNode extends Node{constructor(t,u){super(t,u)}async exec(t){const u=this.findProp("objects",["READ_CTX","LOCAL"]),o=this.findProp("axis",["READ_CTX","LOCAL"]),d=this.findProp("scale",["READ_CTX","LOCAL"]),r=await t.getTarget?.(this);if(u&&o&&d){const h=this.getValue(u,r),f=this.getValue(o),a=this.getValue(d);if(h){const n=[];objectHandle(h,v=>{n.push(v.scale.clone())});const s=(v,b)=>{switch(f){case"x":v.setX(b.x);break;case"y":v.setY(b.y);break;case"z":v.setZ(b.z);break}};await(async()=>{const v=objectHandle(h,async b=>{const m=b.scale.clone();switch(f){case"x":await uSpace.tweenAnimation(this.viewer,m,new webgpu.Vector3().set(m.x*a,m.y,m.z),{duration:800},q=>s(b.scale,q));break;case"y":await uSpace.tweenAnimation(this.viewer,m,new webgpu.Vector3().set(m.x,m.y*a,m.z),{duration:800},q=>s(b.scale,q));break;case"z":await uSpace.tweenAnimation(this.viewer,m,new webgpu.Vector3().set(m.x,m.y,m.z*a),{duration:800},q=>s(b.scale,q));break}});v instanceof Array?await Promise.all(v):await v,this.viewer.render()})(),this.cleanSets.add(()=>{let v=0;objectHandle(h,b=>{b.scale.copy(n[v++])})})}}}}class RotateNode extends Node{constructor(t,u){super(t,u)}async exec(t){const u=this.findProp("objects",["READ_CTX","LOCAL"]),o=this.findProp("axis",["READ_CTX","LOCAL"]),d=this.findProp("rotation",["READ_CTX","LOCAL"]),r=await t.getTarget?.(this);if(u&&o&&d){const h=this.getValue(u,r),f=this.getValue(o),a=this.getValue(d);if(h){const n=[];objectHandle(h,v=>{n.push(v.rotation.clone())});const s=(v,b)=>{switch(f){case"x":v.x=b.x;break;case"y":v.y=b.y;break;case"z":v.z=b.z;break}};await(async()=>{const v=a/180*Math.PI,b=objectHandle(h,async m=>{const q=m.rotation.clone();switch(f){case"x":await uSpace.tweenAnimation(this.viewer,q,new webgpu.Euler().set(q.x+v,q.y,q.z),{duration:800},E=>s(m.rotation,E));break;case"y":await uSpace.tweenAnimation(this.viewer,q,new webgpu.Euler().set(q.x,q.y+v,q.z),{duration:800},E=>s(m.rotation,E));break;case"z":await uSpace.tweenAnimation(this.viewer,q,new webgpu.Euler().set(q.x,q.y,q.z+v),{duration:800},E=>s(m.rotation,E));break}});b instanceof Array?await Promise.all(b):await b,this.viewer.render()})(),this.cleanSets.add(()=>{let v=0;objectHandle(h,b=>{b.rotation.copy(n[v++])})})}}}}class FlyToNode extends Node{constructor(t,u){super(t,u)}async exec(){const t=this.findProp("viewpoint",["READ_CTX","LOCAL"]);if(t){const u=parseValue(this.getValue(t));u&&this.viewer.controls.setCameraViewpoint(u,!0)}}}class SpaceNode extends Node{constructor(t,u){super(t,u)}async exec(){const t=this.findProp("space","LOCAL"),u=this.findProp("out","WRITE_CTX");if(t&&u){const o=parseValue(t.value),d=parseValue(u.value);this.writeContext(d,getObjectById(this.viewer,o))}}}class SpacesNode extends Node{constructor(t,u){super(t,u)}async exec(){const t=this.findProp("spaces","LOCAL"),u=this.findProp("out","WRITE_CTX");if(t&&u){const o=parseValue(t.value),d=parseValue(u.value),r=o.map(h=>getObjectById(this.viewer,h));this.writeContext(d,r)}}}class POINode extends Node{constructor(t,u){super(t,u)}async exec(t){const u=this.findProp("poi","LOCAL"),o=this.findProp("out","WRITE_CTX");if(u&&o){const d=parseValue(u.value),r=parseValue(o.value);this.writeContext(r,getObjectById(this.viewer,d))}}}class POIsNode extends Node{constructor(t,u){super(t,u)}async exec(t){const u=this.findProp("pois","LOCAL"),o=this.findProp("out","WRITE_CTX");if(u&&o){const d=parseValue(u.value),r=parseValue(o.value),h=d.map(f=>getObjectById(this.viewer,f));this.writeContext(r,h)}}}class DataExtractionNode extends Node{constructor(t,u){super(t,u)}async exec(){const t=this.findProp("value","LOCAL"),u=this.findProp("object","LOCAL"),o=this.findProp("out","WRITE_CTX"),d=this.findProp("extraction","LOCAL");if(t&&o&&d&&u){const r=parseValue(d.value),h=parseValue(o.value),f=parseValue(u.value),a=this.getValue(u);let n=parseValue(t.value);if(this.ctx._userDataMap){const e=this.ctx._userDataMap.get(f);e&&(n=e[r])}else if(a&&a.userData.properties){const e=a.userData.properties.find(s=>s.key===r);e&&e.value!==void 0&&(n=e.value)}this.writeContext(h,n)}}}class DataFilterNode extends Node{constructor(t,u){super(t,u)}async exec(){const t=this.findProp("model","LOCAL");if(t){const u=parseValue(t.value),o=new Function("sourceData",u);for(const d in this.ctx){const r=o(this.ctx[d]);(r==null||r===!1)&&delete this.ctx[d]}}}}class PathNode extends Node{constructor(t,u){super(t,u)}async exec(){const t=this.findProp("path","LOCAL"),u=this.findProp("out","WRITE_CTX");if(t&&u){const o=parseValue(t.value),d=parseValue(u.value);this.writeContext(d,getObjectById(this.viewer,o))}}}class PathsNode extends Node{constructor(t,u){super(t,u)}async exec(){const t=this.findProp("paths","LOCAL"),u=this.findProp("out","WRITE_CTX");if(t&&u){const o=parseValue(t.value),d=parseValue(u.value),r=o.map(h=>getObjectById(this.viewer,h));this.writeContext(d,r)}}}class UserDataNode extends Node{constructor(t,u){super(t,u)}async exec(){const t=this.findProp("object",["READ_CTX","LOCAL"]),u=this.findProp("data","LOCAL"),o=this.findProp("source","WRITE_CTX");if(t&&u&&o){let d=parseValue(t.value);const r=parseValue(u.value),h=parseValue(o.value);if(h&&(d=h),d&&r){this.ctx._userDataMap||(this.ctx._userDataMap=new Map);const f=this.ctx._userDataMap.get(d);f?Object.assign(f,r):this.ctx._userDataMap.set(d,r)}}}}class ClipAnimationNode extends Node{constructor(t,u){super(t,u)}async exec(t){let u=await t.getTarget?.(this);if(!u){const d=this.findProp("model",["READ_CTX","LOCAL"]);d&&(u=this.getValue(d))}const o=this.findProp("animation",["READ_CTX","LOCAL"]);if(u&&o){let d;if(o.type==="READ_CTX"){const h=this.parser.getVariableNameById(parseValue(o.value));d=this.readContext(h)}else d=parseValue(o.value);u.playAnimation(d);const r=({delta:h})=>{u.updateAnimation(h)};this.viewer.addEventListener("beforeRender",r),this.cleanSets.add(()=>{u.stopAnimation(d),this.viewer.removeEventListener("beforeRender",r)})}}}class UnClipAnimationNode extends Node{constructor(t,u){super(t,u)}async exec(t){let u=await t.getTarget?.(this);if(!u){const d=this.findProp("model",["READ_CTX","LOCAL"]);d&&(u=this.getValue(d))}const o=this.findProp("animation",["READ_CTX","LOCAL"]);if(u&&o){let d;if(o.type==="READ_CTX"){const r=this.parser.getVariableNameById(parseValue(o.value));d=this.readContext(r)}else d=parseValue(o.value);u.stopAnimation(d)}}}const tweenCache$1=new Map;async function playTweenAnimation(c,t,u){const{id:o,keyframes:d}=u,r=new AnimationsParser(c,t);tweenCache$1.has(o)||tweenCache$1.set(o,new Set),tweenCache$1.get(o)?.add(r),await r.play(d)}function stopTweenAnimation(c){tweenCache$1.get(c)?.forEach(t=>t.stop()),tweenCache$1.get(c)?.clear()}class TweenAnimationNode extends Node{constructor(t,u){super(t,u)}async exec(t){const u=this.findProp("model",["READ_CTX","LOCAL"]),o=this.findProp("animation","LOCAL"),d=this.findProp("wait","LOCAL");if(u&&o&&d){const r=this.getValue(u),h=parseValue(o.value),f=parseValue(d.value);if(r){const a=await t.getAnimations?.(this,r,h);if(a){const n=a.find(e=>e.id===h);n&&await waitFor(async()=>{const e=r.matrix.clone();await playTweenAnimation(this.viewer,r,n),this.cleanSets.add(()=>{stopTweenAnimation(n.id),r&&e.decompose(r.position,r.quaternion,r.scale)})},f)}}}}}class UnTweenAnimationNode extends Node{constructor(t,u){super(t,u)}async exec(){const t=this.findProp("animation","LOCAL");if(t){const u=parseValue(t.value);stopTweenAnimation(u)}}}const tweenCache=new Map;async function playComponentTweenAnimation(c,t,u){const{id:o,keyframes:d}=u,r=new AnimationsParser(c,t);tweenCache.has(o)||tweenCache.set(o,new Set),tweenCache.get(o)?.add(r),await r.play(d)}function stopComponentTweenAnimation(c){tweenCache.get(c)?.forEach(t=>t.stop()),tweenCache.get(c)?.clear()}class ComponentTweenAnimationNode extends Node{constructor(t,u){super(t,u)}async exec(t){const u=this.findProp("mesh",["READ_CTX","LOCAL"]),o=this.findProp("animation","LOCAL"),d=this.findProp("wait","LOCAL");if(u&&o&&d){const r=this.getValue(u),h=parseValue(o.value),f=parseValue(d.value);if(r){const a=await t.getComponentAnimations?.(this,r,h);if(a){const n=a.find(e=>e.id===h);if(n){let e=null;u.valueType==="Mesh"?e=r:u.valueType==="Model"&&(e=getMeshByUserDataUuid(r,n.refId)),e&&await waitFor(async()=>{if(e){const s=e.matrix.clone();await playComponentTweenAnimation(this.viewer,e,n),this.cleanSets.add(()=>{stopComponentTweenAnimation(n.id),e&&s.decompose(e.position,e.quaternion,e.scale)})}},f)}}}}}}class UnComponentTweenAnimationNode extends Node{constructor(t,u){super(t,u)}async exec(){const t=this.findProp("animation","LOCAL");if(t){const u=parseValue(t.value);stopComponentTweenAnimation(u)}}}class FlowParser extends webgpu.EventDispatcher{viewer;flow;nodes;nodesMap;edges;edgesMap;onNodeBefore=null;onNodeAfter=null;constructor(t,u){super(),this.viewer=t,this.flow=u,this.nodes=[],this.nodesMap=new Map,this.edges=[],this.edgesMap=new Map}addNode(t){this.nodes.push(t),this.nodesMap.set(t.id,t)}addEdge(t){this.edges.push(t),this.edgesMap.set(t.id,t)}getNodeById(t){return this.nodesMap.get(t)}getEdgeById(t){return this.edgesMap.get(t)}clear(){this.nodes.length=0,this.nodesMap.clear(),this.edges.length=0,this.edgesMap.clear()}parse(){this.clear();const{nodes:t,edges:u}=this.flow;t.forEach(o=>{const d=parseNodeByType(this,o);this.addNode(d)}),u.forEach(o=>{const d=new Edge(o);this.addEdge(d);const r=this.getNodeById(o.source),h=this.getNodeById(o.target);r&&h&&(r.postNodes.push(h),h.prevNodes.push(r))})}async run(t={},u={preload:!1}){const{preload:o}=u,r=this.nodes.filter(h=>h.prevNodes.length||h.postNodes.length).map(h=>h.run(t,{preload:o}));await Promise.allSettled(r)}async debug(t={},u=1500){const o=this.onNodeAfter;this.onNodeAfter=async d=>{await sleep(u),o?.(d)},await this.run(t)}stop(){this.nodes.forEach(t=>t.reject(new Error("Flow stopped")))}cleanup(){this.nodes.sort((t,u)=>u.execOrder-t.execOrder).forEach(t=>t.cleanup())}getVariableNameById(t){const u=this.nodes.find(o=>o.id===t);if(u){const o=u.props.find(d=>d.name==="out");return o?parseValue(o.value):null}return null}dispose(){this.stop(),this.cleanup()}}class ComponentFlowParser extends FlowParser{flow;constructor(t,u){super(t,u),this.flow=u}}exports.AnimationsLoader=AnimationsLoader;exports.AnimationsParser=AnimationsParser;exports.BuildingGroup=BuildingGroup;exports.ComponentFlowParser=ComponentFlowParser;exports.FloorMesh=FloorMesh;exports.FlowParser=FlowParser;exports.Node=Node;exports.PropertiesLoader=PropertiesLoader;exports.SceneLoader=SceneLoader;exports.SemanticLoader=SemanticLoader;exports.SemanticParser=SemanticParser;exports.TopologiesLoader=TopologiesLoader;exports.TopologyParser=TopologyParser;exports.VisionsLoader=VisionsLoader;exports.VisionsParser=VisionsParser;
86
+ `},publicImport:function(a,n,e){e=e||{};var s;if(e.type!=="der")if(Buffer.isBuffer(n)&&(n=n.toString("utf8")),t.isString(n)){if(n.substring(0,8)!=="ssh-rsa ")throw Error("Unsupported key format");let q=n.indexOf(" ",8);q===-1?q=n.length:a.sshcomment=n.substring(q+1).replace(/\s+|\n\r|\n|\r$/gm,"");const E=n.substring(8,q).replace(/\s+|\n\r|\n|\r$/gm,"");s=Buffer.from(E,"base64")}else throw Error("Unsupported key format");else if(Buffer.isBuffer(n))s=n;else throw Error("Unsupported key format");const l={buf:s,off:0},v=h(l).toString("ascii");if(v!=="ssh-rsa")throw Error("Invalid key type: "+v);const b=h(l),m=h(l);a.setPublic(m,b)},autoImport:function(a,n){return/^[\S\s]*-----BEGIN OPENSSH PRIVATE KEY-----\s*(?=(([A-Za-z0-9+/=]+\s*)+))\1-----END OPENSSH PRIVATE KEY-----[\S\s]*$/g.test(n)?(c.exports.privateImport(a,n),!0):/^[\S\s]*ssh-rsa \s*(?=(([A-Za-z0-9+/=]+\s*)+))\1[\S\s]*$/g.test(n)?(c.exports.publicImport(a,n),!0):!1}};function h(a){const n=a.buf.readInt32BE(a.off);a.off+=4;const e=a.buf.slice(a.off,a.off+n);return a.off+=n,e}function f(a,n){a.buf.writeInt32BE(n.byteLength,a.off),a.off+=4,a.off+=n.copy(a.buf,a.off)}})(openssh)),openssh.exports}var hasRequiredFormats;function requireFormats(){return hasRequiredFormats||(hasRequiredFormats=1,(function(c){requireUtils()._;function t(u){u=u.split("-");for(var o="private",d={type:"default"},r=1;r<u.length;r++)if(u[r])switch(u[r]){case"public":o=u[r];break;case"private":o=u[r];break;case"pem":d.type=u[r];break;case"der":d.type=u[r];break}return{scheme:u[0],keyType:o,keyOpt:d}}c.exports={pkcs1:requirePkcs1(),pkcs8:requirePkcs8(),components:requireComponents(),openssh:requireOpenssh(),isPrivateExport:function(u){return c.exports[u]&&typeof c.exports[u].privateExport=="function"},isPrivateImport:function(u){return c.exports[u]&&typeof c.exports[u].privateImport=="function"},isPublicExport:function(u){return c.exports[u]&&typeof c.exports[u].publicExport=="function"},isPublicImport:function(u){return c.exports[u]&&typeof c.exports[u].publicImport=="function"},detectAndImport:function(u,o,d){if(d===void 0){for(var r in c.exports)if(typeof c.exports[r].autoImport=="function"&&c.exports[r].autoImport(u,o))return!0}else if(d){var h=t(d);if(c.exports[h.scheme])h.keyType==="private"?c.exports[h.scheme].privateImport(u,o,h.keyOpt):c.exports[h.scheme].publicImport(u,o,h.keyOpt);else throw Error("Unsupported key format")}return!1},detectAndExport:function(u,o){if(o){var d=t(o);if(c.exports[d.scheme])if(d.keyType==="private"){if(!u.isPrivate())throw Error("This is not private key");return c.exports[d.scheme].privateExport(u,d.keyOpt)}else{if(!u.isPublic())throw Error("This is not public key");return c.exports[d.scheme].publicExport(u,d.keyOpt)}else throw Error("Unsupported key format")}}}})(formats)),formats.exports}var NodeRSA$1,hasRequiredNodeRSA;function requireNodeRSA(){if(hasRequiredNodeRSA)return NodeRSA$1;hasRequiredNodeRSA=1;var c=requireRsa();requireCryptoBrowserify(),requireLib().Ber;var t=requireUtils()._,u=requireUtils(),o=requireSchemes(),d=requireFormats();return NodeRSA$1=(function(){var r={node10:["md4","md5","ripemd160","sha1","sha224","sha256","sha384","sha512"],node:["md4","md5","ripemd160","sha1","sha224","sha256","sha384","sha512"],iojs:["md4","md5","ripemd160","sha1","sha224","sha256","sha384","sha512"],browser:["md5","ripemd160","sha1","sha256","sha512"]},h="pkcs1_oaep",f="pkcs1",a="private",n={private:"pkcs1-private-pem","private-der":"pkcs1-private-der",public:"pkcs8-public-pem","public-der":"pkcs8-public-der"};function e(s,l,v){if(!(this instanceof e))return new e(s,l,v);t.isObject(l)&&(v=l,l=void 0),this.$options={signingScheme:f,signingSchemeOptions:{hash:"sha256",saltLength:null},encryptionScheme:h,encryptionSchemeOptions:{hash:"sha1",label:null},environment:u.detectEnvironment(),rsaUtils:this},this.keyPair=new c.Key,this.$cache={},Buffer.isBuffer(s)||t.isString(s)?this.importKey(s,l):t.isObject(s)&&this.generateKeyPair(s.b,s.e),this.setOptions(v)}return e.prototype.setOptions=function(s){if(s=s||{},s.environment&&(this.$options.environment=s.environment),s.signingScheme){if(t.isString(s.signingScheme)){var l=s.signingScheme.toLowerCase().split("-");l.length==1?r.node.indexOf(l[0])>-1?(this.$options.signingSchemeOptions={hash:l[0]},this.$options.signingScheme=f):(this.$options.signingScheme=l[0],this.$options.signingSchemeOptions={hash:null}):(this.$options.signingSchemeOptions={hash:l[1]},this.$options.signingScheme=l[0])}else t.isObject(s.signingScheme)&&(this.$options.signingScheme=s.signingScheme.scheme||f,this.$options.signingSchemeOptions=t.omit(s.signingScheme,"scheme"));if(!o.isSignature(this.$options.signingScheme))throw Error("Unsupported signing scheme");if(this.$options.signingSchemeOptions.hash&&r[this.$options.environment].indexOf(this.$options.signingSchemeOptions.hash)===-1)throw Error("Unsupported hashing algorithm for "+this.$options.environment+" environment")}if(s.encryptionScheme){if(t.isString(s.encryptionScheme)?(this.$options.encryptionScheme=s.encryptionScheme.toLowerCase(),this.$options.encryptionSchemeOptions={}):t.isObject(s.encryptionScheme)&&(this.$options.encryptionScheme=s.encryptionScheme.scheme||h,this.$options.encryptionSchemeOptions=t.omit(s.encryptionScheme,"scheme")),!o.isEncryption(this.$options.encryptionScheme))throw Error("Unsupported encryption scheme");if(this.$options.encryptionSchemeOptions.hash&&r[this.$options.environment].indexOf(this.$options.encryptionSchemeOptions.hash)===-1)throw Error("Unsupported hashing algorithm for "+this.$options.environment+" environment")}this.keyPair.setOptions(this.$options)},e.prototype.generateKeyPair=function(s,l){if(s=s||2048,l=l||65537,s%8!==0)throw Error("Key size must be a multiple of 8.");return this.keyPair.generate(s,l.toString(16)),this.$cache={},this},e.prototype.importKey=function(s,l){if(!s)throw Error("Empty key given");if(l&&(l=n[l]||l),!d.detectAndImport(this.keyPair,s,l)&&l===void 0)throw Error("Key format must be specified");return this.$cache={},this},e.prototype.exportKey=function(s){return s=s||a,s=n[s]||s,this.$cache[s]||(this.$cache[s]=d.detectAndExport(this.keyPair,s)),this.$cache[s]},e.prototype.isPrivate=function(){return this.keyPair.isPrivate()},e.prototype.isPublic=function(s){return this.keyPair.isPublic(s)},e.prototype.isEmpty=function(s){return!(this.keyPair.n||this.keyPair.e||this.keyPair.d)},e.prototype.encrypt=function(s,l,v){return this.$$encryptKey(!1,s,l,v)},e.prototype.decrypt=function(s,l){return this.$$decryptKey(!1,s,l)},e.prototype.encryptPrivate=function(s,l,v){return this.$$encryptKey(!0,s,l,v)},e.prototype.decryptPublic=function(s,l){return this.$$decryptKey(!0,s,l)},e.prototype.$$encryptKey=function(s,l,v,b){try{var m=this.keyPair.encrypt(this.$getDataForEncrypt(l,b),s);return v=="buffer"||!v?m:m.toString(v)}catch(q){throw Error("Error during encryption. Original error: "+q)}},e.prototype.$$decryptKey=function(s,l,v){try{l=t.isString(l)?Buffer.from(l,"base64"):l;var b=this.keyPair.decrypt(l,s);if(b===null)throw Error("Key decrypt method returns null.");return this.$getDecryptedData(b,v)}catch(m){throw Error("Error during decryption (probably incorrect key). Original error: "+m)}},e.prototype.sign=function(s,l,v){if(!this.isPrivate())throw Error("This is not private key");var b=this.keyPair.sign(this.$getDataForEncrypt(s,v));return l&&l!="buffer"&&(b=b.toString(l)),b},e.prototype.verify=function(s,l,v,b){if(!this.isPublic())throw Error("This is not public key");return b=!b||b=="buffer"?null:b,this.keyPair.verify(this.$getDataForEncrypt(s,v),l,b)},e.prototype.getKeySize=function(){return this.keyPair.keySize},e.prototype.getMaxMessageSize=function(){return this.keyPair.maxMessageLength},e.prototype.$getDataForEncrypt=function(s,l){if(t.isString(s)||t.isNumber(s))return Buffer.from(""+s,l||"utf8");if(Buffer.isBuffer(s))return s;if(t.isObject(s))return Buffer.from(JSON.stringify(s));throw Error("Unexpected data type")},e.prototype.$getDecryptedData=function(s,l){return l=l||"buffer",l=="buffer"?s:l=="json"?JSON.parse(s.toString()):s.toString(l)},e})(),NodeRSA$1}var NodeRSAExports=requireNodeRSA();const NodeRSA=getDefaultExportFromCjs$1(NodeRSAExports),debugKey="NJHgNB1HDTrHTJc4ERFCBRVBB5HOBEDCjRLChRDIdn8K7EUJD,Vm4C6vC8BpZ6n6G,hxOjYZ{,wYhnJize2rlm9m,6bUcRVbP6sjNbKU8juOWUpukkcV6Cw,Bk2io7{YWJcPnG{1o3GUTpnO:z{kCYHL14HjO8noH1sp[J78k3Y3IcbOSSk97evccx0MdW2uR0f5qhZFQV8e2JCRxxJEBRBC";function decryptWithDebugKey(c){return decryptWithKey(c,decodeString(debugKey))}function decryptWithKey(c,t){const{content:u,sign:o}=c,d=new NodeRSA(t,"pkcs8-public",{environment:"browser",signingScheme:"pkcs1-md5",encryptionScheme:"pkcs1"});if(!d.verify(u,o,"utf8","base64"))throw new Error("u-space: license verify failed");const h=decryptInternal(u,d);return JSON.parse(h)}function decryptInternal(c,t){const u=c.charCodeAt(0),o=c.substring(1,u),d=c.substring(u),r=parseHeader(o);let h="";for(const f of r){const a=d.substring(f.start,f.end);let n;f.encrypt?n=t.decryptPublic(a,"utf8"):n=decodeString(a),h+=n}return h}function parseHeader(c){const t=decodeToBytes(c),o=new DataView(t.buffer).getInt16(0);if(o===1)return parseHeaderV1(t.buffer);throw new Error(`u-space: content version error, version=${o}`)}function parseHeaderV1(c){const t=new DataView(c);let u=2;const o=t.getInt16(u);u+=2;const d=[];for(let r=0;r<o;r++){const h=t.getInt16(u);u+=2;const f=t.getInt16(u);u+=2;const a=t.getInt32(u);u+=4;const n=t.getInt32(u);u+=4;const e={index:h,encrypt:f>0,start:a,end:n};d.push(e)}return d.sort((r,h)=>r.index<=h.index?-1:1),d}const _base64KeyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function decodeToBytes(c){const t=[];let u,o,d,r,h,f,a,n=0;for(c=c.replace(/[^A-Za-z0-9+/=]/g,"");n<c.length;)r=_base64KeyStr.indexOf(c.charAt(n++)),h=_base64KeyStr.indexOf(c.charAt(n++)),f=_base64KeyStr.indexOf(c.charAt(n++)),a=_base64KeyStr.indexOf(c.charAt(n++)),u=r<<2|h>>4,o=(h&15)<<4|f>>2,d=(f&3)<<6|a,t.push(u),f!==64&&t.push(o),a!==64&&t.push(d);return new Int8Array(t)}function decodeString(c){let t="";for(let u=0;u<c.length;u++){const d=c.charCodeAt(u)-1;t+=String.fromCharCode(d)}return t}const logo="data:image/webp;base64,UklGRswmAABXRUJQVlA4TMAmAAAvAIVnEA+imJEkqF4DtQTrz3QpKGjbhjHsQhiui4tMGGI1fJLp/2pgpmGafmQX+FcJCpbA5zH0qRRk4CBkwumBoU/XQR7YOg4Ctg2bWk7Mn3Pd/RAiYgLOrwIBqGKLe/j8QQ8k9LxcT5WABkhGMBpgnw8+S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e6PtH/27F9XTtcZ/1WPMT9l2A7PtP7KUb/h/U27ZwQo6+J8Lea0PvGLffn7ZIFxriktB5jblNJaK97wAQ==";class Watermarker extends webgpu.Scene{viewer;camera;mesh;overlayPass;#t=!1;#r=null;constructor(t){super(),this.viewer=t,this.camera=new webgpu.OrthographicCamera(-1,1,1,-1,0,1),this.camera.position.z=.5,this.mesh=new webgpu.Mesh(new webgpu.PlaneGeometry(1.8,1.8),new webgpu.MeshBasicNodeMaterial({color:16777215,opacity:.5,transparent:!0})),this.add(this.mesh),this.overlayPass=tsl.pass(this,this.camera)}enable(){this.#t=!0,this.#i().then(t=>{this.#t&&(this.mesh.material.map!==t&&(this.mesh.material.map=t,this.mesh.material.needsUpdate=!0),this.viewer.renderPipeline.addOverlayPass(this.overlayPass))}).catch(t=>{this.#r=null,console.warn("u-space Watermarker: failed to load watermark texture.",t)})}disable(){this.#t=!1,this.viewer.renderPipeline.removeOverlayPass(this.overlayPass)}dispose(){this.disable(),this.overlayPass.dispose(),this.mesh.geometry.dispose(),this.mesh.material.dispose(),this.mesh.material.map?.dispose()}#i(){return this.mesh.material.map?Promise.resolve(this.mesh.material.map):(this.#r??=uSpace.TextureLoaderManager.loadAsyncTexture(logo).then(t=>(t.colorSpace=webgpu.SRGBColorSpace,t)),this.#r)}}const _m4=new webgpu.Matrix4;class SceneParser{viewer;path;manager;constructor(t,u,o){this.viewer=t,this.path=u,this.manager=o}async parseAsync(t,u,o){const d=new webgpu.Group,r=async(h,f=null)=>{const a=await this.parseTreeNode(h);if(a){const{id:n,sid:e}=h;this.viewer.objectManager.add(n,a),this.viewer.objectManager.add(e,a),u.add(n),u.add(e),f?f.add(a):d.add(a)}await Promise.all(h.children.map(n=>r(n,a)))};return await Promise.all(t.map(h=>r(h,d))),d}async parseTreeNode(t){const{name:u,renderType:o,path:d,visible:r,matrix:h,shape:f,extra:a}=t;let n=null;if(o==="3D"&&d){const e=this.path+d,s=new uSpace.Model;this.manager.itemStart(e),await s.loadAsync({url:e}),this.manager.itemEnd(e),n=s}else if(o==="GROUP"||o==="STUB")n=new webgpu.Group;else if(o==="POLYGON"&&f?.points){const e=uSpace.ShapeMesh.createFromPoints(f.points);e.material.color.set("blue"),e.material.transparent=!0,e.material.opacity=.5,n=e}else if(o==="CIRCLE"&&f?.radius){const e=new uSpace.CircleMesh({geometryParameters:{radius:f.radius}});e.material.color.set("blue"),e.material.transparent=!0,e.material.opacity=.5,n=e}else if(o==="AREA"||o==="FLOOR"||o==="ROOM"){const e=uSpace.ExtrudeMesh.createFromPoints(f?.points,{geometryParameters:{options:{depth:f?.depth,bevelEnabled:!1}}});e.material.color.set(a?.color??"blue"),e.material.transparent=!0,e.material.opacity=a?.opacity??.5,n=e}if(n){n.name=u,n.visible=r,_m4.fromArray(h).decompose(n.position,n.quaternion,n.scale);const s={...t};Reflect.deleteProperty(s,"children"),Object.assign(n.userData,s)}return n}}class SceneLoader extends webgpu.Loader{viewer;key="";cachedIds=new Set;_resourceData=null;_treeData=[];#t;constructor(t){super(),this.viewer=t,this.#t=new Watermarker(t),this.manager=new webgpu.LoadingManager}setKey(t){return this.key=t,this}async _preareTreeData(){if(!this.path)throw new Error("u-space SceneLoader: path is not set");const t=new BaseFileLoader(this),u=await t.loadAsync(META_DATA_FILE_PATH);if(u.version<1.5)throw new Error("u-space SceneLoader: Only support version 1.5 and above");if(!this.key&&u.authority==="OFFICIAL")throw new Error("u-space SceneLoader: options.key is required when authority is OFFICIAL");this.key&&u.authority==="TRIAL"&&console.warn("u-space SceneLoader: options.key is not used when authority is TRIAL");const o=await t.loadAsync(u.resource),d=this._resourceData!==o;if(this._resourceData=o,d)if(u.encryptWith==="DEBUG")try{this._treeData=decryptWithDebugKey(o),this.#t.enable()}catch{throw new Error("u-space SceneLoader: decrypt with debug key failed")}else if(u.encryptWith==="SCENE"||u.encryptWith==="COMPANY")try{this._treeData=decryptWithKey(o,this.key)}catch{throw new Error("u-space SceneLoader: decrypt with authorized key failed")}else u.encryptWith||(this._treeData=o)}async loadAsync(t={}){if(!this.path)throw new Error("u-space SceneLoader: path is not set");this.manager.itemStart(this.path);try{return await this._preareTreeData(),await new SceneParser(this.viewer,this.path,this.manager).parseAsync(this._treeData,this.cachedIds,t)}catch(u){throw this.manager.itemError(this.path),u}finally{this.manager.itemEnd(this.path)}}clearCache(){this.cachedIds.forEach(t=>{this.viewer.objectManager.removeById(t)}),this.cachedIds.clear()}dispose(){this.clearCache(),this.#t.dispose()}}class AnimationsLoader extends webgpu.Loader{constructor(){super(),this.manager=new webgpu.LoadingManager}async loadAsync(){return await new BaseFileLoader(this).loadAsync(ANIMATIONS_DATA_FILE_PATH)}}class AnimationsParser extends webgpu.EventDispatcher{viewer;target;tweenSet;_initialTransformSymbol=Symbol("initialTransform");constructor(t,u){super(),this.viewer=t,this.target=u,this.tweenSet=new Set}initTransform(t){const{position:u,rotation:o,scale:d}=this.target,r=t??{x:u.x,y:u.y,z:u.z,rotationX:o.x,rotationY:o.y,rotationZ:o.z,scaleX:d.x,scaleY:d.y,scaleZ:d.z};return Reflect.set(this.target,this._initialTransformSymbol,r),r}getInitialTransform(){return Reflect.get(this.target,this._initialTransformSymbol)}async play(t){let u=this.getInitialTransform();u||(u=this.initTransform());for(let o=0;o<t.length;o++){let d=t[o-1];d||(d=u);const r=t[o],h=r.delay??0,f=r.duration??1e3,a=r.easing,n=r.repeat===-1?1/0:r.repeat??0,e=r.yoyo??!1;await uSpace.tweenAnimation(this.viewer,{...d},{...r},{delay:h,duration:f,mode:a,repeat:n,yoyo:e},(s,l)=>{const{x:v,y:b,z:m,rotationX:q,rotationY:E,rotationZ:S,scaleX:O,scaleY:D,scaleZ:j}=s;this.target.position.set(v,b,m),this.target.rotation.set(q,E,S),this.target.scale.set(O,D,j),this.dispatchEvent({type:"update",source:s,tween:l})},s=>{this.tweenSet.add(s),this.dispatchEvent({type:"start",tween:s})})}}stop(){this.tweenSet.forEach(t=>t.stop()),this.tweenSet.clear()}reset(){const t=this.getInitialTransform();if(t){const{x:u,y:o,z:d,rotationX:r,rotationY:h,rotationZ:f,scaleX:a,scaleY:n,scaleZ:e}=t;this.target.position.set(u,o,d),this.target.rotation.set(r,h,f),this.target.scale.set(a,n,e),this.viewer.render()}}dispose(){this.stop(),this.reset(),Reflect.deleteProperty(this.target,this._initialTransformSymbol)}}class TopologyParser{parse(t){const{name:u,position:o,rotation:d,scale:r,nodes:h,nodeRadius:f=.2,nodeColor:a="#0000ff",linkWidth:n=.1,linkColor:e=["#00ff00"]}=t,s=new uSpace.Topology({nodeRadius:f,nodeColor:a,edgeRadius:n,edgeColor:e[0],pathRadius:n+.05});return s.name=u,s.position.set(o.x,o.y,o.z),s.rotation.set(d.x,d.y,d.z),s.scale.set(r.x,r.y,r.z),h.forEach(l=>{const v=new webgpu.Vector3().copy(l.position);s.addNode(l.id,v)}),h.forEach(l=>{l.graphs.forEach(v=>{s.addEdge(l.id,v.targetNodeId)})}),s.renderGraph(),Object.assign(s.userData,t),s}}class TopologiesLoader extends webgpu.Loader{constructor(){super(),this.manager=new webgpu.LoadingManager}async loadAsync(){if(!this.path)throw new Error("u-manager TopologiesLoader: path is not set");const u=await new BaseFileLoader(this).loadAsync(TOPOLOGY_DATA_FILE_PATH),o=new TopologyParser,d=[];return u.forEach(r=>{const h=o.parse(r);d.push(h)}),d}}class PropertiesLoader extends webgpu.Loader{constructor(){super(),this.manager=new webgpu.LoadingManager}async loadAsync(){return await new BaseFileLoader(this).loadAsync(PROPERTIES_DATA_FILE_PATH)}}class VisionsLoader extends webgpu.Loader{constructor(){super(),this.manager=new webgpu.LoadingManager}async loadAsync(){return await new BaseFileLoader(this).loadAsync(VISIONS_DATA_FILE_PATH)}}class VisionsParser{viewer;constructor(t){this.viewer=t}async flyToPrimary(t,u=!0){const o=t.find(d=>d.primary);return o?(await this.flyTo(o,u),!0):!1}async flyTo(t,u=!0){const{camera:o,position:d,target:r,zoom:h=this.viewer.camera.zoom}=t;o==="P"?this.viewer.setCameraByType("perspective"):o==="O"&&this.viewer.setCameraByType("orthographic");const{x:f,y:a,z:n}=d,{x:e,y:s,z:l}=r;await Promise.all([this.viewer.controls.setLookAt(f,a,n,e,s,l,u),this.viewer.controls.zoomTo(h,u)])}}const PLANISH_SCALE_Y=.01,_box=new webgpu.Box3,_pivot=new webgpu.Vector3,_raycastHits=[],_dummyPosition=new webgpu.Vector3,_dummyQuaternion=new webgpu.Quaternion,_dummyScale=new webgpu.Vector3,_boundsMatrix=new webgpu.Matrix4,_boundsSphere=new webgpu.Sphere;function getStateTextureSize(c,t=1){return Math.max(1,Math.ceil(Math.sqrt(Math.max(1,c*t))))}function getMatrixTextureSize(c){const t=Math.sqrt(Math.max(1,c)*4);return Math.max(4,Math.ceil(t/4)*4)}function createStateTexture(c){const t=new webgpu.DataTexture(new Float32Array(c*c*4),c,c,webgpu.RGBAFormat,webgpu.FloatType);return t.magFilter=webgpu.NearestFilter,t.minFilter=webgpu.NearestFilter,t.generateMipmaps=!1,t.needsUpdate=!0,t}function copyAttributeComponents(c,t,u,o){for(let d=0;d<u;d++)o.push(c?.getComponent(t,d)??0)}function createSemanticMaterial(c,t,u){const o=tsl.attribute("semanticIndex","float").toInt(),d=e=>tsl.int(tsl.textureSize(tsl.textureLoad(e),tsl.int(0)).x).toConst(),r=e=>{const s=d(e),l=o.mod(s).toConst(),v=o.div(s).toConst();return tsl.textureLoad(e,tsl.ivec2(l,v))},h=()=>{const e=d(u),s=o.mul(4).toConst(),l=s.mod(e).toConst(),v=s.div(e).toConst();return tsl.mat4(tsl.textureLoad(u,tsl.ivec2(l,v)),tsl.textureLoad(u,tsl.ivec2(l.add(1),v)),tsl.textureLoad(u,tsl.ivec2(l.add(2),v)),tsl.textureLoad(u,tsl.ivec2(l.add(3),v)))},f=r(c),a=r(t).x,n=new webgpu.MeshStandardNodeMaterial({transparent:!0,depthWrite:!1});return n.colorNode=tsl.vec4(f.rgb,1),n.opacityNode=f.a.mul(a),n.maskNode=a.greaterThan(.5).and(f.a.greaterThan(.001)),n.positionNode=h().mul(tsl.vec4(tsl.positionLocal,1)).xyz,n}function copySemanticColor(c,t){if(c instanceof webgpu.Color){t.x=c.r,t.y=c.g,t.z=c.b;return}t.x=c.x,t.y=c.y,t.z=c.z,c instanceof webgpu.Vector4&&(t.w=c.w)}function buildMergedSemanticGeometry(c){const t=[],u=[],o=[],d=[],r=[],h=[];c.forEach((a,n)=>{const e=a.geometry,s=e.getAttribute("position"),l=e.getAttribute("normal"),v=e.getAttribute("uv"),b=e.getIndex();if(!s)return;e.computeBoundingBox(),_box.copy(e.boundingBox??_box.makeEmpty()),_box.getCenter(_pivot),_pivot.y=_box.min.y;const m=t.length/3,q=[],E=[],S=[],O=[];for(let $=0;$<s.count;$++){const J=s.getX($)-_pivot.x,ie=s.getY($)-_pivot.y,ne=s.getZ($)-_pivot.z;t.push(J,ie,ne),q.push(J,ie,ne),d.push(n),copyAttributeComponents(l,$,3,u),copyAttributeComponents(l,$,3,E),copyAttributeComponents(v,$,2,o),copyAttributeComponents(v,$,2,S)}if(b)for(let $=0;$<b.count;$++){const J=b.getX($);r.push(m+J),O.push(J)}else for(let $=0;$<s.count;$++)r.push(m+$),O.push($);const D=new webgpu.BufferGeometry;D.setAttribute("position",new webgpu.Float32BufferAttribute(q,3)),l&&D.setAttribute("normal",new webgpu.Float32BufferAttribute(E,3)),v&&D.setAttribute("uv",new webgpu.Float32BufferAttribute(S,2)),D.setIndex(O),D.computeBoundingBox(),D.computeBoundingSphere();const j=new webgpu.Matrix4().makeTranslation(_pivot.x,_pivot.y,_pivot.z);h.push({id:a.id,kind:a.kind,name:a.name,index:n,baseMatrix:j,matrix:new webgpu.Matrix4,finalMatrix:j.clone(),geometry:D,color:a.color.clone(),visible:!0})});const f=new webgpu.BufferGeometry;return f.setAttribute("position",new webgpu.Float32BufferAttribute(t,3)),u.length>0&&f.setAttribute("normal",new webgpu.Float32BufferAttribute(u,3)),o.length>0&&f.setAttribute("uv",new webgpu.Float32BufferAttribute(o,2)),f.setAttribute("semanticIndex",new webgpu.Float32BufferAttribute(d,1)),f.setIndex(r),f.computeBoundingBox(),f.computeBoundingSphere(),{geometry:f,states:h}}class FloorMesh extends uSpace.BaseMesh{isFloorMergedSemanticMesh=!0;type="FloorMesh";boundingBox=null;boundingSphere=null;wallsInstances=new Map;columnsInstances=new Map;spacesInstances=new Map;doorsInstances=new Map;windowsInstances=new Map;semanticInstances=new Map;#t;#r;#i;#a;#o;#n;constructor(t){const{geometry:u,states:o}=buildMergedSemanticGeometry(t),d=getStateTextureSize(o.length),r=getMatrixTextureSize(o.length),h=createStateTexture(d),f=createStateTexture(d),a=createStateTexture(r),n=createSemanticMaterial(h,f,a);super(u,n),this.#r=o,this.#t={Walls:this.wallsInstances,Columns:this.columnsInstances,Spaces:this.spacesInstances,Doors:this.doorsInstances,Windows:this.windowsInstances},this.#i=h,this.#a=f,this.#o=a,this.#n=new webgpu.Mesh,this.#n.matrixAutoUpdate=!1,this.frustumCulled=!1,this.#r.forEach(e=>{this.semanticInstances.set(e.id,e.index),this.#t[e.kind].set(e.id,e.index),this.#s(e.index),this.#l(e.index),this.#f(e.index)}),this.userData.semanticEntries=this.#r.map(({id:e,kind:s,name:l,index:v})=>({id:e,kind:s,name:l,index:v}))}planish(t){return this.#c(t,u=>this.setScaleYAt(u,PLANISH_SCALE_Y)),this}unplanish(t){return this.#c(t,u=>this.setScaleYAt(u,1)),this}get semanticCount(){return this.#r.length}get instanceCount(){return this.semanticCount}getSemanticIndexById(t){return this.semanticInstances.get(t)}getSemanticIdAt(t){return this.#e(t).id}getSemanticKindAt(t){return this.#e(t).kind}getSemanticNameAt(t){return this.#e(t).name}setColorAt(t,u){const o=this.#e(t);return copySemanticColor(u,o.color),this.#s(t),this}getColorAt(t,u=new webgpu.Vector4){const o=this.#e(t).color;return u.copy(o),u}setOpacityAt(t,u){const o=this.#e(t);return o.color.w=Math.max(0,Math.min(1,u)),this.#s(t),this}getOpacityAt(t){return this.#e(t).color.w}setVisibleAt(t,u){const o=this.#e(t);return o.visible=u,this.#l(t),this}getVisibleAt(t){return this.#e(t).visible}setMatrixAt(t,u){const o=this.#e(t);return o.matrix.copy(u),o.finalMatrix.multiplyMatrices(o.baseMatrix,o.matrix),this.#u(),this.#f(t),this}setScaleAt(t,u,o,d){return this.#h(t,r=>{u instanceof webgpu.Vector3?r.copy(u):r.set(u,o??u,d??u)})}setScaleYAt(t,u){return this.#h(t,o=>{o.y=u})}getMatrixAt(t,u=new webgpu.Matrix4){return u.copy(this.#e(t).matrix),u}getFinalMatrixAt(t,u=new webgpu.Matrix4){return u.copy(this.#e(t).finalMatrix),u}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new webgpu.Box3),this.boundingBox.makeEmpty();for(const t of this.#r)this.getBoundingBoxAt(t.index,_box,!1)&&this.boundingBox.union(_box)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new webgpu.Sphere),this.boundingSphere.makeEmpty();for(const t of this.#r)this.getBoundingSphereAt(t.index,_boundsSphere,!1)&&this.boundingSphere.union(_boundsSphere)}getBoundingBoxAt(t,u=new webgpu.Box3,o=!0){const d=this.#e(t);return d.geometry.boundingBox||d.geometry.computeBoundingBox(),d.geometry.boundingBox?(u.copy(d.geometry.boundingBox).applyMatrix4(d.finalMatrix),o&&(this.updateWorldMatrix(!0,!1),u.applyMatrix4(this.matrixWorld)),u):null}getBoundingSphereAt(t,u=new webgpu.Sphere,o=!0){const d=this.#e(t);return d.geometry.boundingSphere||d.geometry.computeBoundingSphere(),d.geometry.boundingSphere?(u.copy(d.geometry.boundingSphere),o?(this.updateWorldMatrix(!0,!1),_boundsMatrix.multiplyMatrices(this.matrixWorld,d.finalMatrix),u.applyMatrix4(_boundsMatrix)):u.applyMatrix4(d.finalMatrix),u):null}raycast(t,u){if(this.visible===!1&&this.ignoreInvisibleWhenRaycast===!0)return!1;this.updateWorldMatrix(!0,!1),this.#n.material=this.material;for(const o of this.#r)if(!(!o.visible||o.color.w<=.001)){this.#n.geometry=o.geometry,this.#n.matrixWorld.multiplyMatrices(this.matrixWorld,o.finalMatrix),_raycastHits.length=0,this.#n.raycast(t,_raycastHits);for(const d of _raycastHits){const r=d;r.object=this,r.instanceId=o.index,r.semanticId=o.id,r.semanticKind=o.kind,r.semanticName=o.name,r.semanticIndex=o.index,u.push(r)}}}dispose(){this.geometry.dispose(),Array.isArray(this.material)?this.material.forEach(t=>t.dispose()):this.material.dispose(),this.#i.dispose(),this.#a.dispose(),this.#o.dispose(),this.#r.forEach(t=>t.geometry.dispose())}#e(t){const u=this.#r[t];if(!u)throw new Error(`u-space FloorMesh: invalid semantic index ${t}.`);return u}#u(){this.boundingBox=null,this.boundingSphere=null}#c(t,u){if(t===void 0){this.#r.forEach(o=>u(o.index));return}for(const o of this.#t[t].values())u(o)}#h(t,u){const o=this.#e(t);return o.matrix.decompose(_dummyPosition,_dummyQuaternion,_dummyScale),u(_dummyScale),o.matrix.compose(_dummyPosition,_dummyQuaternion,_dummyScale),o.finalMatrix.multiplyMatrices(o.baseMatrix,o.matrix),this.#u(),this.#f(t),this}#s(t){this.#e(t).color.toArray(this.#i.image.data,t*4),this.#i.needsUpdate=!0}#l(t){const u=this.#e(t),o=this.#a.image.data;o[t*4]=u.visible?1:0,o[t*4+1]=0,o[t*4+2]=0,o[t*4+3]=1,this.#a.needsUpdate=!0}#f(t){this.#e(t).finalMatrix.toArray(this.#o.image.data,t*16),this.#o.needsUpdate=!0}}class BuildingGroup extends uSpace.BaseGroup{isBuildingGroup=!0;type="BuildingGroup";floorMeshes=[];constructor(){super()}addFloor(t){return this.floorMeshes.includes(t)||(this.add(t),this.floorMeshes.push(t)),this}getFloorAt(t){return this.floorMeshes[t]}removeFloor(t){const u=this.floorMeshes.indexOf(t);return u!==-1&&this.floorMeshes.splice(u,1),this.remove(t),this}isolateFloor(t){const u=typeof t=="number"?this.getFloorAt(t):t;if(!u||!this.floorMeshes.includes(u))throw new Error("u-space BuildingGroup: the floor is not in this building group.");return this.floorMeshes.forEach(o=>{o.visible=o===u}),this}showAllFloors(){return this.floorMeshes.forEach(t=>{t.visible=!0}),this}planishFloors(t){return this.floorMeshes.forEach(u=>u.planish(t)),this}unplanishFloors(t){return this.floorMeshes.forEach(u=>u.unplanish(t)),this}}const SEMANTIC_INITIAL_COLORS={Walls:new webgpu.Vector4(.86,.86,.82,1),Columns:new webgpu.Vector4(.62,.65,.68,1),Spaces:new webgpu.Vector4(.36,.7,.5,.45),Doors:new webgpu.Vector4(.9,.52,.2,1),Windows:new webgpu.Vector4(.28,.62,.95,.65)};function getInitialColor(c){return SEMANTIC_INITIAL_COLORS[c].clone()}function getValidPolygonShape(c,t,u){return!Array.isArray(c)||c.length<4||c.length%2!==0?(console.warn(`u-space SemanticLoader: invalid ${t} polygon shape for id ${u}.`),null):c}function convertToPlaneIVector2(c){const t=[];for(let u=0;u<c.length;u+=2)t.push({x:c[u],z:c[u+1]});return t}class SemanticParser{parse(t){const u=[];return t.Buildings?.forEach(o=>{const d=new BuildingGroup;d.name=o.Name||"",d.userData.id=o.ID,o.Stories.forEach(r=>{const h=t.Stories?.[r];if(h&&h.ID){const f=[];if(h.Walls?.forEach(n=>{const e=t.Walls?.[n];if(!e||!e.Polygon)return;const s=getValidPolygonShape(e.Polygon.shape,"Walls",e.ID);if(!s)return;const l=uSpace.ExtrudeMesh.createFromPoints(convertToPlaneIVector2(s),{geometryParameters:{options:{depth:e.Height,bevelEnabled:!1}}}).geometry;l.translate(0,e.Elevation,0),l.userData.id=e.ID,f.push({id:e.ID,kind:"Walls",geometry:l,color:getInitialColor("Walls")})}),h.Columns?.forEach(n=>{const e=t.Columns?.[n];if(!e||!e.Polygon)return;const s=getValidPolygonShape(e.Polygon.shape,"Columns",e.ID);if(!s)return;const l=uSpace.ExtrudeMesh.createFromPoints(convertToPlaneIVector2(s),{geometryParameters:{options:{depth:e.Height,bevelEnabled:!1}}}).geometry;l.translate(0,e.Elevation,0),l.userData.id=e.ID,f.push({id:e.ID,kind:"Columns",geometry:l,color:getInitialColor("Columns")})}),h.Doors?.forEach(n=>{const e=t.Doors?.[n];if(!e||!e.Polygon)return;const s=getValidPolygonShape(e.Polygon.shape,"Doors",e.ID);if(!s)return;const l=uSpace.ExtrudeMesh.createFromPoints(convertToPlaneIVector2(s),{geometryParameters:{options:{depth:e.Height,bevelEnabled:!1}}}).geometry;l.translate(0,e.Elevation,0),l.userData.id=e.ID,f.push({id:e.ID,kind:"Doors",geometry:l,color:getInitialColor("Doors")})}),h.Windows?.forEach(n=>{const e=t.Windows?.[n];if(!e||!e.Polygon)return;const s=getValidPolygonShape(e.Polygon.shape,"Windows",e.ID);if(!s)return;const l=uSpace.ExtrudeMesh.createFromPoints(convertToPlaneIVector2(s),{geometryParameters:{options:{depth:e.Height,bevelEnabled:!1}}}).geometry;l.translate(0,e.Elevation,0),l.userData.id=e.ID,f.push({id:e.ID,kind:"Windows",geometry:l,color:getInitialColor("Windows")})}),h.Spaces?.forEach(n=>{const e=t.Spaces?.[n];if(!e||!e.Polygon)return;const s=getValidPolygonShape(e.Polygon.shape,"Spaces",e.ID);if(!s)return;const l=e.CeilingHeight-e.GroundHeight,v=uSpace.ExtrudeMesh.createFromPoints(convertToPlaneIVector2(s),{geometryParameters:{options:{depth:l,bevelEnabled:!1}}}).geometry;v.translate(0,e.GroundHeight,0),v.userData.id=e.ID,f.push({id:e.ID,kind:"Spaces",name:e.Name,geometry:v,color:getInitialColor("Spaces")})}),f.length===0)return;const a=new FloorMesh(f);a.name=h.Name||"",a.userData.id=h.ID,a.pivot=new webgpu.Vector3(0,h.Elevation||0,0),d.addFloor(a)}}),u.push(d)}),u}}class SemanticLoader extends webgpu.Loader{viewer;constructor(t){super(),this.viewer=t,this.manager=new webgpu.LoadingManager}async loadAsync(){if(!this.path)throw new Error("u-space SemanticLoader: path is not set");this.manager.itemStart(this.path);try{const u=await new BaseFileLoader(this).loadAsync(SEMANTIC_DATA_FILE_PATH);return new SemanticParser().parse(u)}catch(t){throw this.manager.itemError(this.path),t}finally{this.manager.itemEnd(this.path)}}}class Edge{id;source;target;sourceHandle;constructor(t){this.id=t.id,this.source=t.source,this.target=t.target,this.sourceHandle=t.sourceHandle}}function objectHandle(c,t){return Array.isArray(c)?c.map(t):t(c)}function sleep(c){return new Promise(t=>setTimeout(t,c))}function parseNodeByType(c,t){switch(t.type){case"START":return new StartNode(c,t);case"COLOR":return new ColorNode(c,t);case"NUMBER":return new NumberNode(c,t);case"HIGHLIGHT":return new HighlightNode(c,t);case"UN_HIGHLIGHT":return new UnHighlightNode(c,t);case"OPACITY":return new OpacityNode(c,t);case"UN_OPACITY":return new UnOpacityNode(c,t);case"EMISSIVE":return new EmissiveNode(c,t);case"UN_EMISSIVE":return new UnEmissiveNode(c,t);case"MESH":return new MeshNode(c,t);case"MESHES":return new MeshesNode(c,t);case"MODEL":return new ModelNode(c,t);case"MODELS":return new ModelsNode(c,t);case"SPACE":return new SpaceNode(c,t);case"SPACES":return new SpacesNode(c,t);case"POIS":return new POIsNode(c,t);case"POI":return new POINode(c,t);case"PATH":return new PathNode(c,t);case"PATHS":return new PathsNode(c,t);case"DELAY":return new DelayNode(c,t);case"CONDITION_NODE":return new ConditionNode(c,t);case"SHOW":return new ShowNode(c,t);case"HIDE":return new HideNode(c,t);case"CLIP_ANIMATION":return new ClipAnimationNode(c,t);case"UN_CLIP_ANIMATION":return new UnClipAnimationNode(c,t);case"TWEEN_ANIMATION":return new TweenAnimationNode(c,t);case"UN_TWEEN_ANIMATION":return new UnTweenAnimationNode(c,t);case"COMPONENT_TWEEN_ANIMATION":return new ComponentTweenAnimationNode(c,t);case"UN_COMPONENT_TWEEN_ANIMATION":return new UnComponentTweenAnimationNode(c,t);case"TRANSLATE":return new TranslateNode(c,t);case"ROTATE":return new RotateNode(c,t);case"SCALE":return new ScaleNode(c,t);case"FLY_TO":return new FlyToNode(c,t);case"DATA_EXTRACTION":return new DataExtractionNode(c,t);case"DATA_FILTER":return new DataFilterNode(c,t);case"USER_DATA_NODE":return new UserDataNode(c,t);default:return new Node(c,t)}}function parseValue(c){return JSON.parse(c)}async function waitFor(c,t){t?await c():c()}function getObjectByIds(c,t){return t.map(u=>c.objectManager.getById(u)).filter(Boolean)}function getObjectById(c,t,u){const o=c.objectManager.getById(t);if(o)return o;{const d=c.scene;return getMeshByUserDataUuid(u??d,t)}}function getMeshByUserDataUuid(c,t){if(c.userData.key===t||c.uuid===t)return c;for(let u=0,o=c.children.length;u<o;u++){const d=c.children[u],r=getMeshByUserDataUuid(d,t);if(r!==null)return r}return null}let count=0;const preloadNodes=["MESH","MESHES","MODEL","MODELS","POI","POIS","SPACE","SPACES","PATH","PATHS","COLOR","NUMBER","DATA_EXTRACTION","DATA_FILTER","USER_DATA_NODE","CONDITION_NODE","START"];class Node{parser;viewer;id;type;props;prevNodes=[];postNodes=[];execOrder=0;ctx;promise;resolve;reject;cleanSets=new Set;onBefore=null;onAfter=null;rejected;constructor(t,u){this.parser=t,this.viewer=t.viewer,this.id=u.id,this.type=u.type,this.props=u.props,this.rejected=!1,this.init()}init(){this.ctx={},this.promise=new Promise((t,u)=>{this.resolve=t,this.reject=o=>{this.rejected=!0,u(o)}})}readContext(t){return this.ctx[t]}writeContext(t,u){this.ctx[t]=u}findProp(t,u){if(u instanceof Array)for(const o of u){const d=this.findProp(t,o);if(d)return d}else return this.props.find(o=>o.name===t&&o.type===u)}async waitForPrevNodes(){return await Promise.all(this.prevNodes.map(t=>t.promise))}mergeContext(){this.prevNodes.forEach(t=>{Object.assign(this.ctx,t.ctx)}),this._mergeUserDataMap()}async exec(t){}async run(t,u={preload:!1}){const{preload:o}=u;try{if(await this.waitForPrevNodes(),this.rejected)throw new Error;this.mergeContext(),await(this.onBefore??this.parser.onNodeBefore)?.(this);try{(!o||preloadNodes.includes(this.type))&&(this.execOrder=++count,await this.exec(t))}catch(d){throw this.reject(d),d}await(this.onAfter??this.parser.onNodeAfter)?.(this),this.resolve()}catch(d){this.reject(d)}}cleanup(){this.cleanSets.forEach(t=>t()),this.cleanSets.clear()}getValue(t,u){if(t.type==="READ_CTX")return this.readContext(parseValue(t.value));if(t.type==="LOCAL"){const{scene:o}=this.viewer;return t.name==="objects"||t.name==="models"||t.name==="meshs"?parseValue(t.value).map(d=>getObjectById(this.viewer,d,u??o)):t.name==="object"||t.name==="model"||t.name==="mesh"?getObjectById(this.viewer,parseValue(t.value),u??o):parseValue(t.value)}}_mergeUserDataMap(){if(this.prevNodes.some(t=>t.ctx._userDataMap))this.ctx._userDataMap=new Map;else return;this.prevNodes.forEach(t=>{t.ctx._userDataMap&&t.ctx._userDataMap.forEach((u,o)=>{this.ctx._userDataMap.set(o,Object.assign({},u))})})}}class StartNode extends Node{constructor(t,u){super(t,u)}}class ColorNode extends Node{constructor(t,u){super(t,u)}async exec(){const t=this.findProp("color","LOCAL"),u=this.findProp("out","WRITE_CTX");t&&u&&this.writeContext(parseValue(u.value),parseValue(t.value))}}class NumberNode extends Node{constructor(t,u){super(t,u)}async exec(){const t=this.findProp("number","LOCAL"),u=this.findProp("out","WRITE_CTX");t&&u&&this.writeContext(parseValue(u.value),parseValue(t.value))}}class HighlightNode extends Node{constructor(t,u){super(t,u)}async exec(t){const u=this.findProp("objects",["READ_CTX","LOCAL"]),o=this.findProp("color",["READ_CTX","LOCAL"]),d=this.findProp("opacity",["READ_CTX","LOCAL"]),r=await t.getTarget?.(this);if(u&&o&&d){const h=this.getValue(u,r),f=this.getValue(o),a=this.getValue(d);h&&(index.MaterialEffects.highlightColor(h,{color:f,opacity:a}),this.cleanSets.add(()=>{index.MaterialEffects.removeHighlightColor(h)}))}}}class UnHighlightNode extends Node{constructor(t,u){super(t,u)}filterUnHighlightObject(t){const u=[];return objectHandle(t,o=>{u.push(o)}),u}async exec(t){const u=this.findProp("objects",["READ_CTX","LOCAL"]),o=await t.getTarget?.(this);if(u){const d=this.getValue(u,o);d&&uSpace.MaterialEffects.removeHighlightColor(d)}}}class OpacityNode extends Node{constructor(t,u){super(t,u)}async exec(t){const u=this.findProp("objects",["READ_CTX","LOCAL"]),o=this.findProp("color",["READ_CTX","LOCAL"]),d=this.findProp("opacity",["READ_CTX","LOCAL"]),r=await t.getTarget?.(this);if(u&&o&&d){const h=this.getValue(u,r),f=this.getValue(o),a=this.getValue(d);if(h){const n=objectHandle(h,e=>e);index.MaterialEffects.highlightColor(n,{color:f,opacity:a,overwrite:!0}),this.cleanSets.add(()=>{index.MaterialEffects.removeHighlightColor(n)})}}}}class UnOpacityNode extends Node{constructor(t,u){super(t,u)}async exec(t){const u=this.findProp("objects",["READ_CTX","LOCAL"]),o=await t.getTarget?.(this);if(u){const d=this.getValue(u,o);d&&uSpace.MaterialEffects.removeHighlightColor(d)}}}class EmissiveNode extends Node{constructor(t,u){super(t,u)}async exec(t){const u=this.findProp("objects",["READ_CTX","LOCAL"]),o=this.findProp("color",["READ_CTX","LOCAL"]),d=this.findProp("baseColor",["READ_CTX","LOCAL"]),r=this.findProp("minOpacity",["READ_CTX","LOCAL"]),h=this.findProp("maxOpacity",["READ_CTX","LOCAL"]),f=this.findProp("duration",["READ_CTX","LOCAL"]),a=await t.getTarget?.(this);if(u&&o&&d&&r&&h&&f){const n=this.getValue(u,a),e=this.getValue(o),s=this.getValue(h);n&&(uSpace.MaterialEffects.breatheColor(n,{color:e,intensity:s}),this.cleanSets.add(()=>{uSpace.MaterialEffects.removeBreatheColor(n)}))}}}class UnEmissiveNode extends Node{constructor(t,u){super(t,u)}filterUnEmissiveObject(t){const u=[];return objectHandle(t,o=>{u.push(o)}),u}async exec(t){const u=this.findProp("objects",["READ_CTX","LOCAL"]),o=await t.getTarget?.(this);u&&this.getValue(u,o)}}const meshCacheSymbol=Symbol("meshCache");class MeshNode extends Node{constructor(t,u){super(t,u)}async exec(t){const{scene:u}=this.viewer,o=await t.getTarget?.(this)||u;t[meshCacheSymbol]||(t[meshCacheSymbol]={});const d=this.findProp("mesh","LOCAL"),r=this.findProp("out","WRITE_CTX");if(d&&r){let h=null;const f=parseValue(d.value),a=parseValue(r.value),n=t[meshCacheSymbol][f];if(n){h=n;return}const e=getMeshByUserDataUuid(o,f);e&&(h=e,t[meshCacheSymbol][f]=e),this.writeContext(a,h)}}}const meshesCacheSymbol=Symbol("meshesCache");class MeshesNode extends Node{constructor(t,u){super(t,u)}async exec(t){const{scene:u}=this.viewer,o=await t.getTarget?.(this)||u;t[meshesCacheSymbol]||(t[meshesCacheSymbol]={});const d=this.findProp("meshes","LOCAL"),r=this.findProp("out","WRITE_CTX");if(d&&r){const h=[],f=parseValue(d.value),a=parseValue(r.value);f.forEach(n=>{const e=t[meshesCacheSymbol][n];if(e){h.push(e);return}const s=getMeshByUserDataUuid(o,n);s&&(h.push(s),t[meshesCacheSymbol][n]=s)}),this.writeContext(a,h)}}}class ModelNode extends Node{constructor(t,u){super(t,u)}async exec(){const t=this.findProp("model","LOCAL"),u=this.findProp("out","WRITE_CTX");if(t&&u){const o=parseValue(t.value),d=parseValue(u.value);this.writeContext(d,getObjectById(this.viewer,o))}}}class ModelsNode extends Node{constructor(t,u){super(t,u)}async exec(){const t=this.findProp("models","LOCAL"),u=this.findProp("out","WRITE_CTX");if(t&&u){const o=parseValue(t.value),d=parseValue(u.value);this.writeContext(d,getObjectByIds(this.viewer,o))}}}class DelayNode extends Node{constructor(t,u){super(t,u)}async exec(){const t=this.findProp("delay","LOCAL");if(t){const u=parseValue(t.value);await sleep(u)}}}class ConditionNode extends Node{constructor(t,u){super(t,u)}execFn(t){return new Function("sourceData",t)(this.ctx)}async exec(){const t=this.findProp("conditaion_node","LOCAL");if(t){const u=parseValue(t.value),o=this.parser.edges.filter(d=>d.source===this.id);u.forEach(d=>{try{if(this.execFn(d.value)!==!0)throw new Error}catch{const h=o.find(a=>a.sourceHandle==String(d.id));if(!h)return;this.postNodes.find(a=>a.id===h.target)?.reject()}})}}}class ShowNode extends Node{constructor(t,u){super(t,u)}filterShowObject(t){const u=[];return objectHandle(t,o=>{o.visible===!1&&u.push(o)}),u}async exec(t){const u=this.findProp("objects",["READ_CTX","LOCAL"]),o=await t.getTarget?.(this);if(u){const d=this.getValue(u,o);if(d){const r=this.filterShowObject(d),h=f=>{objectHandle(r,a=>{a.visible=f}),this.viewer.render()};h(!0),this.cleanSets.add(()=>h(!1))}}}}class HideNode extends Node{constructor(t,u){super(t,u)}filterHideObject(t){const u=[];return objectHandle(t,o=>{o.visible===!0&&u.push(o)}),u}async exec(t){const u=this.findProp("objects",["READ_CTX","LOCAL"]),o=await t.getTarget?.(this);if(u){const d=this.getValue(u,o);if(d){const r=this.filterHideObject(d),h=f=>{objectHandle(r,a=>{a.visible=f}),this.viewer.render()};h(!1),this.cleanSets.add(()=>h(!0))}}}}class TranslateNode extends Node{constructor(t,u){super(t,u)}async exec(t){const u=this.findProp("objects",["READ_CTX","LOCAL"]),o=this.findProp("axis",["READ_CTX","LOCAL"]),d=this.findProp("translate",["READ_CTX","LOCAL"]),r=await t.getTarget?.(this);if(u&&o&&d){const h=this.getValue(u,r),f=this.getValue(o),a=this.getValue(d);if(h){const n=[];objectHandle(h,v=>{n.push(v.position.clone())});const s=(v,b)=>{switch(f){case"x":v.setX(b.x);break;case"y":v.setY(b.y);break;case"z":v.setZ(b.z);break}};await(async()=>{const v=objectHandle(h,async b=>{const m=b.position.clone();switch(f){case"x":await uSpace.tweenAnimation(this.viewer,m,new webgpu.Vector3().set(m.x+a,m.y,m.z),{duration:800},q=>s(b.position,q));break;case"y":await uSpace.tweenAnimation(this.viewer,m,new webgpu.Vector3().set(m.x,m.y+a,m.z),{duration:800},q=>s(b.position,q));break;case"z":await uSpace.tweenAnimation(this.viewer,m,new webgpu.Vector3().set(m.x,m.y,m.z+a),{duration:800},q=>s(b.position,q));break}});v instanceof Array?await Promise.all(v):await v,this.viewer.render()})(),this.cleanSets.add(()=>{let v=0;objectHandle(h,b=>{b.position.copy(n[v++])})})}}}}class ScaleNode extends Node{constructor(t,u){super(t,u)}async exec(t){const u=this.findProp("objects",["READ_CTX","LOCAL"]),o=this.findProp("axis",["READ_CTX","LOCAL"]),d=this.findProp("scale",["READ_CTX","LOCAL"]),r=await t.getTarget?.(this);if(u&&o&&d){const h=this.getValue(u,r),f=this.getValue(o),a=this.getValue(d);if(h){const n=[];objectHandle(h,v=>{n.push(v.scale.clone())});const s=(v,b)=>{switch(f){case"x":v.setX(b.x);break;case"y":v.setY(b.y);break;case"z":v.setZ(b.z);break}};await(async()=>{const v=objectHandle(h,async b=>{const m=b.scale.clone();switch(f){case"x":await uSpace.tweenAnimation(this.viewer,m,new webgpu.Vector3().set(m.x*a,m.y,m.z),{duration:800},q=>s(b.scale,q));break;case"y":await uSpace.tweenAnimation(this.viewer,m,new webgpu.Vector3().set(m.x,m.y*a,m.z),{duration:800},q=>s(b.scale,q));break;case"z":await uSpace.tweenAnimation(this.viewer,m,new webgpu.Vector3().set(m.x,m.y,m.z*a),{duration:800},q=>s(b.scale,q));break}});v instanceof Array?await Promise.all(v):await v,this.viewer.render()})(),this.cleanSets.add(()=>{let v=0;objectHandle(h,b=>{b.scale.copy(n[v++])})})}}}}class RotateNode extends Node{constructor(t,u){super(t,u)}async exec(t){const u=this.findProp("objects",["READ_CTX","LOCAL"]),o=this.findProp("axis",["READ_CTX","LOCAL"]),d=this.findProp("rotation",["READ_CTX","LOCAL"]),r=await t.getTarget?.(this);if(u&&o&&d){const h=this.getValue(u,r),f=this.getValue(o),a=this.getValue(d);if(h){const n=[];objectHandle(h,v=>{n.push(v.rotation.clone())});const s=(v,b)=>{switch(f){case"x":v.x=b.x;break;case"y":v.y=b.y;break;case"z":v.z=b.z;break}};await(async()=>{const v=a/180*Math.PI,b=objectHandle(h,async m=>{const q=m.rotation.clone();switch(f){case"x":await uSpace.tweenAnimation(this.viewer,q,new webgpu.Euler().set(q.x+v,q.y,q.z),{duration:800},E=>s(m.rotation,E));break;case"y":await uSpace.tweenAnimation(this.viewer,q,new webgpu.Euler().set(q.x,q.y+v,q.z),{duration:800},E=>s(m.rotation,E));break;case"z":await uSpace.tweenAnimation(this.viewer,q,new webgpu.Euler().set(q.x,q.y,q.z+v),{duration:800},E=>s(m.rotation,E));break}});b instanceof Array?await Promise.all(b):await b,this.viewer.render()})(),this.cleanSets.add(()=>{let v=0;objectHandle(h,b=>{b.rotation.copy(n[v++])})})}}}}class FlyToNode extends Node{constructor(t,u){super(t,u)}async exec(){const t=this.findProp("viewpoint",["READ_CTX","LOCAL"]);if(t){const u=parseValue(this.getValue(t));u&&this.viewer.controls.setCameraViewpoint(u,!0)}}}class SpaceNode extends Node{constructor(t,u){super(t,u)}async exec(){const t=this.findProp("space","LOCAL"),u=this.findProp("out","WRITE_CTX");if(t&&u){const o=parseValue(t.value),d=parseValue(u.value);this.writeContext(d,getObjectById(this.viewer,o))}}}class SpacesNode extends Node{constructor(t,u){super(t,u)}async exec(){const t=this.findProp("spaces","LOCAL"),u=this.findProp("out","WRITE_CTX");if(t&&u){const o=parseValue(t.value),d=parseValue(u.value),r=o.map(h=>getObjectById(this.viewer,h));this.writeContext(d,r)}}}class POINode extends Node{constructor(t,u){super(t,u)}async exec(t){const u=this.findProp("poi","LOCAL"),o=this.findProp("out","WRITE_CTX");if(u&&o){const d=parseValue(u.value),r=parseValue(o.value);this.writeContext(r,getObjectById(this.viewer,d))}}}class POIsNode extends Node{constructor(t,u){super(t,u)}async exec(t){const u=this.findProp("pois","LOCAL"),o=this.findProp("out","WRITE_CTX");if(u&&o){const d=parseValue(u.value),r=parseValue(o.value),h=d.map(f=>getObjectById(this.viewer,f));this.writeContext(r,h)}}}class DataExtractionNode extends Node{constructor(t,u){super(t,u)}async exec(){const t=this.findProp("value","LOCAL"),u=this.findProp("object","LOCAL"),o=this.findProp("out","WRITE_CTX"),d=this.findProp("extraction","LOCAL");if(t&&o&&d&&u){const r=parseValue(d.value),h=parseValue(o.value),f=parseValue(u.value),a=this.getValue(u);let n=parseValue(t.value);if(this.ctx._userDataMap){const e=this.ctx._userDataMap.get(f);e&&(n=e[r])}else if(a&&a.userData.properties){const e=a.userData.properties.find(s=>s.key===r);e&&e.value!==void 0&&(n=e.value)}this.writeContext(h,n)}}}class DataFilterNode extends Node{constructor(t,u){super(t,u)}async exec(){const t=this.findProp("model","LOCAL");if(t){const u=parseValue(t.value),o=new Function("sourceData",u);for(const d in this.ctx){const r=o(this.ctx[d]);(r==null||r===!1)&&delete this.ctx[d]}}}}class PathNode extends Node{constructor(t,u){super(t,u)}async exec(){const t=this.findProp("path","LOCAL"),u=this.findProp("out","WRITE_CTX");if(t&&u){const o=parseValue(t.value),d=parseValue(u.value);this.writeContext(d,getObjectById(this.viewer,o))}}}class PathsNode extends Node{constructor(t,u){super(t,u)}async exec(){const t=this.findProp("paths","LOCAL"),u=this.findProp("out","WRITE_CTX");if(t&&u){const o=parseValue(t.value),d=parseValue(u.value),r=o.map(h=>getObjectById(this.viewer,h));this.writeContext(d,r)}}}class UserDataNode extends Node{constructor(t,u){super(t,u)}async exec(){const t=this.findProp("object",["READ_CTX","LOCAL"]),u=this.findProp("data","LOCAL"),o=this.findProp("source","WRITE_CTX");if(t&&u&&o){let d=parseValue(t.value);const r=parseValue(u.value),h=parseValue(o.value);if(h&&(d=h),d&&r){this.ctx._userDataMap||(this.ctx._userDataMap=new Map);const f=this.ctx._userDataMap.get(d);f?Object.assign(f,r):this.ctx._userDataMap.set(d,r)}}}}class ClipAnimationNode extends Node{constructor(t,u){super(t,u)}async exec(t){let u=await t.getTarget?.(this);if(!u){const d=this.findProp("model",["READ_CTX","LOCAL"]);d&&(u=this.getValue(d))}const o=this.findProp("animation",["READ_CTX","LOCAL"]);if(u&&o){let d;if(o.type==="READ_CTX"){const h=this.parser.getVariableNameById(parseValue(o.value));d=this.readContext(h)}else d=parseValue(o.value);u.playAnimation(d);const r=({delta:h})=>{u.updateAnimation(h)};this.viewer.addEventListener("beforeRender",r),this.cleanSets.add(()=>{u.stopAnimation(d),this.viewer.removeEventListener("beforeRender",r)})}}}class UnClipAnimationNode extends Node{constructor(t,u){super(t,u)}async exec(t){let u=await t.getTarget?.(this);if(!u){const d=this.findProp("model",["READ_CTX","LOCAL"]);d&&(u=this.getValue(d))}const o=this.findProp("animation",["READ_CTX","LOCAL"]);if(u&&o){let d;if(o.type==="READ_CTX"){const r=this.parser.getVariableNameById(parseValue(o.value));d=this.readContext(r)}else d=parseValue(o.value);u.stopAnimation(d)}}}const tweenCache$1=new Map;async function playTweenAnimation(c,t,u){const{id:o,keyframes:d}=u,r=new AnimationsParser(c,t);tweenCache$1.has(o)||tweenCache$1.set(o,new Set),tweenCache$1.get(o)?.add(r),await r.play(d)}function stopTweenAnimation(c){tweenCache$1.get(c)?.forEach(t=>t.stop()),tweenCache$1.get(c)?.clear()}class TweenAnimationNode extends Node{constructor(t,u){super(t,u)}async exec(t){const u=this.findProp("model",["READ_CTX","LOCAL"]),o=this.findProp("animation","LOCAL"),d=this.findProp("wait","LOCAL");if(u&&o&&d){const r=this.getValue(u),h=parseValue(o.value),f=parseValue(d.value);if(r){const a=await t.getAnimations?.(this,r,h);if(a){const n=a.find(e=>e.id===h);n&&await waitFor(async()=>{const e=r.matrix.clone();await playTweenAnimation(this.viewer,r,n),this.cleanSets.add(()=>{stopTweenAnimation(n.id),r&&e.decompose(r.position,r.quaternion,r.scale)})},f)}}}}}class UnTweenAnimationNode extends Node{constructor(t,u){super(t,u)}async exec(){const t=this.findProp("animation","LOCAL");if(t){const u=parseValue(t.value);stopTweenAnimation(u)}}}const tweenCache=new Map;async function playComponentTweenAnimation(c,t,u){const{id:o,keyframes:d}=u,r=new AnimationsParser(c,t);tweenCache.has(o)||tweenCache.set(o,new Set),tweenCache.get(o)?.add(r),await r.play(d)}function stopComponentTweenAnimation(c){tweenCache.get(c)?.forEach(t=>t.stop()),tweenCache.get(c)?.clear()}class ComponentTweenAnimationNode extends Node{constructor(t,u){super(t,u)}async exec(t){const u=this.findProp("mesh",["READ_CTX","LOCAL"]),o=this.findProp("animation","LOCAL"),d=this.findProp("wait","LOCAL");if(u&&o&&d){const r=this.getValue(u),h=parseValue(o.value),f=parseValue(d.value);if(r){const a=await t.getComponentAnimations?.(this,r,h);if(a){const n=a.find(e=>e.id===h);if(n){let e=null;u.valueType==="Mesh"?e=r:u.valueType==="Model"&&(e=getMeshByUserDataUuid(r,n.refId)),e&&await waitFor(async()=>{if(e){const s=e.matrix.clone();await playComponentTweenAnimation(this.viewer,e,n),this.cleanSets.add(()=>{stopComponentTweenAnimation(n.id),e&&s.decompose(e.position,e.quaternion,e.scale)})}},f)}}}}}}class UnComponentTweenAnimationNode extends Node{constructor(t,u){super(t,u)}async exec(){const t=this.findProp("animation","LOCAL");if(t){const u=parseValue(t.value);stopComponentTweenAnimation(u)}}}class FlowParser extends webgpu.EventDispatcher{viewer;flow;nodes;nodesMap;edges;edgesMap;onNodeBefore=null;onNodeAfter=null;constructor(t,u){super(),this.viewer=t,this.flow=u,this.nodes=[],this.nodesMap=new Map,this.edges=[],this.edgesMap=new Map}addNode(t){this.nodes.push(t),this.nodesMap.set(t.id,t)}addEdge(t){this.edges.push(t),this.edgesMap.set(t.id,t)}getNodeById(t){return this.nodesMap.get(t)}getEdgeById(t){return this.edgesMap.get(t)}clear(){this.nodes.length=0,this.nodesMap.clear(),this.edges.length=0,this.edgesMap.clear()}parse(){this.clear();const{nodes:t,edges:u}=this.flow;t.forEach(o=>{const d=parseNodeByType(this,o);this.addNode(d)}),u.forEach(o=>{const d=new Edge(o);this.addEdge(d);const r=this.getNodeById(o.source),h=this.getNodeById(o.target);r&&h&&(r.postNodes.push(h),h.prevNodes.push(r))})}async run(t={},u={preload:!1}){const{preload:o}=u,r=this.nodes.filter(h=>h.prevNodes.length||h.postNodes.length).map(h=>h.run(t,{preload:o}));await Promise.allSettled(r)}async debug(t={},u=1500){const o=this.onNodeAfter;this.onNodeAfter=async d=>{await sleep(u),o?.(d)},await this.run(t)}stop(){this.nodes.forEach(t=>t.reject(new Error("Flow stopped")))}cleanup(){this.nodes.sort((t,u)=>u.execOrder-t.execOrder).forEach(t=>t.cleanup())}getVariableNameById(t){const u=this.nodes.find(o=>o.id===t);if(u){const o=u.props.find(d=>d.name==="out");return o?parseValue(o.value):null}return null}dispose(){this.stop(),this.cleanup()}}class ComponentFlowParser extends FlowParser{flow;constructor(t,u){super(t,u),this.flow=u}}exports.AnimationsLoader=AnimationsLoader;exports.AnimationsParser=AnimationsParser;exports.BuildingGroup=BuildingGroup;exports.ComponentFlowParser=ComponentFlowParser;exports.FloorMesh=FloorMesh;exports.FlowParser=FlowParser;exports.Node=Node;exports.PropertiesLoader=PropertiesLoader;exports.SceneLoader=SceneLoader;exports.SemanticLoader=SemanticLoader;exports.SemanticParser=SemanticParser;exports.TopologiesLoader=TopologiesLoader;exports.TopologyParser=TopologyParser;exports.VisionsLoader=VisionsLoader;exports.VisionsParser=VisionsParser;