Files
fad_oa/ruoyi-ui/public/file-viewer/assets/3MFLoader--yjh7udp.js

1 line
13 KiB
JavaScript
Raw Normal View History

import{$ as e,C as t,Ct as n,E as r,Ft as i,H as a,K as o,U as s,at as c,et as l,f as u,l as d,ot as f,p,rt as m,st as h,u as g,w as _,wt as v}from"./three.module-BFsVh7r1.js";import{t as y}from"./fflate.module-BIQmJeC9.js";var b=v,x=class extends o{constructor(e){super(e),this.availableExtensions=[]}load(e,n,r,i){let a=this,o=new t(a.manager);o.setPath(a.path),o.setResponseType(`arraybuffer`),o.setRequestHeader(a.requestHeader),o.setWithCredentials(a.withCredentials),o.load(e,function(t){try{n(a.parse(t))}catch(t){i?i(t):console.error(t),a.manager.itemError(e)}},r,i)}parse(t){let v=this,x=new i(this.manager);function S(e){let t=null,n=null,r,i,a=[],o=[],s,c={},l={},u={},d=new TextDecoder;try{t=y(new Uint8Array(e))}catch(e){if(e instanceof ReferenceError)return console.error(`THREE.3MFLoader: fflate missing and file is compressed.`),null}let f=null;for(n in t)n.match(/\_rels\/.rels$/)?r=n:n.match(/3D\/_rels\/.*\.model\.rels$/)?i=n:n.match(/^3D\/[^\/]*\.model$/)?f=n:n.match(/^3D\/.*\/.*\.model$/)?a.push(n):n.match(/^3D\/Textures?\/.*/)&&o.push(n);if(a.push(f),r===void 0)throw Error("THREE.ThreeMFLoader: Cannot find relationship file `rels` in 3MF archive.");let p=t[r],m=C(d.decode(p));if(i){let e=t[i];s=C(d.decode(e))}for(let e=0;e<a.length;e++){let n=a[e],r=t[n],i=d.decode(r),o=new DOMParser().parseFromString(i,`application/xml`);o.documentElement.nodeName.toLowerCase()!==`model`&&console.error(`THREE.3MFLoader: Error loading 3MF - no 3MF document found: `,n);let s=o.querySelector(`model`),l={};for(let e=0;e<s.attributes.length;e++){let t=s.attributes[e];t.name.match(/^xmlns:(.+)$/)&&(l[t.value]=RegExp.$1)}let u=R(s);u.xml=s,0<Object.keys(l).length&&(u.extensions=l),c[n]=u}for(let e=0;e<o.length;e++){let n=o[e];u[n]=t[n].buffer}return{rels:m,modelRels:s,model:c,printTicket:l,texture:u}}function C(e){let t=[],n=new DOMParser().parseFromString(e,`application/xml`).querySelectorAll(`Relationship`);for(let e=0;e<n.length;e++){let r=n[e],i={target:r.getAttribute(`Target`),id:r.getAttribute(`Id`),type:r.getAttribute(`Type`)};t.push(i)}return t}function w(e){let t={};for(let n=0;n<e.length;n++){let r=e[n],i=r.getAttribute(`name`);0<=[`Title`,`Designer`,`Description`,`Copyright`,`LicenseTerms`,`Rating`,`CreationDate`,`ModificationDate`].indexOf(i)&&(t[i]=r.textContent)}return t}function T(e){let t={id:e.getAttribute(`id`),basematerials:[]},n=e.querySelectorAll(`base`);for(let e=0;e<n.length;e++){let r=n[e],i=A(r);i.index=e,t.basematerials.push(i)}return t}function E(e){return{id:e.getAttribute(`id`),path:e.getAttribute(`path`),contenttype:e.getAttribute(`contenttype`),tilestyleu:e.getAttribute(`tilestyleu`),tilestylev:e.getAttribute(`tilestylev`),filter:e.getAttribute(`filter`)}}function ee(e){let t={id:e.getAttribute(`id`),texid:e.getAttribute(`texid`),displaypropertiesid:e.getAttribute(`displaypropertiesid`)},n=e.querySelectorAll(`tex2coord`),r=[];for(let e=0;e<n.length;e++){let t=n[e],i=t.getAttribute(`u`),a=t.getAttribute(`v`);r.push(parseFloat(i),parseFloat(a))}return t.uvs=new Float32Array(r),t}function te(e){let t={id:e.getAttribute(`id`),displaypropertiesid:e.getAttribute(`displaypropertiesid`)},n=e.querySelectorAll(`color`),r=[],i=new p;for(let e=0;e<n.length;e++){let t=n[e].getAttribute(`color`);i.setStyle(t.substring(0,7),b),r.push(i.r,i.g,i.b)}return t.colors=new Float32Array(r),t}function D(e){let t=e.children,n={};for(let e=0;e<t.length;e++){let r={type:t[e].nodeName.substring(2)};for(let n=0;n<t[e].attributes.length;n++){let i=t[e].attributes[n];i.specified&&(r[i.name]=i.value)}n[t[e].getAttribute(`identifier`)]=r}return n}function O(e){let t={id:e.getAttribute(`id`),displayname:e.getAttribute(`displayname`)},n=e.children,r={};for(let e=0;e<n.length;e++){let t=n[e];if(t.nodeName===`i:in`||t.nodeName===`i:out`)r[t.nodeName===`i:in`?`inputs`:`outputs`]=D(t);else{let e=t.children,n={op:t.nodeName.substring(2),identifier:t.getAttribute(`identifier`)};for(let t=0;t<e.length;t++)n[e[t].nodeName.substring(2)]=D(e[t]);r[n.identifier]=n}}return t.operations=r,t}function k(e){let t={id:e.getAttribute(`id`)},n=e.querySelect