@thatopen/components 2.1.27 → 2.2.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/Components/index.d.ts +1 -1
- package/dist/core/Types/src/data-map.d.ts +12 -1
- package/dist/core/Types/src/data-set.d.ts +12 -2
- package/dist/core/Viewpoints/index.d.ts +27 -0
- package/dist/core/Viewpoints/src/Viewpoint.d.ts +43 -0
- package/dist/core/Viewpoints/src/index.d.ts +2 -0
- package/dist/core/Viewpoints/src/types.d.ts +33 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/fragments/FragmentsManager/index.d.ts +9 -1
- package/dist/index.cjs +2198 -7
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +17823 -4731
- package/dist/namespace.d.ts +3043 -2430
- package/dist/openbim/BCFTopics/index.d.ts +92 -0
- package/dist/openbim/BCFTopics/src/Comment.d.ts +35 -0
- package/dist/openbim/BCFTopics/src/Topic.d.ts +129 -0
- package/dist/openbim/BCFTopics/src/TopicComments/index.d.ts +12 -0
- package/dist/openbim/BCFTopics/src/TopicComments/src/template.d.ts +20 -0
- package/dist/openbim/BCFTopics/src/TopicForm/index.d.ts +10 -0
- package/dist/openbim/BCFTopics/src/TopicForm/src/template.d.ts +20 -0
- package/dist/openbim/BCFTopics/src/TopicPanel/index.d.ts +12 -0
- package/dist/openbim/BCFTopics/src/TopicPanel/src/template.d.ts +46 -0
- package/dist/openbim/BCFTopics/src/TopicsList/index.d.ts +12 -0
- package/dist/openbim/BCFTopics/src/TopicsList/src/template.d.ts +29 -0
- package/dist/openbim/BCFTopics/src/ViewpointsList/index.d.ts +12 -0
- package/dist/openbim/BCFTopics/src/ViewpointsList/src/template.d.ts +19 -0
- package/dist/openbim/BCFTopics/src/index.d.ts +7 -0
- package/dist/openbim/BCFTopics/src/types.d.ts +35 -0
- package/dist/openbim/index.d.ts +1 -0
- package/package.json +3 -1
package/dist/index.cjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
"use strict";var qn=Object.defineProperty;var Kn=(l,s,t)=>s in l?qn(l,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):l[s]=t;var u=(l,s,t)=>(Kn(l,typeof s!="symbol"?s+"":s,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("three"),pn=require("@thatopen/fragments"),$n=require("web-ifc");function Oi(l){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const t in l)if(t!=="default"){const e=Object.getOwnPropertyDescriptor(l,t);Object.defineProperty(s,t,e.get?e:{enumerable:!0,get:()=>l[t]})}}return s.default=l,Object.freeze(s)}const g=Oi(C),Dt=Oi(pn),D=Oi($n),Cn=0,Jn=1,to=2,Di=2,vs=1.25,xi=1,rs=6*4+4+4,Ns=65535,eo=Math.pow(2,-24),Bs=Symbol("SKIP_GENERATION");function so(l){return l.index?l.index.count:l.attributes.position.count}function he(l){return so(l)/3}function io(l,s=ArrayBuffer){return l>65535?new Uint32Array(new s(4*l)):new Uint16Array(new s(2*l))}function no(l,s){if(!l.index){const t=l.attributes.position.count,e=s.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,i=io(t,e);l.setIndex(new C.BufferAttribute(i,1));for(let o=0;o<t;o++)i[o]=o}}function Tn(l){const s=he(l),t=l.drawRange,e=t.start/3,i=(t.start+t.count)/3,o=Math.max(0,e),n=Math.min(s,i)-o;return[{offset:Math.floor(o),count:Math.floor(n)}]}function mn(l){if(!l.groups||!l.groups.length)return Tn(l);const s=[],t=new Set,e=l.drawRange,i=e.start/3,o=(e.start+e.count)/3;for(const r of l.groups){const a=r.start/3,c=(r.start+r.count)/3;t.add(Math.max(i,a)),t.add(Math.min(o,c))}const n=Array.from(t.values()).sort((r,a)=>r-a);for(let r=0;r<n.length-1;r++){const a=n[r],c=n[r+1];s.push({offset:Math.floor(a),count:Math.floor(c-a)})}return s}function oo(l){if(l.groups.length===0)return!1;const s=he(l),t=mn(l).sort((o,n)=>o.offset-n.offset),e=t[t.length-1];e.count=Math.min(s-e.offset,e.count);let i=0;return t.forEach(({count:o})=>i+=o),s!==i}function q(l,s,t){return t.min.x=s[l],t.min.y=s[l+1],t.min.z=s[l+2],t.max.x=s[l+3],t.max.y=s[l+4],t.max.z=s[l+5],t}function ro(l){l[0]=l[1]=l[2]=1/0,l[3]=l[4]=l[5]=-1/0}function Ui(l){let s=-1,t=-1/0;for(let e=0;e<3;e++){const i=l[e+3]-l[e];i>t&&(t=i,s=e)}return s}function bi(l,s){s.set(l)}function vi(l,s,t){let e,i;for(let o=0;o<3;o++){const n=o+3;e=l[o],i=s[o],t[o]=e<i?e:i,e=l[n],i=s[n],t[n]=e>i?e:i}}function ve(l,s,t){for(let e=0;e<3;e++){const i=s[l+2*e],o=s[l+2*e+1],n=i-o,r=i+o;n<t[e]&&(t[e]=n),r>t[e+3]&&(t[e+3]=r)}}function ue(l){const s=l[3]-l[0],t=l[4]-l[1],e=l[5]-l[2];return 2*(s*t+t*e+e*s)}function Vs(l,s,t,e,i=null){let o=1/0,n=1/0,r=1/0,a=-1/0,c=-1/0,h=-1/0,E=1/0,d=1/0,I=1/0,f=-1/0,T=-1/0,F=-1/0;const m=i!==null;for(let A=s*6,O=(s+t)*6;A<O;A+=6){const p=l[A+0],R=l[A+1],S=p-R,_=p+R;S<o&&(o=S),_>a&&(a=_),m&&p<E&&(E=p),m&&p>f&&(f=p);const y=l[A+2],N=l[A+3],P=y-N,x=y+N;P<n&&(n=P),x>c&&(c=x),m&&y<d&&(d=y),m&&y>T&&(T=y);const w=l[A+4],U=l[A+5],b=w-U,v=w+U;b<r&&(r=b),v>h&&(h=v),m&&w<I&&(I=w),m&&w>F&&(F=w)}e[0]=o,e[1]=n,e[2]=r,e[3]=a,e[4]=c,e[5]=h,m&&(i[0]=E,i[1]=d,i[2]=I,i[3]=f,i[4]=T,i[5]=F)}function ao(l,s,t,e){let i=1/0,o=1/0,n=1/0,r=-1/0,a=-1/0,c=-1/0;for(let h=s*6,E=(s+t)*6;h<E;h+=6){const d=l[h+0];d<i&&(i=d),d>r&&(r=d);const I=l[h+2];I<o&&(o=I),I>a&&(a=I);const f=l[h+4];f<n&&(n=f),f>c&&(c=f)}e[0]=i,e[1]=o,e[2]=n,e[3]=r,e[4]=a,e[5]=c}function co(l,s){ro(s);const t=l.attributes.position,e=l.index?l.index.array:null,i=he(l),o=new Float32Array(i*6),n=t.normalized,r=t.array,a=t.offset||0;let c=3;t.isInterleavedBufferAttribute&&(c=t.data.stride);const h=["getX","getY","getZ"];for(let E=0;E<i;E++){const d=E*3,I=E*6;let f=d+0,T=d+1,F=d+2;e&&(f=e[f],T=e[T],F=e[F]),n||(f=f*c+a,T=T*c+a,F=F*c+a);for(let m=0;m<3;m++){let A,O,p;n?(A=t[h[m]](f),O=t[h[m]](T),p=t[h[m]](F)):(A=r[f+m],O=r[T+m],p=r[F+m]);let R=A;O<R&&(R=O),p<R&&(R=p);let S=A;O>S&&(S=O),p>S&&(S=p);const _=(S-R)/2,y=m*2;o[I+y+0]=R+_,o[I+y+1]=_+(Math.abs(R)+_)*eo,R<s[m]&&(s[m]=R),S>s[m+3]&&(s[m+3]=S)}}return o}const Ot=32,lo=(l,s)=>l.candidate-s.candidate,yt=new Array(Ot).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),Be=new Float32Array(6);function ho(l,s,t,e,i,o){let n=-1,r=0;if(o===Cn)n=Ui(s),n!==-1&&(r=(s[n]+s[n+3])/2);else if(o===Jn)n=Ui(l),n!==-1&&(r=Eo(t,e,i,n));else if(o===to){const a=ue(l);let c=vs*i;const h=e*6,E=(e+i)*6;for(let d=0;d<3;d++){const I=s[d],F=(s[d+3]-I)/Ot;if(i<Ot/4){const m=[...yt];m.length=i;let A=0;for(let p=h;p<E;p+=6,A++){const R=m[A];R.candidate=t[p+2*d],R.count=0;const{bounds:S,leftCacheBounds:_,rightCacheBounds:y}=R;for(let N=0;N<3;N++)y[N]=1/0,y[N+3]=-1/0,_[N]=1/0,_[N+3]=-1/0,S[N]=1/0,S[N+3]=-1/0;ve(p,t,S)}m.sort(lo);let O=i;for(let p=0;p<O;p++){const R=m[p];for(;p+1<O&&m[p+1].candidate===R.candidate;)m.splice(p+1,1),O--}for(let p=h;p<E;p+=6){const R=t[p+2*d];for(let S=0;S<O;S++){const _=m[S];R>=_.candidate?ve(p,t,_.rightCacheBounds):(ve(p,t,_.leftCacheBounds),_.count++)}}for(let p=0;p<O;p++){const R=m[p],S=R.count,_=i-R.count,y=R.leftCacheBounds,N=R.rightCacheBounds;let P=0;S!==0&&(P=ue(y)/a);let x=0;_!==0&&(x=ue(N)/a);const w=xi+vs*(P*S+x*_);w<c&&(n=d,c=w,r=R.candidate)}}else{for(let O=0;O<Ot;O++){const p=yt[O];p.count=0,p.candidate=I+F+O*F;const R=p.bounds;for(let S=0;S<3;S++)R[S]=1/0,R[S+3]=-1/0}for(let O=h;O<E;O+=6){let S=~~((t[O+2*d]-I)/F);S>=Ot&&(S=Ot-1);const _=yt[S];_.count++,ve(O,t,_.bounds)}const m=yt[Ot-1];bi(m.bounds,m.rightCacheBounds);for(let O=Ot-2;O>=0;O--){const p=yt[O],R=yt[O+1];vi(p.bounds,R.rightCacheBounds,p.rightCacheBounds)}let A=0;for(let O=0;O<Ot-1;O++){const p=yt[O],R=p.count,S=p.bounds,y=yt[O+1].rightCacheBounds;R!==0&&(A===0?bi(S,Be):vi(S,Be,Be)),A+=R;let N=0,P=0;A!==0&&(N=ue(Be)/a);const x=i-A;x!==0&&(P=ue(y)/a);const w=xi+vs*(N*A+P*x);w<c&&(n=d,c=w,r=p.candidate)}}}}else console.warn(`MeshBVH: Invalid build strategy value ${o} used.`);return{axis:n,pos:r}}function Eo(l,s,t,e){let i=0;for(let o=s,n=s+t;o<n;o++)i+=l[o*6+e*2];return i/t}class Ve{constructor(){}}function uo(l,s,t,e,i,o){let n=e,r=e+i-1;const a=o.pos,c=o.axis*2;for(;;){for(;n<=r&&t[n*6+c]<a;)n++;for(;n<=r&&t[r*6+c]>=a;)r--;if(n<r){for(let h=0;h<3;h++){let E=s[n*3+h];s[n*3+h]=s[r*3+h],s[r*3+h]=E}for(let h=0;h<6;h++){let E=t[n*6+h];t[n*6+h]=t[r*6+h],t[r*6+h]=E}n++,r--}else return n}}function Io(l,s,t,e,i,o){let n=e,r=e+i-1;const a=o.pos,c=o.axis*2;for(;;){for(;n<=r&&t[n*6+c]<a;)n++;for(;n<=r&&t[r*6+c]>=a;)r--;if(n<r){let h=l[n];l[n]=l[r],l[r]=h;for(let E=0;E<6;E++){let d=t[n*6+E];t[n*6+E]=t[r*6+E],t[r*6+E]=d}n++,r--}else return n}}function fo(l,s){const t=(l.index?l.index.count:l.attributes.position.count)/3,e=t>2**16,i=e?4:2,o=s?new SharedArrayBuffer(t*i):new ArrayBuffer(t*i),n=e?new Uint32Array(o):new Uint16Array(o);for(let r=0,a=n.length;r<a;r++)n[r]=r;return n}function po(l,s){const t=l.geometry,e=t.index?t.index.array:null,i=s.maxDepth,o=s.verbose,n=s.maxLeafTris,r=s.strategy,a=s.onProgress,c=he(t),h=l._indirectBuffer;let E=!1;const d=new Float32Array(6),I=new Float32Array(6),f=co(t,d),T=s.indirect?Io:uo,F=[],m=s.indirect?Tn(t):mn(t);if(m.length===1){const p=m[0],R=new Ve;R.boundingData=d,ao(f,p.offset,p.count,I),O(R,p.offset,p.count,I),F.push(R)}else for(let p of m){const R=new Ve;R.boundingData=new Float32Array(6),Vs(f,p.offset,p.count,R.boundingData,I),O(R,p.offset,p.count,I),F.push(R)}return F;function A(p){a&&a(p/c)}function O(p,R,S,_=null,y=0){if(!E&&y>=i&&(E=!0,o&&(console.warn(`MeshBVH: Max depth of ${i} reached when generating BVH. Consider increasing maxDepth.`),console.warn(t))),S<=n||y>=i)return A(R+S),p.offset=R,p.count=S,p;const N=ho(p.boundingData,_,f,R,S,r);if(N.axis===-1)return A(R+S),p.offset=R,p.count=S,p;const P=T(h,e,f,R,S,N);if(P===R||P===R+S)A(R+S),p.offset=R,p.count=S;else{p.splitAxis=N.axis;const x=new Ve,w=R,U=P-R;p.left=x,x.boundingData=new Float32Array(6),Vs(f,w,U,x.boundingData,I),O(x,w,U,I,y+1);const b=new Ve,v=P,z=S-U;p.right=b,b.boundingData=new Float32Array(6),Vs(f,v,z,b.boundingData,I),O(b,v,z,I,y+1)}return p}}function Co(l,s){const t=l.geometry;s.indirect&&(l._indirectBuffer=fo(t,s.useSharedArrayBuffer),oo(t)&&!s.verbose&&console.warn('MeshBVH: Provided geometry contains groups that do not fully span the vertex contents while using the "indirect" option. BVH may incorrectly report intersections on unrendered portions of the geometry.')),l._indirectBuffer||no(t,s);const e=po(l,s);let i,o,n;const r=[],a=s.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;for(let E=0;E<e.length;E++){const d=e[E];let I=c(d);const f=new a(rs*I);i=new Float32Array(f),o=new Uint32Array(f),n=new Uint16Array(f),h(0,d),r.push(f)}l._roots=r;return;function c(E){return E.count?1:1+c(E.left)+c(E.right)}function h(E,d){const I=E/4,f=E/2,T=!!d.count,F=d.boundingData;for(let m=0;m<6;m++)i[I+m]=F[m];if(T){const m=d.offset,A=d.count;return o[I+6]=m,n[f+14]=A,n[f+15]=Ns,E+rs}else{const m=d.left,A=d.right,O=d.splitAxis;let p;if(p=h(E+rs,m),p/4>Math.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return o[I+6]=p/4,p=h(p,A),o[I+7]=O,p}}}class St{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(s,t){let e=1/0,i=-1/0;for(let o=0,n=s.length;o<n;o++){const a=s[o][t];e=a<e?a:e,i=a>i?a:i}this.min=e,this.max=i}setFromPoints(s,t){let e=1/0,i=-1/0;for(let o=0,n=t.length;o<n;o++){const r=t[o],a=s.dot(r);e=a<e?a:e,i=a>i?a:i}this.min=e,this.max=i}isSeparated(s){return this.min>s.max||s.min>this.max}}St.prototype.setFromBox=function(){const l=new C.Vector3;return function(t,e){const i=e.min,o=e.max;let n=1/0,r=-1/0;for(let a=0;a<=1;a++)for(let c=0;c<=1;c++)for(let h=0;h<=1;h++){l.x=i.x*a+o.x*(1-a),l.y=i.y*c+o.y*(1-c),l.z=i.z*h+o.z*(1-h);const E=t.dot(l);n=Math.min(E,n),r=Math.max(E,r)}this.min=n,this.max=r}}();const To=function(){const l=new C.Vector3,s=new C.Vector3,t=new C.Vector3;return function(i,o,n){const r=i.start,a=l,c=o.start,h=s;t.subVectors(r,c),l.subVectors(i.end,i.start),s.subVectors(o.end,o.start);const E=t.dot(h),d=h.dot(a),I=h.dot(h),f=t.dot(a),F=a.dot(a)*I-d*d;let m,A;F!==0?m=(E*d-f*I)/F:m=0,A=(E+m*d)/I,n.x=m,n.y=A}}(),Si=function(){const l=new C.Vector2,s=new C.Vector3,t=new C.Vector3;return function(i,o,n,r){To(i,o,l);let a=l.x,c=l.y;if(a>=0&&a<=1&&c>=0&&c<=1){i.at(a,n),o.at(c,r);return}else if(a>=0&&a<=1){c<0?o.at(0,r):o.at(1,r),i.closestPointToPoint(r,!0,n);return}else if(c>=0&&c<=1){a<0?i.at(0,n):i.at(1,n),o.closestPointToPoint(n,!0,r);return}else{let h;a<0?h=i.start:h=i.end;let E;c<0?E=o.start:E=o.end;const d=s,I=t;if(i.closestPointToPoint(E,!0,s),o.closestPointToPoint(h,!0,t),d.distanceToSquared(E)<=I.distanceToSquared(h)){n.copy(d),r.copy(E);return}else{n.copy(h),r.copy(I);return}}}}(),mo=function(){const l=new C.Vector3,s=new C.Vector3,t=new C.Plane,e=new C.Line3;return function(o,n){const{radius:r,center:a}=o,{a:c,b:h,c:E}=n;if(e.start=c,e.end=h,e.closestPointToPoint(a,!0,l).distanceTo(a)<=r||(e.start=c,e.end=E,e.closestPointToPoint(a,!0,l).distanceTo(a)<=r)||(e.start=h,e.end=E,e.closestPointToPoint(a,!0,l).distanceTo(a)<=r))return!0;const T=n.getPlane(t);if(Math.abs(T.distanceToPoint(a))<=r){const m=T.projectPoint(a,s);if(n.containsPoint(m))return!0}return!1}}(),Ro=1e-15;function Ys(l){return Math.abs(l)<Ro}class mt extends C.Triangle{constructor(...s){super(...s),this.isExtendedTriangle=!0,this.satAxes=new Array(4).fill().map(()=>new C.Vector3),this.satBounds=new Array(4).fill().map(()=>new St),this.points=[this.a,this.b,this.c],this.sphere=new C.Sphere,this.plane=new C.Plane,this.needsUpdate=!0}intersectsSphere(s){return mo(s,this)}update(){const s=this.a,t=this.b,e=this.c,i=this.points,o=this.satAxes,n=this.satBounds,r=o[0],a=n[0];this.getNormal(r),a.setFromPoints(r,i);const c=o[1],h=n[1];c.subVectors(s,t),h.setFromPoints(c,i);const E=o[2],d=n[2];E.subVectors(t,e),d.setFromPoints(E,i);const I=o[3],f=n[3];I.subVectors(e,s),f.setFromPoints(I,i),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(r,s),this.needsUpdate=!1}}mt.prototype.closestPointToSegment=function(){const l=new C.Vector3,s=new C.Vector3,t=new C.Line3;return function(i,o=null,n=null){const{start:r,end:a}=i,c=this.points;let h,E=1/0;for(let d=0;d<3;d++){const I=(d+1)%3;t.start.copy(c[d]),t.end.copy(c[I]),Si(t,i,l,s),h=l.distanceToSquared(s),h<E&&(E=h,o&&o.copy(l),n&&n.copy(s))}return this.closestPointToPoint(r,l),h=r.distanceToSquared(l),h<E&&(E=h,o&&o.copy(l),n&&n.copy(r)),this.closestPointToPoint(a,l),h=a.distanceToSquared(l),h<E&&(E=h,o&&o.copy(l),n&&n.copy(a)),Math.sqrt(E)}}();mt.prototype.intersectsTriangle=function(){const l=new mt,s=new Array(3),t=new Array(3),e=new St,i=new St,o=new C.Vector3,n=new C.Vector3,r=new C.Vector3,a=new C.Vector3,c=new C.Vector3,h=new C.Line3,E=new C.Line3,d=new C.Line3,I=new C.Vector3;function f(T,F,m){const A=T.points;let O=0,p=-1;for(let R=0;R<3;R++){const{start:S,end:_}=h;S.copy(A[R]),_.copy(A[(R+1)%3]),h.delta(n);const y=Ys(F.distanceToPoint(S));if(Ys(F.normal.dot(n))&&y){m.copy(h),O=2;break}const N=F.intersectLine(h,I);if(!N&&y&&I.copy(S),(N||y)&&!Ys(I.distanceTo(_))){if(O<=1)(O===1?m.start:m.end).copy(I),y&&(p=O);else if(O>=2){(p===1?m.start:m.end).copy(I),O=2;break}if(O++,O===2&&p===-1)break}}return O}return function(F,m=null,A=!1){this.needsUpdate&&this.update(),F.isExtendedTriangle?F.needsUpdate&&F.update():(l.copy(F),l.update(),F=l);const O=this.plane,p=F.plane;if(Math.abs(O.normal.dot(p.normal))>1-1e-10){const R=this.satBounds,S=this.satAxes;t[0]=F.a,t[1]=F.b,t[2]=F.c;for(let N=0;N<4;N++){const P=R[N],x=S[N];if(e.setFromPoints(x,t),P.isSeparated(e))return!1}const _=F.satBounds,y=F.satAxes;s[0]=this.a,s[1]=this.b,s[2]=this.c;for(let N=0;N<4;N++){const P=_[N],x=y[N];if(e.setFromPoints(x,s),P.isSeparated(e))return!1}for(let N=0;N<4;N++){const P=S[N];for(let x=0;x<4;x++){const w=y[x];if(o.crossVectors(P,w),e.setFromPoints(o,s),i.setFromPoints(o,t),e.isSeparated(i))return!1}}return m&&(A||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),m.start.set(0,0,0),m.end.set(0,0,0)),!0}else{const R=f(this,p,E);if(R===1&&F.containsPoint(E.end))return m&&(m.start.copy(E.end),m.end.copy(E.end)),!0;if(R!==2)return!1;const S=f(F,O,d);if(S===1&&this.containsPoint(d.end))return m&&(m.start.copy(d.end),m.end.copy(d.end)),!0;if(S!==2)return!1;if(E.delta(r),d.delta(a),r.dot(a)<0){let U=d.start;d.start=d.end,d.end=U}const _=E.start.dot(r),y=E.end.dot(r),N=d.start.dot(r),P=d.end.dot(r),x=y<N,w=_<P;return _!==P&&N!==y&&x===w?!1:(m&&(c.subVectors(E.start,d.start),c.dot(r)>0?m.start.copy(E.start):m.start.copy(d.start),c.subVectors(E.end,d.end),c.dot(r)<0?m.end.copy(E.end):m.end.copy(d.end)),!0)}}}();mt.prototype.distanceToPoint=function(){const l=new C.Vector3;return function(t){return this.closestPointToPoint(t,l),t.distanceTo(l)}}();mt.prototype.distanceToTriangle=function(){const l=new C.Vector3,s=new C.Vector3,t=["a","b","c"],e=new C.Line3,i=new C.Line3;return function(n,r=null,a=null){const c=r||a?e:null;if(this.intersectsTriangle(n,c))return(r||a)&&(r&&c.getCenter(r),a&&c.getCenter(a)),0;let h=1/0;for(let E=0;E<3;E++){let d;const I=t[E],f=n[I];this.closestPointToPoint(f,l),d=f.distanceToSquared(l),d<h&&(h=d,r&&r.copy(l),a&&a.copy(f));const T=this[I];n.closestPointToPoint(T,l),d=T.distanceToSquared(l),d<h&&(h=d,r&&r.copy(T),a&&a.copy(l))}for(let E=0;E<3;E++){const d=t[E],I=t[(E+1)%3];e.set(this[d],this[I]);for(let f=0;f<3;f++){const T=t[f],F=t[(f+1)%3];i.set(n[T],n[F]),Si(e,i,l,s);const m=l.distanceToSquared(s);m<h&&(h=m,r&&r.copy(l),a&&a.copy(s))}}return Math.sqrt(h)}}();class rt{constructor(s,t,e){this.isOrientedBox=!0,this.min=new C.Vector3,this.max=new C.Vector3,this.matrix=new C.Matrix4,this.invMatrix=new C.Matrix4,this.points=new Array(8).fill().map(()=>new C.Vector3),this.satAxes=new Array(3).fill().map(()=>new C.Vector3),this.satBounds=new Array(3).fill().map(()=>new St),this.alignedSatBounds=new Array(3).fill().map(()=>new St),this.needsUpdate=!1,s&&this.min.copy(s),t&&this.max.copy(t),e&&this.matrix.copy(e)}set(s,t,e){this.min.copy(s),this.max.copy(t),this.matrix.copy(e),this.needsUpdate=!0}copy(s){this.min.copy(s.min),this.max.copy(s.max),this.matrix.copy(s.matrix),this.needsUpdate=!0}}rt.prototype.update=function(){return function(){const s=this.matrix,t=this.min,e=this.max,i=this.points;for(let c=0;c<=1;c++)for(let h=0;h<=1;h++)for(let E=0;E<=1;E++){const d=1*c|2*h|4*E,I=i[d];I.x=c?e.x:t.x,I.y=h?e.y:t.y,I.z=E?e.z:t.z,I.applyMatrix4(s)}const o=this.satBounds,n=this.satAxes,r=i[0];for(let c=0;c<3;c++){const h=n[c],E=o[c],d=1<<c,I=i[d];h.subVectors(r,I),E.setFromPoints(h,i)}const a=this.alignedSatBounds;a[0].setFromPointsField(i,"x"),a[1].setFromPointsField(i,"y"),a[2].setFromPointsField(i,"z"),this.invMatrix.copy(this.matrix).invert(),this.needsUpdate=!1}}();rt.prototype.intersectsBox=function(){const l=new St;return function(t){this.needsUpdate&&this.update();const e=t.min,i=t.max,o=this.satBounds,n=this.satAxes,r=this.alignedSatBounds;if(l.min=e.x,l.max=i.x,r[0].isSeparated(l)||(l.min=e.y,l.max=i.y,r[1].isSeparated(l))||(l.min=e.z,l.max=i.z,r[2].isSeparated(l)))return!1;for(let a=0;a<3;a++){const c=n[a],h=o[a];if(l.setFromBox(c,t),h.isSeparated(l))return!1}return!0}}();rt.prototype.intersectsTriangle=function(){const l=new mt,s=new Array(3),t=new St,e=new St,i=new C.Vector3;return function(n){this.needsUpdate&&this.update(),n.isExtendedTriangle?n.needsUpdate&&n.update():(l.copy(n),l.update(),n=l);const r=this.satBounds,a=this.satAxes;s[0]=n.a,s[1]=n.b,s[2]=n.c;for(let d=0;d<3;d++){const I=r[d],f=a[d];if(t.setFromPoints(f,s),I.isSeparated(t))return!1}const c=n.satBounds,h=n.satAxes,E=this.points;for(let d=0;d<3;d++){const I=c[d],f=h[d];if(t.setFromPoints(f,E),I.isSeparated(t))return!1}for(let d=0;d<3;d++){const I=a[d];for(let f=0;f<4;f++){const T=h[f];if(i.crossVectors(I,T),t.setFromPoints(i,s),e.setFromPoints(i,E),t.isSeparated(e))return!1}}return!0}}();rt.prototype.closestPointToPoint=function(){return function(s,t){return this.needsUpdate&&this.update(),t.copy(s).applyMatrix4(this.invMatrix).clamp(this.min,this.max).applyMatrix4(this.matrix),t}}();rt.prototype.distanceToPoint=function(){const l=new C.Vector3;return function(t){return this.closestPointToPoint(t,l),t.distanceTo(l)}}();rt.prototype.distanceToBox=function(){const l=["x","y","z"],s=new Array(12).fill().map(()=>new C.Line3),t=new Array(12).fill().map(()=>new C.Line3),e=new C.Vector3,i=new C.Vector3;return function(n,r=0,a=null,c=null){if(this.needsUpdate&&this.update(),this.intersectsBox(n))return(a||c)&&(n.getCenter(i),this.closestPointToPoint(i,e),n.closestPointToPoint(e,i),a&&a.copy(e),c&&c.copy(i)),0;const h=r*r,E=n.min,d=n.max,I=this.points;let f=1/0;for(let F=0;F<8;F++){const m=I[F];i.copy(m).clamp(E,d);const A=m.distanceToSquared(i);if(A<f&&(f=A,a&&a.copy(m),c&&c.copy(i),A<h))return Math.sqrt(A)}let T=0;for(let F=0;F<3;F++)for(let m=0;m<=1;m++)for(let A=0;A<=1;A++){const O=(F+1)%3,p=(F+2)%3,R=m<<O|A<<p,S=1<<F|m<<O|A<<p,_=I[R],y=I[S];s[T].set(_,y);const P=l[F],x=l[O],w=l[p],U=t[T],b=U.start,v=U.end;b[P]=E[P],b[x]=m?E[x]:d[x],b[w]=A?E[w]:d[x],v[P]=d[P],v[x]=m?E[x]:d[x],v[w]=A?E[w]:d[x],T++}for(let F=0;F<=1;F++)for(let m=0;m<=1;m++)for(let A=0;A<=1;A++){i.x=F?d.x:E.x,i.y=m?d.y:E.y,i.z=A?d.z:E.z,this.closestPointToPoint(i,e);const O=i.distanceToSquared(e);if(O<f&&(f=O,a&&a.copy(e),c&&c.copy(i),O<h))return Math.sqrt(O)}for(let F=0;F<12;F++){const m=s[F];for(let A=0;A<12;A++){const O=t[A];Si(m,O,e,i);const p=e.distanceToSquared(i);if(p<f&&(f=p,a&&a.copy(e),c&&c.copy(i),p<h))return Math.sqrt(p)}}return Math.sqrt(f)}}();class _i{constructor(s){this._getNewPrimitive=s,this._primitives=[]}getPrimitive(){const s=this._primitives;return s.length===0?this._getNewPrimitive():s.pop()}releasePrimitive(s){this._primitives.push(s)}}class Fo extends _i{constructor(){super(()=>new mt)}}const dt=new Fo;function ct(l,s){return s[l+15]===65535}function lt(l,s){return s[l+6]}function Et(l,s){return s[l+14]}function ut(l){return l+8}function It(l,s){return s[l+6]}function Rn(l,s){return s[l+7]}class Ao{constructor(){this.float32Array=null,this.uint16Array=null,this.uint32Array=null;const s=[];let t=null;this.setBuffer=e=>{t&&s.push(t),t=e,this.float32Array=new Float32Array(e),this.uint16Array=new Uint16Array(e),this.uint32Array=new Uint32Array(e)},this.clearBuffer=()=>{t=null,this.float32Array=null,this.uint16Array=null,this.uint32Array=null,s.length!==0&&this.setBuffer(s.pop())}}}const X=new Ao;let Mt,re;const Xt=[],Ye=new _i(()=>new C.Box3);function go(l,s,t,e,i,o){Mt=Ye.getPrimitive(),re=Ye.getPrimitive(),Xt.push(Mt,re),X.setBuffer(l._roots[s]);const n=ni(0,l.geometry,t,e,i,o);X.clearBuffer(),Ye.releasePrimitive(Mt),Ye.releasePrimitive(re),Xt.pop(),Xt.pop();const r=Xt.length;return r>0&&(re=Xt[r-1],Mt=Xt[r-2]),n}function ni(l,s,t,e,i=null,o=0,n=0){const{float32Array:r,uint16Array:a,uint32Array:c}=X;let h=l*2;if(ct(h,a)){const d=lt(l,c),I=Et(h,a);return q(l,r,Mt),e(d,I,!1,n,o+l,Mt)}else{let P=function(w){const{uint16Array:U,uint32Array:b}=X;let v=w*2;for(;!ct(v,U);)w=ut(w),v=w*2;return lt(w,b)},x=function(w){const{uint16Array:U,uint32Array:b}=X;let v=w*2;for(;!ct(v,U);)w=It(w,b),v=w*2;return lt(w,b)+Et(v,U)};const d=ut(l),I=It(l,c);let f=d,T=I,F,m,A,O;if(i&&(A=Mt,O=re,q(f,r,A),q(T,r,O),F=i(A),m=i(O),m<F)){f=I,T=d;const w=F;F=m,m=w,A=O}A||(A=Mt,q(f,r,A));const p=ct(f*2,a),R=t(A,p,F,n+1,o+f);let S;if(R===Di){const w=P(f),b=x(f)-w;S=e(w,b,!0,n+1,o+f,A)}else S=R&&ni(f,s,t,e,i,o,n+1);if(S)return!0;O=re,q(T,r,O);const _=ct(T*2,a),y=t(O,_,m,n+1,o+T);let N;if(y===Di){const w=P(T),b=x(T)-w;N=e(w,b,!0,n+1,o+T,O)}else N=y&&ni(T,s,t,e,i,o,n+1);return!!N}}const Ie=new C.Vector3,Gs=new C.Vector3;function Oo(l,s,t={},e=0,i=1/0){const o=e*e,n=i*i;let r=1/0,a=null;if(l.shapecast({boundsTraverseOrder:h=>(Ie.copy(s).clamp(h.min,h.max),Ie.distanceToSquared(s)),intersectsBounds:(h,E,d)=>d<r&&d<n,intersectsTriangle:(h,E)=>{h.closestPointToPoint(s,Ie);const d=s.distanceToSquared(Ie);return d<r&&(Gs.copy(Ie),r=d,a=E),d<o}}),r===1/0)return null;const c=Math.sqrt(r);return t.point?t.point.copy(Gs):t.point=Gs.clone(),t.distance=c,t.faceIndex=a,t}const Zt=new C.Vector3,Qt=new C.Vector3,jt=new C.Vector3,Ge=new C.Vector2,ze=new C.Vector2,He=new C.Vector2,Bi=new C.Vector3,Vi=new C.Vector3,Yi=new C.Vector3,We=new C.Vector3;function So(l,s,t,e,i,o){let n;return o===C.BackSide?n=l.intersectTriangle(e,t,s,!0,i):n=l.intersectTriangle(s,t,e,o!==C.DoubleSide,i),n===null?null:{distance:l.origin.distanceTo(i),point:i.clone()}}function _o(l,s,t,e,i,o,n,r,a){Zt.fromBufferAttribute(s,o),Qt.fromBufferAttribute(s,n),jt.fromBufferAttribute(s,r);const c=So(l,Zt,Qt,jt,We,a);if(c){e&&(Ge.fromBufferAttribute(e,o),ze.fromBufferAttribute(e,n),He.fromBufferAttribute(e,r),c.uv=C.Triangle.getInterpolation(We,Zt,Qt,jt,Ge,ze,He,new C.Vector2)),i&&(Ge.fromBufferAttribute(i,o),ze.fromBufferAttribute(i,n),He.fromBufferAttribute(i,r),c.uv1=C.Triangle.getInterpolation(We,Zt,Qt,jt,Ge,ze,He,new C.Vector2)),t&&(Bi.fromBufferAttribute(t,o),Vi.fromBufferAttribute(t,n),Yi.fromBufferAttribute(t,r),c.normal=C.Triangle.getInterpolation(We,Zt,Qt,jt,Bi,Vi,Yi,new C.Vector3),c.normal.dot(l.direction)>0&&c.normal.multiplyScalar(-1));const h={a:o,b:n,c:r,normal:new C.Vector3,materialIndex:0};C.Triangle.getNormal(Zt,Qt,jt,h.normal),c.face=h,c.faceIndex=o}return c}function Ls(l,s,t,e,i){const o=e*3;let n=o+0,r=o+1,a=o+2;const c=l.index;l.index&&(n=c.getX(n),r=c.getX(r),a=c.getX(a));const{position:h,normal:E,uv:d,uv1:I}=l.attributes,f=_o(t,h,E,d,I,n,r,a,s);return f?(f.faceIndex=e,i&&i.push(f),f):null}function tt(l,s,t,e){const i=l.a,o=l.b,n=l.c;let r=s,a=s+1,c=s+2;t&&(r=t.getX(r),a=t.getX(a),c=t.getX(c)),i.x=e.getX(r),i.y=e.getY(r),i.z=e.getZ(r),o.x=e.getX(a),o.y=e.getY(a),o.z=e.getZ(a),n.x=e.getX(c),n.y=e.getY(c),n.z=e.getZ(c)}function yo(l,s,t,e,i,o){const{geometry:n,_indirectBuffer:r}=l;for(let a=e,c=e+i;a<c;a++)Ls(n,s,t,a,o)}function No(l,s,t,e,i){const{geometry:o,_indirectBuffer:n}=l;let r=1/0,a=null;for(let c=e,h=e+i;c<h;c++){let E;E=Ls(o,s,t,c),E&&E.distance<r&&(a=E,r=E.distance)}return a}function Lo(l,s,t,e,i,o,n){const{geometry:r}=t,{index:a}=r,c=r.attributes.position;for(let h=l,E=s+l;h<E;h++){let d;if(d=h,tt(n,d*3,a,c),n.needsUpdate=!0,e(n,d,i,o))return!0}return!1}function Po(l,s=null){s&&Array.isArray(s)&&(s=new Set(s));const t=l.geometry,e=t.index?t.index.array:null,i=t.attributes.position;let o,n,r,a,c=0;const h=l._roots;for(let d=0,I=h.length;d<I;d++)o=h[d],n=new Uint32Array(o),r=new Uint16Array(o),a=new Float32Array(o),E(0,c),c+=o.byteLength;function E(d,I,f=!1){const T=d*2;if(r[T+15]===Ns){const m=n[d+6],A=r[T+14];let O=1/0,p=1/0,R=1/0,S=-1/0,_=-1/0,y=-1/0;for(let N=3*m,P=3*(m+A);N<P;N++){let x=e[N];const w=i.getX(x),U=i.getY(x),b=i.getZ(x);w<O&&(O=w),w>S&&(S=w),U<p&&(p=U),U>_&&(_=U),b<R&&(R=b),b>y&&(y=b)}return a[d+0]!==O||a[d+1]!==p||a[d+2]!==R||a[d+3]!==S||a[d+4]!==_||a[d+5]!==y?(a[d+0]=O,a[d+1]=p,a[d+2]=R,a[d+3]=S,a[d+4]=_,a[d+5]=y,!0):!1}else{const m=d+8,A=n[d+6],O=m+I,p=A+I;let R=f,S=!1,_=!1;s?R||(S=s.has(O),_=s.has(p),R=!S&&!_):(S=!0,_=!0);const y=R||S,N=R||_;let P=!1;y&&(P=E(m,I,R));let x=!1;N&&(x=E(A,I,R));const w=P||x;if(w)for(let U=0;U<3;U++){const b=m+U,v=A+U,z=a[b],j=a[b+3],et=a[v],Z=a[v+3];a[d+U]=z<et?z:et,a[d+U+3]=j>Z?j:Z}return w}}}const Gi=new C.Box3;function Ut(l,s,t,e){return q(l,s,Gi),t.intersectBox(Gi,e)}function wo(l,s,t,e,i,o){const{geometry:n,_indirectBuffer:r}=l;for(let a=e,c=e+i;a<c;a++){let h=r?r[a]:a;Ls(n,s,t,h,o)}}function Mo(l,s,t,e,i){const{geometry:o,_indirectBuffer:n}=l;let r=1/0,a=null;for(let c=e,h=e+i;c<h;c++){let E;E=Ls(o,s,t,n?n[c]:c),E&&E.distance<r&&(a=E,r=E.distance)}return a}function Do(l,s,t,e,i,o,n){const{geometry:r}=t,{index:a}=r,c=r.attributes.position;for(let h=l,E=s+l;h<E;h++){let d;if(d=t.resolveTriangleIndex(h),tt(n,d*3,a,c),n.needsUpdate=!0,e(n,d,i,o))return!0}return!1}const zi=new C.Vector3;function xo(l,s,t,e,i){X.setBuffer(l._roots[s]),oi(0,l,t,e,i),X.clearBuffer()}function oi(l,s,t,e,i){const{float32Array:o,uint16Array:n,uint32Array:r}=X,a=l*2;if(ct(a,n)){const h=lt(l,r),E=Et(a,n);yo(s,t,e,h,E,i)}else{const h=ut(l);Ut(h,o,e,zi)&&oi(h,s,t,e,i);const E=It(l,r);Ut(E,o,e,zi)&&oi(E,s,t,e,i)}}const Hi=new C.Vector3,Uo=["x","y","z"];function bo(l,s,t,e){X.setBuffer(l._roots[s]);const i=ri(0,l,t,e);return X.clearBuffer(),i}function ri(l,s,t,e){const{float32Array:i,uint16Array:o,uint32Array:n}=X;let r=l*2;if(ct(r,o)){const c=lt(l,n),h=Et(r,o);return No(s,t,e,c,h)}else{const c=Rn(l,n),h=Uo[c],d=e.direction[h]>=0;let I,f;d?(I=ut(l),f=It(l,n)):(I=It(l,n),f=ut(l));const F=Ut(I,i,e,Hi)?ri(I,s,t,e):null;if(F){const O=F.point[h];if(d?O<=i[f+c]:O>=i[f+c+3])return F}const A=Ut(f,i,e,Hi)?ri(f,s,t,e):null;return F&&A?F.distance<=A.distance?F:A:F||A||null}}const ke=new C.Box3,qt=new mt,Kt=new mt,fe=new C.Matrix4,Wi=new rt,Xe=new rt;function vo(l,s,t,e){X.setBuffer(l._roots[s]);const i=ai(0,l,t,e);return X.clearBuffer(),i}function ai(l,s,t,e,i=null){const{float32Array:o,uint16Array:n,uint32Array:r}=X;let a=l*2;if(i===null&&(t.boundingBox||t.computeBoundingBox(),Wi.set(t.boundingBox.min,t.boundingBox.max,e),i=Wi),ct(a,n)){const h=s.geometry,E=h.index,d=h.attributes.position,I=t.index,f=t.attributes.position,T=lt(l,r),F=Et(a,n);if(fe.copy(e).invert(),t.boundsTree)return q(l,o,Xe),Xe.matrix.copy(fe),Xe.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:A=>Xe.intersectsBox(A),intersectsTriangle:A=>{A.a.applyMatrix4(e),A.b.applyMatrix4(e),A.c.applyMatrix4(e),A.needsUpdate=!0;for(let O=T*3,p=(F+T)*3;O<p;O+=3)if(tt(Kt,O,E,d),Kt.needsUpdate=!0,A.intersectsTriangle(Kt))return!0;return!1}});for(let m=T*3,A=(F+T)*3;m<A;m+=3){tt(qt,m,E,d),qt.a.applyMatrix4(fe),qt.b.applyMatrix4(fe),qt.c.applyMatrix4(fe),qt.needsUpdate=!0;for(let O=0,p=I.count;O<p;O+=3)if(tt(Kt,O,I,f),Kt.needsUpdate=!0,qt.intersectsTriangle(Kt))return!0}}else{const h=l+8,E=r[l+6];return q(h,o,ke),!!(i.intersectsBox(ke)&&ai(h,s,t,e,i)||(q(E,o,ke),i.intersectsBox(ke)&&ai(E,s,t,e,i)))}}const Ze=new C.Matrix4,zs=new rt,pe=new rt,Bo=new C.Vector3,Vo=new C.Vector3,Yo=new C.Vector3,Go=new C.Vector3;function zo(l,s,t,e={},i={},o=0,n=1/0){s.boundingBox||s.computeBoundingBox(),zs.set(s.boundingBox.min,s.boundingBox.max,t),zs.needsUpdate=!0;const r=l.geometry,a=r.attributes.position,c=r.index,h=s.attributes.position,E=s.index,d=dt.getPrimitive(),I=dt.getPrimitive();let f=Bo,T=Vo,F=null,m=null;i&&(F=Yo,m=Go);let A=1/0,O=null,p=null;return Ze.copy(t).invert(),pe.matrix.copy(Ze),l.shapecast({boundsTraverseOrder:R=>zs.distanceToBox(R),intersectsBounds:(R,S,_)=>_<A&&_<n?(S&&(pe.min.copy(R.min),pe.max.copy(R.max),pe.needsUpdate=!0),!0):!1,intersectsRange:(R,S)=>{if(s.boundsTree)return s.boundsTree.shapecast({boundsTraverseOrder:y=>pe.distanceToBox(y),intersectsBounds:(y,N,P)=>P<A&&P<n,intersectsRange:(y,N)=>{for(let P=y,x=y+N;P<x;P++){tt(I,3*P,E,h),I.a.applyMatrix4(t),I.b.applyMatrix4(t),I.c.applyMatrix4(t),I.needsUpdate=!0;for(let w=R,U=R+S;w<U;w++){tt(d,3*w,c,a),d.needsUpdate=!0;const b=d.distanceToTriangle(I,f,F);if(b<A&&(T.copy(f),m&&m.copy(F),A=b,O=w,p=P),b<o)return!0}}}});{const _=he(s);for(let y=0,N=_;y<N;y++){tt(I,3*y,E,h),I.a.applyMatrix4(t),I.b.applyMatrix4(t),I.c.applyMatrix4(t),I.needsUpdate=!0;for(let P=R,x=R+S;P<x;P++){tt(d,3*P,c,a),d.needsUpdate=!0;const w=d.distanceToTriangle(I,f,F);if(w<A&&(T.copy(f),m&&m.copy(F),A=w,O=P,p=y),w<o)return!0}}}}}),dt.releasePrimitive(d),dt.releasePrimitive(I),A===1/0?null:(e.point?e.point.copy(T):e.point=T.clone(),e.distance=A,e.faceIndex=O,i&&(i.point?i.point.copy(m):i.point=m.clone(),i.point.applyMatrix4(Ze),T.applyMatrix4(Ze),i.distance=T.sub(i.point).length(),i.faceIndex=p),e)}function Ho(l,s=null){s&&Array.isArray(s)&&(s=new Set(s));const t=l.geometry,e=t.index?t.index.array:null,i=t.attributes.position;let o,n,r,a,c=0;const h=l._roots;for(let d=0,I=h.length;d<I;d++)o=h[d],n=new Uint32Array(o),r=new Uint16Array(o),a=new Float32Array(o),E(0,c),c+=o.byteLength;function E(d,I,f=!1){const T=d*2;if(r[T+15]===Ns){const m=n[d+6],A=r[T+14];let O=1/0,p=1/0,R=1/0,S=-1/0,_=-1/0,y=-1/0;for(let N=m,P=m+A;N<P;N++){const x=3*l.resolveTriangleIndex(N);for(let w=0;w<3;w++){let U=x+w;U=e?e[U]:U;const b=i.getX(U),v=i.getY(U),z=i.getZ(U);b<O&&(O=b),b>S&&(S=b),v<p&&(p=v),v>_&&(_=v),z<R&&(R=z),z>y&&(y=z)}}return a[d+0]!==O||a[d+1]!==p||a[d+2]!==R||a[d+3]!==S||a[d+4]!==_||a[d+5]!==y?(a[d+0]=O,a[d+1]=p,a[d+2]=R,a[d+3]=S,a[d+4]=_,a[d+5]=y,!0):!1}else{const m=d+8,A=n[d+6],O=m+I,p=A+I;let R=f,S=!1,_=!1;s?R||(S=s.has(O),_=s.has(p),R=!S&&!_):(S=!0,_=!0);const y=R||S,N=R||_;let P=!1;y&&(P=E(m,I,R));let x=!1;N&&(x=E(A,I,R));const w=P||x;if(w)for(let U=0;U<3;U++){const b=m+U,v=A+U,z=a[b],j=a[b+3],et=a[v],Z=a[v+3];a[d+U]=z<et?z:et,a[d+U+3]=j>Z?j:Z}return w}}}const ki=new C.Vector3;function Wo(l,s,t,e,i){X.setBuffer(l._roots[s]),ci(0,l,t,e,i),X.clearBuffer()}function ci(l,s,t,e,i){const{float32Array:o,uint16Array:n,uint32Array:r}=X,a=l*2;if(ct(a,n)){const h=lt(l,r),E=Et(a,n);wo(s,t,e,h,E,i)}else{const h=ut(l);Ut(h,o,e,ki)&&ci(h,s,t,e,i);const E=It(l,r);Ut(E,o,e,ki)&&ci(E,s,t,e,i)}}const Xi=new C.Vector3,ko=["x","y","z"];function Xo(l,s,t,e){X.setBuffer(l._roots[s]);const i=li(0,l,t,e);return X.clearBuffer(),i}function li(l,s,t,e){const{float32Array:i,uint16Array:o,uint32Array:n}=X;let r=l*2;if(ct(r,o)){const c=lt(l,n),h=Et(r,o);return Mo(s,t,e,c,h)}else{const c=Rn(l,n),h=ko[c],d=e.direction[h]>=0;let I,f;d?(I=ut(l),f=It(l,n)):(I=It(l,n),f=ut(l));const F=Ut(I,i,e,Xi)?li(I,s,t,e):null;if(F){const O=F.point[h];if(d?O<=i[f+c]:O>=i[f+c+3])return F}const A=Ut(f,i,e,Xi)?li(f,s,t,e):null;return F&&A?F.distance<=A.distance?F:A:F||A||null}}const Qe=new C.Box3,$t=new mt,Jt=new mt,Ce=new C.Matrix4,Zi=new rt,je=new rt;function Zo(l,s,t,e){X.setBuffer(l._roots[s]);const i=hi(0,l,t,e);return X.clearBuffer(),i}function hi(l,s,t,e,i=null){const{float32Array:o,uint16Array:n,uint32Array:r}=X;let a=l*2;if(i===null&&(t.boundingBox||t.computeBoundingBox(),Zi.set(t.boundingBox.min,t.boundingBox.max,e),i=Zi),ct(a,n)){const h=s.geometry,E=h.index,d=h.attributes.position,I=t.index,f=t.attributes.position,T=lt(l,r),F=Et(a,n);if(Ce.copy(e).invert(),t.boundsTree)return q(l,o,je),je.matrix.copy(Ce),je.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:A=>je.intersectsBox(A),intersectsTriangle:A=>{A.a.applyMatrix4(e),A.b.applyMatrix4(e),A.c.applyMatrix4(e),A.needsUpdate=!0;for(let O=T,p=F+T;O<p;O++)if(tt(Jt,3*s.resolveTriangleIndex(O),E,d),Jt.needsUpdate=!0,A.intersectsTriangle(Jt))return!0;return!1}});for(let m=T,A=F+T;m<A;m++){const O=s.resolveTriangleIndex(m);tt($t,3*O,E,d),$t.a.applyMatrix4(Ce),$t.b.applyMatrix4(Ce),$t.c.applyMatrix4(Ce),$t.needsUpdate=!0;for(let p=0,R=I.count;p<R;p+=3)if(tt(Jt,p,I,f),Jt.needsUpdate=!0,$t.intersectsTriangle(Jt))return!0}}else{const h=l+8,E=r[l+6];return q(h,o,Qe),!!(i.intersectsBox(Qe)&&hi(h,s,t,e,i)||(q(E,o,Qe),i.intersectsBox(Qe)&&hi(E,s,t,e,i)))}}const qe=new C.Matrix4,Hs=new rt,Te=new rt,Qo=new C.Vector3,jo=new C.Vector3,qo=new C.Vector3,Ko=new C.Vector3;function $o(l,s,t,e={},i={},o=0,n=1/0){s.boundingBox||s.computeBoundingBox(),Hs.set(s.boundingBox.min,s.boundingBox.max,t),Hs.needsUpdate=!0;const r=l.geometry,a=r.attributes.position,c=r.index,h=s.attributes.position,E=s.index,d=dt.getPrimitive(),I=dt.getPrimitive();let f=Qo,T=jo,F=null,m=null;i&&(F=qo,m=Ko);let A=1/0,O=null,p=null;return qe.copy(t).invert(),Te.matrix.copy(qe),l.shapecast({boundsTraverseOrder:R=>Hs.distanceToBox(R),intersectsBounds:(R,S,_)=>_<A&&_<n?(S&&(Te.min.copy(R.min),Te.max.copy(R.max),Te.needsUpdate=!0),!0):!1,intersectsRange:(R,S)=>{if(s.boundsTree){const _=s.boundsTree;return _.shapecast({boundsTraverseOrder:y=>Te.distanceToBox(y),intersectsBounds:(y,N,P)=>P<A&&P<n,intersectsRange:(y,N)=>{for(let P=y,x=y+N;P<x;P++){const w=_.resolveTriangleIndex(P);tt(I,3*w,E,h),I.a.applyMatrix4(t),I.b.applyMatrix4(t),I.c.applyMatrix4(t),I.needsUpdate=!0;for(let U=R,b=R+S;U<b;U++){const v=l.resolveTriangleIndex(U);tt(d,3*v,c,a),d.needsUpdate=!0;const z=d.distanceToTriangle(I,f,F);if(z<A&&(T.copy(f),m&&m.copy(F),A=z,O=U,p=P),z<o)return!0}}}})}else{const _=he(s);for(let y=0,N=_;y<N;y++){tt(I,3*y,E,h),I.a.applyMatrix4(t),I.b.applyMatrix4(t),I.c.applyMatrix4(t),I.needsUpdate=!0;for(let P=R,x=R+S;P<x;P++){const w=l.resolveTriangleIndex(P);tt(d,3*w,c,a),d.needsUpdate=!0;const U=d.distanceToTriangle(I,f,F);if(U<A&&(T.copy(f),m&&m.copy(F),A=U,O=P,p=y),U<o)return!0}}}}}),dt.releasePrimitive(d),dt.releasePrimitive(I),A===1/0?null:(e.point?e.point.copy(T):e.point=T.clone(),e.distance=A,e.faceIndex=O,i&&(i.point?i.point.copy(m):i.point=m.clone(),i.point.applyMatrix4(qe),T.applyMatrix4(qe),i.distance=T.sub(i.point).length(),i.faceIndex=p),e)}function Jo(){return typeof SharedArrayBuffer<"u"}const Ne=new X.constructor,ls=new X.constructor,Pt=new _i(()=>new C.Box3),te=new C.Box3,ee=new C.Box3,Ws=new C.Box3,ks=new C.Box3;let Xs=!1;function tr(l,s,t,e){if(Xs)throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");Xs=!0;const i=l._roots,o=s._roots;let n,r=0,a=0;const c=new C.Matrix4().copy(t).invert();for(let h=0,E=i.length;h<E;h++){Ne.setBuffer(i[h]),a=0;const d=Pt.getPrimitive();q(0,Ne.float32Array,d),d.applyMatrix4(c);for(let I=0,f=o.length;I<f&&(ls.setBuffer(o[h]),n=ft(0,0,t,c,e,r,a,0,0,d),ls.clearBuffer(),a+=o[I].length,!n);I++);if(Pt.releasePrimitive(d),Ne.clearBuffer(),r+=i[h].length,n)break}return Xs=!1,n}function ft(l,s,t,e,i,o=0,n=0,r=0,a=0,c=null,h=!1){let E,d;h?(E=ls,d=Ne):(E=Ne,d=ls);const I=E.float32Array,f=E.uint32Array,T=E.uint16Array,F=d.float32Array,m=d.uint32Array,A=d.uint16Array,O=l*2,p=s*2,R=ct(O,T),S=ct(p,A);let _=!1;if(S&&R)h?_=i(lt(s,m),Et(s*2,A),lt(l,f),Et(l*2,T),a,n+s,r,o+l):_=i(lt(l,f),Et(l*2,T),lt(s,m),Et(s*2,A),r,o+l,a,n+s);else if(S){const y=Pt.getPrimitive();q(s,F,y),y.applyMatrix4(t);const N=ut(l),P=It(l,f);q(N,I,te),q(P,I,ee);const x=y.intersectsBox(te),w=y.intersectsBox(ee);_=x&&ft(s,N,e,t,i,n,o,a,r+1,y,!h)||w&&ft(s,P,e,t,i,n,o,a,r+1,y,!h),Pt.releasePrimitive(y)}else{const y=ut(s),N=It(s,m);q(y,F,Ws),q(N,F,ks);const P=c.intersectsBox(Ws),x=c.intersectsBox(ks);if(P&&x)_=ft(l,y,t,e,i,o,n,r,a+1,c,h)||ft(l,N,t,e,i,o,n,r,a+1,c,h);else if(P)if(R)_=ft(l,y,t,e,i,o,n,r,a+1,c,h);else{const w=Pt.getPrimitive();w.copy(Ws).applyMatrix4(t);const U=ut(l),b=It(l,f);q(U,I,te),q(b,I,ee);const v=w.intersectsBox(te),z=w.intersectsBox(ee);_=v&&ft(y,U,e,t,i,n,o,a,r+1,w,!h)||z&&ft(y,b,e,t,i,n,o,a,r+1,w,!h),Pt.releasePrimitive(w)}else if(x)if(R)_=ft(l,N,t,e,i,o,n,r,a+1,c,h);else{const w=Pt.getPrimitive();w.copy(ks).applyMatrix4(t);const U=ut(l),b=It(l,f);q(U,I,te),q(b,I,ee);const v=w.intersectsBox(te),z=w.intersectsBox(ee);_=v&&ft(N,U,e,t,i,n,o,a,r+1,w,!h)||z&&ft(N,b,e,t,i,n,o,a,r+1,w,!h),Pt.releasePrimitive(w)}}return _}const Ke=new rt,Qi=new C.Box3;class yi{static serialize(s,t={}){t={cloneBuffers:!0,...t};const e=s.geometry,i=s._roots,o=s._indirectBuffer,n=e.getIndex();let r;return t.cloneBuffers?r={roots:i.map(a=>a.slice()),index:n.array.slice(),indirectBuffer:o?o.slice():null}:r={roots:i,index:n.array,indirectBuffer:o},r}static deserialize(s,t,e={}){e={setIndex:!0,indirect:!!s.indirectBuffer,...e};const{index:i,roots:o,indirectBuffer:n}=s,r=new yi(t,{...e,[Bs]:!0});if(r._roots=o,r._indirectBuffer=n||null,e.setIndex){const a=t.getIndex();if(a===null){const c=new C.BufferAttribute(s.index,1,!1);t.setIndex(c)}else a.array!==i&&(a.array.set(i),a.needsUpdate=!0)}return r}get indirect(){return!!this._indirectBuffer}constructor(s,t={}){if(s.isBufferGeometry){if(s.index&&s.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw new Error("MeshBVH: Only BufferGeometries are supported.");if(t=Object.assign({strategy:Cn,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,indirect:!1,[Bs]:!1},t),t.useSharedArrayBuffer&&!Jo())throw new Error("MeshBVH: SharedArrayBuffer is not available.");this.geometry=s,this._roots=null,this._indirectBuffer=null,t[Bs]||(Co(this,t),!s.boundingBox&&t.setBoundingBox&&(s.boundingBox=this.getBoundingBox(new C.Box3)));const{_indirectBuffer:e}=this;this.resolveTriangleIndex=t.indirect?i=>e[i]:i=>i}refit(s=null){return(this.indirect?Ho:Po)(this,s)}traverse(s,t=0){const e=this._roots[t],i=new Uint32Array(e),o=new Uint16Array(e);n(0);function n(r,a=0){const c=r*2,h=o[c+15]===Ns;if(h){const E=i[r+6],d=o[c+14];s(a,h,new Float32Array(e,r*4,6),E,d)}else{const E=r+rs/4,d=i[r+6],I=i[r+7];s(a,h,new Float32Array(e,r*4,6),I)||(n(E,a+1),n(d,a+1))}}}raycast(s,t=C.FrontSide){const e=this._roots,i=this.geometry,o=[],n=t.isMaterial,r=Array.isArray(t),a=i.groups,c=n?t.side:t,h=this.indirect?Wo:xo;for(let E=0,d=e.length;E<d;E++){const I=r?t[a[E].materialIndex].side:c,f=o.length;if(h(this,E,I,s,o),r){const T=a[E].materialIndex;for(let F=f,m=o.length;F<m;F++)o[F].face.materialIndex=T}}return o}raycastFirst(s,t=C.FrontSide){const e=this._roots,i=this.geometry,o=t.isMaterial,n=Array.isArray(t);let r=null;const a=i.groups,c=o?t.side:t,h=this.indirect?Xo:bo;for(let E=0,d=e.length;E<d;E++){const I=n?t[a[E].materialIndex].side:c,f=h(this,E,I,s);f!=null&&(r==null||f.distance<r.distance)&&(r=f,n&&(f.face.materialIndex=a[E].materialIndex))}return r}intersectsGeometry(s,t){let e=!1;const i=this._roots,o=this.indirect?Zo:vo;for(let n=0,r=i.length;n<r&&(e=o(this,n,s,t),!e);n++);return e}shapecast(s){const t=dt.getPrimitive(),e=this.indirect?Do:Lo;let{boundsTraverseOrder:i,intersectsBounds:o,intersectsRange:n,intersectsTriangle:r}=s;if(n&&r){const E=n;n=(d,I,f,T,F)=>E(d,I,f,T,F)?!0:e(d,I,this,r,f,T,t)}else n||(r?n=(E,d,I,f)=>e(E,d,this,r,I,f,t):n=(E,d,I)=>I);let a=!1,c=0;const h=this._roots;for(let E=0,d=h.length;E<d;E++){const I=h[E];if(a=go(this,E,o,n,i,c),a)break;c+=I.byteLength}return dt.releasePrimitive(t),a}bvhcast(s,t,e){let{intersectsRanges:i,intersectsTriangles:o}=e;const n=dt.getPrimitive(),r=this.geometry.index,a=this.geometry.attributes.position,c=this.indirect?f=>{const T=this.resolveTriangleIndex(f);tt(n,T*3,r,a)}:f=>{tt(n,f*3,r,a)},h=dt.getPrimitive(),E=s.geometry.index,d=s.geometry.attributes.position,I=s.indirect?f=>{const T=s.resolveTriangleIndex(f);tt(h,T*3,E,d)}:f=>{tt(h,f*3,E,d)};if(o){const f=(T,F,m,A,O,p,R,S)=>{for(let _=m,y=m+A;_<y;_++){I(_),h.a.applyMatrix4(t),h.b.applyMatrix4(t),h.c.applyMatrix4(t),h.needsUpdate=!0;for(let N=T,P=T+F;N<P;N++)if(c(N),n.needsUpdate=!0,o(n,h,N,_,O,p,R,S))return!0}return!1};if(i){const T=i;i=function(F,m,A,O,p,R,S,_){return T(F,m,A,O,p,R,S,_)?!0:f(F,m,A,O,p,R,S,_)}}else i=f}return tr(this,s,t,i)}intersectsBox(s,t){return Ke.set(s.min,s.max,t),Ke.needsUpdate=!0,this.shapecast({intersectsBounds:e=>Ke.intersectsBox(e),intersectsTriangle:e=>Ke.intersectsTriangle(e)})}intersectsSphere(s){return this.shapecast({intersectsBounds:t=>s.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(s)})}closestPointToGeometry(s,t,e={},i={},o=0,n=1/0){return(this.indirect?$o:zo)(this,s,t,e,i,o,n)}closestPointToPoint(s,t={},e=0,i=1/0){return Oo(this,s,t,e,i)}getBoundingBox(s){return s.makeEmpty(),this._roots.forEach(e=>{q(0,new Float32Array(e),Qi),s.union(Qi)}),s}}function ji(l,s,t){return l===null||(l.point.applyMatrix4(s.matrixWorld),l.distance=l.point.distanceTo(t.ray.origin),l.object=s,l.distance<t.near||l.distance>t.far)?null:l}const Zs=new C.Ray,qi=new C.Matrix4,er=C.Mesh.prototype.raycast;function sr(l,s){if(this.geometry.boundsTree){if(this.material===void 0)return;qi.copy(this.matrixWorld).invert(),Zs.copy(l.ray).applyMatrix4(qi);const t=this.geometry.boundsTree;if(l.firstHitOnly===!0){const e=ji(t.raycastFirst(Zs,this.material),this,l);e&&s.push(e)}else{const e=t.raycast(Zs,this.material);for(let i=0,o=e.length;i<o;i++){const n=ji(e[i],this,l);n&&s.push(n)}}}else er.call(this,l,s)}function ir(l){return this.boundsTree=new yi(this,l),this.boundsTree}function nr(){this.boundsTree=null}class M{constructor(){u(this,"trigger",s=>{const t=this.handlers.slice(0);for(const e of t)e(s)});u(this,"handlers",[])}add(s){this.handlers.push(s)}remove(s){this.handlers=this.handlers.filter(t=>t!==s)}reset(){this.handlers.length=0}}class Le{constructor(){u(this,"trigger",async s=>{const t=this.handlers.slice(0);for(const e of t)await e(s)});u(this,"handlers",[])}add(s){this.handlers.push(s)}remove(s){this.handlers=this.handlers.filter(t=>t!==s)}reset(){this.handlers.length=0}}class Ps{constructor(s){u(this,"isDisposeable",()=>"dispose"in this&&"onDisposed"in this);u(this,"isResizeable",()=>"resize"in this&&"getSize"in this);u(this,"isUpdateable",()=>"onAfterUpdate"in this&&"onBeforeUpdate"in this&&"update"in this);u(this,"isHideable",()=>"visible"in this);u(this,"isConfigurable",()=>"setup"in this&&"config"in this&&"onSetup"in this);this.components=s}}class $ extends Ps{}class ws extends Ps{constructor(t){super(t);u(this,"worlds",new Map);u(this,"onWorldChanged",new M);u(this,"currentWorld",null);this.onWorldChanged.add(({world:e,action:i})=>{i==="removed"&&this.worlds.delete(e.uuid)})}}class Fn extends ws{constructor(){super(...arguments);u(this,"hasCameraControls",()=>"controls"in this)}}class An extends ws{constructor(){super(...arguments);u(this,"onAfterUpdate",new M);u(this,"onBeforeUpdate",new M);u(this,"onDisposed",new M);u(this,"onResize",new M);u(this,"onClippingPlanesUpdated",new M);u(this,"clippingPlanes",[])}updateClippingPlanes(){this.onClippingPlanesUpdated.trigger()}setPlane(t,e,i){e.isLocal=i;const o=this.clippingPlanes.indexOf(e);t&&o===-1?this.clippingPlanes.push(e):!t&&o>-1&&this.clippingPlanes.splice(o,1),this.three.clippingPlanes=this.clippingPlanes.filter(n=>!n.isLocal)}}const Pe=class Pe extends ${constructor(t){super(t);u(this,"_disposedComponents",new Set);u(this,"enabled",!0);t.add(Pe.uuid,this)}get(){return this._disposedComponents}destroy(t,e=!0,i=!0){t.removeFromParent();const o=t;o.dispose&&o.dispose(),this.disposeGeometryAndMaterials(t,e),i&&o.children&&o.children.length&&this.disposeChildren(o),t.children.length=0}disposeGeometry(t){t.boundsTree&&t.disposeBoundsTree&&t.disposeBoundsTree(),t.dispose()}disposeGeometryAndMaterials(t,e){const i=t;i.geometry&&this.disposeGeometry(i.geometry),e&&i.material&&Pe.disposeMaterial(i),i.material=[],i.geometry=null}disposeChildren(t){for(const e of t.children)this.destroy(e)}static disposeMaterial(t){if(t.material)if(Array.isArray(t.material))for(const e of t.material)e.dispose();else t.material.dispose()}};u(Pe,"uuid","76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe");let _t=Pe;class gn extends ws{constructor(t){super(t);u(this,"onDisposed",new M);u(this,"directionalLights",new Map);u(this,"ambientLights",new Map)}dispose(){const t=this.components.get(_t);for(const e of this.three.children){const i=e;i.geometry&&t.destroy(i)}for(const[,e]of this.directionalLights)e.removeFromParent(),e.target.removeFromParent(),e.dispose();for(const[,e]of this.ambientLights)e.removeFromParent(),e.dispose();this.three.children=[],this.onDisposed.trigger(),this.onDisposed.reset()}}class or extends Set{constructor(t){super(t);u(this,"onItemAdded",new M);u(this,"onItemDeleted",new M);u(this,"onCleared",new M)}clear(){super.clear(),this.onCleared.trigger()}add(t){if(this.has(t))return this;const i=super.add(t);return this.onItemAdded||(this.onItemAdded=new M),this.onItemAdded.trigger(t),i}delete(t){const e=super.delete(t);return e&&this.onItemDeleted.trigger(),e}dispose(){this.clear(),this.onItemAdded.reset(),this.onItemDeleted.reset(),this.onCleared.reset()}}class di extends Map{constructor(t){super(t);u(this,"onItemSet",new M);u(this,"onItemUpdated",new M);u(this,"onItemDeleted",new M);u(this,"onCleared",new M)}clear(){super.clear(),this.onCleared.trigger()}set(t,e){const i=this.has(t),o=super.set(t,e);return i?(this.onItemUpdated||(this.onItemUpdated=new M),this.onItemUpdated.trigger({key:t,value:e})):(this.onItemSet||(this.onItemSet=new M),this.onItemSet.trigger({key:t,value:e})),o}delete(t){const e=super.delete(t);return e&&this.onItemDeleted.trigger(),e}dispose(){this.clear(),this.onItemSet.reset(),this.onItemDeleted.reset(),this.onCleared.reset()}}const as=0,rr=1,ar=new C.Vector3,Ki=new C.Line3,Qs=new C.Plane,$i=new C.Vector3,$e=new C.Triangle;class cr{constructor(){this.tolerance=-1,this.faces=[],this.newFaces=[],this.assigned=new Ji,this.unassigned=new Ji,this.vertices=[]}setFromPoints(s){if(s.length>=4){this.makeEmpty();for(let t=0,e=s.length;t<e;t++)this.vertices.push(new lr(s[t]));this.compute()}return this}setFromObject(s){const t=[];return s.updateMatrixWorld(!0),s.traverse(function(e){const i=e.geometry;if(i!==void 0){const o=i.attributes.position;if(o!==void 0)for(let n=0,r=o.count;n<r;n++){const a=new C.Vector3;a.fromBufferAttribute(o,n).applyMatrix4(e.matrixWorld),t.push(a)}}}),this.setFromPoints(t)}containsPoint(s){const t=this.faces;for(let e=0,i=t.length;e<i;e++)if(t[e].distanceToPoint(s)>this.tolerance)return!1;return!0}intersectRay(s,t){const e=this.faces;let i=-1/0,o=1/0;for(let n=0,r=e.length;n<r;n++){const a=e[n],c=a.distanceToPoint(s.origin),h=a.normal.dot(s.direction);if(c>0&&h>=0)return null;const E=h!==0?-c/h:0;if(!(E<=0)&&(h>0?o=Math.min(E,o):i=Math.max(E,i),i>o))return null}return i!==-1/0?s.at(i,t):s.at(o,t),t}intersectsRay(s){return this.intersectRay(s,ar)!==null}makeEmpty(){return this.faces=[],this.vertices=[],this}addVertexToFace(s,t){return s.face=t,t.outside===null?this.assigned.append(s):this.assigned.insertBefore(t.outside,s),t.outside=s,this}removeVertexFromFace(s,t){return s===t.outside&&(s.next!==null&&s.next.face===t?t.outside=s.next:t.outside=null),this.assigned.remove(s),this}removeAllVerticesFromFace(s){if(s.outside!==null){const t=s.outside;let e=s.outside;for(;e.next!==null&&e.next.face===s;)e=e.next;return this.assigned.removeSubList(t,e),t.prev=e.next=null,s.outside=null,t}}deleteFaceVertices(s,t){const e=this.removeAllVerticesFromFace(s);if(e!==void 0)if(t===void 0)this.unassigned.appendChain(e);else{let i=e;do{const o=i.next;t.distanceToPoint(i.point)>this.tolerance?this.addVertexToFace(i,t):this.unassigned.append(i),i=o}while(i!==null)}return this}resolveUnassignedPoints(s){if(this.unassigned.isEmpty()===!1){let t=this.unassigned.first();do{const e=t.next;let i=this.tolerance,o=null;for(let n=0;n<s.length;n++){const r=s[n];if(r.mark===as){const a=r.distanceToPoint(t.point);if(a>i&&(i=a,o=r),i>1e3*this.tolerance)break}}o!==null&&this.addVertexToFace(t,o),t=e}while(t!==null)}return this}computeExtremes(){const s=new C.Vector3,t=new C.Vector3,e=[],i=[];for(let o=0;o<3;o++)e[o]=i[o]=this.vertices[0];s.copy(this.vertices[0].point),t.copy(this.vertices[0].point);for(let o=0,n=this.vertices.length;o<n;o++){const r=this.vertices[o],a=r.point;for(let c=0;c<3;c++)a.getComponent(c)<s.getComponent(c)&&(s.setComponent(c,a.getComponent(c)),e[c]=r);for(let c=0;c<3;c++)a.getComponent(c)>t.getComponent(c)&&(t.setComponent(c,a.getComponent(c)),i[c]=r)}return this.tolerance=3*Number.EPSILON*(Math.max(Math.abs(s.x),Math.abs(t.x))+Math.max(Math.abs(s.y),Math.abs(t.y))+Math.max(Math.abs(s.z),Math.abs(t.z))),{min:e,max:i}}computeInitialHull(){const s=this.vertices,t=this.computeExtremes(),e=t.min,i=t.max;let o=0,n=0;for(let d=0;d<3;d++){const I=i[d].point.getComponent(d)-e[d].point.getComponent(d);I>o&&(o=I,n=d)}const r=e[n],a=i[n];let c,h;o=0,Ki.set(r.point,a.point);for(let d=0,I=this.vertices.length;d<I;d++){const f=s[d];if(f!==r&&f!==a){Ki.closestPointToPoint(f.point,!0,$i);const T=$i.distanceToSquared(f.point);T>o&&(o=T,c=f)}}o=-1,Qs.setFromCoplanarPoints(r.point,a.point,c.point);for(let d=0,I=this.vertices.length;d<I;d++){const f=s[d];if(f!==r&&f!==a&&f!==c){const T=Math.abs(Qs.distanceToPoint(f.point));T>o&&(o=T,h=f)}}const E=[];if(Qs.distanceToPoint(h.point)<0){E.push(Ct.create(r,a,c),Ct.create(h,a,r),Ct.create(h,c,a),Ct.create(h,r,c));for(let d=0;d<3;d++){const I=(d+1)%3;E[d+1].getEdge(2).setTwin(E[0].getEdge(I)),E[d+1].getEdge(1).setTwin(E[I+1].getEdge(0))}}else{E.push(Ct.create(r,c,a),Ct.create(h,r,a),Ct.create(h,a,c),Ct.create(h,c,r));for(let d=0;d<3;d++){const I=(d+1)%3;E[d+1].getEdge(2).setTwin(E[0].getEdge((3-d)%3)),E[d+1].getEdge(0).setTwin(E[I+1].getEdge(1))}}for(let d=0;d<4;d++)this.faces.push(E[d]);for(let d=0,I=s.length;d<I;d++){const f=s[d];if(f!==r&&f!==a&&f!==c&&f!==h){o=this.tolerance;let T=null;for(let F=0;F<4;F++){const m=this.faces[F].distanceToPoint(f.point);m>o&&(o=m,T=this.faces[F])}T!==null&&this.addVertexToFace(f,T)}}return this}reindexFaces(){const s=[];for(let t=0;t<this.faces.length;t++){const e=this.faces[t];e.mark===as&&s.push(e)}return this.faces=s,this}nextVertexToAdd(){if(this.assigned.isEmpty()===!1){let s,t=0;const e=this.assigned.first().face;let i=e.outside;do{const o=e.distanceToPoint(i.point);o>t&&(t=o,s=i),i=i.next}while(i!==null&&i.face===e);return s}}computeHorizon(s,t,e,i){this.deleteFaceVertices(e),e.mark=rr;let o;t===null?o=t=e.getEdge(0):o=t.next;do{const n=o.twin,r=n.face;r.mark===as&&(r.distanceToPoint(s)>this.tolerance?this.computeHorizon(s,n,r,i):i.push(o)),o=o.next}while(o!==t);return this}addAdjoiningFace(s,t){const e=Ct.create(s,t.tail(),t.head());return this.faces.push(e),e.getEdge(-1).setTwin(t.twin),e.getEdge(0)}addNewFaces(s,t){this.newFaces=[];let e=null,i=null;for(let o=0;o<t.length;o++){const n=t[o],r=this.addAdjoiningFace(s,n);e===null?e=r:r.next.setTwin(i),this.newFaces.push(r.face),i=r}return e.next.setTwin(i),this}addVertexToHull(s){const t=[];return this.unassigned.clear(),this.removeVertexFromFace(s,s.face),this.computeHorizon(s.point,null,s.face,t),this.addNewFaces(s,t),this.resolveUnassignedPoints(this.newFaces),this}cleanup(){return this.assigned.clear(),this.unassigned.clear(),this.newFaces=[],this}compute(){let s;for(this.computeInitialHull();(s=this.nextVertexToAdd())!==void 0;)this.addVertexToHull(s);return this.reindexFaces(),this.cleanup(),this}}class Ct{constructor(){this.normal=new C.Vector3,this.midpoint=new C.Vector3,this.area=0,this.constant=0,this.outside=null,this.mark=as,this.edge=null}static create(s,t,e){const i=new Ct,o=new js(s,i),n=new js(t,i),r=new js(e,i);return o.next=r.prev=n,n.next=o.prev=r,r.next=n.prev=o,i.edge=o,i.compute()}getEdge(s){let t=this.edge;for(;s>0;)t=t.next,s--;for(;s<0;)t=t.prev,s++;return t}compute(){const s=this.edge.tail(),t=this.edge.head(),e=this.edge.next.head();return $e.set(s.point,t.point,e.point),$e.getNormal(this.normal),$e.getMidpoint(this.midpoint),this.area=$e.getArea(),this.constant=this.normal.dot(this.midpoint),this}distanceToPoint(s){return this.normal.dot(s)-this.constant}}class js{constructor(s,t){this.vertex=s,this.prev=null,this.next=null,this.twin=null,this.face=t}head(){return this.vertex}tail(){return this.prev?this.prev.vertex:null}length(){const s=this.head(),t=this.tail();return t!==null?t.point.distanceTo(s.point):-1}lengthSquared(){const s=this.head(),t=this.tail();return t!==null?t.point.distanceToSquared(s.point):-1}setTwin(s){return this.twin=s,s.twin=this,this}}class lr{constructor(s){this.point=s,this.prev=null,this.next=null,this.face=null}}class Ji{constructor(){this.head=null,this.tail=null}first(){return this.head}last(){return this.tail}clear(){return this.head=this.tail=null,this}insertBefore(s,t){return t.prev=s.prev,t.next=s,t.prev===null?this.head=t:t.prev.next=t,s.prev=t,this}insertAfter(s,t){return t.prev=s,t.next=s.next,t.next===null?this.tail=t:t.next.prev=t,s.next=t,this}append(s){return this.head===null?this.head=s:this.tail.next=s,s.prev=this.tail,s.next=null,this.tail=s,this}appendChain(s){for(this.head===null?this.head=s:this.tail.next=s,s.prev=this.tail;s.next!==null;)s=s.next;return this.tail=s,this}remove(s){return s.prev===null?this.head=s.next:s.prev.next=s.next,s.next===null?this.tail=s.prev:s.next.prev=s.prev,this}removeSubList(s,t){return s.prev===null?this.head=t.next:s.prev.next=t.next,t.next===null?this.tail=s.prev:t.next.prev=s.prev,this}isEmpty(){return this.head===null}}const Ei=[2,2,1],ui=[1,0,0];function gt(l,s){return l*3+s}function hr(l){const s=l.elements;let t=0;for(let e=0;e<9;e++)t+=s[e]*s[e];return Math.sqrt(t)}function dr(l){const s=l.elements;let t=0;for(let e=0;e<3;e++){const i=s[gt(Ei[e],ui[e])];t+=2*i*i}return Math.sqrt(t)}function Er(l,s){let t=0,e=1;const i=l.elements;for(let c=0;c<3;c++){const h=Math.abs(i[gt(Ei[c],ui[c])]);h>t&&(t=h,e=c)}let o=1,n=0;const r=ui[e],a=Ei[e];if(Math.abs(i[gt(a,r)])>Number.EPSILON){const c=i[gt(a,a)],h=i[gt(r,r)],E=i[gt(a,r)],d=(c-h)/2/E;let I;d<0?I=-1/(-d+Math.sqrt(1+d*d)):I=1/(d+Math.sqrt(1+d*d)),o=1/Math.sqrt(1+I*I),n=I*o}return s.identity(),s.elements[gt(r,r)]=o,s.elements[gt(a,a)]=o,s.elements[gt(a,r)]=n,s.elements[gt(r,a)]=-n,s}function ur(l,s){let t=0,e=0;const i=10;s.unitary.identity(),s.diagonal.copy(l);const o=s.unitary,n=s.diagonal,r=new g.Matrix3,a=new g.Matrix3,c=Number.EPSILON*hr(n);for(;e<i&&dr(n)>c;)Er(n,r),a.copy(r).transpose(),n.multiply(r),n.premultiply(a),o.multiply(r),++t>2&&(e++,t=0);return s}function On(l){const s=[];for(let st=0;st<l.length-2;st+=3){const Vt=l[st],J=l[st+1],kt=l[st+2];s.push(new g.Vector3(Vt,J,kt))}const t=new cr;t.setFromPoints(s);const e={unitary:new g.Matrix3,diagonal:new g.Matrix3},i=t.faces,o=[],n=[];for(let st=0,Vt=i.length;st<Vt;st++){const J=i[st];let kt=J.edge;o.length=0;do o.push(kt),kt=kt.next;while(kt!==J.edge);const Qn=o.length-2;for(let be=1,jn=Qn;be<=jn;be++){const xs=o[0].vertex,Us=o[be+0].vertex,bs=o[be+1].vertex;n.push(xs.point.x,xs.point.y,xs.point.z),n.push(Us.point.x,Us.point.y,Us.point.z),n.push(bs.point.x,bs.point.y,bs.point.z)}}const r=new g.Vector3,a=new g.Vector3,c=new g.Vector3,h=new g.Vector3,E=new g.Vector3,d=new g.Vector3,I=new g.Vector3,f=new g.Vector3;let T=0,F=0,m=0,A=0,O=0,p=0,R=0;for(let st=0,Vt=n.length;st<Vt;st+=9){r.fromArray(n,st),a.fromArray(n,st+3),c.fromArray(n,st+6),I.set(0,0,0),I.add(r).add(a).add(c).divideScalar(3),h.subVectors(a,r),E.subVectors(c,r);const J=d.crossVectors(h,E).length()/2;f.add(d.copy(I).multiplyScalar(J)),T+=J,F+=(9*I.x*I.x+r.x*r.x+a.x*a.x+c.x*c.x)*(J/12),m+=(9*I.x*I.y+r.x*r.y+a.x*a.y+c.x*c.y)*(J/12),A+=(9*I.x*I.z+r.x*r.z+a.x*a.z+c.x*c.z)*(J/12),O+=(9*I.y*I.y+r.y*r.y+a.y*a.y+c.y*c.y)*(J/12),p+=(9*I.y*I.z+r.y*r.z+a.y*a.z+c.y*c.z)*(J/12),R+=(9*I.z*I.z+r.z*r.z+a.z*a.z+c.z*c.z)*(J/12)}f.divideScalar(T),F/=T,m/=T,A/=T,O/=T,p/=T,R/=T,F-=f.x*f.x,m-=f.x*f.y,A-=f.x*f.z,O-=f.y*f.y,p-=f.y*f.z,R-=f.z*f.z;const S=new g.Matrix3;S.elements[0]=F,S.elements[1]=m,S.elements[2]=A,S.elements[3]=m,S.elements[4]=O,S.elements[5]=p,S.elements[6]=A,S.elements[7]=p,S.elements[8]=R,ur(S,e);const _=e.unitary,y=new g.Vector3,N=new g.Vector3,P=new g.Vector3;_.extractBasis(y,N,P);let x=-1/0,w=-1/0,U=-1/0,b=1/0,v=1/0,z=1/0;for(let st=0,Vt=s.length;st<Vt;st++){const J=s[st];x=Math.max(y.dot(J),x),w=Math.max(N.dot(J),w),U=Math.max(P.dot(J),U),b=Math.min(y.dot(J),b),v=Math.min(N.dot(J),v),z=Math.min(P.dot(J),z)}y.multiplyScalar(.5*(b+x)),N.multiplyScalar(.5*(v+w)),P.multiplyScalar(.5*(z+U));const j=new g.Vector3,et=new g.Vector3,Z=new g.Matrix3;j.add(y).add(N).add(P),et.x=x-b,et.y=w-v,et.z=U-z,et.multiplyScalar(.5),Z.copy(_);const{x:bt,y:vt,z:Bt}=et,Ue=new g.Matrix4;Ue.makeScale(bt*2,vt*2,Bt*2);const de=new g.Matrix4;de.makeTranslation(-bt,-vt,-Bt);const wi=new g.Matrix4;wi.makeTranslation(j.x,j.y,j.z);const Mi=new g.Matrix4;Mi.setFromMatrix3(Z);const Ee=new g.Matrix4;return Ee.multiply(wi),Ee.multiply(Mi),Ee.multiply(de),Ee.multiply(Ue),{center:j,halfSizes:et,rotation:Z,transformation:Ee}}function Sn(l,s,t){const e=[l[0]-s[0],l[1]-s[1],l[2]-s[2]];return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]>0}class Ii{static isTransparent(s){return s.transparent&&s.opacity<1}}const K=class K{static create(){const s=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return`${K._lut[s&255]+K._lut[s>>8&255]+K._lut[s>>16&255]+K._lut[s>>24&255]}-${K._lut[t&255]}${K._lut[t>>8&255]}-${K._lut[t>>16&15|64]}${K._lut[t>>24&255]}-${K._lut[e&63|128]}${K._lut[e>>8&255]}-${K._lut[e>>16&255]}${K._lut[e>>24&255]}${K._lut[i&255]}${K._lut[i>>8&255]}${K._lut[i>>16&255]}${K._lut[i>>24&255]}`.toLowerCase()}static validate(s){if(!K._pattern.test(s))throw new Error(`${s} is not a valid UUID v4.
|
|
1
|
+
"use strict";var Wd=Object.defineProperty;var jd=(r,e,t)=>e in r?Wd(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var y=(r,e,t)=>(jd(r,typeof e!="symbol"?e+"":e,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F=require("three"),_c=require("@thatopen/fragments"),Xd=require("web-ifc");function da(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const D=da(F),We=da(_c),tt=da(Xd),Tc=0,Zd=1,qd=2,$a=2,to=1.25,Va=1,$n=6*4+4+4,Nr=65535,Qd=Math.pow(2,-24),eo=Symbol("SKIP_GENERATION");function Kd(r){return r.index?r.index.count:r.attributes.position.count}function Ji(r){return Kd(r)/3}function Jd(r,e=ArrayBuffer){return r>65535?new Uint32Array(new e(4*r)):new Uint16Array(new e(2*r))}function tu(r,e){if(!r.index){const t=r.attributes.position.count,i=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,s=Jd(t,i);r.setIndex(new F.BufferAttribute(s,1));for(let n=0;n<t;n++)s[n]=n}}function vc(r){const e=Ji(r),t=r.drawRange,i=t.start/3,s=(t.start+t.count)/3,n=Math.max(0,i),o=Math.min(e,s)-n;return[{offset:Math.floor(n),count:Math.floor(o)}]}function wc(r){if(!r.groups||!r.groups.length)return vc(r);const e=[],t=new Set,i=r.drawRange,s=i.start/3,n=(i.start+i.count)/3;for(const a of r.groups){const l=a.start/3,c=(a.start+a.count)/3;t.add(Math.max(s,l)),t.add(Math.min(n,c))}const o=Array.from(t.values()).sort((a,l)=>a-l);for(let a=0;a<o.length-1;a++){const l=o[a],c=o[a+1];e.push({offset:Math.floor(l),count:Math.floor(c-l)})}return e}function eu(r){if(r.groups.length===0)return!1;const e=Ji(r),t=wc(r).sort((n,o)=>n.offset-o.offset),i=t[t.length-1];i.count=Math.min(e-i.offset,i.count);let s=0;return t.forEach(({count:n})=>s+=n),e!==s}function Ft(r,e,t){return t.min.x=e[r],t.min.y=e[r+1],t.min.z=e[r+2],t.max.x=e[r+3],t.max.y=e[r+4],t.max.z=e[r+5],t}function iu(r){r[0]=r[1]=r[2]=1/0,r[3]=r[4]=r[5]=-1/0}function Ga(r){let e=-1,t=-1/0;for(let i=0;i<3;i++){const s=r[i+3]-r[i];s>t&&(t=s,e=i)}return e}function Ha(r,e){e.set(r)}function Ya(r,e,t){let i,s;for(let n=0;n<3;n++){const o=n+3;i=r[n],s=e[n],t[n]=i<s?i:s,i=r[o],s=e[o],t[o]=i>s?i:s}}function pn(r,e,t){for(let i=0;i<3;i++){const s=e[r+2*i],n=e[r+2*i+1],o=s-n,a=s+n;o<t[i]&&(t[i]=o),a>t[i+3]&&(t[i+3]=a)}}function us(r){const e=r[3]-r[0],t=r[4]-r[1],i=r[5]-r[2];return 2*(e*t+t*i+i*e)}function io(r,e,t,i,s=null){let n=1/0,o=1/0,a=1/0,l=-1/0,c=-1/0,h=-1/0,d=1/0,u=1/0,f=1/0,p=-1/0,m=-1/0,E=-1/0;const g=s!==null;for(let I=e*6,T=(e+t)*6;I<T;I+=6){const b=r[I+0],v=r[I+1],A=b-v,S=b+v;A<n&&(n=A),S>l&&(l=S),g&&b<d&&(d=b),g&&b>p&&(p=b);const N=r[I+2],R=r[I+3],P=N-R,M=N+R;P<o&&(o=P),M>c&&(c=M),g&&N<u&&(u=N),g&&N>m&&(m=N);const w=r[I+4],L=r[I+5],C=w-L,U=w+L;C<a&&(a=C),U>h&&(h=U),g&&w<f&&(f=w),g&&w>E&&(E=w)}i[0]=n,i[1]=o,i[2]=a,i[3]=l,i[4]=c,i[5]=h,g&&(s[0]=d,s[1]=u,s[2]=f,s[3]=p,s[4]=m,s[5]=E)}function su(r,e,t,i){let s=1/0,n=1/0,o=1/0,a=-1/0,l=-1/0,c=-1/0;for(let h=e*6,d=(e+t)*6;h<d;h+=6){const u=r[h+0];u<s&&(s=u),u>a&&(a=u);const f=r[h+2];f<n&&(n=f),f>l&&(l=f);const p=r[h+4];p<o&&(o=p),p>c&&(c=p)}i[0]=s,i[1]=n,i[2]=o,i[3]=a,i[4]=l,i[5]=c}function nu(r,e){iu(e);const t=r.attributes.position,i=r.index?r.index.array:null,s=Ji(r),n=new Float32Array(s*6),o=t.normalized,a=t.array,l=t.offset||0;let c=3;t.isInterleavedBufferAttribute&&(c=t.data.stride);const h=["getX","getY","getZ"];for(let d=0;d<s;d++){const u=d*3,f=d*6;let p=u+0,m=u+1,E=u+2;i&&(p=i[p],m=i[m],E=i[E]),o||(p=p*c+l,m=m*c+l,E=E*c+l);for(let g=0;g<3;g++){let I,T,b;o?(I=t[h[g]](p),T=t[h[g]](m),b=t[h[g]](E)):(I=a[p+g],T=a[m+g],b=a[E+g]);let v=I;T<v&&(v=T),b<v&&(v=b);let A=I;T>A&&(A=T),b>A&&(A=b);const S=(A-v)/2,N=g*2;n[f+N+0]=v+S,n[f+N+1]=S+(Math.abs(v)+S)*Qd,v<e[g]&&(e[g]=v),A>e[g+3]&&(e[g+3]=A)}}return n}const Fe=32,ru=(r,e)=>r.candidate-e.candidate,ke=new Array(Fe).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),mn=new Float32Array(6);function ou(r,e,t,i,s,n){let o=-1,a=0;if(n===Tc)o=Ga(e),o!==-1&&(a=(e[o]+e[o+3])/2);else if(n===Zd)o=Ga(r),o!==-1&&(a=au(t,i,s,o));else if(n===qd){const l=us(r);let c=to*s;const h=i*6,d=(i+s)*6;for(let u=0;u<3;u++){const f=e[u],E=(e[u+3]-f)/Fe;if(s<Fe/4){const g=[...ke];g.length=s;let I=0;for(let b=h;b<d;b+=6,I++){const v=g[I];v.candidate=t[b+2*u],v.count=0;const{bounds:A,leftCacheBounds:S,rightCacheBounds:N}=v;for(let R=0;R<3;R++)N[R]=1/0,N[R+3]=-1/0,S[R]=1/0,S[R+3]=-1/0,A[R]=1/0,A[R+3]=-1/0;pn(b,t,A)}g.sort(ru);let T=s;for(let b=0;b<T;b++){const v=g[b];for(;b+1<T&&g[b+1].candidate===v.candidate;)g.splice(b+1,1),T--}for(let b=h;b<d;b+=6){const v=t[b+2*u];for(let A=0;A<T;A++){const S=g[A];v>=S.candidate?pn(b,t,S.rightCacheBounds):(pn(b,t,S.leftCacheBounds),S.count++)}}for(let b=0;b<T;b++){const v=g[b],A=v.count,S=s-v.count,N=v.leftCacheBounds,R=v.rightCacheBounds;let P=0;A!==0&&(P=us(N)/l);let M=0;S!==0&&(M=us(R)/l);const w=Va+to*(P*A+M*S);w<c&&(o=u,c=w,a=v.candidate)}}else{for(let T=0;T<Fe;T++){const b=ke[T];b.count=0,b.candidate=f+E+T*E;const v=b.bounds;for(let A=0;A<3;A++)v[A]=1/0,v[A+3]=-1/0}for(let T=h;T<d;T+=6){let A=~~((t[T+2*u]-f)/E);A>=Fe&&(A=Fe-1);const S=ke[A];S.count++,pn(T,t,S.bounds)}const g=ke[Fe-1];Ha(g.bounds,g.rightCacheBounds);for(let T=Fe-2;T>=0;T--){const b=ke[T],v=ke[T+1];Ya(b.bounds,v.rightCacheBounds,b.rightCacheBounds)}let I=0;for(let T=0;T<Fe-1;T++){const b=ke[T],v=b.count,A=b.bounds,N=ke[T+1].rightCacheBounds;v!==0&&(I===0?Ha(A,mn):Ya(A,mn,mn)),I+=v;let R=0,P=0;I!==0&&(R=us(mn)/l);const M=s-I;M!==0&&(P=us(N)/l);const w=Va+to*(R*I+P*M);w<c&&(o=u,c=w,a=b.candidate)}}}}else console.warn(`MeshBVH: Invalid build strategy value ${n} used.`);return{axis:o,pos:a}}function au(r,e,t,i){let s=0;for(let n=e,o=e+t;n<o;n++)s+=r[n*6+i*2];return s/t}class gn{constructor(){}}function lu(r,e,t,i,s,n){let o=i,a=i+s-1;const l=n.pos,c=n.axis*2;for(;;){for(;o<=a&&t[o*6+c]<l;)o++;for(;o<=a&&t[a*6+c]>=l;)a--;if(o<a){for(let h=0;h<3;h++){let d=e[o*3+h];e[o*3+h]=e[a*3+h],e[a*3+h]=d}for(let h=0;h<6;h++){let d=t[o*6+h];t[o*6+h]=t[a*6+h],t[a*6+h]=d}o++,a--}else return o}}function cu(r,e,t,i,s,n){let o=i,a=i+s-1;const l=n.pos,c=n.axis*2;for(;;){for(;o<=a&&t[o*6+c]<l;)o++;for(;o<=a&&t[a*6+c]>=l;)a--;if(o<a){let h=r[o];r[o]=r[a],r[a]=h;for(let d=0;d<6;d++){let u=t[o*6+d];t[o*6+d]=t[a*6+d],t[a*6+d]=u}o++,a--}else return o}}function hu(r,e){const t=(r.index?r.index.count:r.attributes.position.count)/3,i=t>2**16,s=i?4:2,n=e?new SharedArrayBuffer(t*s):new ArrayBuffer(t*s),o=i?new Uint32Array(n):new Uint16Array(n);for(let a=0,l=o.length;a<l;a++)o[a]=a;return o}function du(r,e){const t=r.geometry,i=t.index?t.index.array:null,s=e.maxDepth,n=e.verbose,o=e.maxLeafTris,a=e.strategy,l=e.onProgress,c=Ji(t),h=r._indirectBuffer;let d=!1;const u=new Float32Array(6),f=new Float32Array(6),p=nu(t,u),m=e.indirect?cu:lu,E=[],g=e.indirect?vc(t):wc(t);if(g.length===1){const b=g[0],v=new gn;v.boundingData=u,su(p,b.offset,b.count,f),T(v,b.offset,b.count,f),E.push(v)}else for(let b of g){const v=new gn;v.boundingData=new Float32Array(6),io(p,b.offset,b.count,v.boundingData,f),T(v,b.offset,b.count,f),E.push(v)}return E;function I(b){l&&l(b/c)}function T(b,v,A,S=null,N=0){if(!d&&N>=s&&(d=!0,n&&(console.warn(`MeshBVH: Max depth of ${s} reached when generating BVH. Consider increasing maxDepth.`),console.warn(t))),A<=o||N>=s)return I(v+A),b.offset=v,b.count=A,b;const R=ou(b.boundingData,S,p,v,A,a);if(R.axis===-1)return I(v+A),b.offset=v,b.count=A,b;const P=m(h,i,p,v,A,R);if(P===v||P===v+A)I(v+A),b.offset=v,b.count=A;else{b.splitAxis=R.axis;const M=new gn,w=v,L=P-v;b.left=M,M.boundingData=new Float32Array(6),io(p,w,L,M.boundingData,f),T(M,w,L,f,N+1);const C=new gn,U=P,q=A-L;b.right=C,C.boundingData=new Float32Array(6),io(p,U,q,C.boundingData,f),T(C,U,q,f,N+1)}return b}}function uu(r,e){const t=r.geometry;e.indirect&&(r._indirectBuffer=hu(t,e.useSharedArrayBuffer),eu(t)&&!e.verbose&&console.warn('MeshBVH: Provided geometry contains groups that do not fully span the vertex contents while using the "indirect" option. BVH may incorrectly report intersections on unrendered portions of the geometry.')),r._indirectBuffer||tu(t,e);const i=du(r,e);let s,n,o;const a=[],l=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;for(let d=0;d<i.length;d++){const u=i[d];let f=c(u);const p=new l($n*f);s=new Float32Array(p),n=new Uint32Array(p),o=new Uint16Array(p),h(0,u),a.push(p)}r._roots=a;return;function c(d){return d.count?1:1+c(d.left)+c(d.right)}function h(d,u){const f=d/4,p=d/2,m=!!u.count,E=u.boundingData;for(let g=0;g<6;g++)s[f+g]=E[g];if(m){const g=u.offset,I=u.count;return n[f+6]=g,o[p+14]=I,o[p+15]=Nr,d+$n}else{const g=u.left,I=u.right,T=u.splitAxis;let b;if(b=h(d+$n,g),b/4>Math.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return n[f+6]=b/4,b=h(b,I),n[f+7]=T,b}}}class Ne{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(e,t){let i=1/0,s=-1/0;for(let n=0,o=e.length;n<o;n++){const l=e[n][t];i=l<i?l:i,s=l>s?l:s}this.min=i,this.max=s}setFromPoints(e,t){let i=1/0,s=-1/0;for(let n=0,o=t.length;n<o;n++){const a=t[n],l=e.dot(a);i=l<i?l:i,s=l>s?l:s}this.min=i,this.max=s}isSeparated(e){return this.min>e.max||e.min>this.max}}Ne.prototype.setFromBox=function(){const r=new F.Vector3;return function(t,i){const s=i.min,n=i.max;let o=1/0,a=-1/0;for(let l=0;l<=1;l++)for(let c=0;c<=1;c++)for(let h=0;h<=1;h++){r.x=s.x*l+n.x*(1-l),r.y=s.y*c+n.y*(1-c),r.z=s.z*h+n.z*(1-h);const d=t.dot(r);o=Math.min(d,o),a=Math.max(d,a)}this.min=o,this.max=a}}();const fu=function(){const r=new F.Vector3,e=new F.Vector3,t=new F.Vector3;return function(s,n,o){const a=s.start,l=r,c=n.start,h=e;t.subVectors(a,c),r.subVectors(s.end,s.start),e.subVectors(n.end,n.start);const d=t.dot(h),u=h.dot(l),f=h.dot(h),p=t.dot(l),E=l.dot(l)*f-u*u;let g,I;E!==0?g=(d*u-p*f)/E:g=0,I=(d+g*u)/f,o.x=g,o.y=I}}(),ua=function(){const r=new F.Vector2,e=new F.Vector3,t=new F.Vector3;return function(s,n,o,a){fu(s,n,r);let l=r.x,c=r.y;if(l>=0&&l<=1&&c>=0&&c<=1){s.at(l,o),n.at(c,a);return}else if(l>=0&&l<=1){c<0?n.at(0,a):n.at(1,a),s.closestPointToPoint(a,!0,o);return}else if(c>=0&&c<=1){l<0?s.at(0,o):s.at(1,o),n.closestPointToPoint(o,!0,a);return}else{let h;l<0?h=s.start:h=s.end;let d;c<0?d=n.start:d=n.end;const u=e,f=t;if(s.closestPointToPoint(d,!0,e),n.closestPointToPoint(h,!0,t),u.distanceToSquared(d)<=f.distanceToSquared(h)){o.copy(u),a.copy(d);return}else{o.copy(h),a.copy(f);return}}}}(),pu=function(){const r=new F.Vector3,e=new F.Vector3,t=new F.Plane,i=new F.Line3;return function(n,o){const{radius:a,center:l}=n,{a:c,b:h,c:d}=o;if(i.start=c,i.end=h,i.closestPointToPoint(l,!0,r).distanceTo(l)<=a||(i.start=c,i.end=d,i.closestPointToPoint(l,!0,r).distanceTo(l)<=a)||(i.start=h,i.end=d,i.closestPointToPoint(l,!0,r).distanceTo(l)<=a))return!0;const m=o.getPlane(t);if(Math.abs(m.distanceToPoint(l))<=a){const g=m.projectPoint(l,e);if(o.containsPoint(g))return!0}return!1}}(),mu=1e-15;function so(r){return Math.abs(r)<mu}class pe extends F.Triangle{constructor(...e){super(...e),this.isExtendedTriangle=!0,this.satAxes=new Array(4).fill().map(()=>new F.Vector3),this.satBounds=new Array(4).fill().map(()=>new Ne),this.points=[this.a,this.b,this.c],this.sphere=new F.Sphere,this.plane=new F.Plane,this.needsUpdate=!0}intersectsSphere(e){return pu(e,this)}update(){const e=this.a,t=this.b,i=this.c,s=this.points,n=this.satAxes,o=this.satBounds,a=n[0],l=o[0];this.getNormal(a),l.setFromPoints(a,s);const c=n[1],h=o[1];c.subVectors(e,t),h.setFromPoints(c,s);const d=n[2],u=o[2];d.subVectors(t,i),u.setFromPoints(d,s);const f=n[3],p=o[3];f.subVectors(i,e),p.setFromPoints(f,s),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(a,e),this.needsUpdate=!1}}pe.prototype.closestPointToSegment=function(){const r=new F.Vector3,e=new F.Vector3,t=new F.Line3;return function(s,n=null,o=null){const{start:a,end:l}=s,c=this.points;let h,d=1/0;for(let u=0;u<3;u++){const f=(u+1)%3;t.start.copy(c[u]),t.end.copy(c[f]),ua(t,s,r,e),h=r.distanceToSquared(e),h<d&&(d=h,n&&n.copy(r),o&&o.copy(e))}return this.closestPointToPoint(a,r),h=a.distanceToSquared(r),h<d&&(d=h,n&&n.copy(r),o&&o.copy(a)),this.closestPointToPoint(l,r),h=l.distanceToSquared(r),h<d&&(d=h,n&&n.copy(r),o&&o.copy(l)),Math.sqrt(d)}}();pe.prototype.intersectsTriangle=function(){const r=new pe,e=new Array(3),t=new Array(3),i=new Ne,s=new Ne,n=new F.Vector3,o=new F.Vector3,a=new F.Vector3,l=new F.Vector3,c=new F.Vector3,h=new F.Line3,d=new F.Line3,u=new F.Line3,f=new F.Vector3;function p(m,E,g){const I=m.points;let T=0,b=-1;for(let v=0;v<3;v++){const{start:A,end:S}=h;A.copy(I[v]),S.copy(I[(v+1)%3]),h.delta(o);const N=so(E.distanceToPoint(A));if(so(E.normal.dot(o))&&N){g.copy(h),T=2;break}const R=E.intersectLine(h,f);if(!R&&N&&f.copy(A),(R||N)&&!so(f.distanceTo(S))){if(T<=1)(T===1?g.start:g.end).copy(f),N&&(b=T);else if(T>=2){(b===1?g.start:g.end).copy(f),T=2;break}if(T++,T===2&&b===-1)break}}return T}return function(E,g=null,I=!1){this.needsUpdate&&this.update(),E.isExtendedTriangle?E.needsUpdate&&E.update():(r.copy(E),r.update(),E=r);const T=this.plane,b=E.plane;if(Math.abs(T.normal.dot(b.normal))>1-1e-10){const v=this.satBounds,A=this.satAxes;t[0]=E.a,t[1]=E.b,t[2]=E.c;for(let R=0;R<4;R++){const P=v[R],M=A[R];if(i.setFromPoints(M,t),P.isSeparated(i))return!1}const S=E.satBounds,N=E.satAxes;e[0]=this.a,e[1]=this.b,e[2]=this.c;for(let R=0;R<4;R++){const P=S[R],M=N[R];if(i.setFromPoints(M,e),P.isSeparated(i))return!1}for(let R=0;R<4;R++){const P=A[R];for(let M=0;M<4;M++){const w=N[M];if(n.crossVectors(P,w),i.setFromPoints(n,e),s.setFromPoints(n,t),i.isSeparated(s))return!1}}return g&&(I||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),g.start.set(0,0,0),g.end.set(0,0,0)),!0}else{const v=p(this,b,d);if(v===1&&E.containsPoint(d.end))return g&&(g.start.copy(d.end),g.end.copy(d.end)),!0;if(v!==2)return!1;const A=p(E,T,u);if(A===1&&this.containsPoint(u.end))return g&&(g.start.copy(u.end),g.end.copy(u.end)),!0;if(A!==2)return!1;if(d.delta(a),u.delta(l),a.dot(l)<0){let L=u.start;u.start=u.end,u.end=L}const S=d.start.dot(a),N=d.end.dot(a),R=u.start.dot(a),P=u.end.dot(a),M=N<R,w=S<P;return S!==P&&R!==N&&M===w?!1:(g&&(c.subVectors(d.start,u.start),c.dot(a)>0?g.start.copy(d.start):g.start.copy(u.start),c.subVectors(d.end,u.end),c.dot(a)<0?g.end.copy(d.end):g.end.copy(u.end)),!0)}}}();pe.prototype.distanceToPoint=function(){const r=new F.Vector3;return function(t){return this.closestPointToPoint(t,r),t.distanceTo(r)}}();pe.prototype.distanceToTriangle=function(){const r=new F.Vector3,e=new F.Vector3,t=["a","b","c"],i=new F.Line3,s=new F.Line3;return function(o,a=null,l=null){const c=a||l?i:null;if(this.intersectsTriangle(o,c))return(a||l)&&(a&&c.getCenter(a),l&&c.getCenter(l)),0;let h=1/0;for(let d=0;d<3;d++){let u;const f=t[d],p=o[f];this.closestPointToPoint(p,r),u=p.distanceToSquared(r),u<h&&(h=u,a&&a.copy(r),l&&l.copy(p));const m=this[f];o.closestPointToPoint(m,r),u=m.distanceToSquared(r),u<h&&(h=u,a&&a.copy(m),l&&l.copy(r))}for(let d=0;d<3;d++){const u=t[d],f=t[(d+1)%3];i.set(this[u],this[f]);for(let p=0;p<3;p++){const m=t[p],E=t[(p+1)%3];s.set(o[m],o[E]),ua(i,s,r,e);const g=r.distanceToSquared(e);g<h&&(h=g,a&&a.copy(r),l&&l.copy(e))}}return Math.sqrt(h)}}();class Wt{constructor(e,t,i){this.isOrientedBox=!0,this.min=new F.Vector3,this.max=new F.Vector3,this.matrix=new F.Matrix4,this.invMatrix=new F.Matrix4,this.points=new Array(8).fill().map(()=>new F.Vector3),this.satAxes=new Array(3).fill().map(()=>new F.Vector3),this.satBounds=new Array(3).fill().map(()=>new Ne),this.alignedSatBounds=new Array(3).fill().map(()=>new Ne),this.needsUpdate=!1,e&&this.min.copy(e),t&&this.max.copy(t),i&&this.matrix.copy(i)}set(e,t,i){this.min.copy(e),this.max.copy(t),this.matrix.copy(i),this.needsUpdate=!0}copy(e){this.min.copy(e.min),this.max.copy(e.max),this.matrix.copy(e.matrix),this.needsUpdate=!0}}Wt.prototype.update=function(){return function(){const e=this.matrix,t=this.min,i=this.max,s=this.points;for(let c=0;c<=1;c++)for(let h=0;h<=1;h++)for(let d=0;d<=1;d++){const u=1*c|2*h|4*d,f=s[u];f.x=c?i.x:t.x,f.y=h?i.y:t.y,f.z=d?i.z:t.z,f.applyMatrix4(e)}const n=this.satBounds,o=this.satAxes,a=s[0];for(let c=0;c<3;c++){const h=o[c],d=n[c],u=1<<c,f=s[u];h.subVectors(a,f),d.setFromPoints(h,s)}const l=this.alignedSatBounds;l[0].setFromPointsField(s,"x"),l[1].setFromPointsField(s,"y"),l[2].setFromPointsField(s,"z"),this.invMatrix.copy(this.matrix).invert(),this.needsUpdate=!1}}();Wt.prototype.intersectsBox=function(){const r=new Ne;return function(t){this.needsUpdate&&this.update();const i=t.min,s=t.max,n=this.satBounds,o=this.satAxes,a=this.alignedSatBounds;if(r.min=i.x,r.max=s.x,a[0].isSeparated(r)||(r.min=i.y,r.max=s.y,a[1].isSeparated(r))||(r.min=i.z,r.max=s.z,a[2].isSeparated(r)))return!1;for(let l=0;l<3;l++){const c=o[l],h=n[l];if(r.setFromBox(c,t),h.isSeparated(r))return!1}return!0}}();Wt.prototype.intersectsTriangle=function(){const r=new pe,e=new Array(3),t=new Ne,i=new Ne,s=new F.Vector3;return function(o){this.needsUpdate&&this.update(),o.isExtendedTriangle?o.needsUpdate&&o.update():(r.copy(o),r.update(),o=r);const a=this.satBounds,l=this.satAxes;e[0]=o.a,e[1]=o.b,e[2]=o.c;for(let u=0;u<3;u++){const f=a[u],p=l[u];if(t.setFromPoints(p,e),f.isSeparated(t))return!1}const c=o.satBounds,h=o.satAxes,d=this.points;for(let u=0;u<3;u++){const f=c[u],p=h[u];if(t.setFromPoints(p,d),f.isSeparated(t))return!1}for(let u=0;u<3;u++){const f=l[u];for(let p=0;p<4;p++){const m=h[p];if(s.crossVectors(f,m),t.setFromPoints(s,e),i.setFromPoints(s,d),t.isSeparated(i))return!1}}return!0}}();Wt.prototype.closestPointToPoint=function(){return function(e,t){return this.needsUpdate&&this.update(),t.copy(e).applyMatrix4(this.invMatrix).clamp(this.min,this.max).applyMatrix4(this.matrix),t}}();Wt.prototype.distanceToPoint=function(){const r=new F.Vector3;return function(t){return this.closestPointToPoint(t,r),t.distanceTo(r)}}();Wt.prototype.distanceToBox=function(){const r=["x","y","z"],e=new Array(12).fill().map(()=>new F.Line3),t=new Array(12).fill().map(()=>new F.Line3),i=new F.Vector3,s=new F.Vector3;return function(o,a=0,l=null,c=null){if(this.needsUpdate&&this.update(),this.intersectsBox(o))return(l||c)&&(o.getCenter(s),this.closestPointToPoint(s,i),o.closestPointToPoint(i,s),l&&l.copy(i),c&&c.copy(s)),0;const h=a*a,d=o.min,u=o.max,f=this.points;let p=1/0;for(let E=0;E<8;E++){const g=f[E];s.copy(g).clamp(d,u);const I=g.distanceToSquared(s);if(I<p&&(p=I,l&&l.copy(g),c&&c.copy(s),I<h))return Math.sqrt(I)}let m=0;for(let E=0;E<3;E++)for(let g=0;g<=1;g++)for(let I=0;I<=1;I++){const T=(E+1)%3,b=(E+2)%3,v=g<<T|I<<b,A=1<<E|g<<T|I<<b,S=f[v],N=f[A];e[m].set(S,N);const P=r[E],M=r[T],w=r[b],L=t[m],C=L.start,U=L.end;C[P]=d[P],C[M]=g?d[M]:u[M],C[w]=I?d[w]:u[M],U[P]=u[P],U[M]=g?d[M]:u[M],U[w]=I?d[w]:u[M],m++}for(let E=0;E<=1;E++)for(let g=0;g<=1;g++)for(let I=0;I<=1;I++){s.x=E?u.x:d.x,s.y=g?u.y:d.y,s.z=I?u.z:d.z,this.closestPointToPoint(s,i);const T=s.distanceToSquared(i);if(T<p&&(p=T,l&&l.copy(i),c&&c.copy(s),T<h))return Math.sqrt(T)}for(let E=0;E<12;E++){const g=e[E];for(let I=0;I<12;I++){const T=t[I];ua(g,T,i,s);const b=i.distanceToSquared(s);if(b<p&&(p=b,l&&l.copy(i),c&&c.copy(s),b<h))return Math.sqrt(b)}}return Math.sqrt(p)}}();class fa{constructor(e){this._getNewPrimitive=e,this._primitives=[]}getPrimitive(){const e=this._primitives;return e.length===0?this._getNewPrimitive():e.pop()}releasePrimitive(e){this._primitives.push(e)}}class gu extends fa{constructor(){super(()=>new pe)}}const ie=new gu;function Xt(r,e){return e[r+15]===65535}function Zt(r,e){return e[r+6]}function se(r,e){return e[r+14]}function ne(r){return r+8}function re(r,e){return e[r+6]}function Ac(r,e){return e[r+7]}class Eu{constructor(){this.float32Array=null,this.uint16Array=null,this.uint32Array=null;const e=[];let t=null;this.setBuffer=i=>{t&&e.push(t),t=i,this.float32Array=new Float32Array(i),this.uint16Array=new Uint16Array(i),this.uint32Array=new Uint32Array(i)},this.clearBuffer=()=>{t=null,this.float32Array=null,this.uint16Array=null,this.uint32Array=null,e.length!==0&&this.setBuffer(e.pop())}}}const At=new Eu;let Ye,zi;const wi=[],En=new fa(()=>new F.Box3);function bu(r,e,t,i,s,n){Ye=En.getPrimitive(),zi=En.getPrimitive(),wi.push(Ye,zi),At.setBuffer(r._roots[e]);const o=Po(0,r.geometry,t,i,s,n);At.clearBuffer(),En.releasePrimitive(Ye),En.releasePrimitive(zi),wi.pop(),wi.pop();const a=wi.length;return a>0&&(zi=wi[a-1],Ye=wi[a-2]),o}function Po(r,e,t,i,s=null,n=0,o=0){const{float32Array:a,uint16Array:l,uint32Array:c}=At;let h=r*2;if(Xt(h,l)){const u=Zt(r,c),f=se(h,l);return Ft(r,a,Ye),i(u,f,!1,o,n+r,Ye)}else{let P=function(w){const{uint16Array:L,uint32Array:C}=At;let U=w*2;for(;!Xt(U,L);)w=ne(w),U=w*2;return Zt(w,C)},M=function(w){const{uint16Array:L,uint32Array:C}=At;let U=w*2;for(;!Xt(U,L);)w=re(w,C),U=w*2;return Zt(w,C)+se(U,L)};const u=ne(r),f=re(r,c);let p=u,m=f,E,g,I,T;if(s&&(I=Ye,T=zi,Ft(p,a,I),Ft(m,a,T),E=s(I),g=s(T),g<E)){p=f,m=u;const w=E;E=g,g=w,I=T}I||(I=Ye,Ft(p,a,I));const b=Xt(p*2,l),v=t(I,b,E,o+1,n+p);let A;if(v===$a){const w=P(p),C=M(p)-w;A=i(w,C,!0,o+1,n+p,I)}else A=v&&Po(p,e,t,i,s,n,o+1);if(A)return!0;T=zi,Ft(m,a,T);const S=Xt(m*2,l),N=t(T,S,g,o+1,n+m);let R;if(N===$a){const w=P(m),C=M(m)-w;R=i(w,C,!0,o+1,n+m,T)}else R=N&&Po(m,e,t,i,s,n,o+1);return!!R}}const fs=new F.Vector3,no=new F.Vector3;function Iu(r,e,t={},i=0,s=1/0){const n=i*i,o=s*s;let a=1/0,l=null;if(r.shapecast({boundsTraverseOrder:h=>(fs.copy(e).clamp(h.min,h.max),fs.distanceToSquared(e)),intersectsBounds:(h,d,u)=>u<a&&u<o,intersectsTriangle:(h,d)=>{h.closestPointToPoint(e,fs);const u=e.distanceToSquared(fs);return u<a&&(no.copy(fs),a=u,l=d),u<n}}),a===1/0)return null;const c=Math.sqrt(a);return t.point?t.point.copy(no):t.point=no.clone(),t.distance=c,t.faceIndex=l,t}const Ai=new F.Vector3,Ri=new F.Vector3,Si=new F.Vector3,bn=new F.Vector2,In=new F.Vector2,Cn=new F.Vector2,Wa=new F.Vector3,ja=new F.Vector3,Xa=new F.Vector3,yn=new F.Vector3;function Cu(r,e,t,i,s,n){let o;return n===F.BackSide?o=r.intersectTriangle(i,t,e,!0,s):o=r.intersectTriangle(e,t,i,n!==F.DoubleSide,s),o===null?null:{distance:r.origin.distanceTo(s),point:s.clone()}}function yu(r,e,t,i,s,n,o,a,l){Ai.fromBufferAttribute(e,n),Ri.fromBufferAttribute(e,o),Si.fromBufferAttribute(e,a);const c=Cu(r,Ai,Ri,Si,yn,l);if(c){i&&(bn.fromBufferAttribute(i,n),In.fromBufferAttribute(i,o),Cn.fromBufferAttribute(i,a),c.uv=F.Triangle.getInterpolation(yn,Ai,Ri,Si,bn,In,Cn,new F.Vector2)),s&&(bn.fromBufferAttribute(s,n),In.fromBufferAttribute(s,o),Cn.fromBufferAttribute(s,a),c.uv1=F.Triangle.getInterpolation(yn,Ai,Ri,Si,bn,In,Cn,new F.Vector2)),t&&(Wa.fromBufferAttribute(t,n),ja.fromBufferAttribute(t,o),Xa.fromBufferAttribute(t,a),c.normal=F.Triangle.getInterpolation(yn,Ai,Ri,Si,Wa,ja,Xa,new F.Vector3),c.normal.dot(r.direction)>0&&c.normal.multiplyScalar(-1));const h={a:n,b:o,c:a,normal:new F.Vector3,materialIndex:0};F.Triangle.getNormal(Ai,Ri,Si,h.normal),c.face=h,c.faceIndex=n}return c}function Pr(r,e,t,i,s){const n=i*3;let o=n+0,a=n+1,l=n+2;const c=r.index;r.index&&(o=c.getX(o),a=c.getX(a),l=c.getX(l));const{position:h,normal:d,uv:u,uv1:f}=r.attributes,p=yu(t,h,d,u,f,o,a,l,e);return p?(p.faceIndex=i,s&&s.push(p),p):null}function Ut(r,e,t,i){const s=r.a,n=r.b,o=r.c;let a=e,l=e+1,c=e+2;t&&(a=t.getX(a),l=t.getX(l),c=t.getX(c)),s.x=i.getX(a),s.y=i.getY(a),s.z=i.getZ(a),n.x=i.getX(l),n.y=i.getY(l),n.z=i.getZ(l),o.x=i.getX(c),o.y=i.getY(c),o.z=i.getZ(c)}function _u(r,e,t,i,s,n){const{geometry:o,_indirectBuffer:a}=r;for(let l=i,c=i+s;l<c;l++)Pr(o,e,t,l,n)}function Tu(r,e,t,i,s){const{geometry:n,_indirectBuffer:o}=r;let a=1/0,l=null;for(let c=i,h=i+s;c<h;c++){let d;d=Pr(n,e,t,c),d&&d.distance<a&&(l=d,a=d.distance)}return l}function vu(r,e,t,i,s,n,o){const{geometry:a}=t,{index:l}=a,c=a.attributes.position;for(let h=r,d=e+r;h<d;h++){let u;if(u=h,Ut(o,u*3,l,c),o.needsUpdate=!0,i(o,u,s,n))return!0}return!1}function wu(r,e=null){e&&Array.isArray(e)&&(e=new Set(e));const t=r.geometry,i=t.index?t.index.array:null,s=t.attributes.position;let n,o,a,l,c=0;const h=r._roots;for(let u=0,f=h.length;u<f;u++)n=h[u],o=new Uint32Array(n),a=new Uint16Array(n),l=new Float32Array(n),d(0,c),c+=n.byteLength;function d(u,f,p=!1){const m=u*2;if(a[m+15]===Nr){const g=o[u+6],I=a[m+14];let T=1/0,b=1/0,v=1/0,A=-1/0,S=-1/0,N=-1/0;for(let R=3*g,P=3*(g+I);R<P;R++){let M=i[R];const w=s.getX(M),L=s.getY(M),C=s.getZ(M);w<T&&(T=w),w>A&&(A=w),L<b&&(b=L),L>S&&(S=L),C<v&&(v=C),C>N&&(N=C)}return l[u+0]!==T||l[u+1]!==b||l[u+2]!==v||l[u+3]!==A||l[u+4]!==S||l[u+5]!==N?(l[u+0]=T,l[u+1]=b,l[u+2]=v,l[u+3]=A,l[u+4]=S,l[u+5]=N,!0):!1}else{const g=u+8,I=o[u+6],T=g+f,b=I+f;let v=p,A=!1,S=!1;e?v||(A=e.has(T),S=e.has(b),v=!A&&!S):(A=!0,S=!0);const N=v||A,R=v||S;let P=!1;N&&(P=d(g,f,v));let M=!1;R&&(M=d(I,f,v));const w=P||M;if(w)for(let L=0;L<3;L++){const C=g+L,U=I+L,q=l[C],G=l[C+3],st=l[U],Y=l[U+3];l[u+L]=q<st?q:st,l[u+L+3]=G>Y?G:Y}return w}}}const Za=new F.Box3;function Xe(r,e,t,i){return Ft(r,e,Za),t.intersectBox(Za,i)}function Au(r,e,t,i,s,n){const{geometry:o,_indirectBuffer:a}=r;for(let l=i,c=i+s;l<c;l++){let h=a?a[l]:l;Pr(o,e,t,h,n)}}function Ru(r,e,t,i,s){const{geometry:n,_indirectBuffer:o}=r;let a=1/0,l=null;for(let c=i,h=i+s;c<h;c++){let d;d=Pr(n,e,t,o?o[c]:c),d&&d.distance<a&&(l=d,a=d.distance)}return l}function Su(r,e,t,i,s,n,o){const{geometry:a}=t,{index:l}=a,c=a.attributes.position;for(let h=r,d=e+r;h<d;h++){let u;if(u=t.resolveTriangleIndex(h),Ut(o,u*3,l,c),o.needsUpdate=!0,i(o,u,s,n))return!0}return!1}const qa=new F.Vector3;function Fu(r,e,t,i,s){At.setBuffer(r._roots[e]),Lo(0,r,t,i,s),At.clearBuffer()}function Lo(r,e,t,i,s){const{float32Array:n,uint16Array:o,uint32Array:a}=At,l=r*2;if(Xt(l,o)){const h=Zt(r,a),d=se(l,o);_u(e,t,i,h,d,s)}else{const h=ne(r);Xe(h,n,i,qa)&&Lo(h,e,t,i,s);const d=re(r,a);Xe(d,n,i,qa)&&Lo(d,e,t,i,s)}}const Qa=new F.Vector3,Ou=["x","y","z"];function xu(r,e,t,i){At.setBuffer(r._roots[e]);const s=Mo(0,r,t,i);return At.clearBuffer(),s}function Mo(r,e,t,i){const{float32Array:s,uint16Array:n,uint32Array:o}=At;let a=r*2;if(Xt(a,n)){const c=Zt(r,o),h=se(a,n);return Tu(e,t,i,c,h)}else{const c=Ac(r,o),h=Ou[c],u=i.direction[h]>=0;let f,p;u?(f=ne(r),p=re(r,o)):(f=re(r,o),p=ne(r));const E=Xe(f,s,i,Qa)?Mo(f,e,t,i):null;if(E){const T=E.point[h];if(u?T<=s[p+c]:T>=s[p+c+3])return E}const I=Xe(p,s,i,Qa)?Mo(p,e,t,i):null;return E&&I?E.distance<=I.distance?E:I:E||I||null}}const _n=new F.Box3,Fi=new pe,Oi=new pe,ps=new F.Matrix4,Ka=new Wt,Tn=new Wt;function Nu(r,e,t,i){At.setBuffer(r._roots[e]);const s=Do(0,r,t,i);return At.clearBuffer(),s}function Do(r,e,t,i,s=null){const{float32Array:n,uint16Array:o,uint32Array:a}=At;let l=r*2;if(s===null&&(t.boundingBox||t.computeBoundingBox(),Ka.set(t.boundingBox.min,t.boundingBox.max,i),s=Ka),Xt(l,o)){const h=e.geometry,d=h.index,u=h.attributes.position,f=t.index,p=t.attributes.position,m=Zt(r,a),E=se(l,o);if(ps.copy(i).invert(),t.boundsTree)return Ft(r,n,Tn),Tn.matrix.copy(ps),Tn.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:I=>Tn.intersectsBox(I),intersectsTriangle:I=>{I.a.applyMatrix4(i),I.b.applyMatrix4(i),I.c.applyMatrix4(i),I.needsUpdate=!0;for(let T=m*3,b=(E+m)*3;T<b;T+=3)if(Ut(Oi,T,d,u),Oi.needsUpdate=!0,I.intersectsTriangle(Oi))return!0;return!1}});for(let g=m*3,I=(E+m)*3;g<I;g+=3){Ut(Fi,g,d,u),Fi.a.applyMatrix4(ps),Fi.b.applyMatrix4(ps),Fi.c.applyMatrix4(ps),Fi.needsUpdate=!0;for(let T=0,b=f.count;T<b;T+=3)if(Ut(Oi,T,f,p),Oi.needsUpdate=!0,Fi.intersectsTriangle(Oi))return!0}}else{const h=r+8,d=a[r+6];return Ft(h,n,_n),!!(s.intersectsBox(_n)&&Do(h,e,t,i,s)||(Ft(d,n,_n),s.intersectsBox(_n)&&Do(d,e,t,i,s)))}}const vn=new F.Matrix4,ro=new Wt,ms=new Wt,Pu=new F.Vector3,Lu=new F.Vector3,Mu=new F.Vector3,Du=new F.Vector3;function Uu(r,e,t,i={},s={},n=0,o=1/0){e.boundingBox||e.computeBoundingBox(),ro.set(e.boundingBox.min,e.boundingBox.max,t),ro.needsUpdate=!0;const a=r.geometry,l=a.attributes.position,c=a.index,h=e.attributes.position,d=e.index,u=ie.getPrimitive(),f=ie.getPrimitive();let p=Pu,m=Lu,E=null,g=null;s&&(E=Mu,g=Du);let I=1/0,T=null,b=null;return vn.copy(t).invert(),ms.matrix.copy(vn),r.shapecast({boundsTraverseOrder:v=>ro.distanceToBox(v),intersectsBounds:(v,A,S)=>S<I&&S<o?(A&&(ms.min.copy(v.min),ms.max.copy(v.max),ms.needsUpdate=!0),!0):!1,intersectsRange:(v,A)=>{if(e.boundsTree)return e.boundsTree.shapecast({boundsTraverseOrder:N=>ms.distanceToBox(N),intersectsBounds:(N,R,P)=>P<I&&P<o,intersectsRange:(N,R)=>{for(let P=N,M=N+R;P<M;P++){Ut(f,3*P,d,h),f.a.applyMatrix4(t),f.b.applyMatrix4(t),f.c.applyMatrix4(t),f.needsUpdate=!0;for(let w=v,L=v+A;w<L;w++){Ut(u,3*w,c,l),u.needsUpdate=!0;const C=u.distanceToTriangle(f,p,E);if(C<I&&(m.copy(p),g&&g.copy(E),I=C,T=w,b=P),C<n)return!0}}}});{const S=Ji(e);for(let N=0,R=S;N<R;N++){Ut(f,3*N,d,h),f.a.applyMatrix4(t),f.b.applyMatrix4(t),f.c.applyMatrix4(t),f.needsUpdate=!0;for(let P=v,M=v+A;P<M;P++){Ut(u,3*P,c,l),u.needsUpdate=!0;const w=u.distanceToTriangle(f,p,E);if(w<I&&(m.copy(p),g&&g.copy(E),I=w,T=P,b=N),w<n)return!0}}}}}),ie.releasePrimitive(u),ie.releasePrimitive(f),I===1/0?null:(i.point?i.point.copy(m):i.point=m.clone(),i.distance=I,i.faceIndex=T,s&&(s.point?s.point.copy(g):s.point=g.clone(),s.point.applyMatrix4(vn),m.applyMatrix4(vn),s.distance=m.sub(s.point).length(),s.faceIndex=b),i)}function ku(r,e=null){e&&Array.isArray(e)&&(e=new Set(e));const t=r.geometry,i=t.index?t.index.array:null,s=t.attributes.position;let n,o,a,l,c=0;const h=r._roots;for(let u=0,f=h.length;u<f;u++)n=h[u],o=new Uint32Array(n),a=new Uint16Array(n),l=new Float32Array(n),d(0,c),c+=n.byteLength;function d(u,f,p=!1){const m=u*2;if(a[m+15]===Nr){const g=o[u+6],I=a[m+14];let T=1/0,b=1/0,v=1/0,A=-1/0,S=-1/0,N=-1/0;for(let R=g,P=g+I;R<P;R++){const M=3*r.resolveTriangleIndex(R);for(let w=0;w<3;w++){let L=M+w;L=i?i[L]:L;const C=s.getX(L),U=s.getY(L),q=s.getZ(L);C<T&&(T=C),C>A&&(A=C),U<b&&(b=U),U>S&&(S=U),q<v&&(v=q),q>N&&(N=q)}}return l[u+0]!==T||l[u+1]!==b||l[u+2]!==v||l[u+3]!==A||l[u+4]!==S||l[u+5]!==N?(l[u+0]=T,l[u+1]=b,l[u+2]=v,l[u+3]=A,l[u+4]=S,l[u+5]=N,!0):!1}else{const g=u+8,I=o[u+6],T=g+f,b=I+f;let v=p,A=!1,S=!1;e?v||(A=e.has(T),S=e.has(b),v=!A&&!S):(A=!0,S=!0);const N=v||A,R=v||S;let P=!1;N&&(P=d(g,f,v));let M=!1;R&&(M=d(I,f,v));const w=P||M;if(w)for(let L=0;L<3;L++){const C=g+L,U=I+L,q=l[C],G=l[C+3],st=l[U],Y=l[U+3];l[u+L]=q<st?q:st,l[u+L+3]=G>Y?G:Y}return w}}}const Ja=new F.Vector3;function Bu(r,e,t,i,s){At.setBuffer(r._roots[e]),Uo(0,r,t,i,s),At.clearBuffer()}function Uo(r,e,t,i,s){const{float32Array:n,uint16Array:o,uint32Array:a}=At,l=r*2;if(Xt(l,o)){const h=Zt(r,a),d=se(l,o);Au(e,t,i,h,d,s)}else{const h=ne(r);Xe(h,n,i,Ja)&&Uo(h,e,t,i,s);const d=re(r,a);Xe(d,n,i,Ja)&&Uo(d,e,t,i,s)}}const tl=new F.Vector3,zu=["x","y","z"];function $u(r,e,t,i){At.setBuffer(r._roots[e]);const s=ko(0,r,t,i);return At.clearBuffer(),s}function ko(r,e,t,i){const{float32Array:s,uint16Array:n,uint32Array:o}=At;let a=r*2;if(Xt(a,n)){const c=Zt(r,o),h=se(a,n);return Ru(e,t,i,c,h)}else{const c=Ac(r,o),h=zu[c],u=i.direction[h]>=0;let f,p;u?(f=ne(r),p=re(r,o)):(f=re(r,o),p=ne(r));const E=Xe(f,s,i,tl)?ko(f,e,t,i):null;if(E){const T=E.point[h];if(u?T<=s[p+c]:T>=s[p+c+3])return E}const I=Xe(p,s,i,tl)?ko(p,e,t,i):null;return E&&I?E.distance<=I.distance?E:I:E||I||null}}const wn=new F.Box3,xi=new pe,Ni=new pe,gs=new F.Matrix4,el=new Wt,An=new Wt;function Vu(r,e,t,i){At.setBuffer(r._roots[e]);const s=Bo(0,r,t,i);return At.clearBuffer(),s}function Bo(r,e,t,i,s=null){const{float32Array:n,uint16Array:o,uint32Array:a}=At;let l=r*2;if(s===null&&(t.boundingBox||t.computeBoundingBox(),el.set(t.boundingBox.min,t.boundingBox.max,i),s=el),Xt(l,o)){const h=e.geometry,d=h.index,u=h.attributes.position,f=t.index,p=t.attributes.position,m=Zt(r,a),E=se(l,o);if(gs.copy(i).invert(),t.boundsTree)return Ft(r,n,An),An.matrix.copy(gs),An.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:I=>An.intersectsBox(I),intersectsTriangle:I=>{I.a.applyMatrix4(i),I.b.applyMatrix4(i),I.c.applyMatrix4(i),I.needsUpdate=!0;for(let T=m,b=E+m;T<b;T++)if(Ut(Ni,3*e.resolveTriangleIndex(T),d,u),Ni.needsUpdate=!0,I.intersectsTriangle(Ni))return!0;return!1}});for(let g=m,I=E+m;g<I;g++){const T=e.resolveTriangleIndex(g);Ut(xi,3*T,d,u),xi.a.applyMatrix4(gs),xi.b.applyMatrix4(gs),xi.c.applyMatrix4(gs),xi.needsUpdate=!0;for(let b=0,v=f.count;b<v;b+=3)if(Ut(Ni,b,f,p),Ni.needsUpdate=!0,xi.intersectsTriangle(Ni))return!0}}else{const h=r+8,d=a[r+6];return Ft(h,n,wn),!!(s.intersectsBox(wn)&&Bo(h,e,t,i,s)||(Ft(d,n,wn),s.intersectsBox(wn)&&Bo(d,e,t,i,s)))}}const Rn=new F.Matrix4,oo=new Wt,Es=new Wt,Gu=new F.Vector3,Hu=new F.Vector3,Yu=new F.Vector3,Wu=new F.Vector3;function ju(r,e,t,i={},s={},n=0,o=1/0){e.boundingBox||e.computeBoundingBox(),oo.set(e.boundingBox.min,e.boundingBox.max,t),oo.needsUpdate=!0;const a=r.geometry,l=a.attributes.position,c=a.index,h=e.attributes.position,d=e.index,u=ie.getPrimitive(),f=ie.getPrimitive();let p=Gu,m=Hu,E=null,g=null;s&&(E=Yu,g=Wu);let I=1/0,T=null,b=null;return Rn.copy(t).invert(),Es.matrix.copy(Rn),r.shapecast({boundsTraverseOrder:v=>oo.distanceToBox(v),intersectsBounds:(v,A,S)=>S<I&&S<o?(A&&(Es.min.copy(v.min),Es.max.copy(v.max),Es.needsUpdate=!0),!0):!1,intersectsRange:(v,A)=>{if(e.boundsTree){const S=e.boundsTree;return S.shapecast({boundsTraverseOrder:N=>Es.distanceToBox(N),intersectsBounds:(N,R,P)=>P<I&&P<o,intersectsRange:(N,R)=>{for(let P=N,M=N+R;P<M;P++){const w=S.resolveTriangleIndex(P);Ut(f,3*w,d,h),f.a.applyMatrix4(t),f.b.applyMatrix4(t),f.c.applyMatrix4(t),f.needsUpdate=!0;for(let L=v,C=v+A;L<C;L++){const U=r.resolveTriangleIndex(L);Ut(u,3*U,c,l),u.needsUpdate=!0;const q=u.distanceToTriangle(f,p,E);if(q<I&&(m.copy(p),g&&g.copy(E),I=q,T=L,b=P),q<n)return!0}}}})}else{const S=Ji(e);for(let N=0,R=S;N<R;N++){Ut(f,3*N,d,h),f.a.applyMatrix4(t),f.b.applyMatrix4(t),f.c.applyMatrix4(t),f.needsUpdate=!0;for(let P=v,M=v+A;P<M;P++){const w=r.resolveTriangleIndex(P);Ut(u,3*w,c,l),u.needsUpdate=!0;const L=u.distanceToTriangle(f,p,E);if(L<I&&(m.copy(p),g&&g.copy(E),I=L,T=P,b=N),L<n)return!0}}}}}),ie.releasePrimitive(u),ie.releasePrimitive(f),I===1/0?null:(i.point?i.point.copy(m):i.point=m.clone(),i.distance=I,i.faceIndex=T,s&&(s.point?s.point.copy(g):s.point=g.clone(),s.point.applyMatrix4(Rn),m.applyMatrix4(Rn),s.distance=m.sub(s.point).length(),s.faceIndex=b),i)}function Xu(){return typeof SharedArrayBuffer<"u"}const xs=new At.constructor,Xn=new At.constructor,$e=new fa(()=>new F.Box3),Pi=new F.Box3,Li=new F.Box3,ao=new F.Box3,lo=new F.Box3;let co=!1;function Zu(r,e,t,i){if(co)throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");co=!0;const s=r._roots,n=e._roots;let o,a=0,l=0;const c=new F.Matrix4().copy(t).invert();for(let h=0,d=s.length;h<d;h++){xs.setBuffer(s[h]),l=0;const u=$e.getPrimitive();Ft(0,xs.float32Array,u),u.applyMatrix4(c);for(let f=0,p=n.length;f<p&&(Xn.setBuffer(n[h]),o=he(0,0,t,c,i,a,l,0,0,u),Xn.clearBuffer(),l+=n[f].length,!o);f++);if($e.releasePrimitive(u),xs.clearBuffer(),a+=s[h].length,o)break}return co=!1,o}function he(r,e,t,i,s,n=0,o=0,a=0,l=0,c=null,h=!1){let d,u;h?(d=Xn,u=xs):(d=xs,u=Xn);const f=d.float32Array,p=d.uint32Array,m=d.uint16Array,E=u.float32Array,g=u.uint32Array,I=u.uint16Array,T=r*2,b=e*2,v=Xt(T,m),A=Xt(b,I);let S=!1;if(A&&v)h?S=s(Zt(e,g),se(e*2,I),Zt(r,p),se(r*2,m),l,o+e,a,n+r):S=s(Zt(r,p),se(r*2,m),Zt(e,g),se(e*2,I),a,n+r,l,o+e);else if(A){const N=$e.getPrimitive();Ft(e,E,N),N.applyMatrix4(t);const R=ne(r),P=re(r,p);Ft(R,f,Pi),Ft(P,f,Li);const M=N.intersectsBox(Pi),w=N.intersectsBox(Li);S=M&&he(e,R,i,t,s,o,n,l,a+1,N,!h)||w&&he(e,P,i,t,s,o,n,l,a+1,N,!h),$e.releasePrimitive(N)}else{const N=ne(e),R=re(e,g);Ft(N,E,ao),Ft(R,E,lo);const P=c.intersectsBox(ao),M=c.intersectsBox(lo);if(P&&M)S=he(r,N,t,i,s,n,o,a,l+1,c,h)||he(r,R,t,i,s,n,o,a,l+1,c,h);else if(P)if(v)S=he(r,N,t,i,s,n,o,a,l+1,c,h);else{const w=$e.getPrimitive();w.copy(ao).applyMatrix4(t);const L=ne(r),C=re(r,p);Ft(L,f,Pi),Ft(C,f,Li);const U=w.intersectsBox(Pi),q=w.intersectsBox(Li);S=U&&he(N,L,i,t,s,o,n,l,a+1,w,!h)||q&&he(N,C,i,t,s,o,n,l,a+1,w,!h),$e.releasePrimitive(w)}else if(M)if(v)S=he(r,R,t,i,s,n,o,a,l+1,c,h);else{const w=$e.getPrimitive();w.copy(lo).applyMatrix4(t);const L=ne(r),C=re(r,p);Ft(L,f,Pi),Ft(C,f,Li);const U=w.intersectsBox(Pi),q=w.intersectsBox(Li);S=U&&he(R,L,i,t,s,o,n,l,a+1,w,!h)||q&&he(R,C,i,t,s,o,n,l,a+1,w,!h),$e.releasePrimitive(w)}}return S}const Sn=new Wt,il=new F.Box3;class pa{static serialize(e,t={}){t={cloneBuffers:!0,...t};const i=e.geometry,s=e._roots,n=e._indirectBuffer,o=i.getIndex();let a;return t.cloneBuffers?a={roots:s.map(l=>l.slice()),index:o.array.slice(),indirectBuffer:n?n.slice():null}:a={roots:s,index:o.array,indirectBuffer:n},a}static deserialize(e,t,i={}){i={setIndex:!0,indirect:!!e.indirectBuffer,...i};const{index:s,roots:n,indirectBuffer:o}=e,a=new pa(t,{...i,[eo]:!0});if(a._roots=n,a._indirectBuffer=o||null,i.setIndex){const l=t.getIndex();if(l===null){const c=new F.BufferAttribute(e.index,1,!1);t.setIndex(c)}else l.array!==s&&(l.array.set(s),l.needsUpdate=!0)}return a}get indirect(){return!!this._indirectBuffer}constructor(e,t={}){if(e.isBufferGeometry){if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw new Error("MeshBVH: Only BufferGeometries are supported.");if(t=Object.assign({strategy:Tc,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,indirect:!1,[eo]:!1},t),t.useSharedArrayBuffer&&!Xu())throw new Error("MeshBVH: SharedArrayBuffer is not available.");this.geometry=e,this._roots=null,this._indirectBuffer=null,t[eo]||(uu(this,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new F.Box3)));const{_indirectBuffer:i}=this;this.resolveTriangleIndex=t.indirect?s=>i[s]:s=>s}refit(e=null){return(this.indirect?ku:wu)(this,e)}traverse(e,t=0){const i=this._roots[t],s=new Uint32Array(i),n=new Uint16Array(i);o(0);function o(a,l=0){const c=a*2,h=n[c+15]===Nr;if(h){const d=s[a+6],u=n[c+14];e(l,h,new Float32Array(i,a*4,6),d,u)}else{const d=a+$n/4,u=s[a+6],f=s[a+7];e(l,h,new Float32Array(i,a*4,6),f)||(o(d,l+1),o(u,l+1))}}}raycast(e,t=F.FrontSide){const i=this._roots,s=this.geometry,n=[],o=t.isMaterial,a=Array.isArray(t),l=s.groups,c=o?t.side:t,h=this.indirect?Bu:Fu;for(let d=0,u=i.length;d<u;d++){const f=a?t[l[d].materialIndex].side:c,p=n.length;if(h(this,d,f,e,n),a){const m=l[d].materialIndex;for(let E=p,g=n.length;E<g;E++)n[E].face.materialIndex=m}}return n}raycastFirst(e,t=F.FrontSide){const i=this._roots,s=this.geometry,n=t.isMaterial,o=Array.isArray(t);let a=null;const l=s.groups,c=n?t.side:t,h=this.indirect?$u:xu;for(let d=0,u=i.length;d<u;d++){const f=o?t[l[d].materialIndex].side:c,p=h(this,d,f,e);p!=null&&(a==null||p.distance<a.distance)&&(a=p,o&&(p.face.materialIndex=l[d].materialIndex))}return a}intersectsGeometry(e,t){let i=!1;const s=this._roots,n=this.indirect?Vu:Nu;for(let o=0,a=s.length;o<a&&(i=n(this,o,e,t),!i);o++);return i}shapecast(e){const t=ie.getPrimitive(),i=this.indirect?Su:vu;let{boundsTraverseOrder:s,intersectsBounds:n,intersectsRange:o,intersectsTriangle:a}=e;if(o&&a){const d=o;o=(u,f,p,m,E)=>d(u,f,p,m,E)?!0:i(u,f,this,a,p,m,t)}else o||(a?o=(d,u,f,p)=>i(d,u,this,a,f,p,t):o=(d,u,f)=>f);let l=!1,c=0;const h=this._roots;for(let d=0,u=h.length;d<u;d++){const f=h[d];if(l=bu(this,d,n,o,s,c),l)break;c+=f.byteLength}return ie.releasePrimitive(t),l}bvhcast(e,t,i){let{intersectsRanges:s,intersectsTriangles:n}=i;const o=ie.getPrimitive(),a=this.geometry.index,l=this.geometry.attributes.position,c=this.indirect?p=>{const m=this.resolveTriangleIndex(p);Ut(o,m*3,a,l)}:p=>{Ut(o,p*3,a,l)},h=ie.getPrimitive(),d=e.geometry.index,u=e.geometry.attributes.position,f=e.indirect?p=>{const m=e.resolveTriangleIndex(p);Ut(h,m*3,d,u)}:p=>{Ut(h,p*3,d,u)};if(n){const p=(m,E,g,I,T,b,v,A)=>{for(let S=g,N=g+I;S<N;S++){f(S),h.a.applyMatrix4(t),h.b.applyMatrix4(t),h.c.applyMatrix4(t),h.needsUpdate=!0;for(let R=m,P=m+E;R<P;R++)if(c(R),o.needsUpdate=!0,n(o,h,R,S,T,b,v,A))return!0}return!1};if(s){const m=s;s=function(E,g,I,T,b,v,A,S){return m(E,g,I,T,b,v,A,S)?!0:p(E,g,I,T,b,v,A,S)}}else s=p}return Zu(this,e,t,s)}intersectsBox(e,t){return Sn.set(e.min,e.max,t),Sn.needsUpdate=!0,this.shapecast({intersectsBounds:i=>Sn.intersectsBox(i),intersectsTriangle:i=>Sn.intersectsTriangle(i)})}intersectsSphere(e){return this.shapecast({intersectsBounds:t=>e.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(e)})}closestPointToGeometry(e,t,i={},s={},n=0,o=1/0){return(this.indirect?ju:Uu)(this,e,t,i,s,n,o)}closestPointToPoint(e,t={},i=0,s=1/0){return Iu(this,e,t,i,s)}getBoundingBox(e){return e.makeEmpty(),this._roots.forEach(i=>{Ft(0,new Float32Array(i),il),e.union(il)}),e}}function sl(r,e,t){return r===null||(r.point.applyMatrix4(e.matrixWorld),r.distance=r.point.distanceTo(t.ray.origin),r.object=e,r.distance<t.near||r.distance>t.far)?null:r}const ho=new F.Ray,nl=new F.Matrix4,qu=F.Mesh.prototype.raycast;function Qu(r,e){if(this.geometry.boundsTree){if(this.material===void 0)return;nl.copy(this.matrixWorld).invert(),ho.copy(r.ray).applyMatrix4(nl);const t=this.geometry.boundsTree;if(r.firstHitOnly===!0){const i=sl(t.raycastFirst(ho,this.material),this,r);i&&e.push(i)}else{const i=t.raycast(ho,this.material);for(let s=0,n=i.length;s<n;s++){const o=sl(i[s],this,r);o&&e.push(o)}}}else qu.call(this,r,e)}function Ku(r){return this.boundsTree=new pa(this,r),this.boundsTree}function Ju(){this.boundsTree=null}let K=class{constructor(){y(this,"trigger",e=>{const t=this.handlers.slice(0);for(const i of t)i(e)});y(this,"handlers",[])}add(e){this.handlers.push(e)}remove(e){this.handlers=this.handlers.filter(t=>t!==e)}reset(){this.handlers.length=0}};class Ns{constructor(){y(this,"trigger",async e=>{const t=this.handlers.slice(0);for(const i of t)await i(e)});y(this,"handlers",[])}add(e){this.handlers.push(e)}remove(e){this.handlers=this.handlers.filter(t=>t!==e)}reset(){this.handlers.length=0}}class Lr{constructor(e){y(this,"isDisposeable",()=>"dispose"in this&&"onDisposed"in this);y(this,"isResizeable",()=>"resize"in this&&"getSize"in this);y(this,"isUpdateable",()=>"onAfterUpdate"in this&&"onBeforeUpdate"in this&&"update"in this);y(this,"isHideable",()=>"visible"in this);y(this,"isConfigurable",()=>"setup"in this&&"config"in this&&"onSetup"in this);this.components=e}}class Ot extends Lr{}class Mr extends Lr{constructor(t){super(t);y(this,"worlds",new Map);y(this,"onWorldChanged",new K);y(this,"currentWorld",null);this.onWorldChanged.add(({world:i,action:s})=>{s==="removed"&&this.worlds.delete(i.uuid)})}}class Rc extends Mr{constructor(){super(...arguments);y(this,"hasCameraControls",()=>"controls"in this)}}class Sc extends Mr{constructor(){super(...arguments);y(this,"onAfterUpdate",new K);y(this,"onBeforeUpdate",new K);y(this,"onDisposed",new K);y(this,"onResize",new K);y(this,"onClippingPlanesUpdated",new K);y(this,"clippingPlanes",[])}updateClippingPlanes(){this.onClippingPlanesUpdated.trigger()}setPlane(t,i,s){i.isLocal=s;const n=this.clippingPlanes.indexOf(i);t&&n===-1?this.clippingPlanes.push(i):!t&&n>-1&&this.clippingPlanes.splice(n,1),this.three.clippingPlanes=this.clippingPlanes.filter(o=>!o.isLocal)}}const ks=class ks extends Ot{constructor(t){super(t);y(this,"_disposedComponents",new Set);y(this,"enabled",!0);t.add(ks.uuid,this)}get(){return this._disposedComponents}destroy(t,i=!0,s=!0){t.removeFromParent();const n=t;n.dispose&&n.dispose(),this.disposeGeometryAndMaterials(t,i),s&&n.children&&n.children.length&&this.disposeChildren(n),t.children.length=0}disposeGeometry(t){t.boundsTree&&t.disposeBoundsTree&&t.disposeBoundsTree(),t.dispose()}disposeGeometryAndMaterials(t,i){const s=t;s.geometry&&this.disposeGeometry(s.geometry),i&&s.material&&ks.disposeMaterial(s),s.material=[],s.geometry=null}disposeChildren(t){for(const i of t.children)this.destroy(i)}static disposeMaterial(t){if(t.material)if(Array.isArray(t.material))for(const i of t.material)i.dispose();else t.material.dispose()}};y(ks,"uuid","76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe");let Pe=ks;class Fc extends Mr{constructor(t){super(t);y(this,"onDisposed",new K);y(this,"directionalLights",new Map);y(this,"ambientLights",new Map)}dispose(){const t=this.components.get(Pe);for(const i of this.three.children){const s=i;s.geometry&&t.destroy(s)}for(const[,i]of this.directionalLights)i.removeFromParent(),i.target.removeFromParent(),i.dispose();for(const[,i]of this.ambientLights)i.removeFromParent(),i.dispose();this.three.children=[],this.onDisposed.trigger(),this.onDisposed.reset()}}class $i extends Set{constructor(t){super(t);y(this,"onItemAdded",new K);y(this,"onItemDeleted",new K);y(this,"onCleared",new K);y(this,"guard",()=>!0)}clear(){super.clear(),this.onCleared.trigger()}add(...t){for(const i of t)this.has(i)||!this.guard(i)||(super.add(i),this.onItemAdded||(this.onItemAdded=new K),this.onItemAdded.trigger(i));return this}delete(t){const i=super.delete(t);return i&&this.onItemDeleted.trigger(),i}dispose(){this.clear(),this.onItemAdded.reset(),this.onItemDeleted.reset(),this.onCleared.reset()}}class pi extends Map{constructor(t){super(t);y(this,"onItemSet",new K);y(this,"onItemUpdated",new K);y(this,"onItemDeleted",new K);y(this,"onCleared",new K);y(this,"guard",()=>!0)}clear(){super.clear(),this.onCleared.trigger()}set(t,i){const s=this.has(t);if(!this.guard(t,i))return this;const o=super.set(t,i);return s?(this.onItemUpdated||(this.onItemUpdated=new K),this.onItemUpdated.trigger({key:t,value:i})):(this.onItemSet||(this.onItemSet=new K),this.onItemSet.trigger({key:t,value:i})),o}delete(t){const i=super.delete(t);return i&&this.onItemDeleted.trigger(t),i}dispose(){this.clear(),this.onItemSet.reset(),this.onItemDeleted.reset(),this.onCleared.reset()}}const Vn=0,tf=1,ef=new F.Vector3,rl=new F.Line3,uo=new F.Plane,ol=new F.Vector3,Fn=new F.Triangle;class sf{constructor(){this.tolerance=-1,this.faces=[],this.newFaces=[],this.assigned=new al,this.unassigned=new al,this.vertices=[]}setFromPoints(e){if(e.length>=4){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.vertices.push(new nf(e[t]));this.compute()}return this}setFromObject(e){const t=[];return e.updateMatrixWorld(!0),e.traverse(function(i){const s=i.geometry;if(s!==void 0){const n=s.attributes.position;if(n!==void 0)for(let o=0,a=n.count;o<a;o++){const l=new F.Vector3;l.fromBufferAttribute(n,o).applyMatrix4(i.matrixWorld),t.push(l)}}}),this.setFromPoints(t)}containsPoint(e){const t=this.faces;for(let i=0,s=t.length;i<s;i++)if(t[i].distanceToPoint(e)>this.tolerance)return!1;return!0}intersectRay(e,t){const i=this.faces;let s=-1/0,n=1/0;for(let o=0,a=i.length;o<a;o++){const l=i[o],c=l.distanceToPoint(e.origin),h=l.normal.dot(e.direction);if(c>0&&h>=0)return null;const d=h!==0?-c/h:0;if(!(d<=0)&&(h>0?n=Math.min(d,n):s=Math.max(d,s),s>n))return null}return s!==-1/0?e.at(s,t):e.at(n,t),t}intersectsRay(e){return this.intersectRay(e,ef)!==null}makeEmpty(){return this.faces=[],this.vertices=[],this}addVertexToFace(e,t){return e.face=t,t.outside===null?this.assigned.append(e):this.assigned.insertBefore(t.outside,e),t.outside=e,this}removeVertexFromFace(e,t){return e===t.outside&&(e.next!==null&&e.next.face===t?t.outside=e.next:t.outside=null),this.assigned.remove(e),this}removeAllVerticesFromFace(e){if(e.outside!==null){const t=e.outside;let i=e.outside;for(;i.next!==null&&i.next.face===e;)i=i.next;return this.assigned.removeSubList(t,i),t.prev=i.next=null,e.outside=null,t}}deleteFaceVertices(e,t){const i=this.removeAllVerticesFromFace(e);if(i!==void 0)if(t===void 0)this.unassigned.appendChain(i);else{let s=i;do{const n=s.next;t.distanceToPoint(s.point)>this.tolerance?this.addVertexToFace(s,t):this.unassigned.append(s),s=n}while(s!==null)}return this}resolveUnassignedPoints(e){if(this.unassigned.isEmpty()===!1){let t=this.unassigned.first();do{const i=t.next;let s=this.tolerance,n=null;for(let o=0;o<e.length;o++){const a=e[o];if(a.mark===Vn){const l=a.distanceToPoint(t.point);if(l>s&&(s=l,n=a),s>1e3*this.tolerance)break}}n!==null&&this.addVertexToFace(t,n),t=i}while(t!==null)}return this}computeExtremes(){const e=new F.Vector3,t=new F.Vector3,i=[],s=[];for(let n=0;n<3;n++)i[n]=s[n]=this.vertices[0];e.copy(this.vertices[0].point),t.copy(this.vertices[0].point);for(let n=0,o=this.vertices.length;n<o;n++){const a=this.vertices[n],l=a.point;for(let c=0;c<3;c++)l.getComponent(c)<e.getComponent(c)&&(e.setComponent(c,l.getComponent(c)),i[c]=a);for(let c=0;c<3;c++)l.getComponent(c)>t.getComponent(c)&&(t.setComponent(c,l.getComponent(c)),s[c]=a)}return this.tolerance=3*Number.EPSILON*(Math.max(Math.abs(e.x),Math.abs(t.x))+Math.max(Math.abs(e.y),Math.abs(t.y))+Math.max(Math.abs(e.z),Math.abs(t.z))),{min:i,max:s}}computeInitialHull(){const e=this.vertices,t=this.computeExtremes(),i=t.min,s=t.max;let n=0,o=0;for(let u=0;u<3;u++){const f=s[u].point.getComponent(u)-i[u].point.getComponent(u);f>n&&(n=f,o=u)}const a=i[o],l=s[o];let c,h;n=0,rl.set(a.point,l.point);for(let u=0,f=this.vertices.length;u<f;u++){const p=e[u];if(p!==a&&p!==l){rl.closestPointToPoint(p.point,!0,ol);const m=ol.distanceToSquared(p.point);m>n&&(n=m,c=p)}}n=-1,uo.setFromCoplanarPoints(a.point,l.point,c.point);for(let u=0,f=this.vertices.length;u<f;u++){const p=e[u];if(p!==a&&p!==l&&p!==c){const m=Math.abs(uo.distanceToPoint(p.point));m>n&&(n=m,h=p)}}const d=[];if(uo.distanceToPoint(h.point)<0){d.push(ue.create(a,l,c),ue.create(h,l,a),ue.create(h,c,l),ue.create(h,a,c));for(let u=0;u<3;u++){const f=(u+1)%3;d[u+1].getEdge(2).setTwin(d[0].getEdge(f)),d[u+1].getEdge(1).setTwin(d[f+1].getEdge(0))}}else{d.push(ue.create(a,c,l),ue.create(h,a,l),ue.create(h,l,c),ue.create(h,c,a));for(let u=0;u<3;u++){const f=(u+1)%3;d[u+1].getEdge(2).setTwin(d[0].getEdge((3-u)%3)),d[u+1].getEdge(0).setTwin(d[f+1].getEdge(1))}}for(let u=0;u<4;u++)this.faces.push(d[u]);for(let u=0,f=e.length;u<f;u++){const p=e[u];if(p!==a&&p!==l&&p!==c&&p!==h){n=this.tolerance;let m=null;for(let E=0;E<4;E++){const g=this.faces[E].distanceToPoint(p.point);g>n&&(n=g,m=this.faces[E])}m!==null&&this.addVertexToFace(p,m)}}return this}reindexFaces(){const e=[];for(let t=0;t<this.faces.length;t++){const i=this.faces[t];i.mark===Vn&&e.push(i)}return this.faces=e,this}nextVertexToAdd(){if(this.assigned.isEmpty()===!1){let e,t=0;const i=this.assigned.first().face;let s=i.outside;do{const n=i.distanceToPoint(s.point);n>t&&(t=n,e=s),s=s.next}while(s!==null&&s.face===i);return e}}computeHorizon(e,t,i,s){this.deleteFaceVertices(i),i.mark=tf;let n;t===null?n=t=i.getEdge(0):n=t.next;do{const o=n.twin,a=o.face;a.mark===Vn&&(a.distanceToPoint(e)>this.tolerance?this.computeHorizon(e,o,a,s):s.push(n)),n=n.next}while(n!==t);return this}addAdjoiningFace(e,t){const i=ue.create(e,t.tail(),t.head());return this.faces.push(i),i.getEdge(-1).setTwin(t.twin),i.getEdge(0)}addNewFaces(e,t){this.newFaces=[];let i=null,s=null;for(let n=0;n<t.length;n++){const o=t[n],a=this.addAdjoiningFace(e,o);i===null?i=a:a.next.setTwin(s),this.newFaces.push(a.face),s=a}return i.next.setTwin(s),this}addVertexToHull(e){const t=[];return this.unassigned.clear(),this.removeVertexFromFace(e,e.face),this.computeHorizon(e.point,null,e.face,t),this.addNewFaces(e,t),this.resolveUnassignedPoints(this.newFaces),this}cleanup(){return this.assigned.clear(),this.unassigned.clear(),this.newFaces=[],this}compute(){let e;for(this.computeInitialHull();(e=this.nextVertexToAdd())!==void 0;)this.addVertexToHull(e);return this.reindexFaces(),this.cleanup(),this}}class ue{constructor(){this.normal=new F.Vector3,this.midpoint=new F.Vector3,this.area=0,this.constant=0,this.outside=null,this.mark=Vn,this.edge=null}static create(e,t,i){const s=new ue,n=new fo(e,s),o=new fo(t,s),a=new fo(i,s);return n.next=a.prev=o,o.next=n.prev=a,a.next=o.prev=n,s.edge=n,s.compute()}getEdge(e){let t=this.edge;for(;e>0;)t=t.next,e--;for(;e<0;)t=t.prev,e++;return t}compute(){const e=this.edge.tail(),t=this.edge.head(),i=this.edge.next.head();return Fn.set(e.point,t.point,i.point),Fn.getNormal(this.normal),Fn.getMidpoint(this.midpoint),this.area=Fn.getArea(),this.constant=this.normal.dot(this.midpoint),this}distanceToPoint(e){return this.normal.dot(e)-this.constant}}class fo{constructor(e,t){this.vertex=e,this.prev=null,this.next=null,this.twin=null,this.face=t}head(){return this.vertex}tail(){return this.prev?this.prev.vertex:null}length(){const e=this.head(),t=this.tail();return t!==null?t.point.distanceTo(e.point):-1}lengthSquared(){const e=this.head(),t=this.tail();return t!==null?t.point.distanceToSquared(e.point):-1}setTwin(e){return this.twin=e,e.twin=this,this}}class nf{constructor(e){this.point=e,this.prev=null,this.next=null,this.face=null}}class al{constructor(){this.head=null,this.tail=null}first(){return this.head}last(){return this.tail}clear(){return this.head=this.tail=null,this}insertBefore(e,t){return t.prev=e.prev,t.next=e,t.prev===null?this.head=t:t.prev.next=t,e.prev=t,this}insertAfter(e,t){return t.prev=e,t.next=e.next,t.next===null?this.tail=t:t.next.prev=t,e.next=t,this}append(e){return this.head===null?this.head=e:this.tail.next=e,e.prev=this.tail,e.next=null,this.tail=e,this}appendChain(e){for(this.head===null?this.head=e:this.tail.next=e,e.prev=this.tail;e.next!==null;)e=e.next;return this.tail=e,this}remove(e){return e.prev===null?this.head=e.next:e.prev.next=e.next,e.next===null?this.tail=e.prev:e.next.prev=e.prev,this}removeSubList(e,t){return e.prev===null?this.head=t.next:e.prev.next=t.next,t.next===null?this.tail=e.prev:t.next.prev=e.prev,this}isEmpty(){return this.head===null}}const zo=[2,2,1],$o=[1,0,0];function ye(r,e){return r*3+e}function rf(r){const e=r.elements;let t=0;for(let i=0;i<9;i++)t+=e[i]*e[i];return Math.sqrt(t)}function of(r){const e=r.elements;let t=0;for(let i=0;i<3;i++){const s=e[ye(zo[i],$o[i])];t+=2*s*s}return Math.sqrt(t)}function af(r,e){let t=0,i=1;const s=r.elements;for(let c=0;c<3;c++){const h=Math.abs(s[ye(zo[c],$o[c])]);h>t&&(t=h,i=c)}let n=1,o=0;const a=$o[i],l=zo[i];if(Math.abs(s[ye(l,a)])>Number.EPSILON){const c=s[ye(l,l)],h=s[ye(a,a)],d=s[ye(l,a)],u=(c-h)/2/d;let f;u<0?f=-1/(-u+Math.sqrt(1+u*u)):f=1/(u+Math.sqrt(1+u*u)),n=1/Math.sqrt(1+f*f),o=f*n}return e.identity(),e.elements[ye(a,a)]=n,e.elements[ye(l,l)]=n,e.elements[ye(l,a)]=o,e.elements[ye(a,l)]=-o,e}function lf(r,e){let t=0,i=0;const s=10;e.unitary.identity(),e.diagonal.copy(r);const n=e.unitary,o=e.diagonal,a=new D.Matrix3,l=new D.Matrix3,c=Number.EPSILON*rf(o);for(;i<s&&of(o)>c;)af(o,a),l.copy(a).transpose(),o.multiply(a),o.premultiply(l),n.multiply(a),++t>2&&(i++,t=0);return e}function Oc(r){const e=[];for(let lt=0;lt<r.length-2;lt+=3){const pt=r[lt],ft=r[lt+1],Ct=r[lt+2];e.push(new D.Vector3(pt,ft,Ct))}const t=new sf;t.setFromPoints(e);const i={unitary:new D.Matrix3,diagonal:new D.Matrix3},s=t.faces,n=[],o=[];for(let lt=0,pt=s.length;lt<pt;lt++){const ft=s[lt];let Ct=ft.edge;n.length=0;do n.push(Ct),Ct=Ct.next;while(Ct!==ft.edge);const Kt=n.length-2;for(let $t=1,_=Kt;$t<=_;$t++){const j=n[0].vertex,V=n[$t+0].vertex,x=n[$t+1].vertex;o.push(j.point.x,j.point.y,j.point.z),o.push(V.point.x,V.point.y,V.point.z),o.push(x.point.x,x.point.y,x.point.z)}}const a=new D.Vector3,l=new D.Vector3,c=new D.Vector3,h=new D.Vector3,d=new D.Vector3,u=new D.Vector3,f=new D.Vector3,p=new D.Vector3;let m=0,E=0,g=0,I=0,T=0,b=0,v=0;for(let lt=0,pt=o.length;lt<pt;lt+=9){a.fromArray(o,lt),l.fromArray(o,lt+3),c.fromArray(o,lt+6),f.set(0,0,0),f.add(a).add(l).add(c).divideScalar(3),h.subVectors(l,a),d.subVectors(c,a);const ft=u.crossVectors(h,d).length()/2;p.add(u.copy(f).multiplyScalar(ft)),m+=ft,E+=(9*f.x*f.x+a.x*a.x+l.x*l.x+c.x*c.x)*(ft/12),g+=(9*f.x*f.y+a.x*a.y+l.x*l.y+c.x*c.y)*(ft/12),I+=(9*f.x*f.z+a.x*a.z+l.x*l.z+c.x*c.z)*(ft/12),T+=(9*f.y*f.y+a.y*a.y+l.y*l.y+c.y*c.y)*(ft/12),b+=(9*f.y*f.z+a.y*a.z+l.y*l.z+c.y*c.z)*(ft/12),v+=(9*f.z*f.z+a.z*a.z+l.z*l.z+c.z*c.z)*(ft/12)}p.divideScalar(m),E/=m,g/=m,I/=m,T/=m,b/=m,v/=m,E-=p.x*p.x,g-=p.x*p.y,I-=p.x*p.z,T-=p.y*p.y,b-=p.y*p.z,v-=p.z*p.z;const A=new D.Matrix3;A.elements[0]=E,A.elements[1]=g,A.elements[2]=I,A.elements[3]=g,A.elements[4]=T,A.elements[5]=b,A.elements[6]=I,A.elements[7]=b,A.elements[8]=v,lf(A,i);const S=i.unitary,N=new D.Vector3,R=new D.Vector3,P=new D.Vector3;S.extractBasis(N,R,P);let M=-1/0,w=-1/0,L=-1/0,C=1/0,U=1/0,q=1/0;for(let lt=0,pt=e.length;lt<pt;lt++){const ft=e[lt];M=Math.max(N.dot(ft),M),w=Math.max(R.dot(ft),w),L=Math.max(P.dot(ft),L),C=Math.min(N.dot(ft),C),U=Math.min(R.dot(ft),U),q=Math.min(P.dot(ft),q)}N.multiplyScalar(.5*(C+M)),R.multiplyScalar(.5*(U+w)),P.multiplyScalar(.5*(q+L));const G=new D.Vector3,st=new D.Vector3,Y=new D.Matrix3;G.add(N).add(R).add(P),st.x=M-C,st.y=w-U,st.z=L-q,st.multiplyScalar(.5),Y.copy(S);const{x:ot,y:$,z:B}=st,at=new D.Matrix4;at.makeScale(ot*2,$*2,B*2);const nt=new D.Matrix4;nt.makeTranslation(-ot,-$,-B);const it=new D.Matrix4;it.makeTranslation(G.x,G.y,G.z);const Rt=new D.Matrix4;Rt.setFromMatrix3(Y);const xt=new D.Matrix4;return xt.multiply(it),xt.multiply(Rt),xt.multiply(nt),xt.multiply(at),{center:G,halfSizes:st,rotation:Y,transformation:xt}}function xc(r,e,t){const i=[r[0]-e[0],r[1]-e[1],r[2]-e[2]];return t[0]*i[0]+t[1]*i[1]+t[2]*i[2]>0}class Vo{static isTransparent(e){return e.transparent&&e.opacity<1}}const Pt=class Pt{static create(){const e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0,s=Math.random()*4294967295|0;return`${Pt._lut[e&255]+Pt._lut[e>>8&255]+Pt._lut[e>>16&255]+Pt._lut[e>>24&255]}-${Pt._lut[t&255]}${Pt._lut[t>>8&255]}-${Pt._lut[t>>16&15|64]}${Pt._lut[t>>24&255]}-${Pt._lut[i&63|128]}${Pt._lut[i>>8&255]}-${Pt._lut[i>>16&255]}${Pt._lut[i>>24&255]}${Pt._lut[s&255]}${Pt._lut[s>>8&255]}${Pt._lut[s>>16&255]}${Pt._lut[s>>24&255]}`.toLowerCase()}static validate(e){if(!Pt._pattern.test(e))throw new Error(`${e} is not a valid UUID v4.
|
|
2
2
|
|
|
3
3
|
- If you're the tool creator, you can take one from https://www.uuidgenerator.net/.
|
|
4
4
|
|
|
5
|
-
- If you're using a platform tool, verify the uuid isn't misspelled or contact the tool creator.`)}};
|
|
5
|
+
- If you're using a platform tool, verify the uuid isn't misspelled or contact the tool creator.`)}};y(Pt,"_pattern",/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/),y(Pt,"_lut",["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"]);let Le=Pt;class cf extends Ot{constructor(t,i){super(t);y(this,"onDisposed",new K);y(this,"onVertexFound",new K);y(this,"onVertexLost",new K);y(this,"onEnabled",new K);y(this,"components");y(this,"workingPlane",null);y(this,"_pickedPoint",null);y(this,"_config");y(this,"_enabled",!1);this.components=t,this.config={snapDistance:.25,showOnlyVertex:!1,...i},this.enabled=!1}set enabled(t){this._enabled=t,t||(this._pickedPoint=null),this.onEnabled.trigger(t)}get enabled(){return this._enabled}set config(t){this._config={...this._config,...t}}get config(){return this._config}dispose(){this.onVertexFound.reset(),this.onVertexLost.reset(),this.components=null,this.onDisposed.trigger(),this.onDisposed.reset()}get(t){if(!this.enabled)return this._pickedPoint;const n=this.components.get(mi).get(t).castRay();if(!n)return this._pickedPoint!==null&&(this.onVertexLost.trigger(),this._pickedPoint=null),this._pickedPoint;const o=this.getClosestVertex(n);return o?(this.workingPlane?Math.abs(this.workingPlane.distanceToPoint(o))<.001:!0)?((this._pickedPoint===null||!this._pickedPoint.equals(o))&&(this._pickedPoint=o.clone(),this.onVertexFound.trigger(this._pickedPoint)),this._pickedPoint):(this._pickedPoint=null,this._pickedPoint):(this._pickedPoint!==null&&(this.onVertexLost.trigger(),this._pickedPoint=null),this._pickedPoint)}getClosestVertex(t){let i=new D.Vector3,s=!1,n=Number.MAX_SAFE_INTEGER;const o=this.getVertices(t);if(o===null)return null;for(const a of o){if(!a)continue;const l=t.point.distanceTo(a);l>n||l>this._config.snapDistance||(s=!0,i=a,n=t.point.distanceTo(a))}return s?i:this.config.showOnlyVertex?null:t.point}getVertices(t){const i=t.object;if(!t.face||!i)return null;const s=i.geometry,n=new D.Matrix4,{instanceId:o}=t,a=o!==void 0,l=i instanceof D.InstancedMesh;return l&&a&&i.getMatrixAt(o,n),[this.getVertex(t.face.a,s),this.getVertex(t.face.b,s),this.getVertex(t.face.c,s)].map(c=>(c&&(l&&a&&c.applyMatrix4(n),c.applyMatrix4(i.matrixWorld)),c))}getVertex(t,i){if(t===void 0)return null;const s=i.attributes.position;return new D.Vector3(s.getX(t),s.getY(t),s.getZ(t))}}const Ir=class Ir{constructor(){y(this,"onDisposed",new K);y(this,"list",new Map);y(this,"enabled",!1);y(this,"_clock");y(this,"update",()=>{if(!this.enabled)return;const e=this._clock.getDelta();for(const[t,i]of this.list)i.enabled&&i.isUpdateable()&&i.update(e);requestAnimationFrame(this.update)});this._clock=new D.Clock,Ir.setupBVH()}add(e,t){if(this.list.has(e))throw new Error("You're trying to add a component that already exists in the components instance. Use Components.get() instead.");Le.validate(e),this.list.set(e,t)}get(e){const t=e.uuid;if(!this.list.has(t)){const i=new e(this);return this.list.has(t)||this.add(t,i),i}return this.list.get(t)}init(){this.enabled=!0,this._clock.start(),this.update()}dispose(){this.enabled=!1;for(const[e,t]of this.list)t.enabled=!1,t.isDisposeable()&&t.dispose();this._clock.stop(),this.onDisposed.trigger(),this.onDisposed.reset()}static setupBVH(){D.BufferGeometry.prototype.computeBoundsTree=Ku,D.BufferGeometry.prototype.disposeBoundsTree=Ju,D.Mesh.prototype.raycast=Qu}};y(Ir,"release","2.2.0-alpha.0");let Zn=Ir;class Nc extends Lr{constructor(){super(...arguments);y(this,"meshes",new Set);y(this,"onAfterUpdate",new K);y(this,"onBeforeUpdate",new K);y(this,"onDisposed",new K);y(this,"isDisposing",!1);y(this,"enabled",!0);y(this,"uuid",Le.create());y(this,"name");y(this,"_scene");y(this,"_camera");y(this,"_renderer",null)}get scene(){if(!this._scene)throw new Error("No scene initialized!");return this._scene}set scene(t){this._scene=t,t.worlds.set(this.uuid,this),t.currentWorld=this,t.onWorldChanged.trigger({world:this,action:"added"})}get camera(){if(!this._camera)throw new Error("No camera initialized!");return this._camera}set camera(t){this._camera=t,t.worlds.set(this.uuid,this),t.currentWorld=this,t.onWorldChanged.trigger({world:this,action:"added"})}get renderer(){return this._renderer}set renderer(t){this._renderer=t,t&&(t.worlds.set(this.uuid,this),t.currentWorld=this,t.onWorldChanged.trigger({world:this,action:"added"}))}update(t){this.enabled&&(!this._scene||!this._camera||(this.scene.currentWorld=this,this.camera.currentWorld=this,this.renderer&&(this.renderer.currentWorld=this),this.onBeforeUpdate.trigger(),this.scene.isUpdateable()&&this.scene.update(t),this.camera.isUpdateable()&&this.camera.update(t),this.renderer&&this.renderer.update(t),this.onAfterUpdate.trigger()))}dispose(t=!0){if(this.enabled=!1,this.isDisposing=!0,this.scene.onWorldChanged.trigger({world:this,action:"removed"}),this.camera.onWorldChanged.trigger({world:this,action:"removed"}),this.renderer&&this.renderer.onWorldChanged.trigger({world:this,action:"removed"}),t){const i=this.components.get(Pe);this.scene.dispose(),this.camera.isDisposeable()&&this.camera.dispose(),this.renderer&&this.renderer.dispose();for(const s of this.meshes)i.destroy(s);this.meshes.clear()}this._scene=null,this._camera=null,this._renderer=null,this.onDisposed.trigger()}}class Pc extends Fc{constructor(t){super(t);y(this,"isSetup",!1);y(this,"three");y(this,"onSetup",new K);y(this,"config",{directionalLight:{color:new D.Color("white"),intensity:1.5,position:new D.Vector3(5,10,3)},ambientLight:{color:new D.Color("white"),intensity:1}});this.three=new D.Scene,this.three.background=new D.Color(2107698)}setup(t){this.config={...this.config,...t};const i=new D.DirectionalLight(this.config.directionalLight.color,this.config.directionalLight.intensity);i.position.copy(this.config.directionalLight.position);const s=new D.AmbientLight(this.config.ambientLight.color,this.config.ambientLight.intensity);this.three.add(i,s),this.directionalLights.set(i.uuid,i),this.ambientLights.set(s.uuid,s),this.isSetup=!0,this.onSetup.trigger(this)}}class hf extends Sc{constructor(t,i,s){super(t);y(this,"enabled",!0);y(this,"container");y(this,"three");y(this,"_canvas");y(this,"_parameters");y(this,"_resizeObserver",null);y(this,"onContainerUpdated",new K);y(this,"_resizing",!1);y(this,"resize",t=>{if(this._resizing)return;this._resizing=!0,this.onContainerUpdated.trigger();const i=t?t.x:this.container.clientWidth,s=t?t.y:this.container.clientHeight;this.three.setSize(i,s),this.onResize.trigger(new D.Vector2(i,s)),this._resizing=!1});y(this,"resizeEvent",()=>{this.resize()});y(this,"onContextLost",t=>{t.preventDefault(),this.enabled=!1});y(this,"onContextBack",()=>{this.three.setRenderTarget(null),this.three.dispose(),this.three=new D.WebGLRenderer({canvas:this._canvas,antialias:!0,alpha:!0,...this._parameters}),this.enabled=!0});this.container=i,this._parameters=s,this.three=new D.WebGLRenderer({antialias:!0,alpha:!0,...s}),this.three.setPixelRatio(Math.min(window.devicePixelRatio,2)),this.setupRenderer(),this.setupEvents(!0),this.resize(),this._canvas=this.three.domElement;const n=this.three.getContext(),{canvas:o}=n;o.addEventListener("webglcontextlost",this.onContextLost,!1),o.addEventListener("webglcontextrestored",this.onContextBack,!1)}update(){if(!this.enabled||!this.currentWorld)return;this.onBeforeUpdate.trigger(this);const t=this.currentWorld.scene.three,i=this.currentWorld.camera.three;this.three.render(t,i),this.onAfterUpdate.trigger(this)}dispose(){this.enabled=!1,this.setupEvents(!1),this.three.domElement.remove(),this.three.forceContextLoss(),this.three.dispose(),this.onResize.reset(),this.onAfterUpdate.reset(),this.onBeforeUpdate.reset(),this.onDisposed.trigger(),this.onDisposed.reset()}getSize(){return new D.Vector2(this.three.domElement.clientWidth,this.three.domElement.clientHeight)}setupEvents(t){const i=this.three.domElement.parentElement;if(!i)throw new Error("This renderer needs to have an HTML container!");this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null),window.removeEventListener("resize",this.resizeEvent),t&&(this._resizeObserver=new ResizeObserver(this.resizeEvent),this._resizeObserver.observe(i),window.addEventListener("resize",this.resizeEvent))}setupRenderer(){this.three.localClippingEnabled=!0,this.container&&this.container.appendChild(this.three.domElement),this.onContainerUpdated.trigger()}}/*!
|
|
6
6
|
* camera-controls
|
|
7
7
|
* https://github.com/yomotsu/camera-controls
|
|
8
8
|
* (c) 2017 @yomotsu
|
|
9
9
|
* Released under the MIT License.
|
|
10
|
-
*/const V={LEFT:1,RIGHT:2,MIDDLE:4},L=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,OFFSET:4,DOLLY:8,ZOOM:16,TOUCH_ROTATE:32,TOUCH_TRUCK:64,TOUCH_OFFSET:128,TOUCH_DOLLY:256,TOUCH_ZOOM:512,TOUCH_DOLLY_TRUCK:1024,TOUCH_DOLLY_OFFSET:2048,TOUCH_DOLLY_ROTATE:4096,TOUCH_ZOOM_TRUCK:8192,TOUCH_ZOOM_OFFSET:16384,TOUCH_ZOOM_ROTATE:32768}),se={NONE:0,IN:1,OUT:-1};function Yt(l){return l.isPerspectiveCamera}function Lt(l){return l.isOrthographicCamera}const ie=Math.PI*2,tn=Math.PI/2,Nn=1e-5,me=Math.PI/180;function pt(l,s,t){return Math.max(s,Math.min(t,l))}function k(l,s=Nn){return Math.abs(l)<s}function H(l,s,t=Nn){return k(l-s,t)}function en(l,s){return Math.round(l/s)*s}function Re(l){return isFinite(l)?l:l<0?-Number.MAX_VALUE:Number.MAX_VALUE}function Fe(l){return Math.abs(l)<Number.MAX_VALUE?l:l*(1/0)}function Je(l,s,t,e,i=1/0,o){e=Math.max(1e-4,e);const n=2/e,r=n*o,a=1/(1+r+.48*r*r+.235*r*r*r);let c=l-s;const h=s,E=i*e;c=pt(c,-E,E),s=l-c;const d=(t.value+n*c)*o;t.value=(t.value-n*d)*a;let I=s+(c+d)*a;return h-l>0==I>h&&(I=h,t.value=(I-h)/o),I}function sn(l,s,t,e,i=1/0,o,n){e=Math.max(1e-4,e);const r=2/e,a=r*o,c=1/(1+a+.48*a*a+.235*a*a*a);let h=s.x,E=s.y,d=s.z,I=l.x-h,f=l.y-E,T=l.z-d;const F=h,m=E,A=d,O=i*e,p=O*O,R=I*I+f*f+T*T;if(R>p){const v=Math.sqrt(R);I=I/v*O,f=f/v*O,T=T/v*O}h=l.x-I,E=l.y-f,d=l.z-T;const S=(t.x+r*I)*o,_=(t.y+r*f)*o,y=(t.z+r*T)*o;t.x=(t.x-r*S)*c,t.y=(t.y-r*_)*c,t.z=(t.z-r*y)*c,n.x=h+(I+S)*c,n.y=E+(f+_)*c,n.z=d+(T+y)*c;const N=F-l.x,P=m-l.y,x=A-l.z,w=n.x-F,U=n.y-m,b=n.z-A;return N*w+P*U+x*b>0&&(n.x=F,n.y=m,n.z=A,t.x=(n.x-F)/o,t.y=(n.y-m)/o,t.z=(n.z-A)/o),n}function qs(l,s){s.set(0,0),l.forEach(t=>{s.x+=t.clientX,s.y+=t.clientY}),s.x/=l.length,s.y/=l.length}function Ks(l,s){return Lt(l)?(console.warn(`${s} is not supported in OrthographicCamera`),!0):!1}class pr{constructor(){this._listeners={}}addEventListener(s,t){const e=this._listeners;e[s]===void 0&&(e[s]=[]),e[s].indexOf(t)===-1&&e[s].push(t)}hasEventListener(s,t){const e=this._listeners;return e[s]!==void 0&&e[s].indexOf(t)!==-1}removeEventListener(s,t){const i=this._listeners[s];if(i!==void 0){const o=i.indexOf(t);o!==-1&&i.splice(o,1)}}removeAllEventListeners(s){if(!s){this._listeners={};return}Array.isArray(this._listeners[s])&&(this._listeners[s].length=0)}dispatchEvent(s){const e=this._listeners[s.type];if(e!==void 0){s.target=this;const i=e.slice(0);for(let o=0,n=i.length;o<n;o++)i[o].call(this,s)}}}const Cr="2.7.3",ts=1/8,Ln=typeof window<"u",Tr=Ln&&/Mac/.test(navigator.platform),mr=!(Ln&&"PointerEvent"in window);let B,nn,es,$s,at,Y,G,ne,Ae,Rt,Ft,Gt,on,rn,ht,ge,oe,an,Js,cn,ti,ei,ss;class nt extends pr{static install(s){B=s.THREE,nn=Object.freeze(new B.Vector3(0,0,0)),es=Object.freeze(new B.Vector3(0,1,0)),$s=Object.freeze(new B.Vector3(0,0,1)),at=new B.Vector2,Y=new B.Vector3,G=new B.Vector3,ne=new B.Vector3,Ae=new B.Vector3,Rt=new B.Vector3,Ft=new B.Vector3,Gt=new B.Vector3,on=new B.Vector3,rn=new B.Vector3,ht=new B.Spherical,ge=new B.Spherical,oe=new B.Box3,an=new B.Box3,Js=new B.Sphere,cn=new B.Quaternion,ti=new B.Quaternion,ei=new B.Matrix4,ss=new B.Raycaster}static get ACTION(){return L}constructor(s,t){super(),this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.minDistance=Number.EPSILON,this.maxDistance=1/0,this.infinityDolly=!1,this.minZoom=.01,this.maxZoom=1/0,this.smoothTime=.25,this.draggingSmoothTime=.125,this.maxSpeed=1/0,this.azimuthRotateSpeed=1,this.polarRotateSpeed=1,this.dollySpeed=1,this.dollyDragInverted=!1,this.truckSpeed=2,this.dollyToCursor=!1,this.dragToOffset=!1,this.verticalDragToForward=!1,this.boundaryFriction=0,this.restThreshold=.01,this.colliderMeshes=[],this.cancel=()=>{},this._enabled=!0,this._state=L.NONE,this._viewport=null,this._changedDolly=0,this._changedZoom=0,this._hasRested=!0,this._boundaryEnclosesCamera=!1,this._needsUpdate=!0,this._updatedLastTime=!1,this._elementRect=new DOMRect,this._isDragging=!1,this._dragNeedsUpdate=!0,this._activePointers=[],this._lockedPointer=null,this._interactiveArea=new DOMRect(0,0,1,1),this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._isUserControllingOffset=!1,this._isUserControllingZoom=!1,this._lastDollyDirection=se.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new B.Vector3,this._focalOffsetVelocity=new B.Vector3,this._zoomVelocity={value:0},this._truckInternal=(p,R,S)=>{let _,y;if(Yt(this._camera)){const N=Y.copy(this._camera.position).sub(this._target),P=this._camera.getEffectiveFOV()*me,x=N.length()*Math.tan(P*.5);_=this.truckSpeed*p*x/this._elementRect.height,y=this.truckSpeed*R*x/this._elementRect.height}else if(Lt(this._camera)){const N=this._camera;_=p*(N.right-N.left)/N.zoom/this._elementRect.width,y=R*(N.top-N.bottom)/N.zoom/this._elementRect.height}else return;this.verticalDragToForward?(S?this.setFocalOffset(this._focalOffsetEnd.x+_,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(_,0,!0),this.forward(-y,!0)):S?this.setFocalOffset(this._focalOffsetEnd.x+_,this._focalOffsetEnd.y+y,this._focalOffsetEnd.z,!0):this.truck(_,y,!0)},this._rotateInternal=(p,R)=>{const S=ie*this.azimuthRotateSpeed*p/this._elementRect.height,_=ie*this.polarRotateSpeed*R/this._elementRect.height;this.rotate(S,_,!0)},this._dollyInternal=(p,R,S)=>{const _=Math.pow(.95,-p*this.dollySpeed),y=this._sphericalEnd.radius,N=this._sphericalEnd.radius*_,P=pt(N,this.minDistance,this.maxDistance),x=P-N;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(N,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(x,!0),this._dollyToNoClamp(P,!0)):this._dollyToNoClamp(P,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?N:P)-y,this._dollyControlCoord.set(R,S)),this._lastDollyDirection=Math.sign(-p)},this._zoomInternal=(p,R,S)=>{const _=Math.pow(.95,p*this.dollySpeed),y=this._zoom,N=this._zoom*_;this.zoomTo(N,!0),this.dollyToCursor&&(this._changedZoom+=N-y,this._dollyControlCoord.set(R,S))},typeof B>"u"&&console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."),this._camera=s,this._yAxisUpSpace=new B.Quaternion().setFromUnitVectors(this._camera.up,es),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=L.NONE,this._target=new B.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new B.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new B.Spherical().setFromVector3(Y.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)),this._sphericalEnd=this._spherical.clone(),this._lastDistance=this._spherical.radius,this._zoom=this._camera.zoom,this._zoomEnd=this._zoom,this._lastZoom=this._zoom,this._nearPlaneCorners=[new B.Vector3,new B.Vector3,new B.Vector3,new B.Vector3],this._updateNearPlaneCorners(),this._boundary=new B.Box3(new B.Vector3(-1/0,-1/0,-1/0),new B.Vector3(1/0,1/0,1/0)),this._cameraUp0=this._camera.up.clone(),this._target0=this._target.clone(),this._position0=this._camera.position.clone(),this._zoom0=this._zoom,this._focalOffset0=this._focalOffset.clone(),this._dollyControlCoord=new B.Vector2,this.mouseButtons={left:L.ROTATE,middle:L.DOLLY,right:L.TRUCK,wheel:Yt(this._camera)?L.DOLLY:Lt(this._camera)?L.ZOOM:L.NONE},this.touches={one:L.TOUCH_ROTATE,two:Yt(this._camera)?L.TOUCH_DOLLY_TRUCK:Lt(this._camera)?L.TOUCH_ZOOM_TRUCK:L.NONE,three:L.TOUCH_TRUCK};const e=new B.Vector2,i=new B.Vector2,o=new B.Vector2,n=p=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const _=this._domElement.getBoundingClientRect(),y=p.clientX/_.width,N=p.clientY/_.height;if(y<this._interactiveArea.left||y>this._interactiveArea.right||N<this._interactiveArea.top||N>this._interactiveArea.bottom)return}const R=p.pointerType!=="mouse"?null:(p.buttons&V.LEFT)===V.LEFT?V.LEFT:(p.buttons&V.MIDDLE)===V.MIDDLE?V.MIDDLE:(p.buttons&V.RIGHT)===V.RIGHT?V.RIGHT:null;if(R!==null){const _=this._findPointerByMouseButton(R);_&&this._disposePointer(_)}if((p.buttons&V.LEFT)===V.LEFT&&this._lockedPointer)return;const S={pointerId:p.pointerId,clientX:p.clientX,clientY:p.clientY,deltaX:0,deltaY:0,mouseButton:R};this._activePointers.push(S),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.ownerDocument.addEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",h),this._isDragging=!0,T(p)},r=p=>{if(!this._enabled||!this._domElement||this._lockedPointer)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const _=this._domElement.getBoundingClientRect(),y=p.clientX/_.width,N=p.clientY/_.height;if(y<this._interactiveArea.left||y>this._interactiveArea.right||N<this._interactiveArea.top||N>this._interactiveArea.bottom)return}const R=(p.buttons&V.LEFT)===V.LEFT?V.LEFT:(p.buttons&V.MIDDLE)===V.MIDDLE?V.MIDDLE:(p.buttons&V.RIGHT)===V.RIGHT?V.RIGHT:null;if(R!==null){const _=this._findPointerByMouseButton(R);_&&this._disposePointer(_)}const S={pointerId:1,clientX:p.clientX,clientY:p.clientY,deltaX:0,deltaY:0,mouseButton:(p.buttons&V.LEFT)===V.LEFT?V.LEFT:(p.buttons&V.MIDDLE)===V.LEFT?V.MIDDLE:(p.buttons&V.RIGHT)===V.LEFT?V.RIGHT:null};this._activePointers.push(S),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("mouseup",E),this._domElement.ownerDocument.addEventListener("mousemove",c),this._domElement.ownerDocument.addEventListener("mouseup",E),this._isDragging=!0,T(p)},a=p=>{p.cancelable&&p.preventDefault();const R=p.pointerId,S=this._lockedPointer||this._findPointerById(R);if(S){if(S.clientX=p.clientX,S.clientY=p.clientY,S.deltaX=p.movementX,S.deltaY=p.movementY,this._state=0,p.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else(!this._isDragging&&this._lockedPointer||this._isDragging&&(p.buttons&V.LEFT)===V.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(p.buttons&V.MIDDLE)===V.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(p.buttons&V.RIGHT)===V.RIGHT&&(this._state=this._state|this.mouseButtons.right);F()}},c=p=>{const R=this._lockedPointer||this._findPointerById(1);R&&(R.clientX=p.clientX,R.clientY=p.clientY,R.deltaX=p.movementX,R.deltaY=p.movementY,this._state=0,(this._lockedPointer||(p.buttons&V.LEFT)===V.LEFT)&&(this._state=this._state|this.mouseButtons.left),(p.buttons&V.MIDDLE)===V.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(p.buttons&V.RIGHT)===V.RIGHT&&(this._state=this._state|this.mouseButtons.right),F())},h=p=>{const R=this._findPointerById(p.pointerId);if(!(R&&R===this._lockedPointer)){if(R&&this._disposePointer(R),p.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=L.NONE;break;case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else this._state=L.NONE;m()}},E=()=>{const p=this._findPointerById(1);p&&p===this._lockedPointer||(p&&this._disposePointer(p),this._state=L.NONE,m())};let d=-1;const I=p=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===L.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const N=this._domElement.getBoundingClientRect(),P=p.clientX/N.width,x=p.clientY/N.height;if(P<this._interactiveArea.left||P>this._interactiveArea.right||x<this._interactiveArea.top||x>this._interactiveArea.bottom)return}if(p.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===L.ROTATE||this.mouseButtons.wheel===L.TRUCK){const N=performance.now();d-N<1e3&&this._getClientRect(this._elementRect),d=N}const R=Tr?-1:-3,S=p.deltaMode===1?p.deltaY/R:p.deltaY/(R*10),_=this.dollyToCursor?(p.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,y=this.dollyToCursor?(p.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case L.ROTATE:{this._rotateInternal(p.deltaX,p.deltaY),this._isUserControllingRotate=!0;break}case L.TRUCK:{this._truckInternal(p.deltaX,p.deltaY,!1),this._isUserControllingTruck=!0;break}case L.OFFSET:{this._truckInternal(p.deltaX,p.deltaY,!0),this._isUserControllingOffset=!0;break}case L.DOLLY:{this._dollyInternal(-S,_,y),this._isUserControllingDolly=!0;break}case L.ZOOM:{this._zoomInternal(-S,_,y),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},f=p=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===nt.ACTION.NONE){const R=p instanceof PointerEvent?p.pointerId:(p instanceof MouseEvent,0),S=this._findPointerById(R);S&&this._disposePointer(S),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("mouseup",E);return}p.preventDefault()}},T=p=>{if(!this._enabled)return;if(qs(this._activePointers,at),this._getClientRect(this._elementRect),e.copy(at),i.copy(at),this._activePointers.length>=2){const S=at.x-this._activePointers[1].clientX,_=at.y-this._activePointers[1].clientY,y=Math.sqrt(S*S+_*_);o.set(0,y);const N=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,P=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;i.set(N,P)}if(this._state=0,!p)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in p&&p.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else!this._lockedPointer&&(p.buttons&V.LEFT)===V.LEFT&&(this._state=this._state|this.mouseButtons.left),(p.buttons&V.MIDDLE)===V.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(p.buttons&V.RIGHT)===V.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&L.ROTATE)===L.ROTATE||(this._state&L.TOUCH_ROTATE)===L.TOUCH_ROTATE||(this._state&L.TOUCH_DOLLY_ROTATE)===L.TOUCH_DOLLY_ROTATE||(this._state&L.TOUCH_ZOOM_ROTATE)===L.TOUCH_ZOOM_ROTATE)&&(this._sphericalEnd.theta=this._spherical.theta,this._sphericalEnd.phi=this._spherical.phi,this._thetaVelocity.value=0,this._phiVelocity.value=0),((this._state&L.TRUCK)===L.TRUCK||(this._state&L.TOUCH_TRUCK)===L.TOUCH_TRUCK||(this._state&L.TOUCH_DOLLY_TRUCK)===L.TOUCH_DOLLY_TRUCK||(this._state&L.TOUCH_ZOOM_TRUCK)===L.TOUCH_ZOOM_TRUCK)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&L.DOLLY)===L.DOLLY||(this._state&L.TOUCH_DOLLY)===L.TOUCH_DOLLY||(this._state&L.TOUCH_DOLLY_TRUCK)===L.TOUCH_DOLLY_TRUCK||(this._state&L.TOUCH_DOLLY_OFFSET)===L.TOUCH_DOLLY_OFFSET||(this._state&L.TOUCH_DOLLY_ROTATE)===L.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&L.ZOOM)===L.ZOOM||(this._state&L.TOUCH_ZOOM)===L.TOUCH_ZOOM||(this._state&L.TOUCH_ZOOM_TRUCK)===L.TOUCH_ZOOM_TRUCK||(this._state&L.TOUCH_ZOOM_OFFSET)===L.TOUCH_ZOOM_OFFSET||(this._state&L.TOUCH_ZOOM_ROTATE)===L.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&L.OFFSET)===L.OFFSET||(this._state&L.TOUCH_OFFSET)===L.TOUCH_OFFSET||(this._state&L.TOUCH_DOLLY_OFFSET)===L.TOUCH_DOLLY_OFFSET||(this._state&L.TOUCH_ZOOM_OFFSET)===L.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},F=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,qs(this._activePointers,at);const R=this._domElement&&document.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,S=R?-R.deltaX:i.x-at.x,_=R?-R.deltaY:i.y-at.y;if(i.copy(at),((this._state&L.ROTATE)===L.ROTATE||(this._state&L.TOUCH_ROTATE)===L.TOUCH_ROTATE||(this._state&L.TOUCH_DOLLY_ROTATE)===L.TOUCH_DOLLY_ROTATE||(this._state&L.TOUCH_ZOOM_ROTATE)===L.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(S,_),this._isUserControllingRotate=!0),(this._state&L.DOLLY)===L.DOLLY||(this._state&L.ZOOM)===L.ZOOM){const y=this.dollyToCursor?(e.x-this._elementRect.x)/this._elementRect.width*2-1:0,N=this.dollyToCursor?(e.y-this._elementRect.y)/this._elementRect.height*-2+1:0,P=this.dollyDragInverted?-1:1;(this._state&L.DOLLY)===L.DOLLY?(this._dollyInternal(P*_*ts,y,N),this._isUserControllingDolly=!0):(this._zoomInternal(P*_*ts,y,N),this._isUserControllingZoom=!0)}if((this._state&L.TOUCH_DOLLY)===L.TOUCH_DOLLY||(this._state&L.TOUCH_ZOOM)===L.TOUCH_ZOOM||(this._state&L.TOUCH_DOLLY_TRUCK)===L.TOUCH_DOLLY_TRUCK||(this._state&L.TOUCH_ZOOM_TRUCK)===L.TOUCH_ZOOM_TRUCK||(this._state&L.TOUCH_DOLLY_OFFSET)===L.TOUCH_DOLLY_OFFSET||(this._state&L.TOUCH_ZOOM_OFFSET)===L.TOUCH_ZOOM_OFFSET||(this._state&L.TOUCH_DOLLY_ROTATE)===L.TOUCH_DOLLY_ROTATE||(this._state&L.TOUCH_ZOOM_ROTATE)===L.TOUCH_ZOOM_ROTATE){const y=at.x-this._activePointers[1].clientX,N=at.y-this._activePointers[1].clientY,P=Math.sqrt(y*y+N*N),x=o.y-P;o.set(0,P);const w=this.dollyToCursor?(i.x-this._elementRect.x)/this._elementRect.width*2-1:0,U=this.dollyToCursor?(i.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&L.TOUCH_DOLLY)===L.TOUCH_DOLLY||(this._state&L.TOUCH_DOLLY_ROTATE)===L.TOUCH_DOLLY_ROTATE||(this._state&L.TOUCH_DOLLY_TRUCK)===L.TOUCH_DOLLY_TRUCK||(this._state&L.TOUCH_DOLLY_OFFSET)===L.TOUCH_DOLLY_OFFSET?(this._dollyInternal(x*ts,w,U),this._isUserControllingDolly=!0):(this._zoomInternal(x*ts,w,U),this._isUserControllingZoom=!0)}((this._state&L.TRUCK)===L.TRUCK||(this._state&L.TOUCH_TRUCK)===L.TOUCH_TRUCK||(this._state&L.TOUCH_DOLLY_TRUCK)===L.TOUCH_DOLLY_TRUCK||(this._state&L.TOUCH_ZOOM_TRUCK)===L.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(S,_,!1),this._isUserControllingTruck=!0),((this._state&L.OFFSET)===L.OFFSET||(this._state&L.TOUCH_OFFSET)===L.TOUCH_OFFSET||(this._state&L.TOUCH_DOLLY_OFFSET)===L.TOUCH_DOLLY_OFFSET||(this._state&L.TOUCH_ZOOM_OFFSET)===L.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(S,_,!0),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},m=()=>{qs(this._activePointers,at),i.copy(at),this._dragNeedsUpdate=!1,(this._activePointers.length===0||this._activePointers.length===1&&this._activePointers[0]===this._lockedPointer)&&(this._isDragging=!1),this._activePointers.length===0&&this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.ownerDocument.removeEventListener("mouseup",E),this.dispatchEvent({type:"controlend"}))};this.lockPointer=()=>{!this._enabled||!this._domElement||(this.cancel(),this._lockedPointer={pointerId:-1,clientX:0,clientY:0,deltaX:0,deltaY:0,mouseButton:null},this._activePointers.push(this._lockedPointer),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",A),this._domElement.ownerDocument.addEventListener("pointerlockerror",O),this._domElement.ownerDocument.addEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",h),T())},this.unlockPointer=()=>{this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),document.exitPointerLock(),this.cancel(),this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointerlockchange",A),this._domElement.ownerDocument.removeEventListener("pointerlockerror",O))};const A=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},O=()=>{this.unlockPointer()};this._addAllEventListeners=p=>{this._domElement=p,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",n),mr&&this._domElement.addEventListener("mousedown",r),this._domElement.addEventListener("pointercancel",h),this._domElement.addEventListener("wheel",I,{passive:!1}),this._domElement.addEventListener("contextmenu",f)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",n),this._domElement.removeEventListener("mousedown",r),this._domElement.removeEventListener("pointercancel",h),this._domElement.removeEventListener("wheel",I,{passive:!1}),this._domElement.removeEventListener("contextmenu",f),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.ownerDocument.removeEventListener("mouseup",E),this._domElement.ownerDocument.removeEventListener("pointerlockchange",A),this._domElement.ownerDocument.removeEventListener("pointerlockerror",O))},this.cancel=()=>{this._state!==L.NONE&&(this._state=L.NONE,this._activePointers.length=0,m())},t&&this.connect(t),this.update(0)}get camera(){return this._camera}set camera(s){this._camera=s,this.updateCameraUp(),this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0}get enabled(){return this._enabled}set enabled(s){this._enabled=s,this._domElement&&(s?(this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none"):(this.cancel(),this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect=""))}get active(){return!this._hasRested}get currentAction(){return this._state}get distance(){return this._spherical.radius}set distance(s){this._spherical.radius===s&&this._sphericalEnd.radius===s||(this._spherical.radius=s,this._sphericalEnd.radius=s,this._needsUpdate=!0)}get azimuthAngle(){return this._spherical.theta}set azimuthAngle(s){this._spherical.theta===s&&this._sphericalEnd.theta===s||(this._spherical.theta=s,this._sphericalEnd.theta=s,this._needsUpdate=!0)}get polarAngle(){return this._spherical.phi}set polarAngle(s){this._spherical.phi===s&&this._sphericalEnd.phi===s||(this._spherical.phi=s,this._sphericalEnd.phi=s,this._needsUpdate=!0)}get boundaryEnclosesCamera(){return this._boundaryEnclosesCamera}set boundaryEnclosesCamera(s){this._boundaryEnclosesCamera=s,this._needsUpdate=!0}set interactiveArea(s){this._interactiveArea.width=pt(s.width,0,1),this._interactiveArea.height=pt(s.height,0,1),this._interactiveArea.x=pt(s.x,0,1-this._interactiveArea.width),this._interactiveArea.y=pt(s.y,0,1-this._interactiveArea.height)}addEventListener(s,t){super.addEventListener(s,t)}removeEventListener(s,t){super.removeEventListener(s,t)}rotate(s,t,e=!1){return this.rotateTo(this._sphericalEnd.theta+s,this._sphericalEnd.phi+t,e)}rotateAzimuthTo(s,t=!1){return this.rotateTo(s,this._sphericalEnd.phi,t)}rotatePolarTo(s,t=!1){return this.rotateTo(this._sphericalEnd.theta,s,t)}rotateTo(s,t,e=!1){this._isUserControllingRotate=!1;const i=pt(s,this.minAzimuthAngle,this.maxAzimuthAngle),o=pt(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=i,this._sphericalEnd.phi=o,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,e||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const n=!e||H(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&H(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(n)}dolly(s,t=!1){return this.dollyTo(this._sphericalEnd.radius-s,t)}dollyTo(s,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=se.NONE,this._changedDolly=0,this._dollyToNoClamp(pt(s,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(s,t=!1){const e=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const n=this._collisionTest(),r=H(n,this._spherical.radius);if(!(e>s)&&r)return Promise.resolve();this._sphericalEnd.radius=Math.min(s,n)}else this._sphericalEnd.radius=s;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const o=!t||H(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(o)}dollyInFixed(s,t=!1){this._targetEnd.add(this._getCameraDirection(Ae).multiplyScalar(s)),t||this._target.copy(this._targetEnd);const e=!t||H(this._target.x,this._targetEnd.x,this.restThreshold)&&H(this._target.y,this._targetEnd.y,this.restThreshold)&&H(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(e)}zoom(s,t=!1){return this.zoomTo(this._zoomEnd+s,t)}zoomTo(s,t=!1){this._isUserControllingZoom=!1,this._zoomEnd=pt(s,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const e=!t||H(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(e)}pan(s,t,e=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(s,t,e)}truck(s,t,e=!1){this._camera.updateMatrix(),Rt.setFromMatrixColumn(this._camera.matrix,0),Ft.setFromMatrixColumn(this._camera.matrix,1),Rt.multiplyScalar(s),Ft.multiplyScalar(-t);const i=Y.copy(Rt).add(Ft),o=G.copy(this._targetEnd).add(i);return this.moveTo(o.x,o.y,o.z,e)}forward(s,t=!1){Y.setFromMatrixColumn(this._camera.matrix,0),Y.crossVectors(this._camera.up,Y),Y.multiplyScalar(s);const e=G.copy(this._targetEnd).add(Y);return this.moveTo(e.x,e.y,e.z,t)}elevate(s,t=!1){return Y.copy(this._camera.up).multiplyScalar(s),this.moveTo(this._targetEnd.x+Y.x,this._targetEnd.y+Y.y,this._targetEnd.z+Y.z,t)}moveTo(s,t,e,i=!1){this._isUserControllingTruck=!1;const o=Y.set(s,t,e).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,o,this.boundaryFriction),this._needsUpdate=!0,i||this._target.copy(this._targetEnd);const n=!i||H(this._target.x,this._targetEnd.x,this.restThreshold)&&H(this._target.y,this._targetEnd.y,this.restThreshold)&&H(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(n)}lookInDirectionOf(s,t,e,i=!1){const r=Y.set(s,t,e).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius);return this.setPosition(r.x,r.y,r.z,i)}fitToBox(s,t,{cover:e=!1,paddingLeft:i=0,paddingRight:o=0,paddingBottom:n=0,paddingTop:r=0}={}){const a=[],c=s.isBox3?oe.copy(s):oe.setFromObject(s);c.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const h=en(this._sphericalEnd.theta,tn),E=en(this._sphericalEnd.phi,tn);a.push(this.rotateTo(h,E,t));const d=Y.setFromSpherical(this._sphericalEnd).normalize(),I=cn.setFromUnitVectors(d,$s),f=H(Math.abs(d.y),1);f&&I.multiply(ti.setFromAxisAngle(es,h)),I.multiply(this._yAxisUpSpaceInverse);const T=an.makeEmpty();G.copy(c.min).applyQuaternion(I),T.expandByPoint(G),G.copy(c.min).setX(c.max.x).applyQuaternion(I),T.expandByPoint(G),G.copy(c.min).setY(c.max.y).applyQuaternion(I),T.expandByPoint(G),G.copy(c.max).setZ(c.min.z).applyQuaternion(I),T.expandByPoint(G),G.copy(c.min).setZ(c.max.z).applyQuaternion(I),T.expandByPoint(G),G.copy(c.max).setY(c.min.y).applyQuaternion(I),T.expandByPoint(G),G.copy(c.max).setX(c.min.x).applyQuaternion(I),T.expandByPoint(G),G.copy(c.max).applyQuaternion(I),T.expandByPoint(G),T.min.x-=i,T.min.y-=n,T.max.x+=o,T.max.y+=r,I.setFromUnitVectors($s,d),f&&I.premultiply(ti.invert()),I.premultiply(this._yAxisUpSpace);const F=T.getSize(Y),m=T.getCenter(G).applyQuaternion(I);if(Yt(this._camera)){const A=this.getDistanceToFitBox(F.x,F.y,F.z,e);a.push(this.moveTo(m.x,m.y,m.z,t)),a.push(this.dollyTo(A,t)),a.push(this.setFocalOffset(0,0,0,t))}else if(Lt(this._camera)){const A=this._camera,O=A.right-A.left,p=A.top-A.bottom,R=e?Math.max(O/F.x,p/F.y):Math.min(O/F.x,p/F.y);a.push(this.moveTo(m.x,m.y,m.z,t)),a.push(this.zoomTo(R,t)),a.push(this.setFocalOffset(0,0,0,t))}return Promise.all(a)}fitToSphere(s,t){const e=[],o=s instanceof B.Sphere?Js.copy(s):nt.createBoundingSphere(s,Js);if(e.push(this.moveTo(o.center.x,o.center.y,o.center.z,t)),Yt(this._camera)){const n=this.getDistanceToFitSphere(o.radius);e.push(this.dollyTo(n,t))}else if(Lt(this._camera)){const n=this._camera.right-this._camera.left,r=this._camera.top-this._camera.bottom,a=2*o.radius,c=Math.min(n/a,r/a);e.push(this.zoomTo(c,t))}return e.push(this.setFocalOffset(0,0,0,t)),Promise.all(e)}setLookAt(s,t,e,i,o,n,r=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=se.NONE,this._changedDolly=0;const a=G.set(i,o,n),c=Y.set(s,t,e);this._targetEnd.copy(a),this._sphericalEnd.setFromVector3(c.sub(a).applyQuaternion(this._yAxisUpSpace)),this.normalizeRotations(),this._needsUpdate=!0,r||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const h=!r||H(this._target.x,this._targetEnd.x,this.restThreshold)&&H(this._target.y,this._targetEnd.y,this.restThreshold)&&H(this._target.z,this._targetEnd.z,this.restThreshold)&&H(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&H(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&H(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(h)}lerpLookAt(s,t,e,i,o,n,r,a,c,h,E,d,I,f=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=se.NONE,this._changedDolly=0;const T=Y.set(i,o,n),F=G.set(s,t,e);ht.setFromVector3(F.sub(T).applyQuaternion(this._yAxisUpSpace));const m=ne.set(h,E,d),A=G.set(r,a,c);ge.setFromVector3(A.sub(m).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(T.lerp(m,I));const O=ge.theta-ht.theta,p=ge.phi-ht.phi,R=ge.radius-ht.radius;this._sphericalEnd.set(ht.radius+R*I,ht.phi+p*I,ht.theta+O*I),this.normalizeRotations(),this._needsUpdate=!0,f||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const S=!f||H(this._target.x,this._targetEnd.x,this.restThreshold)&&H(this._target.y,this._targetEnd.y,this.restThreshold)&&H(this._target.z,this._targetEnd.z,this.restThreshold)&&H(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&H(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&H(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(S)}setPosition(s,t,e,i=!1){return this.setLookAt(s,t,e,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,i)}setTarget(s,t,e,i=!1){const o=this.getPosition(Y),n=this.setLookAt(o.x,o.y,o.z,s,t,e,i);return this._sphericalEnd.phi=pt(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),n}setFocalOffset(s,t,e,i=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(s,t,e),this._needsUpdate=!0,i||this._focalOffset.copy(this._focalOffsetEnd);const o=!i||H(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&H(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&H(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(o)}setOrbitPoint(s,t,e){this._camera.updateMatrixWorld(),Rt.setFromMatrixColumn(this._camera.matrixWorldInverse,0),Ft.setFromMatrixColumn(this._camera.matrixWorldInverse,1),Gt.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const i=Y.set(s,t,e),o=i.distanceTo(this._camera.position),n=i.sub(this._camera.position);Rt.multiplyScalar(n.x),Ft.multiplyScalar(n.y),Gt.multiplyScalar(n.z),Y.copy(Rt).add(Ft).add(Gt),Y.z=Y.z+o,this.dollyTo(o,!1),this.setFocalOffset(-Y.x,Y.y,-Y.z,!1),this.moveTo(s,t,e,!1)}setBoundary(s){if(!s){this._boundary.min.set(-1/0,-1/0,-1/0),this._boundary.max.set(1/0,1/0,1/0),this._needsUpdate=!0;return}this._boundary.copy(s),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(s,t,e,i){if(s===null){this._viewport=null;return}this._viewport=this._viewport||new B.Vector4,typeof s=="number"?this._viewport.set(s,t,e,i):this._viewport.copy(s)}getDistanceToFitBox(s,t,e,i=!1){if(Ks(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const o=s/t,n=this._camera.getEffectiveFOV()*me,r=this._camera.aspect;return((i?o>r:o<r)?t:s/r)*.5/Math.tan(n*.5)+e*.5}getDistanceToFitSphere(s){if(Ks(this._camera,"getDistanceToFitSphere"))return this._spherical.radius;const t=this._camera.getEffectiveFOV()*me,e=Math.atan(Math.tan(t*.5)*this._camera.aspect)*2,i=1<this._camera.aspect?t:e;return s/Math.sin(i*.5)}getTarget(s,t=!0){return(s&&s.isVector3?s:new B.Vector3).copy(t?this._targetEnd:this._target)}getPosition(s,t=!0){return(s&&s.isVector3?s:new B.Vector3).setFromSpherical(t?this._sphericalEnd:this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(t?this._targetEnd:this._target)}getSpherical(s,t=!0){return(s&&s instanceof B.Spherical?s:new B.Spherical).copy(t?this._sphericalEnd:this._spherical)}getFocalOffset(s,t=!0){return(s&&s.isVector3?s:new B.Vector3).copy(t?this._focalOffsetEnd:this._focalOffset)}normalizeRotations(){this._sphericalEnd.theta=this._sphericalEnd.theta%ie,this._sphericalEnd.theta<0&&(this._sphericalEnd.theta+=ie),this._spherical.theta+=ie*Math.round((this._sphericalEnd.theta-this._spherical.theta)/ie)}reset(s=!1){if(!H(this._camera.up.x,this._cameraUp0.x)||!H(this._camera.up.y,this._cameraUp0.y)||!H(this._camera.up.z,this._cameraUp0.z)){this._camera.up.copy(this._cameraUp0);const e=this.getPosition(Y);this.updateCameraUp(),this.setPosition(e.x,e.y,e.z)}const t=[this.setLookAt(this._position0.x,this._position0.y,this._position0.z,this._target0.x,this._target0.y,this._target0.z,s),this.setFocalOffset(this._focalOffset0.x,this._focalOffset0.y,this._focalOffset0.z,s),this.zoomTo(this._zoom0,s)];return Promise.all(t)}saveState(){this._cameraUp0.copy(this._camera.up),this.getTarget(this._target0),this.getPosition(this._position0),this._zoom0=this._zoom,this._focalOffset0.copy(this._focalOffset)}updateCameraUp(){this._yAxisUpSpace.setFromUnitVectors(this._camera.up,es),this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert()}applyCameraUp(){const s=Y.subVectors(this._target,this._camera.position).normalize(),t=G.crossVectors(s,this._camera.up);this._camera.up.crossVectors(t,s).normalize(),this._camera.updateMatrixWorld();const e=this.getPosition(Y);this.updateCameraUp(),this.setPosition(e.x,e.y,e.z)}update(s){const t=this._sphericalEnd.theta-this._spherical.theta,e=this._sphericalEnd.phi-this._spherical.phi,i=this._sphericalEnd.radius-this._spherical.radius,o=on.subVectors(this._targetEnd,this._target),n=rn.subVectors(this._focalOffsetEnd,this._focalOffset),r=this._zoomEnd-this._zoom;if(k(t))this._thetaVelocity.value=0,this._spherical.theta=this._sphericalEnd.theta;else{const E=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.theta=Je(this._spherical.theta,this._sphericalEnd.theta,this._thetaVelocity,E,1/0,s),this._needsUpdate=!0}if(k(e))this._phiVelocity.value=0,this._spherical.phi=this._sphericalEnd.phi;else{const E=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.phi=Je(this._spherical.phi,this._sphericalEnd.phi,this._phiVelocity,E,1/0,s),this._needsUpdate=!0}if(k(i))this._radiusVelocity.value=0,this._spherical.radius=this._sphericalEnd.radius;else{const E=this._isUserControllingDolly?this.draggingSmoothTime:this.smoothTime;this._spherical.radius=Je(this._spherical.radius,this._sphericalEnd.radius,this._radiusVelocity,E,this.maxSpeed,s),this._needsUpdate=!0}if(k(o.x)&&k(o.y)&&k(o.z))this._targetVelocity.set(0,0,0),this._target.copy(this._targetEnd);else{const E=this._isUserControllingTruck?this.draggingSmoothTime:this.smoothTime;sn(this._target,this._targetEnd,this._targetVelocity,E,this.maxSpeed,s,this._target),this._needsUpdate=!0}if(k(n.x)&&k(n.y)&&k(n.z))this._focalOffsetVelocity.set(0,0,0),this._focalOffset.copy(this._focalOffsetEnd);else{const E=this._isUserControllingOffset?this.draggingSmoothTime:this.smoothTime;sn(this._focalOffset,this._focalOffsetEnd,this._focalOffsetVelocity,E,this.maxSpeed,s,this._focalOffset),this._needsUpdate=!0}if(k(r))this._zoomVelocity.value=0,this._zoom=this._zoomEnd;else{const E=this._isUserControllingZoom?this.draggingSmoothTime:this.smoothTime;this._zoom=Je(this._zoom,this._zoomEnd,this._zoomVelocity,E,1/0,s)}if(this.dollyToCursor){if(Yt(this._camera)&&this._changedDolly!==0){const E=this._spherical.radius-this._lastDistance,d=this._camera,I=this._getCameraDirection(Ae),f=Y.copy(I).cross(d.up).normalize();f.lengthSq()===0&&(f.x=1);const T=G.crossVectors(f,I),F=this._sphericalEnd.radius*Math.tan(d.getEffectiveFOV()*me*.5),A=(this._sphericalEnd.radius-E-this._sphericalEnd.radius)/this._sphericalEnd.radius,O=ne.copy(this._targetEnd).add(f.multiplyScalar(this._dollyControlCoord.x*F*d.aspect)).add(T.multiplyScalar(this._dollyControlCoord.y*F)),p=Y.copy(this._targetEnd).lerp(O,A),R=this._lastDollyDirection===se.IN&&this._spherical.radius<=this.minDistance,S=this._lastDollyDirection===se.OUT&&this.maxDistance<=this._spherical.radius;if(this.infinityDolly&&(R||S)){this._sphericalEnd.radius-=E,this._spherical.radius-=E;const y=G.copy(I).multiplyScalar(-E);p.add(y)}this._boundary.clampPoint(p,p);const _=G.subVectors(p,this._targetEnd);this._targetEnd.copy(p),this._target.add(_),this._changedDolly-=E,k(this._changedDolly)&&(this._changedDolly=0)}else if(Lt(this._camera)&&this._changedZoom!==0){const E=this._zoom-this._lastZoom,d=this._camera,I=Y.set(this._dollyControlCoord.x,this._dollyControlCoord.y,(d.near+d.far)/(d.near-d.far)).unproject(d),f=G.set(0,0,-1).applyQuaternion(d.quaternion),T=ne.copy(I).add(f.multiplyScalar(-I.dot(d.up))),m=-(this._zoom-E-this._zoom)/this._zoom,A=this._getCameraDirection(Ae),O=this._targetEnd.dot(A),p=Y.copy(this._targetEnd).lerp(T,m),R=p.dot(A),S=A.multiplyScalar(R-O);p.sub(S),this._boundary.clampPoint(p,p);const _=G.subVectors(p,this._targetEnd);this._targetEnd.copy(p),this._target.add(_),this._changedZoom-=E,k(this._changedZoom)&&(this._changedZoom=0)}}this._camera.zoom!==this._zoom&&(this._camera.zoom=this._zoom,this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0),this._dragNeedsUpdate=!0;const a=this._collisionTest();this._spherical.radius=Math.min(this._spherical.radius,a),this._spherical.makeSafe(),this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target),this._camera.lookAt(this._target),(!k(this._focalOffset.x)||!k(this._focalOffset.y)||!k(this._focalOffset.z))&&(this._camera.updateMatrixWorld(),Rt.setFromMatrixColumn(this._camera.matrix,0),Ft.setFromMatrixColumn(this._camera.matrix,1),Gt.setFromMatrixColumn(this._camera.matrix,2),Rt.multiplyScalar(this._focalOffset.x),Ft.multiplyScalar(-this._focalOffset.y),Gt.multiplyScalar(this._focalOffset.z),Y.copy(Rt).add(Ft).add(Gt),this._camera.position.add(Y)),this._boundaryEnclosesCamera&&this._encloseToBoundary(this._camera.position.copy(this._target),Y.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),1);const h=this._needsUpdate;return h&&!this._updatedLastTime?(this._hasRested=!1,this.dispatchEvent({type:"wake"}),this.dispatchEvent({type:"update"})):h?(this.dispatchEvent({type:"update"}),k(t,this.restThreshold)&&k(e,this.restThreshold)&&k(i,this.restThreshold)&&k(o.x,this.restThreshold)&&k(o.y,this.restThreshold)&&k(o.z,this.restThreshold)&&k(n.x,this.restThreshold)&&k(n.y,this.restThreshold)&&k(n.z,this.restThreshold)&&k(r,this.restThreshold)&&!this._hasRested&&(this._hasRested=!0,this.dispatchEvent({type:"rest"}))):!h&&this._updatedLastTime&&this.dispatchEvent({type:"sleep"}),this._lastDistance=this._spherical.radius,this._lastZoom=this._zoom,this._updatedLastTime=h,this._needsUpdate=!1,h}toJSON(){return JSON.stringify({enabled:this._enabled,minDistance:this.minDistance,maxDistance:Re(this.maxDistance),minZoom:this.minZoom,maxZoom:Re(this.maxZoom),minPolarAngle:this.minPolarAngle,maxPolarAngle:Re(this.maxPolarAngle),minAzimuthAngle:Re(this.minAzimuthAngle),maxAzimuthAngle:Re(this.maxAzimuthAngle),smoothTime:this.smoothTime,draggingSmoothTime:this.draggingSmoothTime,dollySpeed:this.dollySpeed,truckSpeed:this.truckSpeed,dollyToCursor:this.dollyToCursor,verticalDragToForward:this.verticalDragToForward,target:this._targetEnd.toArray(),position:Y.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),zoom:this._zoomEnd,focalOffset:this._focalOffsetEnd.toArray(),target0:this._target0.toArray(),position0:this._position0.toArray(),zoom0:this._zoom0,focalOffset0:this._focalOffset0.toArray()})}fromJSON(s,t=!1){const e=JSON.parse(s);this.enabled=e.enabled,this.minDistance=e.minDistance,this.maxDistance=Fe(e.maxDistance),this.minZoom=e.minZoom,this.maxZoom=Fe(e.maxZoom),this.minPolarAngle=e.minPolarAngle,this.maxPolarAngle=Fe(e.maxPolarAngle),this.minAzimuthAngle=Fe(e.minAzimuthAngle),this.maxAzimuthAngle=Fe(e.maxAzimuthAngle),this.smoothTime=e.smoothTime,this.draggingSmoothTime=e.draggingSmoothTime,this.dollySpeed=e.dollySpeed,this.truckSpeed=e.truckSpeed,this.dollyToCursor=e.dollyToCursor,this.verticalDragToForward=e.verticalDragToForward,this._target0.fromArray(e.target0),this._position0.fromArray(e.position0),this._zoom0=e.zoom0,this._focalOffset0.fromArray(e.focalOffset0),this.moveTo(e.target[0],e.target[1],e.target[2],t),ht.setFromVector3(Y.fromArray(e.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)),this.rotateTo(ht.theta,ht.phi,t),this.dollyTo(ht.radius,t),this.zoomTo(e.zoom,t),this.setFocalOffset(e.focalOffset[0],e.focalOffset[1],e.focalOffset[2],t),this._needsUpdate=!0}connect(s){if(this._domElement){console.warn("camera-controls is already connected.");return}s.setAttribute("data-camera-controls-version",Cr),this._addAllEventListeners(s),this._getClientRect(this._elementRect)}disconnect(){this.cancel(),this._removeAllEventListeners(),this._domElement&&(this._domElement.removeAttribute("data-camera-controls-version"),this._domElement=void 0)}dispose(){this.removeAllEventListeners(),this.disconnect()}_getTargetDirection(s){return s.setFromSpherical(this._spherical).divideScalar(this._spherical.radius).applyQuaternion(this._yAxisUpSpaceInverse)}_getCameraDirection(s){return this._getTargetDirection(s).negate()}_findPointerById(s){return this._activePointers.find(t=>t.pointerId===s)}_findPointerByMouseButton(s){return this._activePointers.find(t=>t.mouseButton===s)}_disposePointer(s){this._activePointers.splice(this._activePointers.indexOf(s),1)}_encloseToBoundary(s,t,e){const i=t.lengthSq();if(i===0)return s;const o=G.copy(t).add(s),r=this._boundary.clampPoint(o,ne).sub(o),a=r.lengthSq();if(a===0)return s.add(t);if(a===i)return s;if(e===0)return s.add(t).add(r);{const c=1+e*a/t.dot(r);return s.add(G.copy(t).multiplyScalar(c)).add(r.multiplyScalar(1-e))}}_updateNearPlaneCorners(){if(Yt(this._camera)){const s=this._camera,t=s.near,e=s.getEffectiveFOV()*me,i=Math.tan(e*.5)*t,o=i*s.aspect;this._nearPlaneCorners[0].set(-o,-i,0),this._nearPlaneCorners[1].set(o,-i,0),this._nearPlaneCorners[2].set(o,i,0),this._nearPlaneCorners[3].set(-o,i,0)}else if(Lt(this._camera)){const s=this._camera,t=1/s.zoom,e=s.left*t,i=s.right*t,o=s.top*t,n=s.bottom*t;this._nearPlaneCorners[0].set(e,o,0),this._nearPlaneCorners[1].set(i,o,0),this._nearPlaneCorners[2].set(i,n,0),this._nearPlaneCorners[3].set(e,n,0)}}_collisionTest(){let s=1/0;if(!(this.colliderMeshes.length>=1)||Ks(this._camera,"_collisionTest"))return s;const e=this._getTargetDirection(Ae);ei.lookAt(nn,e,this._camera.up);for(let i=0;i<4;i++){const o=G.copy(this._nearPlaneCorners[i]);o.applyMatrix4(ei);const n=ne.addVectors(this._target,o);ss.set(n,e),ss.far=this._spherical.radius+1;const r=ss.intersectObjects(this.colliderMeshes);r.length!==0&&r[0].distance<s&&(s=r[0].distance)}return s}_getClientRect(s){if(!this._domElement)return;const t=this._domElement.getBoundingClientRect();return s.x=t.left,s.y=t.top,this._viewport?(s.x+=this._viewport.x,s.y+=t.height-this._viewport.w-this._viewport.y,s.width=this._viewport.z,s.height=this._viewport.w):(s.width=t.width,s.height=t.height),s}_createOnRestPromise(s){return s?Promise.resolve():(this._hasRested=!1,this.dispatchEvent({type:"transitionstart"}),new Promise(t=>{const e=()=>{this.removeEventListener("rest",e),t()};this.addEventListener("rest",e)}))}_addAllEventListeners(s){}_removeAllEventListeners(){}get dampingFactor(){return console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."),0}set dampingFactor(s){console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead.")}get draggingDampingFactor(){return console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."),0}set draggingDampingFactor(s){console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.")}static createBoundingSphere(s,t=new B.Sphere){const e=t,i=e.center;oe.makeEmpty(),s.traverseVisible(n=>{n.isMesh&&oe.expandByObject(n)}),oe.getCenter(i);let o=0;return s.traverseVisible(n=>{if(!n.isMesh)return;const r=n,a=r.geometry.clone();a.applyMatrix4(r.matrixWorld);const h=a.attributes.position;for(let E=0,d=h.count;E<d;E++)Y.fromBufferAttribute(h,E),o=Math.max(o,i.distanceToSquared(Y))}),e.radius=Math.sqrt(o),e}}class ce extends Fn{constructor(t){super(t);u(this,"onBeforeUpdate",new M);u(this,"onAfterUpdate",new M);u(this,"onAspectUpdated",new M);u(this,"onDisposed",new M);u(this,"three");u(this,"_allControls",new Map);u(this,"updateAspect",()=>{var t;if(!(!this.currentWorld||!this.currentWorld.renderer)){if(this.three instanceof g.OrthographicCamera){this.onAspectUpdated.trigger();return}if((t=this.currentWorld.renderer)!=null&&t.isResizeable()){const e=this.currentWorld.renderer.getSize();this.three.aspect=e.width/e.height,this.three.updateProjectionMatrix(),this.onAspectUpdated.trigger()}}});this.three=this.setupCamera(),this.setupEvents(!0),this.onWorldChanged.add(({action:e,world:i})=>{if(e==="added"){const o=this.newCameraControls();this._allControls.set(i.uuid,o)}if(e==="removed"){const o=this._allControls.get(i.uuid);o&&(o.dispose(),this._allControls.delete(i.uuid))}})}get controls(){if(!this.currentWorld)throw new Error("This camera needs a world to work!");const t=this._allControls.get(this.currentWorld.uuid);if(!t)throw new Error("Controls not found!");return t}get enabled(){return this.currentWorld===null?!1:this.controls.enabled}set enabled(t){this.currentWorld!==null&&(this.controls.enabled=t)}dispose(){this.setupEvents(!1),this.onAspectUpdated.reset(),this.onBeforeUpdate.reset(),this.onAfterUpdate.reset(),this.three.removeFromParent(),this.onDisposed.trigger(),this.onDisposed.reset();for(const[t,e]of this._allControls)e.dispose()}update(t){this.enabled&&(this.onBeforeUpdate.trigger(this),this.controls.update(t),this.onAfterUpdate.trigger(this))}setupCamera(){const t=window.innerWidth/window.innerHeight,e=new g.PerspectiveCamera(60,t,1,1e3);return e.position.set(50,50,50),e.lookAt(new g.Vector3(0,0,0)),e}newCameraControls(){if(!this.currentWorld)throw new Error("This camera needs a world to work!");if(!this.currentWorld.renderer)throw new Error("This camera needs a renderer to work!");nt.install({THREE:ce.getSubsetOfThree()});const{domElement:t}=this.currentWorld.renderer.three,e=new nt(this.three,t);return e.smoothTime=.2,e.dollyToCursor=!0,e.infinityDolly=!0,e.minDistance=6,e}setupEvents(t){t?window.addEventListener("resize",this.updateAspect):window.removeEventListener("resize",this.updateAspect)}static getSubsetOfThree(){return{MOUSE:g.MOUSE,Vector2:g.Vector2,Vector3:g.Vector3,Vector4:g.Vector4,Quaternion:g.Quaternion,Matrix4:g.Matrix4,Spherical:g.Spherical,Box3:g.Box3,Sphere:g.Sphere,Raycaster:g.Raycaster,MathUtils:g.MathUtils}}}const Cs=class Cs extends ${constructor(t){super(t);u(this,"onAfterUpdate",new M);u(this,"onBeforeUpdate",new M);u(this,"onDisposed",new M);u(this,"onWorldCreated",new M);u(this,"onWorldDeleted",new M);u(this,"list",new Map);u(this,"enabled",!0);t.add(Cs.uuid,this)}create(){const t=new _n(this.components),e=t.uuid;if(this.list.has(e))throw new Error("There is already a world with this name!");return this.list.set(e,t),this.onWorldCreated.trigger(t),t}delete(t){if(!this.list.has(t.uuid))throw new Error("The provided world is not found in the list!");const e=t.uuid;this.list.delete(t.uuid),t.dispose(),this.onWorldDeleted.trigger(e)}dispose(){this.enabled=!1;for(const[t,e]of this.list)e.dispose();this.list.clear(),this.onDisposed.trigger()}update(t){if(this.enabled)for(const[e,i]of this.list)i.update(t)}};u(Cs,"uuid","fdb61dc4-2ec1-4966-b83d-54ea795fad4a");let ds=Cs;function Rr(l,s,t,e){return new Promise((i,o)=>{function n(){const r=l.clientWaitSync(s,t,0);if(r===l.WAIT_FAILED){o();return}if(r===l.TIMEOUT_EXPIRED){setTimeout(n,e);return}i()}n()})}async function Fr(l,s,t,e,i,o,n){const r=l.fenceSync(l.SYNC_GPU_COMMANDS_COMPLETE,0);l.flush(),await Rr(l,r,0,10),l.deleteSync(r),l.bindBuffer(s,t),l.getBufferSubData(s,e,i,o,n),l.bindBuffer(s,null)}async function Ni(l,s,t,e,i,o,n,r){const a=l.createBuffer();return l.bindBuffer(l.PIXEL_PACK_BUFFER,a),l.bufferData(l.PIXEL_PACK_BUFFER,r.byteLength,l.STREAM_READ),l.readPixels(s,t,e,i,o,n,0),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),await Fr(l,l.PIXEL_PACK_BUFFER,a,0,r),l.deleteBuffer(a),r}class Pn{constructor(s,t,e){u(this,"onDisposed",new M);u(this,"onViewUpdated",new Le);u(this,"enabled",!0);u(this,"needsUpdate",!1);u(this,"renderDebugFrame",!1);u(this,"components");u(this,"world");u(this,"renderer");u(this,"autoUpdate",!0);u(this,"updateInterval",1e3);u(this,"worker");u(this,"scene",new g.Scene);u(this,"_width",512);u(this,"_height",512);u(this,"_availableColor",1);u(this,"renderTarget");u(this,"bufferSize");u(this,"_buffer");u(this,"_isWorkerBusy",!1);u(this,"updateVisibility",async s=>{if(!this.enabled||!this.needsUpdate&&!s||this._isWorkerBusy)return;this._isWorkerBusy=!0;const t=this.world.camera.three;t.updateMatrix(),this.renderer.setSize(this._width,this._height),this.renderer.setRenderTarget(this.renderTarget),this.renderer.render(this.scene,t);const e=this.renderer.getContext();await Ni(e,0,0,this._width,this._height,e.RGBA,e.UNSIGNED_BYTE,this._buffer),this.renderer.setRenderTarget(null),this.renderDebugFrame&&this.renderer.render(this.scene,t),this.worker.postMessage({buffer:this._buffer}),this.needsUpdate=!1});if(!t.renderer)throw new Error("The given world must have a renderer!");this.components=s,this.applySettings(e),this.world=t,this.renderer=new g.WebGLRenderer,this.renderTarget=new g.WebGLRenderTarget(this._width,this._height),this.bufferSize=this._width*this._height*4,this._buffer=new Uint8Array(this.bufferSize),this.renderer.clippingPlanes=t.renderer.clippingPlanes;const i=`
|
|
10
|
+
*/const dt={LEFT:1,RIGHT:2,MIDDLE:4},H=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,OFFSET:4,DOLLY:8,ZOOM:16,TOUCH_ROTATE:32,TOUCH_TRUCK:64,TOUCH_OFFSET:128,TOUCH_DOLLY:256,TOUCH_ZOOM:512,TOUCH_DOLLY_TRUCK:1024,TOUCH_DOLLY_OFFSET:2048,TOUCH_DOLLY_ROTATE:4096,TOUCH_ZOOM_TRUCK:8192,TOUCH_ZOOM_OFFSET:16384,TOUCH_ZOOM_ROTATE:32768}),Mi={NONE:0,IN:1,OUT:-1};function si(r){return r.isPerspectiveCamera}function ze(r){return r.isOrthographicCamera}const Di=Math.PI*2,ll=Math.PI/2,Lc=1e-5,bs=Math.PI/180;function de(r,e,t){return Math.max(e,Math.min(t,r))}function vt(r,e=Lc){return Math.abs(r)<e}function bt(r,e,t=Lc){return vt(r-e,t)}function cl(r,e){return Math.round(r/e)*e}function Is(r){return isFinite(r)?r:r<0?-Number.MAX_VALUE:Number.MAX_VALUE}function Cs(r){return Math.abs(r)<Number.MAX_VALUE?r:r*(1/0)}function On(r,e,t,i,s=1/0,n){i=Math.max(1e-4,i);const o=2/i,a=o*n,l=1/(1+a+.48*a*a+.235*a*a*a);let c=r-e;const h=e,d=s*i;c=de(c,-d,d),e=r-c;const u=(t.value+o*c)*n;t.value=(t.value-o*u)*l;let f=e+(c+u)*l;return h-r>0==f>h&&(f=h,t.value=(f-h)/n),f}function hl(r,e,t,i,s=1/0,n,o){i=Math.max(1e-4,i);const a=2/i,l=a*n,c=1/(1+l+.48*l*l+.235*l*l*l);let h=e.x,d=e.y,u=e.z,f=r.x-h,p=r.y-d,m=r.z-u;const E=h,g=d,I=u,T=s*i,b=T*T,v=f*f+p*p+m*m;if(v>b){const U=Math.sqrt(v);f=f/U*T,p=p/U*T,m=m/U*T}h=r.x-f,d=r.y-p,u=r.z-m;const A=(t.x+a*f)*n,S=(t.y+a*p)*n,N=(t.z+a*m)*n;t.x=(t.x-a*A)*c,t.y=(t.y-a*S)*c,t.z=(t.z-a*N)*c,o.x=h+(f+A)*c,o.y=d+(p+S)*c,o.z=u+(m+N)*c;const R=E-r.x,P=g-r.y,M=I-r.z,w=o.x-E,L=o.y-g,C=o.z-I;return R*w+P*L+M*C>0&&(o.x=E,o.y=g,o.z=I,t.x=(o.x-E)/n,t.y=(o.y-g)/n,t.z=(o.z-I)/n),o}function po(r,e){e.set(0,0),r.forEach(t=>{e.x+=t.clientX,e.y+=t.clientY}),e.x/=r.length,e.y/=r.length}function mo(r,e){return ze(r)?(console.warn(`${e} is not supported in OrthographicCamera`),!0):!1}class df{constructor(){this._listeners={}}addEventListener(e,t){const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){const s=this._listeners[e];if(s!==void 0){const n=s.indexOf(t);n!==-1&&s.splice(n,1)}}removeAllEventListeners(e){if(!e){this._listeners={};return}Array.isArray(this._listeners[e])&&(this._listeners[e].length=0)}dispatchEvent(e){const i=this._listeners[e.type];if(i!==void 0){e.target=this;const s=i.slice(0);for(let n=0,o=s.length;n<o;n++)s[n].call(this,e)}}}const uf="2.7.3",xn=1/8,Mc=typeof window<"u",ff=Mc&&/Mac/.test(navigator.platform),pf=!(Mc&&"PointerEvent"in window);let ht,dl,Nn,go,jt,ut,gt,Ui,ys,be,Ie,ni,ul,fl,te,_s,ki,pl,Eo,ml,bo,Io,Pn;class Gt extends df{static install(e){ht=e.THREE,dl=Object.freeze(new ht.Vector3(0,0,0)),Nn=Object.freeze(new ht.Vector3(0,1,0)),go=Object.freeze(new ht.Vector3(0,0,1)),jt=new ht.Vector2,ut=new ht.Vector3,gt=new ht.Vector3,Ui=new ht.Vector3,ys=new ht.Vector3,be=new ht.Vector3,Ie=new ht.Vector3,ni=new ht.Vector3,ul=new ht.Vector3,fl=new ht.Vector3,te=new ht.Spherical,_s=new ht.Spherical,ki=new ht.Box3,pl=new ht.Box3,Eo=new ht.Sphere,ml=new ht.Quaternion,bo=new ht.Quaternion,Io=new ht.Matrix4,Pn=new ht.Raycaster}static get ACTION(){return H}constructor(e,t){super(),this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.minDistance=Number.EPSILON,this.maxDistance=1/0,this.infinityDolly=!1,this.minZoom=.01,this.maxZoom=1/0,this.smoothTime=.25,this.draggingSmoothTime=.125,this.maxSpeed=1/0,this.azimuthRotateSpeed=1,this.polarRotateSpeed=1,this.dollySpeed=1,this.dollyDragInverted=!1,this.truckSpeed=2,this.dollyToCursor=!1,this.dragToOffset=!1,this.verticalDragToForward=!1,this.boundaryFriction=0,this.restThreshold=.01,this.colliderMeshes=[],this.cancel=()=>{},this._enabled=!0,this._state=H.NONE,this._viewport=null,this._changedDolly=0,this._changedZoom=0,this._hasRested=!0,this._boundaryEnclosesCamera=!1,this._needsUpdate=!0,this._updatedLastTime=!1,this._elementRect=new DOMRect,this._isDragging=!1,this._dragNeedsUpdate=!0,this._activePointers=[],this._lockedPointer=null,this._interactiveArea=new DOMRect(0,0,1,1),this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._isUserControllingOffset=!1,this._isUserControllingZoom=!1,this._lastDollyDirection=Mi.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new ht.Vector3,this._focalOffsetVelocity=new ht.Vector3,this._zoomVelocity={value:0},this._truckInternal=(b,v,A)=>{let S,N;if(si(this._camera)){const R=ut.copy(this._camera.position).sub(this._target),P=this._camera.getEffectiveFOV()*bs,M=R.length()*Math.tan(P*.5);S=this.truckSpeed*b*M/this._elementRect.height,N=this.truckSpeed*v*M/this._elementRect.height}else if(ze(this._camera)){const R=this._camera;S=b*(R.right-R.left)/R.zoom/this._elementRect.width,N=v*(R.top-R.bottom)/R.zoom/this._elementRect.height}else return;this.verticalDragToForward?(A?this.setFocalOffset(this._focalOffsetEnd.x+S,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(S,0,!0),this.forward(-N,!0)):A?this.setFocalOffset(this._focalOffsetEnd.x+S,this._focalOffsetEnd.y+N,this._focalOffsetEnd.z,!0):this.truck(S,N,!0)},this._rotateInternal=(b,v)=>{const A=Di*this.azimuthRotateSpeed*b/this._elementRect.height,S=Di*this.polarRotateSpeed*v/this._elementRect.height;this.rotate(A,S,!0)},this._dollyInternal=(b,v,A)=>{const S=Math.pow(.95,-b*this.dollySpeed),N=this._sphericalEnd.radius,R=this._sphericalEnd.radius*S,P=de(R,this.minDistance,this.maxDistance),M=P-R;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(R,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(M,!0),this._dollyToNoClamp(P,!0)):this._dollyToNoClamp(P,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?R:P)-N,this._dollyControlCoord.set(v,A)),this._lastDollyDirection=Math.sign(-b)},this._zoomInternal=(b,v,A)=>{const S=Math.pow(.95,b*this.dollySpeed),N=this._zoom,R=this._zoom*S;this.zoomTo(R,!0),this.dollyToCursor&&(this._changedZoom+=R-N,this._dollyControlCoord.set(v,A))},typeof ht>"u"&&console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."),this._camera=e,this._yAxisUpSpace=new ht.Quaternion().setFromUnitVectors(this._camera.up,Nn),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=H.NONE,this._target=new ht.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new ht.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new ht.Spherical().setFromVector3(ut.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)),this._sphericalEnd=this._spherical.clone(),this._lastDistance=this._spherical.radius,this._zoom=this._camera.zoom,this._zoomEnd=this._zoom,this._lastZoom=this._zoom,this._nearPlaneCorners=[new ht.Vector3,new ht.Vector3,new ht.Vector3,new ht.Vector3],this._updateNearPlaneCorners(),this._boundary=new ht.Box3(new ht.Vector3(-1/0,-1/0,-1/0),new ht.Vector3(1/0,1/0,1/0)),this._cameraUp0=this._camera.up.clone(),this._target0=this._target.clone(),this._position0=this._camera.position.clone(),this._zoom0=this._zoom,this._focalOffset0=this._focalOffset.clone(),this._dollyControlCoord=new ht.Vector2,this.mouseButtons={left:H.ROTATE,middle:H.DOLLY,right:H.TRUCK,wheel:si(this._camera)?H.DOLLY:ze(this._camera)?H.ZOOM:H.NONE},this.touches={one:H.TOUCH_ROTATE,two:si(this._camera)?H.TOUCH_DOLLY_TRUCK:ze(this._camera)?H.TOUCH_ZOOM_TRUCK:H.NONE,three:H.TOUCH_TRUCK};const i=new ht.Vector2,s=new ht.Vector2,n=new ht.Vector2,o=b=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const S=this._domElement.getBoundingClientRect(),N=b.clientX/S.width,R=b.clientY/S.height;if(N<this._interactiveArea.left||N>this._interactiveArea.right||R<this._interactiveArea.top||R>this._interactiveArea.bottom)return}const v=b.pointerType!=="mouse"?null:(b.buttons&dt.LEFT)===dt.LEFT?dt.LEFT:(b.buttons&dt.MIDDLE)===dt.MIDDLE?dt.MIDDLE:(b.buttons&dt.RIGHT)===dt.RIGHT?dt.RIGHT:null;if(v!==null){const S=this._findPointerByMouseButton(v);S&&this._disposePointer(S)}if((b.buttons&dt.LEFT)===dt.LEFT&&this._lockedPointer)return;const A={pointerId:b.pointerId,clientX:b.clientX,clientY:b.clientY,deltaX:0,deltaY:0,mouseButton:v};this._activePointers.push(A),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.ownerDocument.addEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",h),this._isDragging=!0,m(b)},a=b=>{if(!this._enabled||!this._domElement||this._lockedPointer)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const S=this._domElement.getBoundingClientRect(),N=b.clientX/S.width,R=b.clientY/S.height;if(N<this._interactiveArea.left||N>this._interactiveArea.right||R<this._interactiveArea.top||R>this._interactiveArea.bottom)return}const v=(b.buttons&dt.LEFT)===dt.LEFT?dt.LEFT:(b.buttons&dt.MIDDLE)===dt.MIDDLE?dt.MIDDLE:(b.buttons&dt.RIGHT)===dt.RIGHT?dt.RIGHT:null;if(v!==null){const S=this._findPointerByMouseButton(v);S&&this._disposePointer(S)}const A={pointerId:1,clientX:b.clientX,clientY:b.clientY,deltaX:0,deltaY:0,mouseButton:(b.buttons&dt.LEFT)===dt.LEFT?dt.LEFT:(b.buttons&dt.MIDDLE)===dt.LEFT?dt.MIDDLE:(b.buttons&dt.RIGHT)===dt.LEFT?dt.RIGHT:null};this._activePointers.push(A),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("mouseup",d),this._domElement.ownerDocument.addEventListener("mousemove",c),this._domElement.ownerDocument.addEventListener("mouseup",d),this._isDragging=!0,m(b)},l=b=>{b.cancelable&&b.preventDefault();const v=b.pointerId,A=this._lockedPointer||this._findPointerById(v);if(A){if(A.clientX=b.clientX,A.clientY=b.clientY,A.deltaX=b.movementX,A.deltaY=b.movementY,this._state=0,b.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else(!this._isDragging&&this._lockedPointer||this._isDragging&&(b.buttons&dt.LEFT)===dt.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(b.buttons&dt.MIDDLE)===dt.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(b.buttons&dt.RIGHT)===dt.RIGHT&&(this._state=this._state|this.mouseButtons.right);E()}},c=b=>{const v=this._lockedPointer||this._findPointerById(1);v&&(v.clientX=b.clientX,v.clientY=b.clientY,v.deltaX=b.movementX,v.deltaY=b.movementY,this._state=0,(this._lockedPointer||(b.buttons&dt.LEFT)===dt.LEFT)&&(this._state=this._state|this.mouseButtons.left),(b.buttons&dt.MIDDLE)===dt.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(b.buttons&dt.RIGHT)===dt.RIGHT&&(this._state=this._state|this.mouseButtons.right),E())},h=b=>{const v=this._findPointerById(b.pointerId);if(!(v&&v===this._lockedPointer)){if(v&&this._disposePointer(v),b.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=H.NONE;break;case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else this._state=H.NONE;g()}},d=()=>{const b=this._findPointerById(1);b&&b===this._lockedPointer||(b&&this._disposePointer(b),this._state=H.NONE,g())};let u=-1;const f=b=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===H.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const R=this._domElement.getBoundingClientRect(),P=b.clientX/R.width,M=b.clientY/R.height;if(P<this._interactiveArea.left||P>this._interactiveArea.right||M<this._interactiveArea.top||M>this._interactiveArea.bottom)return}if(b.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===H.ROTATE||this.mouseButtons.wheel===H.TRUCK){const R=performance.now();u-R<1e3&&this._getClientRect(this._elementRect),u=R}const v=ff?-1:-3,A=b.deltaMode===1?b.deltaY/v:b.deltaY/(v*10),S=this.dollyToCursor?(b.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,N=this.dollyToCursor?(b.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case H.ROTATE:{this._rotateInternal(b.deltaX,b.deltaY),this._isUserControllingRotate=!0;break}case H.TRUCK:{this._truckInternal(b.deltaX,b.deltaY,!1),this._isUserControllingTruck=!0;break}case H.OFFSET:{this._truckInternal(b.deltaX,b.deltaY,!0),this._isUserControllingOffset=!0;break}case H.DOLLY:{this._dollyInternal(-A,S,N),this._isUserControllingDolly=!0;break}case H.ZOOM:{this._zoomInternal(-A,S,N),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},p=b=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===Gt.ACTION.NONE){const v=b instanceof PointerEvent?b.pointerId:(b instanceof MouseEvent,0),A=this._findPointerById(v);A&&this._disposePointer(A),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("mouseup",d);return}b.preventDefault()}},m=b=>{if(!this._enabled)return;if(po(this._activePointers,jt),this._getClientRect(this._elementRect),i.copy(jt),s.copy(jt),this._activePointers.length>=2){const A=jt.x-this._activePointers[1].clientX,S=jt.y-this._activePointers[1].clientY,N=Math.sqrt(A*A+S*S);n.set(0,N);const R=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,P=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;s.set(R,P)}if(this._state=0,!b)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in b&&b.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else!this._lockedPointer&&(b.buttons&dt.LEFT)===dt.LEFT&&(this._state=this._state|this.mouseButtons.left),(b.buttons&dt.MIDDLE)===dt.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(b.buttons&dt.RIGHT)===dt.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&H.ROTATE)===H.ROTATE||(this._state&H.TOUCH_ROTATE)===H.TOUCH_ROTATE||(this._state&H.TOUCH_DOLLY_ROTATE)===H.TOUCH_DOLLY_ROTATE||(this._state&H.TOUCH_ZOOM_ROTATE)===H.TOUCH_ZOOM_ROTATE)&&(this._sphericalEnd.theta=this._spherical.theta,this._sphericalEnd.phi=this._spherical.phi,this._thetaVelocity.value=0,this._phiVelocity.value=0),((this._state&H.TRUCK)===H.TRUCK||(this._state&H.TOUCH_TRUCK)===H.TOUCH_TRUCK||(this._state&H.TOUCH_DOLLY_TRUCK)===H.TOUCH_DOLLY_TRUCK||(this._state&H.TOUCH_ZOOM_TRUCK)===H.TOUCH_ZOOM_TRUCK)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&H.DOLLY)===H.DOLLY||(this._state&H.TOUCH_DOLLY)===H.TOUCH_DOLLY||(this._state&H.TOUCH_DOLLY_TRUCK)===H.TOUCH_DOLLY_TRUCK||(this._state&H.TOUCH_DOLLY_OFFSET)===H.TOUCH_DOLLY_OFFSET||(this._state&H.TOUCH_DOLLY_ROTATE)===H.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&H.ZOOM)===H.ZOOM||(this._state&H.TOUCH_ZOOM)===H.TOUCH_ZOOM||(this._state&H.TOUCH_ZOOM_TRUCK)===H.TOUCH_ZOOM_TRUCK||(this._state&H.TOUCH_ZOOM_OFFSET)===H.TOUCH_ZOOM_OFFSET||(this._state&H.TOUCH_ZOOM_ROTATE)===H.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&H.OFFSET)===H.OFFSET||(this._state&H.TOUCH_OFFSET)===H.TOUCH_OFFSET||(this._state&H.TOUCH_DOLLY_OFFSET)===H.TOUCH_DOLLY_OFFSET||(this._state&H.TOUCH_ZOOM_OFFSET)===H.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},E=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,po(this._activePointers,jt);const v=this._domElement&&document.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,A=v?-v.deltaX:s.x-jt.x,S=v?-v.deltaY:s.y-jt.y;if(s.copy(jt),((this._state&H.ROTATE)===H.ROTATE||(this._state&H.TOUCH_ROTATE)===H.TOUCH_ROTATE||(this._state&H.TOUCH_DOLLY_ROTATE)===H.TOUCH_DOLLY_ROTATE||(this._state&H.TOUCH_ZOOM_ROTATE)===H.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(A,S),this._isUserControllingRotate=!0),(this._state&H.DOLLY)===H.DOLLY||(this._state&H.ZOOM)===H.ZOOM){const N=this.dollyToCursor?(i.x-this._elementRect.x)/this._elementRect.width*2-1:0,R=this.dollyToCursor?(i.y-this._elementRect.y)/this._elementRect.height*-2+1:0,P=this.dollyDragInverted?-1:1;(this._state&H.DOLLY)===H.DOLLY?(this._dollyInternal(P*S*xn,N,R),this._isUserControllingDolly=!0):(this._zoomInternal(P*S*xn,N,R),this._isUserControllingZoom=!0)}if((this._state&H.TOUCH_DOLLY)===H.TOUCH_DOLLY||(this._state&H.TOUCH_ZOOM)===H.TOUCH_ZOOM||(this._state&H.TOUCH_DOLLY_TRUCK)===H.TOUCH_DOLLY_TRUCK||(this._state&H.TOUCH_ZOOM_TRUCK)===H.TOUCH_ZOOM_TRUCK||(this._state&H.TOUCH_DOLLY_OFFSET)===H.TOUCH_DOLLY_OFFSET||(this._state&H.TOUCH_ZOOM_OFFSET)===H.TOUCH_ZOOM_OFFSET||(this._state&H.TOUCH_DOLLY_ROTATE)===H.TOUCH_DOLLY_ROTATE||(this._state&H.TOUCH_ZOOM_ROTATE)===H.TOUCH_ZOOM_ROTATE){const N=jt.x-this._activePointers[1].clientX,R=jt.y-this._activePointers[1].clientY,P=Math.sqrt(N*N+R*R),M=n.y-P;n.set(0,P);const w=this.dollyToCursor?(s.x-this._elementRect.x)/this._elementRect.width*2-1:0,L=this.dollyToCursor?(s.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&H.TOUCH_DOLLY)===H.TOUCH_DOLLY||(this._state&H.TOUCH_DOLLY_ROTATE)===H.TOUCH_DOLLY_ROTATE||(this._state&H.TOUCH_DOLLY_TRUCK)===H.TOUCH_DOLLY_TRUCK||(this._state&H.TOUCH_DOLLY_OFFSET)===H.TOUCH_DOLLY_OFFSET?(this._dollyInternal(M*xn,w,L),this._isUserControllingDolly=!0):(this._zoomInternal(M*xn,w,L),this._isUserControllingZoom=!0)}((this._state&H.TRUCK)===H.TRUCK||(this._state&H.TOUCH_TRUCK)===H.TOUCH_TRUCK||(this._state&H.TOUCH_DOLLY_TRUCK)===H.TOUCH_DOLLY_TRUCK||(this._state&H.TOUCH_ZOOM_TRUCK)===H.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(A,S,!1),this._isUserControllingTruck=!0),((this._state&H.OFFSET)===H.OFFSET||(this._state&H.TOUCH_OFFSET)===H.TOUCH_OFFSET||(this._state&H.TOUCH_DOLLY_OFFSET)===H.TOUCH_DOLLY_OFFSET||(this._state&H.TOUCH_ZOOM_OFFSET)===H.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(A,S,!0),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},g=()=>{po(this._activePointers,jt),s.copy(jt),this._dragNeedsUpdate=!1,(this._activePointers.length===0||this._activePointers.length===1&&this._activePointers[0]===this._lockedPointer)&&(this._isDragging=!1),this._activePointers.length===0&&this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.ownerDocument.removeEventListener("mouseup",d),this.dispatchEvent({type:"controlend"}))};this.lockPointer=()=>{!this._enabled||!this._domElement||(this.cancel(),this._lockedPointer={pointerId:-1,clientX:0,clientY:0,deltaX:0,deltaY:0,mouseButton:null},this._activePointers.push(this._lockedPointer),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",I),this._domElement.ownerDocument.addEventListener("pointerlockerror",T),this._domElement.ownerDocument.addEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",h),m())},this.unlockPointer=()=>{this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),document.exitPointerLock(),this.cancel(),this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointerlockchange",I),this._domElement.ownerDocument.removeEventListener("pointerlockerror",T))};const I=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},T=()=>{this.unlockPointer()};this._addAllEventListeners=b=>{this._domElement=b,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",o),pf&&this._domElement.addEventListener("mousedown",a),this._domElement.addEventListener("pointercancel",h),this._domElement.addEventListener("wheel",f,{passive:!1}),this._domElement.addEventListener("contextmenu",p)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",o),this._domElement.removeEventListener("mousedown",a),this._domElement.removeEventListener("pointercancel",h),this._domElement.removeEventListener("wheel",f,{passive:!1}),this._domElement.removeEventListener("contextmenu",p),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.ownerDocument.removeEventListener("mouseup",d),this._domElement.ownerDocument.removeEventListener("pointerlockchange",I),this._domElement.ownerDocument.removeEventListener("pointerlockerror",T))},this.cancel=()=>{this._state!==H.NONE&&(this._state=H.NONE,this._activePointers.length=0,g())},t&&this.connect(t),this.update(0)}get camera(){return this._camera}set camera(e){this._camera=e,this.updateCameraUp(),this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._domElement&&(e?(this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none"):(this.cancel(),this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect=""))}get active(){return!this._hasRested}get currentAction(){return this._state}get distance(){return this._spherical.radius}set distance(e){this._spherical.radius===e&&this._sphericalEnd.radius===e||(this._spherical.radius=e,this._sphericalEnd.radius=e,this._needsUpdate=!0)}get azimuthAngle(){return this._spherical.theta}set azimuthAngle(e){this._spherical.theta===e&&this._sphericalEnd.theta===e||(this._spherical.theta=e,this._sphericalEnd.theta=e,this._needsUpdate=!0)}get polarAngle(){return this._spherical.phi}set polarAngle(e){this._spherical.phi===e&&this._sphericalEnd.phi===e||(this._spherical.phi=e,this._sphericalEnd.phi=e,this._needsUpdate=!0)}get boundaryEnclosesCamera(){return this._boundaryEnclosesCamera}set boundaryEnclosesCamera(e){this._boundaryEnclosesCamera=e,this._needsUpdate=!0}set interactiveArea(e){this._interactiveArea.width=de(e.width,0,1),this._interactiveArea.height=de(e.height,0,1),this._interactiveArea.x=de(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=de(e.y,0,1-this._interactiveArea.height)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}rotate(e,t,i=!1){return this.rotateTo(this._sphericalEnd.theta+e,this._sphericalEnd.phi+t,i)}rotateAzimuthTo(e,t=!1){return this.rotateTo(e,this._sphericalEnd.phi,t)}rotatePolarTo(e,t=!1){return this.rotateTo(this._sphericalEnd.theta,e,t)}rotateTo(e,t,i=!1){this._isUserControllingRotate=!1;const s=de(e,this.minAzimuthAngle,this.maxAzimuthAngle),n=de(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=s,this._sphericalEnd.phi=n,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,i||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const o=!i||bt(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&bt(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(o)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=Mi.NONE,this._changedDolly=0,this._dollyToNoClamp(de(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const i=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const o=this._collisionTest(),a=bt(o,this._spherical.radius);if(!(i>e)&&a)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,o)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const n=!t||bt(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(n)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection(ys).multiplyScalar(e)),t||this._target.copy(this._targetEnd);const i=!t||bt(this._target.x,this._targetEnd.x,this.restThreshold)&&bt(this._target.y,this._targetEnd.y,this.restThreshold)&&bt(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(i)}zoom(e,t=!1){return this.zoomTo(this._zoomEnd+e,t)}zoomTo(e,t=!1){this._isUserControllingZoom=!1,this._zoomEnd=de(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const i=!t||bt(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(i)}pan(e,t,i=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(e,t,i)}truck(e,t,i=!1){this._camera.updateMatrix(),be.setFromMatrixColumn(this._camera.matrix,0),Ie.setFromMatrixColumn(this._camera.matrix,1),be.multiplyScalar(e),Ie.multiplyScalar(-t);const s=ut.copy(be).add(Ie),n=gt.copy(this._targetEnd).add(s);return this.moveTo(n.x,n.y,n.z,i)}forward(e,t=!1){ut.setFromMatrixColumn(this._camera.matrix,0),ut.crossVectors(this._camera.up,ut),ut.multiplyScalar(e);const i=gt.copy(this._targetEnd).add(ut);return this.moveTo(i.x,i.y,i.z,t)}elevate(e,t=!1){return ut.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+ut.x,this._targetEnd.y+ut.y,this._targetEnd.z+ut.z,t)}moveTo(e,t,i,s=!1){this._isUserControllingTruck=!1;const n=ut.set(e,t,i).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,n,this.boundaryFriction),this._needsUpdate=!0,s||this._target.copy(this._targetEnd);const o=!s||bt(this._target.x,this._targetEnd.x,this.restThreshold)&&bt(this._target.y,this._targetEnd.y,this.restThreshold)&&bt(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(o)}lookInDirectionOf(e,t,i,s=!1){const a=ut.set(e,t,i).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius);return this.setPosition(a.x,a.y,a.z,s)}fitToBox(e,t,{cover:i=!1,paddingLeft:s=0,paddingRight:n=0,paddingBottom:o=0,paddingTop:a=0}={}){const l=[],c=e.isBox3?ki.copy(e):ki.setFromObject(e);c.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const h=cl(this._sphericalEnd.theta,ll),d=cl(this._sphericalEnd.phi,ll);l.push(this.rotateTo(h,d,t));const u=ut.setFromSpherical(this._sphericalEnd).normalize(),f=ml.setFromUnitVectors(u,go),p=bt(Math.abs(u.y),1);p&&f.multiply(bo.setFromAxisAngle(Nn,h)),f.multiply(this._yAxisUpSpaceInverse);const m=pl.makeEmpty();gt.copy(c.min).applyQuaternion(f),m.expandByPoint(gt),gt.copy(c.min).setX(c.max.x).applyQuaternion(f),m.expandByPoint(gt),gt.copy(c.min).setY(c.max.y).applyQuaternion(f),m.expandByPoint(gt),gt.copy(c.max).setZ(c.min.z).applyQuaternion(f),m.expandByPoint(gt),gt.copy(c.min).setZ(c.max.z).applyQuaternion(f),m.expandByPoint(gt),gt.copy(c.max).setY(c.min.y).applyQuaternion(f),m.expandByPoint(gt),gt.copy(c.max).setX(c.min.x).applyQuaternion(f),m.expandByPoint(gt),gt.copy(c.max).applyQuaternion(f),m.expandByPoint(gt),m.min.x-=s,m.min.y-=o,m.max.x+=n,m.max.y+=a,f.setFromUnitVectors(go,u),p&&f.premultiply(bo.invert()),f.premultiply(this._yAxisUpSpace);const E=m.getSize(ut),g=m.getCenter(gt).applyQuaternion(f);if(si(this._camera)){const I=this.getDistanceToFitBox(E.x,E.y,E.z,i);l.push(this.moveTo(g.x,g.y,g.z,t)),l.push(this.dollyTo(I,t)),l.push(this.setFocalOffset(0,0,0,t))}else if(ze(this._camera)){const I=this._camera,T=I.right-I.left,b=I.top-I.bottom,v=i?Math.max(T/E.x,b/E.y):Math.min(T/E.x,b/E.y);l.push(this.moveTo(g.x,g.y,g.z,t)),l.push(this.zoomTo(v,t)),l.push(this.setFocalOffset(0,0,0,t))}return Promise.all(l)}fitToSphere(e,t){const i=[],n=e instanceof ht.Sphere?Eo.copy(e):Gt.createBoundingSphere(e,Eo);if(i.push(this.moveTo(n.center.x,n.center.y,n.center.z,t)),si(this._camera)){const o=this.getDistanceToFitSphere(n.radius);i.push(this.dollyTo(o,t))}else if(ze(this._camera)){const o=this._camera.right-this._camera.left,a=this._camera.top-this._camera.bottom,l=2*n.radius,c=Math.min(o/l,a/l);i.push(this.zoomTo(c,t))}return i.push(this.setFocalOffset(0,0,0,t)),Promise.all(i)}setLookAt(e,t,i,s,n,o,a=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Mi.NONE,this._changedDolly=0;const l=gt.set(s,n,o),c=ut.set(e,t,i);this._targetEnd.copy(l),this._sphericalEnd.setFromVector3(c.sub(l).applyQuaternion(this._yAxisUpSpace)),this.normalizeRotations(),this._needsUpdate=!0,a||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const h=!a||bt(this._target.x,this._targetEnd.x,this.restThreshold)&&bt(this._target.y,this._targetEnd.y,this.restThreshold)&&bt(this._target.z,this._targetEnd.z,this.restThreshold)&&bt(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&bt(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&bt(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(h)}lerpLookAt(e,t,i,s,n,o,a,l,c,h,d,u,f,p=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Mi.NONE,this._changedDolly=0;const m=ut.set(s,n,o),E=gt.set(e,t,i);te.setFromVector3(E.sub(m).applyQuaternion(this._yAxisUpSpace));const g=Ui.set(h,d,u),I=gt.set(a,l,c);_s.setFromVector3(I.sub(g).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(m.lerp(g,f));const T=_s.theta-te.theta,b=_s.phi-te.phi,v=_s.radius-te.radius;this._sphericalEnd.set(te.radius+v*f,te.phi+b*f,te.theta+T*f),this.normalizeRotations(),this._needsUpdate=!0,p||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const A=!p||bt(this._target.x,this._targetEnd.x,this.restThreshold)&&bt(this._target.y,this._targetEnd.y,this.restThreshold)&&bt(this._target.z,this._targetEnd.z,this.restThreshold)&&bt(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&bt(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&bt(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(A)}setPosition(e,t,i,s=!1){return this.setLookAt(e,t,i,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,s)}setTarget(e,t,i,s=!1){const n=this.getPosition(ut),o=this.setLookAt(n.x,n.y,n.z,e,t,i,s);return this._sphericalEnd.phi=de(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),o}setFocalOffset(e,t,i,s=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(e,t,i),this._needsUpdate=!0,s||this._focalOffset.copy(this._focalOffsetEnd);const n=!s||bt(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&bt(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&bt(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(n)}setOrbitPoint(e,t,i){this._camera.updateMatrixWorld(),be.setFromMatrixColumn(this._camera.matrixWorldInverse,0),Ie.setFromMatrixColumn(this._camera.matrixWorldInverse,1),ni.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const s=ut.set(e,t,i),n=s.distanceTo(this._camera.position),o=s.sub(this._camera.position);be.multiplyScalar(o.x),Ie.multiplyScalar(o.y),ni.multiplyScalar(o.z),ut.copy(be).add(Ie).add(ni),ut.z=ut.z+n,this.dollyTo(n,!1),this.setFocalOffset(-ut.x,ut.y,-ut.z,!1),this.moveTo(e,t,i,!1)}setBoundary(e){if(!e){this._boundary.min.set(-1/0,-1/0,-1/0),this._boundary.max.set(1/0,1/0,1/0),this._needsUpdate=!0;return}this._boundary.copy(e),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(e,t,i,s){if(e===null){this._viewport=null;return}this._viewport=this._viewport||new ht.Vector4,typeof e=="number"?this._viewport.set(e,t,i,s):this._viewport.copy(e)}getDistanceToFitBox(e,t,i,s=!1){if(mo(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const n=e/t,o=this._camera.getEffectiveFOV()*bs,a=this._camera.aspect;return((s?n>a:n<a)?t:e/a)*.5/Math.tan(o*.5)+i*.5}getDistanceToFitSphere(e){if(mo(this._camera,"getDistanceToFitSphere"))return this._spherical.radius;const t=this._camera.getEffectiveFOV()*bs,i=Math.atan(Math.tan(t*.5)*this._camera.aspect)*2,s=1<this._camera.aspect?t:i;return e/Math.sin(s*.5)}getTarget(e,t=!0){return(e&&e.isVector3?e:new ht.Vector3).copy(t?this._targetEnd:this._target)}getPosition(e,t=!0){return(e&&e.isVector3?e:new ht.Vector3).setFromSpherical(t?this._sphericalEnd:this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(t?this._targetEnd:this._target)}getSpherical(e,t=!0){return(e&&e instanceof ht.Spherical?e:new ht.Spherical).copy(t?this._sphericalEnd:this._spherical)}getFocalOffset(e,t=!0){return(e&&e.isVector3?e:new ht.Vector3).copy(t?this._focalOffsetEnd:this._focalOffset)}normalizeRotations(){this._sphericalEnd.theta=this._sphericalEnd.theta%Di,this._sphericalEnd.theta<0&&(this._sphericalEnd.theta+=Di),this._spherical.theta+=Di*Math.round((this._sphericalEnd.theta-this._spherical.theta)/Di)}reset(e=!1){if(!bt(this._camera.up.x,this._cameraUp0.x)||!bt(this._camera.up.y,this._cameraUp0.y)||!bt(this._camera.up.z,this._cameraUp0.z)){this._camera.up.copy(this._cameraUp0);const i=this.getPosition(ut);this.updateCameraUp(),this.setPosition(i.x,i.y,i.z)}const t=[this.setLookAt(this._position0.x,this._position0.y,this._position0.z,this._target0.x,this._target0.y,this._target0.z,e),this.setFocalOffset(this._focalOffset0.x,this._focalOffset0.y,this._focalOffset0.z,e),this.zoomTo(this._zoom0,e)];return Promise.all(t)}saveState(){this._cameraUp0.copy(this._camera.up),this.getTarget(this._target0),this.getPosition(this._position0),this._zoom0=this._zoom,this._focalOffset0.copy(this._focalOffset)}updateCameraUp(){this._yAxisUpSpace.setFromUnitVectors(this._camera.up,Nn),this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert()}applyCameraUp(){const e=ut.subVectors(this._target,this._camera.position).normalize(),t=gt.crossVectors(e,this._camera.up);this._camera.up.crossVectors(t,e).normalize(),this._camera.updateMatrixWorld();const i=this.getPosition(ut);this.updateCameraUp(),this.setPosition(i.x,i.y,i.z)}update(e){const t=this._sphericalEnd.theta-this._spherical.theta,i=this._sphericalEnd.phi-this._spherical.phi,s=this._sphericalEnd.radius-this._spherical.radius,n=ul.subVectors(this._targetEnd,this._target),o=fl.subVectors(this._focalOffsetEnd,this._focalOffset),a=this._zoomEnd-this._zoom;if(vt(t))this._thetaVelocity.value=0,this._spherical.theta=this._sphericalEnd.theta;else{const d=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.theta=On(this._spherical.theta,this._sphericalEnd.theta,this._thetaVelocity,d,1/0,e),this._needsUpdate=!0}if(vt(i))this._phiVelocity.value=0,this._spherical.phi=this._sphericalEnd.phi;else{const d=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.phi=On(this._spherical.phi,this._sphericalEnd.phi,this._phiVelocity,d,1/0,e),this._needsUpdate=!0}if(vt(s))this._radiusVelocity.value=0,this._spherical.radius=this._sphericalEnd.radius;else{const d=this._isUserControllingDolly?this.draggingSmoothTime:this.smoothTime;this._spherical.radius=On(this._spherical.radius,this._sphericalEnd.radius,this._radiusVelocity,d,this.maxSpeed,e),this._needsUpdate=!0}if(vt(n.x)&&vt(n.y)&&vt(n.z))this._targetVelocity.set(0,0,0),this._target.copy(this._targetEnd);else{const d=this._isUserControllingTruck?this.draggingSmoothTime:this.smoothTime;hl(this._target,this._targetEnd,this._targetVelocity,d,this.maxSpeed,e,this._target),this._needsUpdate=!0}if(vt(o.x)&&vt(o.y)&&vt(o.z))this._focalOffsetVelocity.set(0,0,0),this._focalOffset.copy(this._focalOffsetEnd);else{const d=this._isUserControllingOffset?this.draggingSmoothTime:this.smoothTime;hl(this._focalOffset,this._focalOffsetEnd,this._focalOffsetVelocity,d,this.maxSpeed,e,this._focalOffset),this._needsUpdate=!0}if(vt(a))this._zoomVelocity.value=0,this._zoom=this._zoomEnd;else{const d=this._isUserControllingZoom?this.draggingSmoothTime:this.smoothTime;this._zoom=On(this._zoom,this._zoomEnd,this._zoomVelocity,d,1/0,e)}if(this.dollyToCursor){if(si(this._camera)&&this._changedDolly!==0){const d=this._spherical.radius-this._lastDistance,u=this._camera,f=this._getCameraDirection(ys),p=ut.copy(f).cross(u.up).normalize();p.lengthSq()===0&&(p.x=1);const m=gt.crossVectors(p,f),E=this._sphericalEnd.radius*Math.tan(u.getEffectiveFOV()*bs*.5),I=(this._sphericalEnd.radius-d-this._sphericalEnd.radius)/this._sphericalEnd.radius,T=Ui.copy(this._targetEnd).add(p.multiplyScalar(this._dollyControlCoord.x*E*u.aspect)).add(m.multiplyScalar(this._dollyControlCoord.y*E)),b=ut.copy(this._targetEnd).lerp(T,I),v=this._lastDollyDirection===Mi.IN&&this._spherical.radius<=this.minDistance,A=this._lastDollyDirection===Mi.OUT&&this.maxDistance<=this._spherical.radius;if(this.infinityDolly&&(v||A)){this._sphericalEnd.radius-=d,this._spherical.radius-=d;const N=gt.copy(f).multiplyScalar(-d);b.add(N)}this._boundary.clampPoint(b,b);const S=gt.subVectors(b,this._targetEnd);this._targetEnd.copy(b),this._target.add(S),this._changedDolly-=d,vt(this._changedDolly)&&(this._changedDolly=0)}else if(ze(this._camera)&&this._changedZoom!==0){const d=this._zoom-this._lastZoom,u=this._camera,f=ut.set(this._dollyControlCoord.x,this._dollyControlCoord.y,(u.near+u.far)/(u.near-u.far)).unproject(u),p=gt.set(0,0,-1).applyQuaternion(u.quaternion),m=Ui.copy(f).add(p.multiplyScalar(-f.dot(u.up))),g=-(this._zoom-d-this._zoom)/this._zoom,I=this._getCameraDirection(ys),T=this._targetEnd.dot(I),b=ut.copy(this._targetEnd).lerp(m,g),v=b.dot(I),A=I.multiplyScalar(v-T);b.sub(A),this._boundary.clampPoint(b,b);const S=gt.subVectors(b,this._targetEnd);this._targetEnd.copy(b),this._target.add(S),this._changedZoom-=d,vt(this._changedZoom)&&(this._changedZoom=0)}}this._camera.zoom!==this._zoom&&(this._camera.zoom=this._zoom,this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0),this._dragNeedsUpdate=!0;const l=this._collisionTest();this._spherical.radius=Math.min(this._spherical.radius,l),this._spherical.makeSafe(),this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target),this._camera.lookAt(this._target),(!vt(this._focalOffset.x)||!vt(this._focalOffset.y)||!vt(this._focalOffset.z))&&(this._camera.updateMatrixWorld(),be.setFromMatrixColumn(this._camera.matrix,0),Ie.setFromMatrixColumn(this._camera.matrix,1),ni.setFromMatrixColumn(this._camera.matrix,2),be.multiplyScalar(this._focalOffset.x),Ie.multiplyScalar(-this._focalOffset.y),ni.multiplyScalar(this._focalOffset.z),ut.copy(be).add(Ie).add(ni),this._camera.position.add(ut)),this._boundaryEnclosesCamera&&this._encloseToBoundary(this._camera.position.copy(this._target),ut.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),1);const h=this._needsUpdate;return h&&!this._updatedLastTime?(this._hasRested=!1,this.dispatchEvent({type:"wake"}),this.dispatchEvent({type:"update"})):h?(this.dispatchEvent({type:"update"}),vt(t,this.restThreshold)&&vt(i,this.restThreshold)&&vt(s,this.restThreshold)&&vt(n.x,this.restThreshold)&&vt(n.y,this.restThreshold)&&vt(n.z,this.restThreshold)&&vt(o.x,this.restThreshold)&&vt(o.y,this.restThreshold)&&vt(o.z,this.restThreshold)&&vt(a,this.restThreshold)&&!this._hasRested&&(this._hasRested=!0,this.dispatchEvent({type:"rest"}))):!h&&this._updatedLastTime&&this.dispatchEvent({type:"sleep"}),this._lastDistance=this._spherical.radius,this._lastZoom=this._zoom,this._updatedLastTime=h,this._needsUpdate=!1,h}toJSON(){return JSON.stringify({enabled:this._enabled,minDistance:this.minDistance,maxDistance:Is(this.maxDistance),minZoom:this.minZoom,maxZoom:Is(this.maxZoom),minPolarAngle:this.minPolarAngle,maxPolarAngle:Is(this.maxPolarAngle),minAzimuthAngle:Is(this.minAzimuthAngle),maxAzimuthAngle:Is(this.maxAzimuthAngle),smoothTime:this.smoothTime,draggingSmoothTime:this.draggingSmoothTime,dollySpeed:this.dollySpeed,truckSpeed:this.truckSpeed,dollyToCursor:this.dollyToCursor,verticalDragToForward:this.verticalDragToForward,target:this._targetEnd.toArray(),position:ut.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),zoom:this._zoomEnd,focalOffset:this._focalOffsetEnd.toArray(),target0:this._target0.toArray(),position0:this._position0.toArray(),zoom0:this._zoom0,focalOffset0:this._focalOffset0.toArray()})}fromJSON(e,t=!1){const i=JSON.parse(e);this.enabled=i.enabled,this.minDistance=i.minDistance,this.maxDistance=Cs(i.maxDistance),this.minZoom=i.minZoom,this.maxZoom=Cs(i.maxZoom),this.minPolarAngle=i.minPolarAngle,this.maxPolarAngle=Cs(i.maxPolarAngle),this.minAzimuthAngle=Cs(i.minAzimuthAngle),this.maxAzimuthAngle=Cs(i.maxAzimuthAngle),this.smoothTime=i.smoothTime,this.draggingSmoothTime=i.draggingSmoothTime,this.dollySpeed=i.dollySpeed,this.truckSpeed=i.truckSpeed,this.dollyToCursor=i.dollyToCursor,this.verticalDragToForward=i.verticalDragToForward,this._target0.fromArray(i.target0),this._position0.fromArray(i.position0),this._zoom0=i.zoom0,this._focalOffset0.fromArray(i.focalOffset0),this.moveTo(i.target[0],i.target[1],i.target[2],t),te.setFromVector3(ut.fromArray(i.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)),this.rotateTo(te.theta,te.phi,t),this.dollyTo(te.radius,t),this.zoomTo(i.zoom,t),this.setFocalOffset(i.focalOffset[0],i.focalOffset[1],i.focalOffset[2],t),this._needsUpdate=!0}connect(e){if(this._domElement){console.warn("camera-controls is already connected.");return}e.setAttribute("data-camera-controls-version",uf),this._addAllEventListeners(e),this._getClientRect(this._elementRect)}disconnect(){this.cancel(),this._removeAllEventListeners(),this._domElement&&(this._domElement.removeAttribute("data-camera-controls-version"),this._domElement=void 0)}dispose(){this.removeAllEventListeners(),this.disconnect()}_getTargetDirection(e){return e.setFromSpherical(this._spherical).divideScalar(this._spherical.radius).applyQuaternion(this._yAxisUpSpaceInverse)}_getCameraDirection(e){return this._getTargetDirection(e).negate()}_findPointerById(e){return this._activePointers.find(t=>t.pointerId===e)}_findPointerByMouseButton(e){return this._activePointers.find(t=>t.mouseButton===e)}_disposePointer(e){this._activePointers.splice(this._activePointers.indexOf(e),1)}_encloseToBoundary(e,t,i){const s=t.lengthSq();if(s===0)return e;const n=gt.copy(t).add(e),a=this._boundary.clampPoint(n,Ui).sub(n),l=a.lengthSq();if(l===0)return e.add(t);if(l===s)return e;if(i===0)return e.add(t).add(a);{const c=1+i*l/t.dot(a);return e.add(gt.copy(t).multiplyScalar(c)).add(a.multiplyScalar(1-i))}}_updateNearPlaneCorners(){if(si(this._camera)){const e=this._camera,t=e.near,i=e.getEffectiveFOV()*bs,s=Math.tan(i*.5)*t,n=s*e.aspect;this._nearPlaneCorners[0].set(-n,-s,0),this._nearPlaneCorners[1].set(n,-s,0),this._nearPlaneCorners[2].set(n,s,0),this._nearPlaneCorners[3].set(-n,s,0)}else if(ze(this._camera)){const e=this._camera,t=1/e.zoom,i=e.left*t,s=e.right*t,n=e.top*t,o=e.bottom*t;this._nearPlaneCorners[0].set(i,n,0),this._nearPlaneCorners[1].set(s,n,0),this._nearPlaneCorners[2].set(s,o,0),this._nearPlaneCorners[3].set(i,o,0)}}_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||mo(this._camera,"_collisionTest"))return e;const i=this._getTargetDirection(ys);Io.lookAt(dl,i,this._camera.up);for(let s=0;s<4;s++){const n=gt.copy(this._nearPlaneCorners[s]);n.applyMatrix4(Io);const o=Ui.addVectors(this._target,n);Pn.set(o,i),Pn.far=this._spherical.radius+1;const a=Pn.intersectObjects(this.colliderMeshes);a.length!==0&&a[0].distance<e&&(e=a[0].distance)}return e}_getClientRect(e){if(!this._domElement)return;const t=this._domElement.getBoundingClientRect();return e.x=t.left,e.y=t.top,this._viewport?(e.x+=this._viewport.x,e.y+=t.height-this._viewport.w-this._viewport.y,e.width=this._viewport.z,e.height=this._viewport.w):(e.width=t.width,e.height=t.height),e}_createOnRestPromise(e){return e?Promise.resolve():(this._hasRested=!1,this.dispatchEvent({type:"transitionstart"}),new Promise(t=>{const i=()=>{this.removeEventListener("rest",i),t()};this.addEventListener("rest",i)}))}_addAllEventListeners(e){}_removeAllEventListeners(){}get dampingFactor(){return console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."),0}set dampingFactor(e){console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead.")}get draggingDampingFactor(){return console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."),0}set draggingDampingFactor(e){console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.")}static createBoundingSphere(e,t=new ht.Sphere){const i=t,s=i.center;ki.makeEmpty(),e.traverseVisible(o=>{o.isMesh&&ki.expandByObject(o)}),ki.getCenter(s);let n=0;return e.traverseVisible(o=>{if(!o.isMesh)return;const a=o,l=a.geometry.clone();l.applyMatrix4(a.matrixWorld);const h=l.attributes.position;for(let d=0,u=h.count;d<u;d++)ut.fromBufferAttribute(h,d),n=Math.max(n,s.distanceToSquared(ut))}),i.radius=Math.sqrt(n),i}}class Gi extends Rc{constructor(t){super(t);y(this,"onBeforeUpdate",new K);y(this,"onAfterUpdate",new K);y(this,"onAspectUpdated",new K);y(this,"onDisposed",new K);y(this,"three");y(this,"_allControls",new Map);y(this,"updateAspect",()=>{var t;if(!(!this.currentWorld||!this.currentWorld.renderer)){if(this.three instanceof D.OrthographicCamera){this.onAspectUpdated.trigger();return}if((t=this.currentWorld.renderer)!=null&&t.isResizeable()){const i=this.currentWorld.renderer.getSize();this.three.aspect=i.width/i.height,this.three.updateProjectionMatrix(),this.onAspectUpdated.trigger()}}});this.three=this.setupCamera(),this.setupEvents(!0),this.onWorldChanged.add(({action:i,world:s})=>{if(i==="added"){const n=this.newCameraControls();this._allControls.set(s.uuid,n)}if(i==="removed"){const n=this._allControls.get(s.uuid);n&&(n.dispose(),this._allControls.delete(s.uuid))}})}get controls(){if(!this.currentWorld)throw new Error("This camera needs a world to work!");const t=this._allControls.get(this.currentWorld.uuid);if(!t)throw new Error("Controls not found!");return t}get enabled(){return this.currentWorld===null?!1:this.controls.enabled}set enabled(t){this.currentWorld!==null&&(this.controls.enabled=t)}dispose(){this.setupEvents(!1),this.onAspectUpdated.reset(),this.onBeforeUpdate.reset(),this.onAfterUpdate.reset(),this.three.removeFromParent(),this.onDisposed.trigger(),this.onDisposed.reset();for(const[t,i]of this._allControls)i.dispose()}update(t){this.enabled&&(this.onBeforeUpdate.trigger(this),this.controls.update(t),this.onAfterUpdate.trigger(this))}setupCamera(){const t=window.innerWidth/window.innerHeight,i=new D.PerspectiveCamera(60,t,1,1e3);return i.position.set(50,50,50),i.lookAt(new D.Vector3(0,0,0)),i}newCameraControls(){if(!this.currentWorld)throw new Error("This camera needs a world to work!");if(!this.currentWorld.renderer)throw new Error("This camera needs a renderer to work!");Gt.install({THREE:Gi.getSubsetOfThree()});const{domElement:t}=this.currentWorld.renderer.three,i=new Gt(this.three,t);return i.smoothTime=.2,i.dollyToCursor=!0,i.infinityDolly=!0,i.minDistance=6,i}setupEvents(t){t?window.addEventListener("resize",this.updateAspect):window.removeEventListener("resize",this.updateAspect)}static getSubsetOfThree(){return{MOUSE:D.MOUSE,Vector2:D.Vector2,Vector3:D.Vector3,Vector4:D.Vector4,Quaternion:D.Quaternion,Matrix4:D.Matrix4,Spherical:D.Spherical,Box3:D.Box3,Sphere:D.Sphere,Raycaster:D.Raycaster,MathUtils:D.MathUtils}}}const Cr=class Cr extends Ot{constructor(t){super(t);y(this,"onAfterUpdate",new K);y(this,"onBeforeUpdate",new K);y(this,"onDisposed",new K);y(this,"onWorldCreated",new K);y(this,"onWorldDeleted",new K);y(this,"list",new Map);y(this,"enabled",!0);t.add(Cr.uuid,this)}create(){const t=new Nc(this.components),i=t.uuid;if(this.list.has(i))throw new Error("There is already a world with this name!");return this.list.set(i,t),this.onWorldCreated.trigger(t),t}delete(t){if(!this.list.has(t.uuid))throw new Error("The provided world is not found in the list!");const i=t.uuid;this.list.delete(t.uuid),t.dispose(),this.onWorldDeleted.trigger(i)}dispose(){this.enabled=!1;for(const[t,i]of this.list)i.dispose();this.list.clear(),this.onDisposed.trigger()}update(t){if(this.enabled)for(const[i,s]of this.list)s.update(t)}};y(Cr,"uuid","fdb61dc4-2ec1-4966-b83d-54ea795fad4a");let qn=Cr;function mf(r,e,t,i){return new Promise((s,n)=>{function o(){const a=r.clientWaitSync(e,t,0);if(a===r.WAIT_FAILED){n();return}if(a===r.TIMEOUT_EXPIRED){setTimeout(o,i);return}s()}o()})}async function gf(r,e,t,i,s,n,o){const a=r.fenceSync(r.SYNC_GPU_COMMANDS_COMPLETE,0);r.flush(),await mf(r,a,0,10),r.deleteSync(a),r.bindBuffer(e,t),r.getBufferSubData(e,i,s,n,o),r.bindBuffer(e,null)}async function ma(r,e,t,i,s,n,o,a){const l=r.createBuffer();return r.bindBuffer(r.PIXEL_PACK_BUFFER,l),r.bufferData(r.PIXEL_PACK_BUFFER,a.byteLength,r.STREAM_READ),r.readPixels(e,t,i,s,n,o,0),r.bindBuffer(r.PIXEL_PACK_BUFFER,null),await gf(r,r.PIXEL_PACK_BUFFER,l,0,a),r.deleteBuffer(l),a}class Dc{constructor(e,t,i){y(this,"onDisposed",new K);y(this,"onViewUpdated",new Ns);y(this,"enabled",!0);y(this,"needsUpdate",!1);y(this,"renderDebugFrame",!1);y(this,"components");y(this,"world");y(this,"renderer");y(this,"autoUpdate",!0);y(this,"updateInterval",1e3);y(this,"worker");y(this,"scene",new D.Scene);y(this,"_width",512);y(this,"_height",512);y(this,"_availableColor",1);y(this,"renderTarget");y(this,"bufferSize");y(this,"_buffer");y(this,"_isWorkerBusy",!1);y(this,"updateVisibility",async e=>{if(!this.enabled||!this.needsUpdate&&!e||this._isWorkerBusy)return;this._isWorkerBusy=!0;const t=this.world.camera.three;t.updateMatrix(),this.renderer.setSize(this._width,this._height),this.renderer.setRenderTarget(this.renderTarget),this.renderer.render(this.scene,t);const i=this.renderer.getContext();await ma(i,0,0,this._width,this._height,i.RGBA,i.UNSIGNED_BYTE,this._buffer),this.renderer.setRenderTarget(null),this.renderDebugFrame&&this.renderer.render(this.scene,t),this.worker.postMessage({buffer:this._buffer}),this.needsUpdate=!1});if(!t.renderer)throw new Error("The given world must have a renderer!");this.components=e,this.applySettings(i),this.world=t,this.renderer=new D.WebGLRenderer,this.renderTarget=new D.WebGLRenderTarget(this._width,this._height),this.bufferSize=this._width*this._height*4,this._buffer=new Uint8Array(this.bufferSize),this.renderer.clippingPlanes=t.renderer.clippingPlanes;const s=`
|
|
11
11
|
addEventListener("message", (event) => {
|
|
12
12
|
const { buffer } = event.data;
|
|
13
13
|
const colors = new Map();
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
}
|
|
25
25
|
postMessage({ colors });
|
|
26
26
|
});
|
|
27
|
-
`,
|
|
27
|
+
`,n=new Blob([s],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(n))}dispose(){this.enabled=!1;for(const e of this.scene.children)e.removeFromParent();this.onViewUpdated.reset(),this.worker.terminate(),this.renderer.forceContextLoss(),this.renderer.dispose(),this.renderTarget.dispose(),this._buffer=null,this.onDisposed.reset()}getAvailableColor(){let e=BigInt(this._availableColor.toString());const t=[];do t.unshift(Number(e%256n)),e/=256n;while(e);for(;t.length!==3;)t.unshift(0);const[i,s,n]=t,o=`${i}-${s}-${n}`;return{r:i,g:s,b:n,code:o}}increaseColor(){if(this._availableColor===256*256*256){console.warn("Color can't be increased over 256 x 256 x 256!");return}this._availableColor++}decreaseColor(){if(this._availableColor===1){console.warn("Color can't be decreased under 0!");return}this._availableColor--}applySettings(e){e&&(e.updateInterval!==void 0&&(this.updateInterval=e.updateInterval),e.height!==void 0&&(this._height=e.height),e.width!==void 0&&(this._width=e.width),e.autoUpdate!==void 0&&(this.autoUpdate=e.autoUpdate))}}class Uc extends Dc{constructor(t,i,s){super(t,i,s);y(this,"onViewUpdated",new K);y(this,"threshold",100);y(this,"colorMeshes",new Map);y(this,"isProcessing",!1);y(this,"_colorCodeMeshMap",new Map);y(this,"_meshIDColorCodeMap",new Map);y(this,"_currentVisibleMeshes",new Set);y(this,"_recentlyHiddenMeshes",new Set);y(this,"_intervalID",null);y(this,"_transparentMat",new D.MeshBasicMaterial({transparent:!0,opacity:0}));y(this,"handleWorkerMessage",async t=>{if(this.isProcessing)return;const i=t.data.colors;this._recentlyHiddenMeshes=new Set(this._currentVisibleMeshes),this._currentVisibleMeshes.clear();for(const[s,n]of i){if(n<this.threshold)continue;const o=this._colorCodeMeshMap.get(s);o&&(this._currentVisibleMeshes.add(o),this._recentlyHiddenMeshes.delete(o))}this.onViewUpdated.trigger({seen:this._currentVisibleMeshes,unseen:this._recentlyHiddenMeshes}),this._isWorkerBusy=!1});this.worker.addEventListener("message",this.handleWorkerMessage),this.autoUpdate&&window.setInterval(async()=>{this.isProcessing||await this.updateVisibility()},this.updateInterval),this.onViewUpdated.add(({seen:n,unseen:o})=>{for(const a of n)a.visible=!0;for(const a of o)a.visible=!1})}dispose(){super.dispose(),this._intervalID!==null&&(window.clearInterval(this._intervalID),this._intervalID=null),this._currentVisibleMeshes.clear(),this._recentlyHiddenMeshes.clear(),this._meshIDColorCodeMap.clear(),this._transparentMat.dispose(),this._colorCodeMeshMap.clear();const t=this.components.get(Pe);for(const i in this.colorMeshes){const s=this.colorMeshes.get(i);s&&t.destroy(s,!0)}this.colorMeshes.clear()}add(t){if(!this.enabled)return;if(this.isProcessing){console.log("Culler processing not finished yet.");return}this.isProcessing=!0;const i=t instanceof D.InstancedMesh,{geometry:s,material:n}=t,{colorMaterial:o,code:a}=this.getAvailableMaterial();let l;if(Array.isArray(n)){let d=!0;const u=[];for(const f of n)Vo.isTransparent(f)?u.push(this._transparentMat):(d=!1,u.push(o));if(d){o.dispose(),this.isProcessing=!1;return}l=u}else if(Vo.isTransparent(n)){o.dispose(),this.isProcessing=!1;return}else l=o;this._colorCodeMeshMap.set(a,t),this._meshIDColorCodeMap.set(t.uuid,a);const c=i?t.count:1,h=new D.InstancedMesh(s,l,c);i?h.instanceMatrix=t.instanceMatrix:h.setMatrixAt(0,new D.Matrix4),t.visible=!1,t.updateWorldMatrix(!0,!1),h.applyMatrix4(t.matrixWorld),h.updateMatrix(),this.scene.add(h),this.colorMeshes.set(t.uuid,h),this.increaseColor(),this.isProcessing=!1}remove(t){if(this.isProcessing){console.log("Culler processing not finished yet.");return}this.isProcessing=!0;const i=this.components.get(Pe);this._currentVisibleMeshes.delete(t),this._recentlyHiddenMeshes.delete(t);const s=this.colorMeshes.get(t.uuid),n=this._meshIDColorCodeMap.get(t.uuid);if(!s||!n){this.isProcessing=!1;return}this._colorCodeMeshMap.delete(n),this._meshIDColorCodeMap.delete(t.uuid),this.colorMeshes.delete(t.uuid),s.geometry=void 0,s.material=[],i.destroy(s,!0),this._recentlyHiddenMeshes.delete(t),this._currentVisibleMeshes.delete(t),this.isProcessing=!1}updateInstanced(t){for(const i of t){const s=this.colorMeshes.get(i.uuid);s&&(s.count=i.count)}}getAvailableMaterial(){const{r:t,g:i,b:s,code:n}=this.getAvailableColor(),o=D.ColorManagement.enabled;D.ColorManagement.enabled=!1;const a=new D.Color(`rgb(${t}, ${i}, ${s})`);if(!this.world.renderer)throw new Error("Renderer not found in the world!");const l=this.world.renderer.clippingPlanes,c=new D.MeshBasicMaterial({color:a,clippingPlanes:l,side:D.DoubleSide});return D.ColorManagement.enabled=o,{colorMaterial:c,code:n}}}const Bs=class Bs extends Ot{constructor(t){super(t);y(this,"onDisposed",new K);y(this,"_enabled",!0);y(this,"list",new Map);t.add(Bs.uuid,this)}get enabled(){return this._enabled}set enabled(t){this._enabled=t;for(const[i,s]of this.list)s.enabled=t}create(t,i){if(this.list.has(t.uuid))return this.list.get(t.uuid);const s=new Uc(this.components,t,i);return this.list.set(t.uuid,s),s}delete(t){const i=this.list.get(t.uuid);i&&i.dispose(),this.list.delete(t.uuid)}dispose(){this.enabled=!1,this.onDisposed.trigger(Bs.uuid),this.onDisposed.reset();for(const[t,i]of this.list)i.dispose();this.list.clear()}updateInstanced(t){for(const[,i]of this.list)i.updateInstanced(t)}};y(Bs,"uuid","69f2a50d-c266-44fc-b1bd-fa4d34be89e6");let Qn=Bs;class Ef{constructor(e,t){y(this,"onDisposed",new K);y(this,"onDistanceComputed",new K);y(this,"excludedObjects",new Set);y(this,"enabled",!0);y(this,"renderDebugFrame",!1);y(this,"components");y(this,"scene",new D.Scene);y(this,"camera",new D.OrthographicCamera(-1,1,1,-1,0,1));y(this,"depthMaterial");y(this,"world");y(this,"renderer");y(this,"worker");y(this,"_width",512);y(this,"_height",512);y(this,"_postQuad");y(this,"tempRT");y(this,"resultRT");y(this,"bufferSize");y(this,"_buffer");y(this,"_isWorkerBusy",!1);y(this,"compute",async()=>{if(!this.enabled||this.world.isDisposing||this._isWorkerBusy)return;this._isWorkerBusy=!0,this.world.camera.three.updateMatrix(),this.renderer.setSize(this._width,this._height),this.renderer.setRenderTarget(this.tempRT);const e="visibilityBeforeDistanceCheck";for(const i of this.excludedObjects)i.userData[e]=i.visible,i.visible=!1;this.renderer.render(this.world.scene.three,this.world.camera.three);for(const i of this.excludedObjects)i.userData[e]!==void 0&&(i.visible=i.userData[e]);this.depthMaterial.uniforms.tDiffuse.value=this.tempRT.texture,this.depthMaterial.uniforms.tDepth.value=this.tempRT.depthTexture,this.renderer.setRenderTarget(this.resultRT),this.renderer.render(this.scene,this.camera);const t=this.renderer.getContext();await ma(t,0,0,this._width,this._height,t.RGBA,t.UNSIGNED_BYTE,this._buffer),this.renderer.setRenderTarget(null),this.renderDebugFrame&&this.renderer.render(this.scene,this.camera),this.worker.postMessage({buffer:this._buffer})});y(this,"handleWorkerMessage",e=>{if(!this.enabled||this.world.isDisposing)return;const t=e.data.colors;let i=Number.MAX_VALUE;for(const l of t)l!==0&&l<i&&(i=l);const s=this.world.camera.three||D.OrthographicCamera,o=(i/255-1)*-1*(s.far-s.near),a=Math.min(o,s.far);this.onDistanceComputed.trigger(a),this._isWorkerBusy=!1});if(!t.renderer)throw new Error("The given world must have a renderer!");this.components=e,this.world=t;const i=t.camera.three;this.renderer=new D.WebGLRenderer,this.tempRT=new D.WebGLRenderTarget(this._width,this._height),this.bufferSize=this._width*this._height*4,this._buffer=new Uint8Array(this.bufferSize),this.tempRT.texture.minFilter=D.NearestFilter,this.tempRT.texture.magFilter=D.NearestFilter,this.tempRT.stencilBuffer=!1,this.tempRT.samples=0,this.tempRT.depthTexture=new D.DepthTexture(this._width,this._height),this.tempRT.depthTexture.format=D.DepthFormat,this.tempRT.depthTexture.type=D.UnsignedShortType,this.resultRT=new D.WebGLRenderTarget(this._width,this._height),this.depthMaterial=new D.ShaderMaterial({vertexShader:`
|
|
28
28
|
varying vec2 vUv;
|
|
29
29
|
|
|
30
30
|
void main() {
|
|
@@ -54,7 +54,7 @@ void main() {
|
|
|
54
54
|
gl_FragColor.rgb = 1.0 - vec3( depth );
|
|
55
55
|
gl_FragColor.a = 1.0;
|
|
56
56
|
}
|
|
57
|
-
`,uniforms:{cameraNear:{value:
|
|
57
|
+
`,uniforms:{cameraNear:{value:i.near},cameraFar:{value:i.far},tDiffuse:{value:null},tDepth:{value:null}}});const s=new D.PlaneGeometry(2,2);this._postQuad=new D.Mesh(s,this.depthMaterial),this.scene.add(this._postQuad),this.renderer.clippingPlanes=t.renderer.clippingPlanes;const n=`
|
|
58
58
|
addEventListener("message", (event) => {
|
|
59
59
|
const { buffer } = event.data;
|
|
60
60
|
const colors = new Set();
|
|
@@ -64,7 +64,7 @@ void main() {
|
|
|
64
64
|
}
|
|
65
65
|
postMessage({ colors });
|
|
66
66
|
});
|
|
67
|
-
`,
|
|
67
|
+
`,o=new Blob([n],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(o)),this.worker.addEventListener("message",this.handleWorkerMessage)}dispose(){this.enabled=!1,this.onDistanceComputed.reset(),this.worker.terminate(),this.renderer.forceContextLoss(),this.renderer.dispose(),this.tempRT.dispose(),this.resultRT.dispose();const e=[...this.scene.children];this.excludedObjects.clear();for(const t of e)t.removeFromParent();this._postQuad.geometry.dispose(),this._postQuad.removeFromParent(),this._buffer=null,this.onDisposed.reset()}}class bf extends Pc{constructor(){super(...arguments);y(this,"_distanceRenderer");y(this,"autoBias",!0);y(this,"config",{directionalLight:{color:new D.Color("white"),intensity:1.5,position:new D.Vector3(5,10,3)},ambientLight:{color:new D.Color("white"),intensity:1},shadows:{cascade:1,resolution:512}});y(this,"_lightsWithShadow",new Map);y(this,"_isComputingShadows",!1);y(this,"_shadowsEnabled",!0);y(this,"_bias",0);y(this,"recomputeShadows",t=>{if(!this._shadowsEnabled)return;if(this.autoBias&&(this.bias=t/-1e5),t*=1.5,!this.currentWorld)throw new Error("A world needs to be assigned to the scene before computing shadows!");if(!this._lightsWithShadow.size)throw new Error("No shadows found!");const s=this.currentWorld.camera.three;if(!(s instanceof D.PerspectiveCamera)&&!(s instanceof D.OrthographicCamera))throw new Error("Invalid camera type!");const n=new D.Vector3;s.getWorldDirection(n);let o=t;const a=new D.Vector3;a.copy(this.config.directionalLight.position),a.normalize();for(const[l,c]of this._lightsWithShadow){const h=this.directionalLights.get(c);if(!h)throw new Error("Light not found.");const d=new D.Vector3;d.copy(n);const u=l===this._lightsWithShadow.size-1,f=u?o/2:o*2/3;d.multiplyScalar(f),d.add(s.position);const p=o-f,m=new D.Vector3;m.copy(a),m.multiplyScalar(p),h.target.position.copy(d),h.position.copy(d),h.position.add(m),h.shadow.camera.right=p,h.shadow.camera.left=-p,h.shadow.camera.top=p,h.shadow.camera.bottom=-p,h.shadow.camera.far=p*2,h.shadow.camera.updateProjectionMatrix(),h.shadow.camera.updateMatrix(),u||(o/=3)}this._isComputingShadows=!1})}get bias(){return this._bias}set bias(t){this._bias=t;for(const[,i]of this._lightsWithShadow){const s=this.directionalLights.get(i);s&&(s.shadow.bias=t)}}get shadowsEnabled(){return this._shadowsEnabled}set shadowsEnabled(t){this._shadowsEnabled=t;for(const[,i]of this.directionalLights)i.castShadow=t}get distanceRenderer(){if(!this._distanceRenderer)throw new Error("You must set up this component before accessing the distance renderer!");return this._distanceRenderer}setup(t){if(super.setup(t),this.config={...this.config,...t},this.config.shadows.cascade<=0)throw new Error("Config.shadows.cascade must be a natural number greater than 0!");if(this.config.shadows.cascade>1)throw new Error("Multiple shadows not supported yet!");if(!this.currentWorld)throw new Error("A world needs to be assigned to the scene before setting it up!");for(const[,i]of this.directionalLights)i.target.removeFromParent(),i.removeFromParent(),i.dispose();this.directionalLights.clear(),this._distanceRenderer||(this._distanceRenderer=new Ef(this.components,this.currentWorld),this._distanceRenderer.onDistanceComputed.add(this.recomputeShadows)),this._lightsWithShadow.clear();for(let i=0;i<this.config.shadows.cascade;i++){const s=new D.DirectionalLight;s.intensity=this.config.directionalLight.intensity,s.color=this.config.directionalLight.color,s.position.copy(this.config.directionalLight.position),s.shadow.mapSize.width=this.config.shadows.resolution,s.shadow.mapSize.height=this.config.shadows.resolution,this.three.add(s,s.target),this.directionalLights.set(s.uuid,s),this._lightsWithShadow.set(i,s.uuid),s.castShadow=!0,s.shadow.bias=this._bias}}dispose(){super.dispose(),this._distanceRenderer&&this._distanceRenderer.dispose(),this._lightsWithShadow.clear()}async updateShadows(){this._isComputingShadows||!this._shadowsEnabled||(this._isComputingShadows=!0,await this.distanceRenderer.compute())}}class kc{constructor(e){y(this,"_event");y(this,"_position",new D.Vector2);y(this,"onDisposed",new K);y(this,"updateMouseInfo",e=>{this._event=e});this.dom=e,this.setupEvents(!0)}get position(){if(this._event){const e=this.dom.getBoundingClientRect();this._position.x=this.getPositionX(e,this._event),this._position.y=this.getPositionY(e,this._event)}return this._position}dispose(){this.setupEvents(!1),this.onDisposed.trigger(),this.onDisposed.reset()}getPositionY(e,t){return-((t.clientY-e.top)/(e.bottom-e.top))*2+1}getPositionX(e,t){return(t.clientX-e.left)/(e.right-e.left)*2-1}setupEvents(e){e?this.dom.addEventListener("pointermove",this.updateMouseInfo):this.dom.removeEventListener("pointermove",this.updateMouseInfo)}}class Bc{constructor(e,t){y(this,"enabled",!0);y(this,"components");y(this,"onDisposed",new K);y(this,"mouse");y(this,"three",new D.Raycaster);y(this,"world");const i=t.renderer;if(!i)throw new Error("A renderer is needed for the raycaster to work!");this.world=t,this.mouse=new kc(i.three.domElement),this.components=e}dispose(){this.mouse.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}castRay(e=Array.from(this.world.meshes)){if(!this.world)throw new Error("A world is needed to cast rays!");const t=this.world.camera.three;return this.three.setFromCamera(this.mouse.position,t),this.intersect(e)}castRayFromVector(e,t,i=Array.from(this.world.meshes)){return this.three.set(e,t),this.intersect(i)}intersect(e=Array.from(this.world.meshes)){const t=this.three.intersectObjects(e),i=this.filterClippingPlanes(t);return i.length>0?i[0]:null}filterClippingPlanes(e){if(!this.world.renderer)throw new Error("Renderer not found!");const t=this.world.renderer.three;if(!t.clippingPlanes)return e;const i=t.clippingPlanes;return e.length<=0||!i||(i==null?void 0:i.length)<=0?e:e.filter(s=>i.every(n=>n.distanceToPoint(s.point)>0))}}const yr=class yr extends Ot{constructor(t){super(t);y(this,"enabled",!0);y(this,"list",new Map);y(this,"onDisposed",new K);t.add(yr.uuid,this)}get(t){if(this.list.has(t.uuid))return this.list.get(t.uuid);const i=new Bc(this.components,t);return this.list.set(t.uuid,i),t.onDisposed.add(()=>{this.delete(t)}),i}delete(t){const i=this.list.get(t.uuid);i&&i.dispose(),this.list.delete(t.uuid)}dispose(){for(const[t,i]of this.list)i.dispose();this.list.clear(),this.onDisposed.trigger()}};y(yr,"uuid","d5d8bdf0-db25-4952-b951-b643af207ace");let mi=yr;class zc{constructor(e,t,i){y(this,"onDisposed",new K);y(this,"world");y(this,"components");y(this,"three");y(this,"_fade",3);y(this,"updateZoom",()=>{this.world.camera instanceof Gi&&(this.material.uniforms.uZoom.value=this.world.camera.three.zoom)});this.world=t;const{color:s,size1:n,size2:o,distance:a}=i;this.components=e;const l=new D.PlaneGeometry(2,2,1,1),c=new D.ShaderMaterial({side:D.DoubleSide,uniforms:{uSize1:{value:n},uSize2:{value:o},uColor:{value:s},uDistance:{value:a},uFade:{value:this._fade},uZoom:{value:1}},transparent:!0,vertexShader:`
|
|
68
68
|
|
|
69
69
|
varying vec3 worldPosition;
|
|
70
70
|
|
|
@@ -125,4 +125,2195 @@ void main() {
|
|
|
125
125
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
`,extensions:{derivatives:!0}});this.three=new g.Mesh(a,c),this.three.frustumCulled=!1,t.scene.three.add(this.three),this.setupEvents(!0)}get visible(){return this.three.visible}set visible(s){s?this.world.scene.three.add(this.three):this.three.removeFromParent()}get material(){return this.three.material}get fade(){return this._fade===3}set fade(s){this._fade=s?3:0,this.material.uniforms.uFade.value=this._fade}dispose(){this.setupEvents(!1),this.components.get(_t).destroy(this.three),this.onDisposed.trigger(),this.onDisposed.reset(),this.world=null,this.components=null}setupEvents(s){if(this.world.isDisposing||!(this.world.camera instanceof ce))return;const t=this.world.camera.controls;s?t.addEventListener("update",this.updateZoom):t.removeEventListener("update",this.updateZoom)}}const ms=class ms extends ${constructor(t){super(t);u(this,"list",new Map);u(this,"config",{color:new g.Color(12303291),size1:1,size2:10,distance:500});u(this,"onDisposed",new M);u(this,"enabled",!0);t.add(ms.uuid,this)}create(t){if(this.list.has(t.uuid))throw new Error("This world already has a grid!");const e=new xn(this.components,t,this.config);return this.list.set(t.uuid,e),t.onDisposed.add(()=>{this.delete(t)}),e}delete(t){const e=this.list.get(t.uuid);e&&e.dispose(),this.list.delete(t.uuid)}dispose(){for(const[t,e]of this.list)e.dispose();this.list.clear(),this.onDisposed.trigger(),this.onDisposed.reset()}};u(ms,"uuid","d1e814d5-b81c-4452-87a2-f039375e0489");let fi=ms;const zt=new C.Raycaster,it=new C.Vector3,Nt=new C.Vector3,Q=new C.Quaternion,ln={X:new C.Vector3(1,0,0),Y:new C.Vector3(0,1,0),Z:new C.Vector3(0,0,1)},si={type:"change"},hn={type:"mouseDown"},dn={type:"mouseUp",mode:null},En={type:"objectChange"};class Or extends C.Object3D{constructor(s,t){super(),t===void 0&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),t=document),this.isTransformControls=!0,this.visible=!1,this.domElement=t,this.domElement.style.touchAction="none";const e=new Pr;this._gizmo=e,this.add(e);const i=new wr;this._plane=i,this.add(i);const o=this;function n(A,O){let p=O;Object.defineProperty(o,A,{get:function(){return p!==void 0?p:O},set:function(R){p!==R&&(p=R,i[A]=R,e[A]=R,o.dispatchEvent({type:A+"-changed",value:R}),o.dispatchEvent(si))}}),o[A]=O,i[A]=O,e[A]=O}n("camera",s),n("object",void 0),n("enabled",!0),n("axis",null),n("mode","translate"),n("translationSnap",null),n("rotationSnap",null),n("scaleSnap",null),n("space","world"),n("size",1),n("dragging",!1),n("showX",!0),n("showY",!0),n("showZ",!0);const r=new C.Vector3,a=new C.Vector3,c=new C.Quaternion,h=new C.Quaternion,E=new C.Vector3,d=new C.Quaternion,I=new C.Vector3,f=new C.Vector3,T=new C.Vector3,F=0,m=new C.Vector3;n("worldPosition",r),n("worldPositionStart",a),n("worldQuaternion",c),n("worldQuaternionStart",h),n("cameraPosition",E),n("cameraQuaternion",d),n("pointStart",I),n("pointEnd",f),n("rotationAxis",T),n("rotationAngle",F),n("eye",m),this._offset=new C.Vector3,this._startNorm=new C.Vector3,this._endNorm=new C.Vector3,this._cameraScale=new C.Vector3,this._parentPosition=new C.Vector3,this._parentQuaternion=new C.Quaternion,this._parentQuaternionInv=new C.Quaternion,this._parentScale=new C.Vector3,this._worldScaleStart=new C.Vector3,this._worldQuaternionInv=new C.Quaternion,this._worldScale=new C.Vector3,this._positionStart=new C.Vector3,this._quaternionStart=new C.Quaternion,this._scaleStart=new C.Vector3,this._getPointer=Sr.bind(this),this._onPointerDown=yr.bind(this),this._onPointerHover=_r.bind(this),this._onPointerMove=Nr.bind(this),this._onPointerUp=Lr.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(){this.object!==void 0&&(this.object.updateMatrixWorld(),this.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld(this)}pointerHover(s){if(this.object===void 0||this.dragging===!0)return;zt.setFromCamera(s,this.camera);const t=ii(this._gizmo.picker[this.mode],zt);t?this.axis=t.object.name:this.axis=null}pointerDown(s){if(!(this.object===void 0||this.dragging===!0||s.button!==0)&&this.axis!==null){zt.setFromCamera(s,this.camera);const t=ii(this._plane,zt,!0);t&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(t.point).sub(this.worldPositionStart)),this.dragging=!0,hn.mode=this.mode,this.dispatchEvent(hn)}}pointerMove(s){const t=this.axis,e=this.mode,i=this.object;let o=this.space;if(e==="scale"?o="local":(t==="E"||t==="XYZE"||t==="XYZ")&&(o="world"),i===void 0||t===null||this.dragging===!1||s.button!==-1)return;zt.setFromCamera(s,this.camera);const n=ii(this._plane,zt,!0);if(n){if(this.pointEnd.copy(n.point).sub(this.worldPositionStart),e==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),o==="local"&&t!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),t.indexOf("X")===-1&&(this._offset.x=0),t.indexOf("Y")===-1&&(this._offset.y=0),t.indexOf("Z")===-1&&(this._offset.z=0),o==="local"&&t!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),i.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(o==="local"&&(i.position.applyQuaternion(Q.copy(this._quaternionStart).invert()),t.search("X")!==-1&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.position.applyQuaternion(this._quaternionStart)),o==="world"&&(i.parent&&i.position.add(it.setFromMatrixPosition(i.parent.matrixWorld)),t.search("X")!==-1&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.parent&&i.position.sub(it.setFromMatrixPosition(i.parent.matrixWorld))));else if(e==="scale"){if(t.search("XYZ")!==-1){let r=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(r*=-1),Nt.set(r,r,r)}else it.copy(this.pointStart),Nt.copy(this.pointEnd),it.applyQuaternion(this._worldQuaternionInv),Nt.applyQuaternion(this._worldQuaternionInv),Nt.divide(it),t.search("X")===-1&&(Nt.x=1),t.search("Y")===-1&&(Nt.y=1),t.search("Z")===-1&&(Nt.z=1);i.scale.copy(this._scaleStart).multiply(Nt),this.scaleSnap&&(t.search("X")!==-1&&(i.scale.x=Math.round(i.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Y")!==-1&&(i.scale.y=Math.round(i.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Z")!==-1&&(i.scale.z=Math.round(i.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(e==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const r=20/this.worldPosition.distanceTo(it.setFromMatrixPosition(this.camera.matrixWorld));let a=!1;t==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(it.copy(this.rotationAxis).cross(this.eye))*r):(t==="X"||t==="Y"||t==="Z")&&(this.rotationAxis.copy(ln[t]),it.copy(ln[t]),o==="local"&&it.applyQuaternion(this.worldQuaternion),it.cross(this.eye),it.length()===0?a=!0:this.rotationAngle=this._offset.dot(it.normalize())*r),(t==="E"||a)&&(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),o==="local"&&t!=="E"&&t!=="XYZE"?(i.quaternion.copy(this._quaternionStart),i.quaternion.multiply(Q.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),i.quaternion.copy(Q.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),i.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(si),this.dispatchEvent(En)}}pointerUp(s){s.button===0&&(this.dragging&&this.axis!==null&&(dn.mode=this.mode,this.dispatchEvent(dn)),this.dragging=!1,this.axis=null)}dispose(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse(function(s){s.geometry&&s.geometry.dispose(),s.material&&s.material.dispose()})}attach(s){return this.object=s,this.visible=!0,this}detach(){return this.object=void 0,this.visible=!1,this.axis=null,this}reset(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(si),this.dispatchEvent(En),this.pointStart.copy(this.pointEnd))}getRaycaster(){return zt}getMode(){return this.mode}setMode(s){this.mode=s}setTranslationSnap(s){this.translationSnap=s}setRotationSnap(s){this.rotationSnap=s}setScaleSnap(s){this.scaleSnap=s}setSize(s){this.size=s}setSpace(s){this.space=s}}function Sr(l){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:l.button};{const s=this.domElement.getBoundingClientRect();return{x:(l.clientX-s.left)/s.width*2-1,y:-(l.clientY-s.top)/s.height*2+1,button:l.button}}}function _r(l){if(this.enabled)switch(l.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(l));break}}function yr(l){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(l.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(l)),this.pointerDown(this._getPointer(l)))}function Nr(l){this.enabled&&this.pointerMove(this._getPointer(l))}function Lr(l){this.enabled&&(this.domElement.releasePointerCapture(l.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(l)))}function ii(l,s,t){const e=s.intersectObject(l,!0);for(let i=0;i<e.length;i++)if(e[i].object.visible||t)return e[i];return!1}const is=new C.Euler,W=new C.Vector3(0,1,0),un=new C.Vector3(0,0,0),In=new C.Matrix4,ns=new C.Quaternion,cs=new C.Quaternion,At=new C.Vector3,fn=new C.Matrix4,_e=new C.Vector3(1,0,0),Ht=new C.Vector3(0,1,0),ye=new C.Vector3(0,0,1),os=new C.Vector3,Oe=new C.Vector3,Se=new C.Vector3;class Pr extends C.Object3D{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const s=new C.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),t=new C.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),e=s.clone();e.opacity=.15;const i=t.clone();i.opacity=.5;const o=s.clone();o.color.setHex(16711680);const n=s.clone();n.color.setHex(65280);const r=s.clone();r.color.setHex(255);const a=s.clone();a.color.setHex(16711680),a.opacity=.5;const c=s.clone();c.color.setHex(65280),c.opacity=.5;const h=s.clone();h.color.setHex(255),h.opacity=.5;const E=s.clone();E.opacity=.25;const d=s.clone();d.color.setHex(16776960),d.opacity=.25,s.clone().color.setHex(16776960);const f=s.clone();f.color.setHex(7895160);const T=new C.CylinderGeometry(0,.04,.1,12);T.translate(0,.05,0);const F=new C.BoxGeometry(.08,.08,.08);F.translate(0,.04,0);const m=new C.BufferGeometry;m.setAttribute("position",new C.Float32BufferAttribute([0,0,0,1,0,0],3));const A=new C.CylinderGeometry(.0075,.0075,.5,3);A.translate(0,.25,0);function O(v,z){const j=new C.TorusGeometry(v,.0075,3,64,z*Math.PI*2);return j.rotateY(Math.PI/2),j.rotateX(Math.PI/2),j}function p(){const v=new C.BufferGeometry;return v.setAttribute("position",new C.Float32BufferAttribute([0,0,0,1,1,1],3)),v}const R={X:[[new C.Mesh(T,o),[.5,0,0],[0,0,-Math.PI/2]],[new C.Mesh(T,o),[-.5,0,0],[0,0,Math.PI/2]],[new C.Mesh(A,o),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new C.Mesh(T,n),[0,.5,0]],[new C.Mesh(T,n),[0,-.5,0],[Math.PI,0,0]],[new C.Mesh(A,n)]],Z:[[new C.Mesh(T,r),[0,0,.5],[Math.PI/2,0,0]],[new C.Mesh(T,r),[0,0,-.5],[-Math.PI/2,0,0]],[new C.Mesh(A,r),null,[Math.PI/2,0,0]]],XYZ:[[new C.Mesh(new C.OctahedronGeometry(.1,0),E.clone()),[0,0,0]]],XY:[[new C.Mesh(new C.BoxGeometry(.15,.15,.01),h.clone()),[.15,.15,0]]],YZ:[[new C.Mesh(new C.BoxGeometry(.15,.15,.01),a.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new C.Mesh(new C.BoxGeometry(.15,.15,.01),c.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},S={X:[[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[.3,0,0],[0,0,-Math.PI/2]],[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[0,.3,0]],[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[0,-.3,0],[0,0,Math.PI]]],Z:[[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[0,0,.3],[Math.PI/2,0,0]],[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new C.Mesh(new C.OctahedronGeometry(.2,0),e)]],XY:[[new C.Mesh(new C.BoxGeometry(.2,.2,.01),e),[.15,.15,0]]],YZ:[[new C.Mesh(new C.BoxGeometry(.2,.2,.01),e),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new C.Mesh(new C.BoxGeometry(.2,.2,.01),e),[.15,0,.15],[-Math.PI/2,0,0]]]},_={START:[[new C.Mesh(new C.OctahedronGeometry(.01,2),i),null,null,null,"helper"]],END:[[new C.Mesh(new C.OctahedronGeometry(.01,2),i),null,null,null,"helper"]],DELTA:[[new C.Line(p(),i),null,null,null,"helper"]],X:[[new C.Line(m,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new C.Line(m,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new C.Line(m,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},y={XYZE:[[new C.Mesh(O(.5,1),f),null,[0,Math.PI/2,0]]],X:[[new C.Mesh(O(.5,.5),o)]],Y:[[new C.Mesh(O(.5,.5),n),null,[0,0,-Math.PI/2]]],Z:[[new C.Mesh(O(.5,.5),r),null,[0,Math.PI/2,0]]],E:[[new C.Mesh(O(.75,1),d),null,[0,Math.PI/2,0]]]},N={AXIS:[[new C.Line(m,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},P={XYZE:[[new C.Mesh(new C.SphereGeometry(.25,10,8),e)]],X:[[new C.Mesh(new C.TorusGeometry(.5,.1,4,24),e),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new C.Mesh(new C.TorusGeometry(.5,.1,4,24),e),[0,0,0],[Math.PI/2,0,0]]],Z:[[new C.Mesh(new C.TorusGeometry(.5,.1,4,24),e),[0,0,0],[0,0,-Math.PI/2]]],E:[[new C.Mesh(new C.TorusGeometry(.75,.1,2,24),e)]]},x={X:[[new C.Mesh(F,o),[.5,0,0],[0,0,-Math.PI/2]],[new C.Mesh(A,o),[0,0,0],[0,0,-Math.PI/2]],[new C.Mesh(F,o),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new C.Mesh(F,n),[0,.5,0]],[new C.Mesh(A,n)],[new C.Mesh(F,n),[0,-.5,0],[0,0,Math.PI]]],Z:[[new C.Mesh(F,r),[0,0,.5],[Math.PI/2,0,0]],[new C.Mesh(A,r),[0,0,0],[Math.PI/2,0,0]],[new C.Mesh(F,r),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new C.Mesh(new C.BoxGeometry(.15,.15,.01),h),[.15,.15,0]]],YZ:[[new C.Mesh(new C.BoxGeometry(.15,.15,.01),a),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new C.Mesh(new C.BoxGeometry(.15,.15,.01),c),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new C.Mesh(new C.BoxGeometry(.1,.1,.1),E.clone())]]},w={X:[[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[.3,0,0],[0,0,-Math.PI/2]],[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[0,.3,0]],[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[0,-.3,0],[0,0,Math.PI]]],Z:[[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[0,0,.3],[Math.PI/2,0,0]],[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new C.Mesh(new C.BoxGeometry(.2,.2,.01),e),[.15,.15,0]]],YZ:[[new C.Mesh(new C.BoxGeometry(.2,.2,.01),e),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new C.Mesh(new C.BoxGeometry(.2,.2,.01),e),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new C.Mesh(new C.BoxGeometry(.2,.2,.2),e),[0,0,0]]]},U={X:[[new C.Line(m,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new C.Line(m,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new C.Line(m,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function b(v){const z=new C.Object3D;for(const j in v)for(let et=v[j].length;et--;){const Z=v[j][et][0].clone(),bt=v[j][et][1],vt=v[j][et][2],Bt=v[j][et][3],Ue=v[j][et][4];Z.name=j,Z.tag=Ue,bt&&Z.position.set(bt[0],bt[1],bt[2]),vt&&Z.rotation.set(vt[0],vt[1],vt[2]),Bt&&Z.scale.set(Bt[0],Bt[1],Bt[2]),Z.updateMatrix();const de=Z.geometry.clone();de.applyMatrix4(Z.matrix),Z.geometry=de,Z.renderOrder=1/0,Z.position.set(0,0,0),Z.rotation.set(0,0,0),Z.scale.set(1,1,1),z.add(Z)}return z}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=b(R)),this.add(this.gizmo.rotate=b(y)),this.add(this.gizmo.scale=b(x)),this.add(this.picker.translate=b(S)),this.add(this.picker.rotate=b(P)),this.add(this.picker.scale=b(w)),this.add(this.helper.translate=b(_)),this.add(this.helper.rotate=b(N)),this.add(this.helper.scale=b(U)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(s){const e=(this.mode==="scale"?"local":this.space)==="local"?this.worldQuaternion:cs;this.gizmo.translate.visible=this.mode==="translate",this.gizmo.rotate.visible=this.mode==="rotate",this.gizmo.scale.visible=this.mode==="scale",this.helper.translate.visible=this.mode==="translate",this.helper.rotate.visible=this.mode==="rotate",this.helper.scale.visible=this.mode==="scale";let i=[];i=i.concat(this.picker[this.mode].children),i=i.concat(this.gizmo[this.mode].children),i=i.concat(this.helper[this.mode].children);for(let o=0;o<i.length;o++){const n=i[o];n.visible=!0,n.rotation.set(0,0,0),n.position.copy(this.worldPosition);let r;if(this.camera.isOrthographicCamera?r=(this.camera.top-this.camera.bottom)/this.camera.zoom:r=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),n.scale.set(1,1,1).multiplyScalar(r*this.size/4),n.tag==="helper"){n.visible=!1,n.name==="AXIS"?(n.visible=!!this.axis,this.axis==="X"&&(Q.setFromEuler(is.set(0,0,0)),n.quaternion.copy(e).multiply(Q),Math.abs(W.copy(_e).applyQuaternion(e).dot(this.eye))>.9&&(n.visible=!1)),this.axis==="Y"&&(Q.setFromEuler(is.set(0,0,Math.PI/2)),n.quaternion.copy(e).multiply(Q),Math.abs(W.copy(Ht).applyQuaternion(e).dot(this.eye))>.9&&(n.visible=!1)),this.axis==="Z"&&(Q.setFromEuler(is.set(0,Math.PI/2,0)),n.quaternion.copy(e).multiply(Q),Math.abs(W.copy(ye).applyQuaternion(e).dot(this.eye))>.9&&(n.visible=!1)),this.axis==="XYZE"&&(Q.setFromEuler(is.set(0,Math.PI/2,0)),W.copy(this.rotationAxis),n.quaternion.setFromRotationMatrix(In.lookAt(un,W,Ht)),n.quaternion.multiply(Q),n.visible=this.dragging),this.axis==="E"&&(n.visible=!1)):n.name==="START"?(n.position.copy(this.worldPositionStart),n.visible=this.dragging):n.name==="END"?(n.position.copy(this.worldPosition),n.visible=this.dragging):n.name==="DELTA"?(n.position.copy(this.worldPositionStart),n.quaternion.copy(this.worldQuaternionStart),it.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),it.applyQuaternion(this.worldQuaternionStart.clone().invert()),n.scale.copy(it),n.visible=this.dragging):(n.quaternion.copy(e),this.dragging?n.position.copy(this.worldPositionStart):n.position.copy(this.worldPosition),this.axis&&(n.visible=this.axis.search(n.name)!==-1));continue}n.quaternion.copy(e),this.mode==="translate"||this.mode==="scale"?(n.name==="X"&&Math.abs(W.copy(_e).applyQuaternion(e).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="Y"&&Math.abs(W.copy(Ht).applyQuaternion(e).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="Z"&&Math.abs(W.copy(ye).applyQuaternion(e).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="XY"&&Math.abs(W.copy(ye).applyQuaternion(e).dot(this.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="YZ"&&Math.abs(W.copy(_e).applyQuaternion(e).dot(this.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="XZ"&&Math.abs(W.copy(Ht).applyQuaternion(e).dot(this.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1)):this.mode==="rotate"&&(ns.copy(e),W.copy(this.eye).applyQuaternion(Q.copy(e).invert()),n.name.search("E")!==-1&&n.quaternion.setFromRotationMatrix(In.lookAt(this.eye,un,Ht)),n.name==="X"&&(Q.setFromAxisAngle(_e,Math.atan2(-W.y,W.z)),Q.multiplyQuaternions(ns,Q),n.quaternion.copy(Q)),n.name==="Y"&&(Q.setFromAxisAngle(Ht,Math.atan2(W.x,W.z)),Q.multiplyQuaternions(ns,Q),n.quaternion.copy(Q)),n.name==="Z"&&(Q.setFromAxisAngle(ye,Math.atan2(W.y,W.x)),Q.multiplyQuaternions(ns,Q),n.quaternion.copy(Q))),n.visible=n.visible&&(n.name.indexOf("X")===-1||this.showX),n.visible=n.visible&&(n.name.indexOf("Y")===-1||this.showY),n.visible=n.visible&&(n.name.indexOf("Z")===-1||this.showZ),n.visible=n.visible&&(n.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),n.material._color=n.material._color||n.material.color.clone(),n.material._opacity=n.material._opacity||n.material.opacity,n.material.color.copy(n.material._color),n.material.opacity=n.material._opacity,this.enabled&&this.axis&&(n.name===this.axis||this.axis.split("").some(function(a){return n.name===a}))&&(n.material.color.setHex(16776960),n.material.opacity=1)}super.updateMatrixWorld(s)}}class wr extends C.Mesh{constructor(){super(new C.PlaneGeometry(1e5,1e5,2,2),new C.MeshBasicMaterial({visible:!1,wireframe:!0,side:C.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(s){let t=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(t="local"),os.copy(_e).applyQuaternion(t==="local"?this.worldQuaternion:cs),Oe.copy(Ht).applyQuaternion(t==="local"?this.worldQuaternion:cs),Se.copy(ye).applyQuaternion(t==="local"?this.worldQuaternion:cs),W.copy(Oe),this.mode){case"translate":case"scale":switch(this.axis){case"X":W.copy(this.eye).cross(os),At.copy(os).cross(W);break;case"Y":W.copy(this.eye).cross(Oe),At.copy(Oe).cross(W);break;case"Z":W.copy(this.eye).cross(Se),At.copy(Se).cross(W);break;case"XY":At.copy(Se);break;case"YZ":At.copy(os);break;case"XZ":W.copy(Se),At.copy(Oe);break;case"XYZ":case"E":At.set(0,0,0);break}break;case"rotate":default:At.set(0,0,0)}At.length()===0?this.quaternion.copy(this.cameraQuaternion):(fn.lookAt(it.set(0,0,0),At,W),this.quaternion.setFromRotationMatrix(fn)),super.updateMatrixWorld(s)}}class Ms{constructor(s,t,e,i,o,n=5,r=!0){u(this,"onDraggingStarted",new M);u(this,"onDraggingEnded",new M);u(this,"onDisposed",new M);u(this,"normal");u(this,"origin");u(this,"three",new g.Plane);u(this,"components");u(this,"world");u(this,"type","default");u(this,"_helper");u(this,"_visible",!0);u(this,"_enabled",!0);u(this,"_controlsActive",!1);u(this,"_arrowBoundBox",new g.Mesh);u(this,"_planeMesh");u(this,"_controls");u(this,"_hiddenMaterial",new g.MeshBasicMaterial({visible:!1}));u(this,"update",()=>{this._enabled&&this.three.setFromNormalAndCoplanarPoint(this.normal,this._helper.position)});u(this,"changeDrag",s=>{this._visible=!s.value,this.preventCameraMovement(),this.notifyDraggingChanged(s)});if(this.components=s,this.world=t,!t.renderer)throw new Error("The given world must have a renderer!");this.normal=i,this.origin=e,t.renderer.setPlane(!0,this.three),this._planeMesh=Ms.newPlaneMesh(n,o),this._helper=this.newHelper(),this._controls=this.newTransformControls(),this.three.setFromNormalAndCoplanarPoint(i,e),r&&this.toggleControls(!0)}get enabled(){return this._enabled}set enabled(s){if(!this.world.renderer)throw new Error("No renderer found for clipping plane!");this._enabled=s,this.world.renderer.setPlane(s,this.three)}get visible(){return this._visible}set visible(s){this._visible=s,this._controls.visible=s,this._helper.visible=s,this.toggleControls(s)}get meshes(){return[this._planeMesh,this._arrowBoundBox]}get planeMaterial(){return this._planeMesh.material}set planeMaterial(s){this._planeMesh.material=s}get size(){return this._planeMesh.scale.x}set size(s){this._planeMesh.scale.set(s,s,s)}get helper(){return this._helper}setFromNormalAndCoplanarPoint(s,t){this.reset(),this.normal.equals(s)||(this.normal.copy(s),this._helper.lookAt(s)),this.origin.copy(t),this._helper.position.copy(t),this._helper.updateMatrix(),this.update()}dispose(){this._enabled=!1,this.onDraggingStarted.reset(),this.onDraggingEnded.reset(),this._helper.removeFromParent(),this.world.renderer&&this.world.renderer.setPlane(!1,this.three),this._arrowBoundBox.removeFromParent(),this._arrowBoundBox.geometry.dispose(),this._planeMesh.geometry.dispose(),this._controls.removeFromParent(),this._controls.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}reset(){const s=new g.Vector3(1,0,0),t=new g.Vector3;this.normal.equals(s)||(this.normal.copy(s),this._helper.lookAt(s)),this.origin.copy(t),this._helper.position.copy(t),this._helper.updateMatrix()}toggleControls(s){if(s){if(this._controlsActive)return;this._controls.addEventListener("change",this.update),this._controls.addEventListener("dragging-changed",this.changeDrag)}else this._controls.removeEventListener("change",this.update),this._controls.removeEventListener("dragging-changed",this.changeDrag);this._controlsActive=s}newTransformControls(){if(!this.world.renderer)throw new Error("No renderer found for clipping plane!");const s=this.world.camera.three,t=this.world.renderer.three.domElement,e=new Or(s,t);return this.initializeControls(e),this.world.scene.three.add(e),e}initializeControls(s){s.attach(this._helper),s.showX=!1,s.showY=!1,s.setSpace("local"),this.createArrowBoundingBox(),s.children[0].children[0].add(this._arrowBoundBox)}createArrowBoundingBox(){this._arrowBoundBox.geometry=new g.CylinderGeometry(.18,.18,1.2),this._arrowBoundBox.material=this._hiddenMaterial,this._arrowBoundBox.rotateX(Math.PI/2),this._arrowBoundBox.updateMatrix(),this._arrowBoundBox.geometry.applyMatrix4(this._arrowBoundBox.matrix)}notifyDraggingChanged(s){s.value?this.onDraggingStarted.trigger():this.onDraggingEnded.trigger()}preventCameraMovement(){this.world.camera.enabled=this._visible}newHelper(){const s=new g.Object3D;return s.lookAt(this.normal),s.position.copy(this.origin),this._planeMesh.position.z+=.01,s.add(this._planeMesh),this.world.scene.three.add(s),s}static newPlaneMesh(s,t){const e=new g.PlaneGeometry(1),i=new g.Mesh(e,t);return i.scale.set(s,s,s),i}}const Me=class Me extends ${constructor(t){super(t);u(this,"onBeforeDrag",new M);u(this,"onAfterDrag",new M);u(this,"onBeforeCreate",new M);u(this,"onBeforeCancel",new M);u(this,"onAfterCancel",new M);u(this,"onBeforeDelete",new M);u(this,"onAfterCreate",new M);u(this,"onAfterDelete",new M);u(this,"onDisposed",new M);u(this,"orthogonalY",!1);u(this,"toleranceOrthogonalY",.7);u(this,"Type",Ms);u(this,"list",[]);u(this,"_material",new g.MeshBasicMaterial({color:12255487,side:g.DoubleSide,transparent:!0,opacity:.2}));u(this,"_size",5);u(this,"_enabled",!1);u(this,"_visible",!0);u(this,"_onStartDragging",()=>{this.onBeforeDrag.trigger()});u(this,"_onEndDragging",()=>{this.onAfterDrag.trigger()});this.components.add(Me.uuid,this)}get enabled(){return this._enabled}set enabled(t){this._enabled=t;for(const e of this.list)e.enabled=t;this.updateMaterialsAndPlanes()}get visible(){return this._visible}set visible(t){this._visible=t;for(const e of this.list)e.visible=t}get material(){return this._material}set material(t){this._material=t;for(const e of this.list)e.planeMaterial=t}get size(){return this._size}set size(t){this._size=t;for(const e of this.list)e.size=t}dispose(){this._enabled=!1;for(const t of this.list)t.dispose();this.list.length=0,this._material.dispose(),this.onBeforeCreate.reset(),this.onBeforeCancel.reset(),this.onBeforeDelete.reset(),this.onBeforeDrag.reset(),this.onAfterCreate.reset(),this.onAfterCancel.reset(),this.onAfterDelete.reset(),this.onAfterDrag.reset(),this.onDisposed.trigger(Me.uuid),this.onDisposed.reset()}create(t){const o=this.components.get(le).get(t).castRay();return o?this.createPlaneFromIntersection(t,o):null}createFromNormalAndCoplanarPoint(t,e,i){const o=this.newPlane(t,i,e);return this.updateMaterialsAndPlanes(),o}delete(t,e){e||(e=this.pickPlane(t)),e&&this.deletePlane(e)}deleteAll(t){const e=[...this.list];for(const i of e)if(!t||t.has(i.type)){this.delete(i.world,i);const o=this.list.indexOf(i);o!==-1&&this.list.splice(o,1)}}deletePlane(t){const e=this.list.indexOf(t);if(e!==-1){if(this.list.splice(e,1),!t.world.renderer)throw new Error("Renderer not found for this plane's world!");t.world.renderer.setPlane(!1,t.three),t.dispose(),this.updateMaterialsAndPlanes(),this.onAfterDelete.trigger(t)}}pickPlane(t){const i=this.components.get(le).get(t),o=this.getAllPlaneMeshes(),n=i.castRay(o);if(n){const r=n.object;return this.list.find(a=>a.meshes.includes(r))}}getAllPlaneMeshes(){const t=[];for(const e of this.list)t.push(...e.meshes);return t}createPlaneFromIntersection(t,e){var a;if(!t.renderer)throw new Error("The given world must have a renderer!");const i=e.point.distanceTo(new g.Vector3(0,0,0)),o=(a=e.face)==null?void 0:a.normal;if(!i||!o)return null;const n=this.getWorldNormal(e,o),r=this.newPlane(t,e.point,n.negate());return r.visible=this._visible,r.size=this._size,t.renderer.setPlane(!0,r.three),this.updateMaterialsAndPlanes(),r}getWorldNormal(t,e){const i=t.object;let o=t.object.matrixWorld.clone();if(i instanceof g.InstancedMesh&&t.instanceId!==void 0){const c=new g.Matrix4;i.getMatrixAt(t.instanceId,c),o=c.multiply(o)}const r=new g.Matrix3().getNormalMatrix(o),a=e.clone().applyMatrix3(r).normalize();return this.normalizePlaneDirectionY(a),a}normalizePlaneDirectionY(t){this.orthogonalY&&(t.y>this.toleranceOrthogonalY&&(t.x=0,t.y=1,t.z=0),t.y<-this.toleranceOrthogonalY&&(t.x=0,t.y=-1,t.z=0))}newPlane(t,e,i){const o=new this.Type(this.components,t,e,i,this._material);return o.onDraggingStarted.add(this._onStartDragging),o.onDraggingEnded.add(this._onEndDragging),this.list.push(o),this.onAfterCreate.trigger(o),o}updateMaterialsAndPlanes(){const t=this.components.get(ds);for(const[e,i]of t.list){if(!i.renderer)continue;i.renderer.updateClippingPlanes();const{clippingPlanes:o}=i.renderer;for(const n of i.meshes)if(n.material)if(Array.isArray(n.material))for(const r of n.material)r.clippingPlanes=o;else n.material.clippingPlanes=o}}};u(Me,"uuid","66290bc5-18c4-4cd1-9379-2e17a0617611");let pi=Me;class Un{constructor(s){u(this,"onDisposed",new M);u(this,"onAfterUpdate",new M);u(this,"onBeforeUpdate",new M);u(this,"onResize",new M);u(this,"frontOffset",0);u(this,"overrideMaterial",new g.MeshDepthMaterial);u(this,"backgroundColor",new g.Color(395274));u(this,"renderer");u(this,"enabled",!0);u(this,"world");u(this,"_lockRotation",!0);u(this,"_camera");u(this,"_plane");u(this,"_size",new g.Vector2(320,160));u(this,"_tempVector1",new g.Vector3);u(this,"_tempVector2",new g.Vector3);u(this,"_tempTarget",new g.Vector3);u(this,"down",new g.Vector3(0,-1,0));u(this,"updatePlanes",()=>{if(!this.world.renderer)throw new Error("The given world must have a renderer!");const s=[],t=this.world.renderer.three;for(const e of t.clippingPlanes)s.push(e);s.push(this._plane),this.renderer.clippingPlanes=s});if(this.world=s,!this.world.renderer)throw new Error("The given world must have a renderer!");this.renderer=new g.WebGLRenderer,this.renderer.setSize(this._size.x,this._size.y);const t=1,e=this._size.x/this._size.y;this._camera=new g.OrthographicCamera(t*e/-2,t*e/2,t/2,t/-2),this.world.renderer.onClippingPlanesUpdated.add(this.updatePlanes),this._camera.position.set(0,200,0),this._camera.zoom=.1,this._camera.rotation.x=-Math.PI/2,this._plane=new g.Plane(this.down,200),this.updatePlanes()}get lockRotation(){return this._lockRotation}set lockRotation(s){this._lockRotation=s,s&&(this._camera.rotation.z=0)}get zoom(){return this._camera.zoom}set zoom(s){this._camera.zoom=s,this._camera.updateProjectionMatrix()}dispose(){this.enabled=!1,this.onBeforeUpdate.reset(),this.onAfterUpdate.reset(),this.onResize.reset(),this.overrideMaterial.dispose(),this.renderer.forceContextLoss(),this.renderer.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}get(){return this._camera}update(){if(!this.enabled)return;this.onBeforeUpdate.trigger();const s=this.world.scene.three,t=this.world.camera;if(!t.hasCameraControls())throw new Error("The given world must use camera controls!");if(!(s instanceof g.Scene))throw new Error("The given world must have a THREE.Scene as a root!");const e=t.controls;if(e.getPosition(this._tempVector1),this._camera.position.x=this._tempVector1.x,this._camera.position.z=this._tempVector1.z,this.frontOffset!==0&&(e.getTarget(this._tempVector2),this._tempVector2.sub(this._tempVector1),this._tempVector2.normalize().multiplyScalar(this.frontOffset),this._camera.position.x+=this._tempVector2.x,this._camera.position.z+=this._tempVector2.z),!this._lockRotation){e.getTarget(this._tempTarget);const o=Math.atan2(this._tempTarget.x-this._tempVector1.x,this._tempTarget.z-this._tempVector1.z);this._camera.rotation.z=o+Math.PI}this._plane.set(this.down,this._tempVector1.y);const i=s.background;s.background=this.backgroundColor,this.renderer.render(s,this._camera),s.background=i,this.onAfterUpdate.trigger()}getSize(){return this._size}resize(s=this._size){this._size.copy(s),this.renderer.setSize(s.x,s.y);const t=s.x/s.y,e=1;this._camera.left=e*t/-2,this._camera.right=e*t/2,this._camera.top=e/2,this._camera.bottom=-e/2,this._camera.updateProjectionMatrix(),this.onResize.trigger(s)}}const Rs=class Rs extends ${constructor(t){super(t);u(this,"onAfterUpdate",new M);u(this,"onBeforeUpdate",new M);u(this,"onDisposed",new M);u(this,"enabled",!0);u(this,"list",new Map);this.components.add(Rs.uuid,this)}create(t){if(this.list.has(t.uuid))throw new Error("This world already has a minimap!");const e=new Un(t);return this.list.set(t.uuid,e),e}delete(t){const e=this.list.get(t);e&&e.dispose(),this.list.delete(t)}dispose(){for(const[t,e]of this.list)e.dispose();this.list.clear(),this.onDisposed.trigger()}update(){for(const[t,e]of this.list)e.update()}};u(Rs,"uuid","39ad6aad-84c8-4adf-a1e0-7f25313a9e7f");let Ci=Rs;class bn{constructor(s){u(this,"enabled",!1);u(this,"id","FirstPerson");this.camera=s}set(s){if(this.enabled=s,s){if(this.camera.projection.current!=="Perspective"){this.camera.set("Orbit");return}this.setupFirstPersonCamera()}}setupFirstPersonCamera(){const s=this.camera.controls,t=new g.Vector3;s.distance--,s.getPosition(t),s.minDistance=1,s.maxDistance=1,s.distance=1,s.moveTo(t.x,t.y,t.z),s.truckSpeed=50,s.mouseButtons.wheel=nt.ACTION.DOLLY,s.touches.two=nt.ACTION.TOUCH_ZOOM_TRUCK}}class vn{constructor(s){u(this,"enabled",!0);u(this,"id","Orbit");this.camera=s,this.activateOrbitControls()}set(s){this.enabled=s,s&&this.activateOrbitControls()}activateOrbitControls(){const s=this.camera.controls;s.minDistance=1,s.maxDistance=300;const t=new g.Vector3;s.getPosition(t);const e=t.length();s.distance=e,s.truckSpeed=2;const{rotation:i}=this.camera.three,o=new g.Vector3(0,0,-1).applyEuler(i),n=t.addScaledVector(o,e);s.moveTo(n.x,n.y,n.z)}}class Bn{constructor(s){u(this,"enabled",!1);u(this,"id","Plan");u(this,"mouseAction1");u(this,"mouseAction2");u(this,"mouseInitialized",!1);u(this,"defaultAzimuthSpeed");u(this,"defaultPolarSpeed");this.camera=s,this.defaultAzimuthSpeed=s.controls.azimuthRotateSpeed,this.defaultPolarSpeed=s.controls.polarRotateSpeed}set(s){this.enabled=s;const t=this.camera.controls;t.azimuthRotateSpeed=s?0:this.defaultAzimuthSpeed,t.polarRotateSpeed=s?0:this.defaultPolarSpeed,this.mouseInitialized||(this.mouseAction1=t.touches.one,this.mouseAction2=t.touches.two,this.mouseInitialized=!0),s?(t.mouseButtons.left=nt.ACTION.TRUCK,t.touches.one=nt.ACTION.TOUCH_TRUCK,t.touches.two=nt.ACTION.TOUCH_ZOOM):(t.mouseButtons.left=nt.ACTION.ROTATE,t.touches.one=this.mouseAction1,t.touches.two=this.mouseAction2)}}class Vn{constructor(s){u(this,"onChanged",new M);u(this,"current","Perspective");u(this,"camera");u(this,"matchOrthoDistanceEnabled",!1);u(this,"_component");u(this,"_previousDistance",-1);this._component=s,this.camera=s.three}async set(s){this.current!==s&&(s==="Orthographic"?this.setOrthoCamera():await this.setPerspectiveCamera(),this.onChanged.trigger(this.camera))}async toggle(){const t=this.current==="Perspective"?"Orthographic":"Perspective";await this.set(t)}setOrthoCamera(){if(this._component.mode===null||this._component.mode.id==="FirstPerson")return;this._previousDistance=this._component.controls.distance,this._component.controls.distance=200;const s=this.getPerspectiveDims();if(!s)return;const{width:t,height:e}=s;this.setupOrthoCamera(e,t),this.camera=this._component.threeOrtho,this.current="Orthographic"}getPerspectiveDims(){const s=this._component.currentWorld;if(!s||!s.renderer)return null;const t=new g.Vector3;this._component.threePersp.getWorldDirection(t);const e=new g.Vector3;this._component.controls.getTarget(e);const o=e.clone().sub(this._component.threePersp.position).dot(t),n=s.renderer.getSize(),r=n.x/n.y,a=this._component.threePersp,c=o*2*Math.atan(a.fov*(Math.PI/180)/2);return{width:c*r,height:c}}setupOrthoCamera(s,t){this._component.controls.mouseButtons.wheel=nt.ACTION.ZOOM,this._component.controls.mouseButtons.middle=nt.ACTION.ZOOM;const e=this._component.threePersp,i=this._component.threeOrtho;i.zoom=1,i.left=t/-2,i.right=t/2,i.top=s/2,i.bottom=s/-2,i.updateProjectionMatrix(),i.position.copy(e.position),i.quaternion.copy(e.quaternion),this._component.controls.camera=i}getDistance(){const s=this._component.threePersp,t=this._component.threeOrtho;return(t.top-t.bottom)/t.zoom/(2*Math.atan(s.fov*(Math.PI/180)/2))}async setPerspectiveCamera(){this._component.controls.mouseButtons.wheel=nt.ACTION.DOLLY,this._component.controls.mouseButtons.middle=nt.ACTION.DOLLY;const s=this._component.threePersp,t=this._component.threeOrtho;s.position.copy(t.position),s.quaternion.copy(t.quaternion),this._component.controls.mouseButtons.wheel=nt.ACTION.DOLLY,this.matchOrthoDistanceEnabled?this._component.controls.distance=this.getDistance():this._component.controls.distance=this._previousDistance,await this._component.controls.zoomTo(1),s.updateProjectionMatrix(),this._component.controls.camera=s,this.camera=s,this.current="Perspective"}}class Mr extends ce{constructor(t){super(t);u(this,"projection");u(this,"threeOrtho");u(this,"threePersp");u(this,"_userInputButtons",{});u(this,"_frustumSize",50);u(this,"_navigationModes",new Map);u(this,"_mode",null);u(this,"previousSize",null);this.threePersp=this.three,this.threeOrtho=this.newOrthoCamera(),this.projection=new Vn(this),this.onAspectUpdated.add(()=>{this.setOrthoPerspCameraAspect()}),this.projection.onChanged.add(e=>{this.three=e,this.updateAspect()}),this.onWorldChanged.add(({action:e})=>{e==="added"&&(this._navigationModes.clear(),this._navigationModes.set("Orbit",new vn(this)),this._navigationModes.set("FirstPerson",new bn(this)),this._navigationModes.set("Plan",new Bn(this)),this._mode=this._navigationModes.get("Orbit"),this.mode.set(!0,{preventTargetAdjustment:!0}),this.currentWorld&&this.currentWorld.renderer&&(this.previousSize=this.currentWorld.renderer.getSize().clone()))})}get mode(){if(!this._mode)throw new Error("Mode not found, camera not initialized");return this._mode}dispose(){super.dispose(),this.threeOrtho.removeFromParent()}set(t){if(this.mode!==null&&this.mode.id!==t){if(this.mode.set(!1),!this._navigationModes.has(t))throw new Error("The specified mode does not exist!");this._mode=this._navigationModes.get(t),this.mode.set(!0)}}async fit(t,e=1.5){if(!this.enabled)return;const i=Number.MAX_VALUE,o=Number.MIN_VALUE,n=new g.Vector3(i,i,i),r=new g.Vector3(o,o,o);for(const I of t){const f=new g.Box3().setFromObject(I);f.min.x<n.x&&(n.x=f.min.x),f.min.y<n.y&&(n.y=f.min.y),f.min.z<n.z&&(n.z=f.min.z),f.max.x>r.x&&(r.x=f.max.x),f.max.y>r.y&&(r.y=f.max.y),f.max.z>r.z&&(r.z=f.max.z)}const a=new g.Box3(n,r),c=new g.Vector3;a.getSize(c);const h=new g.Vector3;a.getCenter(h);const E=Math.max(c.x,c.y,c.z)*e,d=new g.Sphere(h,E);await this.controls.fitToSphere(d,!0)}setUserInput(t){t?this.enableUserInput():this.disableUserInput()}disableUserInput(){this._userInputButtons.left=this.controls.mouseButtons.left,this._userInputButtons.right=this.controls.mouseButtons.right,this._userInputButtons.middle=this.controls.mouseButtons.middle,this._userInputButtons.wheel=this.controls.mouseButtons.wheel,this.controls.mouseButtons.left=0,this.controls.mouseButtons.right=0,this.controls.mouseButtons.middle=0,this.controls.mouseButtons.wheel=0}enableUserInput(){Object.keys(this._userInputButtons).length!==0&&(this.controls.mouseButtons.left=this._userInputButtons.left,this.controls.mouseButtons.right=this._userInputButtons.right,this.controls.mouseButtons.middle=this._userInputButtons.middle,this.controls.mouseButtons.wheel=this._userInputButtons.wheel)}newOrthoCamera(){const t=window.innerWidth/window.innerHeight;return new g.OrthographicCamera(this._frustumSize*t/-2,this._frustumSize*t/2,this._frustumSize/2,this._frustumSize/-2,.1,1e3)}setOrthoPerspCameraAspect(){if(!this.currentWorld||!this.currentWorld.renderer||!this.previousSize)return;const t=this.currentWorld.renderer.getSize(),e=this.threeOrtho.top,i=this.threeOrtho.right,o=t.y/this.previousSize.y,n=t.x/this.previousSize.x,r=e*o,a=i*n;this.threeOrtho.left=-a,this.threeOrtho.right=a,this.threeOrtho.top=r,this.threeOrtho.bottom=-r,this.threeOrtho.updateProjectionMatrix(),this.previousSize.copy(t)}}const Dr=new Map([[D.IFCRELAGGREGATES,{forRelated:"Decomposes",forRelating:"IsDecomposedBy"}],[D.IFCRELASSOCIATESMATERIAL,{forRelated:"HasAssociations",forRelating:"AssociatedTo"}],[D.IFCRELASSOCIATESCLASSIFICATION,{forRelated:"HasAssociations",forRelating:"ClassificationForObjects"}],[D.IFCRELASSIGNSTOGROUP,{forRelated:"HasAssignments",forRelating:"IsGroupedBy"}],[D.IFCRELDEFINESBYPROPERTIES,{forRelated:"IsDefinedBy",forRelating:"DefinesOcurrence"}],[D.IFCRELDEFINESBYTYPE,{forRelated:"IsTypedBy",forRelating:"Types"}],[D.IFCRELDEFINESBYTEMPLATE,{forRelated:"IsDefinedBy",forRelating:"Defines"}],[D.IFCRELCONTAINEDINSPATIALSTRUCTURE,{forRelated:"ContainedInStructure",forRelating:"ContainsElements"}],[D.IFCRELFLOWCONTROLELEMENTS,{forRelated:"AssignedToFlowElement",forRelating:"HasControlElements"}],[D.IFCRELCONNECTSELEMENTS,{forRelated:"ConnectedFrom",forRelating:"ConnectedTo"}],[D.IFCRELASSIGNSTOPRODUCT,{forRelated:"HasAssignments",forRelating:"ReferencedBy"}],[D.IFCRELDECLARES,{forRelated:"HasContext",forRelating:"Declares"}],[D.IFCRELASSIGNSTOCONTROL,{forRelated:"HasAssignments",forRelating:"Controls"}],[D.IFCRELNESTS,{forRelated:"Nests",forRelating:"IsNestedBy"}]]),De=class De extends ${constructor(t){super(t);u(this,"onDisposed",new M);u(this,"onRelationsIndexed",new M);u(this,"relationMaps",{});u(this,"enabled",!0);u(this,"_relToAttributesMap",Dr);u(this,"_inverseAttributes",["IsDecomposedBy","Decomposes","AssociatedTo","HasAssociations","ClassificationForObjects","IsGroupedBy","HasAssignments","IsDefinedBy","DefinesOcurrence","IsTypedBy","Types","Defines","ContainedInStructure","ContainsElements","HasControlElements","AssignedToFlowElement","ConnectedTo","ConnectedFrom","ReferencedBy","Declares","HasContext","Controls","IsNestedBy","Nests"]);u(this,"_ifcRels",[D.IFCRELAGGREGATES,D.IFCRELASSOCIATESMATERIAL,D.IFCRELASSOCIATESCLASSIFICATION,D.IFCRELASSIGNSTOGROUP,D.IFCRELDEFINESBYPROPERTIES,D.IFCRELDEFINESBYTYPE,D.IFCRELDEFINESBYTEMPLATE,D.IFCRELCONTAINEDINSPATIALSTRUCTURE,D.IFCRELFLOWCONTROLELEMENTS,D.IFCRELCONNECTSELEMENTS,D.IFCRELASSIGNSTOPRODUCT,D.IFCRELDECLARES,D.IFCRELASSIGNSTOCONTROL,D.IFCRELNESTS]);u(this,"onFragmentsDisposed",t=>{delete this.relationMaps[t.groupID]});this.components.add(De.uuid,this),t.get(ot).onFragmentsDisposed.add(this.onFragmentsDisposed)}indexRelations(t,e,i,o){const n=Object.keys(e).find(d=>d.startsWith("Relating")),r=Object.keys(e).find(d=>d.startsWith("Related"));if(!(n&&r))return;const a=e[n].value,c=e[r].map(d=>d.value),h=t.get(a)??new Map,E=this.getAttributeIndex(o);E!==null&&(h.set(E,c),t.set(a,h));for(const d of c){const I=t.get(d)??new Map,f=this.getAttributeIndex(i);if(!f)continue;const T=I.get(f)??[];T.push(a),I.set(f,T),t.set(d,I)}}getAttributeIndex(t){const e=this._inverseAttributes.indexOf(t);return e===-1?null:e}setRelationMap(t,e){this.relationMaps[t.uuid]=e,this.onRelationsIndexed.trigger({modelID:t.uuid,relationsMap:e})}async process(t){if(!t.hasProperties)throw new Error("FragmentsGroup properties not found");let e=this.relationMaps[t.uuid];if(e)return e;e=new Map;for(const i of this._ifcRels){const o=await t.getAllPropertiesOfType(i);if(!o)continue;const n=this._relToAttributesMap.get(i);if(!n)continue;const{forRelated:r,forRelating:a}=n;for(const c in o){const h=o[c];this.indexRelations(e,h,r,a)}}return this.setRelationMap(t,e),e}async processFromWebIfc(t,e){const i=new Map;for(const o of this._ifcRels){const n=this._relToAttributesMap.get(o);if(!n)continue;const{forRelated:r,forRelating:a}=n,c=t.GetLineIDsWithType(e,o);for(let h=0;h<c.size();h++){const E=await t.properties.getItemProperties(e,c.get(h));this.indexRelations(i,E,r,a)}}return this.onRelationsIndexed.trigger({modelID:e.toString(),relationsMap:i}),i}getEntityRelations(t,e,i){const o=this.relationMaps[t.uuid];if(!o)throw new Error(`IfcRelationsIndexer: model ${t.uuid} has no relations indexed.`);const n=o.get(e),r=this.getAttributeIndex(i);if(n===void 0||r===null)return null;const a=n.get(r);return a||null}serializeRelations(t){const e={};for(const[i,o]of t.entries()){e[i]||(e[i]={});for(const[n,r]of o.entries())e[i][n]=r}return JSON.stringify(e)}serializeModelRelations(t){const e=this.relationMaps[t.uuid];return e?this.serializeRelations(e):null}serializeAllRelations(){const t={};for(const e in this.relationMaps){const i=this.relationMaps[e],o={};for(const[n,r]of i.entries()){o[n]||(o[n]={});for(const[a,c]of r.entries())o[n][a]=c}t[e]=o}return JSON.stringify(t)}getRelationsMapFromJSON(t){const e=JSON.parse(t),i=new Map;for(const o in e){const n=e[o],r=new Map;for(const a in n)r.set(Number(a),n[a]);i.set(Number(o),r)}return i}dispose(){this.relationMaps={},this.components.get(ot).onFragmentsDisposed.remove(this.onFragmentsDisposed),this.onDisposed.trigger(De.uuid),this.onDisposed.reset()}getEntitiesWithRelation(t,e,i){const o=this.relationMaps[t.uuid];if(!o)throw new Error("IfcRelationsIndexer: the model relations are not indexed!");const n=new Set;for(const[r,a]of o){const c=this.getAttributeIndex(e);if(c===null)throw new Error("IfcRelationsIndexer: invalid inverse attribute name");const h=a.get(c);h&&h.includes(i)&&n.add(r)}return n}addEntityRelations(t,e,i,...o){const n=this.getEntityRelations(t,e,i);if(n)n.push(...o);else{const r=this.getAttributeIndex(i);if(!r)throw new Error(`IfcRelationsIndexer: ${i} is not a valid relation name.`);const a=this.relationMaps[t.uuid].get(e);a==null||a.set(r,o)}}getEntityChildren(t,e,i=new Set){if(i.add(e),this.relationMaps[t.uuid]===void 0)throw new Error("The provided model has no indices. You have to generate them first.");const n=this.getEntityRelations(t,e,"IsDecomposedBy");if(n)for(const a of n)this.getEntityChildren(t,a,i);const r=this.getEntityRelations(t,e,"ContainsElements");if(r)for(const a of r)this.getEntityChildren(t,a,i);return i}};u(De,"uuid","23a889ab-83b3-44a4-8bee-ead83438370b");let Wt=De;const Fs=class Fs extends ${constructor(t){super(t);u(this,"onDisposed",new M);u(this,"onFragmentsLoaded",new M);u(this,"onFragmentsDisposed",new M);u(this,"list",new di);u(this,"groups",new di);u(this,"baseCoordinationModel","");u(this,"baseCoordinationMatrix",new g.Matrix4);u(this,"enabled",!0);u(this,"_loader",new pn.Serializer);this.components.add(Fs.uuid,this)}get meshes(){const t=[];for(const[e,i]of this.list)t.push(i.mesh);return t}dispose(){for(const[t,e]of this.groups)e.dispose(!0);this.baseCoordinationModel="",this.groups.clear(),this.list.clear(),this.onFragmentsLoaded.reset(),this.onFragmentsDisposed.reset(),this.onDisposed.trigger(),this.onDisposed.reset()}disposeGroup(t){const{uuid:e}=t,i=[];for(const o of t.items)i.push(o.id),this.list.delete(o.id);t.dispose(!0),this.groups.delete(t.uuid),this.onFragmentsDisposed.trigger({groupID:e,fragmentIDs:i})}load(t,e){const o={...{coordinate:!0},...e},{coordinate:n,name:r,properties:a,relationsMap:c}=o,h=this._loader.import(t);e&&(h.isStreamed=e.isStreamed||!1),r&&(h.name=r);for(const E of h.items)E.group=h,this.list.set(E.id,E);return n&&this.coordinate([h]),this.groups.set(h.uuid,h),a&&h.setLocalProperties(a),c&&this.components.get(Wt).setRelationMap(h,c),this.onFragmentsLoaded.trigger(h),h}export(t){return this._loader.export(t)}getModelIdMap(t){const e={};for(const i in t){const o=this.list.get(i);if(!(o&&o.group))continue;const n=o.group;n.uuid in e||(e[n.uuid]=new Set);const r=t[i];for(const a of r)e[n.uuid].add(a)}return e}modelIdToFragmentIdMap(t){let e={};for(const i in t){const o=this.groups.get(i);if(!o)continue;const n=t[i],r=o.getFragmentMap(n);e={...e,...r}}return e}coordinate(t=Array.from(this.groups.values())){if(this.baseCoordinationModel.length===0){const i=t.pop();if(!i)return;this.baseCoordinationModel=i.uuid,this.baseCoordinationMatrix=i.coordinationMatrix.clone()}if(t.length)for(const i of t)i.coordinationMatrix.equals(this.baseCoordinationMatrix)||(i.position.set(0,0,0),i.rotation.set(0,0,0),i.scale.set(1,1,1),i.updateMatrix(),this.applyBaseCoordinateSystem(i,i.coordinationMatrix))}applyBaseCoordinateSystem(t,e){t.applyMatrix4(e.clone().invert()),t.applyMatrix4(this.baseCoordinationMatrix)}clone(t,e){const i=t.cloneGroup(e);this.groups.set(i.uuid,i);for(const o of i.items)this.list.set(o.id,o);return i}};u(Fs,"uuid","fef46874-46a3-461b-8c44-2922ab77c806");let ot=Fs;const Tt=class Tt extends ${constructor(t){super(t);u(this,"enabled",!0);u(this,"onDisposed",new M);u(this,"_absoluteMin");u(this,"_absoluteMax");u(this,"_meshes",[]);this.components.add(Tt.uuid,this),this._absoluteMin=Tt.newBound(!0),this._absoluteMax=Tt.newBound(!1)}static getDimensions(t){const{min:e,max:i}=t,o=Math.abs(i.x-e.x),n=Math.abs(i.y-e.y),r=Math.abs(i.z-e.z),a=new g.Vector3;return a.subVectors(i,e).divideScalar(2).add(e),{width:o,height:n,depth:r,center:a}}static newBound(t){const e=t?1:-1;return new g.Vector3(e*Number.MAX_VALUE,e*Number.MAX_VALUE,e*Number.MAX_VALUE)}static getBounds(t,e,i){const o=i||this.newBound(!1),n=e||this.newBound(!0);for(const r of t)r.x<n.x&&(n.x=r.x),r.y<n.y&&(n.y=r.y),r.z<n.z&&(n.z=r.z),r.x>o.x&&(o.x=r.x),r.y>o.y&&(o.y=r.y),r.z>o.z&&(o.z=r.z);return new g.Box3(e,i)}dispose(){const t=this.components.get(_t);for(const e of this._meshes)t.destroy(e);this._meshes=[],this.onDisposed.trigger(Tt.uuid),this.onDisposed.reset()}get(){const t=this._absoluteMin.clone(),e=this._absoluteMax.clone();return new g.Box3(t,e)}getSphere(){const t=this._absoluteMin.clone(),e=this._absoluteMax.clone(),i=Math.abs((e.x-t.x)/2),o=Math.abs((e.y-t.y)/2),n=Math.abs((e.z-t.z)/2),r=new g.Vector3(t.x+i,t.y+o,t.z+n),a=r.distanceTo(t);return new g.Sphere(r,a)}getMesh(){const t=new g.Box3(this._absoluteMin,this._absoluteMax),e=Tt.getDimensions(t),{width:i,height:o,depth:n,center:r}=e,a=new g.BoxGeometry(i,o,n),c=new g.Mesh(a);return this._meshes.push(c),c.position.copy(r),c}reset(){this._absoluteMin=Tt.newBound(!0),this._absoluteMax=Tt.newBound(!1)}add(t){for(const e of t.items)this.addMesh(e.mesh)}addMesh(t,e){if(!t.geometry.index)return;const i=Tt.getFragmentBounds(t);t.updateMatrixWorld();const o=t.matrixWorld,n=new g.Matrix4,r=t instanceof g.InstancedMesh,a=new Set;if(t instanceof Dt.FragmentMesh){e||(e=t.fragment.ids);for(const c of e){const h=t.fragment.getInstancesIDs(c);if(h)for(const E of h)a.add(E)}}else a.add(0);for(const c of a){const h=i.min.clone(),E=i.max.clone();r&&(t.getMatrixAt(c,n),h.applyMatrix4(n),E.applyMatrix4(n)),h.applyMatrix4(o),E.applyMatrix4(o),h.x<this._absoluteMin.x&&(this._absoluteMin.x=h.x),h.y<this._absoluteMin.y&&(this._absoluteMin.y=h.y),h.z<this._absoluteMin.z&&(this._absoluteMin.z=h.z),h.x>this._absoluteMax.x&&(this._absoluteMax.x=h.x),h.y>this._absoluteMax.y&&(this._absoluteMax.y=h.y),h.z>this._absoluteMax.z&&(this._absoluteMax.z=h.z),E.x>this._absoluteMax.x&&(this._absoluteMax.x=E.x),E.y>this._absoluteMax.y&&(this._absoluteMax.y=E.y),E.z>this._absoluteMax.z&&(this._absoluteMax.z=E.z),E.x<this._absoluteMin.x&&(this._absoluteMin.x=E.x),E.y<this._absoluteMin.y&&(this._absoluteMin.y=E.y),E.z<this._absoluteMin.z&&(this._absoluteMin.z=E.z)}}addFragmentIdMap(t){const e=this.components.get(ot);for(const i in t){const o=e.list.get(i);if(!o)continue;const n=t[i];this.addMesh(o.mesh,n)}}static getFragmentBounds(t){const e=t.geometry.attributes.position,i=Number.MAX_VALUE,o=-i,n=new g.Vector3(i,i,i),r=new g.Vector3(o,o,o);if(!t.geometry.index)throw new Error("Geometry must be indexed!");const a=Array.from(t.geometry.index.array);for(let c=0;c<a.length;c++){if(c%3===0&&a[c]===0&&a[c+1]===0&&a[c+2]===0){c+=2;continue}const h=a[c],E=e.getX(h),d=e.getY(h),I=e.getZ(h);E<n.x&&(n.x=E),d<n.y&&(n.y=d),I<n.z&&(n.z=I),E>r.x&&(r.x=E),d>r.y&&(r.y=d),I>r.z&&(r.z=I)}return new g.Box3(n,r)}};u(Tt,"uuid","d1444724-dba6-4cdd-a0c7-68ee1450d166");let Ti=Tt;const Li=new Set([1123145078,574549367,1675464909,2059837836,3798115385,32440307,3125803723,3207858831,2740243338,2624227202,4240577450,3615266464,3724593414,220341763,477187591,1878645084,1300840506,3303107099,1607154358,1878645084,846575682,1351298697,2417041796,3049322572,3331915920,1416205885,776857604,3285139300,3958052878,2827736869,2732653382,673634403,3448662350,4142052618,2924175390,803316827,2556980723,1809719519,2205249479,807026263,3737207727,1660063152,2347385850,2705031697,3732776249,2485617015,2611217952,1704287377,2937912522,2770003689,1281925730,1484403080,3448662350,4142052618,3800577675,4006246654,3590301190,1383045692,2775532180,2047409740,370225590,3593883385,2665983363,4124623270,812098782,3649129432,987898635,1105321065,3510044353,1635779807,2603310189,3406155212,1310608509,4261334040,2736907675,3649129432,1136057603,1260505505,4182860854,2713105998,2898889636,59481748,3749851601,3486308946,3150382593,1062206242,3264961684,15328376,1485152156,370225590,1981873012,2859738748,45288368,2614616156,2732653382,775493141,2147822146,2601014836,2629017746,1186437898,2367409068,1213902940,3632507154,3900360178,476780140,1472233963,2804161546,3008276851,738692330,374418227,315944413,3905492369,3570813810,2571569899,178912537,2294589976,1437953363,2133299955,572779678,3092502836,388784114,2624227202,1425443689,3057273783,2347385850,1682466193,2519244187,2839578677,3958567839,2513912981,2830218821,427810014]),As=class As extends ${constructor(t){super(t);u(this,"enabled",!0);t.add(As.uuid,this)}async export(t,e,i=!1,o=!0){const n={},r=new Set(t.GetIfcEntityList(e)),a=new Set([D.IFCPROJECT,D.IFCSITE,D.IFCBUILDING,D.IFCBUILDINGSTOREY,D.IFCSPACE]);for(const c of a)r.add(c);for(const c of r){if(Li.has(c))continue;const h=a.has(c)&&o,E=t.GetLineIDsWithType(e,c);for(const d of E){const I=t.GetLine(0,d,h,i);n[I.expressID]=I}}return n}};u(As,"uuid","b32c4332-cd67-436e-ba7f-196646c7a635");let us=As;const Yn={103090709:"IFCPROJECT",4097777520:"IFCSITE",4031249490:"IFCBUILDING",3124254112:"IFCBUILDINGSTOREY",3856911033:"IFCSPACE",1674181508:"IFCANNOTATION",25142252:"IFCCONTROLLER",32344328:"IFCBOILER",76236018:"IFCLAMP",90941305:"IFCPUMP",177149247:"IFCAIRTERMINALBOX",182646315:"IFCFLOWINSTRUMENT",263784265:"IFCFURNISHINGELEMENT",264262732:"IFCELECTRICGENERATOR",277319702:"IFCAUDIOVISUALAPPLIANCE",310824031:"IFCPIPEFITTING",331165859:"IFCSTAIR",342316401:"IFCDUCTFITTING",377706215:"IFCMECHANICALFASTENER",395920057:"IFCDOOR",402227799:"IFCELECTRICMOTOR",413509423:"IFCSYSTEMFURNITUREELEMENT",484807127:"IFCEVAPORATOR",486154966:"IFCWINDOWSTANDARDCASE",629592764:"IFCLIGHTFIXTURE",630975310:"IFCUNITARYCONTROLELEMENT",635142910:"IFCCABLECARRIERFITTING",639361253:"IFCCOIL",647756555:"IFCFASTENER",707683696:"IFCFLOWSTORAGEDEVICE",738039164:"IFCPROTECTIVEDEVICE",753842376:"IFCBEAM",812556717:"IFCTANK",819412036:"IFCFILTER",843113511:"IFCCOLUMN",862014818:"IFCELECTRICDISTRIBUTIONBOARD",900683007:"IFCFOOTING",905975707:"IFCCOLUMNSTANDARDCASE",926996030:"IFCVOIDINGFEATURE",979691226:"IFCREINFORCINGBAR",987401354:"IFCFLOWSEGMENT",1003880860:"IFCELECTRICTIMECONTROL",1051757585:"IFCCABLEFITTING",1052013943:"IFCDISTRIBUTIONCHAMBERELEMENT",1062813311:"IFCDISTRIBUTIONCONTROLELEMENT",1073191201:"IFCMEMBER",1095909175:"IFCBUILDINGELEMENTPROXY",1156407060:"IFCPLATESTANDARDCASE",1162798199:"IFCSWITCHINGDEVICE",1329646415:"IFCSHADINGDEVICE",1335981549:"IFCDISCRETEACCESSORY",1360408905:"IFCDUCTSILENCER",1404847402:"IFCSTACKTERMINAL",1426591983:"IFCFIRESUPPRESSIONTERMINAL",1437502449:"IFCMEDICALDEVICE",1509553395:"IFCFURNITURE",1529196076:"IFCSLAB",1620046519:"IFCTRANSPORTELEMENT",1634111441:"IFCAIRTERMINAL",1658829314:"IFCENERGYCONVERSIONDEVICE",1677625105:"IFCCIVILELEMENT",1687234759:"IFCPILE",1904799276:"IFCELECTRICAPPLIANCE",1911478936:"IFCMEMBERSTANDARDCASE",1945004755:"IFCDISTRIBUTIONELEMENT",1973544240:"IFCCOVERING",1999602285:"IFCSPACEHEATER",2016517767:"IFCROOF",2056796094:"IFCAIRTOAIRHEATRECOVERY",2058353004:"IFCFLOWCONTROLLER",2068733104:"IFCHUMIDIFIER",2176052936:"IFCJUNCTIONBOX",2188021234:"IFCFLOWMETER",2223149337:"IFCFLOWTERMINAL",2262370178:"IFCRAILING",2272882330:"IFCCONDENSER",2295281155:"IFCPROTECTIVEDEVICETRIPPINGUNIT",2320036040:"IFCREINFORCINGMESH",2347447852:"IFCTENDONANCHOR",2391383451:"IFCVIBRATIONISOLATOR",2391406946:"IFCWALL",2474470126:"IFCMOTORCONNECTION",2769231204:"IFCVIRTUALELEMENT",2814081492:"IFCENGINE",2906023776:"IFCBEAMSTANDARDCASE",2938176219:"IFCBURNER",2979338954:"IFCBUILDINGELEMENTPART",3024970846:"IFCRAMP",3026737570:"IFCTUBEBUNDLE",3027962421:"IFCSLABSTANDARDCASE",3040386961:"IFCDISTRIBUTIONFLOWELEMENT",3053780830:"IFCSANITARYTERMINAL",3079942009:"IFCOPENINGSTANDARDCASE",3087945054:"IFCALARM",3101698114:"IFCSURFACEFEATURE",3127900445:"IFCSLABELEMENTEDCASE",3132237377:"IFCFLOWMOVINGDEVICE",3171933400:"IFCPLATE",3221913625:"IFCCOMMUNICATIONSAPPLIANCE",3242481149:"IFCDOORSTANDARDCASE",3283111854:"IFCRAMPFLIGHT",3296154744:"IFCCHIMNEY",3304561284:"IFCWINDOW",3310460725:"IFCELECTRICFLOWSTORAGEDEVICE",3319311131:"IFCHEATEXCHANGER",3415622556:"IFCFAN",3420628829:"IFCSOLARDEVICE",3493046030:"IFCGEOGRAPHICELEMENT",3495092785:"IFCCURTAINWALL",3508470533:"IFCFLOWTREATMENTDEVICE",3512223829:"IFCWALLSTANDARDCASE",3518393246:"IFCDUCTSEGMENT",3571504051:"IFCCOMPRESSOR",3588315303:"IFCOPENINGELEMENT",3612865200:"IFCPIPESEGMENT",3640358203:"IFCCOOLINGTOWER",3651124850:"IFCPROJECTIONELEMENT",3694346114:"IFCOUTLET",3747195512:"IFCEVAPORATIVECOOLER",3758799889:"IFCCABLECARRIERSEGMENT",3824725483:"IFCTENDON",3825984169:"IFCTRANSFORMER",3902619387:"IFCCHILLER",4074379575:"IFCDAMPER",4086658281:"IFCSENSOR",4123344466:"IFCELEMENTASSEMBLY",4136498852:"IFCCOOLEDBEAM",4156078855:"IFCWALLELEMENTEDCASE",4175244083:"IFCINTERCEPTOR",4207607924:"IFCVALVE",4217484030:"IFCCABLESEGMENT",4237592921:"IFCWASTETERMINAL",4252922144:"IFCSTAIRFLIGHT",4278956645:"IFCFLOWFITTING",4288193352:"IFCACTUATOR",4292641817:"IFCUNITARYEQUIPMENT",3009204131:"IFCGRID"};class xr{getAll(s,t){const e={},i=Object.keys(Yn).map(o=>parseInt(o,10));for(let o=0;o<i.length;o++){const n=i[o],r=s.GetLineIDsWithType(t,n),a=r.size();for(let c=0;c<a;c++)e[r.get(c)]=n}return e}}const Pi={950732822:"IFCURIREFERENCE",4075327185:"IFCTIME",1209108979:"IFCTEMPERATURERATEOFCHANGEMEASURE",3457685358:"IFCSOUNDPRESSURELEVELMEASURE",4157543285:"IFCSOUNDPOWERLEVELMEASURE",2798247006:"IFCPROPERTYSETDEFINITIONSET",1790229001:"IFCPOSITIVEINTEGER",525895558:"IFCNONNEGATIVELENGTHMEASURE",1774176899:"IFCLINEINDEX",1275358634:"IFCLANGUAGEID",2541165894:"IFCDURATION",3701338814:"IFCDAYINWEEKNUMBER",2195413836:"IFCDATETIME",937566702:"IFCDATE",1683019596:"IFCCARDINALPOINTREFERENCE",2314439260:"IFCBINARY",1500781891:"IFCAREADENSITYMEASURE",3683503648:"IFCARCINDEX",4065007721:"IFCYEARNUMBER",1718600412:"IFCWARPINGMOMENTMEASURE",51269191:"IFCWARPINGCONSTANTMEASURE",2593997549:"IFCVOLUMETRICFLOWRATEMEASURE",3458127941:"IFCVOLUMEMEASURE",3345633955:"IFCVAPORPERMEABILITYMEASURE",1278329552:"IFCTORQUEMEASURE",2591213694:"IFCTIMESTAMP",2726807636:"IFCTIMEMEASURE",743184107:"IFCTHERMODYNAMICTEMPERATUREMEASURE",2016195849:"IFCTHERMALTRANSMITTANCEMEASURE",857959152:"IFCTHERMALRESISTANCEMEASURE",2281867870:"IFCTHERMALEXPANSIONCOEFFICIENTMEASURE",2645777649:"IFCTHERMALCONDUCTIVITYMEASURE",232962298:"IFCTHERMALADMITTANCEMEASURE",296282323:"IFCTEXTTRANSFORMATION",603696268:"IFCTEXTFONTNAME",3490877962:"IFCTEXTDECORATION",1460886941:"IFCTEXTALIGNMENT",2801250643:"IFCTEXT",58845555:"IFCTEMPERATUREGRADIENTMEASURE",361837227:"IFCSPECULARROUGHNESS",2757832317:"IFCSPECULAREXPONENT",3477203348:"IFCSPECIFICHEATCAPACITYMEASURE",993287707:"IFCSOUNDPRESSUREMEASURE",846465480:"IFCSOUNDPOWERMEASURE",3471399674:"IFCSOLIDANGLEMEASURE",408310005:"IFCSHEARMODULUSMEASURE",2190458107:"IFCSECTIONALAREAINTEGRALMEASURE",3467162246:"IFCSECTIONMODULUSMEASURE",2766185779:"IFCSECONDINMINUTE",3211557302:"IFCROTATIONALSTIFFNESSMEASURE",1755127002:"IFCROTATIONALMASSMEASURE",2133746277:"IFCROTATIONALFREQUENCYMEASURE",200335297:"IFCREAL",96294661:"IFCRATIOMEASURE",3972513137:"IFCRADIOACTIVITYMEASURE",3665567075:"IFCPRESSUREMEASURE",2169031380:"IFCPRESENTABLETEXT",1364037233:"IFCPOWERMEASURE",1245737093:"IFCPOSITIVERATIOMEASURE",3054510233:"IFCPOSITIVEPLANEANGLEMEASURE",2815919920:"IFCPOSITIVELENGTHMEASURE",4042175685:"IFCPLANEANGLEMEASURE",2642773653:"IFCPLANARFORCEMEASURE",2260317790:"IFCPARAMETERVALUE",929793134:"IFCPHMEASURE",2395907400:"IFCNUMERICMEASURE",2095195183:"IFCNORMALISEDRATIOMEASURE",765770214:"IFCMONTHINYEARNUMBER",2615040989:"IFCMONETARYMEASURE",3114022597:"IFCMOMENTOFINERTIAMEASURE",1648970520:"IFCMOLECULARWEIGHTMEASURE",3177669450:"IFCMOISTUREDIFFUSIVITYMEASURE",1753493141:"IFCMODULUSOFSUBGRADEREACTIONMEASURE",1052454078:"IFCMODULUSOFROTATIONALSUBGRADEREACTIONMEASURE",2173214787:"IFCMODULUSOFLINEARSUBGRADEREACTIONMEASURE",3341486342:"IFCMODULUSOFELASTICITYMEASURE",102610177:"IFCMINUTEINHOUR",3531705166:"IFCMASSPERLENGTHMEASURE",3124614049:"IFCMASSMEASURE",4017473158:"IFCMASSFLOWRATEMEASURE",1477762836:"IFCMASSDENSITYMEASURE",2486716878:"IFCMAGNETICFLUXMEASURE",286949696:"IFCMAGNETICFLUXDENSITYMEASURE",151039812:"IFCLUMINOUSINTENSITYMEASURE",2755797622:"IFCLUMINOUSINTENSITYDISTRIBUTIONMEASURE",2095003142:"IFCLUMINOUSFLUXMEASURE",503418787:"IFCLOGICAL",3086160713:"IFCLINEARVELOCITYMEASURE",1307019551:"IFCLINEARSTIFFNESSMEASURE",2128979029:"IFCLINEARMOMENTMEASURE",191860431:"IFCLINEARFORCEMEASURE",1243674935:"IFCLENGTHMEASURE",3258342251:"IFCLABEL",2054016361:"IFCKINEMATICVISCOSITYMEASURE",3192672207:"IFCISOTHERMALMOISTURECAPACITYMEASURE",3686016028:"IFCIONCONCENTRATIONMEASURE",3809634241:"IFCINTEGERCOUNTRATEMEASURE",1939436016:"IFCINTEGER",2679005408:"IFCINDUCTANCEMEASURE",3358199106:"IFCILLUMINANCEMEASURE",983778844:"IFCIDENTIFIER",2589826445:"IFCHOURINDAY",1158859006:"IFCHEATINGVALUEMEASURE",3113092358:"IFCHEATFLUXDENSITYMEASURE",3064340077:"IFCGLOBALLYUNIQUEID",3044325142:"IFCFREQUENCYMEASURE",1361398929:"IFCFORCEMEASURE",2590844177:"IFCFONTWEIGHT",2715512545:"IFCFONTVARIANT",1102727119:"IFCFONTSTYLE",2078135608:"IFCENERGYMEASURE",2506197118:"IFCELECTRICVOLTAGEMEASURE",2951915441:"IFCELECTRICRESISTANCEMEASURE",3790457270:"IFCELECTRICCURRENTMEASURE",2093906313:"IFCELECTRICCONDUCTANCEMEASURE",3818826038:"IFCELECTRICCHARGEMEASURE",1827137117:"IFCELECTRICCAPACITANCEMEASURE",69416015:"IFCDYNAMICVISCOSITYMEASURE",524656162:"IFCDOSEEQUIVALENTMEASURE",4134073009:"IFCDIMENSIONCOUNT",1514641115:"IFCDESCRIPTIVEMEASURE",300323983:"IFCDAYLIGHTSAVINGHOUR",86635668:"IFCDAYINMONTHNUMBER",94842927:"IFCCURVATUREMEASURE",1778710042:"IFCCOUNTMEASURE",3238673880:"IFCCONTEXTDEPENDENTMEASURE",3812528620:"IFCCOMPOUNDPLANEANGLEMEASURE",2991860651:"IFCCOMPLEXNUMBER",1867003952:"IFCBOXALIGNMENT",2735952531:"IFCBOOLEAN",2650437152:"IFCAREAMEASURE",632304761:"IFCANGULARVELOCITYMEASURE",360377573:"IFCAMOUNTOFSUBSTANCEMEASURE",4182062534:"IFCACCELERATIONMEASURE",3699917729:"IFCABSORBEDDOSEMEASURE",1971632696:"IFCGEOSLICE",2680139844:"IFCGEOMODEL",24726584:"IFCELECTRICFLOWTREATMENTDEVICE",3693000487:"IFCDISTRIBUTIONBOARD",3460952963:"IFCCONVEYORSEGMENT",3999819293:"IFCCAISSONFOUNDATION",3314249567:"IFCBOREHOLE",4196446775:"IFCBEARING",325726236:"IFCALIGNMENT",3425753595:"IFCTRACKELEMENT",991950508:"IFCSIGNAL",3798194928:"IFCREINFORCEDSOIL",3290496277:"IFCRAIL",1383356374:"IFCPAVEMENT",2182337498:"IFCNAVIGATIONELEMENT",234836483:"IFCMOORINGDEVICE",2078563270:"IFCMOBILETELECOMMUNICATIONSAPPLIANCE",1638804497:"IFCLIQUIDTERMINAL",1154579445:"IFCLINEARPOSITIONINGELEMENT",2696325953:"IFCKERB",2713699986:"IFCGEOTECHNICALASSEMBLY",2142170206:"IFCELECTRICFLOWTREATMENTDEVICETYPE",3376911765:"IFCEARTHWORKSFILL",1077100507:"IFCEARTHWORKSELEMENT",3071239417:"IFCEARTHWORKSCUT",479945903:"IFCDISTRIBUTIONBOARDTYPE",3426335179:"IFCDEEPFOUNDATION",1502416096:"IFCCOURSE",2940368186:"IFCCONVEYORSEGMENTTYPE",3203706013:"IFCCAISSONFOUNDATIONTYPE",3862327254:"IFCBUILTSYSTEM",1876633798:"IFCBUILTELEMENT",963979645:"IFCBRIDGEPART",644574406:"IFCBRIDGE",3649138523:"IFCBEARINGTYPE",1662888072:"IFCALIGNMENTVERTICAL",317615605:"IFCALIGNMENTSEGMENT",1545765605:"IFCALIGNMENTHORIZONTAL",4266260250:"IFCALIGNMENTCANT",3956297820:"IFCVIBRATIONDAMPERTYPE",1530820697:"IFCVIBRATIONDAMPER",840318589:"IFCVEHICLE",1953115116:"IFCTRANSPORTATIONDEVICE",618700268:"IFCTRACKELEMENTTYPE",2281632017:"IFCTENDONCONDUITTYPE",3663046924:"IFCTENDONCONDUIT",42703149:"IFCSINESPIRAL",1894708472:"IFCSIGNALTYPE",3599934289:"IFCSIGNTYPE",33720170:"IFCSIGN",1027922057:"IFCSEVENTHORDERPOLYNOMIALSPIRAL",544395925:"IFCSEGMENTEDREFERENCECURVE",3649235739:"IFCSECONDORDERPOLYNOMIALSPIRAL",550521510:"IFCROADPART",146592293:"IFCROAD",3818125796:"IFCRELADHERESTOELEMENT",4021432810:"IFCREFERENT",1891881377:"IFCRAILWAYPART",3992365140:"IFCRAILWAY",1763565496:"IFCRAILTYPE",1946335990:"IFCPOSITIONINGELEMENT",514975943:"IFCPAVEMENTTYPE",506776471:"IFCNAVIGATIONELEMENTTYPE",710110818:"IFCMOORINGDEVICETYPE",1950438474:"IFCMOBILETELECOMMUNICATIONSAPPLIANCETYPE",976884017:"IFCMARINEPART",525669439:"IFCMARINEFACILITY",1770583370:"IFCLIQUIDTERMINALTYPE",2176059722:"IFCLINEARELEMENT",679976338:"IFCKERBTYPE",3948183225:"IFCIMPACTPROTECTIONDEVICETYPE",2568555532:"IFCIMPACTPROTECTIONDEVICE",2898700619:"IFCGRADIENTCURVE",1594536857:"IFCGEOTECHNICALSTRATUM",4230923436:"IFCGEOTECHNICALELEMENT",4228831410:"IFCFACILITYPARTCOMMON",1310830890:"IFCFACILITYPART",24185140:"IFCFACILITY",4234616927:"IFCDIRECTRIXDERIVEDREFERENCESWEPTAREASOLID",1306400036:"IFCDEEPFOUNDATIONTYPE",4189326743:"IFCCOURSETYPE",2000195564:"IFCCOSINESPIRAL",3497074424:"IFCCLOTHOID",1626504194:"IFCBUILTELEMENTTYPE",3651464721:"IFCVEHICLETYPE",1229763772:"IFCTRIANGULATEDIRREGULARNETWORK",3665877780:"IFCTRANSPORTATIONDEVICETYPE",782932809:"IFCTHIRDORDERPOLYNOMIALSPIRAL",2735484536:"IFCSPIRAL",1356537516:"IFCSECTIONEDSURFACE",1290935644:"IFCSECTIONEDSOLIDHORIZONTAL",1862484736:"IFCSECTIONEDSOLID",1441486842:"IFCRELPOSITIONS",1033248425:"IFCRELASSOCIATESPROFILEDEF",3381221214:"IFCPOLYNOMIALCURVE",2485787929:"IFCOFFSETCURVEBYDISTANCES",590820931:"IFCOFFSETCURVE",3465909080:"IFCINDEXEDPOLYGONALTEXTUREMAP",593015953:"IFCDIRECTRIXCURVESWEPTAREASOLID",4212018352:"IFCCURVESEGMENT",3425423356:"IFCAXIS2PLACEMENTLINEAR",823603102:"IFCSEGMENT",2165702409:"IFCPOINTBYDISTANCEEXPRESSION",182550632:"IFCOPENCROSSPROFILEDEF",388784114:"IFCLINEARPLACEMENT",536804194:"IFCALIGNMENTHORIZONTALSEGMENT",3752311538:"IFCALIGNMENTCANTSEGMENT",1010789467:"IFCTEXTURECOORDINATEINDICESWITHVOIDS",222769930:"IFCTEXTURECOORDINATEINDICES",2691318326:"IFCQUANTITYNUMBER",3633395639:"IFCALIGNMENTVERTICALSEGMENT",2879124712:"IFCALIGNMENTPARAMETERSEGMENT",25142252:"IFCCONTROLLER",3087945054:"IFCALARM",4288193352:"IFCACTUATOR",630975310:"IFCUNITARYCONTROLELEMENT",4086658281:"IFCSENSOR",2295281155:"IFCPROTECTIVEDEVICETRIPPINGUNIT",182646315:"IFCFLOWINSTRUMENT",1426591983:"IFCFIRESUPPRESSIONTERMINAL",819412036:"IFCFILTER",3415622556:"IFCFAN",1003880860:"IFCELECTRICTIMECONTROL",402227799:"IFCELECTRICMOTOR",264262732:"IFCELECTRICGENERATOR",3310460725:"IFCELECTRICFLOWSTORAGEDEVICE",862014818:"IFCELECTRICDISTRIBUTIONBOARD",1904799276:"IFCELECTRICAPPLIANCE",1360408905:"IFCDUCTSILENCER",3518393246:"IFCDUCTSEGMENT",342316401:"IFCDUCTFITTING",562808652:"IFCDISTRIBUTIONCIRCUIT",4074379575:"IFCDAMPER",3640358203:"IFCCOOLINGTOWER",4136498852:"IFCCOOLEDBEAM",2272882330:"IFCCONDENSER",3571504051:"IFCCOMPRESSOR",3221913625:"IFCCOMMUNICATIONSAPPLIANCE",639361253:"IFCCOIL",3902619387:"IFCCHILLER",4217484030:"IFCCABLESEGMENT",1051757585:"IFCCABLEFITTING",3758799889:"IFCCABLECARRIERSEGMENT",635142910:"IFCCABLECARRIERFITTING",2938176219:"IFCBURNER",32344328:"IFCBOILER",2906023776:"IFCBEAMSTANDARDCASE",277319702:"IFCAUDIOVISUALAPPLIANCE",2056796094:"IFCAIRTOAIRHEATRECOVERY",177149247:"IFCAIRTERMINALBOX",1634111441:"IFCAIRTERMINAL",486154966:"IFCWINDOWSTANDARDCASE",4237592921:"IFCWASTETERMINAL",4156078855:"IFCWALLELEMENTEDCASE",4207607924:"IFCVALVE",4292641817:"IFCUNITARYEQUIPMENT",3179687236:"IFCUNITARYCONTROLELEMENTTYPE",3026737570:"IFCTUBEBUNDLE",3825984169:"IFCTRANSFORMER",812556717:"IFCTANK",1162798199:"IFCSWITCHINGDEVICE",385403989:"IFCSTRUCTURALLOADCASE",1404847402:"IFCSTACKTERMINAL",1999602285:"IFCSPACEHEATER",3420628829:"IFCSOLARDEVICE",3027962421:"IFCSLABSTANDARDCASE",3127900445:"IFCSLABELEMENTEDCASE",1329646415:"IFCSHADINGDEVICE",3053780830:"IFCSANITARYTERMINAL",2572171363:"IFCREINFORCINGBARTYPE",1232101972:"IFCRATIONALBSPLINECURVEWITHKNOTS",90941305:"IFCPUMP",655969474:"IFCPROTECTIVEDEVICETRIPPINGUNITTYPE",738039164:"IFCPROTECTIVEDEVICE",1156407060:"IFCPLATESTANDARDCASE",3612865200:"IFCPIPESEGMENT",310824031:"IFCPIPEFITTING",3694346114:"IFCOUTLET",144952367:"IFCOUTERBOUNDARYCURVE",2474470126:"IFCMOTORCONNECTION",1911478936:"IFCMEMBERSTANDARDCASE",1437502449:"IFCMEDICALDEVICE",629592764:"IFCLIGHTFIXTURE",76236018:"IFCLAMP",2176052936:"IFCJUNCTIONBOX",4175244083:"IFCINTERCEPTOR",2068733104:"IFCHUMIDIFIER",3319311131:"IFCHEATEXCHANGER",2188021234:"IFCFLOWMETER",1209101575:"IFCEXTERNALSPATIALELEMENT",484807127:"IFCEVAPORATOR",3747195512:"IFCEVAPORATIVECOOLER",2814081492:"IFCENGINE",2417008758:"IFCELECTRICDISTRIBUTIONBOARDTYPE",3242481149:"IFCDOORSTANDARDCASE",3205830791:"IFCDISTRIBUTIONSYSTEM",400855858:"IFCCOMMUNICATIONSAPPLIANCETYPE",905975707:"IFCCOLUMNSTANDARDCASE",1677625105:"IFCCIVILELEMENT",3296154744:"IFCCHIMNEY",2674252688:"IFCCABLEFITTINGTYPE",2188180465:"IFCBURNERTYPE",1177604601:"IFCBUILDINGSYSTEM",39481116:"IFCBUILDINGELEMENTPARTTYPE",1136057603:"IFCBOUNDARYCURVE",2461110595:"IFCBSPLINECURVEWITHKNOTS",1532957894:"IFCAUDIOVISUALAPPLIANCETYPE",4088093105:"IFCWORKCALENDAR",4009809668:"IFCWINDOWTYPE",926996030:"IFCVOIDINGFEATURE",2391383451:"IFCVIBRATIONISOLATOR",2415094496:"IFCTENDONTYPE",3081323446:"IFCTENDONANCHORTYPE",413509423:"IFCSYSTEMFURNITUREELEMENT",3101698114:"IFCSURFACEFEATURE",3657597509:"IFCSTRUCTURALSURFACEACTION",2757150158:"IFCSTRUCTURALCURVEREACTION",1004757350:"IFCSTRUCTURALCURVEACTION",338393293:"IFCSTAIRTYPE",1072016465:"IFCSOLARDEVICETYPE",4074543187:"IFCSHADINGDEVICETYPE",2157484638:"IFCSEAMCURVE",2781568857:"IFCROOFTYPE",2310774935:"IFCREINFORCINGMESHTYPE",964333572:"IFCREINFORCINGELEMENTTYPE",683857671:"IFCRATIONALBSPLINESURFACEWITHKNOTS",1469900589:"IFCRAMPTYPE",2839578677:"IFCPOLYGONALFACESET",1158309216:"IFCPILETYPE",3079942009:"IFCOPENINGSTANDARDCASE",1114901282:"IFCMEDICALDEVICETYPE",3113134337:"IFCINTERSECTIONCURVE",3946677679:"IFCINTERCEPTORTYPE",2571569899:"IFCINDEXEDPOLYCURVE",3493046030:"IFCGEOGRAPHICELEMENT",1509553395:"IFCFURNITURE",1893162501:"IFCFOOTINGTYPE",2853485674:"IFCEXTERNALSPATIALSTRUCTUREELEMENT",4148101412:"IFCEVENT",132023988:"IFCENGINETYPE",2397081782:"IFCELEMENTASSEMBLYTYPE",2323601079:"IFCDOORTYPE",1213902940:"IFCCYLINDRICALSURFACE",1525564444:"IFCCONSTRUCTIONPRODUCTRESOURCETYPE",4105962743:"IFCCONSTRUCTIONMATERIALRESOURCETYPE",2185764099:"IFCCONSTRUCTIONEQUIPMENTRESOURCETYPE",15328376:"IFCCOMPOSITECURVEONSURFACE",3875453745:"IFCCOMPLEXPROPERTYTEMPLATE",3893394355:"IFCCIVILELEMENTTYPE",2197970202:"IFCCHIMNEYTYPE",167062518:"IFCBSPLINESURFACEWITHKNOTS",2887950389:"IFCBSPLINESURFACE",2603310189:"IFCADVANCEDBREPWITHVOIDS",1635779807:"IFCADVANCEDBREP",2916149573:"IFCTRIANGULATEDFACESET",1935646853:"IFCTOROIDALSURFACE",2387106220:"IFCTESSELLATEDFACESET",3206491090:"IFCTASKTYPE",699246055:"IFCSURFACECURVE",4095615324:"IFCSUBCONTRACTRESOURCETYPE",603775116:"IFCSTRUCTURALSURFACEREACTION",4015995234:"IFCSPHERICALSURFACE",2481509218:"IFCSPATIALZONETYPE",463610769:"IFCSPATIALZONE",710998568:"IFCSPATIALELEMENTTYPE",1412071761:"IFCSPATIALELEMENT",3663146110:"IFCSIMPLEPROPERTYTEMPLATE",3243963512:"IFCREVOLVEDAREASOLIDTAPERED",816062949:"IFCREPARAMETRISEDCOMPOSITECURVESEGMENT",1521410863:"IFCRELSPACEBOUNDARY2NDLEVEL",3523091289:"IFCRELSPACEBOUNDARY1STLEVEL",427948657:"IFCRELINTERFERESELEMENTS",307848117:"IFCRELDEFINESBYTEMPLATE",1462361463:"IFCRELDEFINESBYOBJECT",2565941209:"IFCRELDECLARES",1027710054:"IFCRELASSIGNSTOGROUPBYFACTOR",3521284610:"IFCPROPERTYTEMPLATE",492091185:"IFCPROPERTYSETTEMPLATE",653396225:"IFCPROJECTLIBRARY",569719735:"IFCPROCEDURETYPE",3967405729:"IFCPREDEFINEDPROPERTYSET",1682466193:"IFCPCURVE",428585644:"IFCLABORRESOURCETYPE",2294589976:"IFCINDEXEDPOLYGONALFACEWITHVOIDS",178912537:"IFCINDEXEDPOLYGONALFACE",4095422895:"IFCGEOGRAPHICELEMENTTYPE",2652556860:"IFCFIXEDREFERENCESWEPTAREASOLID",2804161546:"IFCEXTRUDEDAREASOLIDTAPERED",4024345920:"IFCEVENTTYPE",2629017746:"IFCCURVEBOUNDEDSURFACE",1815067380:"IFCCREWRESOURCETYPE",3419103109:"IFCCONTEXT",2574617495:"IFCCONSTRUCTIONRESOURCETYPE",2059837836:"IFCCARTESIANPOINTLIST3D",1675464909:"IFCCARTESIANPOINTLIST2D",574549367:"IFCCARTESIANPOINTLIST",3406155212:"IFCADVANCEDFACE",3698973494:"IFCTYPERESOURCE",3736923433:"IFCTYPEPROCESS",901063453:"IFCTESSELLATEDITEM",1096409881:"IFCSWEPTDISKSOLIDPOLYGONAL",1042787934:"IFCRESOURCETIME",1608871552:"IFCRESOURCECONSTRAINTRELATIONSHIP",2943643501:"IFCRESOURCEAPPROVALRELATIONSHIP",2090586900:"IFCQUANTITYSET",1482703590:"IFCPROPERTYTEMPLATEDEFINITION",3778827333:"IFCPREDEFINEDPROPERTIES",2998442950:"IFCMIRROREDPROFILEDEF",853536259:"IFCMATERIALRELATIONSHIP",3404854881:"IFCMATERIALPROFILESETUSAGETAPERING",3079605661:"IFCMATERIALPROFILESETUSAGE",2852063980:"IFCMATERIALCONSTITUENTSET",3708119e3:"IFCMATERIALCONSTITUENT",1585845231:"IFCLAGTIME",2133299955:"IFCINDEXEDTRIANGLETEXTUREMAP",1437953363:"IFCINDEXEDTEXTUREMAP",3570813810:"IFCINDEXEDCOLOURMAP",1437805879:"IFCEXTERNALREFERENCERELATIONSHIP",297599258:"IFCEXTENDEDPROPERTIES",211053100:"IFCEVENTTIME",2713554722:"IFCCONVERSIONBASEDUNITWITHOFFSET",3285139300:"IFCCOLOURRGBLIST",1236880293:"IFCWORKTIME",1199560280:"IFCTIMEPERIOD",3611470254:"IFCTEXTUREVERTEXLIST",2771591690:"IFCTASKTIMERECURRING",1549132990:"IFCTASKTIME",2043862942:"IFCTABLECOLUMN",2934153892:"IFCSURFACEREINFORCEMENTAREA",609421318:"IFCSTRUCTURALLOADORRESULT",3478079324:"IFCSTRUCTURALLOADCONFIGURATION",1054537805:"IFCSCHEDULINGTIME",2439245199:"IFCRESOURCELEVELRELATIONSHIP",2433181523:"IFCREFERENCE",3915482550:"IFCRECURRENCEPATTERN",986844984:"IFCPROPERTYABSTRACTION",3843373140:"IFCPROJECTEDCRS",677532197:"IFCPRESENTATIONITEM",1507914824:"IFCMATERIALUSAGEDEFINITION",552965576:"IFCMATERIALPROFILEWITHOFFSETS",164193824:"IFCMATERIALPROFILESET",2235152071:"IFCMATERIALPROFILE",1847252529:"IFCMATERIALLAYERWITHOFFSETS",760658860:"IFCMATERIALDEFINITION",3057273783:"IFCMAPCONVERSION",4294318154:"IFCEXTERNALINFORMATION",1466758467:"IFCCOORDINATEREFERENCESYSTEM",1785450214:"IFCCOORDINATEOPERATION",775493141:"IFCCONNECTIONVOLUMEGEOMETRY",979691226:"IFCREINFORCINGBAR",3700593921:"IFCELECTRICDISTRIBUTIONPOINT",1062813311:"IFCDISTRIBUTIONCONTROLELEMENT",1052013943:"IFCDISTRIBUTIONCHAMBERELEMENT",578613899:"IFCCONTROLLERTYPE",2454782716:"IFCCHAMFEREDGEFEATURE",753842376:"IFCBEAM",3001207471:"IFCALARMTYPE",2874132201:"IFCACTUATORTYPE",3304561284:"IFCWINDOW",3512223829:"IFCWALLSTANDARDCASE",2391406946:"IFCWALL",3313531582:"IFCVIBRATIONISOLATORTYPE",2347447852:"IFCTENDONANCHOR",3824725483:"IFCTENDON",2515109513:"IFCSTRUCTURALANALYSISMODEL",4252922144:"IFCSTAIRFLIGHT",331165859:"IFCSTAIR",1529196076:"IFCSLAB",1783015770:"IFCSENSORTYPE",1376911519:"IFCROUNDEDEDGEFEATURE",2016517767:"IFCROOF",2320036040:"IFCREINFORCINGMESH",3027567501:"IFCREINFORCINGELEMENT",3055160366:"IFCRATIONALBEZIERCURVE",3283111854:"IFCRAMPFLIGHT",3024970846:"IFCRAMP",2262370178:"IFCRAILING",3171933400:"IFCPLATE",1687234759:"IFCPILE",1073191201:"IFCMEMBER",900683007:"IFCFOOTING",3508470533:"IFCFLOWTREATMENTDEVICE",2223149337:"IFCFLOWTERMINAL",707683696:"IFCFLOWSTORAGEDEVICE",987401354:"IFCFLOWSEGMENT",3132237377:"IFCFLOWMOVINGDEVICE",4037862832:"IFCFLOWINSTRUMENTTYPE",4278956645:"IFCFLOWFITTING",2058353004:"IFCFLOWCONTROLLER",4222183408:"IFCFIRESUPPRESSIONTERMINALTYPE",1810631287:"IFCFILTERTYPE",346874300:"IFCFANTYPE",1658829314:"IFCENERGYCONVERSIONDEVICE",857184966:"IFCELECTRICALELEMENT",1634875225:"IFCELECTRICALCIRCUIT",712377611:"IFCELECTRICTIMECONTROLTYPE",1217240411:"IFCELECTRICMOTORTYPE",1365060375:"IFCELECTRICHEATERTYPE",1534661035:"IFCELECTRICGENERATORTYPE",3277789161:"IFCELECTRICFLOWSTORAGEDEVICETYPE",663422040:"IFCELECTRICAPPLIANCETYPE",855621170:"IFCEDGEFEATURE",2030761528:"IFCDUCTSILENCERTYPE",3760055223:"IFCDUCTSEGMENTTYPE",869906466:"IFCDUCTFITTINGTYPE",395920057:"IFCDOOR",3041715199:"IFCDISTRIBUTIONPORT",3040386961:"IFCDISTRIBUTIONFLOWELEMENT",1945004755:"IFCDISTRIBUTIONELEMENT",2063403501:"IFCDISTRIBUTIONCONTROLELEMENTTYPE",1599208980:"IFCDISTRIBUTIONCHAMBERELEMENTTYPE",2635815018:"IFCDISCRETEACCESSORYTYPE",1335981549:"IFCDISCRETEACCESSORY",4147604152:"IFCDIAMETERDIMENSION",3961806047:"IFCDAMPERTYPE",3495092785:"IFCCURTAINWALL",1973544240:"IFCCOVERING",2954562838:"IFCCOOLINGTOWERTYPE",335055490:"IFCCOOLEDBEAMTYPE",488727124:"IFCCONSTRUCTIONPRODUCTRESOURCE",1060000209:"IFCCONSTRUCTIONMATERIALRESOURCE",3898045240:"IFCCONSTRUCTIONEQUIPMENTRESOURCE",1163958913:"IFCCONDITIONCRITERION",2188551683:"IFCCONDITION",2816379211:"IFCCONDENSERTYPE",3850581409:"IFCCOMPRESSORTYPE",843113511:"IFCCOLUMN",2301859152:"IFCCOILTYPE",2611217952:"IFCCIRCLE",2951183804:"IFCCHILLERTYPE",1285652485:"IFCCABLESEGMENTTYPE",3293546465:"IFCCABLECARRIERSEGMENTTYPE",395041908:"IFCCABLECARRIERFITTINGTYPE",1909888760:"IFCBUILDINGELEMENTPROXYTYPE",1095909175:"IFCBUILDINGELEMENTPROXY",2979338954:"IFCBUILDINGELEMENTPART",52481810:"IFCBUILDINGELEMENTCOMPONENT",3299480353:"IFCBUILDINGELEMENT",231477066:"IFCBOILERTYPE",1916977116:"IFCBEZIERCURVE",819618141:"IFCBEAMTYPE",1967976161:"IFCBSPLINECURVE",3460190687:"IFCASSET",2470393545:"IFCANGULARDIMENSION",1871374353:"IFCAIRTOAIRHEATRECOVERYTYPE",3352864051:"IFCAIRTERMINALTYPE",1411407467:"IFCAIRTERMINALBOXTYPE",3821786052:"IFCACTIONREQUEST",1213861670:"IFC2DCOMPOSITECURVE",1033361043:"IFCZONE",3342526732:"IFCWORKSCHEDULE",4218914973:"IFCWORKPLAN",1028945134:"IFCWORKCONTROL",1133259667:"IFCWASTETERMINALTYPE",1898987631:"IFCWALLTYPE",2769231204:"IFCVIRTUALELEMENT",728799441:"IFCVALVETYPE",1911125066:"IFCUNITARYEQUIPMENTTYPE",1600972822:"IFCTUBEBUNDLETYPE",3593883385:"IFCTRIMMEDCURVE",1620046519:"IFCTRANSPORTELEMENT",1692211062:"IFCTRANSFORMERTYPE",1637806684:"IFCTIMESERIESSCHEDULE",5716631:"IFCTANKTYPE",2254336722:"IFCSYSTEM",2315554128:"IFCSWITCHINGDEVICETYPE",148013059:"IFCSUBCONTRACTRESOURCE",1975003073:"IFCSTRUCTURALSURFACECONNECTION",2986769608:"IFCSTRUCTURALRESULTGROUP",1235345126:"IFCSTRUCTURALPOINTREACTION",734778138:"IFCSTRUCTURALPOINTCONNECTION",2082059205:"IFCSTRUCTURALPOINTACTION",3987759626:"IFCSTRUCTURALPLANARACTIONVARYING",1621171031:"IFCSTRUCTURALPLANARACTION",1252848954:"IFCSTRUCTURALLOADGROUP",1721250024:"IFCSTRUCTURALLINEARACTIONVARYING",1807405624:"IFCSTRUCTURALLINEARACTION",2445595289:"IFCSTRUCTURALCURVEMEMBERVARYING",214636428:"IFCSTRUCTURALCURVEMEMBER",4243806635:"IFCSTRUCTURALCURVECONNECTION",1179482911:"IFCSTRUCTURALCONNECTION",682877961:"IFCSTRUCTURALACTION",1039846685:"IFCSTAIRFLIGHTTYPE",3112655638:"IFCSTACKTERMINALTYPE",3812236995:"IFCSPACETYPE",652456506:"IFCSPACEPROGRAM",1305183839:"IFCSPACEHEATERTYPE",3856911033:"IFCSPACE",2533589738:"IFCSLABTYPE",4097777520:"IFCSITE",4105383287:"IFCSERVICELIFE",3517283431:"IFCSCHEDULETIMECONTROL",1768891740:"IFCSANITARYTERMINALTYPE",2863920197:"IFCRELASSIGNSTASKS",160246688:"IFCRELAGGREGATES",2324767716:"IFCRAMPFLIGHTTYPE",2893384427:"IFCRAILINGTYPE",3248260540:"IFCRADIUSDIMENSION",2250791053:"IFCPUMPTYPE",1842657554:"IFCPROTECTIVEDEVICETYPE",3651124850:"IFCPROJECTIONELEMENT",3642467123:"IFCPROJECTORDERRECORD",2904328755:"IFCPROJECTORDER",2744685151:"IFCPROCEDURE",3740093272:"IFCPORT",3724593414:"IFCPOLYLINE",4017108033:"IFCPLATETYPE",4231323485:"IFCPIPESEGMENTTYPE",804291784:"IFCPIPEFITTINGTYPE",3327091369:"IFCPERMIT",2382730787:"IFCPERFORMANCEHISTORY",2837617999:"IFCOUTLETTYPE",3425660407:"IFCORDERACTION",3588315303:"IFCOPENINGELEMENT",4143007308:"IFCOCCUPANT",1916936684:"IFCMOVE",977012517:"IFCMOTORCONNECTIONTYPE",3181161470:"IFCMEMBERTYPE",2108223431:"IFCMECHANICALFASTENERTYPE",377706215:"IFCMECHANICALFASTENER",2506943328:"IFCLINEARDIMENSION",1161773419:"IFCLIGHTFIXTURETYPE",1051575348:"IFCLAMPTYPE",3827777499:"IFCLABORRESOURCE",4288270099:"IFCJUNCTIONBOXTYPE",2391368822:"IFCINVENTORY",1806887404:"IFCHUMIDIFIERTYPE",1251058090:"IFCHEATEXCHANGERTYPE",2706460486:"IFCGROUP",3009204131:"IFCGRID",200128114:"IFCGASTERMINALTYPE",814719939:"IFCFURNITURESTANDARD",263784265:"IFCFURNISHINGELEMENT",3009222698:"IFCFLOWTREATMENTDEVICETYPE",2297155007:"IFCFLOWTERMINALTYPE",1339347760:"IFCFLOWSTORAGEDEVICETYPE",1834744321:"IFCFLOWSEGMENTTYPE",1482959167:"IFCFLOWMOVINGDEVICETYPE",3815607619:"IFCFLOWMETERTYPE",3198132628:"IFCFLOWFITTINGTYPE",3907093117:"IFCFLOWCONTROLLERTYPE",1287392070:"IFCFEATUREELEMENTSUBTRACTION",2143335405:"IFCFEATUREELEMENTADDITION",2827207264:"IFCFEATUREELEMENT",2489546625:"IFCFASTENERTYPE",647756555:"IFCFASTENER",3737207727:"IFCFACETEDBREPWITHVOIDS",807026263:"IFCFACETEDBREP",3390157468:"IFCEVAPORATORTYPE",3174744832:"IFCEVAPORATIVECOOLERTYPE",3272907226:"IFCEQUIPMENTSTANDARD",1962604670:"IFCEQUIPMENTELEMENT",2107101300:"IFCENERGYCONVERSIONDEVICETYPE",1704287377:"IFCELLIPSE",2590856083:"IFCELEMENTCOMPONENTTYPE",1623761950:"IFCELEMENTCOMPONENT",4123344466:"IFCELEMENTASSEMBLY",1758889154:"IFCELEMENT",360485395:"IFCELECTRICALBASEPROPERTIES",3849074793:"IFCDISTRIBUTIONFLOWELEMENTTYPE",3256556792:"IFCDISTRIBUTIONELEMENTTYPE",681481545:"IFCDIMENSIONCURVEDIRECTEDCALLOUT",1457835157:"IFCCURTAINWALLTYPE",3295246426:"IFCCREWRESOURCE",1916426348:"IFCCOVERINGTYPE",1419761937:"IFCCOSTSCHEDULE",3895139033:"IFCCOSTITEM",3293443760:"IFCCONTROL",2559216714:"IFCCONSTRUCTIONRESOURCE",2510884976:"IFCCONIC",3732776249:"IFCCOMPOSITECURVE",300633059:"IFCCOLUMNTYPE",2937912522:"IFCCIRCLEHOLLOWPROFILEDEF",3124254112:"IFCBUILDINGSTOREY",1950629157:"IFCBUILDINGELEMENTTYPE",4031249490:"IFCBUILDING",1260505505:"IFCBOUNDEDCURVE",3649129432:"IFCBOOLEANCLIPPINGRESULT",1334484129:"IFCBLOCK",3207858831:"IFCASYMMETRICISHAPEPROFILEDEF",1674181508:"IFCANNOTATION",2296667514:"IFCACTOR",2097647324:"IFCTRANSPORTELEMENTTYPE",3473067441:"IFCTASK",1580310250:"IFCSYSTEMFURNITUREELEMENTTYPE",4124788165:"IFCSURFACEOFREVOLUTION",2809605785:"IFCSURFACEOFLINEAREXTRUSION",2028607225:"IFCSURFACECURVESWEPTAREASOLID",4070609034:"IFCSTRUCTUREDDIMENSIONCALLOUT",2218152070:"IFCSTRUCTURALSURFACEMEMBERVARYING",3979015343:"IFCSTRUCTURALSURFACEMEMBER",3689010777:"IFCSTRUCTURALREACTION",530289379:"IFCSTRUCTURALMEMBER",3136571912:"IFCSTRUCTURALITEM",3544373492:"IFCSTRUCTURALACTIVITY",451544542:"IFCSPHERE",3893378262:"IFCSPATIALSTRUCTUREELEMENTTYPE",2706606064:"IFCSPATIALSTRUCTUREELEMENT",3626867408:"IFCRIGHTCIRCULARCYLINDER",4158566097:"IFCRIGHTCIRCULARCONE",1856042241:"IFCREVOLVEDAREASOLID",2914609552:"IFCRESOURCE",1401173127:"IFCRELVOIDSELEMENT",3451746338:"IFCRELSPACEBOUNDARY",366585022:"IFCRELSERVICESBUILDINGS",4122056220:"IFCRELSEQUENCE",1058617721:"IFCRELSCHEDULESCOSTITEMS",1245217292:"IFCRELREFERENCEDINSPATIALSTRUCTURE",750771296:"IFCRELPROJECTSELEMENT",202636808:"IFCRELOVERRIDESPROPERTIES",2051452291:"IFCRELOCCUPIESSPACES",3268803585:"IFCRELNESTS",4189434867:"IFCRELINTERACTIONREQUIREMENTS",279856033:"IFCRELFLOWCONTROLELEMENTS",3940055652:"IFCRELFILLSELEMENT",781010003:"IFCRELDEFINESBYTYPE",4186316022:"IFCRELDEFINESBYPROPERTIES",693640335:"IFCRELDEFINES",2551354335:"IFCRELDECOMPOSES",2802773753:"IFCRELCOVERSSPACES",886880790:"IFCRELCOVERSBLDGELEMENTS",3242617779:"IFCRELCONTAINEDINSPATIALSTRUCTURE",3678494232:"IFCRELCONNECTSWITHREALIZINGELEMENTS",504942748:"IFCRELCONNECTSWITHECCENTRICITY",1638771189:"IFCRELCONNECTSSTRUCTURALMEMBER",3912681535:"IFCRELCONNECTSSTRUCTURALELEMENT",2127690289:"IFCRELCONNECTSSTRUCTURALACTIVITY",3190031847:"IFCRELCONNECTSPORTS",4201705270:"IFCRELCONNECTSPORTTOELEMENT",3945020480:"IFCRELCONNECTSPATHELEMENTS",1204542856:"IFCRELCONNECTSELEMENTS",826625072:"IFCRELCONNECTS",2851387026:"IFCRELASSOCIATESPROFILEPROPERTIES",2655215786:"IFCRELASSOCIATESMATERIAL",3840914261:"IFCRELASSOCIATESLIBRARY",982818633:"IFCRELASSOCIATESDOCUMENT",2728634034:"IFCRELASSOCIATESCONSTRAINT",919958153:"IFCRELASSOCIATESCLASSIFICATION",4095574036:"IFCRELASSOCIATESAPPROVAL",1327628568:"IFCRELASSOCIATESAPPLIEDVALUE",1865459582:"IFCRELASSOCIATES",205026976:"IFCRELASSIGNSTORESOURCE",3372526763:"IFCRELASSIGNSTOPROJECTORDER",2857406711:"IFCRELASSIGNSTOPRODUCT",4278684876:"IFCRELASSIGNSTOPROCESS",1307041759:"IFCRELASSIGNSTOGROUP",2495723537:"IFCRELASSIGNSTOCONTROL",1683148259:"IFCRELASSIGNSTOACTOR",3939117080:"IFCRELASSIGNS",3454111270:"IFCRECTANGULARTRIMMEDSURFACE",2798486643:"IFCRECTANGULARPYRAMID",2770003689:"IFCRECTANGLEHOLLOWPROFILEDEF",3219374653:"IFCPROXY",1451395588:"IFCPROPERTYSET",4194566429:"IFCPROJECTIONCURVE",103090709:"IFCPROJECT",4208778838:"IFCPRODUCT",2945172077:"IFCPROCESS",220341763:"IFCPLANE",603570806:"IFCPLANARBOX",3566463478:"IFCPERMEABLECOVERINGPROPERTIES",3505215534:"IFCOFFSETCURVE3D",3388369263:"IFCOFFSETCURVE2D",3888040117:"IFCOBJECT",1425443689:"IFCMANIFOLDSOLIDBREP",1281925730:"IFCLINE",572779678:"IFCLSHAPEPROFILEDEF",1484403080:"IFCISHAPEPROFILEDEF",987898635:"IFCGEOMETRICCURVESET",1268542332:"IFCFURNITURETYPE",4238390223:"IFCFURNISHINGELEMENTTYPE",3455213021:"IFCFLUIDFLOWPROPERTIES",315944413:"IFCFILLAREASTYLETILES",4203026998:"IFCFILLAREASTYLETILESYMBOLWITHSTYLE",374418227:"IFCFILLAREASTYLEHATCHING",2047409740:"IFCFACEBASEDSURFACEMODEL",477187591:"IFCEXTRUDEDAREASOLID",80994333:"IFCENERGYPROPERTIES",2835456948:"IFCELLIPSEPROFILEDEF",2777663545:"IFCELEMENTARYSURFACE",339256511:"IFCELEMENTTYPE",1883228015:"IFCELEMENTQUANTITY",1472233963:"IFCEDGELOOP",4006246654:"IFCDRAUGHTINGPREDEFINEDCURVEFONT",445594917:"IFCDRAUGHTINGPREDEFINEDCOLOUR",3073041342:"IFCDRAUGHTINGCALLOUT",526551008:"IFCDOORSTYLE",1714330368:"IFCDOORPANELPROPERTIES",2963535650:"IFCDOORLININGPROPERTIES",32440307:"IFCDIRECTION",4054601972:"IFCDIMENSIONCURVETERMINATOR",606661476:"IFCDIMENSIONCURVE",693772133:"IFCDEFINEDSYMBOL",2827736869:"IFCCURVEBOUNDEDPLANE",2601014836:"IFCCURVE",2147822146:"IFCCSGSOLID",2506170314:"IFCCSGPRIMITIVE3D",194851669:"IFCCRANERAILFSHAPEPROFILEDEF",4133800736:"IFCCRANERAILASHAPEPROFILEDEF",2485617015:"IFCCOMPOSITECURVESEGMENT",2205249479:"IFCCLOSEDSHELL",1383045692:"IFCCIRCLEPROFILEDEF",1416205885:"IFCCARTESIANTRANSFORMATIONOPERATOR3DNONUNIFORM",3331915920:"IFCCARTESIANTRANSFORMATIONOPERATOR3D",3486308946:"IFCCARTESIANTRANSFORMATIONOPERATOR2DNONUNIFORM",3749851601:"IFCCARTESIANTRANSFORMATIONOPERATOR2D",59481748:"IFCCARTESIANTRANSFORMATIONOPERATOR",1123145078:"IFCCARTESIANPOINT",2898889636:"IFCCSHAPEPROFILEDEF",2713105998:"IFCBOXEDHALFSPACE",2581212453:"IFCBOUNDINGBOX",4182860854:"IFCBOUNDEDSURFACE",2736907675:"IFCBOOLEANRESULT",2740243338:"IFCAXIS2PLACEMENT3D",3125803723:"IFCAXIS2PLACEMENT2D",4261334040:"IFCAXIS1PLACEMENT",1302238472:"IFCANNOTATIONSURFACE",2265737646:"IFCANNOTATIONFILLAREAOCCURRENCE",669184980:"IFCANNOTATIONFILLAREA",3288037868:"IFCANNOTATIONCURVEOCCURRENCE",2543172580:"IFCZSHAPEPROFILEDEF",1299126871:"IFCWINDOWSTYLE",512836454:"IFCWINDOWPANELPROPERTIES",336235671:"IFCWINDOWLININGPROPERTIES",2759199220:"IFCVERTEXLOOP",1417489154:"IFCVECTOR",427810014:"IFCUSHAPEPROFILEDEF",2347495698:"IFCTYPEPRODUCT",1628702193:"IFCTYPEOBJECT",1345879162:"IFCTWODIRECTIONREPEATFACTOR",2715220739:"IFCTRAPEZIUMPROFILEDEF",3124975700:"IFCTEXTLITERALWITHEXTENT",4282788508:"IFCTEXTLITERAL",3028897424:"IFCTERMINATORSYMBOL",3071757647:"IFCTSHAPEPROFILEDEF",230924584:"IFCSWEPTSURFACE",1260650574:"IFCSWEPTDISKSOLID",2247615214:"IFCSWEPTAREASOLID",1878645084:"IFCSURFACESTYLERENDERING",2513912981:"IFCSURFACE",2233826070:"IFCSUBEDGE",3653947884:"IFCSTRUCTURALSTEELPROFILEPROPERTIES",3843319758:"IFCSTRUCTURALPROFILEPROPERTIES",1190533807:"IFCSTRUCTURALLOADSINGLEFORCEWARPING",1597423693:"IFCSTRUCTURALLOADSINGLEFORCE",1973038258:"IFCSTRUCTURALLOADSINGLEDISPLACEMENTDISTORTION",2473145415:"IFCSTRUCTURALLOADSINGLEDISPLACEMENT",2668620305:"IFCSTRUCTURALLOADPLANARFORCE",1595516126:"IFCSTRUCTURALLOADLINEARFORCE",390701378:"IFCSPACETHERMALLOADPROPERTIES",1202362311:"IFCSOUNDVALUE",2485662743:"IFCSOUNDPROPERTIES",723233188:"IFCSOLIDMODEL",2609359061:"IFCSLIPPAGECONNECTIONCONDITION",4124623270:"IFCSHELLBASEDSURFACEMODEL",2411513650:"IFCSERVICELIFEFACTOR",1509187699:"IFCSECTIONEDSPINE",2778083089:"IFCROUNDEDRECTANGLEPROFILEDEF",478536968:"IFCRELATIONSHIP",3765753017:"IFCREINFORCEMENTDEFINITIONPROPERTIES",3413951693:"IFCREGULARTIMESERIES",3615266464:"IFCRECTANGLEPROFILEDEF",110355661:"IFCPROPERTYTABLEVALUE",3650150729:"IFCPROPERTYSINGLEVALUE",3357820518:"IFCPROPERTYSETDEFINITION",941946838:"IFCPROPERTYREFERENCEVALUE",2752243245:"IFCPROPERTYLISTVALUE",4166981789:"IFCPROPERTYENUMERATEDVALUE",1680319473:"IFCPROPERTYDEFINITION",871118103:"IFCPROPERTYBOUNDEDVALUE",673634403:"IFCPRODUCTDEFINITIONSHAPE",179317114:"IFCPREDEFINEDPOINTMARKERSYMBOL",433424934:"IFCPREDEFINEDDIMENSIONSYMBOL",2559016684:"IFCPREDEFINEDCURVEFONT",759155922:"IFCPREDEFINEDCOLOUR",2775532180:"IFCPOLYGONALBOUNDEDHALFSPACE",2924175390:"IFCPOLYLOOP",1423911732:"IFCPOINTONSURFACE",4022376103:"IFCPOINTONCURVE",2067069095:"IFCPOINT",1663979128:"IFCPLANAREXTENT",2004835150:"IFCPLACEMENT",597895409:"IFCPIXELTEXTURE",3021840470:"IFCPHYSICALCOMPLEXQUANTITY",2519244187:"IFCPATH",2529465313:"IFCPARAMETERIZEDPROFILEDEF",1029017970:"IFCORIENTEDEDGE",2665983363:"IFCOPENSHELL",2833995503:"IFCONEDIRECTIONREPEATFACTOR",219451334:"IFCOBJECTDEFINITION",1430189142:"IFCMECHANICALCONCRETEMATERIALPROPERTIES",2022407955:"IFCMATERIALDEFINITIONREPRESENTATION",2347385850:"IFCMAPPEDITEM",1008929658:"IFCLOOP",2624227202:"IFCLOCALPLACEMENT",3422422726:"IFCLIGHTSOURCESPOT",1520743889:"IFCLIGHTSOURCEPOSITIONAL",4266656042:"IFCLIGHTSOURCEGONIOMETRIC",2604431987:"IFCLIGHTSOURCEDIRECTIONAL",125510826:"IFCLIGHTSOURCEAMBIENT",1402838566:"IFCLIGHTSOURCE",3741457305:"IFCIRREGULARTIMESERIES",3905492369:"IFCIMAGETEXTURE",2445078500:"IFCHYGROSCOPICMATERIALPROPERTIES",812098782:"IFCHALFSPACESOLID",178086475:"IFCGRIDPLACEMENT",3590301190:"IFCGEOMETRICSET",4142052618:"IFCGEOMETRICREPRESENTATIONSUBCONTEXT",2453401579:"IFCGEOMETRICREPRESENTATIONITEM",3448662350:"IFCGEOMETRICREPRESENTATIONCONTEXT",1446786286:"IFCGENERALPROFILEPROPERTIES",803998398:"IFCGENERALMATERIALPROPERTIES",3857492461:"IFCFUELPROPERTIES",738692330:"IFCFILLAREASTYLE",4219587988:"IFCFAILURECONNECTIONCONDITION",3008276851:"IFCFACESURFACE",803316827:"IFCFACEOUTERBOUND",1809719519:"IFCFACEBOUND",2556980723:"IFCFACE",1860660968:"IFCEXTENDEDMATERIALPROPERTIES",476780140:"IFCEDGECURVE",3900360178:"IFCEDGE",4170525392:"IFCDRAUGHTINGPREDEFINEDTEXTFONT",3732053477:"IFCDOCUMENTREFERENCE",1694125774:"IFCDIMENSIONPAIR",2273265877:"IFCDIMENSIONCALLOUTRELATIONSHIP",3632507154:"IFCDERIVEDPROFILEDEF",3800577675:"IFCCURVESTYLE",2889183280:"IFCCONVERSIONBASEDUNIT",3050246964:"IFCCONTEXTDEPENDENTUNIT",45288368:"IFCCONNECTIONPOINTECCENTRICITY",1981873012:"IFCCONNECTIONCURVEGEOMETRY",370225590:"IFCCONNECTEDFACESET",1485152156:"IFCCOMPOSITEPROFILEDEF",2542286263:"IFCCOMPLEXPROPERTY",776857604:"IFCCOLOURRGB",647927063:"IFCCLASSIFICATIONREFERENCE",3150382593:"IFCCENTERLINEPROFILEDEF",616511568:"IFCBLOBTEXTURE",2705031697:"IFCARBITRARYPROFILEDEFWITHVOIDS",1310608509:"IFCARBITRARYOPENPROFILEDEF",3798115385:"IFCARBITRARYCLOSEDPROFILEDEF",2297822566:"IFCANNOTATIONTEXTOCCURRENCE",3612888222:"IFCANNOTATIONSYMBOLOCCURRENCE",962685235:"IFCANNOTATIONSURFACEOCCURRENCE",2442683028:"IFCANNOTATIONOCCURRENCE",1065908215:"IFCWATERPROPERTIES",891718957:"IFCVIRTUALGRIDINTERSECTION",1907098498:"IFCVERTEXPOINT",3304826586:"IFCVERTEXBASEDTEXTUREMAP",2799835756:"IFCVERTEX",180925521:"IFCUNITASSIGNMENT",1735638870:"IFCTOPOLOGYREPRESENTATION",1377556343:"IFCTOPOLOGICALREPRESENTATIONITEM",581633288:"IFCTIMESERIESVALUE",1718945513:"IFCTIMESERIESREFERENCERELATIONSHIP",3101149627:"IFCTIMESERIES",3317419933:"IFCTHERMALMATERIALPROPERTIES",1210645708:"IFCTEXTUREVERTEX",2552916305:"IFCTEXTUREMAP",1742049831:"IFCTEXTURECOORDINATEGENERATOR",280115917:"IFCTEXTURECOORDINATE",1484833681:"IFCTEXTSTYLEWITHBOXCHARACTERISTICS",1640371178:"IFCTEXTSTYLETEXTMODEL",2636378356:"IFCTEXTSTYLEFORDEFINEDFONT",1983826977:"IFCTEXTSTYLEFONTMODEL",1447204868:"IFCTEXTSTYLE",912023232:"IFCTELECOMADDRESS",531007025:"IFCTABLEROW",985171141:"IFCTABLE",1290481447:"IFCSYMBOLSTYLE",626085974:"IFCSURFACETEXTURE",1351298697:"IFCSURFACESTYLEWITHTEXTURES",846575682:"IFCSURFACESTYLESHADING",1607154358:"IFCSURFACESTYLEREFRACTION",3303107099:"IFCSURFACESTYLELIGHTING",1300840506:"IFCSURFACESTYLE",3049322572:"IFCSTYLEDREPRESENTATION",3958052878:"IFCSTYLEDITEM",2830218821:"IFCSTYLEMODEL",3408363356:"IFCSTRUCTURALLOADTEMPERATURE",2525727697:"IFCSTRUCTURALLOADSTATIC",2162789131:"IFCSTRUCTURALLOAD",2273995522:"IFCSTRUCTURALCONNECTIONCONDITION",3692461612:"IFCSIMPLEPROPERTY",4240577450:"IFCSHAPEREPRESENTATION",3982875396:"IFCSHAPEMODEL",867548509:"IFCSHAPEASPECT",4165799628:"IFCSECTIONREINFORCEMENTPROPERTIES",2042790032:"IFCSECTIONPROPERTIES",448429030:"IFCSIUNIT",2341007311:"IFCROOT",3679540991:"IFCRIBPLATEPROFILEPROPERTIES",1660063152:"IFCREPRESENTATIONMAP",3008791417:"IFCREPRESENTATIONITEM",3377609919:"IFCREPRESENTATIONCONTEXT",1076942058:"IFCREPRESENTATION",1222501353:"IFCRELAXATION",1580146022:"IFCREINFORCEMENTBARPROPERTIES",2692823254:"IFCREFERENCESVALUEDOCUMENT",825690147:"IFCQUANTITYWEIGHT",2405470396:"IFCQUANTITYVOLUME",3252649465:"IFCQUANTITYTIME",931644368:"IFCQUANTITYLENGTH",2093928680:"IFCQUANTITYCOUNT",2044713172:"IFCQUANTITYAREA",3710013099:"IFCPROPERTYENUMERATION",148025276:"IFCPROPERTYDEPENDENCYRELATIONSHIP",3896028662:"IFCPROPERTYCONSTRAINTRELATIONSHIP",2598011224:"IFCPROPERTY",2802850158:"IFCPROFILEPROPERTIES",3958567839:"IFCPROFILEDEF",2267347899:"IFCPRODUCTSOFCOMBUSTIONPROPERTIES",2095639259:"IFCPRODUCTREPRESENTATION",2417041796:"IFCPRESENTATIONSTYLEASSIGNMENT",3119450353:"IFCPRESENTATIONSTYLE",1304840413:"IFCPRESENTATIONLAYERWITHSTYLE",2022622350:"IFCPRESENTATIONLAYERASSIGNMENT",1775413392:"IFCPREDEFINEDTEXTFONT",3213052703:"IFCPREDEFINEDTERMINATORSYMBOL",990879717:"IFCPREDEFINEDSYMBOL",3727388367:"IFCPREDEFINEDITEM",3355820592:"IFCPOSTALADDRESS",2226359599:"IFCPHYSICALSIMPLEQUANTITY",2483315170:"IFCPHYSICALQUANTITY",101040310:"IFCPERSONANDORGANIZATION",2077209135:"IFCPERSON",1207048766:"IFCOWNERHISTORY",1411181986:"IFCORGANIZATIONRELATIONSHIP",4251960020:"IFCORGANIZATION",1227763645:"IFCOPTICALMATERIALPROPERTIES",2251480897:"IFCOBJECTIVE",3701648758:"IFCOBJECTPLACEMENT",1918398963:"IFCNAMEDUNIT",2706619895:"IFCMONETARYUNIT",3368373690:"IFCMETRIC",677618848:"IFCMECHANICALSTEELMATERIALPROPERTIES",4256014907:"IFCMECHANICALMATERIALPROPERTIES",2597039031:"IFCMEASUREWITHUNIT",3265635763:"IFCMATERIALPROPERTIES",2199411900:"IFCMATERIALLIST",1303795690:"IFCMATERIALLAYERSETUSAGE",3303938423:"IFCMATERIALLAYERSET",248100487:"IFCMATERIALLAYER",1847130766:"IFCMATERIALCLASSIFICATIONRELATIONSHIP",1838606355:"IFCMATERIAL",30780891:"IFCLOCALTIME",1566485204:"IFCLIGHTINTENSITYDISTRIBUTION",4162380809:"IFCLIGHTDISTRIBUTIONDATA",3452421091:"IFCLIBRARYREFERENCE",2655187982:"IFCLIBRARYINFORMATION",3020489413:"IFCIRREGULARTIMESERIESVALUE",852622518:"IFCGRIDAXIS",3548104201:"IFCEXTERNALLYDEFINEDTEXTFONT",3207319532:"IFCEXTERNALLYDEFINEDSYMBOL",1040185647:"IFCEXTERNALLYDEFINEDSURFACESTYLE",2242383968:"IFCEXTERNALLYDEFINEDHATCHSTYLE",3200245327:"IFCEXTERNALREFERENCE",1648886627:"IFCENVIRONMENTALIMPACTVALUE",3796139169:"IFCDRAUGHTINGCALLOUTRELATIONSHIP",770865208:"IFCDOCUMENTINFORMATIONRELATIONSHIP",1154170062:"IFCDOCUMENTINFORMATION",1376555844:"IFCDOCUMENTELECTRONICFORMAT",2949456006:"IFCDIMENSIONALEXPONENTS",1045800335:"IFCDERIVEDUNITELEMENT",1765591967:"IFCDERIVEDUNIT",1072939445:"IFCDATEANDTIME",3510044353:"IFCCURVESTYLEFONTPATTERN",2367409068:"IFCCURVESTYLEFONTANDSCALING",1105321065:"IFCCURVESTYLEFONT",539742890:"IFCCURRENCYRELATIONSHIP",602808272:"IFCCOSTVALUE",1065062679:"IFCCOORDINATEDUNIVERSALTIMEOFFSET",347226245:"IFCCONSTRAINTRELATIONSHIP",613356794:"IFCCONSTRAINTCLASSIFICATIONRELATIONSHIP",1658513725:"IFCCONSTRAINTAGGREGATIONRELATIONSHIP",1959218052:"IFCCONSTRAINT",2732653382:"IFCCONNECTIONSURFACEGEOMETRY",4257277454:"IFCCONNECTIONPORTGEOMETRY",2614616156:"IFCCONNECTIONPOINTGEOMETRY",2859738748:"IFCCONNECTIONGEOMETRY",3264961684:"IFCCOLOURSPECIFICATION",3639012971:"IFCCLASSIFICATIONNOTATIONFACET",938368621:"IFCCLASSIFICATIONNOTATION",1098599126:"IFCCLASSIFICATIONITEMRELATIONSHIP",1767535486:"IFCCLASSIFICATIONITEM",747523909:"IFCCLASSIFICATION",622194075:"IFCCALENDARDATE",2069777674:"IFCBOUNDARYNODECONDITIONWARPING",1387855156:"IFCBOUNDARYNODECONDITION",3367102660:"IFCBOUNDARYFACECONDITION",1560379544:"IFCBOUNDARYEDGECONDITION",4037036970:"IFCBOUNDARYCONDITION",3869604511:"IFCAPPROVALRELATIONSHIP",390851274:"IFCAPPROVALPROPERTYRELATIONSHIP",2080292479:"IFCAPPROVALACTORRELATIONSHIP",130549933:"IFCAPPROVAL",1110488051:"IFCAPPLIEDVALUERELATIONSHIP",411424972:"IFCAPPLIEDVALUE",639542469:"IFCAPPLICATION",618182010:"IFCADDRESS",3630933823:"IFCACTORROLE",599546466:"FILE_DESCRIPTION",1390159747:"FILE_NAME",1109904537:"FILE_SCHEMA"};class xt{static async getUnits(s){var n,r,a;const{IFCUNITASSIGNMENT:t}=D,e=await s.getAllPropertiesOfType(t);if(!e)return 1;const i=Object.keys(e),o=e[parseInt(i[0],10)];for(const c of o.Units){if(c.value===void 0||c.value===null)continue;const h=await s.getProperties(c.value);if(!h||!h.UnitType||!h.UnitType.value||h.UnitType.value!=="LENGTHUNIT")continue;let d=1,I=1;return h.Name.value==="METRE"&&(I=1),h.Name.value==="FOOT"&&(I=.3048),((n=h.Prefix)==null?void 0:n.value)==="MILLI"?d=.001:((r=h.Prefix)==null?void 0:r.value)==="CENTI"?d=.01:((a=h.Prefix)==null?void 0:a.value)==="DECI"&&(d=.1),I*d}return 1}static async findItemByGuid(s,t){var i;const e=s.getAllPropertiesIDs();for(const o of e){const n=await s.getProperties(o);if(n&&((i=n.GlobalId)==null?void 0:i.value)===t)return n}return null}static async getRelationMap(s,t,e){var a;const o=e??(async()=>{}),n={},r=s.getAllPropertiesIDs();for(const c of r){const h=await s.getProperties(c);if(!h)continue;const E=h.type===t,d=Object.keys(h).find(m=>m.startsWith("Relating")),I=Object.keys(h).find(m=>m.startsWith("Related"));if(!(E&&d&&I))continue;const f=await s.getProperties((a=h[d])==null?void 0:a.value),T=h[I];if(!f||!T||!(T&&Array.isArray(T)))continue;const F=T.map(m=>m.value);await o(f.expressID,F),n[f.expressID]=F}return n}static async getQsetQuantities(s,t,e){const o=e??(()=>{}),n=await s.getProperties(t);return!n||n.type!==D.IFCELEMENTQUANTITY?null:(n.Quantities??[{}]).map(c=>(c.value&&o(c.value),c.value)).filter(c=>c!==null)}static async getPsetProps(s,t,e){const o=e??(()=>{}),n=await s.getProperties(t);return!n||n.type!==D.IFCPROPERTYSET?null:(n.HasProperties??[{}]).map(c=>(c.value&&o(c.value),c.value)).filter(c=>c!==null)}static async getPsetRel(s,t){var r;if(!await s.getProperties(t))return null;const i=await s.getAllPropertiesOfType(D.IFCRELDEFINESBYPROPERTIES);if(!i)return null;const o=Object.values(i);let n=null;for(const a of o)((r=a.RelatingPropertyDefinition)==null?void 0:r.value)===t&&(n=a.expressID);return n}static async getQsetRel(s,t){return xt.getPsetRel(s,t)}static async getEntityName(s,t){var n;const e=await s.getProperties(t);if(!e)return{key:null,name:null};const i=Object.keys(e).find(r=>r.endsWith("Name"))??null,o=i?(n=e[i])==null?void 0:n.value:null;return{key:i,name:o}}static async getQuantityValue(s,t){const e=await s.getProperties(t);if(!e)return{key:null,value:null};const i=Object.keys(e).find(n=>n.endsWith("Value"))??null;let o;return i===null||e[i]===void 0||e[i]===null?o=null:o=e[i].value,{key:i,value:o}}static isRel(s){return Pi[s].startsWith("IFCREL")}static async attributeExists(s,t,e){const i=await s.getProperties(t);return i?Object.keys(i).includes(e):!1}static async groupEntitiesByType(s,t){var i;const e=new Map;for(const o of t){const n=await s.getProperties(o);if(!n)continue;const r=n.type;e.get(r)||e.set(r,new Set),(i=e.get(r))==null||i.add(o)}return e}}class Ur{constructor(){u(this,"factor",1);u(this,"complement",1)}apply(s){const e=this.getScaleMatrix().multiply(s);s.copy(e)}setUp(s){var o,n,r;this.factor=1;const t=this.getLengthUnits(s);if(!t)return;const e=t==null,i=t.Name===void 0||t.Name===null;e||i||(t.Name.value==="FOOT"&&(this.factor=.3048),((o=t.Prefix)==null?void 0:o.value)==="MILLI"?this.complement=.001:((n=t.Prefix)==null?void 0:n.value)==="CENTI"?this.complement=.01:((r=t.Prefix)==null?void 0:r.value)==="DECI"&&(this.complement=.01))}getLengthUnits(s){try{const e=s.GetLineIDsWithType(0,D.IFCUNITASSIGNMENT).get(0),i=s.GetLine(0,e);for(const o of i.Units){if(!o||o.value===null||o.value===void 0)continue;const n=s.GetLine(0,o.value);if(n.UnitType&&n.UnitType.value==="LENGTHUNIT")return n}return null}catch{return console.log("Could not get units"),null}}getScaleMatrix(){const s=this.factor;return new g.Matrix4().fromArray([s,0,0,0,0,s,0,0,0,0,s,0,0,0,0,1])}}class Gn{constructor(){u(this,"itemsByFloor",{});u(this,"_units",new Ur)}setUp(s){this._units.setUp(s),this.cleanUp();try{const t=s.GetLineIDsWithType(0,D.IFCRELCONTAINEDINSPATIALSTRUCTURE),e=new Set,i=s.GetLineIDsWithType(0,D.IFCSPACE);for(let c=0;c<i.size();c++)e.add(i.get(c));const o=s.GetLineIDsWithType(0,D.IFCRELAGGREGATES),n=o.size();for(let c=0;c<n;c++){const h=o.get(c),E=s.GetLine(0,h);if(!E||!E.RelatingObject||!E.RelatedObjects)continue;const d=E.RelatingObject.value,I=E.RelatedObjects;for(const f of I){const T=f.value;e.has(T)&&(this.itemsByFloor[T]=d)}}const r={},a=t.size();for(let c=0;c<a;c++){const h=t.get(c),E=s.GetLine(0,h);if(!E||!E.RelatingStructure||!E.RelatedElements)continue;const d=E.RelatingStructure.value,I=E.RelatedElements;if(e.has(d))for(const f of I){r[d]||(r[d]=[]);const T=f.value;r[d].push(T)}else for(const f of I){const T=f.value;this.itemsByFloor[T]=d}}for(const c in r){const h=this.itemsByFloor[c];if(h!==void 0){const E=r[c];for(const d of E)this.itemsByFloor[d]=h}}for(let c=0;c<n;c++){const h=o.get(c),E=s.GetLine(0,h);if(!E||!E.RelatingObject||!E.RelatedObjects)continue;const d=E.RelatingObject.value,I=E.RelatedObjects;for(const f of I){const T=f.value,F=this.itemsByFloor[d];F!==void 0&&(this.itemsByFloor[T]=F)}}}catch{console.log("Could not get floors.")}}cleanUp(){this.itemsByFloor={}}}class Ds{constructor(){u(this,"includeProperties",!0);u(this,"optionalCategories",[D.IFCSPACE]);u(this,"coordinate",!0);u(this,"wasm",{path:"",absolute:!1,logLevel:D.LogLevel.LOG_LEVEL_OFF});u(this,"excludedCategories",new Set);u(this,"includedCategories",new Set);u(this,"saveLocations",!1);u(this,"webIfc",{COORDINATE_TO_ORIGIN:!0});u(this,"autoSetWasm",!0);u(this,"customLocateFileHandler",null)}}class zn{constructor(){u(this,"defLineMat",new g.LineBasicMaterial({color:16777215}))}read(s){const t=s.GetAllAlignments(0),e=s.GetAllCrossSections2D(0),i=s.GetAllCrossSections3D(0),o={IfcAlignment:t,IfcCrossSection2D:e,IfcCrossSection3D:i};return this.get(o)}get(s){if(s.IfcAlignment){const t=new Map;for(const e of s.IfcAlignment){const i=new Dt.Alignment;i.absolute=this.getCurves(e.curve3D,i),i.horizontal=this.getCurves(e.horizontal,i),i.vertical=this.getCurves(e.vertical,i),t.set(t.size,i)}return{alignments:t,coordinationMatrix:new g.Matrix4}}}getCurves(s,t){const e=[];let i=0;for(const o of s){const n={};if(o.data)for(const d of o.data){const[I,f]=d.split(": "),T=parseFloat(f);n[I]=T||f}const{points:r}=o,a=new Float32Array(r.length*3);for(let d=0;d<r.length;d++){const{x:I,y:f,z:T}=r[d];a[d*3]=I,a[d*3+1]=f,a[d*3+2]=T||0}const c=new g.BufferAttribute(a,3),h=new g.EdgesGeometry;h.setAttribute("position",c);const E=new Dt.CurveMesh(i,n,t,h,this.defLineMat);e.push(E.curve),i++}return e}}class Hn{getNameInfo(s){var E;const t={},{arguments:e}=s.GetHeaderLine(0,D.FILE_NAME)||{};if(!e)return t;const[i,o,n,r,a,c,h]=e;if(i!=null&&i.value&&(t.name=i.value),o!=null&&o.value&&(t.creationDate=new Date(o.value)),n){t.author={};const[d,I]=n;d!=null&&d.value&&(t.author.name=d.value),I!=null&&I.value&&(t.author.email=I.value)}return(E=r[0])!=null&&E.value&&(t.organization=r[0].value),a!=null&&a.value&&(t.preprocessorVersion=a==null?void 0:a.value),c!=null&&c.value&&(t.originatingSystem=c==null?void 0:c.value),h!=null&&h.value&&(t.authorization=h==null?void 0:h.value),t}getDescriptionInfo(s){var n;const t={},{arguments:e}=s.GetHeaderLine(0,D.FILE_DESCRIPTION)||{};if(!e)return t;const[i,o]=e;if((n=i[0])!=null&&n.value){const r=i[0].value.match(/\[([^\]]+)\]/);r&&r[1]&&(t.viewDefinition=r[1])}return o!=null&&o.value&&(t.implementationLevel=o.value),t}}class Wn{static get(s,t){const e=[D.IFCPROJECT,D.IFCSITE,D.IFCBUILDING,D.IFCBUILDINGSTOREY,D.IFCSPACE,D.IFCROAD,D.IFCFACILITY,D.IFCFACILITYPART,D.IFCBRIDGE],i=s.data;for(const o of e){const n=t.GetLineIDsWithType(0,o),r=n.size();for(let a=0;a<r;a++){const c=n.get(a);i.has(c)||i.set(c,[[],[0,o]])}}}}const xe=class xe extends ${constructor(t){super(t);u(this,"onDisposed",new M);u(this,"onIfcStartedLoading",new M);u(this,"onSetup",new M);u(this,"settings",new Ds);u(this,"webIfc",new D.IfcAPI);u(this,"enabled",!0);u(this,"_material",new g.MeshLambertMaterial);u(this,"_spatialTree",new Gn);u(this,"_metaData",new Hn);u(this,"_fragmentInstances",new Map);u(this,"_civil",new zn);u(this,"_visitedFragments",new Map);u(this,"_materialT",new g.MeshLambertMaterial({transparent:!0,opacity:.5}));this.components.add(xe.uuid,this),this.settings.excludedCategories.add(D.IFCOPENINGELEMENT)}dispose(){this.webIfc=null,this.onDisposed.trigger(xe.uuid),this.onDisposed.reset()}async setup(t){this.settings={...this.settings,...t},this.settings.autoSetWasm&&await this.autoSetWasm(),this.onSetup.trigger()}async load(t,e=!0){const i=performance.now();this.onIfcStartedLoading.trigger(),await this.readIfcFile(t);const o=await this.getAllGeometries(),r=await this.components.get(us).export(this.webIfc,0);o.setLocalProperties(r);const a=this.components.get(ot);a.groups.set(o.uuid,o);for(const c of o.items)a.list.set(c.id,c),c.mesh.uuid=c.id,c.group=o;a.onFragmentsLoaded.trigger(o),e&&a.coordinate([o]);for(const[c]of o.data){const h=r[c];if(!h||!h.GlobalId)continue;const E=h.GlobalId.value||h.GlobalId;o.globalToExpressIDs.set(E,c)}return Wn.get(o,this.webIfc),this.cleanUp(),console.log(`Streaming the IFC took ${performance.now()-i} ms!`),o}async readIfcFile(t){const{path:e,absolute:i,logLevel:o}=this.settings.wasm;return this.webIfc.SetWasmPath(e,i),await this.webIfc.Init(this.settings.customLocateFileHandler||void 0),o&&this.webIfc.SetLogLevel(o),this.webIfc.OpenModel(t,this.settings.webIfc)}cleanUp(){try{this.webIfc.Dispose()}catch{console.log("Web-ifc wasn't disposed.")}this.webIfc=null,this.webIfc=new D.IfcAPI,this._visitedFragments.clear(),this._fragmentInstances.clear()}async getAllGeometries(){this._spatialTree.setUp(this.webIfc);const t=this.webIfc.GetIfcEntityList(0),e=new Dt.FragmentsGroup;e.ifcMetadata={name:"",description:"",...this._metaData.getNameInfo(this.webIfc),...this._metaData.getDescriptionInfo(this.webIfc),schema:this.webIfc.GetModelSchema(0)||"IFC2X3",maxExpressID:this.webIfc.GetMaxExpressID(0)};const i=[];for(const n of t){if(!this.webIfc.IsIfcElement(n)&&n!==D.IFCSPACE)continue;const r=this.settings.includedCategories;if(r.size>0&&!r.has(n))continue;if(this.settings.excludedCategories.has(n))continue;const a=this.webIfc.GetLineIDsWithType(0,n),c=a.size();for(let h=0;h<c;h++){const E=a.get(h);i.push(E);const d=this._spatialTree.itemsByFloor[E]||0;e.data.set(E,[[],[d,n]])}}this._spatialTree.cleanUp(),this.webIfc.StreamMeshes(0,i,n=>{this.getMesh(n,e)});for(const n of this._visitedFragments){const{index:r,fragment:a}=n[1];e.keyFragments.set(r,a.id)}for(const n of e.items){const r=this._fragmentInstances.get(n.id);if(!r)throw new Error("Fragment not found!");const a=[];for(const[c,h]of r)a.push(h);n.add(a)}const o=this.webIfc.GetCoordinationMatrix(0);return e.coordinationMatrix.fromArray(o),e.civilData=this._civil.read(this.webIfc),e}getMesh(t,e){const i=t.geometries.size(),o=t.expressID;for(let n=0;n<i;n++){const r=t.geometries.get(n),{x:a,y:c,z:h,w:E}=r.color,d=E!==1,{geometryExpressID:I}=r,f=`${I}-${d}`;if(!this._visitedFragments.has(f)){const R=this.getGeometry(this.webIfc,I),S=d?this._materialT:this._material,_=new Dt.Fragment(R,S,1);e.add(_.mesh),e.items.push(_);const y=this._visitedFragments.size;this._visitedFragments.set(f,{index:y,fragment:_})}const T=new g.Color().setRGB(a,c,h,"srgb"),F=new g.Matrix4;F.fromArray(r.flatTransformation);const m=this._visitedFragments.get(f);if(m===void 0)throw new Error("Error getting geometry data for streaming!");const A=e.data.get(o);if(!A)throw new Error("Data not found!");A[0].push(m.index);const{fragment:O}=m;this._fragmentInstances.has(O.id)||this._fragmentInstances.set(O.id,new Map);const p=this._fragmentInstances.get(O.id);if(!p)throw new Error("Instances not found!");if(p.has(o)){const R=p.get(o);if(!R)throw new Error("Instance not found!");R.transforms.push(F),R.colors&&R.colors.push(T)}else p.set(o,{id:o,transforms:[F],colors:[T]})}}getGeometry(t,e){const i=t.GetGeometry(0,e),o=t.GetIndexArray(i.GetIndexData(),i.GetIndexDataSize()),n=t.GetVertexArray(i.GetVertexData(),i.GetVertexDataSize()),r=new Float32Array(n.length/2),a=new Float32Array(n.length/2);for(let d=0;d<n.length;d+=6)r[d/2]=n[d],r[d/2+1]=n[d+1],r[d/2+2]=n[d+2],a[d/2]=n[d+3],a[d/2+1]=n[d+4],a[d/2+2]=n[d+5];const c=new g.BufferGeometry,h=new g.BufferAttribute(r,3),E=new g.BufferAttribute(a,3);return c.setAttribute("position",h),c.setAttribute("normal",E),c.setIndex(Array.from(o)),i.delete(),c}async autoSetWasm(){const t=await fetch(`https://unpkg.com/@thatopen/components@${hs.release}/package.json`);if(!t.ok){console.warn("Couldn't get openbim-components package.json. Set wasm settings manually.");return}const e=await t.json();if(!("web-ifc"in e.peerDependencies))console.warn("Couldn't get web-ifc from peer dependencies in openbim-components. Set wasm settings manually.");else{const i=e.peerDependencies["web-ifc"];this.settings.wasm.path=`https://unpkg.com/web-ifc@${i}/`,this.settings.wasm.absolute=!0}}};u(xe,"uuid","a659add7-1418-4771-a0d6-7d4d438e4624");let Is=xe;const wt=class wt extends ${constructor(t){super(t);u(this,"onDisposed",new M);u(this,"onRequestFile",new M);u(this,"ifcToExport",null);u(this,"onElementToPset",new M);u(this,"onPropToPset",new M);u(this,"onPsetRemoved",new M);u(this,"onDataChanged",new M);u(this,"wasm",{path:"/",absolute:!1});u(this,"enabled",!0);u(this,"attributeListeners",{});u(this,"selectedModel");u(this,"changeMap",{});this.components.add(wt.uuid,this)}dispose(){this.selectedModel=void 0,this.attributeListeners={},this.changeMap={},this.onElementToPset.reset(),this.onPropToPset.reset(),this.onPsetRemoved.reset(),this.onDataChanged.reset(),this.onDisposed.trigger(wt.uuid),this.onDisposed.reset()}static getIFCSchema(t){const e=t.ifcMetadata.schema;if(!e)throw new Error("IFC Schema not found");return e.startsWith("IFC2X3")?"IFC2X3":e.startsWith("IFC4")&&e.replace("IFC4","")===""?"IFC4":e.startsWith("IFC4X3")?"IFC4X3":e}async setData(t,...e){for(const i of e){const o=i.expressID;o&&(await t.setProperties(o,i),this.registerChange(t,o))}}async newPset(t,e,i){const o=wt.getIFCSchema(t),{ownerHistoryHandle:n}=await this.getOwnerHistory(t),r=this.newGUID(t),a=new D[o].IfcLabel(e),c=i?new D[o].IfcText(i):null,h=new D[o].IfcPropertySet(r,n,a,c,[]);h.expressID=this.increaseMaxID(t);const E=this.newGUID(t),d=new D[o].IfcRelDefinesByProperties(E,n,null,null,[],new D.Handle(h.expressID));return d.expressID=this.increaseMaxID(t),await this.setData(t,h,d),{pset:h,rel:d}}async removePset(t,...e){for(const i of e){const o=await t.getProperties(i);if((o==null?void 0:o.type)!==D.IFCPROPERTYSET)continue;const n=await xt.getPsetRel(t,i);if(n&&(await t.setProperties(n,null),this.registerChange(t,n)),o){for(const r of o.HasProperties)await t.setProperties(r.value,null);await t.setProperties(i,null),this.onPsetRemoved.trigger({model:t,psetID:i}),this.registerChange(t,i)}}}newSingleStringProperty(t,e,i,o){return this.newSingleProperty(t,e,i,o)}newSingleNumericProperty(t,e,i,o){return this.newSingleProperty(t,e,i,o)}newSingleBooleanProperty(t,e,i,o){return this.newSingleProperty(t,e,i,o)}async removePsetProp(t,e,i){const o=await t.getProperties(e),n=await t.getProperties(i);!o||!n||o.type===D.IFCPROPERTYSET&&n&&(o.HasProperties=o.HasProperties.filter(r=>r.value!==i),await t.setProperties(i,null),this.registerChange(t,e,i))}async addElementToPset(t,e,...i){const o=await xt.getPsetRel(t,e);if(!o)return;const n=await t.getProperties(o);if(!n)return;for(const a of i){const c=new D.Handle(a);n.RelatedObjects.push(c),this.onElementToPset.trigger({model:t,psetID:e,elementID:a})}this.registerChange(t,e);const r=this.components.get(Wt);for(const a of i)r.addEntityRelations(t,a,"IsDefinedBy",e)}async addPropToPset(t,e,...i){const o=await t.getProperties(e);if(o){for(const n of i){if(o.HasProperties.includes(n))continue;const r=new D.Handle(n);o.HasProperties.push(r),this.onPropToPset.trigger({model:t,psetID:e,propID:n})}this.registerChange(t,e)}}async saveToIfc(t,e){const i=this.components.get(Is),o=i.webIfc,n=await i.readIfcFile(e),r=this.changeMap[t.uuid]??[];for(const c of r){const h=await t.getProperties(c);if(h)try{o.WriteLine(n,h)}catch{}else try{o.DeleteLine(n,c)}catch{}}const a=o.SaveModel(n);return i.webIfc.CloseModel(n),i.cleanUp(),a}async setAttributeListener(t,e,i){this.attributeListeners[t.uuid]||(this.attributeListeners[t.uuid]={});const o=this.attributeListeners[t.uuid][e]?this.attributeListeners[t.uuid][e][i]:null;if(o)return o;const n=await t.getProperties(e);if(!n)throw new Error(`Entity with expressID ${e} doesn't exists.`);const r=n[i];if(Array.isArray(r)||!r)throw new Error(`Attribute ${i} is array or null, and it can't have a listener.`);const a=r.value;if(a===void 0||a==null)throw new Error(`Attribute ${i} has a badly defined handle.`);const c=new M;return Object.defineProperty(n[i],"value",{get(){return this._value},async set(h){this._value=h,c.trigger(h)}}),n[i].value=a,this.attributeListeners[t.uuid][e]||(this.attributeListeners[t.uuid][e]={}),this.attributeListeners[t.uuid][e][i]=c,c}increaseMaxID(t){return t.ifcMetadata.maxExpressID++,t.ifcMetadata.maxExpressID}newGUID(t){const e=wt.getIFCSchema(t);return new D[e].IfcGloballyUniqueId(ae.create())}async getOwnerHistory(t){const e=await t.getAllPropertiesOfType(D.IFCOWNERHISTORY);if(!e)throw new Error("No OwnerHistory was found.");const i=Object.keys(e).map(r=>parseInt(r,10)),o=e[i[0]],n=new D.Handle(o.expressID);return{ownerHistory:o,ownerHistoryHandle:n}}registerChange(t,...e){this.changeMap[t.uuid]||(this.changeMap[t.uuid]=new Set);for(const i of e)this.changeMap[t.uuid].add(i),this.onDataChanged.trigger({model:t,expressID:i})}async newSingleProperty(t,e,i,o){const n=wt.getIFCSchema(t),r=new D[n].IfcIdentifier(i),a=new D[n][e](o),c=new D[n].IfcPropertySingleValue(r,null,a,null);return c.expressID=this.increaseMaxID(t),await this.setData(t,c),c}};u(wt,"uuid","58c2d9f0-183c-48d6-a402-dfcf5b9a34df");let mi=wt;const gs=class gs extends ${constructor(t){super(t);u(this,"enabled",!0);u(this,"list",{});u(this,"onDisposed",new M);u(this,"onFragmentsDisposed",t=>{const{groupID:e,fragmentIDs:i}=t;for(const o in this.list){const n=this.list[o],r=Object.keys(n);if(r.includes(e))delete n[e],Object.values(n).length===0&&delete this.list[o];else for(const a of r){const c=n[a];for(const h of i)delete c.map[h];Object.values(c).length===0&&delete n[a]}}});t.add(gs.uuid,this),t.get(ot).onFragmentsDisposed.add(this.onFragmentsDisposed)}dispose(){this.list={},this.components.get(ot).onFragmentsDisposed.remove(this.onFragmentsDisposed),this.onDisposed.trigger(),this.onDisposed.reset()}remove(t){for(const e in this.list){const i=this.list[e];for(const o in i){const n=i[o];delete n.map[t]}}}find(t){const e=this.components.get(ot);if(!t){const r={};for(const[a,c]of e.list)r[a]=new Set(c.ids);return r}const i=Object.keys(t).length,o={};for(const r in t){const a=t[r];if(!this.list[r]){console.warn(`Classification ${r} does not exist.`);continue}for(const c of a){const h=this.list[r][c];if(h)for(const E in h.map){o[E]||(o[E]=new Map);for(const d of h.map[E]){const I=o[E].get(d);I===void 0?o[E].set(d,1):o[E].set(d,I+1)}}}}const n={};for(const r in o){const a=o[r];for(const[c,h]of a){if(h===void 0)throw new Error("Malformed fragments map!");h===i&&(n[r]||(n[r]=new Set),n[r].add(c))}}return n}byModel(t,e){this.list.models||(this.list.models={});const i=this.list.models;i[t]||(i[t]={map:{},id:null,name:t});const o=i[t];for(const[n,r]of e.data){const a=r[0];for(const c of a){const h=e.keyFragments.get(c);h&&(o.map[h]||(o.map[h]=new Set),o.map[h].add(n))}}}async byPredefinedType(t){var o;this.list.predefinedTypes||(this.list.predefinedTypes={});const e=this.list.predefinedTypes,i=t.getAllPropertiesIDs();for(const n of i){const r=await t.getProperties(n);if(!r)continue;const a=String((o=r.PredefinedType)==null?void 0:o.value).toUpperCase();e[a]||(e[a]={map:{},id:null,name:a});const c=e[a];for(const[h,E]of t.data){const d=E[0];for(const I of d){const f=t.keyFragments.get(I);if(!f)throw new Error("Fragment ID not found!");c.map[f]||(c.map[f]=new Set),c.map[f].add(r.expressID)}}}}byEntity(t){this.list.entities||(this.list.entities={});for(const[e,i]of t.data){const n=i[1][1],r=Pi[n];this.saveItem(t,"entities",r,e)}}async byIfcRel(t,e,i){xt.isRel(e)&&await xt.getRelationMap(t,e,async(o,n)=>{const{name:r}=await xt.getEntityName(t,o);for(const a of n)this.saveItem(t,i,r??"NO REL NAME",a)})}async bySpatialStructure(t,e={}){var c,h;const i=this.components.get(Wt),o=i.relationMaps[t.uuid];if(!o)throw new Error(`Classifier: model relations of ${t.name||t.uuid} have to exists to group by spatial structure.`);const n="spatialStructures",a=e.useProperties===void 0||e.useProperties;for(const[E]of o){if(e.isolate){const T=t.data.get(E);if(!T)continue;const F=T[1][1];if(F===void 0||!e.isolate.has(F))continue}const d=i.getEntityRelations(t,E,"Decomposes");if(d)for(const T of d){let F=T.toString();if(a){const m=await t.getProperties(T);if(!m)continue;F=(c=m.Name)==null?void 0:c.value}this.saveItem(t,n,F,E,T)}const I=i.getEntityRelations(t,E,"ContainsElements");if(!I)continue;let f=E.toString();if(a){const T=await t.getProperties(E);if(!T)continue;f=(h=T.Name)==null?void 0:h.value}for(const T of I){this.saveItem(t,n,f,T,E);const F=i.getEntityRelations(t,Number(T),"IsDecomposedBy");if(F)for(const m of F)this.saveItem(t,n,f,m,E)}}}setColor(t,e,i=!1){const o=this.components.get(ot);for(const n in t){const r=o.list.get(n);if(!r)continue;const a=t[n];r.setColor(e,a,i)}}resetColor(t){const e=this.components.get(ot);for(const i in t){const o=e.list.get(i);if(!o)continue;const n=t[i];o.resetColor(n)}}saveItem(t,e,i,o,n=null){this.list[e]||(this.list[e]={});const r=t.data.get(o);if(r)for(const a of r[0]){const c=t.keyFragments.get(a);if(c){const h=this.list[e];h[i]||(h[i]={map:{},id:n,name:i}),h[i].map[c]||(h[i].map[c]=new Set),h[i].map[c].add(o)}}}};u(gs,"uuid","e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7");let fs=gs;const Os=class Os extends ${constructor(t){super(t);u(this,"onDisposed",new M);u(this,"enabled",!0);u(this,"height",10);u(this,"groupName","spatialStructures");u(this,"list",new Set);t.add(Os.uuid,this)}dispose(){this.list.clear(),this.onDisposed.trigger(),this.onDisposed.reset()}set(t){if(!this.enabled)return;const e=this.components.get(fs),i=this.components.get(ot),o=t?1:-1;let n=0;const r=e.list[this.groupName],a=new g.Matrix4;for(const c in r){a.elements[13]=n*o*this.height;for(const h in r[c].map){const E=i.list.get(h),d=c+h,I=this.list.has(d);if(!E||t&&I||!t&&!I)continue;t?this.list.add(d):this.list.delete(d);const f=r[c].map[h];E.applyTransform(f,a),E.mesh.computeBoundingSphere(),E.mesh.computeBoundingBox()}n++}}};u(Os,"uuid","d260618b-ce88-4c7d-826c-6debb91de3e2");let Ri=Os;const Ss=class Ss extends ${constructor(t){super(t);u(this,"enabled",!0);this.components.add(Ss.uuid,this)}set(t,e){const i=this.components.get(ot);if(!e){for(const[o,n]of i.list)n&&(n.setVisibility(t),this.updateCulledVisibility(n));return}for(const o in e){const n=e[o],r=i.list.get(o);r&&(r.setVisibility(t,n),this.updateCulledVisibility(r))}}isolate(t){this.set(!1),this.set(!0,t)}updateCulledVisibility(t){const e=this.components.get(Es);for(const[i,o]of e.list){const n=o.colorMeshes.get(t.id);n&&(n.count=t.mesh.count)}}};u(Ss,"uuid","dd9ccf2d-8a21-4821-b7f6-2949add16a29");let Fi=Ss;class kn extends Ds{constructor(){super(...arguments);u(this,"minGeometrySize",10);u(this,"minAssetsSize",1e3)}}const _s=class _s extends ${constructor(t){super(t);u(this,"onGeometryStreamed",new M);u(this,"onAssetStreamed",new M);u(this,"onProgress",new M);u(this,"onIfcLoaded",new M);u(this,"onDisposed",new M);u(this,"settings",new kn);u(this,"enabled",!0);u(this,"webIfc",new D.IfcAPI);u(this,"_spatialTree",new Gn);u(this,"_metaData",new Hn);u(this,"_visitedGeometries",new Map);u(this,"_streamSerializer",new Dt.StreamSerializer);u(this,"_geometries",new Map);u(this,"_geometryCount",0);u(this,"_civil",new zn);u(this,"_groupSerializer",new Dt.Serializer);u(this,"_assets",[]);u(this,"_meshesWithHoles",new Set);this.components.add(_s.uuid,this),this.settings.excludedCategories.add(D.IFCOPENINGELEMENT)}dispose(){this.onIfcLoaded.reset(),this.onGeometryStreamed.reset(),this.onAssetStreamed.reset(),this.webIfc=null,this.onDisposed.trigger(),this.onDisposed.reset()}async streamFromBuffer(t){await this.readIfcFile(t),await this.streamAllGeometries(),this.cleanUp()}async streamFromCallBack(t){await this.streamIfcFile(t),await this.streamAllGeometries(),this.cleanUp()}async readIfcFile(t){const{path:e,absolute:i,logLevel:o}=this.settings.wasm;this.webIfc.SetWasmPath(e,i),await this.webIfc.Init(),o&&this.webIfc.SetLogLevel(o),this.webIfc.OpenModel(t,this.settings.webIfc)}async streamIfcFile(t){const{path:e,absolute:i,logLevel:o}=this.settings.wasm;this.webIfc.SetWasmPath(e,i),await this.webIfc.Init(),o&&this.webIfc.SetLogLevel(o),this.webIfc.OpenModelFromCallback(t,this.settings.webIfc)}async streamAllGeometries(){const{minGeometrySize:t,minAssetsSize:e}=this.settings;this._spatialTree.setUp(this.webIfc);const i=this.webIfc.GetIfcEntityList(0),o=[[]],n=new Dt.FragmentsGroup;n.ifcMetadata={name:"",description:"",...this._metaData.getNameInfo(this.webIfc),...this._metaData.getDescriptionInfo(this.webIfc),schema:this.webIfc.GetModelSchema(0)||"IFC2X3",maxExpressID:this.webIfc.GetMaxExpressID(0)};let r=0,a=0;for(const T of i){if(!this.webIfc.IsIfcElement(T)&&T!==D.IFCSPACE||this.settings.excludedCategories.has(T))continue;const F=this.webIfc.GetLineIDsWithType(0,T),m=F.size();for(let A=0;A<m;A++){r>t&&(r=0,a++,o.push([]));const O=F.get(A);o[a].push(O);const p=this.webIfc.GetLine(0,O);if(p.GlobalId){const S=(p==null?void 0:p.GlobalId.value)||(p==null?void 0:p.GlobalId);n.globalToExpressIDs.set(S,O)}const R=this._spatialTree.itemsByFloor[O]||0;n.data.set(O,[[],[R,T]]),r++}}this._spatialTree.cleanUp();let c=.01,h=0;for(const T of o){h++,this.webIfc.StreamMeshes(0,T,m=>{this.getMesh(this.webIfc,m,n)}),this._geometryCount>t&&await this.streamGeometries(),this._assets.length>e&&await this.streamAssets();const F=h/o.length;F>c&&(c+=.01,c=Math.max(c,F),this.onProgress.trigger(Math.round(c*100)/100))}this._geometryCount&&await this.streamGeometries(),this._assets.length&&await this.streamAssets();const{opaque:E,transparent:d}=n.geometryIDs;for(const[T,{index:F,uuid:m}]of this._visitedGeometries)n.keyFragments.set(F,m),(T>1?E:d).set(T,F);Wn.get(n,this.webIfc);const I=this.webIfc.GetCoordinationMatrix(0);n.coordinationMatrix.fromArray(I),n.civilData=this._civil.read(this.webIfc);const f=this._groupSerializer.export(n);this.onIfcLoaded.trigger(f),n.dispose(!0)}cleanUp(){try{this.webIfc.Dispose()}catch{}this.webIfc=null,this.webIfc=new D.IfcAPI,this._visitedGeometries.clear(),this._geometries.clear(),this._assets=[],this._meshesWithHoles.clear()}getMesh(t,e,i){const o=e.geometries.size(),n=e.expressID,r={id:n,geometries:[]};for(let a=0;a<o;a++){const c=e.geometries.get(a),h=c.geometryExpressID,E=c.color.w===1?1:-1,d=h*E;if(!this._visitedGeometries.has(d)){this._visitedGeometries.has(h)||this.getGeometry(t,h);const R=this._visitedGeometries.size,S=g.MathUtils.generateUUID();this._visitedGeometries.set(d,{uuid:S,index:R})}const I=this._visitedGeometries.get(d);if(I===void 0)throw new Error("Error getting geometry data for streaming!");const f=i.data.get(n);if(!f)throw new Error("Data not found!");f[0].push(I.index);const{x:T,y:F,z:m,w:A}=c.color,O=[T,F,m,A],p=c.flatTransformation;r.geometries.push({color:O,geometryID:h,transformation:p})}this._assets.push(r)}getGeometry(t,e){const i=t.GetGeometry(0,e),o=t.GetIndexArray(i.GetIndexData(),i.GetIndexDataSize()),n=t.GetVertexArray(i.GetVertexData(),i.GetVertexDataSize()),r=new Float32Array(n.length/2),a=new Float32Array(n.length/2);for(let I=0;I<n.length;I+=6)r[I/2]=n[I],r[I/2+1]=n[I+1],r[I/2+2]=n[I+2],a[I/2]=n[I+3],a[I/2+1]=n[I+4],a[I/2+2]=n[I+5];const c=On(r),h=new Float32Array(c.transformation.elements),E=[c.center.x,c.center.y,c.center.z];let d=!1;for(let I=0;I<r.length-2;I+=3){const f=r[I],T=r[I+1],F=r[I+2],m=a[I],A=a[I+1],O=a[I+2];if(Sn(E,[f,T,F],[m,A,O])){d=!0;break}}this._geometries.set(e,{position:r,normal:a,index:o,boundingBox:h,hasHoles:d}),i.delete(),this._geometryCount++}async streamAssets(){await this.onAssetStreamed.trigger(this._assets),this._assets=null,this._assets=[]}async streamGeometries(){let t=this._streamSerializer.export(this._geometries),e={};for(const[i,{boundingBox:o,hasHoles:n}]of this._geometries)e[i]={boundingBox:o,hasHoles:n};this.onGeometryStreamed.trigger({data:e,buffer:t}),e=null,t=null,this._geometries.clear(),this._geometryCount=0}};u(_s,"uuid","d9999a00-e1f5-4d3f-8cfe-c56e08609764");let Ai=_s;class Xn extends Ds{constructor(){super(...arguments);u(this,"propertiesSize",100)}}class Zn extends ${constructor(){super(...arguments);u(this,"onPropertiesStreamed",new Le);u(this,"onProgress",new Le);u(this,"onIndicesStreamed",new Le);u(this,"onDisposed",new M);u(this,"enabled",!0);u(this,"settings",new Xn);u(this,"webIfc",new D.IfcAPI)}async dispose(){this.onIndicesStreamed.reset(),this.onPropertiesStreamed.reset(),this.webIfc=null,this.onDisposed.reset()}async streamFromBuffer(t){await this.readIfcFile(t),await this.streamAllProperties(),this.cleanUp()}async streamFromCallBack(t){await this.streamIfcFile(t),await this.streamAllProperties(),this.cleanUp()}async readIfcFile(t){const{path:e,absolute:i,logLevel:o}=this.settings.wasm;this.webIfc.SetWasmPath(e,i),await this.webIfc.Init(),o&&this.webIfc.SetLogLevel(o),this.webIfc.OpenModel(t,this.settings.webIfc)}async streamIfcFile(t){const{path:e,absolute:i,logLevel:o}=this.settings.wasm;this.webIfc.SetWasmPath(e,i),await this.webIfc.Init(),o&&this.webIfc.SetLogLevel(o),this.webIfc.OpenModelFromCallback(t,this.settings.webIfc)}async streamAllProperties(){const{propertiesSize:t}=this.settings,e=new Set(this.webIfc.GetIfcEntityList(0)),i=new Set([D.IFCPROJECT,D.IFCSITE,D.IFCBUILDING,D.IFCBUILDINGSTOREY,D.IFCSPACE]);for(const c of i)e.add(c);let o=.01,n=0;for(const c of e){if(n++,Li.has(c))continue;const h=i.has(c),E=this.webIfc.GetLineIDsWithType(0,c),d=E.size();let I=0;for(let T=0;T<d-t;T+=t){const F={};for(let m=0;m<t;m++){I++;const A=E.get(T+m);try{const O=this.webIfc.GetLine(0,A,h);F[O.expressID]=O}catch{console.log(`Could not get property: ${A}`)}}await this.onPropertiesStreamed.trigger({type:c,data:F})}if(I!==d){const T={};for(let F=I;F<d;F++){const m=E.get(F);try{const A=this.webIfc.GetLine(0,m,h);T[A.expressID]=A}catch{console.log(`Could not get property: ${m}`)}}await this.onPropertiesStreamed.trigger({type:c,data:T})}n/e.size>o&&(o=Math.round(o*100)/100,await this.onProgress.trigger(o),o+=.01)}await this.onProgress.trigger(1);const a=await this.components.get(Wt).processFromWebIfc(this.webIfc,0);await this.onIndicesStreamed.trigger(a)}cleanUp(){this.webIfc.Dispose(),this.webIfc=null,this.webIfc=new D.IfcAPI}}u(Zn,"uuid","88d2c89c-ce32-47d7-8cb6-d51e4b311a0b");const ys=class ys extends ${constructor(t){super(t);u(this,"enabled",!0);t.add(ys.uuid,this)}static distanceFromPointToLine(t,e,i,o=!1){const n=new g.Line3,r=new g.Vector3;return n.set(e,i),n.closestPointToPoint(t,o,r),r.distanceTo(t)}getFace(t,e,i){if(!t.geometry.index)throw new Error("Geometry must be indexed!");const o=new Map,n=t.geometry.index.array,{plane:r}=this.getFaceData(e,i,t),a=[];for(let d=0;d<n.length/3;d++){const{plane:I,edges:f}=this.getFaceData(d,i,t);if(I.equals(r)){a.push({index:d,edges:f});for(const{id:T,points:F,distance:m}of f)o.set(T,{points:F,distance:m})}}let c=0;const h=new Map,E=new Map;for(const{index:d,edges:I}of a){const f=new Map;for(const{id:R}of I)if(h.has(R)){const S=h.get(R);f.set(R,S)}const T=I.map(R=>R.id);if(!f.size){const R=c++;for(const{id:S}of I)h.set(S,R);E.set(R,{edges:new Set(T),indices:new Set([d])});continue}let F=null;const m=new Set,A=new Set(T);for(const[R,S]of f){F===null?F=S:S!==F&&m.add(S),h.delete(R);const{edges:_}=E.get(S);_.delete(R),A.delete(R)}if(F===null)throw new Error("Error computing face!");const O=E.get(F),{indices:p}=O;p.add(d);for(const R of A){h.set(R,F);const{edges:S}=O;S.add(R)}for(const R of m){const S=E.get(R),{edges:_,indices:y}=S,N=E.get(F),{edges:P,indices:x}=N;for(const w of _)P.add(w),h.set(w,F);for(const w of y)x.add(w);E.delete(R)}}for(const[d,{indices:I,edges:f}]of E)if(I.has(e)){const T=[];for(const F of f){const m=o.get(F);T.push(m)}return{edges:T,indices:I}}return null}getVerticesAndNormal(t,e,i){if(!t.geometry.index)throw new Error("Geometry must be indexed!");const o=t.geometry.index.array,n=t.geometry.attributes.position.array,r=t.geometry.attributes.normal.array,a=o[e*3]*3,c=o[e*3+1]*3,h=o[e*3+2]*3,E=new g.Vector3(n[a],n[a+1],n[a+2]),d=new g.Vector3(n[c],n[c+1],n[c+2]),I=new g.Vector3(n[h],n[h+1],n[h+2]),f=new g.Vector3(r[a],r[a+1],r[a+2]),T=new g.Vector3(r[c],r[c+1],r[c+2]),F=new g.Vector3(r[h],r[h+1],r[h+2]),m=(f.x+T.x+F.x)/3,A=(f.y+T.y+F.y)/3,O=(f.z+T.z+F.z)/3,p=new g.Vector3(m,A,O);if(i!==void 0&&t instanceof g.InstancedMesh){const R=new g.Matrix4;t.getMatrixAt(i,R);const S=new g.Matrix4;S.extractRotation(R),p.applyMatrix4(S),E.applyMatrix4(R),d.applyMatrix4(R),I.applyMatrix4(R)}return{p1:E,p2:d,p3:I,faceNormal:p}}round(t){t.x=Math.trunc(t.x*1e3)/1e3,t.y=Math.trunc(t.y*1e3)/1e3,t.z=Math.trunc(t.z*1e3)/1e3}getVolumeFromFragments(t){const e=this.components.get(ot),i=new g.Matrix4,o=[];for(const r in t){const a=e.list.get(r);if(!a)continue;const c=t[r];let h=0;for(const I of c){const f=a.getInstancesIDs(I);f&&(h+=f.size)}const E=new g.InstancedMesh(a.mesh.geometry,void 0,h);let d=0;for(const I of c){const f=a.getInstancesIDs(I);if(f)for(const T of f)a.mesh.getMatrixAt(T,i),E.setMatrixAt(d++,i)}o.push(E)}const n=this.getVolumeFromMeshes(o);for(const r of o)r.geometry=null,r.material=[],r.dispose();return n}getVolumeFromMeshes(t){let e=0;for(const i of t)e+=this.getVolumeOfMesh(i);return e}getFaceData(t,e,i){const o=this.getVerticesAndNormal(i,t,e),{p1:n,p2:r,p3:a,faceNormal:c}=o;this.round(n),this.round(r),this.round(a),this.round(c);const h=[{id:`${n.x}|${n.y}|${n.z}`,value:n},{id:`${r.x}|${r.y}|${r.z}`,value:r},{id:`${a.x}|${a.y}|${a.z}`,value:a}];h.sort((O,p)=>O.id<p.id?-1:O.id>p.id?1:0);const[{id:E,value:d},{id:I,value:f},{id:T,value:F}]=h,m=[{id:`${E}|${I}`,distance:d.distanceTo(f),points:[d,f]},{id:`${I}|${T}`,distance:f.distanceTo(F),points:[f,F]},{id:`${E}|${T}`,distance:d.distanceTo(F),points:[d,F]}],A=new g.Plane;return A.setFromNormalAndCoplanarPoint(c,n),A.constant=Math.round(A.constant*10)/10,{plane:A,edges:m}}getVolumeOfMesh(t){let e=0;const i=new g.Vector3,o=new g.Vector3,n=new g.Vector3,{index:r}=t.geometry,a=t.geometry.attributes.position.array;if(!r)return console.warn("Geometry must be indexed to compute its volume!"),0;const c=[];if(t instanceof g.InstancedMesh)for(let E=0;E<t.count;E++){const d=new g.Matrix4;t.getMatrixAt(E,d),c.push(d)}else c.push(new g.Matrix4().identity());const{matrixWorld:h}=t;for(let E=0;E<r.array.length-2;E+=3)for(const d of c){const I=d.multiply(h),f=r.array[E]*3,T=r.array[E+1]*3,F=r.array[E+2]*3;i.set(a[f],a[f+1],a[f+2]).applyMatrix4(I),o.set(a[T],a[T+1],a[T+2]).applyMatrix4(I),n.set(a[F],a[F+1],a[F+2]).applyMatrix4(I),e+=this.getSignedVolumeOfTriangle(i,o,n)}return Math.abs(e)}getSignedVolumeOfTriangle(t,e,i){const o=i.x*e.y*t.z,n=e.x*i.y*t.z,r=i.x*t.y*e.z,a=t.x*i.y*e.z,c=e.x*t.y*i.z,h=t.x*e.y*i.z;return 1/6*(-o+n+r-a-c+h)}};u(ys,"uuid","267ca032-672f-4cb0-afa9-d24e904f39d6");let gi=ys;exports.AsyncEvent=Le;exports.Base=Ps;exports.BaseCamera=Fn;exports.BaseRenderer=An;exports.BaseScene=gn;exports.BaseWorldItem=ws;exports.BoundingBoxer=Ti;exports.Classifier=fs;exports.Clipper=pi;exports.Component=$;exports.Components=hs;exports.CullerRenderer=Pn;exports.Cullers=Es;exports.DataMap=di;exports.DataSet=or;exports.Disposer=_t;exports.Event=M;exports.Exploder=Ri;exports.FirstPersonMode=bn;exports.FragmentsManager=ot;exports.GeometryTypes=Li;exports.Grids=fi;exports.Hider=Fi;exports.IfcCategories=xr;exports.IfcCategoryMap=Pi;exports.IfcElements=Yn;exports.IfcFragmentSettings=Ds;exports.IfcGeometryTiler=Ai;exports.IfcJsonExporter=us;exports.IfcLoader=Is;exports.IfcPropertiesManager=mi;exports.IfcPropertiesTiler=Zn;exports.IfcPropertiesUtils=xt;exports.IfcRelationsIndexer=Wt;exports.IfcStreamingSettings=kn;exports.MaterialsUtils=Ii;exports.MeasurementUtils=gi;exports.MeshCullerRenderer=wn;exports.MiniMap=Un;exports.MiniMaps=Ci;exports.Mouse=Mn;exports.OrbitMode=vn;exports.OrthoPerspectiveCamera=Mr;exports.PlanMode=Bn;exports.ProjectionManager=Vn;exports.PropertiesStreamingSettings=Xn;exports.Raycasters=le;exports.ShadowedScene=gr;exports.SimpleCamera=ce;exports.SimpleGrid=xn;exports.SimplePlane=Ms;exports.SimpleRaycaster=Dn;exports.SimpleRenderer=fr;exports.SimpleScene=yn;exports.SimpleWorld=_n;exports.UUID=ae;exports.VertexPicker=Ir;exports.Worlds=ds;exports.isPointInFrontOfPlane=Sn;exports.obbFromPoints=On;exports.readPixelsAsync=Ni;
|
|
128
|
+
`,extensions:{derivatives:!0}});this.three=new D.Mesh(l,c),this.three.frustumCulled=!1,t.scene.three.add(this.three),this.setupEvents(!0)}get visible(){return this.three.visible}set visible(e){e?this.world.scene.three.add(this.three):this.three.removeFromParent()}get material(){return this.three.material}get fade(){return this._fade===3}set fade(e){this._fade=e?3:0,this.material.uniforms.uFade.value=this._fade}dispose(){this.setupEvents(!1),this.components.get(Pe).destroy(this.three),this.onDisposed.trigger(),this.onDisposed.reset(),this.world=null,this.components=null}setupEvents(e){if(this.world.isDisposing||!(this.world.camera instanceof Gi))return;const t=this.world.camera.controls;e?t.addEventListener("update",this.updateZoom):t.removeEventListener("update",this.updateZoom)}}const _r=class _r extends Ot{constructor(t){super(t);y(this,"list",new Map);y(this,"config",{color:new D.Color(12303291),size1:1,size2:10,distance:500});y(this,"onDisposed",new K);y(this,"enabled",!0);t.add(_r.uuid,this)}create(t){if(this.list.has(t.uuid))throw new Error("This world already has a grid!");const i=new zc(this.components,t,this.config);return this.list.set(t.uuid,i),t.onDisposed.add(()=>{this.delete(t)}),i}delete(t){const i=this.list.get(t.uuid);i&&i.dispose(),this.list.delete(t.uuid)}dispose(){for(const[t,i]of this.list)i.dispose();this.list.clear(),this.onDisposed.trigger(),this.onDisposed.reset()}};y(_r,"uuid","d1e814d5-b81c-4452-87a2-f039375e0489");let Go=_r;const ri=new F.Raycaster,Vt=new F.Vector3,Be=new F.Vector3,St=new F.Quaternion,gl={X:new F.Vector3(1,0,0),Y:new F.Vector3(0,1,0),Z:new F.Vector3(0,0,1)},Co={type:"change"},El={type:"mouseDown"},bl={type:"mouseUp",mode:null},Il={type:"objectChange"};class If extends F.Object3D{constructor(e,t){super(),t===void 0&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),t=document),this.isTransformControls=!0,this.visible=!1,this.domElement=t,this.domElement.style.touchAction="none";const i=new wf;this._gizmo=i,this.add(i);const s=new Af;this._plane=s,this.add(s);const n=this;function o(I,T){let b=T;Object.defineProperty(n,I,{get:function(){return b!==void 0?b:T},set:function(v){b!==v&&(b=v,s[I]=v,i[I]=v,n.dispatchEvent({type:I+"-changed",value:v}),n.dispatchEvent(Co))}}),n[I]=T,s[I]=T,i[I]=T}o("camera",e),o("object",void 0),o("enabled",!0),o("axis",null),o("mode","translate"),o("translationSnap",null),o("rotationSnap",null),o("scaleSnap",null),o("space","world"),o("size",1),o("dragging",!1),o("showX",!0),o("showY",!0),o("showZ",!0);const a=new F.Vector3,l=new F.Vector3,c=new F.Quaternion,h=new F.Quaternion,d=new F.Vector3,u=new F.Quaternion,f=new F.Vector3,p=new F.Vector3,m=new F.Vector3,E=0,g=new F.Vector3;o("worldPosition",a),o("worldPositionStart",l),o("worldQuaternion",c),o("worldQuaternionStart",h),o("cameraPosition",d),o("cameraQuaternion",u),o("pointStart",f),o("pointEnd",p),o("rotationAxis",m),o("rotationAngle",E),o("eye",g),this._offset=new F.Vector3,this._startNorm=new F.Vector3,this._endNorm=new F.Vector3,this._cameraScale=new F.Vector3,this._parentPosition=new F.Vector3,this._parentQuaternion=new F.Quaternion,this._parentQuaternionInv=new F.Quaternion,this._parentScale=new F.Vector3,this._worldScaleStart=new F.Vector3,this._worldQuaternionInv=new F.Quaternion,this._worldScale=new F.Vector3,this._positionStart=new F.Vector3,this._quaternionStart=new F.Quaternion,this._scaleStart=new F.Vector3,this._getPointer=Cf.bind(this),this._onPointerDown=_f.bind(this),this._onPointerHover=yf.bind(this),this._onPointerMove=Tf.bind(this),this._onPointerUp=vf.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(){this.object!==void 0&&(this.object.updateMatrixWorld(),this.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld(this)}pointerHover(e){if(this.object===void 0||this.dragging===!0)return;ri.setFromCamera(e,this.camera);const t=yo(this._gizmo.picker[this.mode],ri);t?this.axis=t.object.name:this.axis=null}pointerDown(e){if(!(this.object===void 0||this.dragging===!0||e.button!==0)&&this.axis!==null){ri.setFromCamera(e,this.camera);const t=yo(this._plane,ri,!0);t&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(t.point).sub(this.worldPositionStart)),this.dragging=!0,El.mode=this.mode,this.dispatchEvent(El)}}pointerMove(e){const t=this.axis,i=this.mode,s=this.object;let n=this.space;if(i==="scale"?n="local":(t==="E"||t==="XYZE"||t==="XYZ")&&(n="world"),s===void 0||t===null||this.dragging===!1||e.button!==-1)return;ri.setFromCamera(e,this.camera);const o=yo(this._plane,ri,!0);if(o){if(this.pointEnd.copy(o.point).sub(this.worldPositionStart),i==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),n==="local"&&t!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),t.indexOf("X")===-1&&(this._offset.x=0),t.indexOf("Y")===-1&&(this._offset.y=0),t.indexOf("Z")===-1&&(this._offset.z=0),n==="local"&&t!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),s.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(n==="local"&&(s.position.applyQuaternion(St.copy(this._quaternionStart).invert()),t.search("X")!==-1&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.position.applyQuaternion(this._quaternionStart)),n==="world"&&(s.parent&&s.position.add(Vt.setFromMatrixPosition(s.parent.matrixWorld)),t.search("X")!==-1&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.parent&&s.position.sub(Vt.setFromMatrixPosition(s.parent.matrixWorld))));else if(i==="scale"){if(t.search("XYZ")!==-1){let a=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(a*=-1),Be.set(a,a,a)}else Vt.copy(this.pointStart),Be.copy(this.pointEnd),Vt.applyQuaternion(this._worldQuaternionInv),Be.applyQuaternion(this._worldQuaternionInv),Be.divide(Vt),t.search("X")===-1&&(Be.x=1),t.search("Y")===-1&&(Be.y=1),t.search("Z")===-1&&(Be.z=1);s.scale.copy(this._scaleStart).multiply(Be),this.scaleSnap&&(t.search("X")!==-1&&(s.scale.x=Math.round(s.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Y")!==-1&&(s.scale.y=Math.round(s.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Z")!==-1&&(s.scale.z=Math.round(s.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(i==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const a=20/this.worldPosition.distanceTo(Vt.setFromMatrixPosition(this.camera.matrixWorld));let l=!1;t==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(Vt.copy(this.rotationAxis).cross(this.eye))*a):(t==="X"||t==="Y"||t==="Z")&&(this.rotationAxis.copy(gl[t]),Vt.copy(gl[t]),n==="local"&&Vt.applyQuaternion(this.worldQuaternion),Vt.cross(this.eye),Vt.length()===0?l=!0:this.rotationAngle=this._offset.dot(Vt.normalize())*a),(t==="E"||l)&&(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),n==="local"&&t!=="E"&&t!=="XYZE"?(s.quaternion.copy(this._quaternionStart),s.quaternion.multiply(St.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),s.quaternion.copy(St.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),s.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(Co),this.dispatchEvent(Il)}}pointerUp(e){e.button===0&&(this.dragging&&this.axis!==null&&(bl.mode=this.mode,this.dispatchEvent(bl)),this.dragging=!1,this.axis=null)}dispose(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse(function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})}attach(e){return this.object=e,this.visible=!0,this}detach(){return this.object=void 0,this.visible=!1,this.axis=null,this}reset(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(Co),this.dispatchEvent(Il),this.pointStart.copy(this.pointEnd))}getRaycaster(){return ri}getMode(){return this.mode}setMode(e){this.mode=e}setTranslationSnap(e){this.translationSnap=e}setRotationSnap(e){this.rotationSnap=e}setScaleSnap(e){this.scaleSnap=e}setSize(e){this.size=e}setSpace(e){this.space=e}}function Cf(r){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:r.button};{const e=this.domElement.getBoundingClientRect();return{x:(r.clientX-e.left)/e.width*2-1,y:-(r.clientY-e.top)/e.height*2+1,button:r.button}}}function yf(r){if(this.enabled)switch(r.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(r));break}}function _f(r){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(r.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(r)),this.pointerDown(this._getPointer(r)))}function Tf(r){this.enabled&&this.pointerMove(this._getPointer(r))}function vf(r){this.enabled&&(this.domElement.releasePointerCapture(r.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(r)))}function yo(r,e,t){const i=e.intersectObject(r,!0);for(let s=0;s<i.length;s++)if(i[s].object.visible||t)return i[s];return!1}const Ln=new F.Euler,_t=new F.Vector3(0,1,0),Cl=new F.Vector3(0,0,0),yl=new F.Matrix4,Mn=new F.Quaternion,Gn=new F.Quaternion,Ce=new F.Vector3,_l=new F.Matrix4,Fs=new F.Vector3(1,0,0),ci=new F.Vector3(0,1,0),Os=new F.Vector3(0,0,1),Dn=new F.Vector3,Ts=new F.Vector3,vs=new F.Vector3;class wf extends F.Object3D{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const e=new F.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),t=new F.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),i=e.clone();i.opacity=.15;const s=t.clone();s.opacity=.5;const n=e.clone();n.color.setHex(16711680);const o=e.clone();o.color.setHex(65280);const a=e.clone();a.color.setHex(255);const l=e.clone();l.color.setHex(16711680),l.opacity=.5;const c=e.clone();c.color.setHex(65280),c.opacity=.5;const h=e.clone();h.color.setHex(255),h.opacity=.5;const d=e.clone();d.opacity=.25;const u=e.clone();u.color.setHex(16776960),u.opacity=.25,e.clone().color.setHex(16776960);const p=e.clone();p.color.setHex(7895160);const m=new F.CylinderGeometry(0,.04,.1,12);m.translate(0,.05,0);const E=new F.BoxGeometry(.08,.08,.08);E.translate(0,.04,0);const g=new F.BufferGeometry;g.setAttribute("position",new F.Float32BufferAttribute([0,0,0,1,0,0],3));const I=new F.CylinderGeometry(.0075,.0075,.5,3);I.translate(0,.25,0);function T(U,q){const G=new F.TorusGeometry(U,.0075,3,64,q*Math.PI*2);return G.rotateY(Math.PI/2),G.rotateX(Math.PI/2),G}function b(){const U=new F.BufferGeometry;return U.setAttribute("position",new F.Float32BufferAttribute([0,0,0,1,1,1],3)),U}const v={X:[[new F.Mesh(m,n),[.5,0,0],[0,0,-Math.PI/2]],[new F.Mesh(m,n),[-.5,0,0],[0,0,Math.PI/2]],[new F.Mesh(I,n),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new F.Mesh(m,o),[0,.5,0]],[new F.Mesh(m,o),[0,-.5,0],[Math.PI,0,0]],[new F.Mesh(I,o)]],Z:[[new F.Mesh(m,a),[0,0,.5],[Math.PI/2,0,0]],[new F.Mesh(m,a),[0,0,-.5],[-Math.PI/2,0,0]],[new F.Mesh(I,a),null,[Math.PI/2,0,0]]],XYZ:[[new F.Mesh(new F.OctahedronGeometry(.1,0),d.clone()),[0,0,0]]],XY:[[new F.Mesh(new F.BoxGeometry(.15,.15,.01),h.clone()),[.15,.15,0]]],YZ:[[new F.Mesh(new F.BoxGeometry(.15,.15,.01),l.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new F.Mesh(new F.BoxGeometry(.15,.15,.01),c.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},A={X:[[new F.Mesh(new F.CylinderGeometry(.2,0,.6,4),i),[.3,0,0],[0,0,-Math.PI/2]],[new F.Mesh(new F.CylinderGeometry(.2,0,.6,4),i),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new F.Mesh(new F.CylinderGeometry(.2,0,.6,4),i),[0,.3,0]],[new F.Mesh(new F.CylinderGeometry(.2,0,.6,4),i),[0,-.3,0],[0,0,Math.PI]]],Z:[[new F.Mesh(new F.CylinderGeometry(.2,0,.6,4),i),[0,0,.3],[Math.PI/2,0,0]],[new F.Mesh(new F.CylinderGeometry(.2,0,.6,4),i),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new F.Mesh(new F.OctahedronGeometry(.2,0),i)]],XY:[[new F.Mesh(new F.BoxGeometry(.2,.2,.01),i),[.15,.15,0]]],YZ:[[new F.Mesh(new F.BoxGeometry(.2,.2,.01),i),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new F.Mesh(new F.BoxGeometry(.2,.2,.01),i),[.15,0,.15],[-Math.PI/2,0,0]]]},S={START:[[new F.Mesh(new F.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],END:[[new F.Mesh(new F.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],DELTA:[[new F.Line(b(),s),null,null,null,"helper"]],X:[[new F.Line(g,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new F.Line(g,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new F.Line(g,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},N={XYZE:[[new F.Mesh(T(.5,1),p),null,[0,Math.PI/2,0]]],X:[[new F.Mesh(T(.5,.5),n)]],Y:[[new F.Mesh(T(.5,.5),o),null,[0,0,-Math.PI/2]]],Z:[[new F.Mesh(T(.5,.5),a),null,[0,Math.PI/2,0]]],E:[[new F.Mesh(T(.75,1),u),null,[0,Math.PI/2,0]]]},R={AXIS:[[new F.Line(g,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},P={XYZE:[[new F.Mesh(new F.SphereGeometry(.25,10,8),i)]],X:[[new F.Mesh(new F.TorusGeometry(.5,.1,4,24),i),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new F.Mesh(new F.TorusGeometry(.5,.1,4,24),i),[0,0,0],[Math.PI/2,0,0]]],Z:[[new F.Mesh(new F.TorusGeometry(.5,.1,4,24),i),[0,0,0],[0,0,-Math.PI/2]]],E:[[new F.Mesh(new F.TorusGeometry(.75,.1,2,24),i)]]},M={X:[[new F.Mesh(E,n),[.5,0,0],[0,0,-Math.PI/2]],[new F.Mesh(I,n),[0,0,0],[0,0,-Math.PI/2]],[new F.Mesh(E,n),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new F.Mesh(E,o),[0,.5,0]],[new F.Mesh(I,o)],[new F.Mesh(E,o),[0,-.5,0],[0,0,Math.PI]]],Z:[[new F.Mesh(E,a),[0,0,.5],[Math.PI/2,0,0]],[new F.Mesh(I,a),[0,0,0],[Math.PI/2,0,0]],[new F.Mesh(E,a),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new F.Mesh(new F.BoxGeometry(.15,.15,.01),h),[.15,.15,0]]],YZ:[[new F.Mesh(new F.BoxGeometry(.15,.15,.01),l),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new F.Mesh(new F.BoxGeometry(.15,.15,.01),c),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new F.Mesh(new F.BoxGeometry(.1,.1,.1),d.clone())]]},w={X:[[new F.Mesh(new F.CylinderGeometry(.2,0,.6,4),i),[.3,0,0],[0,0,-Math.PI/2]],[new F.Mesh(new F.CylinderGeometry(.2,0,.6,4),i),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new F.Mesh(new F.CylinderGeometry(.2,0,.6,4),i),[0,.3,0]],[new F.Mesh(new F.CylinderGeometry(.2,0,.6,4),i),[0,-.3,0],[0,0,Math.PI]]],Z:[[new F.Mesh(new F.CylinderGeometry(.2,0,.6,4),i),[0,0,.3],[Math.PI/2,0,0]],[new F.Mesh(new F.CylinderGeometry(.2,0,.6,4),i),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new F.Mesh(new F.BoxGeometry(.2,.2,.01),i),[.15,.15,0]]],YZ:[[new F.Mesh(new F.BoxGeometry(.2,.2,.01),i),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new F.Mesh(new F.BoxGeometry(.2,.2,.01),i),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new F.Mesh(new F.BoxGeometry(.2,.2,.2),i),[0,0,0]]]},L={X:[[new F.Line(g,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new F.Line(g,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new F.Line(g,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function C(U){const q=new F.Object3D;for(const G in U)for(let st=U[G].length;st--;){const Y=U[G][st][0].clone(),ot=U[G][st][1],$=U[G][st][2],B=U[G][st][3],at=U[G][st][4];Y.name=G,Y.tag=at,ot&&Y.position.set(ot[0],ot[1],ot[2]),$&&Y.rotation.set($[0],$[1],$[2]),B&&Y.scale.set(B[0],B[1],B[2]),Y.updateMatrix();const nt=Y.geometry.clone();nt.applyMatrix4(Y.matrix),Y.geometry=nt,Y.renderOrder=1/0,Y.position.set(0,0,0),Y.rotation.set(0,0,0),Y.scale.set(1,1,1),q.add(Y)}return q}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=C(v)),this.add(this.gizmo.rotate=C(N)),this.add(this.gizmo.scale=C(M)),this.add(this.picker.translate=C(A)),this.add(this.picker.rotate=C(P)),this.add(this.picker.scale=C(w)),this.add(this.helper.translate=C(S)),this.add(this.helper.rotate=C(R)),this.add(this.helper.scale=C(L)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(e){const i=(this.mode==="scale"?"local":this.space)==="local"?this.worldQuaternion:Gn;this.gizmo.translate.visible=this.mode==="translate",this.gizmo.rotate.visible=this.mode==="rotate",this.gizmo.scale.visible=this.mode==="scale",this.helper.translate.visible=this.mode==="translate",this.helper.rotate.visible=this.mode==="rotate",this.helper.scale.visible=this.mode==="scale";let s=[];s=s.concat(this.picker[this.mode].children),s=s.concat(this.gizmo[this.mode].children),s=s.concat(this.helper[this.mode].children);for(let n=0;n<s.length;n++){const o=s[n];o.visible=!0,o.rotation.set(0,0,0),o.position.copy(this.worldPosition);let a;if(this.camera.isOrthographicCamera?a=(this.camera.top-this.camera.bottom)/this.camera.zoom:a=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),o.scale.set(1,1,1).multiplyScalar(a*this.size/4),o.tag==="helper"){o.visible=!1,o.name==="AXIS"?(o.visible=!!this.axis,this.axis==="X"&&(St.setFromEuler(Ln.set(0,0,0)),o.quaternion.copy(i).multiply(St),Math.abs(_t.copy(Fs).applyQuaternion(i).dot(this.eye))>.9&&(o.visible=!1)),this.axis==="Y"&&(St.setFromEuler(Ln.set(0,0,Math.PI/2)),o.quaternion.copy(i).multiply(St),Math.abs(_t.copy(ci).applyQuaternion(i).dot(this.eye))>.9&&(o.visible=!1)),this.axis==="Z"&&(St.setFromEuler(Ln.set(0,Math.PI/2,0)),o.quaternion.copy(i).multiply(St),Math.abs(_t.copy(Os).applyQuaternion(i).dot(this.eye))>.9&&(o.visible=!1)),this.axis==="XYZE"&&(St.setFromEuler(Ln.set(0,Math.PI/2,0)),_t.copy(this.rotationAxis),o.quaternion.setFromRotationMatrix(yl.lookAt(Cl,_t,ci)),o.quaternion.multiply(St),o.visible=this.dragging),this.axis==="E"&&(o.visible=!1)):o.name==="START"?(o.position.copy(this.worldPositionStart),o.visible=this.dragging):o.name==="END"?(o.position.copy(this.worldPosition),o.visible=this.dragging):o.name==="DELTA"?(o.position.copy(this.worldPositionStart),o.quaternion.copy(this.worldQuaternionStart),Vt.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),Vt.applyQuaternion(this.worldQuaternionStart.clone().invert()),o.scale.copy(Vt),o.visible=this.dragging):(o.quaternion.copy(i),this.dragging?o.position.copy(this.worldPositionStart):o.position.copy(this.worldPosition),this.axis&&(o.visible=this.axis.search(o.name)!==-1));continue}o.quaternion.copy(i),this.mode==="translate"||this.mode==="scale"?(o.name==="X"&&Math.abs(_t.copy(Fs).applyQuaternion(i).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="Y"&&Math.abs(_t.copy(ci).applyQuaternion(i).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="Z"&&Math.abs(_t.copy(Os).applyQuaternion(i).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="XY"&&Math.abs(_t.copy(Os).applyQuaternion(i).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="YZ"&&Math.abs(_t.copy(Fs).applyQuaternion(i).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="XZ"&&Math.abs(_t.copy(ci).applyQuaternion(i).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1)):this.mode==="rotate"&&(Mn.copy(i),_t.copy(this.eye).applyQuaternion(St.copy(i).invert()),o.name.search("E")!==-1&&o.quaternion.setFromRotationMatrix(yl.lookAt(this.eye,Cl,ci)),o.name==="X"&&(St.setFromAxisAngle(Fs,Math.atan2(-_t.y,_t.z)),St.multiplyQuaternions(Mn,St),o.quaternion.copy(St)),o.name==="Y"&&(St.setFromAxisAngle(ci,Math.atan2(_t.x,_t.z)),St.multiplyQuaternions(Mn,St),o.quaternion.copy(St)),o.name==="Z"&&(St.setFromAxisAngle(Os,Math.atan2(_t.y,_t.x)),St.multiplyQuaternions(Mn,St),o.quaternion.copy(St))),o.visible=o.visible&&(o.name.indexOf("X")===-1||this.showX),o.visible=o.visible&&(o.name.indexOf("Y")===-1||this.showY),o.visible=o.visible&&(o.name.indexOf("Z")===-1||this.showZ),o.visible=o.visible&&(o.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),o.material._color=o.material._color||o.material.color.clone(),o.material._opacity=o.material._opacity||o.material.opacity,o.material.color.copy(o.material._color),o.material.opacity=o.material._opacity,this.enabled&&this.axis&&(o.name===this.axis||this.axis.split("").some(function(l){return o.name===l}))&&(o.material.color.setHex(16776960),o.material.opacity=1)}super.updateMatrixWorld(e)}}class Af extends F.Mesh{constructor(){super(new F.PlaneGeometry(1e5,1e5,2,2),new F.MeshBasicMaterial({visible:!1,wireframe:!0,side:F.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(e){let t=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(t="local"),Dn.copy(Fs).applyQuaternion(t==="local"?this.worldQuaternion:Gn),Ts.copy(ci).applyQuaternion(t==="local"?this.worldQuaternion:Gn),vs.copy(Os).applyQuaternion(t==="local"?this.worldQuaternion:Gn),_t.copy(Ts),this.mode){case"translate":case"scale":switch(this.axis){case"X":_t.copy(this.eye).cross(Dn),Ce.copy(Dn).cross(_t);break;case"Y":_t.copy(this.eye).cross(Ts),Ce.copy(Ts).cross(_t);break;case"Z":_t.copy(this.eye).cross(vs),Ce.copy(vs).cross(_t);break;case"XY":Ce.copy(vs);break;case"YZ":Ce.copy(Dn);break;case"XZ":_t.copy(vs),Ce.copy(Ts);break;case"XYZ":case"E":Ce.set(0,0,0);break}break;case"rotate":default:Ce.set(0,0,0)}Ce.length()===0?this.quaternion.copy(this.cameraQuaternion):(_l.lookAt(Vt.set(0,0,0),Ce,_t),this.quaternion.setFromRotationMatrix(_l)),super.updateMatrixWorld(e)}}class Dr{constructor(e,t,i,s,n,o=5,a=!0){y(this,"onDraggingStarted",new K);y(this,"onDraggingEnded",new K);y(this,"onDisposed",new K);y(this,"normal");y(this,"origin");y(this,"three",new D.Plane);y(this,"components");y(this,"world");y(this,"type","default");y(this,"_helper");y(this,"_visible",!0);y(this,"_enabled",!0);y(this,"_controlsActive",!1);y(this,"_arrowBoundBox",new D.Mesh);y(this,"_planeMesh");y(this,"_controls");y(this,"_hiddenMaterial",new D.MeshBasicMaterial({visible:!1}));y(this,"update",()=>{this._enabled&&this.three.setFromNormalAndCoplanarPoint(this.normal,this._helper.position)});y(this,"changeDrag",e=>{this._visible=!e.value,this.preventCameraMovement(),this.notifyDraggingChanged(e)});if(this.components=e,this.world=t,!t.renderer)throw new Error("The given world must have a renderer!");this.normal=s,this.origin=i,t.renderer.setPlane(!0,this.three),this._planeMesh=Dr.newPlaneMesh(o,n),this._helper=this.newHelper(),this._controls=this.newTransformControls(),this.three.setFromNormalAndCoplanarPoint(s,i),a&&this.toggleControls(!0)}get enabled(){return this._enabled}set enabled(e){if(!this.world.renderer)throw new Error("No renderer found for clipping plane!");this._enabled=e,this.world.renderer.setPlane(e,this.three)}get visible(){return this._visible}set visible(e){this._visible=e,this._controls.visible=e,this._helper.visible=e,this.toggleControls(e)}get meshes(){return[this._planeMesh,this._arrowBoundBox]}get planeMaterial(){return this._planeMesh.material}set planeMaterial(e){this._planeMesh.material=e}get size(){return this._planeMesh.scale.x}set size(e){this._planeMesh.scale.set(e,e,e)}get helper(){return this._helper}setFromNormalAndCoplanarPoint(e,t){this.reset(),this.normal.equals(e)||(this.normal.copy(e),this._helper.lookAt(e)),this.origin.copy(t),this._helper.position.copy(t),this._helper.updateMatrix(),this.update()}dispose(){this._enabled=!1,this.onDraggingStarted.reset(),this.onDraggingEnded.reset(),this._helper.removeFromParent(),this.world.renderer&&this.world.renderer.setPlane(!1,this.three),this._arrowBoundBox.removeFromParent(),this._arrowBoundBox.geometry.dispose(),this._planeMesh.geometry.dispose(),this._controls.removeFromParent(),this._controls.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}reset(){const e=new D.Vector3(1,0,0),t=new D.Vector3;this.normal.equals(e)||(this.normal.copy(e),this._helper.lookAt(e)),this.origin.copy(t),this._helper.position.copy(t),this._helper.updateMatrix()}toggleControls(e){if(e){if(this._controlsActive)return;this._controls.addEventListener("change",this.update),this._controls.addEventListener("dragging-changed",this.changeDrag)}else this._controls.removeEventListener("change",this.update),this._controls.removeEventListener("dragging-changed",this.changeDrag);this._controlsActive=e}newTransformControls(){if(!this.world.renderer)throw new Error("No renderer found for clipping plane!");const e=this.world.camera.three,t=this.world.renderer.three.domElement,i=new If(e,t);return this.initializeControls(i),this.world.scene.three.add(i),i}initializeControls(e){e.attach(this._helper),e.showX=!1,e.showY=!1,e.setSpace("local"),this.createArrowBoundingBox(),e.children[0].children[0].add(this._arrowBoundBox)}createArrowBoundingBox(){this._arrowBoundBox.geometry=new D.CylinderGeometry(.18,.18,1.2),this._arrowBoundBox.material=this._hiddenMaterial,this._arrowBoundBox.rotateX(Math.PI/2),this._arrowBoundBox.updateMatrix(),this._arrowBoundBox.geometry.applyMatrix4(this._arrowBoundBox.matrix)}notifyDraggingChanged(e){e.value?this.onDraggingStarted.trigger():this.onDraggingEnded.trigger()}preventCameraMovement(){this.world.camera.enabled=this._visible}newHelper(){const e=new D.Object3D;return e.lookAt(this.normal),e.position.copy(this.origin),this._planeMesh.position.z+=.01,e.add(this._planeMesh),this.world.scene.three.add(e),e}static newPlaneMesh(e,t){const i=new D.PlaneGeometry(1),s=new D.Mesh(i,t);return s.scale.set(e,e,e),s}}const zs=class zs extends Ot{constructor(t){super(t);y(this,"onBeforeDrag",new K);y(this,"onAfterDrag",new K);y(this,"onBeforeCreate",new K);y(this,"onBeforeCancel",new K);y(this,"onAfterCancel",new K);y(this,"onBeforeDelete",new K);y(this,"onAfterCreate",new K);y(this,"onAfterDelete",new K);y(this,"onDisposed",new K);y(this,"orthogonalY",!1);y(this,"toleranceOrthogonalY",.7);y(this,"Type",Dr);y(this,"list",[]);y(this,"_material",new D.MeshBasicMaterial({color:12255487,side:D.DoubleSide,transparent:!0,opacity:.2}));y(this,"_size",5);y(this,"_enabled",!1);y(this,"_visible",!0);y(this,"_onStartDragging",()=>{this.onBeforeDrag.trigger()});y(this,"_onEndDragging",()=>{this.onAfterDrag.trigger()});this.components.add(zs.uuid,this)}get enabled(){return this._enabled}set enabled(t){this._enabled=t;for(const i of this.list)i.enabled=t;this.updateMaterialsAndPlanes()}get visible(){return this._visible}set visible(t){this._visible=t;for(const i of this.list)i.visible=t}get material(){return this._material}set material(t){this._material=t;for(const i of this.list)i.planeMaterial=t}get size(){return this._size}set size(t){this._size=t;for(const i of this.list)i.size=t}dispose(){this._enabled=!1;for(const t of this.list)t.dispose();this.list.length=0,this._material.dispose(),this.onBeforeCreate.reset(),this.onBeforeCancel.reset(),this.onBeforeDelete.reset(),this.onBeforeDrag.reset(),this.onAfterCreate.reset(),this.onAfterCancel.reset(),this.onAfterDelete.reset(),this.onAfterDrag.reset(),this.onDisposed.trigger(zs.uuid),this.onDisposed.reset()}create(t){const n=this.components.get(mi).get(t).castRay();return n?this.createPlaneFromIntersection(t,n):null}createFromNormalAndCoplanarPoint(t,i,s){const n=this.newPlane(t,s,i);return this.updateMaterialsAndPlanes(),n}delete(t,i){i||(i=this.pickPlane(t)),i&&this.deletePlane(i)}deleteAll(t){const i=[...this.list];for(const s of i)if(!t||t.has(s.type)){this.delete(s.world,s);const n=this.list.indexOf(s);n!==-1&&this.list.splice(n,1)}}deletePlane(t){const i=this.list.indexOf(t);if(i!==-1){if(this.list.splice(i,1),!t.world.renderer)throw new Error("Renderer not found for this plane's world!");t.world.renderer.setPlane(!1,t.three),t.dispose(),this.updateMaterialsAndPlanes(),this.onAfterDelete.trigger(t)}}pickPlane(t){const s=this.components.get(mi).get(t),n=this.getAllPlaneMeshes(),o=s.castRay(n);if(o){const a=o.object;return this.list.find(l=>l.meshes.includes(a))}}getAllPlaneMeshes(){const t=[];for(const i of this.list)t.push(...i.meshes);return t}createPlaneFromIntersection(t,i){var l;if(!t.renderer)throw new Error("The given world must have a renderer!");const s=i.point.distanceTo(new D.Vector3(0,0,0)),n=(l=i.face)==null?void 0:l.normal;if(!s||!n)return null;const o=this.getWorldNormal(i,n),a=this.newPlane(t,i.point,o.negate());return a.visible=this._visible,a.size=this._size,t.renderer.setPlane(!0,a.three),this.updateMaterialsAndPlanes(),a}getWorldNormal(t,i){const s=t.object;let n=t.object.matrixWorld.clone();if(s instanceof D.InstancedMesh&&t.instanceId!==void 0){const c=new D.Matrix4;s.getMatrixAt(t.instanceId,c),n=c.multiply(n)}const a=new D.Matrix3().getNormalMatrix(n),l=i.clone().applyMatrix3(a).normalize();return this.normalizePlaneDirectionY(l),l}normalizePlaneDirectionY(t){this.orthogonalY&&(t.y>this.toleranceOrthogonalY&&(t.x=0,t.y=1,t.z=0),t.y<-this.toleranceOrthogonalY&&(t.x=0,t.y=-1,t.z=0))}newPlane(t,i,s){const n=new this.Type(this.components,t,i,s,this._material);return n.onDraggingStarted.add(this._onStartDragging),n.onDraggingEnded.add(this._onEndDragging),this.list.push(n),this.onAfterCreate.trigger(n),n}updateMaterialsAndPlanes(){const t=this.components.get(qn);for(const[i,s]of t.list){if(!s.renderer)continue;s.renderer.updateClippingPlanes();const{clippingPlanes:n}=s.renderer;for(const o of s.meshes)if(o.material)if(Array.isArray(o.material))for(const a of o.material)a.clippingPlanes=n;else o.material.clippingPlanes=n}}};y(zs,"uuid","66290bc5-18c4-4cd1-9379-2e17a0617611");let Kn=zs;class $c{constructor(e){y(this,"enabled",!1);y(this,"id","FirstPerson");this.camera=e}set(e){if(this.enabled=e,e){if(this.camera.projection.current!=="Perspective"){this.camera.set("Orbit");return}this.setupFirstPersonCamera()}}setupFirstPersonCamera(){const e=this.camera.controls,t=new D.Vector3;e.distance--,e.getPosition(t),e.minDistance=1,e.maxDistance=1,e.distance=1,e.moveTo(t.x,t.y,t.z),e.truckSpeed=50,e.mouseButtons.wheel=Gt.ACTION.DOLLY,e.touches.two=Gt.ACTION.TOUCH_ZOOM_TRUCK}}class Vc{constructor(e){y(this,"enabled",!0);y(this,"id","Orbit");this.camera=e,this.activateOrbitControls()}set(e){this.enabled=e,e&&this.activateOrbitControls()}activateOrbitControls(){const e=this.camera.controls;e.minDistance=1,e.maxDistance=300;const t=new D.Vector3;e.getPosition(t);const i=t.length();e.distance=i,e.truckSpeed=2;const{rotation:s}=this.camera.three,n=new D.Vector3(0,0,-1).applyEuler(s),o=t.addScaledVector(n,i);e.moveTo(o.x,o.y,o.z)}}class Gc{constructor(e){y(this,"enabled",!1);y(this,"id","Plan");y(this,"mouseAction1");y(this,"mouseAction2");y(this,"mouseInitialized",!1);y(this,"defaultAzimuthSpeed");y(this,"defaultPolarSpeed");this.camera=e,this.defaultAzimuthSpeed=e.controls.azimuthRotateSpeed,this.defaultPolarSpeed=e.controls.polarRotateSpeed}set(e){this.enabled=e;const t=this.camera.controls;t.azimuthRotateSpeed=e?0:this.defaultAzimuthSpeed,t.polarRotateSpeed=e?0:this.defaultPolarSpeed,this.mouseInitialized||(this.mouseAction1=t.touches.one,this.mouseAction2=t.touches.two,this.mouseInitialized=!0),e?(t.mouseButtons.left=Gt.ACTION.TRUCK,t.touches.one=Gt.ACTION.TOUCH_TRUCK,t.touches.two=Gt.ACTION.TOUCH_ZOOM):(t.mouseButtons.left=Gt.ACTION.ROTATE,t.touches.one=this.mouseAction1,t.touches.two=this.mouseAction2)}}class Hc{constructor(e){y(this,"onChanged",new K);y(this,"current","Perspective");y(this,"camera");y(this,"matchOrthoDistanceEnabled",!1);y(this,"_component");y(this,"_previousDistance",-1);this._component=e,this.camera=e.three}async set(e){this.current!==e&&(e==="Orthographic"?this.setOrthoCamera():await this.setPerspectiveCamera(),this.onChanged.trigger(this.camera))}async toggle(){const t=this.current==="Perspective"?"Orthographic":"Perspective";await this.set(t)}setOrthoCamera(){if(this._component.mode===null||this._component.mode.id==="FirstPerson")return;this._previousDistance=this._component.controls.distance,this._component.controls.distance=200;const e=this.getPerspectiveDims();if(!e)return;const{width:t,height:i}=e;this.setupOrthoCamera(i,t),this.camera=this._component.threeOrtho,this.current="Orthographic"}getPerspectiveDims(){const e=this._component.currentWorld;if(!e||!e.renderer)return null;const t=new D.Vector3;this._component.threePersp.getWorldDirection(t);const i=new D.Vector3;this._component.controls.getTarget(i);const n=i.clone().sub(this._component.threePersp.position).dot(t),o=e.renderer.getSize(),a=o.x/o.y,l=this._component.threePersp,c=n*2*Math.atan(l.fov*(Math.PI/180)/2);return{width:c*a,height:c}}setupOrthoCamera(e,t){this._component.controls.mouseButtons.wheel=Gt.ACTION.ZOOM,this._component.controls.mouseButtons.middle=Gt.ACTION.ZOOM;const i=this._component.threePersp,s=this._component.threeOrtho;s.zoom=1,s.left=t/-2,s.right=t/2,s.top=e/2,s.bottom=e/-2,s.updateProjectionMatrix(),s.position.copy(i.position),s.quaternion.copy(i.quaternion),this._component.controls.camera=s}getDistance(){const e=this._component.threePersp,t=this._component.threeOrtho;return(t.top-t.bottom)/t.zoom/(2*Math.atan(e.fov*(Math.PI/180)/2))}async setPerspectiveCamera(){this._component.controls.mouseButtons.wheel=Gt.ACTION.DOLLY,this._component.controls.mouseButtons.middle=Gt.ACTION.DOLLY;const e=this._component.threePersp,t=this._component.threeOrtho;e.position.copy(t.position),e.quaternion.copy(t.quaternion),this._component.controls.mouseButtons.wheel=Gt.ACTION.DOLLY,this.matchOrthoDistanceEnabled?this._component.controls.distance=this.getDistance():this._component.controls.distance=this._previousDistance,await this._component.controls.zoomTo(1),e.updateProjectionMatrix(),this._component.controls.camera=e,this.camera=e,this.current="Perspective"}}class Yc extends Gi{constructor(t){super(t);y(this,"projection");y(this,"threeOrtho");y(this,"threePersp");y(this,"_userInputButtons",{});y(this,"_frustumSize",50);y(this,"_navigationModes",new Map);y(this,"_mode",null);y(this,"previousSize",null);this.threePersp=this.three,this.threeOrtho=this.newOrthoCamera(),this.projection=new Hc(this),this.onAspectUpdated.add(()=>{this.setOrthoPerspCameraAspect()}),this.projection.onChanged.add(i=>{this.three=i,this.updateAspect()}),this.onWorldChanged.add(({action:i})=>{i==="added"&&(this._navigationModes.clear(),this._navigationModes.set("Orbit",new Vc(this)),this._navigationModes.set("FirstPerson",new $c(this)),this._navigationModes.set("Plan",new Gc(this)),this._mode=this._navigationModes.get("Orbit"),this.mode.set(!0,{preventTargetAdjustment:!0}),this.currentWorld&&this.currentWorld.renderer&&(this.previousSize=this.currentWorld.renderer.getSize().clone()))})}get mode(){if(!this._mode)throw new Error("Mode not found, camera not initialized");return this._mode}dispose(){super.dispose(),this.threeOrtho.removeFromParent()}set(t){if(this.mode!==null&&this.mode.id!==t){if(this.mode.set(!1),!this._navigationModes.has(t))throw new Error("The specified mode does not exist!");this._mode=this._navigationModes.get(t),this.mode.set(!0)}}async fit(t,i=1.5){if(!this.enabled)return;const s=Number.MAX_VALUE,n=Number.MIN_VALUE,o=new D.Vector3(s,s,s),a=new D.Vector3(n,n,n);for(const f of t){const p=new D.Box3().setFromObject(f);p.min.x<o.x&&(o.x=p.min.x),p.min.y<o.y&&(o.y=p.min.y),p.min.z<o.z&&(o.z=p.min.z),p.max.x>a.x&&(a.x=p.max.x),p.max.y>a.y&&(a.y=p.max.y),p.max.z>a.z&&(a.z=p.max.z)}const l=new D.Box3(o,a),c=new D.Vector3;l.getSize(c);const h=new D.Vector3;l.getCenter(h);const d=Math.max(c.x,c.y,c.z)*i,u=new D.Sphere(h,d);await this.controls.fitToSphere(u,!0)}setUserInput(t){t?this.enableUserInput():this.disableUserInput()}disableUserInput(){this._userInputButtons.left=this.controls.mouseButtons.left,this._userInputButtons.right=this.controls.mouseButtons.right,this._userInputButtons.middle=this.controls.mouseButtons.middle,this._userInputButtons.wheel=this.controls.mouseButtons.wheel,this.controls.mouseButtons.left=0,this.controls.mouseButtons.right=0,this.controls.mouseButtons.middle=0,this.controls.mouseButtons.wheel=0}enableUserInput(){Object.keys(this._userInputButtons).length!==0&&(this.controls.mouseButtons.left=this._userInputButtons.left,this.controls.mouseButtons.right=this._userInputButtons.right,this.controls.mouseButtons.middle=this._userInputButtons.middle,this.controls.mouseButtons.wheel=this._userInputButtons.wheel)}newOrthoCamera(){const t=window.innerWidth/window.innerHeight;return new D.OrthographicCamera(this._frustumSize*t/-2,this._frustumSize*t/2,this._frustumSize/2,this._frustumSize/-2,.1,1e3)}setOrthoPerspCameraAspect(){if(!this.currentWorld||!this.currentWorld.renderer||!this.previousSize)return;const t=this.currentWorld.renderer.getSize(),i=this.threeOrtho.top,s=this.threeOrtho.right,n=t.y/this.previousSize.y,o=t.x/this.previousSize.x,a=i*n,l=s*o;this.threeOrtho.left=-l,this.threeOrtho.right=l,this.threeOrtho.top=a,this.threeOrtho.bottom=-a,this.threeOrtho.updateProjectionMatrix(),this.previousSize.copy(t)}}const Rf=new Map([[tt.IFCRELAGGREGATES,{forRelated:"Decomposes",forRelating:"IsDecomposedBy"}],[tt.IFCRELASSOCIATESMATERIAL,{forRelated:"HasAssociations",forRelating:"AssociatedTo"}],[tt.IFCRELASSOCIATESCLASSIFICATION,{forRelated:"HasAssociations",forRelating:"ClassificationForObjects"}],[tt.IFCRELASSIGNSTOGROUP,{forRelated:"HasAssignments",forRelating:"IsGroupedBy"}],[tt.IFCRELDEFINESBYPROPERTIES,{forRelated:"IsDefinedBy",forRelating:"DefinesOcurrence"}],[tt.IFCRELDEFINESBYTYPE,{forRelated:"IsTypedBy",forRelating:"Types"}],[tt.IFCRELDEFINESBYTEMPLATE,{forRelated:"IsDefinedBy",forRelating:"Defines"}],[tt.IFCRELCONTAINEDINSPATIALSTRUCTURE,{forRelated:"ContainedInStructure",forRelating:"ContainsElements"}],[tt.IFCRELFLOWCONTROLELEMENTS,{forRelated:"AssignedToFlowElement",forRelating:"HasControlElements"}],[tt.IFCRELCONNECTSELEMENTS,{forRelated:"ConnectedFrom",forRelating:"ConnectedTo"}],[tt.IFCRELASSIGNSTOPRODUCT,{forRelated:"HasAssignments",forRelating:"ReferencedBy"}],[tt.IFCRELDECLARES,{forRelated:"HasContext",forRelating:"Declares"}],[tt.IFCRELASSIGNSTOCONTROL,{forRelated:"HasAssignments",forRelating:"Controls"}],[tt.IFCRELNESTS,{forRelated:"Nests",forRelating:"IsNestedBy"}]]),$s=class $s extends Ot{constructor(t){super(t);y(this,"onDisposed",new K);y(this,"onRelationsIndexed",new K);y(this,"relationMaps",{});y(this,"enabled",!0);y(this,"_relToAttributesMap",Rf);y(this,"_inverseAttributes",["IsDecomposedBy","Decomposes","AssociatedTo","HasAssociations","ClassificationForObjects","IsGroupedBy","HasAssignments","IsDefinedBy","DefinesOcurrence","IsTypedBy","Types","Defines","ContainedInStructure","ContainsElements","HasControlElements","AssignedToFlowElement","ConnectedTo","ConnectedFrom","ReferencedBy","Declares","HasContext","Controls","IsNestedBy","Nests"]);y(this,"_ifcRels",[tt.IFCRELAGGREGATES,tt.IFCRELASSOCIATESMATERIAL,tt.IFCRELASSOCIATESCLASSIFICATION,tt.IFCRELASSIGNSTOGROUP,tt.IFCRELDEFINESBYPROPERTIES,tt.IFCRELDEFINESBYTYPE,tt.IFCRELDEFINESBYTEMPLATE,tt.IFCRELCONTAINEDINSPATIALSTRUCTURE,tt.IFCRELFLOWCONTROLELEMENTS,tt.IFCRELCONNECTSELEMENTS,tt.IFCRELASSIGNSTOPRODUCT,tt.IFCRELDECLARES,tt.IFCRELASSIGNSTOCONTROL,tt.IFCRELNESTS]);y(this,"onFragmentsDisposed",t=>{delete this.relationMaps[t.groupID]});this.components.add($s.uuid,this),t.get(wt).onFragmentsDisposed.add(this.onFragmentsDisposed)}indexRelations(t,i,s,n){const o=Object.keys(i).find(u=>u.startsWith("Relating")),a=Object.keys(i).find(u=>u.startsWith("Related"));if(!(o&&a))return;const l=i[o].value,c=i[a].map(u=>u.value),h=t.get(l)??new Map,d=this.getAttributeIndex(n);d!==null&&(h.set(d,c),t.set(l,h));for(const u of c){const f=t.get(u)??new Map,p=this.getAttributeIndex(s);if(!p)continue;const m=f.get(p)??[];m.push(l),f.set(p,m),t.set(u,f)}}getAttributeIndex(t){const i=this._inverseAttributes.indexOf(t);return i===-1?null:i}setRelationMap(t,i){this.relationMaps[t.uuid]=i,this.onRelationsIndexed.trigger({modelID:t.uuid,relationsMap:i})}async process(t){if(!t.hasProperties)throw new Error("FragmentsGroup properties not found");let i=this.relationMaps[t.uuid];if(i)return i;i=new Map;for(const s of this._ifcRels){const n=await t.getAllPropertiesOfType(s);if(!n)continue;const o=this._relToAttributesMap.get(s);if(!o)continue;const{forRelated:a,forRelating:l}=o;for(const c in n){const h=n[c];this.indexRelations(i,h,a,l)}}return this.setRelationMap(t,i),i}async processFromWebIfc(t,i){const s=new Map;for(const n of this._ifcRels){const o=this._relToAttributesMap.get(n);if(!o)continue;const{forRelated:a,forRelating:l}=o,c=t.GetLineIDsWithType(i,n);for(let h=0;h<c.size();h++){const d=await t.properties.getItemProperties(i,c.get(h));this.indexRelations(s,d,a,l)}}return this.onRelationsIndexed.trigger({modelID:i.toString(),relationsMap:s}),s}getEntityRelations(t,i,s){const n=this.relationMaps[t.uuid];if(!n)throw new Error(`IfcRelationsIndexer: model ${t.uuid} has no relations indexed.`);const o=n.get(i),a=this.getAttributeIndex(s);if(o===void 0||a===null)return null;const l=o.get(a);return l||null}serializeRelations(t){const i={};for(const[s,n]of t.entries()){i[s]||(i[s]={});for(const[o,a]of n.entries())i[s][o]=a}return JSON.stringify(i)}serializeModelRelations(t){const i=this.relationMaps[t.uuid];return i?this.serializeRelations(i):null}serializeAllRelations(){const t={};for(const i in this.relationMaps){const s=this.relationMaps[i],n={};for(const[o,a]of s.entries()){n[o]||(n[o]={});for(const[l,c]of a.entries())n[o][l]=c}t[i]=n}return JSON.stringify(t)}getRelationsMapFromJSON(t){const i=JSON.parse(t),s=new Map;for(const n in i){const o=i[n],a=new Map;for(const l in o)a.set(Number(l),o[l]);s.set(Number(n),a)}return s}dispose(){this.relationMaps={},this.components.get(wt).onFragmentsDisposed.remove(this.onFragmentsDisposed),this.onDisposed.trigger($s.uuid),this.onDisposed.reset()}getEntitiesWithRelation(t,i,s){const n=this.relationMaps[t.uuid];if(!n)throw new Error("IfcRelationsIndexer: the model relations are not indexed!");const o=new Set;for(const[a,l]of n){const c=this.getAttributeIndex(i);if(c===null)throw new Error("IfcRelationsIndexer: invalid inverse attribute name");const h=l.get(c);h&&h.includes(s)&&o.add(a)}return o}addEntityRelations(t,i,s,...n){const o=this.getEntityRelations(t,i,s);if(o)o.push(...n);else{const a=this.getAttributeIndex(s);if(!a)throw new Error(`IfcRelationsIndexer: ${s} is not a valid relation name.`);const l=this.relationMaps[t.uuid].get(i);l==null||l.set(a,n)}}getEntityChildren(t,i,s=new Set){if(s.add(i),this.relationMaps[t.uuid]===void 0)throw new Error("The provided model has no indices. You have to generate them first.");const o=this.getEntityRelations(t,i,"IsDecomposedBy");if(o)for(const l of o)this.getEntityChildren(t,l,s);const a=this.getEntityRelations(t,i,"ContainsElements");if(a)for(const l of a)this.getEntityChildren(t,l,s);return s}};y($s,"uuid","23a889ab-83b3-44a4-8bee-ead83438370b");let gi=$s;const Tr=class Tr extends Ot{constructor(t){super(t);y(this,"onDisposed",new K);y(this,"onFragmentsLoaded",new K);y(this,"onFragmentsDisposed",new K);y(this,"list",new pi);y(this,"groups",new pi);y(this,"baseCoordinationModel","");y(this,"baseCoordinationMatrix",new D.Matrix4);y(this,"enabled",!0);y(this,"_loader",new _c.Serializer);this.components.add(Tr.uuid,this)}get meshes(){const t=[];for(const[i,s]of this.list)t.push(s.mesh);return t}dispose(){for(const[t,i]of this.groups)i.dispose(!0);this.baseCoordinationModel="",this.groups.clear(),this.list.clear(),this.onFragmentsLoaded.reset(),this.onFragmentsDisposed.reset(),this.onDisposed.trigger(),this.onDisposed.reset()}disposeGroup(t){const{uuid:i}=t,s=[];for(const n of t.items)s.push(n.id),this.list.delete(n.id);t.dispose(!0),this.groups.delete(t.uuid),this.onFragmentsDisposed.trigger({groupID:i,fragmentIDs:s})}load(t,i){const n={...{coordinate:!0},...i},{coordinate:o,name:a,properties:l,relationsMap:c}=n,h=this._loader.import(t);i&&(h.isStreamed=i.isStreamed||!1),a&&(h.name=a);for(const d of h.items)d.group=h,this.list.set(d.id,d);return o&&this.coordinate([h]),this.groups.set(h.uuid,h),l&&h.setLocalProperties(l),c&&this.components.get(gi).setRelationMap(h,c),this.onFragmentsLoaded.trigger(h),h}export(t){return this._loader.export(t)}getModelIdMap(t){const i={};for(const s in t){const n=this.list.get(s);if(!(n&&n.group))continue;const o=n.group;o.uuid in i||(i[o.uuid]=new Set);const a=t[s];for(const l of a)i[o.uuid].add(l)}return i}modelIdToFragmentIdMap(t){let i={};for(const s in t){const n=this.groups.get(s);if(!n)continue;const o=t[s],a=n.getFragmentMap(o);i={...i,...a}}return i}guidToFragmentIdMap(t){const i={};for(const[n,o]of this.groups){n in i||(i[n]=new Set);for(const a of t){const l=o.globalToExpressIDs.get(a);l&&i[n].add(l)}}return this.modelIdToFragmentIdMap(i)}coordinate(t=Array.from(this.groups.values())){if(this.baseCoordinationModel.length===0){const s=t.pop();if(!s)return;this.baseCoordinationModel=s.uuid,this.baseCoordinationMatrix=s.coordinationMatrix.clone()}if(t.length)for(const s of t)s.coordinationMatrix.equals(this.baseCoordinationMatrix)||(s.position.set(0,0,0),s.rotation.set(0,0,0),s.scale.set(1,1,1),s.updateMatrix(),this.applyBaseCoordinateSystem(s,s.coordinationMatrix))}applyBaseCoordinateSystem(t,i){i&&t.applyMatrix4(i.clone().invert()),t.applyMatrix4(this.baseCoordinationMatrix)}clone(t,i){const s=t.cloneGroup(i);this.groups.set(s.uuid,s);for(const n of s.items)this.list.set(n.id,n);return s}};y(Tr,"uuid","fef46874-46a3-461b-8c44-2922ab77c806");let wt=Tr;var Un=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Sf(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function kn(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Wc={exports:{}};/*!
|
|
129
|
+
|
|
130
|
+
JSZip v3.10.1 - A JavaScript class for generating and reading zip files
|
|
131
|
+
<http://stuartk.com/jszip>
|
|
132
|
+
|
|
133
|
+
(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
|
|
134
|
+
Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
|
|
135
|
+
|
|
136
|
+
JSZip uses the library pako released under the MIT license :
|
|
137
|
+
https://github.com/nodeca/pako/blob/main/LICENSE
|
|
138
|
+
*/(function(r,e){(function(t){r.exports=t()})(function(){return function t(i,s,n){function o(c,h){if(!s[c]){if(!i[c]){var d=typeof kn=="function"&&kn;if(!h&&d)return d(c,!0);if(a)return a(c,!0);var u=new Error("Cannot find module '"+c+"'");throw u.code="MODULE_NOT_FOUND",u}var f=s[c]={exports:{}};i[c][0].call(f.exports,function(p){var m=i[c][1][p];return o(m||p)},f,f.exports,t,i,s,n)}return s[c].exports}for(var a=typeof kn=="function"&&kn,l=0;l<n.length;l++)o(n[l]);return o}({1:[function(t,i,s){var n=t("./utils"),o=t("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";s.encode=function(l){for(var c,h,d,u,f,p,m,E=[],g=0,I=l.length,T=I,b=n.getTypeOf(l)!=="string";g<l.length;)T=I-g,d=b?(c=l[g++],h=g<I?l[g++]:0,g<I?l[g++]:0):(c=l.charCodeAt(g++),h=g<I?l.charCodeAt(g++):0,g<I?l.charCodeAt(g++):0),u=c>>2,f=(3&c)<<4|h>>4,p=1<T?(15&h)<<2|d>>6:64,m=2<T?63&d:64,E.push(a.charAt(u)+a.charAt(f)+a.charAt(p)+a.charAt(m));return E.join("")},s.decode=function(l){var c,h,d,u,f,p,m=0,E=0,g="data:";if(l.substr(0,g.length)===g)throw new Error("Invalid base64 input, it looks like a data url.");var I,T=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===a.charAt(64)&&T--,l.charAt(l.length-2)===a.charAt(64)&&T--,T%1!=0)throw new Error("Invalid base64 input, bad content length.");for(I=o.uint8array?new Uint8Array(0|T):new Array(0|T);m<l.length;)c=a.indexOf(l.charAt(m++))<<2|(u=a.indexOf(l.charAt(m++)))>>4,h=(15&u)<<4|(f=a.indexOf(l.charAt(m++)))>>2,d=(3&f)<<6|(p=a.indexOf(l.charAt(m++))),I[E++]=c,f!==64&&(I[E++]=h),p!==64&&(I[E++]=d);return I}},{"./support":30,"./utils":32}],2:[function(t,i,s){var n=t("./external"),o=t("./stream/DataWorker"),a=t("./stream/Crc32Probe"),l=t("./stream/DataLengthProbe");function c(h,d,u,f,p){this.compressedSize=h,this.uncompressedSize=d,this.crc32=u,this.compression=f,this.compressedContent=p}c.prototype={getContentWorker:function(){var h=new o(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),d=this;return h.on("end",function(){if(this.streamInfo.data_length!==d.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),h},getCompressedWorker:function(){return new o(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},c.createWorkerFrom=function(h,d,u){return h.pipe(new a).pipe(new l("uncompressedSize")).pipe(d.compressWorker(u)).pipe(new l("compressedSize")).withStreamInfo("compression",d)},i.exports=c},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,i,s){var n=t("./stream/GenericWorker");s.STORE={magic:"\0\0",compressWorker:function(){return new n("STORE compression")},uncompressWorker:function(){return new n("STORE decompression")}},s.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,i,s){var n=t("./utils"),o=function(){for(var a,l=[],c=0;c<256;c++){a=c;for(var h=0;h<8;h++)a=1&a?3988292384^a>>>1:a>>>1;l[c]=a}return l}();i.exports=function(a,l){return a!==void 0&&a.length?n.getTypeOf(a)!=="string"?function(c,h,d,u){var f=o,p=u+d;c^=-1;for(var m=u;m<p;m++)c=c>>>8^f[255&(c^h[m])];return-1^c}(0|l,a,a.length,0):function(c,h,d,u){var f=o,p=u+d;c^=-1;for(var m=u;m<p;m++)c=c>>>8^f[255&(c^h.charCodeAt(m))];return-1^c}(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(t,i,s){s.base64=!1,s.binary=!1,s.dir=!1,s.createFolders=!0,s.date=null,s.compression=null,s.compressionOptions=null,s.comment=null,s.unixPermissions=null,s.dosPermissions=null},{}],6:[function(t,i,s){var n=null;n=typeof Promise<"u"?Promise:t("lie"),i.exports={Promise:n}},{lie:37}],7:[function(t,i,s){var n=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=t("pako"),a=t("./utils"),l=t("./stream/GenericWorker"),c=n?"uint8array":"array";function h(d,u){l.call(this,"FlateWorker/"+d),this._pako=null,this._pakoAction=d,this._pakoOptions=u,this.meta={}}s.magic="\b\0",a.inherits(h,l),h.prototype.processChunk=function(d){this.meta=d.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(c,d.data),!1)},h.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},h.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},h.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var d=this;this._pako.onData=function(u){d.push({data:u,meta:d.meta})}},s.compressWorker=function(d){return new h("Deflate",d)},s.uncompressWorker=function(){return new h("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,i,s){function n(f,p){var m,E="";for(m=0;m<p;m++)E+=String.fromCharCode(255&f),f>>>=8;return E}function o(f,p,m,E,g,I){var T,b,v=f.file,A=f.compression,S=I!==c.utf8encode,N=a.transformTo("string",I(v.name)),R=a.transformTo("string",c.utf8encode(v.name)),P=v.comment,M=a.transformTo("string",I(P)),w=a.transformTo("string",c.utf8encode(P)),L=R.length!==v.name.length,C=w.length!==P.length,U="",q="",G="",st=v.dir,Y=v.date,ot={crc32:0,compressedSize:0,uncompressedSize:0};p&&!m||(ot.crc32=f.crc32,ot.compressedSize=f.compressedSize,ot.uncompressedSize=f.uncompressedSize);var $=0;p&&($|=8),S||!L&&!C||($|=2048);var B=0,at=0;st&&(B|=16),g==="UNIX"?(at=798,B|=function(it,Rt){var xt=it;return it||(xt=Rt?16893:33204),(65535&xt)<<16}(v.unixPermissions,st)):(at=20,B|=function(it){return 63&(it||0)}(v.dosPermissions)),T=Y.getUTCHours(),T<<=6,T|=Y.getUTCMinutes(),T<<=5,T|=Y.getUTCSeconds()/2,b=Y.getUTCFullYear()-1980,b<<=4,b|=Y.getUTCMonth()+1,b<<=5,b|=Y.getUTCDate(),L&&(q=n(1,1)+n(h(N),4)+R,U+="up"+n(q.length,2)+q),C&&(G=n(1,1)+n(h(M),4)+w,U+="uc"+n(G.length,2)+G);var nt="";return nt+=`
|
|
139
|
+
\0`,nt+=n($,2),nt+=A.magic,nt+=n(T,2),nt+=n(b,2),nt+=n(ot.crc32,4),nt+=n(ot.compressedSize,4),nt+=n(ot.uncompressedSize,4),nt+=n(N.length,2),nt+=n(U.length,2),{fileRecord:d.LOCAL_FILE_HEADER+nt+N+U,dirRecord:d.CENTRAL_FILE_HEADER+n(at,2)+nt+n(M.length,2)+"\0\0\0\0"+n(B,4)+n(E,4)+N+U+M}}var a=t("../utils"),l=t("../stream/GenericWorker"),c=t("../utf8"),h=t("../crc32"),d=t("../signature");function u(f,p,m,E){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=p,this.zipPlatform=m,this.encodeFileName=E,this.streamFiles=f,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(u,l),u.prototype.push=function(f){var p=f.meta.percent||0,m=this.entriesCount,E=this._sources.length;this.accumulate?this.contentBuffer.push(f):(this.bytesWritten+=f.data.length,l.prototype.push.call(this,{data:f.data,meta:{currentFile:this.currentFile,percent:m?(p+100*(m-E-1))/m:100}}))},u.prototype.openedSource=function(f){this.currentSourceOffset=this.bytesWritten,this.currentFile=f.file.name;var p=this.streamFiles&&!f.file.dir;if(p){var m=o(f,p,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:m.fileRecord,meta:{percent:0}})}else this.accumulate=!0},u.prototype.closedSource=function(f){this.accumulate=!1;var p=this.streamFiles&&!f.file.dir,m=o(f,p,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(m.dirRecord),p)this.push({data:function(E){return d.DATA_DESCRIPTOR+n(E.crc32,4)+n(E.compressedSize,4)+n(E.uncompressedSize,4)}(f),meta:{percent:100}});else for(this.push({data:m.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},u.prototype.flush=function(){for(var f=this.bytesWritten,p=0;p<this.dirRecords.length;p++)this.push({data:this.dirRecords[p],meta:{percent:100}});var m=this.bytesWritten-f,E=function(g,I,T,b,v){var A=a.transformTo("string",v(b));return d.CENTRAL_DIRECTORY_END+"\0\0\0\0"+n(g,2)+n(g,2)+n(I,4)+n(T,4)+n(A.length,2)+A}(this.dirRecords.length,m,f,this.zipComment,this.encodeFileName);this.push({data:E,meta:{percent:100}})},u.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},u.prototype.registerPrevious=function(f){this._sources.push(f);var p=this;return f.on("data",function(m){p.processChunk(m)}),f.on("end",function(){p.closedSource(p.previous.streamInfo),p._sources.length?p.prepareNextSource():p.end()}),f.on("error",function(m){p.error(m)}),this},u.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},u.prototype.error=function(f){var p=this._sources;if(!l.prototype.error.call(this,f))return!1;for(var m=0;m<p.length;m++)try{p[m].error(f)}catch{}return!0},u.prototype.lock=function(){l.prototype.lock.call(this);for(var f=this._sources,p=0;p<f.length;p++)f[p].lock()},i.exports=u},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(t,i,s){var n=t("../compressions"),o=t("./ZipFileWorker");s.generateWorker=function(a,l,c){var h=new o(l.streamFiles,c,l.platform,l.encodeFileName),d=0;try{a.forEach(function(u,f){d++;var p=function(I,T){var b=I||T,v=n[b];if(!v)throw new Error(b+" is not a valid compression method !");return v}(f.options.compression,l.compression),m=f.options.compressionOptions||l.compressionOptions||{},E=f.dir,g=f.date;f._compressWorker(p,m).withStreamInfo("file",{name:u,dir:E,date:g,comment:f.comment||"",unixPermissions:f.unixPermissions,dosPermissions:f.dosPermissions}).pipe(h)}),h.entriesCount=d}catch(u){h.error(u)}return h}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(t,i,s){function n(){if(!(this instanceof n))return new n;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var o=new n;for(var a in this)typeof this[a]!="function"&&(o[a]=this[a]);return o}}(n.prototype=t("./object")).loadAsync=t("./load"),n.support=t("./support"),n.defaults=t("./defaults"),n.version="3.10.1",n.loadAsync=function(o,a){return new n().loadAsync(o,a)},n.external=t("./external"),i.exports=n},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(t,i,s){var n=t("./utils"),o=t("./external"),a=t("./utf8"),l=t("./zipEntries"),c=t("./stream/Crc32Probe"),h=t("./nodejsUtils");function d(u){return new o.Promise(function(f,p){var m=u.decompressed.getContentWorker().pipe(new c);m.on("error",function(E){p(E)}).on("end",function(){m.streamInfo.crc32!==u.decompressed.crc32?p(new Error("Corrupted zip : CRC32 mismatch")):f()}).resume()})}i.exports=function(u,f){var p=this;return f=n.extend(f||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),h.isNode&&h.isStream(u)?o.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):n.prepareContent("the loaded zip file",u,!0,f.optimizedBinaryString,f.base64).then(function(m){var E=new l(f);return E.load(m),E}).then(function(m){var E=[o.Promise.resolve(m)],g=m.files;if(f.checkCRC32)for(var I=0;I<g.length;I++)E.push(d(g[I]));return o.Promise.all(E)}).then(function(m){for(var E=m.shift(),g=E.files,I=0;I<g.length;I++){var T=g[I],b=T.fileNameStr,v=n.resolve(T.fileNameStr);p.file(v,T.decompressed,{binary:!0,optimizedBinaryString:!0,date:T.date,dir:T.dir,comment:T.fileCommentStr.length?T.fileCommentStr:null,unixPermissions:T.unixPermissions,dosPermissions:T.dosPermissions,createFolders:f.createFolders}),T.dir||(p.file(v).unsafeOriginalName=b)}return E.zipComment.length&&(p.comment=E.zipComment),p})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(t,i,s){var n=t("../utils"),o=t("../stream/GenericWorker");function a(l,c){o.call(this,"Nodejs stream input adapter for "+l),this._upstreamEnded=!1,this._bindStream(c)}n.inherits(a,o),a.prototype._bindStream=function(l){var c=this;(this._stream=l).pause(),l.on("data",function(h){c.push({data:h,meta:{percent:0}})}).on("error",function(h){c.isPaused?this.generatedError=h:c.error(h)}).on("end",function(){c.isPaused?c._upstreamEnded=!0:c.end()})},a.prototype.pause=function(){return!!o.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},i.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(t,i,s){var n=t("readable-stream").Readable;function o(a,l,c){n.call(this,l),this._helper=a;var h=this;a.on("data",function(d,u){h.push(d)||h._helper.pause(),c&&c(u)}).on("error",function(d){h.emit("error",d)}).on("end",function(){h.push(null)})}t("../utils").inherits(o,n),o.prototype._read=function(){this._helper.resume()},i.exports=o},{"../utils":32,"readable-stream":16}],14:[function(t,i,s){i.exports={isNode:typeof Buffer<"u",newBufferFrom:function(n,o){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(n,o);if(typeof n=="number")throw new Error('The "data" argument must not be a number');return new Buffer(n,o)},allocBuffer:function(n){if(Buffer.alloc)return Buffer.alloc(n);var o=new Buffer(n);return o.fill(0),o},isBuffer:function(n){return Buffer.isBuffer(n)},isStream:function(n){return n&&typeof n.on=="function"&&typeof n.pause=="function"&&typeof n.resume=="function"}}},{}],15:[function(t,i,s){function n(v,A,S){var N,R=a.getTypeOf(A),P=a.extend(S||{},h);P.date=P.date||new Date,P.compression!==null&&(P.compression=P.compression.toUpperCase()),typeof P.unixPermissions=="string"&&(P.unixPermissions=parseInt(P.unixPermissions,8)),P.unixPermissions&&16384&P.unixPermissions&&(P.dir=!0),P.dosPermissions&&16&P.dosPermissions&&(P.dir=!0),P.dir&&(v=g(v)),P.createFolders&&(N=E(v))&&I.call(this,N,!0);var M=R==="string"&&P.binary===!1&&P.base64===!1;S&&S.binary!==void 0||(P.binary=!M),(A instanceof d&&A.uncompressedSize===0||P.dir||!A||A.length===0)&&(P.base64=!1,P.binary=!0,A="",P.compression="STORE",R="string");var w=null;w=A instanceof d||A instanceof l?A:p.isNode&&p.isStream(A)?new m(v,A):a.prepareContent(v,A,P.binary,P.optimizedBinaryString,P.base64);var L=new u(v,w,P);this.files[v]=L}var o=t("./utf8"),a=t("./utils"),l=t("./stream/GenericWorker"),c=t("./stream/StreamHelper"),h=t("./defaults"),d=t("./compressedObject"),u=t("./zipObject"),f=t("./generate"),p=t("./nodejsUtils"),m=t("./nodejs/NodejsStreamInputAdapter"),E=function(v){v.slice(-1)==="/"&&(v=v.substring(0,v.length-1));var A=v.lastIndexOf("/");return 0<A?v.substring(0,A):""},g=function(v){return v.slice(-1)!=="/"&&(v+="/"),v},I=function(v,A){return A=A!==void 0?A:h.createFolders,v=g(v),this.files[v]||n.call(this,v,null,{dir:!0,createFolders:A}),this.files[v]};function T(v){return Object.prototype.toString.call(v)==="[object RegExp]"}var b={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(v){var A,S,N;for(A in this.files)N=this.files[A],(S=A.slice(this.root.length,A.length))&&A.slice(0,this.root.length)===this.root&&v(S,N)},filter:function(v){var A=[];return this.forEach(function(S,N){v(S,N)&&A.push(N)}),A},file:function(v,A,S){if(arguments.length!==1)return v=this.root+v,n.call(this,v,A,S),this;if(T(v)){var N=v;return this.filter(function(P,M){return!M.dir&&N.test(P)})}var R=this.files[this.root+v];return R&&!R.dir?R:null},folder:function(v){if(!v)return this;if(T(v))return this.filter(function(R,P){return P.dir&&v.test(R)});var A=this.root+v,S=I.call(this,A),N=this.clone();return N.root=S.name,N},remove:function(v){v=this.root+v;var A=this.files[v];if(A||(v.slice(-1)!=="/"&&(v+="/"),A=this.files[v]),A&&!A.dir)delete this.files[v];else for(var S=this.filter(function(R,P){return P.name.slice(0,v.length)===v}),N=0;N<S.length;N++)delete this.files[S[N].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(v){var A,S={};try{if((S=a.extend(v||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:o.utf8encode})).type=S.type.toLowerCase(),S.compression=S.compression.toUpperCase(),S.type==="binarystring"&&(S.type="string"),!S.type)throw new Error("No output type specified.");a.checkSupport(S.type),S.platform!=="darwin"&&S.platform!=="freebsd"&&S.platform!=="linux"&&S.platform!=="sunos"||(S.platform="UNIX"),S.platform==="win32"&&(S.platform="DOS");var N=S.comment||this.comment||"";A=f.generateWorker(this,S,N)}catch(R){(A=new l("error")).error(R)}return new c(A,S.type||"string",S.mimeType)},generateAsync:function(v,A){return this.generateInternalStream(v).accumulate(A)},generateNodeStream:function(v,A){return(v=v||{}).type||(v.type="nodebuffer"),this.generateInternalStream(v).toNodejsStream(A)}};i.exports=b},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(t,i,s){i.exports=t("stream")},{stream:void 0}],17:[function(t,i,s){var n=t("./DataReader");function o(a){n.call(this,a);for(var l=0;l<this.data.length;l++)a[l]=255&a[l]}t("../utils").inherits(o,n),o.prototype.byteAt=function(a){return this.data[this.zero+a]},o.prototype.lastIndexOfSignature=function(a){for(var l=a.charCodeAt(0),c=a.charCodeAt(1),h=a.charCodeAt(2),d=a.charCodeAt(3),u=this.length-4;0<=u;--u)if(this.data[u]===l&&this.data[u+1]===c&&this.data[u+2]===h&&this.data[u+3]===d)return u-this.zero;return-1},o.prototype.readAndCheckSignature=function(a){var l=a.charCodeAt(0),c=a.charCodeAt(1),h=a.charCodeAt(2),d=a.charCodeAt(3),u=this.readData(4);return l===u[0]&&c===u[1]&&h===u[2]&&d===u[3]},o.prototype.readData=function(a){if(this.checkOffset(a),a===0)return[];var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},i.exports=o},{"../utils":32,"./DataReader":18}],18:[function(t,i,s){var n=t("../utils");function o(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}o.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var l,c=0;for(this.checkOffset(a),l=this.index+a-1;l>=this.index;l--)c=(c<<8)+this.byteAt(l);return this.index+=a,c},readString:function(a){return n.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},i.exports=o},{"../utils":32}],19:[function(t,i,s){var n=t("./Uint8ArrayReader");function o(a){n.call(this,a)}t("../utils").inherits(o,n),o.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},i.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,i,s){var n=t("./DataReader");function o(a){n.call(this,a)}t("../utils").inherits(o,n),o.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},o.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},o.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},o.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},i.exports=o},{"../utils":32,"./DataReader":18}],21:[function(t,i,s){var n=t("./ArrayReader");function o(a){n.call(this,a)}t("../utils").inherits(o,n),o.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},i.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(t,i,s){var n=t("../utils"),o=t("../support"),a=t("./ArrayReader"),l=t("./StringReader"),c=t("./NodeBufferReader"),h=t("./Uint8ArrayReader");i.exports=function(d){var u=n.getTypeOf(d);return n.checkSupport(u),u!=="string"||o.uint8array?u==="nodebuffer"?new c(d):o.uint8array?new h(n.transformTo("uint8array",d)):new a(n.transformTo("array",d)):new l(d)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,i,s){s.LOCAL_FILE_HEADER="PK",s.CENTRAL_FILE_HEADER="PK",s.CENTRAL_DIRECTORY_END="PK",s.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",s.ZIP64_CENTRAL_DIRECTORY_END="PK",s.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(t,i,s){var n=t("./GenericWorker"),o=t("../utils");function a(l){n.call(this,"ConvertWorker to "+l),this.destType=l}o.inherits(a,n),a.prototype.processChunk=function(l){this.push({data:o.transformTo(this.destType,l.data),meta:l.meta})},i.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(t,i,s){var n=t("./GenericWorker"),o=t("../crc32");function a(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(a,n),a.prototype.processChunk=function(l){this.streamInfo.crc32=o(l.data,this.streamInfo.crc32||0),this.push(l)},i.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,i,s){var n=t("../utils"),o=t("./GenericWorker");function a(l){o.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}n.inherits(a,o),a.prototype.processChunk=function(l){if(l){var c=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=c+l.data.length}o.prototype.processChunk.call(this,l)},i.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(t,i,s){var n=t("../utils"),o=t("./GenericWorker");function a(l){o.call(this,"DataWorker");var c=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(h){c.dataIsReady=!0,c.data=h,c.max=h&&h.length||0,c.type=n.getTypeOf(h),c.isPaused||c._tickAndRepeat()},function(h){c.error(h)})}n.inherits(a,o),a.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,c=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,c);break;case"uint8array":l=this.data.subarray(this.index,c);break;case"array":case"nodebuffer":l=this.data.slice(this.index,c)}return this.index=c,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},i.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(t,i,s){function n(o){this.name=o||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}n.prototype={push:function(o){this.emit("data",o)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(o){this.emit("error",o)}return!0},error:function(o){return!this.isFinished&&(this.isPaused?this.generatedError=o:(this.isFinished=!0,this.emit("error",o),this.previous&&this.previous.error(o),this.cleanUp()),!0)},on:function(o,a){return this._listeners[o].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(o,a){if(this._listeners[o])for(var l=0;l<this._listeners[o].length;l++)this._listeners[o][l].call(this,a)},pipe:function(o){return o.registerPrevious(this)},registerPrevious:function(o){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=o.streamInfo,this.mergeStreamInfo(),this.previous=o;var a=this;return o.on("data",function(l){a.processChunk(l)}),o.on("end",function(){a.end()}),o.on("error",function(l){a.error(l)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var o=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),o=!0),this.previous&&this.previous.resume(),!o},flush:function(){},processChunk:function(o){this.push(o)},withStreamInfo:function(o,a){return this.extraStreamInfo[o]=a,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var o in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,o)&&(this.streamInfo[o]=this.extraStreamInfo[o])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var o="Worker "+this.name;return this.previous?this.previous+" -> "+o:o}},i.exports=n},{}],29:[function(t,i,s){var n=t("../utils"),o=t("./ConvertWorker"),a=t("./GenericWorker"),l=t("../base64"),c=t("../support"),h=t("../external"),d=null;if(c.nodestream)try{d=t("../nodejs/NodejsStreamOutputAdapter")}catch{}function u(p,m){return new h.Promise(function(E,g){var I=[],T=p._internalType,b=p._outputType,v=p._mimeType;p.on("data",function(A,S){I.push(A),m&&m(S)}).on("error",function(A){I=[],g(A)}).on("end",function(){try{var A=function(S,N,R){switch(S){case"blob":return n.newBlob(n.transformTo("arraybuffer",N),R);case"base64":return l.encode(N);default:return n.transformTo(S,N)}}(b,function(S,N){var R,P=0,M=null,w=0;for(R=0;R<N.length;R++)w+=N[R].length;switch(S){case"string":return N.join("");case"array":return Array.prototype.concat.apply([],N);case"uint8array":for(M=new Uint8Array(w),R=0;R<N.length;R++)M.set(N[R],P),P+=N[R].length;return M;case"nodebuffer":return Buffer.concat(N);default:throw new Error("concat : unsupported type '"+S+"'")}}(T,I),v);E(A)}catch(S){g(S)}I=[]}).resume()})}function f(p,m,E){var g=m;switch(m){case"blob":case"arraybuffer":g="uint8array";break;case"base64":g="string"}try{this._internalType=g,this._outputType=m,this._mimeType=E,n.checkSupport(g),this._worker=p.pipe(new o(g)),p.lock()}catch(I){this._worker=new a("error"),this._worker.error(I)}}f.prototype={accumulate:function(p){return u(this,p)},on:function(p,m){var E=this;return p==="data"?this._worker.on(p,function(g){m.call(E,g.data,g.meta)}):this._worker.on(p,function(){n.delay(m,arguments,E)}),this},resume:function(){return n.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(p){if(n.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new d(this,{objectMode:this._outputType!=="nodebuffer"},p)}},i.exports=f},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(t,i,s){if(s.base64=!0,s.array=!0,s.string=!0,s.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",s.nodebuffer=typeof Buffer<"u",s.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")s.blob=!1;else{var n=new ArrayBuffer(0);try{s.blob=new Blob([n],{type:"application/zip"}).size===0}catch{try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);o.append(n),s.blob=o.getBlob("application/zip").size===0}catch{s.blob=!1}}}try{s.nodestream=!!t("readable-stream").Readable}catch{s.nodestream=!1}},{"readable-stream":16}],31:[function(t,i,s){for(var n=t("./utils"),o=t("./support"),a=t("./nodejsUtils"),l=t("./stream/GenericWorker"),c=new Array(256),h=0;h<256;h++)c[h]=252<=h?6:248<=h?5:240<=h?4:224<=h?3:192<=h?2:1;c[254]=c[254]=1;function d(){l.call(this,"utf-8 decode"),this.leftOver=null}function u(){l.call(this,"utf-8 encode")}s.utf8encode=function(f){return o.nodebuffer?a.newBufferFrom(f,"utf-8"):function(p){var m,E,g,I,T,b=p.length,v=0;for(I=0;I<b;I++)(64512&(E=p.charCodeAt(I)))==55296&&I+1<b&&(64512&(g=p.charCodeAt(I+1)))==56320&&(E=65536+(E-55296<<10)+(g-56320),I++),v+=E<128?1:E<2048?2:E<65536?3:4;for(m=o.uint8array?new Uint8Array(v):new Array(v),I=T=0;T<v;I++)(64512&(E=p.charCodeAt(I)))==55296&&I+1<b&&(64512&(g=p.charCodeAt(I+1)))==56320&&(E=65536+(E-55296<<10)+(g-56320),I++),E<128?m[T++]=E:(E<2048?m[T++]=192|E>>>6:(E<65536?m[T++]=224|E>>>12:(m[T++]=240|E>>>18,m[T++]=128|E>>>12&63),m[T++]=128|E>>>6&63),m[T++]=128|63&E);return m}(f)},s.utf8decode=function(f){return o.nodebuffer?n.transformTo("nodebuffer",f).toString("utf-8"):function(p){var m,E,g,I,T=p.length,b=new Array(2*T);for(m=E=0;m<T;)if((g=p[m++])<128)b[E++]=g;else if(4<(I=c[g]))b[E++]=65533,m+=I-1;else{for(g&=I===2?31:I===3?15:7;1<I&&m<T;)g=g<<6|63&p[m++],I--;1<I?b[E++]=65533:g<65536?b[E++]=g:(g-=65536,b[E++]=55296|g>>10&1023,b[E++]=56320|1023&g)}return b.length!==E&&(b.subarray?b=b.subarray(0,E):b.length=E),n.applyFromCharCode(b)}(f=n.transformTo(o.uint8array?"uint8array":"array",f))},n.inherits(d,l),d.prototype.processChunk=function(f){var p=n.transformTo(o.uint8array?"uint8array":"array",f.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var m=p;(p=new Uint8Array(m.length+this.leftOver.length)).set(this.leftOver,0),p.set(m,this.leftOver.length)}else p=this.leftOver.concat(p);this.leftOver=null}var E=function(I,T){var b;for((T=T||I.length)>I.length&&(T=I.length),b=T-1;0<=b&&(192&I[b])==128;)b--;return b<0||b===0?T:b+c[I[b]]>T?b:T}(p),g=p;E!==p.length&&(o.uint8array?(g=p.subarray(0,E),this.leftOver=p.subarray(E,p.length)):(g=p.slice(0,E),this.leftOver=p.slice(E,p.length))),this.push({data:s.utf8decode(g),meta:f.meta})},d.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=d,n.inherits(u,l),u.prototype.processChunk=function(f){this.push({data:s.utf8encode(f.data),meta:f.meta})},s.Utf8EncodeWorker=u},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,i,s){var n=t("./support"),o=t("./base64"),a=t("./nodejsUtils"),l=t("./external");function c(m){return m}function h(m,E){for(var g=0;g<m.length;++g)E[g]=255&m.charCodeAt(g);return E}t("setimmediate"),s.newBlob=function(m,E){s.checkSupport("blob");try{return new Blob([m],{type:E})}catch{try{var g=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return g.append(m),g.getBlob(E)}catch{throw new Error("Bug : can't construct the Blob.")}}};var d={stringifyByChunk:function(m,E,g){var I=[],T=0,b=m.length;if(b<=g)return String.fromCharCode.apply(null,m);for(;T<b;)E==="array"||E==="nodebuffer"?I.push(String.fromCharCode.apply(null,m.slice(T,Math.min(T+g,b)))):I.push(String.fromCharCode.apply(null,m.subarray(T,Math.min(T+g,b)))),T+=g;return I.join("")},stringifyByChar:function(m){for(var E="",g=0;g<m.length;g++)E+=String.fromCharCode(m[g]);return E},applyCanBeUsed:{uint8array:function(){try{return n.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}}(),nodebuffer:function(){try{return n.nodebuffer&&String.fromCharCode.apply(null,a.allocBuffer(1)).length===1}catch{return!1}}()}};function u(m){var E=65536,g=s.getTypeOf(m),I=!0;if(g==="uint8array"?I=d.applyCanBeUsed.uint8array:g==="nodebuffer"&&(I=d.applyCanBeUsed.nodebuffer),I)for(;1<E;)try{return d.stringifyByChunk(m,g,E)}catch{E=Math.floor(E/2)}return d.stringifyByChar(m)}function f(m,E){for(var g=0;g<m.length;g++)E[g]=m[g];return E}s.applyFromCharCode=u;var p={};p.string={string:c,array:function(m){return h(m,new Array(m.length))},arraybuffer:function(m){return p.string.uint8array(m).buffer},uint8array:function(m){return h(m,new Uint8Array(m.length))},nodebuffer:function(m){return h(m,a.allocBuffer(m.length))}},p.array={string:u,array:c,arraybuffer:function(m){return new Uint8Array(m).buffer},uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return a.newBufferFrom(m)}},p.arraybuffer={string:function(m){return u(new Uint8Array(m))},array:function(m){return f(new Uint8Array(m),new Array(m.byteLength))},arraybuffer:c,uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return a.newBufferFrom(new Uint8Array(m))}},p.uint8array={string:u,array:function(m){return f(m,new Array(m.length))},arraybuffer:function(m){return m.buffer},uint8array:c,nodebuffer:function(m){return a.newBufferFrom(m)}},p.nodebuffer={string:u,array:function(m){return f(m,new Array(m.length))},arraybuffer:function(m){return p.nodebuffer.uint8array(m).buffer},uint8array:function(m){return f(m,new Uint8Array(m.length))},nodebuffer:c},s.transformTo=function(m,E){if(E=E||"",!m)return E;s.checkSupport(m);var g=s.getTypeOf(E);return p[g][m](E)},s.resolve=function(m){for(var E=m.split("/"),g=[],I=0;I<E.length;I++){var T=E[I];T==="."||T===""&&I!==0&&I!==E.length-1||(T===".."?g.pop():g.push(T))}return g.join("/")},s.getTypeOf=function(m){return typeof m=="string"?"string":Object.prototype.toString.call(m)==="[object Array]"?"array":n.nodebuffer&&a.isBuffer(m)?"nodebuffer":n.uint8array&&m instanceof Uint8Array?"uint8array":n.arraybuffer&&m instanceof ArrayBuffer?"arraybuffer":void 0},s.checkSupport=function(m){if(!n[m.toLowerCase()])throw new Error(m+" is not supported by this platform")},s.MAX_VALUE_16BITS=65535,s.MAX_VALUE_32BITS=-1,s.pretty=function(m){var E,g,I="";for(g=0;g<(m||"").length;g++)I+="\\x"+((E=m.charCodeAt(g))<16?"0":"")+E.toString(16).toUpperCase();return I},s.delay=function(m,E,g){setImmediate(function(){m.apply(g||null,E||[])})},s.inherits=function(m,E){function g(){}g.prototype=E.prototype,m.prototype=new g},s.extend=function(){var m,E,g={};for(m=0;m<arguments.length;m++)for(E in arguments[m])Object.prototype.hasOwnProperty.call(arguments[m],E)&&g[E]===void 0&&(g[E]=arguments[m][E]);return g},s.prepareContent=function(m,E,g,I,T){return l.Promise.resolve(E).then(function(b){return n.blob&&(b instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(b))!==-1)&&typeof FileReader<"u"?new l.Promise(function(v,A){var S=new FileReader;S.onload=function(N){v(N.target.result)},S.onerror=function(N){A(N.target.error)},S.readAsArrayBuffer(b)}):b}).then(function(b){var v=s.getTypeOf(b);return v?(v==="arraybuffer"?b=s.transformTo("uint8array",b):v==="string"&&(T?b=o.decode(b):g&&I!==!0&&(b=function(A){return h(A,n.uint8array?new Uint8Array(A.length):new Array(A.length))}(b))),b):l.Promise.reject(new Error("Can't read the data of '"+m+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(t,i,s){var n=t("./reader/readerFor"),o=t("./utils"),a=t("./signature"),l=t("./zipEntry"),c=t("./support");function h(d){this.files=[],this.loadOptions=d}h.prototype={checkSignature:function(d){if(!this.reader.readAndCheckSignature(d)){this.reader.index-=4;var u=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+o.pretty(u)+", expected "+o.pretty(d)+")")}},isSignature:function(d,u){var f=this.reader.index;this.reader.setIndex(d);var p=this.reader.readString(4)===u;return this.reader.setIndex(f),p},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var d=this.reader.readData(this.zipCommentLength),u=c.uint8array?"uint8array":"array",f=o.transformTo(u,d);this.zipComment=this.loadOptions.decodeFileName(f)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var d,u,f,p=this.zip64EndOfCentralSize-44;0<p;)d=this.reader.readInt(2),u=this.reader.readInt(4),f=this.reader.readData(u),this.zip64ExtensibleData[d]={id:d,length:u,value:f}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var d,u;for(d=0;d<this.files.length;d++)u=this.files[d],this.reader.setIndex(u.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),u.readLocalPart(this.reader),u.handleUTF8(),u.processAttributes()},readCentralDir:function(){var d;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(d=new l({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(d);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var d=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(d<0)throw this.isSignature(0,a.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(d);var u=d;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===o.MAX_VALUE_16BITS||this.diskWithCentralDirStart===o.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===o.MAX_VALUE_16BITS||this.centralDirRecords===o.MAX_VALUE_16BITS||this.centralDirSize===o.MAX_VALUE_32BITS||this.centralDirOffset===o.MAX_VALUE_32BITS){if(this.zip64=!0,(d=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(d),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var f=this.centralDirOffset+this.centralDirSize;this.zip64&&(f+=20,f+=12+this.zip64EndOfCentralSize);var p=u-f;if(0<p)this.isSignature(u,a.CENTRAL_FILE_HEADER)||(this.reader.zero=p);else if(p<0)throw new Error("Corrupted zip: missing "+Math.abs(p)+" bytes.")},prepareReader:function(d){this.reader=n(d)},load:function(d){this.prepareReader(d),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},i.exports=h},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(t,i,s){var n=t("./reader/readerFor"),o=t("./utils"),a=t("./compressedObject"),l=t("./crc32"),c=t("./utf8"),h=t("./compressions"),d=t("./support");function u(f,p){this.options=f,this.loadOptions=p}u.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(f){var p,m;if(f.skip(22),this.fileNameLength=f.readInt(2),m=f.readInt(2),this.fileName=f.readData(this.fileNameLength),f.skip(m),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((p=function(E){for(var g in h)if(Object.prototype.hasOwnProperty.call(h,g)&&h[g].magic===E)return h[g];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+o.pretty(this.compressionMethod)+" unknown (inner file : "+o.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,p,f.readData(this.compressedSize))},readCentralPart:function(f){this.versionMadeBy=f.readInt(2),f.skip(2),this.bitFlag=f.readInt(2),this.compressionMethod=f.readString(2),this.date=f.readDate(),this.crc32=f.readInt(4),this.compressedSize=f.readInt(4),this.uncompressedSize=f.readInt(4);var p=f.readInt(2);if(this.extraFieldsLength=f.readInt(2),this.fileCommentLength=f.readInt(2),this.diskNumberStart=f.readInt(2),this.internalFileAttributes=f.readInt(2),this.externalFileAttributes=f.readInt(4),this.localHeaderOffset=f.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");f.skip(p),this.readExtraFields(f),this.parseZIP64ExtraField(f),this.fileComment=f.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var f=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),f==0&&(this.dosPermissions=63&this.externalFileAttributes),f==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var f=n(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=f.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=f.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=f.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=f.readInt(4))}},readExtraFields:function(f){var p,m,E,g=f.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});f.index+4<g;)p=f.readInt(2),m=f.readInt(2),E=f.readData(m),this.extraFields[p]={id:p,length:m,value:E};f.setIndex(g)},handleUTF8:function(){var f=d.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=c.utf8decode(this.fileName),this.fileCommentStr=c.utf8decode(this.fileComment);else{var p=this.findExtraFieldUnicodePath();if(p!==null)this.fileNameStr=p;else{var m=o.transformTo(f,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(m)}var E=this.findExtraFieldUnicodeComment();if(E!==null)this.fileCommentStr=E;else{var g=o.transformTo(f,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(g)}}},findExtraFieldUnicodePath:function(){var f=this.extraFields[28789];if(f){var p=n(f.value);return p.readInt(1)!==1||l(this.fileName)!==p.readInt(4)?null:c.utf8decode(p.readData(f.length-5))}return null},findExtraFieldUnicodeComment:function(){var f=this.extraFields[25461];if(f){var p=n(f.value);return p.readInt(1)!==1||l(this.fileComment)!==p.readInt(4)?null:c.utf8decode(p.readData(f.length-5))}return null}},i.exports=u},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(t,i,s){function n(p,m,E){this.name=p,this.dir=E.dir,this.date=E.date,this.comment=E.comment,this.unixPermissions=E.unixPermissions,this.dosPermissions=E.dosPermissions,this._data=m,this._dataBinary=E.binary,this.options={compression:E.compression,compressionOptions:E.compressionOptions}}var o=t("./stream/StreamHelper"),a=t("./stream/DataWorker"),l=t("./utf8"),c=t("./compressedObject"),h=t("./stream/GenericWorker");n.prototype={internalStream:function(p){var m=null,E="string";try{if(!p)throw new Error("No output type specified.");var g=(E=p.toLowerCase())==="string"||E==="text";E!=="binarystring"&&E!=="text"||(E="string"),m=this._decompressWorker();var I=!this._dataBinary;I&&!g&&(m=m.pipe(new l.Utf8EncodeWorker)),!I&&g&&(m=m.pipe(new l.Utf8DecodeWorker))}catch(T){(m=new h("error")).error(T)}return new o(m,E,"")},async:function(p,m){return this.internalStream(p).accumulate(m)},nodeStream:function(p,m){return this.internalStream(p||"nodebuffer").toNodejsStream(m)},_compressWorker:function(p,m){if(this._data instanceof c&&this._data.compression.magic===p.magic)return this._data.getCompressedWorker();var E=this._decompressWorker();return this._dataBinary||(E=E.pipe(new l.Utf8EncodeWorker)),c.createWorkerFrom(E,p,m)},_decompressWorker:function(){return this._data instanceof c?this._data.getContentWorker():this._data instanceof h?this._data:new a(this._data)}};for(var d=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],u=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},f=0;f<d.length;f++)n.prototype[d[f]]=u;i.exports=n},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(t,i,s){(function(n){var o,a,l=n.MutationObserver||n.WebKitMutationObserver;if(l){var c=0,h=new l(p),d=n.document.createTextNode("");h.observe(d,{characterData:!0}),o=function(){d.data=c=++c%2}}else if(n.setImmediate||n.MessageChannel===void 0)o="document"in n&&"onreadystatechange"in n.document.createElement("script")?function(){var m=n.document.createElement("script");m.onreadystatechange=function(){p(),m.onreadystatechange=null,m.parentNode.removeChild(m),m=null},n.document.documentElement.appendChild(m)}:function(){setTimeout(p,0)};else{var u=new n.MessageChannel;u.port1.onmessage=p,o=function(){u.port2.postMessage(0)}}var f=[];function p(){var m,E;a=!0;for(var g=f.length;g;){for(E=f,f=[],m=-1;++m<g;)E[m]();g=f.length}a=!1}i.exports=function(m){f.push(m)!==1||a||o()}}).call(this,typeof Un<"u"?Un:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(t,i,s){var n=t("immediate");function o(){}var a={},l=["REJECTED"],c=["FULFILLED"],h=["PENDING"];function d(g){if(typeof g!="function")throw new TypeError("resolver must be a function");this.state=h,this.queue=[],this.outcome=void 0,g!==o&&m(this,g)}function u(g,I,T){this.promise=g,typeof I=="function"&&(this.onFulfilled=I,this.callFulfilled=this.otherCallFulfilled),typeof T=="function"&&(this.onRejected=T,this.callRejected=this.otherCallRejected)}function f(g,I,T){n(function(){var b;try{b=I(T)}catch(v){return a.reject(g,v)}b===g?a.reject(g,new TypeError("Cannot resolve promise with itself")):a.resolve(g,b)})}function p(g){var I=g&&g.then;if(g&&(typeof g=="object"||typeof g=="function")&&typeof I=="function")return function(){I.apply(g,arguments)}}function m(g,I){var T=!1;function b(S){T||(T=!0,a.reject(g,S))}function v(S){T||(T=!0,a.resolve(g,S))}var A=E(function(){I(v,b)});A.status==="error"&&b(A.value)}function E(g,I){var T={};try{T.value=g(I),T.status="success"}catch(b){T.status="error",T.value=b}return T}(i.exports=d).prototype.finally=function(g){if(typeof g!="function")return this;var I=this.constructor;return this.then(function(T){return I.resolve(g()).then(function(){return T})},function(T){return I.resolve(g()).then(function(){throw T})})},d.prototype.catch=function(g){return this.then(null,g)},d.prototype.then=function(g,I){if(typeof g!="function"&&this.state===c||typeof I!="function"&&this.state===l)return this;var T=new this.constructor(o);return this.state!==h?f(T,this.state===c?g:I,this.outcome):this.queue.push(new u(T,g,I)),T},u.prototype.callFulfilled=function(g){a.resolve(this.promise,g)},u.prototype.otherCallFulfilled=function(g){f(this.promise,this.onFulfilled,g)},u.prototype.callRejected=function(g){a.reject(this.promise,g)},u.prototype.otherCallRejected=function(g){f(this.promise,this.onRejected,g)},a.resolve=function(g,I){var T=E(p,I);if(T.status==="error")return a.reject(g,T.value);var b=T.value;if(b)m(g,b);else{g.state=c,g.outcome=I;for(var v=-1,A=g.queue.length;++v<A;)g.queue[v].callFulfilled(I)}return g},a.reject=function(g,I){g.state=l,g.outcome=I;for(var T=-1,b=g.queue.length;++T<b;)g.queue[T].callRejected(I);return g},d.resolve=function(g){return g instanceof this?g:a.resolve(new this(o),g)},d.reject=function(g){var I=new this(o);return a.reject(I,g)},d.all=function(g){var I=this;if(Object.prototype.toString.call(g)!=="[object Array]")return this.reject(new TypeError("must be an array"));var T=g.length,b=!1;if(!T)return this.resolve([]);for(var v=new Array(T),A=0,S=-1,N=new this(o);++S<T;)R(g[S],S);return N;function R(P,M){I.resolve(P).then(function(w){v[M]=w,++A!==T||b||(b=!0,a.resolve(N,v))},function(w){b||(b=!0,a.reject(N,w))})}},d.race=function(g){var I=this;if(Object.prototype.toString.call(g)!=="[object Array]")return this.reject(new TypeError("must be an array"));var T=g.length,b=!1;if(!T)return this.resolve([]);for(var v=-1,A=new this(o);++v<T;)S=g[v],I.resolve(S).then(function(N){b||(b=!0,a.resolve(A,N))},function(N){b||(b=!0,a.reject(A,N))});var S;return A}},{immediate:36}],38:[function(t,i,s){var n={};(0,t("./lib/utils/common").assign)(n,t("./lib/deflate"),t("./lib/inflate"),t("./lib/zlib/constants")),i.exports=n},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(t,i,s){var n=t("./zlib/deflate"),o=t("./utils/common"),a=t("./utils/strings"),l=t("./zlib/messages"),c=t("./zlib/zstream"),h=Object.prototype.toString,d=0,u=-1,f=0,p=8;function m(g){if(!(this instanceof m))return new m(g);this.options=o.assign({level:u,method:p,chunkSize:16384,windowBits:15,memLevel:8,strategy:f,to:""},g||{});var I=this.options;I.raw&&0<I.windowBits?I.windowBits=-I.windowBits:I.gzip&&0<I.windowBits&&I.windowBits<16&&(I.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var T=n.deflateInit2(this.strm,I.level,I.method,I.windowBits,I.memLevel,I.strategy);if(T!==d)throw new Error(l[T]);if(I.header&&n.deflateSetHeader(this.strm,I.header),I.dictionary){var b;if(b=typeof I.dictionary=="string"?a.string2buf(I.dictionary):h.call(I.dictionary)==="[object ArrayBuffer]"?new Uint8Array(I.dictionary):I.dictionary,(T=n.deflateSetDictionary(this.strm,b))!==d)throw new Error(l[T]);this._dict_set=!0}}function E(g,I){var T=new m(I);if(T.push(g,!0),T.err)throw T.msg||l[T.err];return T.result}m.prototype.push=function(g,I){var T,b,v=this.strm,A=this.options.chunkSize;if(this.ended)return!1;b=I===~~I?I:I===!0?4:0,typeof g=="string"?v.input=a.string2buf(g):h.call(g)==="[object ArrayBuffer]"?v.input=new Uint8Array(g):v.input=g,v.next_in=0,v.avail_in=v.input.length;do{if(v.avail_out===0&&(v.output=new o.Buf8(A),v.next_out=0,v.avail_out=A),(T=n.deflate(v,b))!==1&&T!==d)return this.onEnd(T),!(this.ended=!0);v.avail_out!==0&&(v.avail_in!==0||b!==4&&b!==2)||(this.options.to==="string"?this.onData(a.buf2binstring(o.shrinkBuf(v.output,v.next_out))):this.onData(o.shrinkBuf(v.output,v.next_out)))}while((0<v.avail_in||v.avail_out===0)&&T!==1);return b===4?(T=n.deflateEnd(this.strm),this.onEnd(T),this.ended=!0,T===d):b!==2||(this.onEnd(d),!(v.avail_out=0))},m.prototype.onData=function(g){this.chunks.push(g)},m.prototype.onEnd=function(g){g===d&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=g,this.msg=this.strm.msg},s.Deflate=m,s.deflate=E,s.deflateRaw=function(g,I){return(I=I||{}).raw=!0,E(g,I)},s.gzip=function(g,I){return(I=I||{}).gzip=!0,E(g,I)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(t,i,s){var n=t("./zlib/inflate"),o=t("./utils/common"),a=t("./utils/strings"),l=t("./zlib/constants"),c=t("./zlib/messages"),h=t("./zlib/zstream"),d=t("./zlib/gzheader"),u=Object.prototype.toString;function f(m){if(!(this instanceof f))return new f(m);this.options=o.assign({chunkSize:16384,windowBits:0,to:""},m||{});var E=this.options;E.raw&&0<=E.windowBits&&E.windowBits<16&&(E.windowBits=-E.windowBits,E.windowBits===0&&(E.windowBits=-15)),!(0<=E.windowBits&&E.windowBits<16)||m&&m.windowBits||(E.windowBits+=32),15<E.windowBits&&E.windowBits<48&&!(15&E.windowBits)&&(E.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new h,this.strm.avail_out=0;var g=n.inflateInit2(this.strm,E.windowBits);if(g!==l.Z_OK)throw new Error(c[g]);this.header=new d,n.inflateGetHeader(this.strm,this.header)}function p(m,E){var g=new f(E);if(g.push(m,!0),g.err)throw g.msg||c[g.err];return g.result}f.prototype.push=function(m,E){var g,I,T,b,v,A,S=this.strm,N=this.options.chunkSize,R=this.options.dictionary,P=!1;if(this.ended)return!1;I=E===~~E?E:E===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof m=="string"?S.input=a.binstring2buf(m):u.call(m)==="[object ArrayBuffer]"?S.input=new Uint8Array(m):S.input=m,S.next_in=0,S.avail_in=S.input.length;do{if(S.avail_out===0&&(S.output=new o.Buf8(N),S.next_out=0,S.avail_out=N),(g=n.inflate(S,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&R&&(A=typeof R=="string"?a.string2buf(R):u.call(R)==="[object ArrayBuffer]"?new Uint8Array(R):R,g=n.inflateSetDictionary(this.strm,A)),g===l.Z_BUF_ERROR&&P===!0&&(g=l.Z_OK,P=!1),g!==l.Z_STREAM_END&&g!==l.Z_OK)return this.onEnd(g),!(this.ended=!0);S.next_out&&(S.avail_out!==0&&g!==l.Z_STREAM_END&&(S.avail_in!==0||I!==l.Z_FINISH&&I!==l.Z_SYNC_FLUSH)||(this.options.to==="string"?(T=a.utf8border(S.output,S.next_out),b=S.next_out-T,v=a.buf2string(S.output,T),S.next_out=b,S.avail_out=N-b,b&&o.arraySet(S.output,S.output,T,b,0),this.onData(v)):this.onData(o.shrinkBuf(S.output,S.next_out)))),S.avail_in===0&&S.avail_out===0&&(P=!0)}while((0<S.avail_in||S.avail_out===0)&&g!==l.Z_STREAM_END);return g===l.Z_STREAM_END&&(I=l.Z_FINISH),I===l.Z_FINISH?(g=n.inflateEnd(this.strm),this.onEnd(g),this.ended=!0,g===l.Z_OK):I!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),!(S.avail_out=0))},f.prototype.onData=function(m){this.chunks.push(m)},f.prototype.onEnd=function(m){m===l.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=m,this.msg=this.strm.msg},s.Inflate=f,s.inflate=p,s.inflateRaw=function(m,E){return(E=E||{}).raw=!0,p(m,E)},s.ungzip=p},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(t,i,s){var n=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";s.assign=function(l){for(var c=Array.prototype.slice.call(arguments,1);c.length;){var h=c.shift();if(h){if(typeof h!="object")throw new TypeError(h+"must be non-object");for(var d in h)h.hasOwnProperty(d)&&(l[d]=h[d])}}return l},s.shrinkBuf=function(l,c){return l.length===c?l:l.subarray?l.subarray(0,c):(l.length=c,l)};var o={arraySet:function(l,c,h,d,u){if(c.subarray&&l.subarray)l.set(c.subarray(h,h+d),u);else for(var f=0;f<d;f++)l[u+f]=c[h+f]},flattenChunks:function(l){var c,h,d,u,f,p;for(c=d=0,h=l.length;c<h;c++)d+=l[c].length;for(p=new Uint8Array(d),c=u=0,h=l.length;c<h;c++)f=l[c],p.set(f,u),u+=f.length;return p}},a={arraySet:function(l,c,h,d,u){for(var f=0;f<d;f++)l[u+f]=c[h+f]},flattenChunks:function(l){return[].concat.apply([],l)}};s.setTyped=function(l){l?(s.Buf8=Uint8Array,s.Buf16=Uint16Array,s.Buf32=Int32Array,s.assign(s,o)):(s.Buf8=Array,s.Buf16=Array,s.Buf32=Array,s.assign(s,a))},s.setTyped(n)},{}],42:[function(t,i,s){var n=t("./common"),o=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch{o=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{a=!1}for(var l=new n.Buf8(256),c=0;c<256;c++)l[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;function h(d,u){if(u<65537&&(d.subarray&&a||!d.subarray&&o))return String.fromCharCode.apply(null,n.shrinkBuf(d,u));for(var f="",p=0;p<u;p++)f+=String.fromCharCode(d[p]);return f}l[254]=l[254]=1,s.string2buf=function(d){var u,f,p,m,E,g=d.length,I=0;for(m=0;m<g;m++)(64512&(f=d.charCodeAt(m)))==55296&&m+1<g&&(64512&(p=d.charCodeAt(m+1)))==56320&&(f=65536+(f-55296<<10)+(p-56320),m++),I+=f<128?1:f<2048?2:f<65536?3:4;for(u=new n.Buf8(I),m=E=0;E<I;m++)(64512&(f=d.charCodeAt(m)))==55296&&m+1<g&&(64512&(p=d.charCodeAt(m+1)))==56320&&(f=65536+(f-55296<<10)+(p-56320),m++),f<128?u[E++]=f:(f<2048?u[E++]=192|f>>>6:(f<65536?u[E++]=224|f>>>12:(u[E++]=240|f>>>18,u[E++]=128|f>>>12&63),u[E++]=128|f>>>6&63),u[E++]=128|63&f);return u},s.buf2binstring=function(d){return h(d,d.length)},s.binstring2buf=function(d){for(var u=new n.Buf8(d.length),f=0,p=u.length;f<p;f++)u[f]=d.charCodeAt(f);return u},s.buf2string=function(d,u){var f,p,m,E,g=u||d.length,I=new Array(2*g);for(f=p=0;f<g;)if((m=d[f++])<128)I[p++]=m;else if(4<(E=l[m]))I[p++]=65533,f+=E-1;else{for(m&=E===2?31:E===3?15:7;1<E&&f<g;)m=m<<6|63&d[f++],E--;1<E?I[p++]=65533:m<65536?I[p++]=m:(m-=65536,I[p++]=55296|m>>10&1023,I[p++]=56320|1023&m)}return h(I,p)},s.utf8border=function(d,u){var f;for((u=u||d.length)>d.length&&(u=d.length),f=u-1;0<=f&&(192&d[f])==128;)f--;return f<0||f===0?u:f+l[d[f]]>u?f:u}},{"./common":41}],43:[function(t,i,s){i.exports=function(n,o,a,l){for(var c=65535&n|0,h=n>>>16&65535|0,d=0;a!==0;){for(a-=d=2e3<a?2e3:a;h=h+(c=c+o[l++]|0)|0,--d;);c%=65521,h%=65521}return c|h<<16|0}},{}],44:[function(t,i,s){i.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(t,i,s){var n=function(){for(var o,a=[],l=0;l<256;l++){o=l;for(var c=0;c<8;c++)o=1&o?3988292384^o>>>1:o>>>1;a[l]=o}return a}();i.exports=function(o,a,l,c){var h=n,d=c+l;o^=-1;for(var u=c;u<d;u++)o=o>>>8^h[255&(o^a[u])];return-1^o}},{}],46:[function(t,i,s){var n,o=t("../utils/common"),a=t("./trees"),l=t("./adler32"),c=t("./crc32"),h=t("./messages"),d=0,u=4,f=0,p=-2,m=-1,E=4,g=2,I=8,T=9,b=286,v=30,A=19,S=2*b+1,N=15,R=3,P=258,M=P+R+1,w=42,L=113,C=1,U=2,q=3,G=4;function st(_,j){return _.msg=h[j],j}function Y(_){return(_<<1)-(4<_?9:0)}function ot(_){for(var j=_.length;0<=--j;)_[j]=0}function $(_){var j=_.state,V=j.pending;V>_.avail_out&&(V=_.avail_out),V!==0&&(o.arraySet(_.output,j.pending_buf,j.pending_out,V,_.next_out),_.next_out+=V,j.pending_out+=V,_.total_out+=V,_.avail_out-=V,j.pending-=V,j.pending===0&&(j.pending_out=0))}function B(_,j){a._tr_flush_block(_,0<=_.block_start?_.block_start:-1,_.strstart-_.block_start,j),_.block_start=_.strstart,$(_.strm)}function at(_,j){_.pending_buf[_.pending++]=j}function nt(_,j){_.pending_buf[_.pending++]=j>>>8&255,_.pending_buf[_.pending++]=255&j}function it(_,j){var V,x,O=_.max_chain_length,k=_.strstart,Z=_.prev_length,Q=_.nice_match,z=_.strstart>_.w_size-M?_.strstart-(_.w_size-M):0,J=_.window,rt=_.w_mask,et=_.prev,ct=_.strstart+P,Tt=J[k+Z-1],mt=J[k+Z];_.prev_length>=_.good_match&&(O>>=2),Q>_.lookahead&&(Q=_.lookahead);do if(J[(V=j)+Z]===mt&&J[V+Z-1]===Tt&&J[V]===J[k]&&J[++V]===J[k+1]){k+=2,V++;do;while(J[++k]===J[++V]&&J[++k]===J[++V]&&J[++k]===J[++V]&&J[++k]===J[++V]&&J[++k]===J[++V]&&J[++k]===J[++V]&&J[++k]===J[++V]&&J[++k]===J[++V]&&k<ct);if(x=P-(ct-k),k=ct-P,Z<x){if(_.match_start=j,Q<=(Z=x))break;Tt=J[k+Z-1],mt=J[k+Z]}}while((j=et[j&rt])>z&&--O!=0);return Z<=_.lookahead?Z:_.lookahead}function Rt(_){var j,V,x,O,k,Z,Q,z,J,rt,et=_.w_size;do{if(O=_.window_size-_.lookahead-_.strstart,_.strstart>=et+(et-M)){for(o.arraySet(_.window,_.window,et,et,0),_.match_start-=et,_.strstart-=et,_.block_start-=et,j=V=_.hash_size;x=_.head[--j],_.head[j]=et<=x?x-et:0,--V;);for(j=V=et;x=_.prev[--j],_.prev[j]=et<=x?x-et:0,--V;);O+=et}if(_.strm.avail_in===0)break;if(Z=_.strm,Q=_.window,z=_.strstart+_.lookahead,J=O,rt=void 0,rt=Z.avail_in,J<rt&&(rt=J),V=rt===0?0:(Z.avail_in-=rt,o.arraySet(Q,Z.input,Z.next_in,rt,z),Z.state.wrap===1?Z.adler=l(Z.adler,Q,rt,z):Z.state.wrap===2&&(Z.adler=c(Z.adler,Q,rt,z)),Z.next_in+=rt,Z.total_in+=rt,rt),_.lookahead+=V,_.lookahead+_.insert>=R)for(k=_.strstart-_.insert,_.ins_h=_.window[k],_.ins_h=(_.ins_h<<_.hash_shift^_.window[k+1])&_.hash_mask;_.insert&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[k+R-1])&_.hash_mask,_.prev[k&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=k,k++,_.insert--,!(_.lookahead+_.insert<R)););}while(_.lookahead<M&&_.strm.avail_in!==0)}function xt(_,j){for(var V,x;;){if(_.lookahead<M){if(Rt(_),_.lookahead<M&&j===d)return C;if(_.lookahead===0)break}if(V=0,_.lookahead>=R&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+R-1])&_.hash_mask,V=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),V!==0&&_.strstart-V<=_.w_size-M&&(_.match_length=it(_,V)),_.match_length>=R)if(x=a._tr_tally(_,_.strstart-_.match_start,_.match_length-R),_.lookahead-=_.match_length,_.match_length<=_.max_lazy_match&&_.lookahead>=R){for(_.match_length--;_.strstart++,_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+R-1])&_.hash_mask,V=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart,--_.match_length!=0;);_.strstart++}else _.strstart+=_.match_length,_.match_length=0,_.ins_h=_.window[_.strstart],_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+1])&_.hash_mask;else x=a._tr_tally(_,0,_.window[_.strstart]),_.lookahead--,_.strstart++;if(x&&(B(_,!1),_.strm.avail_out===0))return C}return _.insert=_.strstart<R-1?_.strstart:R-1,j===u?(B(_,!0),_.strm.avail_out===0?q:G):_.last_lit&&(B(_,!1),_.strm.avail_out===0)?C:U}function lt(_,j){for(var V,x,O;;){if(_.lookahead<M){if(Rt(_),_.lookahead<M&&j===d)return C;if(_.lookahead===0)break}if(V=0,_.lookahead>=R&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+R-1])&_.hash_mask,V=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),_.prev_length=_.match_length,_.prev_match=_.match_start,_.match_length=R-1,V!==0&&_.prev_length<_.max_lazy_match&&_.strstart-V<=_.w_size-M&&(_.match_length=it(_,V),_.match_length<=5&&(_.strategy===1||_.match_length===R&&4096<_.strstart-_.match_start)&&(_.match_length=R-1)),_.prev_length>=R&&_.match_length<=_.prev_length){for(O=_.strstart+_.lookahead-R,x=a._tr_tally(_,_.strstart-1-_.prev_match,_.prev_length-R),_.lookahead-=_.prev_length-1,_.prev_length-=2;++_.strstart<=O&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+R-1])&_.hash_mask,V=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),--_.prev_length!=0;);if(_.match_available=0,_.match_length=R-1,_.strstart++,x&&(B(_,!1),_.strm.avail_out===0))return C}else if(_.match_available){if((x=a._tr_tally(_,0,_.window[_.strstart-1]))&&B(_,!1),_.strstart++,_.lookahead--,_.strm.avail_out===0)return C}else _.match_available=1,_.strstart++,_.lookahead--}return _.match_available&&(x=a._tr_tally(_,0,_.window[_.strstart-1]),_.match_available=0),_.insert=_.strstart<R-1?_.strstart:R-1,j===u?(B(_,!0),_.strm.avail_out===0?q:G):_.last_lit&&(B(_,!1),_.strm.avail_out===0)?C:U}function pt(_,j,V,x,O){this.good_length=_,this.max_lazy=j,this.nice_length=V,this.max_chain=x,this.func=O}function ft(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=I,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new o.Buf16(2*S),this.dyn_dtree=new o.Buf16(2*(2*v+1)),this.bl_tree=new o.Buf16(2*(2*A+1)),ot(this.dyn_ltree),ot(this.dyn_dtree),ot(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new o.Buf16(N+1),this.heap=new o.Buf16(2*b+1),ot(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new o.Buf16(2*b+1),ot(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Ct(_){var j;return _&&_.state?(_.total_in=_.total_out=0,_.data_type=g,(j=_.state).pending=0,j.pending_out=0,j.wrap<0&&(j.wrap=-j.wrap),j.status=j.wrap?w:L,_.adler=j.wrap===2?0:1,j.last_flush=d,a._tr_init(j),f):st(_,p)}function Kt(_){var j=Ct(_);return j===f&&function(V){V.window_size=2*V.w_size,ot(V.head),V.max_lazy_match=n[V.level].max_lazy,V.good_match=n[V.level].good_length,V.nice_match=n[V.level].nice_length,V.max_chain_length=n[V.level].max_chain,V.strstart=0,V.block_start=0,V.lookahead=0,V.insert=0,V.match_length=V.prev_length=R-1,V.match_available=0,V.ins_h=0}(_.state),j}function $t(_,j,V,x,O,k){if(!_)return p;var Z=1;if(j===m&&(j=6),x<0?(Z=0,x=-x):15<x&&(Z=2,x-=16),O<1||T<O||V!==I||x<8||15<x||j<0||9<j||k<0||E<k)return st(_,p);x===8&&(x=9);var Q=new ft;return(_.state=Q).strm=_,Q.wrap=Z,Q.gzhead=null,Q.w_bits=x,Q.w_size=1<<Q.w_bits,Q.w_mask=Q.w_size-1,Q.hash_bits=O+7,Q.hash_size=1<<Q.hash_bits,Q.hash_mask=Q.hash_size-1,Q.hash_shift=~~((Q.hash_bits+R-1)/R),Q.window=new o.Buf8(2*Q.w_size),Q.head=new o.Buf16(Q.hash_size),Q.prev=new o.Buf16(Q.w_size),Q.lit_bufsize=1<<O+6,Q.pending_buf_size=4*Q.lit_bufsize,Q.pending_buf=new o.Buf8(Q.pending_buf_size),Q.d_buf=1*Q.lit_bufsize,Q.l_buf=3*Q.lit_bufsize,Q.level=j,Q.strategy=k,Q.method=V,Kt(_)}n=[new pt(0,0,0,0,function(_,j){var V=65535;for(V>_.pending_buf_size-5&&(V=_.pending_buf_size-5);;){if(_.lookahead<=1){if(Rt(_),_.lookahead===0&&j===d)return C;if(_.lookahead===0)break}_.strstart+=_.lookahead,_.lookahead=0;var x=_.block_start+V;if((_.strstart===0||_.strstart>=x)&&(_.lookahead=_.strstart-x,_.strstart=x,B(_,!1),_.strm.avail_out===0)||_.strstart-_.block_start>=_.w_size-M&&(B(_,!1),_.strm.avail_out===0))return C}return _.insert=0,j===u?(B(_,!0),_.strm.avail_out===0?q:G):(_.strstart>_.block_start&&(B(_,!1),_.strm.avail_out),C)}),new pt(4,4,8,4,xt),new pt(4,5,16,8,xt),new pt(4,6,32,32,xt),new pt(4,4,16,16,lt),new pt(8,16,32,32,lt),new pt(8,16,128,128,lt),new pt(8,32,128,256,lt),new pt(32,128,258,1024,lt),new pt(32,258,258,4096,lt)],s.deflateInit=function(_,j){return $t(_,j,I,15,8,0)},s.deflateInit2=$t,s.deflateReset=Kt,s.deflateResetKeep=Ct,s.deflateSetHeader=function(_,j){return _&&_.state?_.state.wrap!==2?p:(_.state.gzhead=j,f):p},s.deflate=function(_,j){var V,x,O,k;if(!_||!_.state||5<j||j<0)return _?st(_,p):p;if(x=_.state,!_.output||!_.input&&_.avail_in!==0||x.status===666&&j!==u)return st(_,_.avail_out===0?-5:p);if(x.strm=_,V=x.last_flush,x.last_flush=j,x.status===w)if(x.wrap===2)_.adler=0,at(x,31),at(x,139),at(x,8),x.gzhead?(at(x,(x.gzhead.text?1:0)+(x.gzhead.hcrc?2:0)+(x.gzhead.extra?4:0)+(x.gzhead.name?8:0)+(x.gzhead.comment?16:0)),at(x,255&x.gzhead.time),at(x,x.gzhead.time>>8&255),at(x,x.gzhead.time>>16&255),at(x,x.gzhead.time>>24&255),at(x,x.level===9?2:2<=x.strategy||x.level<2?4:0),at(x,255&x.gzhead.os),x.gzhead.extra&&x.gzhead.extra.length&&(at(x,255&x.gzhead.extra.length),at(x,x.gzhead.extra.length>>8&255)),x.gzhead.hcrc&&(_.adler=c(_.adler,x.pending_buf,x.pending,0)),x.gzindex=0,x.status=69):(at(x,0),at(x,0),at(x,0),at(x,0),at(x,0),at(x,x.level===9?2:2<=x.strategy||x.level<2?4:0),at(x,3),x.status=L);else{var Z=I+(x.w_bits-8<<4)<<8;Z|=(2<=x.strategy||x.level<2?0:x.level<6?1:x.level===6?2:3)<<6,x.strstart!==0&&(Z|=32),Z+=31-Z%31,x.status=L,nt(x,Z),x.strstart!==0&&(nt(x,_.adler>>>16),nt(x,65535&_.adler)),_.adler=1}if(x.status===69)if(x.gzhead.extra){for(O=x.pending;x.gzindex<(65535&x.gzhead.extra.length)&&(x.pending!==x.pending_buf_size||(x.gzhead.hcrc&&x.pending>O&&(_.adler=c(_.adler,x.pending_buf,x.pending-O,O)),$(_),O=x.pending,x.pending!==x.pending_buf_size));)at(x,255&x.gzhead.extra[x.gzindex]),x.gzindex++;x.gzhead.hcrc&&x.pending>O&&(_.adler=c(_.adler,x.pending_buf,x.pending-O,O)),x.gzindex===x.gzhead.extra.length&&(x.gzindex=0,x.status=73)}else x.status=73;if(x.status===73)if(x.gzhead.name){O=x.pending;do{if(x.pending===x.pending_buf_size&&(x.gzhead.hcrc&&x.pending>O&&(_.adler=c(_.adler,x.pending_buf,x.pending-O,O)),$(_),O=x.pending,x.pending===x.pending_buf_size)){k=1;break}k=x.gzindex<x.gzhead.name.length?255&x.gzhead.name.charCodeAt(x.gzindex++):0,at(x,k)}while(k!==0);x.gzhead.hcrc&&x.pending>O&&(_.adler=c(_.adler,x.pending_buf,x.pending-O,O)),k===0&&(x.gzindex=0,x.status=91)}else x.status=91;if(x.status===91)if(x.gzhead.comment){O=x.pending;do{if(x.pending===x.pending_buf_size&&(x.gzhead.hcrc&&x.pending>O&&(_.adler=c(_.adler,x.pending_buf,x.pending-O,O)),$(_),O=x.pending,x.pending===x.pending_buf_size)){k=1;break}k=x.gzindex<x.gzhead.comment.length?255&x.gzhead.comment.charCodeAt(x.gzindex++):0,at(x,k)}while(k!==0);x.gzhead.hcrc&&x.pending>O&&(_.adler=c(_.adler,x.pending_buf,x.pending-O,O)),k===0&&(x.status=103)}else x.status=103;if(x.status===103&&(x.gzhead.hcrc?(x.pending+2>x.pending_buf_size&&$(_),x.pending+2<=x.pending_buf_size&&(at(x,255&_.adler),at(x,_.adler>>8&255),_.adler=0,x.status=L)):x.status=L),x.pending!==0){if($(_),_.avail_out===0)return x.last_flush=-1,f}else if(_.avail_in===0&&Y(j)<=Y(V)&&j!==u)return st(_,-5);if(x.status===666&&_.avail_in!==0)return st(_,-5);if(_.avail_in!==0||x.lookahead!==0||j!==d&&x.status!==666){var Q=x.strategy===2?function(z,J){for(var rt;;){if(z.lookahead===0&&(Rt(z),z.lookahead===0)){if(J===d)return C;break}if(z.match_length=0,rt=a._tr_tally(z,0,z.window[z.strstart]),z.lookahead--,z.strstart++,rt&&(B(z,!1),z.strm.avail_out===0))return C}return z.insert=0,J===u?(B(z,!0),z.strm.avail_out===0?q:G):z.last_lit&&(B(z,!1),z.strm.avail_out===0)?C:U}(x,j):x.strategy===3?function(z,J){for(var rt,et,ct,Tt,mt=z.window;;){if(z.lookahead<=P){if(Rt(z),z.lookahead<=P&&J===d)return C;if(z.lookahead===0)break}if(z.match_length=0,z.lookahead>=R&&0<z.strstart&&(et=mt[ct=z.strstart-1])===mt[++ct]&&et===mt[++ct]&&et===mt[++ct]){Tt=z.strstart+P;do;while(et===mt[++ct]&&et===mt[++ct]&&et===mt[++ct]&&et===mt[++ct]&&et===mt[++ct]&&et===mt[++ct]&&et===mt[++ct]&&et===mt[++ct]&&ct<Tt);z.match_length=P-(Tt-ct),z.match_length>z.lookahead&&(z.match_length=z.lookahead)}if(z.match_length>=R?(rt=a._tr_tally(z,1,z.match_length-R),z.lookahead-=z.match_length,z.strstart+=z.match_length,z.match_length=0):(rt=a._tr_tally(z,0,z.window[z.strstart]),z.lookahead--,z.strstart++),rt&&(B(z,!1),z.strm.avail_out===0))return C}return z.insert=0,J===u?(B(z,!0),z.strm.avail_out===0?q:G):z.last_lit&&(B(z,!1),z.strm.avail_out===0)?C:U}(x,j):n[x.level].func(x,j);if(Q!==q&&Q!==G||(x.status=666),Q===C||Q===q)return _.avail_out===0&&(x.last_flush=-1),f;if(Q===U&&(j===1?a._tr_align(x):j!==5&&(a._tr_stored_block(x,0,0,!1),j===3&&(ot(x.head),x.lookahead===0&&(x.strstart=0,x.block_start=0,x.insert=0))),$(_),_.avail_out===0))return x.last_flush=-1,f}return j!==u?f:x.wrap<=0?1:(x.wrap===2?(at(x,255&_.adler),at(x,_.adler>>8&255),at(x,_.adler>>16&255),at(x,_.adler>>24&255),at(x,255&_.total_in),at(x,_.total_in>>8&255),at(x,_.total_in>>16&255),at(x,_.total_in>>24&255)):(nt(x,_.adler>>>16),nt(x,65535&_.adler)),$(_),0<x.wrap&&(x.wrap=-x.wrap),x.pending!==0?f:1)},s.deflateEnd=function(_){var j;return _&&_.state?(j=_.state.status)!==w&&j!==69&&j!==73&&j!==91&&j!==103&&j!==L&&j!==666?st(_,p):(_.state=null,j===L?st(_,-3):f):p},s.deflateSetDictionary=function(_,j){var V,x,O,k,Z,Q,z,J,rt=j.length;if(!_||!_.state||(k=(V=_.state).wrap)===2||k===1&&V.status!==w||V.lookahead)return p;for(k===1&&(_.adler=l(_.adler,j,rt,0)),V.wrap=0,rt>=V.w_size&&(k===0&&(ot(V.head),V.strstart=0,V.block_start=0,V.insert=0),J=new o.Buf8(V.w_size),o.arraySet(J,j,rt-V.w_size,V.w_size,0),j=J,rt=V.w_size),Z=_.avail_in,Q=_.next_in,z=_.input,_.avail_in=rt,_.next_in=0,_.input=j,Rt(V);V.lookahead>=R;){for(x=V.strstart,O=V.lookahead-(R-1);V.ins_h=(V.ins_h<<V.hash_shift^V.window[x+R-1])&V.hash_mask,V.prev[x&V.w_mask]=V.head[V.ins_h],V.head[V.ins_h]=x,x++,--O;);V.strstart=x,V.lookahead=R-1,Rt(V)}return V.strstart+=V.lookahead,V.block_start=V.strstart,V.insert=V.lookahead,V.lookahead=0,V.match_length=V.prev_length=R-1,V.match_available=0,_.next_in=Q,_.input=z,_.avail_in=Z,V.wrap=k,f},s.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(t,i,s){i.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(t,i,s){i.exports=function(n,o){var a,l,c,h,d,u,f,p,m,E,g,I,T,b,v,A,S,N,R,P,M,w,L,C,U;a=n.state,l=n.next_in,C=n.input,c=l+(n.avail_in-5),h=n.next_out,U=n.output,d=h-(o-n.avail_out),u=h+(n.avail_out-257),f=a.dmax,p=a.wsize,m=a.whave,E=a.wnext,g=a.window,I=a.hold,T=a.bits,b=a.lencode,v=a.distcode,A=(1<<a.lenbits)-1,S=(1<<a.distbits)-1;t:do{T<15&&(I+=C[l++]<<T,T+=8,I+=C[l++]<<T,T+=8),N=b[I&A];e:for(;;){if(I>>>=R=N>>>24,T-=R,(R=N>>>16&255)===0)U[h++]=65535&N;else{if(!(16&R)){if(!(64&R)){N=b[(65535&N)+(I&(1<<R)-1)];continue e}if(32&R){a.mode=12;break t}n.msg="invalid literal/length code",a.mode=30;break t}P=65535&N,(R&=15)&&(T<R&&(I+=C[l++]<<T,T+=8),P+=I&(1<<R)-1,I>>>=R,T-=R),T<15&&(I+=C[l++]<<T,T+=8,I+=C[l++]<<T,T+=8),N=v[I&S];i:for(;;){if(I>>>=R=N>>>24,T-=R,!(16&(R=N>>>16&255))){if(!(64&R)){N=v[(65535&N)+(I&(1<<R)-1)];continue i}n.msg="invalid distance code",a.mode=30;break t}if(M=65535&N,T<(R&=15)&&(I+=C[l++]<<T,(T+=8)<R&&(I+=C[l++]<<T,T+=8)),f<(M+=I&(1<<R)-1)){n.msg="invalid distance too far back",a.mode=30;break t}if(I>>>=R,T-=R,(R=h-d)<M){if(m<(R=M-R)&&a.sane){n.msg="invalid distance too far back",a.mode=30;break t}if(L=g,(w=0)===E){if(w+=p-R,R<P){for(P-=R;U[h++]=g[w++],--R;);w=h-M,L=U}}else if(E<R){if(w+=p+E-R,(R-=E)<P){for(P-=R;U[h++]=g[w++],--R;);if(w=0,E<P){for(P-=R=E;U[h++]=g[w++],--R;);w=h-M,L=U}}}else if(w+=E-R,R<P){for(P-=R;U[h++]=g[w++],--R;);w=h-M,L=U}for(;2<P;)U[h++]=L[w++],U[h++]=L[w++],U[h++]=L[w++],P-=3;P&&(U[h++]=L[w++],1<P&&(U[h++]=L[w++]))}else{for(w=h-M;U[h++]=U[w++],U[h++]=U[w++],U[h++]=U[w++],2<(P-=3););P&&(U[h++]=U[w++],1<P&&(U[h++]=U[w++]))}break}}break}}while(l<c&&h<u);l-=P=T>>3,I&=(1<<(T-=P<<3))-1,n.next_in=l,n.next_out=h,n.avail_in=l<c?c-l+5:5-(l-c),n.avail_out=h<u?u-h+257:257-(h-u),a.hold=I,a.bits=T}},{}],49:[function(t,i,s){var n=t("../utils/common"),o=t("./adler32"),a=t("./crc32"),l=t("./inffast"),c=t("./inftrees"),h=1,d=2,u=0,f=-2,p=1,m=852,E=592;function g(w){return(w>>>24&255)+(w>>>8&65280)+((65280&w)<<8)+((255&w)<<24)}function I(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function T(w){var L;return w&&w.state?(L=w.state,w.total_in=w.total_out=L.total=0,w.msg="",L.wrap&&(w.adler=1&L.wrap),L.mode=p,L.last=0,L.havedict=0,L.dmax=32768,L.head=null,L.hold=0,L.bits=0,L.lencode=L.lendyn=new n.Buf32(m),L.distcode=L.distdyn=new n.Buf32(E),L.sane=1,L.back=-1,u):f}function b(w){var L;return w&&w.state?((L=w.state).wsize=0,L.whave=0,L.wnext=0,T(w)):f}function v(w,L){var C,U;return w&&w.state?(U=w.state,L<0?(C=0,L=-L):(C=1+(L>>4),L<48&&(L&=15)),L&&(L<8||15<L)?f:(U.window!==null&&U.wbits!==L&&(U.window=null),U.wrap=C,U.wbits=L,b(w))):f}function A(w,L){var C,U;return w?(U=new I,(w.state=U).window=null,(C=v(w,L))!==u&&(w.state=null),C):f}var S,N,R=!0;function P(w){if(R){var L;for(S=new n.Buf32(512),N=new n.Buf32(32),L=0;L<144;)w.lens[L++]=8;for(;L<256;)w.lens[L++]=9;for(;L<280;)w.lens[L++]=7;for(;L<288;)w.lens[L++]=8;for(c(h,w.lens,0,288,S,0,w.work,{bits:9}),L=0;L<32;)w.lens[L++]=5;c(d,w.lens,0,32,N,0,w.work,{bits:5}),R=!1}w.lencode=S,w.lenbits=9,w.distcode=N,w.distbits=5}function M(w,L,C,U){var q,G=w.state;return G.window===null&&(G.wsize=1<<G.wbits,G.wnext=0,G.whave=0,G.window=new n.Buf8(G.wsize)),U>=G.wsize?(n.arraySet(G.window,L,C-G.wsize,G.wsize,0),G.wnext=0,G.whave=G.wsize):(U<(q=G.wsize-G.wnext)&&(q=U),n.arraySet(G.window,L,C-U,q,G.wnext),(U-=q)?(n.arraySet(G.window,L,C-U,U,0),G.wnext=U,G.whave=G.wsize):(G.wnext+=q,G.wnext===G.wsize&&(G.wnext=0),G.whave<G.wsize&&(G.whave+=q))),0}s.inflateReset=b,s.inflateReset2=v,s.inflateResetKeep=T,s.inflateInit=function(w){return A(w,15)},s.inflateInit2=A,s.inflate=function(w,L){var C,U,q,G,st,Y,ot,$,B,at,nt,it,Rt,xt,lt,pt,ft,Ct,Kt,$t,_,j,V,x,O=0,k=new n.Buf8(4),Z=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!w||!w.state||!w.output||!w.input&&w.avail_in!==0)return f;(C=w.state).mode===12&&(C.mode=13),st=w.next_out,q=w.output,ot=w.avail_out,G=w.next_in,U=w.input,Y=w.avail_in,$=C.hold,B=C.bits,at=Y,nt=ot,j=u;t:for(;;)switch(C.mode){case p:if(C.wrap===0){C.mode=13;break}for(;B<16;){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}if(2&C.wrap&&$===35615){k[C.check=0]=255&$,k[1]=$>>>8&255,C.check=a(C.check,k,2,0),B=$=0,C.mode=2;break}if(C.flags=0,C.head&&(C.head.done=!1),!(1&C.wrap)||(((255&$)<<8)+($>>8))%31){w.msg="incorrect header check",C.mode=30;break}if((15&$)!=8){w.msg="unknown compression method",C.mode=30;break}if(B-=4,_=8+(15&($>>>=4)),C.wbits===0)C.wbits=_;else if(_>C.wbits){w.msg="invalid window size",C.mode=30;break}C.dmax=1<<_,w.adler=C.check=1,C.mode=512&$?10:12,B=$=0;break;case 2:for(;B<16;){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}if(C.flags=$,(255&C.flags)!=8){w.msg="unknown compression method",C.mode=30;break}if(57344&C.flags){w.msg="unknown header flags set",C.mode=30;break}C.head&&(C.head.text=$>>8&1),512&C.flags&&(k[0]=255&$,k[1]=$>>>8&255,C.check=a(C.check,k,2,0)),B=$=0,C.mode=3;case 3:for(;B<32;){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}C.head&&(C.head.time=$),512&C.flags&&(k[0]=255&$,k[1]=$>>>8&255,k[2]=$>>>16&255,k[3]=$>>>24&255,C.check=a(C.check,k,4,0)),B=$=0,C.mode=4;case 4:for(;B<16;){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}C.head&&(C.head.xflags=255&$,C.head.os=$>>8),512&C.flags&&(k[0]=255&$,k[1]=$>>>8&255,C.check=a(C.check,k,2,0)),B=$=0,C.mode=5;case 5:if(1024&C.flags){for(;B<16;){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}C.length=$,C.head&&(C.head.extra_len=$),512&C.flags&&(k[0]=255&$,k[1]=$>>>8&255,C.check=a(C.check,k,2,0)),B=$=0}else C.head&&(C.head.extra=null);C.mode=6;case 6:if(1024&C.flags&&(Y<(it=C.length)&&(it=Y),it&&(C.head&&(_=C.head.extra_len-C.length,C.head.extra||(C.head.extra=new Array(C.head.extra_len)),n.arraySet(C.head.extra,U,G,it,_)),512&C.flags&&(C.check=a(C.check,U,it,G)),Y-=it,G+=it,C.length-=it),C.length))break t;C.length=0,C.mode=7;case 7:if(2048&C.flags){if(Y===0)break t;for(it=0;_=U[G+it++],C.head&&_&&C.length<65536&&(C.head.name+=String.fromCharCode(_)),_&&it<Y;);if(512&C.flags&&(C.check=a(C.check,U,it,G)),Y-=it,G+=it,_)break t}else C.head&&(C.head.name=null);C.length=0,C.mode=8;case 8:if(4096&C.flags){if(Y===0)break t;for(it=0;_=U[G+it++],C.head&&_&&C.length<65536&&(C.head.comment+=String.fromCharCode(_)),_&&it<Y;);if(512&C.flags&&(C.check=a(C.check,U,it,G)),Y-=it,G+=it,_)break t}else C.head&&(C.head.comment=null);C.mode=9;case 9:if(512&C.flags){for(;B<16;){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}if($!==(65535&C.check)){w.msg="header crc mismatch",C.mode=30;break}B=$=0}C.head&&(C.head.hcrc=C.flags>>9&1,C.head.done=!0),w.adler=C.check=0,C.mode=12;break;case 10:for(;B<32;){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}w.adler=C.check=g($),B=$=0,C.mode=11;case 11:if(C.havedict===0)return w.next_out=st,w.avail_out=ot,w.next_in=G,w.avail_in=Y,C.hold=$,C.bits=B,2;w.adler=C.check=1,C.mode=12;case 12:if(L===5||L===6)break t;case 13:if(C.last){$>>>=7&B,B-=7&B,C.mode=27;break}for(;B<3;){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}switch(C.last=1&$,B-=1,3&($>>>=1)){case 0:C.mode=14;break;case 1:if(P(C),C.mode=20,L!==6)break;$>>>=2,B-=2;break t;case 2:C.mode=17;break;case 3:w.msg="invalid block type",C.mode=30}$>>>=2,B-=2;break;case 14:for($>>>=7&B,B-=7&B;B<32;){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}if((65535&$)!=($>>>16^65535)){w.msg="invalid stored block lengths",C.mode=30;break}if(C.length=65535&$,B=$=0,C.mode=15,L===6)break t;case 15:C.mode=16;case 16:if(it=C.length){if(Y<it&&(it=Y),ot<it&&(it=ot),it===0)break t;n.arraySet(q,U,G,it,st),Y-=it,G+=it,ot-=it,st+=it,C.length-=it;break}C.mode=12;break;case 17:for(;B<14;){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}if(C.nlen=257+(31&$),$>>>=5,B-=5,C.ndist=1+(31&$),$>>>=5,B-=5,C.ncode=4+(15&$),$>>>=4,B-=4,286<C.nlen||30<C.ndist){w.msg="too many length or distance symbols",C.mode=30;break}C.have=0,C.mode=18;case 18:for(;C.have<C.ncode;){for(;B<3;){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}C.lens[Z[C.have++]]=7&$,$>>>=3,B-=3}for(;C.have<19;)C.lens[Z[C.have++]]=0;if(C.lencode=C.lendyn,C.lenbits=7,V={bits:C.lenbits},j=c(0,C.lens,0,19,C.lencode,0,C.work,V),C.lenbits=V.bits,j){w.msg="invalid code lengths set",C.mode=30;break}C.have=0,C.mode=19;case 19:for(;C.have<C.nlen+C.ndist;){for(;pt=(O=C.lencode[$&(1<<C.lenbits)-1])>>>16&255,ft=65535&O,!((lt=O>>>24)<=B);){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}if(ft<16)$>>>=lt,B-=lt,C.lens[C.have++]=ft;else{if(ft===16){for(x=lt+2;B<x;){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}if($>>>=lt,B-=lt,C.have===0){w.msg="invalid bit length repeat",C.mode=30;break}_=C.lens[C.have-1],it=3+(3&$),$>>>=2,B-=2}else if(ft===17){for(x=lt+3;B<x;){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}B-=lt,_=0,it=3+(7&($>>>=lt)),$>>>=3,B-=3}else{for(x=lt+7;B<x;){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}B-=lt,_=0,it=11+(127&($>>>=lt)),$>>>=7,B-=7}if(C.have+it>C.nlen+C.ndist){w.msg="invalid bit length repeat",C.mode=30;break}for(;it--;)C.lens[C.have++]=_}}if(C.mode===30)break;if(C.lens[256]===0){w.msg="invalid code -- missing end-of-block",C.mode=30;break}if(C.lenbits=9,V={bits:C.lenbits},j=c(h,C.lens,0,C.nlen,C.lencode,0,C.work,V),C.lenbits=V.bits,j){w.msg="invalid literal/lengths set",C.mode=30;break}if(C.distbits=6,C.distcode=C.distdyn,V={bits:C.distbits},j=c(d,C.lens,C.nlen,C.ndist,C.distcode,0,C.work,V),C.distbits=V.bits,j){w.msg="invalid distances set",C.mode=30;break}if(C.mode=20,L===6)break t;case 20:C.mode=21;case 21:if(6<=Y&&258<=ot){w.next_out=st,w.avail_out=ot,w.next_in=G,w.avail_in=Y,C.hold=$,C.bits=B,l(w,nt),st=w.next_out,q=w.output,ot=w.avail_out,G=w.next_in,U=w.input,Y=w.avail_in,$=C.hold,B=C.bits,C.mode===12&&(C.back=-1);break}for(C.back=0;pt=(O=C.lencode[$&(1<<C.lenbits)-1])>>>16&255,ft=65535&O,!((lt=O>>>24)<=B);){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}if(pt&&!(240&pt)){for(Ct=lt,Kt=pt,$t=ft;pt=(O=C.lencode[$t+(($&(1<<Ct+Kt)-1)>>Ct)])>>>16&255,ft=65535&O,!(Ct+(lt=O>>>24)<=B);){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}$>>>=Ct,B-=Ct,C.back+=Ct}if($>>>=lt,B-=lt,C.back+=lt,C.length=ft,pt===0){C.mode=26;break}if(32&pt){C.back=-1,C.mode=12;break}if(64&pt){w.msg="invalid literal/length code",C.mode=30;break}C.extra=15&pt,C.mode=22;case 22:if(C.extra){for(x=C.extra;B<x;){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}C.length+=$&(1<<C.extra)-1,$>>>=C.extra,B-=C.extra,C.back+=C.extra}C.was=C.length,C.mode=23;case 23:for(;pt=(O=C.distcode[$&(1<<C.distbits)-1])>>>16&255,ft=65535&O,!((lt=O>>>24)<=B);){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}if(!(240&pt)){for(Ct=lt,Kt=pt,$t=ft;pt=(O=C.distcode[$t+(($&(1<<Ct+Kt)-1)>>Ct)])>>>16&255,ft=65535&O,!(Ct+(lt=O>>>24)<=B);){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}$>>>=Ct,B-=Ct,C.back+=Ct}if($>>>=lt,B-=lt,C.back+=lt,64&pt){w.msg="invalid distance code",C.mode=30;break}C.offset=ft,C.extra=15&pt,C.mode=24;case 24:if(C.extra){for(x=C.extra;B<x;){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}C.offset+=$&(1<<C.extra)-1,$>>>=C.extra,B-=C.extra,C.back+=C.extra}if(C.offset>C.dmax){w.msg="invalid distance too far back",C.mode=30;break}C.mode=25;case 25:if(ot===0)break t;if(it=nt-ot,C.offset>it){if((it=C.offset-it)>C.whave&&C.sane){w.msg="invalid distance too far back",C.mode=30;break}Rt=it>C.wnext?(it-=C.wnext,C.wsize-it):C.wnext-it,it>C.length&&(it=C.length),xt=C.window}else xt=q,Rt=st-C.offset,it=C.length;for(ot<it&&(it=ot),ot-=it,C.length-=it;q[st++]=xt[Rt++],--it;);C.length===0&&(C.mode=21);break;case 26:if(ot===0)break t;q[st++]=C.length,ot--,C.mode=21;break;case 27:if(C.wrap){for(;B<32;){if(Y===0)break t;Y--,$|=U[G++]<<B,B+=8}if(nt-=ot,w.total_out+=nt,C.total+=nt,nt&&(w.adler=C.check=C.flags?a(C.check,q,nt,st-nt):o(C.check,q,nt,st-nt)),nt=ot,(C.flags?$:g($))!==C.check){w.msg="incorrect data check",C.mode=30;break}B=$=0}C.mode=28;case 28:if(C.wrap&&C.flags){for(;B<32;){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}if($!==(4294967295&C.total)){w.msg="incorrect length check",C.mode=30;break}B=$=0}C.mode=29;case 29:j=1;break t;case 30:j=-3;break t;case 31:return-4;case 32:default:return f}return w.next_out=st,w.avail_out=ot,w.next_in=G,w.avail_in=Y,C.hold=$,C.bits=B,(C.wsize||nt!==w.avail_out&&C.mode<30&&(C.mode<27||L!==4))&&M(w,w.output,w.next_out,nt-w.avail_out)?(C.mode=31,-4):(at-=w.avail_in,nt-=w.avail_out,w.total_in+=at,w.total_out+=nt,C.total+=nt,C.wrap&&nt&&(w.adler=C.check=C.flags?a(C.check,q,nt,w.next_out-nt):o(C.check,q,nt,w.next_out-nt)),w.data_type=C.bits+(C.last?64:0)+(C.mode===12?128:0)+(C.mode===20||C.mode===15?256:0),(at==0&&nt===0||L===4)&&j===u&&(j=-5),j)},s.inflateEnd=function(w){if(!w||!w.state)return f;var L=w.state;return L.window&&(L.window=null),w.state=null,u},s.inflateGetHeader=function(w,L){var C;return w&&w.state&&2&(C=w.state).wrap?((C.head=L).done=!1,u):f},s.inflateSetDictionary=function(w,L){var C,U=L.length;return w&&w.state?(C=w.state).wrap!==0&&C.mode!==11?f:C.mode===11&&o(1,L,U,0)!==C.check?-3:M(w,L,U,U)?(C.mode=31,-4):(C.havedict=1,u):f},s.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(t,i,s){var n=t("../utils/common"),o=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],a=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],l=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],c=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];i.exports=function(h,d,u,f,p,m,E,g){var I,T,b,v,A,S,N,R,P,M=g.bits,w=0,L=0,C=0,U=0,q=0,G=0,st=0,Y=0,ot=0,$=0,B=null,at=0,nt=new n.Buf16(16),it=new n.Buf16(16),Rt=null,xt=0;for(w=0;w<=15;w++)nt[w]=0;for(L=0;L<f;L++)nt[d[u+L]]++;for(q=M,U=15;1<=U&&nt[U]===0;U--);if(U<q&&(q=U),U===0)return p[m++]=20971520,p[m++]=20971520,g.bits=1,0;for(C=1;C<U&&nt[C]===0;C++);for(q<C&&(q=C),w=Y=1;w<=15;w++)if(Y<<=1,(Y-=nt[w])<0)return-1;if(0<Y&&(h===0||U!==1))return-1;for(it[1]=0,w=1;w<15;w++)it[w+1]=it[w]+nt[w];for(L=0;L<f;L++)d[u+L]!==0&&(E[it[d[u+L]]++]=L);if(S=h===0?(B=Rt=E,19):h===1?(B=o,at-=257,Rt=a,xt-=257,256):(B=l,Rt=c,-1),w=C,A=m,st=L=$=0,b=-1,v=(ot=1<<(G=q))-1,h===1&&852<ot||h===2&&592<ot)return 1;for(;;){for(N=w-st,P=E[L]<S?(R=0,E[L]):E[L]>S?(R=Rt[xt+E[L]],B[at+E[L]]):(R=96,0),I=1<<w-st,C=T=1<<G;p[A+($>>st)+(T-=I)]=N<<24|R<<16|P|0,T!==0;);for(I=1<<w-1;$&I;)I>>=1;if(I!==0?($&=I-1,$+=I):$=0,L++,--nt[w]==0){if(w===U)break;w=d[u+E[L]]}if(q<w&&($&v)!==b){for(st===0&&(st=q),A+=C,Y=1<<(G=w-st);G+st<U&&!((Y-=nt[G+st])<=0);)G++,Y<<=1;if(ot+=1<<G,h===1&&852<ot||h===2&&592<ot)return 1;p[b=$&v]=q<<24|G<<16|A-m|0}}return $!==0&&(p[A+$]=w-st<<24|64<<16|0),g.bits=q,0}},{"../utils/common":41}],51:[function(t,i,s){i.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(t,i,s){var n=t("../utils/common"),o=0,a=1;function l(O){for(var k=O.length;0<=--k;)O[k]=0}var c=0,h=29,d=256,u=d+1+h,f=30,p=19,m=2*u+1,E=15,g=16,I=7,T=256,b=16,v=17,A=18,S=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],N=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],R=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],P=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],M=new Array(2*(u+2));l(M);var w=new Array(2*f);l(w);var L=new Array(512);l(L);var C=new Array(256);l(C);var U=new Array(h);l(U);var q,G,st,Y=new Array(f);function ot(O,k,Z,Q,z){this.static_tree=O,this.extra_bits=k,this.extra_base=Z,this.elems=Q,this.max_length=z,this.has_stree=O&&O.length}function $(O,k){this.dyn_tree=O,this.max_code=0,this.stat_desc=k}function B(O){return O<256?L[O]:L[256+(O>>>7)]}function at(O,k){O.pending_buf[O.pending++]=255&k,O.pending_buf[O.pending++]=k>>>8&255}function nt(O,k,Z){O.bi_valid>g-Z?(O.bi_buf|=k<<O.bi_valid&65535,at(O,O.bi_buf),O.bi_buf=k>>g-O.bi_valid,O.bi_valid+=Z-g):(O.bi_buf|=k<<O.bi_valid&65535,O.bi_valid+=Z)}function it(O,k,Z){nt(O,Z[2*k],Z[2*k+1])}function Rt(O,k){for(var Z=0;Z|=1&O,O>>>=1,Z<<=1,0<--k;);return Z>>>1}function xt(O,k,Z){var Q,z,J=new Array(E+1),rt=0;for(Q=1;Q<=E;Q++)J[Q]=rt=rt+Z[Q-1]<<1;for(z=0;z<=k;z++){var et=O[2*z+1];et!==0&&(O[2*z]=Rt(J[et]++,et))}}function lt(O){var k;for(k=0;k<u;k++)O.dyn_ltree[2*k]=0;for(k=0;k<f;k++)O.dyn_dtree[2*k]=0;for(k=0;k<p;k++)O.bl_tree[2*k]=0;O.dyn_ltree[2*T]=1,O.opt_len=O.static_len=0,O.last_lit=O.matches=0}function pt(O){8<O.bi_valid?at(O,O.bi_buf):0<O.bi_valid&&(O.pending_buf[O.pending++]=O.bi_buf),O.bi_buf=0,O.bi_valid=0}function ft(O,k,Z,Q){var z=2*k,J=2*Z;return O[z]<O[J]||O[z]===O[J]&&Q[k]<=Q[Z]}function Ct(O,k,Z){for(var Q=O.heap[Z],z=Z<<1;z<=O.heap_len&&(z<O.heap_len&&ft(k,O.heap[z+1],O.heap[z],O.depth)&&z++,!ft(k,Q,O.heap[z],O.depth));)O.heap[Z]=O.heap[z],Z=z,z<<=1;O.heap[Z]=Q}function Kt(O,k,Z){var Q,z,J,rt,et=0;if(O.last_lit!==0)for(;Q=O.pending_buf[O.d_buf+2*et]<<8|O.pending_buf[O.d_buf+2*et+1],z=O.pending_buf[O.l_buf+et],et++,Q===0?it(O,z,k):(it(O,(J=C[z])+d+1,k),(rt=S[J])!==0&&nt(O,z-=U[J],rt),it(O,J=B(--Q),Z),(rt=N[J])!==0&&nt(O,Q-=Y[J],rt)),et<O.last_lit;);it(O,T,k)}function $t(O,k){var Z,Q,z,J=k.dyn_tree,rt=k.stat_desc.static_tree,et=k.stat_desc.has_stree,ct=k.stat_desc.elems,Tt=-1;for(O.heap_len=0,O.heap_max=m,Z=0;Z<ct;Z++)J[2*Z]!==0?(O.heap[++O.heap_len]=Tt=Z,O.depth[Z]=0):J[2*Z+1]=0;for(;O.heap_len<2;)J[2*(z=O.heap[++O.heap_len]=Tt<2?++Tt:0)]=1,O.depth[z]=0,O.opt_len--,et&&(O.static_len-=rt[2*z+1]);for(k.max_code=Tt,Z=O.heap_len>>1;1<=Z;Z--)Ct(O,J,Z);for(z=ct;Z=O.heap[1],O.heap[1]=O.heap[O.heap_len--],Ct(O,J,1),Q=O.heap[1],O.heap[--O.heap_max]=Z,O.heap[--O.heap_max]=Q,J[2*z]=J[2*Z]+J[2*Q],O.depth[z]=(O.depth[Z]>=O.depth[Q]?O.depth[Z]:O.depth[Q])+1,J[2*Z+1]=J[2*Q+1]=z,O.heap[1]=z++,Ct(O,J,1),2<=O.heap_len;);O.heap[--O.heap_max]=O.heap[1],function(mt,Jt){var cs,Ee,hs,Nt,un,Jr,Se=Jt.dyn_tree,Ba=Jt.max_code,Gd=Jt.stat_desc.static_tree,Hd=Jt.stat_desc.has_stree,Yd=Jt.stat_desc.extra_bits,za=Jt.stat_desc.extra_base,ds=Jt.stat_desc.max_length,fn=0;for(Nt=0;Nt<=E;Nt++)mt.bl_count[Nt]=0;for(Se[2*mt.heap[mt.heap_max]+1]=0,cs=mt.heap_max+1;cs<m;cs++)ds<(Nt=Se[2*Se[2*(Ee=mt.heap[cs])+1]+1]+1)&&(Nt=ds,fn++),Se[2*Ee+1]=Nt,Ba<Ee||(mt.bl_count[Nt]++,un=0,za<=Ee&&(un=Yd[Ee-za]),Jr=Se[2*Ee],mt.opt_len+=Jr*(Nt+un),Hd&&(mt.static_len+=Jr*(Gd[2*Ee+1]+un)));if(fn!==0){do{for(Nt=ds-1;mt.bl_count[Nt]===0;)Nt--;mt.bl_count[Nt]--,mt.bl_count[Nt+1]+=2,mt.bl_count[ds]--,fn-=2}while(0<fn);for(Nt=ds;Nt!==0;Nt--)for(Ee=mt.bl_count[Nt];Ee!==0;)Ba<(hs=mt.heap[--cs])||(Se[2*hs+1]!==Nt&&(mt.opt_len+=(Nt-Se[2*hs+1])*Se[2*hs],Se[2*hs+1]=Nt),Ee--)}}(O,k),xt(J,Tt,O.bl_count)}function _(O,k,Z){var Q,z,J=-1,rt=k[1],et=0,ct=7,Tt=4;for(rt===0&&(ct=138,Tt=3),k[2*(Z+1)+1]=65535,Q=0;Q<=Z;Q++)z=rt,rt=k[2*(Q+1)+1],++et<ct&&z===rt||(et<Tt?O.bl_tree[2*z]+=et:z!==0?(z!==J&&O.bl_tree[2*z]++,O.bl_tree[2*b]++):et<=10?O.bl_tree[2*v]++:O.bl_tree[2*A]++,J=z,Tt=(et=0)===rt?(ct=138,3):z===rt?(ct=6,3):(ct=7,4))}function j(O,k,Z){var Q,z,J=-1,rt=k[1],et=0,ct=7,Tt=4;for(rt===0&&(ct=138,Tt=3),Q=0;Q<=Z;Q++)if(z=rt,rt=k[2*(Q+1)+1],!(++et<ct&&z===rt)){if(et<Tt)for(;it(O,z,O.bl_tree),--et!=0;);else z!==0?(z!==J&&(it(O,z,O.bl_tree),et--),it(O,b,O.bl_tree),nt(O,et-3,2)):et<=10?(it(O,v,O.bl_tree),nt(O,et-3,3)):(it(O,A,O.bl_tree),nt(O,et-11,7));J=z,Tt=(et=0)===rt?(ct=138,3):z===rt?(ct=6,3):(ct=7,4)}}l(Y);var V=!1;function x(O,k,Z,Q){nt(O,(c<<1)+(Q?1:0),3),function(z,J,rt,et){pt(z),at(z,rt),at(z,~rt),n.arraySet(z.pending_buf,z.window,J,rt,z.pending),z.pending+=rt}(O,k,Z)}s._tr_init=function(O){V||(function(){var k,Z,Q,z,J,rt=new Array(E+1);for(z=Q=0;z<h-1;z++)for(U[z]=Q,k=0;k<1<<S[z];k++)C[Q++]=z;for(C[Q-1]=z,z=J=0;z<16;z++)for(Y[z]=J,k=0;k<1<<N[z];k++)L[J++]=z;for(J>>=7;z<f;z++)for(Y[z]=J<<7,k=0;k<1<<N[z]-7;k++)L[256+J++]=z;for(Z=0;Z<=E;Z++)rt[Z]=0;for(k=0;k<=143;)M[2*k+1]=8,k++,rt[8]++;for(;k<=255;)M[2*k+1]=9,k++,rt[9]++;for(;k<=279;)M[2*k+1]=7,k++,rt[7]++;for(;k<=287;)M[2*k+1]=8,k++,rt[8]++;for(xt(M,u+1,rt),k=0;k<f;k++)w[2*k+1]=5,w[2*k]=Rt(k,5);q=new ot(M,S,d+1,u,E),G=new ot(w,N,0,f,E),st=new ot(new Array(0),R,0,p,I)}(),V=!0),O.l_desc=new $(O.dyn_ltree,q),O.d_desc=new $(O.dyn_dtree,G),O.bl_desc=new $(O.bl_tree,st),O.bi_buf=0,O.bi_valid=0,lt(O)},s._tr_stored_block=x,s._tr_flush_block=function(O,k,Z,Q){var z,J,rt=0;0<O.level?(O.strm.data_type===2&&(O.strm.data_type=function(et){var ct,Tt=4093624447;for(ct=0;ct<=31;ct++,Tt>>>=1)if(1&Tt&&et.dyn_ltree[2*ct]!==0)return o;if(et.dyn_ltree[18]!==0||et.dyn_ltree[20]!==0||et.dyn_ltree[26]!==0)return a;for(ct=32;ct<d;ct++)if(et.dyn_ltree[2*ct]!==0)return a;return o}(O)),$t(O,O.l_desc),$t(O,O.d_desc),rt=function(et){var ct;for(_(et,et.dyn_ltree,et.l_desc.max_code),_(et,et.dyn_dtree,et.d_desc.max_code),$t(et,et.bl_desc),ct=p-1;3<=ct&&et.bl_tree[2*P[ct]+1]===0;ct--);return et.opt_len+=3*(ct+1)+5+5+4,ct}(O),z=O.opt_len+3+7>>>3,(J=O.static_len+3+7>>>3)<=z&&(z=J)):z=J=Z+5,Z+4<=z&&k!==-1?x(O,k,Z,Q):O.strategy===4||J===z?(nt(O,2+(Q?1:0),3),Kt(O,M,w)):(nt(O,4+(Q?1:0),3),function(et,ct,Tt,mt){var Jt;for(nt(et,ct-257,5),nt(et,Tt-1,5),nt(et,mt-4,4),Jt=0;Jt<mt;Jt++)nt(et,et.bl_tree[2*P[Jt]+1],3);j(et,et.dyn_ltree,ct-1),j(et,et.dyn_dtree,Tt-1)}(O,O.l_desc.max_code+1,O.d_desc.max_code+1,rt+1),Kt(O,O.dyn_ltree,O.dyn_dtree)),lt(O),Q&&pt(O)},s._tr_tally=function(O,k,Z){return O.pending_buf[O.d_buf+2*O.last_lit]=k>>>8&255,O.pending_buf[O.d_buf+2*O.last_lit+1]=255&k,O.pending_buf[O.l_buf+O.last_lit]=255&Z,O.last_lit++,k===0?O.dyn_ltree[2*Z]++:(O.matches++,k--,O.dyn_ltree[2*(C[Z]+d+1)]++,O.dyn_dtree[2*B(k)]++),O.last_lit===O.lit_bufsize-1},s._tr_align=function(O){nt(O,2,3),it(O,T,M),function(k){k.bi_valid===16?(at(k,k.bi_buf),k.bi_buf=0,k.bi_valid=0):8<=k.bi_valid&&(k.pending_buf[k.pending++]=255&k.bi_buf,k.bi_buf>>=8,k.bi_valid-=8)}(O)}},{"../utils/common":41}],53:[function(t,i,s){i.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,i,s){(function(n){(function(o,a){if(!o.setImmediate){var l,c,h,d,u=1,f={},p=!1,m=o.document,E=Object.getPrototypeOf&&Object.getPrototypeOf(o);E=E&&E.setTimeout?E:o,l={}.toString.call(o.process)==="[object process]"?function(b){process.nextTick(function(){I(b)})}:function(){if(o.postMessage&&!o.importScripts){var b=!0,v=o.onmessage;return o.onmessage=function(){b=!1},o.postMessage("","*"),o.onmessage=v,b}}()?(d="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",T,!1):o.attachEvent("onmessage",T),function(b){o.postMessage(d+b,"*")}):o.MessageChannel?((h=new MessageChannel).port1.onmessage=function(b){I(b.data)},function(b){h.port2.postMessage(b)}):m&&"onreadystatechange"in m.createElement("script")?(c=m.documentElement,function(b){var v=m.createElement("script");v.onreadystatechange=function(){I(b),v.onreadystatechange=null,c.removeChild(v),v=null},c.appendChild(v)}):function(b){setTimeout(I,0,b)},E.setImmediate=function(b){typeof b!="function"&&(b=new Function(""+b));for(var v=new Array(arguments.length-1),A=0;A<v.length;A++)v[A]=arguments[A+1];var S={callback:b,args:v};return f[u]=S,l(u),u++},E.clearImmediate=g}function g(b){delete f[b]}function I(b){if(p)setTimeout(I,0,b);else{var v=f[b];if(v){p=!0;try{(function(A){var S=A.callback,N=A.args;switch(N.length){case 0:S();break;case 1:S(N[0]);break;case 2:S(N[0],N[1]);break;case 3:S(N[0],N[1],N[2]);break;default:S.apply(a,N)}})(v)}finally{g(b),p=!1}}}}function T(b){b.source===o&&typeof b.data=="string"&&b.data.indexOf(d)===0&&I(+b.data.slice(d.length))}})(typeof self>"u"?n===void 0?this:n:self)}).call(this,typeof Un<"u"?Un:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(Wc);var Ff=Wc.exports;const Tl=Sf(Ff);var ga={},Ur={};(function(r){const e=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",t=e+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",i="["+e+"]["+t+"]*",s=new RegExp("^"+i+"$"),n=function(a,l){const c=[];let h=l.exec(a);for(;h;){const d=[];d.startIndex=l.lastIndex-h[0].length;const u=h.length;for(let f=0;f<u;f++)d.push(h[f]);c.push(d),h=l.exec(a)}return c},o=function(a){const l=s.exec(a);return!(l===null||typeof l>"u")};r.isExist=function(a){return typeof a<"u"},r.isEmptyObject=function(a){return Object.keys(a).length===0},r.merge=function(a,l,c){if(l){const h=Object.keys(l),d=h.length;for(let u=0;u<d;u++)c==="strict"?a[h[u]]=[l[h[u]]]:a[h[u]]=l[h[u]]}},r.getValue=function(a){return r.isExist(a)?a:""},r.isName=o,r.getAllMatches=n,r.nameRegexp=i})(Ur);const Ea=Ur,Of={allowBooleanAttributes:!1,unpairedTags:[]};ga.validate=function(r,e){e=Object.assign({},Of,e);const t=[];let i=!1,s=!1;r[0]==="\uFEFF"&&(r=r.substr(1));for(let n=0;n<r.length;n++)if(r[n]==="<"&&r[n+1]==="?"){if(n+=2,n=wl(r,n),n.err)return n}else if(r[n]==="<"){let o=n;if(n++,r[n]==="!"){n=Al(r,n);continue}else{let a=!1;r[n]==="/"&&(a=!0,n++);let l="";for(;n<r.length&&r[n]!==">"&&r[n]!==" "&&r[n]!==" "&&r[n]!==`
|
|
140
|
+
`&&r[n]!=="\r";n++)l+=r[n];if(l=l.trim(),l[l.length-1]==="/"&&(l=l.substring(0,l.length-1),n--),!kf(l)){let d;return l.trim().length===0?d="Invalid space after '<'.":d="Tag '"+l+"' is an invalid name.",Lt("InvalidTag",d,Yt(r,n))}const c=Pf(r,n);if(c===!1)return Lt("InvalidAttr","Attributes for '"+l+"' have open quote.",Yt(r,n));let h=c.value;if(n=c.index,h[h.length-1]==="/"){const d=n-h.length;h=h.substring(0,h.length-1);const u=Rl(h,e);if(u===!0)i=!0;else return Lt(u.err.code,u.err.msg,Yt(r,d+u.err.line))}else if(a)if(c.tagClosed){if(h.trim().length>0)return Lt("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",Yt(r,o));if(t.length===0)return Lt("InvalidTag","Closing tag '"+l+"' has not been opened.",Yt(r,o));{const d=t.pop();if(l!==d.tagName){let u=Yt(r,d.tagStartPos);return Lt("InvalidTag","Expected closing tag '"+d.tagName+"' (opened in line "+u.line+", col "+u.col+") instead of closing tag '"+l+"'.",Yt(r,o))}t.length==0&&(s=!0)}}else return Lt("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",Yt(r,n));else{const d=Rl(h,e);if(d!==!0)return Lt(d.err.code,d.err.msg,Yt(r,n-h.length+d.err.line));if(s===!0)return Lt("InvalidXml","Multiple possible root nodes found.",Yt(r,n));e.unpairedTags.indexOf(l)!==-1||t.push({tagName:l,tagStartPos:o}),i=!0}for(n++;n<r.length;n++)if(r[n]==="<")if(r[n+1]==="!"){n++,n=Al(r,n);continue}else if(r[n+1]==="?"){if(n=wl(r,++n),n.err)return n}else break;else if(r[n]==="&"){const d=Df(r,n);if(d==-1)return Lt("InvalidChar","char '&' is not expected.",Yt(r,n));n=d}else if(s===!0&&!vl(r[n]))return Lt("InvalidXml","Extra text at the end",Yt(r,n));r[n]==="<"&&n--}}else{if(vl(r[n]))continue;return Lt("InvalidChar","char '"+r[n]+"' is not expected.",Yt(r,n))}if(i){if(t.length==1)return Lt("InvalidTag","Unclosed tag '"+t[0].tagName+"'.",Yt(r,t[0].tagStartPos));if(t.length>0)return Lt("InvalidXml","Invalid '"+JSON.stringify(t.map(n=>n.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return Lt("InvalidXml","Start tag expected.",1);return!0};function vl(r){return r===" "||r===" "||r===`
|
|
141
|
+
`||r==="\r"}function wl(r,e){const t=e;for(;e<r.length;e++)if(r[e]=="?"||r[e]==" "){const i=r.substr(t,e-t);if(e>5&&i==="xml")return Lt("InvalidXml","XML declaration allowed only at the start of the document.",Yt(r,e));if(r[e]=="?"&&r[e+1]==">"){e++;break}else continue}return e}function Al(r,e){if(r.length>e+5&&r[e+1]==="-"&&r[e+2]==="-"){for(e+=3;e<r.length;e++)if(r[e]==="-"&&r[e+1]==="-"&&r[e+2]===">"){e+=2;break}}else if(r.length>e+8&&r[e+1]==="D"&&r[e+2]==="O"&&r[e+3]==="C"&&r[e+4]==="T"&&r[e+5]==="Y"&&r[e+6]==="P"&&r[e+7]==="E"){let t=1;for(e+=8;e<r.length;e++)if(r[e]==="<")t++;else if(r[e]===">"&&(t--,t===0))break}else if(r.length>e+9&&r[e+1]==="["&&r[e+2]==="C"&&r[e+3]==="D"&&r[e+4]==="A"&&r[e+5]==="T"&&r[e+6]==="A"&&r[e+7]==="["){for(e+=8;e<r.length;e++)if(r[e]==="]"&&r[e+1]==="]"&&r[e+2]===">"){e+=2;break}}return e}const xf='"',Nf="'";function Pf(r,e){let t="",i="",s=!1;for(;e<r.length;e++){if(r[e]===xf||r[e]===Nf)i===""?i=r[e]:i!==r[e]||(i="");else if(r[e]===">"&&i===""){s=!0;break}t+=r[e]}return i!==""?!1:{value:t,index:e,tagClosed:s}}const Lf=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Rl(r,e){const t=Ea.getAllMatches(r,Lf),i={};for(let s=0;s<t.length;s++){if(t[s][1].length===0)return Lt("InvalidAttr","Attribute '"+t[s][2]+"' has no space in starting.",ws(t[s]));if(t[s][3]!==void 0&&t[s][4]===void 0)return Lt("InvalidAttr","Attribute '"+t[s][2]+"' is without value.",ws(t[s]));if(t[s][3]===void 0&&!e.allowBooleanAttributes)return Lt("InvalidAttr","boolean attribute '"+t[s][2]+"' is not allowed.",ws(t[s]));const n=t[s][2];if(!Uf(n))return Lt("InvalidAttr","Attribute '"+n+"' is an invalid name.",ws(t[s]));if(!i.hasOwnProperty(n))i[n]=1;else return Lt("InvalidAttr","Attribute '"+n+"' is repeated.",ws(t[s]))}return!0}function Mf(r,e){let t=/\d/;for(r[e]==="x"&&(e++,t=/[\da-fA-F]/);e<r.length;e++){if(r[e]===";")return e;if(!r[e].match(t))break}return-1}function Df(r,e){if(e++,r[e]===";")return-1;if(r[e]==="#")return e++,Mf(r,e);let t=0;for(;e<r.length;e++,t++)if(!(r[e].match(/\w/)&&t<20)){if(r[e]===";")break;return-1}return e}function Lt(r,e,t){return{err:{code:r,msg:e,line:t.line||t,col:t.col}}}function Uf(r){return Ea.isName(r)}function kf(r){return Ea.isName(r)}function Yt(r,e){const t=r.substring(0,e).split(/\r?\n/);return{line:t.length,col:t[t.length-1].length+1}}function ws(r){return r.startIndex+r[1].length}var ba={};const jc={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(r,e){return e},attributeValueProcessor:function(r,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(r,e,t){return r}},Bf=function(r){return Object.assign({},jc,r)};ba.buildOptions=Bf;ba.defaultOptions=jc;class zf{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,t){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:t})}addChild(e){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}}var $f=zf;const Vf=Ur;function Gf(r,e){const t={};if(r[e+3]==="O"&&r[e+4]==="C"&&r[e+5]==="T"&&r[e+6]==="Y"&&r[e+7]==="P"&&r[e+8]==="E"){e=e+9;let i=1,s=!1,n=!1,o="";for(;e<r.length;e++)if(r[e]==="<"&&!n){if(s&&Wf(r,e))e+=7,[entityName,val,e]=Hf(r,e+1),val.indexOf("&")===-1&&(t[qf(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(s&&jf(r,e))e+=8;else if(s&&Xf(r,e))e+=8;else if(s&&Zf(r,e))e+=9;else if(Yf)n=!0;else throw new Error("Invalid DOCTYPE");i++,o=""}else if(r[e]===">"){if(n?r[e-1]==="-"&&r[e-2]==="-"&&(n=!1,i--):i--,i===0)break}else r[e]==="["?s=!0:o+=r[e];if(i!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:t,i:e}}function Hf(r,e){let t="";for(;e<r.length&&r[e]!=="'"&&r[e]!=='"';e++)t+=r[e];if(t=t.trim(),t.indexOf(" ")!==-1)throw new Error("External entites are not supported");const i=r[e++];let s="";for(;e<r.length&&r[e]!==i;e++)s+=r[e];return[t,s,e]}function Yf(r,e){return r[e+1]==="!"&&r[e+2]==="-"&&r[e+3]==="-"}function Wf(r,e){return r[e+1]==="!"&&r[e+2]==="E"&&r[e+3]==="N"&&r[e+4]==="T"&&r[e+5]==="I"&&r[e+6]==="T"&&r[e+7]==="Y"}function jf(r,e){return r[e+1]==="!"&&r[e+2]==="E"&&r[e+3]==="L"&&r[e+4]==="E"&&r[e+5]==="M"&&r[e+6]==="E"&&r[e+7]==="N"&&r[e+8]==="T"}function Xf(r,e){return r[e+1]==="!"&&r[e+2]==="A"&&r[e+3]==="T"&&r[e+4]==="T"&&r[e+5]==="L"&&r[e+6]==="I"&&r[e+7]==="S"&&r[e+8]==="T"}function Zf(r,e){return r[e+1]==="!"&&r[e+2]==="N"&&r[e+3]==="O"&&r[e+4]==="T"&&r[e+5]==="A"&&r[e+6]==="T"&&r[e+7]==="I"&&r[e+8]==="O"&&r[e+9]==="N"}function qf(r){if(Vf.isName(r))return r;throw new Error(`Invalid entity name ${r}`)}var Qf=Gf;const Kf=/^[-+]?0x[a-fA-F0-9]+$/,Jf=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt);!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const tp={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function ep(r,e={}){if(e=Object.assign({},tp,e),!r||typeof r!="string")return r;let t=r.trim();if(e.skipLike!==void 0&&e.skipLike.test(t))return r;if(e.hex&&Kf.test(t))return Number.parseInt(t,16);{const i=Jf.exec(t);if(i){const s=i[1],n=i[2];let o=ip(i[3]);const a=i[4]||i[6];if(!e.leadingZeros&&n.length>0&&s&&t[2]!==".")return r;if(!e.leadingZeros&&n.length>0&&!s&&t[1]!==".")return r;{const l=Number(t),c=""+l;return c.search(/[eE]/)!==-1||a?e.eNotation?l:r:t.indexOf(".")!==-1?c==="0"&&o===""||c===o||s&&c==="-"+o?l:r:n?o===c||s+o===c?l:r:t===c||t===s+c?l:r}}else return r}}function ip(r){return r&&r.indexOf(".")!==-1&&(r=r.replace(/0+$/,""),r==="."?r="0":r[0]==="."?r="0"+r:r[r.length-1]==="."&&(r=r.substr(0,r.length-1))),r}var sp=ep;const Xc=Ur,As=$f,np=Qf,rp=sp;let op=class{constructor(e){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(t,i)=>String.fromCharCode(Number.parseInt(i,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(t,i)=>String.fromCharCode(Number.parseInt(i,16))}},this.addExternalEntities=ap,this.parseXml=up,this.parseTextData=lp,this.resolveNameSpace=cp,this.buildAttributesMap=dp,this.isItStopNode=gp,this.replaceEntitiesValue=pp,this.readStopNodeData=bp,this.saveTextToParentTag=mp,this.addChild=fp}};function ap(r){const e=Object.keys(r);for(let t=0;t<e.length;t++){const i=e[t];this.lastEntities[i]={regex:new RegExp("&"+i+";","g"),val:r[i]}}}function lp(r,e,t,i,s,n,o){if(r!==void 0&&(this.options.trimValues&&!i&&(r=r.trim()),r.length>0)){o||(r=this.replaceEntitiesValue(r));const a=this.options.tagValueProcessor(e,r,t,s,n);return a==null?r:typeof a!=typeof r||a!==r?a:this.options.trimValues?Yo(r,this.options.parseTagValue,this.options.numberParseOptions):r.trim()===r?Yo(r,this.options.parseTagValue,this.options.numberParseOptions):r}}function cp(r){if(this.options.removeNSPrefix){const e=r.split(":"),t=r.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(r=t+e[1])}return r}const hp=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function dp(r,e,t){if(!this.options.ignoreAttributes&&typeof r=="string"){const i=Xc.getAllMatches(r,hp),s=i.length,n={};for(let o=0;o<s;o++){const a=this.resolveNameSpace(i[o][1]);let l=i[o][4],c=this.options.attributeNamePrefix+a;if(a.length)if(this.options.transformAttributeName&&(c=this.options.transformAttributeName(c)),c==="__proto__"&&(c="#__proto__"),l!==void 0){this.options.trimValues&&(l=l.trim()),l=this.replaceEntitiesValue(l);const h=this.options.attributeValueProcessor(a,l,e);h==null?n[c]=l:typeof h!=typeof l||h!==l?n[c]=h:n[c]=Yo(l,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(n[c]=!0)}if(!Object.keys(n).length)return;if(this.options.attributesGroupName){const o={};return o[this.options.attributesGroupName]=n,o}return n}}const up=function(r){r=r.replace(/\r\n?/g,`
|
|
142
|
+
`);const e=new As("!xml");let t=e,i="",s="";for(let n=0;n<r.length;n++)if(r[n]==="<")if(r[n+1]==="/"){const a=hi(r,">",n,"Closing Tag is not closed.");let l=r.substring(n+2,a).trim();if(this.options.removeNSPrefix){const d=l.indexOf(":");d!==-1&&(l=l.substr(d+1))}this.options.transformTagName&&(l=this.options.transformTagName(l)),t&&(i=this.saveTextToParentTag(i,t,s));const c=s.substring(s.lastIndexOf(".")+1);if(l&&this.options.unpairedTags.indexOf(l)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${l}>`);let h=0;c&&this.options.unpairedTags.indexOf(c)!==-1?(h=s.lastIndexOf(".",s.lastIndexOf(".")-1),this.tagsNodeStack.pop()):h=s.lastIndexOf("."),s=s.substring(0,h),t=this.tagsNodeStack.pop(),i="",n=a}else if(r[n+1]==="?"){let a=Ho(r,n,!1,"?>");if(!a)throw new Error("Pi Tag is not closed.");if(i=this.saveTextToParentTag(i,t,s),!(this.options.ignoreDeclaration&&a.tagName==="?xml"||this.options.ignorePiTags)){const l=new As(a.tagName);l.add(this.options.textNodeName,""),a.tagName!==a.tagExp&&a.attrExpPresent&&(l[":@"]=this.buildAttributesMap(a.tagExp,s,a.tagName)),this.addChild(t,l,s)}n=a.closeIndex+1}else if(r.substr(n+1,3)==="!--"){const a=hi(r,"-->",n+4,"Comment is not closed.");if(this.options.commentPropName){const l=r.substring(n+4,a-2);i=this.saveTextToParentTag(i,t,s),t.add(this.options.commentPropName,[{[this.options.textNodeName]:l}])}n=a}else if(r.substr(n+1,2)==="!D"){const a=np(r,n);this.docTypeEntities=a.entities,n=a.i}else if(r.substr(n+1,2)==="!["){const a=hi(r,"]]>",n,"CDATA is not closed.")-2,l=r.substring(n+9,a);i=this.saveTextToParentTag(i,t,s);let c=this.parseTextData(l,t.tagname,s,!0,!1,!0,!0);c==null&&(c=""),this.options.cdataPropName?t.add(this.options.cdataPropName,[{[this.options.textNodeName]:l}]):t.add(this.options.textNodeName,c),n=a+2}else{let a=Ho(r,n,this.options.removeNSPrefix),l=a.tagName;const c=a.rawTagName;let h=a.tagExp,d=a.attrExpPresent,u=a.closeIndex;this.options.transformTagName&&(l=this.options.transformTagName(l)),t&&i&&t.tagname!=="!xml"&&(i=this.saveTextToParentTag(i,t,s,!1));const f=t;if(f&&this.options.unpairedTags.indexOf(f.tagname)!==-1&&(t=this.tagsNodeStack.pop(),s=s.substring(0,s.lastIndexOf("."))),l!==e.tagname&&(s+=s?"."+l:l),this.isItStopNode(this.options.stopNodes,s,l)){let p="";if(h.length>0&&h.lastIndexOf("/")===h.length-1)l[l.length-1]==="/"?(l=l.substr(0,l.length-1),s=s.substr(0,s.length-1),h=l):h=h.substr(0,h.length-1),n=a.closeIndex;else if(this.options.unpairedTags.indexOf(l)!==-1)n=a.closeIndex;else{const E=this.readStopNodeData(r,c,u+1);if(!E)throw new Error(`Unexpected end of ${c}`);n=E.i,p=E.tagContent}const m=new As(l);l!==h&&d&&(m[":@"]=this.buildAttributesMap(h,s,l)),p&&(p=this.parseTextData(p,l,s,!0,d,!0,!0)),s=s.substr(0,s.lastIndexOf(".")),m.add(this.options.textNodeName,p),this.addChild(t,m,s)}else{if(h.length>0&&h.lastIndexOf("/")===h.length-1){l[l.length-1]==="/"?(l=l.substr(0,l.length-1),s=s.substr(0,s.length-1),h=l):h=h.substr(0,h.length-1),this.options.transformTagName&&(l=this.options.transformTagName(l));const p=new As(l);l!==h&&d&&(p[":@"]=this.buildAttributesMap(h,s,l)),this.addChild(t,p,s),s=s.substr(0,s.lastIndexOf("."))}else{const p=new As(l);this.tagsNodeStack.push(t),l!==h&&d&&(p[":@"]=this.buildAttributesMap(h,s,l)),this.addChild(t,p,s),t=p}i="",n=u}}else i+=r[n];return e.child};function fp(r,e,t){const i=this.options.updateTag(e.tagname,t,e[":@"]);i===!1||(typeof i=="string"&&(e.tagname=i),r.addChild(e))}const pp=function(r){if(this.options.processEntities){for(let e in this.docTypeEntities){const t=this.docTypeEntities[e];r=r.replace(t.regx,t.val)}for(let e in this.lastEntities){const t=this.lastEntities[e];r=r.replace(t.regex,t.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){const t=this.htmlEntities[e];r=r.replace(t.regex,t.val)}r=r.replace(this.ampEntity.regex,this.ampEntity.val)}return r};function mp(r,e,t,i){return r&&(i===void 0&&(i=Object.keys(e.child).length===0),r=this.parseTextData(r,e.tagname,t,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,i),r!==void 0&&r!==""&&e.add(this.options.textNodeName,r),r=""),r}function gp(r,e,t){const i="*."+t;for(const s in r){const n=r[s];if(i===n||e===n)return!0}return!1}function Ep(r,e,t=">"){let i,s="";for(let n=e;n<r.length;n++){let o=r[n];if(i)o===i&&(i="");else if(o==='"'||o==="'")i=o;else if(o===t[0])if(t[1]){if(r[n+1]===t[1])return{data:s,index:n}}else return{data:s,index:n};else o===" "&&(o=" ");s+=o}}function hi(r,e,t,i){const s=r.indexOf(e,t);if(s===-1)throw new Error(i);return s+e.length-1}function Ho(r,e,t,i=">"){const s=Ep(r,e+1,i);if(!s)return;let n=s.data;const o=s.index,a=n.search(/\s/);let l=n,c=!0;a!==-1&&(l=n.substring(0,a),n=n.substring(a+1).trimStart());const h=l;if(t){const d=l.indexOf(":");d!==-1&&(l=l.substr(d+1),c=l!==s.data.substr(d+1))}return{tagName:l,tagExp:n,closeIndex:o,attrExpPresent:c,rawTagName:h}}function bp(r,e,t){const i=t;let s=1;for(;t<r.length;t++)if(r[t]==="<")if(r[t+1]==="/"){const n=hi(r,">",t,`${e} is not closed`);if(r.substring(t+2,n).trim()===e&&(s--,s===0))return{tagContent:r.substring(i,t),i:n};t=n}else if(r[t+1]==="?")t=hi(r,"?>",t+1,"StopNode is not closed.");else if(r.substr(t+1,3)==="!--")t=hi(r,"-->",t+3,"StopNode is not closed.");else if(r.substr(t+1,2)==="![")t=hi(r,"]]>",t,"StopNode is not closed.")-2;else{const n=Ho(r,t,">");n&&((n&&n.tagName)===e&&n.tagExp[n.tagExp.length-1]!=="/"&&s++,t=n.closeIndex)}}function Yo(r,e,t){if(e&&typeof r=="string"){const i=r.trim();return i==="true"?!0:i==="false"?!1:rp(r,t)}else return Xc.isExist(r)?r:""}var Ip=op,Zc={};function Cp(r,e){return qc(r,e)}function qc(r,e,t){let i;const s={};for(let n=0;n<r.length;n++){const o=r[n],a=yp(o);let l="";if(t===void 0?l=a:l=t+"."+a,a===e.textNodeName)i===void 0?i=o[a]:i+=""+o[a];else{if(a===void 0)continue;if(o[a]){let c=qc(o[a],e,l);const h=Tp(c,e);o[":@"]?_p(c,o[":@"],l,e):Object.keys(c).length===1&&c[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?c=c[e.textNodeName]:Object.keys(c).length===0&&(e.alwaysCreateTextNode?c[e.textNodeName]="":c=""),s[a]!==void 0&&s.hasOwnProperty(a)?(Array.isArray(s[a])||(s[a]=[s[a]]),s[a].push(c)):e.isArray(a,l,h)?s[a]=[c]:s[a]=c}}}return typeof i=="string"?i.length>0&&(s[e.textNodeName]=i):i!==void 0&&(s[e.textNodeName]=i),s}function yp(r){const e=Object.keys(r);for(let t=0;t<e.length;t++){const i=e[t];if(i!==":@")return i}}function _p(r,e,t,i){if(e){const s=Object.keys(e),n=s.length;for(let o=0;o<n;o++){const a=s[o];i.isArray(a,t+"."+a,!0,!0)?r[a]=[e[a]]:r[a]=e[a]}}}function Tp(r,e){const{textNodeName:t}=e,i=Object.keys(r).length;return!!(i===0||i===1&&(r[t]||typeof r[t]=="boolean"||r[t]===0))}Zc.prettify=Cp;const{buildOptions:vp}=ba,wp=Ip,{prettify:Ap}=Zc,Rp=ga;let Sp=class{constructor(e){this.externalEntities={},this.options=vp(e)}parse(e,t){if(typeof e!="string")if(e.toString)e=e.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(t){t===!0&&(t={});const n=Rp.validate(e,t);if(n!==!0)throw Error(`${n.err.msg}:${n.err.line}:${n.err.col}`)}const i=new wp(this.options);i.addExternalEntities(this.externalEntities);const s=i.parseXml(e);return this.options.preserveOrder||s===void 0?s:Ap(s,this.options)}addEntity(e,t){if(t.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(e.indexOf("&")!==-1||e.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if(t==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=t}};var Fp=Sp;const Op=`
|
|
143
|
+
`;function xp(r,e){let t="";return e.format&&e.indentBy.length>0&&(t=Op),Qc(r,e,"",t)}function Qc(r,e,t,i){let s="",n=!1;for(let o=0;o<r.length;o++){const a=r[o],l=Np(a);if(l===void 0)continue;let c="";if(t.length===0?c=l:c=`${t}.${l}`,l===e.textNodeName){let p=a[l];Pp(c,e)||(p=e.tagValueProcessor(l,p),p=Kc(p,e)),n&&(s+=i),s+=p,n=!1;continue}else if(l===e.cdataPropName){n&&(s+=i),s+=`<![CDATA[${a[l][0][e.textNodeName]}]]>`,n=!1;continue}else if(l===e.commentPropName){s+=i+`<!--${a[l][0][e.textNodeName]}-->`,n=!0;continue}else if(l[0]==="?"){const p=Sl(a[":@"],e),m=l==="?xml"?"":i;let E=a[l][0][e.textNodeName];E=E.length!==0?" "+E:"",s+=m+`<${l}${E}${p}?>`,n=!0;continue}let h=i;h!==""&&(h+=e.indentBy);const d=Sl(a[":@"],e),u=i+`<${l}${d}`,f=Qc(a[l],e,c,h);e.unpairedTags.indexOf(l)!==-1?e.suppressUnpairedNode?s+=u+">":s+=u+"/>":(!f||f.length===0)&&e.suppressEmptyNode?s+=u+"/>":f&&f.endsWith(">")?s+=u+`>${f}${i}</${l}>`:(s+=u+">",f&&i!==""&&(f.includes("/>")||f.includes("</"))?s+=i+e.indentBy+f+i:s+=f,s+=`</${l}>`),n=!0}return s}function Np(r){const e=Object.keys(r);for(let t=0;t<e.length;t++){const i=e[t];if(r.hasOwnProperty(i)&&i!==":@")return i}}function Sl(r,e){let t="";if(r&&!e.ignoreAttributes)for(let i in r){if(!r.hasOwnProperty(i))continue;let s=e.attributeValueProcessor(i,r[i]);s=Kc(s,e),s===!0&&e.suppressBooleanAttributes?t+=` ${i.substr(e.attributeNamePrefix.length)}`:t+=` ${i.substr(e.attributeNamePrefix.length)}="${s}"`}return t}function Pp(r,e){r=r.substr(0,r.length-e.textNodeName.length-1);let t=r.substr(r.lastIndexOf(".")+1);for(let i in e.stopNodes)if(e.stopNodes[i]===r||e.stopNodes[i]==="*."+t)return!0;return!1}function Kc(r,e){if(r&&r.length>0&&e.processEntities)for(let t=0;t<e.entities.length;t++){const i=e.entities[t];r=r.replace(i.regex,i.val)}return r}var Lp=xp;const Mp=Lp,Dp={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(r,e){return e},attributeValueProcessor:function(r,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function Ke(r){this.options=Object.assign({},Dp,r),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=Bp),this.processTextOrObjNode=Up,this.options.format?(this.indentate=kp,this.tagEndChar=`>
|
|
144
|
+
`,this.newLine=`
|
|
145
|
+
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}Ke.prototype.build=function(r){return this.options.preserveOrder?Mp(r,this.options):(Array.isArray(r)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(r={[this.options.arrayNodeName]:r}),this.j2x(r,0).val)};Ke.prototype.j2x=function(r,e){let t="",i="";for(let s in r)if(Object.prototype.hasOwnProperty.call(r,s))if(typeof r[s]>"u")this.isAttribute(s)&&(i+="");else if(r[s]===null)this.isAttribute(s)?i+="":s[0]==="?"?i+=this.indentate(e)+"<"+s+"?"+this.tagEndChar:i+=this.indentate(e)+"<"+s+"/"+this.tagEndChar;else if(r[s]instanceof Date)i+=this.buildTextValNode(r[s],s,"",e);else if(typeof r[s]!="object"){const n=this.isAttribute(s);if(n)t+=this.buildAttrPairStr(n,""+r[s]);else if(s===this.options.textNodeName){let o=this.options.tagValueProcessor(s,""+r[s]);i+=this.replaceEntitiesValue(o)}else i+=this.buildTextValNode(r[s],s,"",e)}else if(Array.isArray(r[s])){const n=r[s].length;let o="",a="";for(let l=0;l<n;l++){const c=r[s][l];if(!(typeof c>"u"))if(c===null)s[0]==="?"?i+=this.indentate(e)+"<"+s+"?"+this.tagEndChar:i+=this.indentate(e)+"<"+s+"/"+this.tagEndChar;else if(typeof c=="object")if(this.options.oneListGroup){const h=this.j2x(c,e+1);o+=h.val,this.options.attributesGroupName&&c.hasOwnProperty(this.options.attributesGroupName)&&(a+=h.attrStr)}else o+=this.processTextOrObjNode(c,s,e);else if(this.options.oneListGroup){let h=this.options.tagValueProcessor(s,c);h=this.replaceEntitiesValue(h),o+=h}else o+=this.buildTextValNode(c,s,"",e)}this.options.oneListGroup&&(o=this.buildObjectNode(o,s,a,e)),i+=o}else if(this.options.attributesGroupName&&s===this.options.attributesGroupName){const n=Object.keys(r[s]),o=n.length;for(let a=0;a<o;a++)t+=this.buildAttrPairStr(n[a],""+r[s][n[a]])}else i+=this.processTextOrObjNode(r[s],s,e);return{attrStr:t,val:i}};Ke.prototype.buildAttrPairStr=function(r,e){return e=this.options.attributeValueProcessor(r,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&e==="true"?" "+r:" "+r+'="'+e+'"'};function Up(r,e,t){const i=this.j2x(r,t+1);return r[this.options.textNodeName]!==void 0&&Object.keys(r).length===1?this.buildTextValNode(r[this.options.textNodeName],e,i.attrStr,t):this.buildObjectNode(i.val,e,i.attrStr,t)}Ke.prototype.buildObjectNode=function(r,e,t,i){if(r==="")return e[0]==="?"?this.indentate(i)+"<"+e+t+"?"+this.tagEndChar:this.indentate(i)+"<"+e+t+this.closeTag(e)+this.tagEndChar;{let s="</"+e+this.tagEndChar,n="";return e[0]==="?"&&(n="?",s=""),(t||t==="")&&r.indexOf("<")===-1?this.indentate(i)+"<"+e+t+n+">"+r+s:this.options.commentPropName!==!1&&e===this.options.commentPropName&&n.length===0?this.indentate(i)+`<!--${r}-->`+this.newLine:this.indentate(i)+"<"+e+t+n+this.tagEndChar+r+this.indentate(i)+s}};Ke.prototype.closeTag=function(r){let e="";return this.options.unpairedTags.indexOf(r)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${r}`,e};Ke.prototype.buildTextValNode=function(r,e,t,i){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName)return this.indentate(i)+`<![CDATA[${r}]]>`+this.newLine;if(this.options.commentPropName!==!1&&e===this.options.commentPropName)return this.indentate(i)+`<!--${r}-->`+this.newLine;if(e[0]==="?")return this.indentate(i)+"<"+e+t+"?"+this.tagEndChar;{let s=this.options.tagValueProcessor(e,r);return s=this.replaceEntitiesValue(s),s===""?this.indentate(i)+"<"+e+t+this.closeTag(e)+this.tagEndChar:this.indentate(i)+"<"+e+t+">"+s+"</"+e+this.tagEndChar}};Ke.prototype.replaceEntitiesValue=function(r){if(r&&r.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const t=this.options.entities[e];r=r.replace(t.regex,t.val)}return r};function kp(r){return this.options.indentBy.repeat(r)}function Bp(r){return r.startsWith(this.options.attributeNamePrefix)&&r!==this.options.textNodeName?r.substr(this.attrPrefixLen):!1}var zp=Ke;const $p=ga,Vp=Fp,Gp=zp;var Hp={XMLParser:Vp,XMLValidator:$p,XMLBuilder:Gp};class Jn{constructor(e,t){y(this,"date",new Date);y(this,"author");y(this,"guid",Le.create());y(this,"viewpoint");y(this,"modifiedAuthor");y(this,"modifiedDate");y(this,"topic");y(this,"_components");y(this,"_comment","");this._components=e,this._comment=t;const i=this._components.get(Mt);this.author=i.config.author}set comment(e){var i;const t=this._components.get(Mt);this._comment=e,this.modifiedDate=new Date,this.modifiedAuthor=t.config.author,(i=this.topic)==null||i.comments.set(this.guid,this)}get comment(){return this._comment}serialize(){let e=null;this.viewpoint&&(e=`<Viewpoint Guid="${this.viewpoint.guid}"/>`);let t=null;this.modifiedDate&&(t=`<ModifiedDate>${this.modifiedDate.toISOString()}</ModifiedDate>`);let i=null;return this.modifiedAuthor&&(i=`<ModifiedAuthor>${this.modifiedAuthor}</ModifiedAuthor>`),`
|
|
146
|
+
<Comment Guid="${this.guid}">
|
|
147
|
+
<Date>${this.date.toISOString()}</Date>
|
|
148
|
+
<Author>${this.author}</Author>
|
|
149
|
+
<Comment>${this.comment}</Comment>
|
|
150
|
+
${e??""}
|
|
151
|
+
${i??""}
|
|
152
|
+
${t??""}
|
|
153
|
+
</Comment>
|
|
154
|
+
`}}const _e=class _e{constructor(e){y(this,"guid",Le.create());y(this,"title",_e.default.title);y(this,"creationDate",new Date);y(this,"creationAuthor","");y(this,"viewpoints",new $i);y(this,"relatedTopics",new $i);y(this,"comments",new pi);y(this,"customData",{});y(this,"description");y(this,"serverAssignedId");y(this,"dueDate");y(this,"modifiedAuthor");y(this,"modifiedDate");y(this,"index");y(this,"_type",_e.default.type);y(this,"_status",_e.default.status);y(this,"_priority",_e.default.priority);y(this,"_stage",_e.default.priority);y(this,"_assignedTo",_e.default.assignedTo);y(this,"_labels",_e.default.labels);y(this,"_components");this._components=e;const t=e.get(Mt);this.creationAuthor=t.config.author,this.relatedTopics.guard=i=>i!==this.guid}set type(e){const t=this._components.get(Mt),{strict:i,types:s}=t.config;(!i||s.has(e))&&(this._type=e)}get type(){return this._type}set status(e){const t=this._components.get(Mt),{strict:i,statuses:s}=t.config;(!i||s.has(e))&&(this._status=e)}get status(){return this._status}set priority(e){const t=this._components.get(Mt);if(e){const{strict:i,priorities:s}=t.config;if(!(i?s.has(e):!0))return;this._priority=e}else this._priority=e}get priority(){return this._priority}set stage(e){const t=this._components.get(Mt);if(e){const{strict:i,stages:s}=t.config;if(!(i?s.has(e):!0))return;this._stage=e}else this._stage=e}get stage(){return this._stage}set assignedTo(e){const t=this._components.get(Mt);if(e){const{strict:i,users:s}=t.config;if(!(i?s.has(e):!0))return;this._assignedTo=e}else this._assignedTo=e}get assignedTo(){return this._assignedTo}set labels(e){const t=this._components.get(Mt),{strict:i,labels:s}=t.config;if(i){const n=new Set;for(const o of e)(!i||s.has(o))&&n.add(o);this._labels=n}else this._labels=e}get labels(){return this._labels}get _managerVersion(){return this._components.get(Mt).config.version}set(e){const t=e,i=this;for(const n in e){if(n==="guid")continue;const o=t[n];n in this&&(i[n]=o)}return this._components.get(Mt).list.set(this.guid,this),this}createComment(e,t){const i=new Jn(this._components,e);return i.viewpoint=t,i.topic=this,this.comments.set(i.guid,i),i}createLabelTags(e=this._managerVersion){let t="Labels";e==="2.1"&&(t="Labels"),e==="3"&&(t="Label");let i=[...this.labels].map(s=>`<${t}>${s}</${t}>`).join(`
|
|
155
|
+
`);for(const s in this.customData){const n=this.customData[s];typeof n=="string"&&(i+=`
|
|
156
|
+
<${t}>${n}</${t}>`)}return e==="2.1"?i:e==="3"?i.length!==0?`<Labels>
|
|
157
|
+
${i}
|
|
158
|
+
</Labels>`:"<Labels/>":i}createCommentTags(e=this._managerVersion){const t=[...this.comments.values()].map(i=>i.serialize()).join(`
|
|
159
|
+
`);return e==="2.1"?t:e==="3"?t.length!==0?`<Comments>
|
|
160
|
+
${t}
|
|
161
|
+
</Comments>`:"<Comments/>":t}createViewpointTags(e=this._managerVersion){let t="Viewpoints";e==="2.1"&&(t="Viewpoints"),e==="3"&&(t="ViewPoint");const i=this._components.get(Ht),n=[...this.viewpoints].map(o=>i.list.get(o)).filter(o=>o).map(o=>`<${t} Guid="${o.guid}">
|
|
162
|
+
<Viewpoint>${o.guid}.bcfv</Viewpoint>
|
|
163
|
+
<Snapshot>${o.guid}.jpeg</Snapshot>
|
|
164
|
+
</${t}>
|
|
165
|
+
`).join(`
|
|
166
|
+
`);return e==="2.1"?n:e==="3"?n.length!==0?`<Viewpoints>
|
|
167
|
+
${n}
|
|
168
|
+
</Viewpoints>`:"<Viewpoints />":n}createRelatedTopicTags(e=this._managerVersion){const t=[...this.relatedTopics].map(i=>`<RelatedTopic Guid="${i}"></RelatedTopic>
|
|
169
|
+
`).join(`
|
|
170
|
+
`);return e==="2.1"?t:e==="3"?t.length!==0?`<RelatedTopics>
|
|
171
|
+
${t}
|
|
172
|
+
</RelatedTopics>`:"<RelatedTopics />":t}serialize(){const e=this._managerVersion;let t=null;this.serverAssignedId&&(t=`ServerAssignedId="${this.serverAssignedId}"`);let i=null;this.priority&&(i=`<Priority>${this.priority}</Priority>`);let s=null;this.index&&e==="2.1"&&(s=`<Index>${this.index}</Index>`);let n=null;this.modifiedDate&&(n=`<ModifiedDate>${this.modifiedDate.toISOString()}</ModifiedDate>`);let o=null;this.modifiedAuthor&&(o=`<ModifiedAuthor>${this.modifiedAuthor}</ModifiedAuthor>`);let a=null;this.dueDate&&(a=`<DueDate>${this.dueDate.toISOString()}</DueDate>`);let l=null;this.assignedTo&&(l=`<AssignedTo>${this.assignedTo}</AssignedTo>`);let c=null;this.description&&(c=`<Description>${this.description}</Description>`);let h=null;this.stage&&(h=`<Stage>${this.stage}</Stage>`);const d=this.createCommentTags(e),u=this.createViewpointTags(e),f=this.createLabelTags(e),p=this.createRelatedTopicTags(e);return`
|
|
173
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
174
|
+
<Markup>
|
|
175
|
+
<Topic Guid="${this.guid}" TopicType="${this.type}" TopicStatus="${this.status}" ${t??""}>
|
|
176
|
+
<Title>${this.title}</Title>
|
|
177
|
+
<CreationDate>${this.creationDate.toISOString()}</CreationDate>
|
|
178
|
+
<CreationAuthor>${this.creationAuthor}</CreationAuthor>
|
|
179
|
+
${i??""}
|
|
180
|
+
${s??""}
|
|
181
|
+
${n??""}
|
|
182
|
+
${o??""}
|
|
183
|
+
${a??""}
|
|
184
|
+
${l??""}
|
|
185
|
+
${c??""}
|
|
186
|
+
${h??""}
|
|
187
|
+
${f}
|
|
188
|
+
${p}
|
|
189
|
+
${e==="3"?d:""}
|
|
190
|
+
${e==="3"?u:""}
|
|
191
|
+
</Topic>
|
|
192
|
+
${e==="2.1"?d:""}
|
|
193
|
+
${e==="2.1"?u:""}
|
|
194
|
+
</Markup>
|
|
195
|
+
`}};y(_e,"default",{title:"BCF Topic",type:"Issue",status:"Active",labels:new Set});let Gs=_e;var Yp=Object.defineProperty,Wp=(r,e,t)=>e in r?Yp(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,oi=(r,e,t)=>(Wp(r,typeof e!="symbol"?e+"":e,t),t);const Hi=Math.min,Oe=Math.max,tr=Math.round,Ze=r=>({x:r,y:r}),jp={left:"right",right:"left",bottom:"top",top:"bottom"},Xp={start:"end",end:"start"};function Fl(r,e,t){return Oe(r,Hi(e,t))}function tn(r,e){return typeof r=="function"?r(e):r}function Me(r){return r.split("-")[0]}function kr(r){return r.split("-")[1]}function Jc(r){return r==="x"?"y":"x"}function th(r){return r==="y"?"height":"width"}function Ei(r){return["top","bottom"].includes(Me(r))?"y":"x"}function eh(r){return Jc(Ei(r))}function Zp(r,e,t){t===void 0&&(t=!1);const i=kr(r),s=eh(r),n=th(s);let o=s==="x"?i===(t?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[n]>e.floating[n]&&(o=er(o)),[o,er(o)]}function qp(r){const e=er(r);return[Wo(r),e,Wo(e)]}function Wo(r){return r.replace(/start|end/g,e=>Xp[e])}function Qp(r,e,t){const i=["left","right"],s=["right","left"],n=["top","bottom"],o=["bottom","top"];switch(r){case"top":case"bottom":return t?e?s:i:e?i:s;case"left":case"right":return e?n:o;default:return[]}}function Kp(r,e,t,i){const s=kr(r);let n=Qp(Me(r),t==="start",i);return s&&(n=n.map(o=>o+"-"+s),e&&(n=n.concat(n.map(Wo)))),n}function er(r){return r.replace(/left|right|bottom|top/g,e=>jp[e])}function Jp(r){return{top:0,right:0,bottom:0,left:0,...r}}function ih(r){return typeof r!="number"?Jp(r):{top:r,right:r,bottom:r,left:r}}function Yi(r){const{x:e,y:t,width:i,height:s}=r;return{width:i,height:s,top:t,left:e,right:e+i,bottom:t+s,x:e,y:t}}function Ol(r,e,t){let{reference:i,floating:s}=r;const n=Ei(e),o=eh(e),a=th(o),l=Me(e),c=n==="y",h=i.x+i.width/2-s.width/2,d=i.y+i.height/2-s.height/2,u=i[a]/2-s[a]/2;let f;switch(l){case"top":f={x:h,y:i.y-s.height};break;case"bottom":f={x:h,y:i.y+i.height};break;case"right":f={x:i.x+i.width,y:d};break;case"left":f={x:i.x-s.width,y:d};break;default:f={x:i.x,y:i.y}}switch(kr(e)){case"start":f[o]-=u*(t&&c?-1:1);break;case"end":f[o]+=u*(t&&c?-1:1);break}return f}const tm=async(r,e,t)=>{const{placement:i="bottom",strategy:s="absolute",middleware:n=[],platform:o}=t,a=n.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:r,floating:e,strategy:s}),{x:h,y:d}=Ol(c,i,l),u=i,f={},p=0;for(let m=0;m<a.length;m++){const{name:E,fn:g}=a[m],{x:I,y:T,data:b,reset:v}=await g({x:h,y:d,initialPlacement:i,placement:u,strategy:s,middlewareData:f,rects:c,platform:o,elements:{reference:r,floating:e}});h=I??h,d=T??d,f={...f,[E]:{...f[E],...b}},v&&p<=50&&(p++,typeof v=="object"&&(v.placement&&(u=v.placement),v.rects&&(c=v.rects===!0?await o.getElementRects({reference:r,floating:e,strategy:s}):v.rects),{x:h,y:d}=Ol(c,u,l)),m=-1)}return{x:h,y:d,placement:u,strategy:s,middlewareData:f}};async function sh(r,e){var t;e===void 0&&(e={});const{x:i,y:s,platform:n,rects:o,elements:a,strategy:l}=r,{boundary:c="clippingAncestors",rootBoundary:h="viewport",elementContext:d="floating",altBoundary:u=!1,padding:f=0}=tn(e,r),p=ih(f),m=a[u?d==="floating"?"reference":"floating":d],E=Yi(await n.getClippingRect({element:(t=await(n.isElement==null?void 0:n.isElement(m)))==null||t?m:m.contextElement||await(n.getDocumentElement==null?void 0:n.getDocumentElement(a.floating)),boundary:c,rootBoundary:h,strategy:l})),g=d==="floating"?{x:i,y:s,width:o.floating.width,height:o.floating.height}:o.reference,I=await(n.getOffsetParent==null?void 0:n.getOffsetParent(a.floating)),T=await(n.isElement==null?void 0:n.isElement(I))?await(n.getScale==null?void 0:n.getScale(I))||{x:1,y:1}:{x:1,y:1},b=Yi(n.convertOffsetParentRelativeRectToViewportRelativeRect?await n.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:g,offsetParent:I,strategy:l}):g);return{top:(E.top-b.top+p.top)/T.y,bottom:(b.bottom-E.bottom+p.bottom)/T.y,left:(E.left-b.left+p.left)/T.x,right:(b.right-E.right+p.right)/T.x}}const em=function(r){return r===void 0&&(r={}),{name:"flip",options:r,async fn(e){var t,i;const{placement:s,middlewareData:n,rects:o,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:h=!0,crossAxis:d=!0,fallbackPlacements:u,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...E}=tn(r,e);if((t=n.arrow)!=null&&t.alignmentOffset)return{};const g=Me(s),I=Ei(a),T=Me(a)===a,b=await(l.isRTL==null?void 0:l.isRTL(c.floating)),v=u||(T||!m?[er(a)]:qp(a)),A=p!=="none";!u&&A&&v.push(...Kp(a,m,p,b));const S=[a,...v],N=await sh(e,E),R=[];let P=((i=n.flip)==null?void 0:i.overflows)||[];if(h&&R.push(N[g]),d){const C=Zp(s,o,b);R.push(N[C[0]],N[C[1]])}if(P=[...P,{placement:s,overflows:R}],!R.every(C=>C<=0)){var M,w;const C=(((M=n.flip)==null?void 0:M.index)||0)+1,U=S[C];if(U)return{data:{index:C,overflows:P},reset:{placement:U}};let q=(w=P.filter(G=>G.overflows[0]<=0).sort((G,st)=>G.overflows[1]-st.overflows[1])[0])==null?void 0:w.placement;if(!q)switch(f){case"bestFit":{var L;const G=(L=P.filter(st=>{if(A){const Y=Ei(st.placement);return Y===I||Y==="y"}return!0}).map(st=>[st.placement,st.overflows.filter(Y=>Y>0).reduce((Y,ot)=>Y+ot,0)]).sort((st,Y)=>st[1]-Y[1])[0])==null?void 0:L[0];G&&(q=G);break}case"initialPlacement":q=a;break}if(s!==q)return{reset:{placement:q}}}return{}}}};function nh(r){const e=Hi(...r.map(n=>n.left)),t=Hi(...r.map(n=>n.top)),i=Oe(...r.map(n=>n.right)),s=Oe(...r.map(n=>n.bottom));return{x:e,y:t,width:i-e,height:s-t}}function im(r){const e=r.slice().sort((s,n)=>s.y-n.y),t=[];let i=null;for(let s=0;s<e.length;s++){const n=e[s];!i||n.y-i.y>i.height/2?t.push([n]):t[t.length-1].push(n),i=n}return t.map(s=>Yi(nh(s)))}const sm=function(r){return r===void 0&&(r={}),{name:"inline",options:r,async fn(e){const{placement:t,elements:i,rects:s,platform:n,strategy:o}=e,{padding:a=2,x:l,y:c}=tn(r,e),h=Array.from(await(n.getClientRects==null?void 0:n.getClientRects(i.reference))||[]),d=im(h),u=Yi(nh(h)),f=ih(a);function p(){if(d.length===2&&d[0].left>d[1].right&&l!=null&&c!=null)return d.find(E=>l>E.left-f.left&&l<E.right+f.right&&c>E.top-f.top&&c<E.bottom+f.bottom)||u;if(d.length>=2){if(Ei(t)==="y"){const P=d[0],M=d[d.length-1],w=Me(t)==="top",L=P.top,C=M.bottom,U=w?P.left:M.left,q=w?P.right:M.right,G=q-U,st=C-L;return{top:L,bottom:C,left:U,right:q,width:G,height:st,x:U,y:L}}const E=Me(t)==="left",g=Oe(...d.map(P=>P.right)),I=Hi(...d.map(P=>P.left)),T=d.filter(P=>E?P.left===I:P.right===g),b=T[0].top,v=T[T.length-1].bottom,A=I,S=g,N=S-A,R=v-b;return{top:b,bottom:v,left:A,right:S,width:N,height:R,x:A,y:b}}return u}const m=await n.getElementRects({reference:{getBoundingClientRect:p},floating:i.floating,strategy:o});return s.reference.x!==m.reference.x||s.reference.y!==m.reference.y||s.reference.width!==m.reference.width||s.reference.height!==m.reference.height?{reset:{rects:m}}:{}}}};async function nm(r,e){const{placement:t,platform:i,elements:s}=r,n=await(i.isRTL==null?void 0:i.isRTL(s.floating)),o=Me(t),a=kr(t),l=Ei(t)==="y",c=["left","top"].includes(o)?-1:1,h=n&&l?-1:1,d=tn(e,r);let{mainAxis:u,crossAxis:f,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return a&&typeof p=="number"&&(f=a==="end"?p*-1:p),l?{x:f*h,y:u*c}:{x:u*c,y:f*h}}const rh=function(r){return{name:"offset",options:r,async fn(e){var t,i;const{x:s,y:n,placement:o,middlewareData:a}=e,l=await nm(e,r);return o===((t=a.offset)==null?void 0:t.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:s+l.x,y:n+l.y,data:{...l,placement:o}}}}},rm=function(r){return r===void 0&&(r={}),{name:"shift",options:r,async fn(e){const{x:t,y:i,placement:s}=e,{mainAxis:n=!0,crossAxis:o=!1,limiter:a={fn:E=>{let{x:g,y:I}=E;return{x:g,y:I}}},...l}=tn(r,e),c={x:t,y:i},h=await sh(e,l),d=Ei(Me(s)),u=Jc(d);let f=c[u],p=c[d];if(n){const E=u==="y"?"top":"left",g=u==="y"?"bottom":"right",I=f+h[E],T=f-h[g];f=Fl(I,f,T)}if(o){const E=d==="y"?"top":"left",g=d==="y"?"bottom":"right",I=p+h[E],T=p-h[g];p=Fl(I,p,T)}const m=a.fn({...e,[u]:f,[d]:p});return{...m,data:{x:m.x-t,y:m.y-i}}}}};function qe(r){return oh(r)?(r.nodeName||"").toLowerCase():"#document"}function qt(r){var e;return(r==null||(e=r.ownerDocument)==null?void 0:e.defaultView)||window}function Je(r){var e;return(e=(oh(r)?r.ownerDocument:r.document)||window.document)==null?void 0:e.documentElement}function oh(r){return r instanceof Node||r instanceof qt(r).Node}function Te(r){return r instanceof Element||r instanceof qt(r).Element}function ve(r){return r instanceof HTMLElement||r instanceof qt(r).HTMLElement}function xl(r){return typeof ShadowRoot>"u"?!1:r instanceof ShadowRoot||r instanceof qt(r).ShadowRoot}function en(r){const{overflow:e,overflowX:t,overflowY:i,display:s}=oe(r);return/auto|scroll|overlay|hidden|clip/.test(e+i+t)&&!["inline","contents"].includes(s)}function om(r){return["table","td","th"].includes(qe(r))}function am(r){return[":popover-open",":modal"].some(e=>{try{return r.matches(e)}catch{return!1}})}function Ia(r){const e=Ca(),t=Te(r)?oe(r):r;return t.transform!=="none"||t.perspective!=="none"||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||["transform","perspective","filter"].some(i=>(t.willChange||"").includes(i))||["paint","layout","strict","content"].some(i=>(t.contain||"").includes(i))}function lm(r){let e=Wi(r);for(;ve(e)&&!Br(e);){if(Ia(e))return e;if(am(e))return null;e=Wi(e)}return null}function Ca(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Br(r){return["html","body","#document"].includes(qe(r))}function oe(r){return qt(r).getComputedStyle(r)}function zr(r){return Te(r)?{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}:{scrollLeft:r.scrollX,scrollTop:r.scrollY}}function Wi(r){if(qe(r)==="html")return r;const e=r.assignedSlot||r.parentNode||xl(r)&&r.host||Je(r);return xl(e)?e.host:e}function ah(r){const e=Wi(r);return Br(e)?r.ownerDocument?r.ownerDocument.body:r.body:ve(e)&&en(e)?e:ah(e)}function jo(r,e,t){var i;e===void 0&&(e=[]),t===void 0&&(t=!0);const s=ah(r),n=s===((i=r.ownerDocument)==null?void 0:i.body),o=qt(s);if(n){const a=cm(o);return e.concat(o,o.visualViewport||[],en(s)?s:[],a&&t?jo(a):[])}return e.concat(s,jo(s,[],t))}function cm(r){return r.parent&&Object.getPrototypeOf(r.parent)?r.frameElement:null}function lh(r){const e=oe(r);let t=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const s=ve(r),n=s?r.offsetWidth:t,o=s?r.offsetHeight:i,a=tr(t)!==n||tr(i)!==o;return a&&(t=n,i=o),{width:t,height:i,$:a}}function ch(r){return Te(r)?r:r.contextElement}function Vi(r){const e=ch(r);if(!ve(e))return Ze(1);const t=e.getBoundingClientRect(),{width:i,height:s,$:n}=lh(e);let o=(n?tr(t.width):t.width)/i,a=(n?tr(t.height):t.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const hm=Ze(0);function hh(r){const e=qt(r);return!Ca()||!e.visualViewport?hm:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function dm(r,e,t){return e===void 0&&(e=!1),!t||e&&t!==qt(r)?!1:e}function Hs(r,e,t,i){e===void 0&&(e=!1),t===void 0&&(t=!1);const s=r.getBoundingClientRect(),n=ch(r);let o=Ze(1);e&&(i?Te(i)&&(o=Vi(i)):o=Vi(r));const a=dm(n,t,i)?hh(n):Ze(0);let l=(s.left+a.x)/o.x,c=(s.top+a.y)/o.y,h=s.width/o.x,d=s.height/o.y;if(n){const u=qt(n),f=i&&Te(i)?qt(i):i;let p=u,m=p.frameElement;for(;m&&i&&f!==p;){const E=Vi(m),g=m.getBoundingClientRect(),I=oe(m),T=g.left+(m.clientLeft+parseFloat(I.paddingLeft))*E.x,b=g.top+(m.clientTop+parseFloat(I.paddingTop))*E.y;l*=E.x,c*=E.y,h*=E.x,d*=E.y,l+=T,c+=b,p=qt(m),m=p.frameElement}}return Yi({width:h,height:d,x:l,y:c})}const um=[":popover-open",":modal"];function dh(r){return um.some(e=>{try{return r.matches(e)}catch{return!1}})}function fm(r){let{elements:e,rect:t,offsetParent:i,strategy:s}=r;const n=s==="fixed",o=Je(i),a=e?dh(e.floating):!1;if(i===o||a&&n)return t;let l={scrollLeft:0,scrollTop:0},c=Ze(1);const h=Ze(0),d=ve(i);if((d||!d&&!n)&&((qe(i)!=="body"||en(o))&&(l=zr(i)),ve(i))){const u=Hs(i);c=Vi(i),h.x=u.x+i.clientLeft,h.y=u.y+i.clientTop}return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-l.scrollLeft*c.x+h.x,y:t.y*c.y-l.scrollTop*c.y+h.y}}function pm(r){return Array.from(r.getClientRects())}function uh(r){return Hs(Je(r)).left+zr(r).scrollLeft}function mm(r){const e=Je(r),t=zr(r),i=r.ownerDocument.body,s=Oe(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),n=Oe(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let o=-t.scrollLeft+uh(r);const a=-t.scrollTop;return oe(i).direction==="rtl"&&(o+=Oe(e.clientWidth,i.clientWidth)-s),{width:s,height:n,x:o,y:a}}function gm(r,e){const t=qt(r),i=Je(r),s=t.visualViewport;let n=i.clientWidth,o=i.clientHeight,a=0,l=0;if(s){n=s.width,o=s.height;const c=Ca();(!c||c&&e==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}return{width:n,height:o,x:a,y:l}}function Em(r,e){const t=Hs(r,!0,e==="fixed"),i=t.top+r.clientTop,s=t.left+r.clientLeft,n=ve(r)?Vi(r):Ze(1),o=r.clientWidth*n.x,a=r.clientHeight*n.y,l=s*n.x,c=i*n.y;return{width:o,height:a,x:l,y:c}}function Nl(r,e,t){let i;if(e==="viewport")i=gm(r,t);else if(e==="document")i=mm(Je(r));else if(Te(e))i=Em(e,t);else{const s=hh(r);i={...e,x:e.x-s.x,y:e.y-s.y}}return Yi(i)}function fh(r,e){const t=Wi(r);return t===e||!Te(t)||Br(t)?!1:oe(t).position==="fixed"||fh(t,e)}function bm(r,e){const t=e.get(r);if(t)return t;let i=jo(r,[],!1).filter(a=>Te(a)&&qe(a)!=="body"),s=null;const n=oe(r).position==="fixed";let o=n?Wi(r):r;for(;Te(o)&&!Br(o);){const a=oe(o),l=Ia(o);!l&&a.position==="fixed"&&(s=null),(n?!l&&!s:!l&&a.position==="static"&&s&&["absolute","fixed"].includes(s.position)||en(o)&&!l&&fh(r,o))?i=i.filter(c=>c!==o):s=a,o=Wi(o)}return e.set(r,i),i}function Im(r){let{element:e,boundary:t,rootBoundary:i,strategy:s}=r;const n=[...t==="clippingAncestors"?bm(e,this._c):[].concat(t),i],o=n[0],a=n.reduce((l,c)=>{const h=Nl(e,c,s);return l.top=Oe(h.top,l.top),l.right=Hi(h.right,l.right),l.bottom=Hi(h.bottom,l.bottom),l.left=Oe(h.left,l.left),l},Nl(e,o,s));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Cm(r){const{width:e,height:t}=lh(r);return{width:e,height:t}}function ym(r,e,t){const i=ve(e),s=Je(e),n=t==="fixed",o=Hs(r,!0,n,e);let a={scrollLeft:0,scrollTop:0};const l=Ze(0);if(i||!i&&!n)if((qe(e)!=="body"||en(s))&&(a=zr(e)),i){const d=Hs(e,!0,n,e);l.x=d.x+e.clientLeft,l.y=d.y+e.clientTop}else s&&(l.x=uh(s));const c=o.left+a.scrollLeft-l.x,h=o.top+a.scrollTop-l.y;return{x:c,y:h,width:o.width,height:o.height}}function Pl(r,e){return!ve(r)||oe(r).position==="fixed"?null:e?e(r):r.offsetParent}function ph(r,e){const t=qt(r);if(!ve(r)||dh(r))return t;let i=Pl(r,e);for(;i&&om(i)&&oe(i).position==="static";)i=Pl(i,e);return i&&(qe(i)==="html"||qe(i)==="body"&&oe(i).position==="static"&&!Ia(i))?t:i||lm(r)||t}const _m=async function(r){const e=this.getOffsetParent||ph,t=this.getDimensions;return{reference:ym(r.reference,await e(r.floating),r.strategy),floating:{x:0,y:0,...await t(r.floating)}}};function Tm(r){return oe(r).direction==="rtl"}const vm={convertOffsetParentRelativeRectToViewportRelativeRect:fm,getDocumentElement:Je,getClippingRect:Im,getOffsetParent:ph,getElementRects:_m,getClientRects:pm,getDimensions:Cm,getScale:Vi,isElement:Te,isRTL:Tm},mh=rm,gh=em,Eh=sm,bh=(r,e,t)=>{const i=new Map,s={platform:vm,...t},n={...s.platform,_c:i};return tm(r,e,{...s,platform:n})};/**
|
|
196
|
+
* @license
|
|
197
|
+
* Copyright 2019 Google LLC
|
|
198
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
199
|
+
*/const Hn=globalThis,ya=Hn.ShadowRoot&&(Hn.ShadyCSS===void 0||Hn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,_a=Symbol(),Ll=new WeakMap;let Ih=class{constructor(r,e,t){if(this._$cssResult$=!0,t!==_a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=r,this.t=e}get styleSheet(){let r=this.o;const e=this.t;if(ya&&r===void 0){const t=e!==void 0&&e.length===1;t&&(r=Ll.get(e)),r===void 0&&((this.o=r=new CSSStyleSheet).replaceSync(this.cssText),t&&Ll.set(e,r))}return r}toString(){return this.cssText}};const wm=r=>new Ih(typeof r=="string"?r:r+"",void 0,_a),yt=(r,...e)=>{const t=r.length===1?r[0]:e.reduce((i,s,n)=>i+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+r[n+1],r[0]);return new Ih(t,r,_a)},Am=(r,e)=>{if(ya)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const i=document.createElement("style"),s=Hn.litNonce;s!==void 0&&i.setAttribute("nonce",s),i.textContent=t.cssText,r.appendChild(i)}},Ml=ya?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return wm(t)})(r):r;/**
|
|
200
|
+
* @license
|
|
201
|
+
* Copyright 2017 Google LLC
|
|
202
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
203
|
+
*/const{is:Rm,defineProperty:Sm,getOwnPropertyDescriptor:Fm,getOwnPropertyNames:Om,getOwnPropertySymbols:xm,getPrototypeOf:Nm}=Object,ji=globalThis,Dl=ji.trustedTypes,Pm=Dl?Dl.emptyScript:"",Ul=ji.reactiveElementPolyfillSupport,Ps=(r,e)=>r,ir={toAttribute(r,e){switch(e){case Boolean:r=r?Pm:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},Ta=(r,e)=>!Rm(r,e),kl={attribute:!0,type:String,converter:ir,reflect:!1,hasChanged:Ta};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),ji.litPropertyMetadata??(ji.litPropertyMetadata=new WeakMap);class Bi extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=kl){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(e,i,t);s!==void 0&&Sm(this.prototype,e,s)}}static getPropertyDescriptor(e,t,i){const{get:s,set:n}=Fm(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get(){return s==null?void 0:s.call(this)},set(o){const a=s==null?void 0:s.call(this);n.call(this,o),this.requestUpdate(e,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??kl}static _$Ei(){if(this.hasOwnProperty(Ps("elementProperties")))return;const e=Nm(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Ps("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ps("properties"))){const t=this.properties,i=[...Om(t),...xm(t)];for(const s of i)this.createProperty(s,t[s])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[i,s]of t)this.elementProperties.set(i,s)}this._$Eh=new Map;for(const[t,i]of this.elementProperties){const s=this._$Eu(t,i);s!==void 0&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const s of i)t.unshift(Ml(s))}else e!==void 0&&t.push(Ml(e));return t}static _$Eu(e,t){const i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(t=>t(this))}addController(e){var t;(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((t=e.hostConnected)==null||t.call(e))}removeController(e){var t;(t=this._$EO)==null||t.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Am(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(t=>{var i;return(i=t.hostConnected)==null?void 0:i.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(t=>{var i;return(i=t.hostDisconnected)==null?void 0:i.call(t)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$EC(e,t){var i;const s=this.constructor.elementProperties.get(e),n=this.constructor._$Eu(e,s);if(n!==void 0&&s.reflect===!0){const o=(((i=s.converter)==null?void 0:i.toAttribute)!==void 0?s.converter:ir).toAttribute(t,s.type);this._$Em=e,o==null?this.removeAttribute(n):this.setAttribute(n,o),this._$Em=null}}_$AK(e,t){var i;const s=this.constructor,n=s._$Eh.get(e);if(n!==void 0&&this._$Em!==n){const o=s.getPropertyOptions(n),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((i=o.converter)==null?void 0:i.fromAttribute)!==void 0?o.converter:ir;this._$Em=n,this[n]=a.fromAttribute(t,o.type),this._$Em=null}}requestUpdate(e,t,i){if(e!==void 0){if(i??(i=this.constructor.getPropertyOptions(e)),!(i.hasChanged??Ta)(this[e],t))return;this.P(e,t,i)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(e,t,i){this._$AL.has(e)||this._$AL.set(e,t),i.reflect===!0&&this._$Em!==e&&(this._$Ej??(this._$Ej=new Set)).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[n,o]of this._$Ep)this[n]=o;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[n,o]of s)o.wrapped!==!0||this._$AL.has(n)||this[n]===void 0||this.P(n,this[n],o)}let t=!1;const i=this._$AL;try{t=this.shouldUpdate(i),t?(this.willUpdate(i),(e=this._$EO)==null||e.forEach(s=>{var n;return(n=s.hostUpdate)==null?void 0:n.call(s)}),this.update(i)):this._$EU()}catch(s){throw t=!1,this._$EU(),s}t&&this._$AE(i)}willUpdate(e){}_$AE(e){var t;(t=this._$EO)==null||t.forEach(i=>{var s;return(s=i.hostUpdated)==null?void 0:s.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&(this._$Ej=this._$Ej.forEach(t=>this._$EC(t,this[t]))),this._$EU()}updated(e){}firstUpdated(e){}}Bi.elementStyles=[],Bi.shadowRootOptions={mode:"open"},Bi[Ps("elementProperties")]=new Map,Bi[Ps("finalized")]=new Map,Ul==null||Ul({ReactiveElement:Bi}),(ji.reactiveElementVersions??(ji.reactiveElementVersions=[])).push("2.0.4");/**
|
|
204
|
+
* @license
|
|
205
|
+
* Copyright 2017 Google LLC
|
|
206
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
207
|
+
*/const sr=globalThis,nr=sr.trustedTypes,Bl=nr?nr.createPolicy("lit-html",{createHTML:r=>r}):void 0,Ch="$lit$",Ge=`lit$${Math.random().toFixed(9).slice(2)}$`,yh="?"+Ge,Lm=`<${yh}>`,bi=document,Ys=()=>bi.createComment(""),Ws=r=>r===null||typeof r!="object"&&typeof r!="function",va=Array.isArray,Mm=r=>va(r)||typeof(r==null?void 0:r[Symbol.iterator])=="function",_o=`[
|
|
208
|
+
\f\r]`,Rs=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,zl=/-->/g,$l=/>/g,ai=RegExp(`>|${_o}(?:([^\\s"'>=/]+)(${_o}*=${_o}*(?:[^
|
|
209
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Vl=/'/g,Gl=/"/g,_h=/^(?:script|style|textarea|title)$/i,Dm=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),X=Dm(1),Ii=Symbol.for("lit-noChange"),Dt=Symbol.for("lit-nothing"),Hl=new WeakMap,di=bi.createTreeWalker(bi,129);function Th(r,e){if(!va(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Bl!==void 0?Bl.createHTML(e):e}const Um=(r,e)=>{const t=r.length-1,i=[];let s,n=e===2?"<svg>":e===3?"<math>":"",o=Rs;for(let a=0;a<t;a++){const l=r[a];let c,h,d=-1,u=0;for(;u<l.length&&(o.lastIndex=u,h=o.exec(l),h!==null);)u=o.lastIndex,o===Rs?h[1]==="!--"?o=zl:h[1]!==void 0?o=$l:h[2]!==void 0?(_h.test(h[2])&&(s=RegExp("</"+h[2],"g")),o=ai):h[3]!==void 0&&(o=ai):o===ai?h[0]===">"?(o=s??Rs,d=-1):h[1]===void 0?d=-2:(d=o.lastIndex-h[2].length,c=h[1],o=h[3]===void 0?ai:h[3]==='"'?Gl:Vl):o===Gl||o===Vl?o=ai:o===zl||o===$l?o=Rs:(o=ai,s=void 0);const f=o===ai&&r[a+1].startsWith("/>")?" ":"";n+=o===Rs?l+Lm:d>=0?(i.push(c),l.slice(0,d)+Ch+l.slice(d)+Ge+f):l+Ge+(d===-2?a:f)}return[Th(r,n+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),i]};class js{constructor({strings:e,_$litType$:t},i){let s;this.parts=[];let n=0,o=0;const a=e.length-1,l=this.parts,[c,h]=Um(e,t);if(this.el=js.createElement(c,i),di.currentNode=this.el.content,t===2||t===3){const d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(s=di.nextNode())!==null&&l.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(const d of s.getAttributeNames())if(d.endsWith(Ch)){const u=h[o++],f=s.getAttribute(d).split(Ge),p=/([.?@])?(.*)/.exec(u);l.push({type:1,index:n,name:p[2],strings:f,ctor:p[1]==="."?Bm:p[1]==="?"?zm:p[1]==="@"?$m:$r}),s.removeAttribute(d)}else d.startsWith(Ge)&&(l.push({type:6,index:n}),s.removeAttribute(d));if(_h.test(s.tagName)){const d=s.textContent.split(Ge),u=d.length-1;if(u>0){s.textContent=nr?nr.emptyScript:"";for(let f=0;f<u;f++)s.append(d[f],Ys()),di.nextNode(),l.push({type:2,index:++n});s.append(d[u],Ys())}}}else if(s.nodeType===8)if(s.data===yh)l.push({type:2,index:n});else{let d=-1;for(;(d=s.data.indexOf(Ge,d+1))!==-1;)l.push({type:7,index:n}),d+=Ge.length-1}n++}}static createElement(e,t){const i=bi.createElement("template");return i.innerHTML=e,i}}function Xi(r,e,t=r,i){var s,n;if(e===Ii)return e;let o=i!==void 0?(s=t.o)==null?void 0:s[i]:t.l;const a=Ws(e)?void 0:e._$litDirective$;return(o==null?void 0:o.constructor)!==a&&((n=o==null?void 0:o._$AO)==null||n.call(o,!1),a===void 0?o=void 0:(o=new a(r),o._$AT(r,t,i)),i!==void 0?(t.o??(t.o=[]))[i]=o:t.l=o),o!==void 0&&(e=Xi(r,o._$AS(r,e.values),o,i)),e}class km{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:i}=this._$AD,s=((e==null?void 0:e.creationScope)??bi).importNode(t,!0);di.currentNode=s;let n=di.nextNode(),o=0,a=0,l=i[0];for(;l!==void 0;){if(o===l.index){let c;l.type===2?c=new sn(n,n.nextSibling,this,e):l.type===1?c=new l.ctor(n,l.name,l.strings,this,e):l.type===6&&(c=new Vm(n,this,e)),this._$AV.push(c),l=i[++a]}o!==(l==null?void 0:l.index)&&(n=di.nextNode(),o++)}return di.currentNode=bi,s}p(e){let t=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}}class sn{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this.v}constructor(e,t,i,s){this.type=2,this._$AH=Dt,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=s,this.v=(s==null?void 0:s.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Xi(this,e,t),Ws(e)?e===Dt||e==null||e===""?(this._$AH!==Dt&&this._$AR(),this._$AH=Dt):e!==this._$AH&&e!==Ii&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Mm(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==Dt&&Ws(this._$AH)?this._$AA.nextSibling.data=e:this.T(bi.createTextNode(e)),this._$AH=e}$(e){var t;const{values:i,_$litType$:s}=e,n=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=js.createElement(Th(s.h,s.h[0]),this.options)),s);if(((t=this._$AH)==null?void 0:t._$AD)===n)this._$AH.p(i);else{const o=new km(n,this),a=o.u(this.options);o.p(i),this.T(a),this._$AH=o}}_$AC(e){let t=Hl.get(e.strings);return t===void 0&&Hl.set(e.strings,t=new js(e)),t}k(e){va(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,s=0;for(const n of e)s===t.length?t.push(i=new sn(this.O(Ys()),this.O(Ys()),this,this.options)):i=t[s],i._$AI(n),s++;s<t.length&&(this._$AR(i&&i._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,t);e&&e!==this._$AB;){const s=e.nextSibling;e.remove(),e=s}}setConnected(e){var t;this._$AM===void 0&&(this.v=e,(t=this._$AP)==null||t.call(this,e))}}class $r{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,s,n){this.type=1,this._$AH=Dt,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=n,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=Dt}_$AI(e,t=this,i,s){const n=this.strings;let o=!1;if(n===void 0)e=Xi(this,e,t,0),o=!Ws(e)||e!==this._$AH&&e!==Ii,o&&(this._$AH=e);else{const a=e;let l,c;for(e=n[0],l=0;l<n.length-1;l++)c=Xi(this,a[i+l],t,l),c===Ii&&(c=this._$AH[l]),o||(o=!Ws(c)||c!==this._$AH[l]),c===Dt?e=Dt:e!==Dt&&(e+=(c??"")+n[l+1]),this._$AH[l]=c}o&&!s&&this.j(e)}j(e){e===Dt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class Bm extends $r{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Dt?void 0:e}}class zm extends $r{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Dt)}}class $m extends $r{constructor(e,t,i,s,n){super(e,t,i,s,n),this.type=5}_$AI(e,t=this){if((e=Xi(this,e,t,0)??Dt)===Ii)return;const i=this._$AH,s=e===Dt&&i!==Dt||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,n=e!==Dt&&(i===Dt||s);s&&this.element.removeEventListener(this.name,this,i),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}}class Vm{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){Xi(this,e)}}const Yl=sr.litHtmlPolyfillSupport;Yl==null||Yl(js,sn),(sr.litHtmlVersions??(sr.litHtmlVersions=[])).push("3.2.0");const Zi=(r,e,t)=>{const i=(t==null?void 0:t.renderBefore)??e;let s=i._$litPart$;if(s===void 0){const n=(t==null?void 0:t.renderBefore)??null;i._$litPart$=s=new sn(e.insertBefore(Ys(),n),n,void 0,t??{})}return s._$AI(r),s};/**
|
|
210
|
+
* @license
|
|
211
|
+
* Copyright 2017 Google LLC
|
|
212
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
213
|
+
*/let It=class extends Bi{constructor(){super(...arguments),this.renderOptions={host:this},this.o=void 0}createRenderRoot(){var e;const t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this.o=Zi(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this.o)==null||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this.o)==null||e.setConnected(!1)}render(){return Ii}};var Wl;It._$litElement$=!0,It.finalized=!0,(Wl=globalThis.litElementHydrateSupport)==null||Wl.call(globalThis,{LitElement:It});const jl=globalThis.litElementPolyfillSupport;jl==null||jl({LitElement:It});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.0");/**
|
|
214
|
+
* @license
|
|
215
|
+
* Copyright 2017 Google LLC
|
|
216
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
217
|
+
*/const Gm={attribute:!0,type:String,converter:ir,reflect:!1,hasChanged:Ta},Hm=(r=Gm,e,t)=>{const{kind:i,metadata:s}=t;let n=globalThis.litPropertyMetadata.get(s);if(n===void 0&&globalThis.litPropertyMetadata.set(s,n=new Map),n.set(t.name,r),i==="accessor"){const{name:o}=t;return{set(a){const l=e.get.call(this);e.set.call(this,a),this.requestUpdate(o,l,r)},init(a){return a!==void 0&&this.P(o,void 0,r),a}}}if(i==="setter"){const{name:o}=t;return function(a){const l=this[o];e.call(this,a),this.requestUpdate(o,l,r)}}throw Error("Unsupported decorator location: "+i)};function W(r){return(e,t)=>typeof t=="object"?Hm(r,e,t):((i,s,n)=>{const o=s.hasOwnProperty(n);return s.constructor.createProperty(n,o?{...i,wrapped:!0}:i),o?Object.getOwnPropertyDescriptor(s,n):void 0})(r,e,t)}/**
|
|
218
|
+
* @license
|
|
219
|
+
* Copyright 2017 Google LLC
|
|
220
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
221
|
+
*/function ts(r){return W({...r,state:!0,attribute:!1})}/**
|
|
222
|
+
* @license
|
|
223
|
+
* Copyright 2020 Google LLC
|
|
224
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
225
|
+
*/const Ym=r=>r.strings===void 0;/**
|
|
226
|
+
* @license
|
|
227
|
+
* Copyright 2017 Google LLC
|
|
228
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
229
|
+
*/const vh={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},wh=r=>(...e)=>({_$litDirective$:r,values:e});class Ah{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,i){this.t=e,this._$AM=t,this.i=i}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}/**
|
|
230
|
+
* @license
|
|
231
|
+
* Copyright 2017 Google LLC
|
|
232
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
233
|
+
*/const Ls=(r,e)=>{var t;const i=r._$AN;if(i===void 0)return!1;for(const s of i)(t=s._$AO)==null||t.call(s,e,!1),Ls(s,e);return!0},rr=r=>{let e,t;do{if((e=r._$AM)===void 0)break;t=e._$AN,t.delete(r),r=e}while((t==null?void 0:t.size)===0)},Rh=r=>{for(let e;e=r._$AM;r=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(r))break;t.add(r),Xm(e)}};function Wm(r){this._$AN!==void 0?(rr(this),this._$AM=r,Rh(this)):this._$AM=r}function jm(r,e=!1,t=0){const i=this._$AH,s=this._$AN;if(s!==void 0&&s.size!==0)if(e)if(Array.isArray(i))for(let n=t;n<i.length;n++)Ls(i[n],!1),rr(i[n]);else i!=null&&(Ls(i,!1),rr(i));else Ls(this,r)}const Xm=r=>{r.type==vh.CHILD&&(r._$AP??(r._$AP=jm),r._$AQ??(r._$AQ=Wm))};class Zm extends Ah{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,i){super._$AT(e,t,i),Rh(this),this.isConnected=e._$AU}_$AO(e,t=!0){var i,s;e!==this.isConnected&&(this.isConnected=e,e?(i=this.reconnected)==null||i.call(this):(s=this.disconnected)==null||s.call(this)),t&&(Ls(this,e),rr(this))}setValue(e){if(Ym(this.t))this.t._$AI(e,this);else{const t=[...this.t._$AH];t[this.i]=e,this.t._$AI(t,this,0)}}disconnected(){}reconnected(){}}/**
|
|
234
|
+
* @license
|
|
235
|
+
* Copyright 2020 Google LLC
|
|
236
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
237
|
+
*/const qi=()=>new qm;class qm{}const To=new WeakMap,we=wh(class extends Zm{render(r){return Dt}update(r,[e]){var t;const i=e!==this.Y;return i&&this.Y!==void 0&&this.rt(void 0),(i||this.lt!==this.ct)&&(this.Y=e,this.ht=(t=r.options)==null?void 0:t.host,this.rt(this.ct=r.element)),Dt}rt(r){if(this.isConnected||(r=void 0),typeof this.Y=="function"){const e=this.ht??globalThis;let t=To.get(e);t===void 0&&(t=new WeakMap,To.set(e,t)),t.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),t.set(this.Y,r),r!==void 0&&this.Y.call(this.ht,r)}else this.Y.value=r}get lt(){var r,e;return typeof this.Y=="function"?(r=To.get(this.ht??globalThis))==null?void 0:r.get(this.Y):(e=this.Y)==null?void 0:e.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});/**
|
|
238
|
+
* (c) Iconify
|
|
239
|
+
*
|
|
240
|
+
* For the full copyright and license information, please view the license.txt
|
|
241
|
+
* files at https://github.com/iconify/iconify
|
|
242
|
+
*
|
|
243
|
+
* Licensed under MIT.
|
|
244
|
+
*
|
|
245
|
+
* @license MIT
|
|
246
|
+
* @version 2.0.0
|
|
247
|
+
*/const Sh=Object.freeze({left:0,top:0,width:16,height:16}),or=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),nn=Object.freeze({...Sh,...or}),Xo=Object.freeze({...nn,body:"",hidden:!1}),Qm=Object.freeze({width:null,height:null}),Fh=Object.freeze({...Qm,...or});function Km(r,e=0){const t=r.replace(/^-?[0-9.]*/,"");function i(s){for(;s<0;)s+=4;return s%4}if(t===""){const s=parseInt(r);return isNaN(s)?0:i(s)}else if(t!==r){let s=0;switch(t){case"%":s=25;break;case"deg":s=90}if(s){let n=parseFloat(r.slice(0,r.length-t.length));return isNaN(n)?0:(n=n/s,n%1===0?i(n):0)}}return e}const Jm=/[\s,]+/;function tg(r,e){e.split(Jm).forEach(t=>{switch(t.trim()){case"horizontal":r.hFlip=!0;break;case"vertical":r.vFlip=!0;break}})}const Oh={...Fh,preserveAspectRatio:""};function Xl(r){const e={...Oh},t=(i,s)=>r.getAttribute(i)||s;return e.width=t("width",null),e.height=t("height",null),e.rotate=Km(t("rotate","")),tg(e,t("flip","")),e.preserveAspectRatio=t("preserveAspectRatio",t("preserveaspectratio","")),e}function eg(r,e){for(const t in Oh)if(r[t]!==e[t])return!0;return!1}const Ms=/^[a-z0-9]+(-[a-z0-9]+)*$/,rn=(r,e,t,i="")=>{const s=r.split(":");if(r.slice(0,1)==="@"){if(s.length<2||s.length>3)return null;i=s.shift().slice(1)}if(s.length>3||!s.length)return null;if(s.length>1){const a=s.pop(),l=s.pop(),c={provider:s.length>0?s[0]:i,prefix:l,name:a};return e&&!Yn(c)?null:c}const n=s[0],o=n.split("-");if(o.length>1){const a={provider:i,prefix:o.shift(),name:o.join("-")};return e&&!Yn(a)?null:a}if(t&&i===""){const a={provider:i,prefix:"",name:n};return e&&!Yn(a,t)?null:a}return null},Yn=(r,e)=>r?!!((r.provider===""||r.provider.match(Ms))&&(e&&r.prefix===""||r.prefix.match(Ms))&&r.name.match(Ms)):!1;function ig(r,e){const t={};!r.hFlip!=!e.hFlip&&(t.hFlip=!0),!r.vFlip!=!e.vFlip&&(t.vFlip=!0);const i=((r.rotate||0)+(e.rotate||0))%4;return i&&(t.rotate=i),t}function Zl(r,e){const t=ig(r,e);for(const i in Xo)i in or?i in r&&!(i in t)&&(t[i]=or[i]):i in e?t[i]=e[i]:i in r&&(t[i]=r[i]);return t}function sg(r,e){const t=r.icons,i=r.aliases||Object.create(null),s=Object.create(null);function n(o){if(t[o])return s[o]=[];if(!(o in s)){s[o]=null;const a=i[o]&&i[o].parent,l=a&&n(a);l&&(s[o]=[a].concat(l))}return s[o]}return Object.keys(t).concat(Object.keys(i)).forEach(n),s}function ng(r,e,t){const i=r.icons,s=r.aliases||Object.create(null);let n={};function o(a){n=Zl(i[a]||s[a],n)}return o(e),t.forEach(o),Zl(r,n)}function xh(r,e){const t=[];if(typeof r!="object"||typeof r.icons!="object")return t;r.not_found instanceof Array&&r.not_found.forEach(s=>{e(s,null),t.push(s)});const i=sg(r);for(const s in i){const n=i[s];n&&(e(s,ng(r,s,n)),t.push(s))}return t}const rg={provider:"",aliases:{},not_found:{},...Sh};function vo(r,e){for(const t in e)if(t in r&&typeof r[t]!=typeof e[t])return!1;return!0}function Nh(r){if(typeof r!="object"||r===null)return null;const e=r;if(typeof e.prefix!="string"||!r.icons||typeof r.icons!="object"||!vo(r,rg))return null;const t=e.icons;for(const s in t){const n=t[s];if(!s.match(Ms)||typeof n.body!="string"||!vo(n,Xo))return null}const i=e.aliases||Object.create(null);for(const s in i){const n=i[s],o=n.parent;if(!s.match(Ms)||typeof o!="string"||!t[o]&&!i[o]||!vo(n,Xo))return null}return e}const ar=Object.create(null);function og(r,e){return{provider:r,prefix:e,icons:Object.create(null),missing:new Set}}function Qe(r,e){const t=ar[r]||(ar[r]=Object.create(null));return t[e]||(t[e]=og(r,e))}function wa(r,e){return Nh(e)?xh(e,(t,i)=>{i?r.icons[t]=i:r.missing.add(t)}):[]}function ag(r,e,t){try{if(typeof t.body=="string")return r.icons[e]={...t},!0}catch{}return!1}function lg(r,e){let t=[];return(typeof r=="string"?[r]:Object.keys(ar)).forEach(i=>{(typeof i=="string"&&typeof e=="string"?[e]:Object.keys(ar[i]||{})).forEach(s=>{const n=Qe(i,s);t=t.concat(Object.keys(n.icons).map(o=>(i!==""?"@"+i+":":"")+s+":"+o))})}),t}let Xs=!1;function Ph(r){return typeof r=="boolean"&&(Xs=r),Xs}function Zs(r){const e=typeof r=="string"?rn(r,!0,Xs):r;if(e){const t=Qe(e.provider,e.prefix),i=e.name;return t.icons[i]||(t.missing.has(i)?null:void 0)}}function Lh(r,e){const t=rn(r,!0,Xs);if(!t)return!1;const i=Qe(t.provider,t.prefix);return ag(i,t.name,e)}function ql(r,e){if(typeof r!="object")return!1;if(typeof e!="string"&&(e=r.provider||""),Xs&&!e&&!r.prefix){let s=!1;return Nh(r)&&(r.prefix="",xh(r,(n,o)=>{o&&Lh(n,o)&&(s=!0)})),s}const t=r.prefix;if(!Yn({provider:e,prefix:t,name:"a"}))return!1;const i=Qe(e,t);return!!wa(i,r)}function Ql(r){return!!Zs(r)}function cg(r){const e=Zs(r);return e?{...nn,...e}:null}function hg(r){const e={loaded:[],missing:[],pending:[]},t=Object.create(null);r.sort((s,n)=>s.provider!==n.provider?s.provider.localeCompare(n.provider):s.prefix!==n.prefix?s.prefix.localeCompare(n.prefix):s.name.localeCompare(n.name));let i={provider:"",prefix:"",name:""};return r.forEach(s=>{if(i.name===s.name&&i.prefix===s.prefix&&i.provider===s.provider)return;i=s;const n=s.provider,o=s.prefix,a=s.name,l=t[n]||(t[n]=Object.create(null)),c=l[o]||(l[o]=Qe(n,o));let h;a in c.icons?h=e.loaded:o===""||c.missing.has(a)?h=e.missing:h=e.pending;const d={provider:n,prefix:o,name:a};h.push(d)}),e}function Mh(r,e){r.forEach(t=>{const i=t.loaderCallbacks;i&&(t.loaderCallbacks=i.filter(s=>s.id!==e))})}function dg(r){r.pendingCallbacksFlag||(r.pendingCallbacksFlag=!0,setTimeout(()=>{r.pendingCallbacksFlag=!1;const e=r.loaderCallbacks?r.loaderCallbacks.slice(0):[];if(!e.length)return;let t=!1;const i=r.provider,s=r.prefix;e.forEach(n=>{const o=n.icons,a=o.pending.length;o.pending=o.pending.filter(l=>{if(l.prefix!==s)return!0;const c=l.name;if(r.icons[c])o.loaded.push({provider:i,prefix:s,name:c});else if(r.missing.has(c))o.missing.push({provider:i,prefix:s,name:c});else return t=!0,!0;return!1}),o.pending.length!==a&&(t||Mh([r],n.id),n.callback(o.loaded.slice(0),o.missing.slice(0),o.pending.slice(0),n.abort))})}))}let ug=0;function fg(r,e,t){const i=ug++,s=Mh.bind(null,t,i);if(!e.pending.length)return s;const n={id:i,icons:e,callback:r,abort:s};return t.forEach(o=>{(o.loaderCallbacks||(o.loaderCallbacks=[])).push(n)}),s}const Zo=Object.create(null);function Kl(r,e){Zo[r]=e}function qo(r){return Zo[r]||Zo[""]}function pg(r,e=!0,t=!1){const i=[];return r.forEach(s=>{const n=typeof s=="string"?rn(s,e,t):s;n&&i.push(n)}),i}var mg={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function gg(r,e,t,i){const s=r.resources.length,n=r.random?Math.floor(Math.random()*s):r.index;let o;if(r.random){let A=r.resources.slice(0);for(o=[];A.length>1;){const S=Math.floor(Math.random()*A.length);o.push(A[S]),A=A.slice(0,S).concat(A.slice(S+1))}o=o.concat(A)}else o=r.resources.slice(n).concat(r.resources.slice(0,n));const a=Date.now();let l="pending",c=0,h,d=null,u=[],f=[];typeof i=="function"&&f.push(i);function p(){d&&(clearTimeout(d),d=null)}function m(){l==="pending"&&(l="aborted"),p(),u.forEach(A=>{A.status==="pending"&&(A.status="aborted")}),u=[]}function E(A,S){S&&(f=[]),typeof A=="function"&&f.push(A)}function g(){return{startTime:a,payload:e,status:l,queriesSent:c,queriesPending:u.length,subscribe:E,abort:m}}function I(){l="failed",f.forEach(A=>{A(void 0,h)})}function T(){u.forEach(A=>{A.status==="pending"&&(A.status="aborted")}),u=[]}function b(A,S,N){const R=S!=="success";switch(u=u.filter(P=>P!==A),l){case"pending":break;case"failed":if(R||!r.dataAfterTimeout)return;break;default:return}if(S==="abort"){h=N,I();return}if(R){h=N,u.length||(o.length?v():I());return}if(p(),T(),!r.random){const P=r.resources.indexOf(A.resource);P!==-1&&P!==r.index&&(r.index=P)}l="completed",f.forEach(P=>{P(N)})}function v(){if(l!=="pending")return;p();const A=o.shift();if(A===void 0){if(u.length){d=setTimeout(()=>{p(),l==="pending"&&(T(),I())},r.timeout);return}I();return}const S={status:"pending",resource:A,callback:(N,R)=>{b(S,N,R)}};u.push(S),c++,d=setTimeout(v,r.rotate),t(A,e,S.callback)}return setTimeout(v),g}function Dh(r){const e={...mg,...r};let t=[];function i(){t=t.filter(o=>o().status==="pending")}function s(o,a,l){const c=gg(e,o,a,(h,d)=>{i(),l&&l(h,d)});return t.push(c),c}function n(o){return t.find(a=>o(a))||null}return{query:s,find:n,setIndex:o=>{e.index=o},getIndex:()=>e.index,cleanup:i}}function Aa(r){let e;if(typeof r.resources=="string")e=[r.resources];else if(e=r.resources,!(e instanceof Array)||!e.length)return null;return{resources:e,path:r.path||"/",maxURL:r.maxURL||500,rotate:r.rotate||750,timeout:r.timeout||5e3,random:r.random===!0,index:r.index||0,dataAfterTimeout:r.dataAfterTimeout!==!1}}const Vr=Object.create(null),Bn=["https://api.simplesvg.com","https://api.unisvg.com"],Qo=[];for(;Bn.length>0;)Bn.length===1||Math.random()>.5?Qo.push(Bn.shift()):Qo.push(Bn.pop());Vr[""]=Aa({resources:["https://api.iconify.design"].concat(Qo)});function Jl(r,e){const t=Aa(e);return t===null?!1:(Vr[r]=t,!0)}function Gr(r){return Vr[r]}function Eg(){return Object.keys(Vr)}function tc(){}const wo=Object.create(null);function bg(r){if(!wo[r]){const e=Gr(r);if(!e)return;const t=Dh(e),i={config:e,redundancy:t};wo[r]=i}return wo[r]}function Uh(r,e,t){let i,s;if(typeof r=="string"){const n=qo(r);if(!n)return t(void 0,424),tc;s=n.send;const o=bg(r);o&&(i=o.redundancy)}else{const n=Aa(r);if(n){i=Dh(n);const o=r.resources?r.resources[0]:"",a=qo(o);a&&(s=a.send)}}return!i||!s?(t(void 0,424),tc):i.query(e,s,t)().abort}const ec="iconify2",qs="iconify",kh=qs+"-count",ic=qs+"-version",Bh=36e5,Ig=168,Cg=50;function Ko(r,e){try{return r.getItem(e)}catch{}}function Ra(r,e,t){try{return r.setItem(e,t),!0}catch{}}function sc(r,e){try{r.removeItem(e)}catch{}}function Jo(r,e){return Ra(r,kh,e.toString())}function ta(r){return parseInt(Ko(r,kh))||0}const fi={local:!0,session:!0},zh={local:new Set,session:new Set};let Sa=!1;function yg(r){Sa=r}let zn=typeof window>"u"?{}:window;function $h(r){const e=r+"Storage";try{if(zn&&zn[e]&&typeof zn[e].length=="number")return zn[e]}catch{}fi[r]=!1}function Vh(r,e){const t=$h(r);if(!t)return;const i=Ko(t,ic);if(i!==ec){if(i){const a=ta(t);for(let l=0;l<a;l++)sc(t,qs+l.toString())}Ra(t,ic,ec),Jo(t,0);return}const s=Math.floor(Date.now()/Bh)-Ig,n=a=>{const l=qs+a.toString(),c=Ko(t,l);if(typeof c=="string"){try{const h=JSON.parse(c);if(typeof h=="object"&&typeof h.cached=="number"&&h.cached>s&&typeof h.provider=="string"&&typeof h.data=="object"&&typeof h.data.prefix=="string"&&e(h,a))return!0}catch{}sc(t,l)}};let o=ta(t);for(let a=o-1;a>=0;a--)n(a)||(a===o-1?(o--,Jo(t,o)):zh[r].add(a))}function Gh(){if(!Sa){yg(!0);for(const r in fi)Vh(r,e=>{const t=e.data,i=e.provider,s=t.prefix,n=Qe(i,s);if(!wa(n,t).length)return!1;const o=t.lastModified||-1;return n.lastModifiedCached=n.lastModifiedCached?Math.min(n.lastModifiedCached,o):o,!0})}}function _g(r,e){const t=r.lastModifiedCached;if(t&&t>=e)return t===e;if(r.lastModifiedCached=e,t)for(const i in fi)Vh(i,s=>{const n=s.data;return s.provider!==r.provider||n.prefix!==r.prefix||n.lastModified===e});return!0}function Tg(r,e){Sa||Gh();function t(i){let s;if(!fi[i]||!(s=$h(i)))return;const n=zh[i];let o;if(n.size)n.delete(o=Array.from(n).shift());else if(o=ta(s),o>=Cg||!Jo(s,o+1))return;const a={cached:Math.floor(Date.now()/Bh),provider:r.provider,data:e};return Ra(s,qs+o.toString(),JSON.stringify(a))}e.lastModified&&!_g(r,e.lastModified)||Object.keys(e.icons).length&&(e.not_found&&(e=Object.assign({},e),delete e.not_found),t("local")||t("session"))}function nc(){}function vg(r){r.iconsLoaderFlag||(r.iconsLoaderFlag=!0,setTimeout(()=>{r.iconsLoaderFlag=!1,dg(r)}))}function wg(r,e){r.iconsToLoad?r.iconsToLoad=r.iconsToLoad.concat(e).sort():r.iconsToLoad=e,r.iconsQueueFlag||(r.iconsQueueFlag=!0,setTimeout(()=>{r.iconsQueueFlag=!1;const{provider:t,prefix:i}=r,s=r.iconsToLoad;delete r.iconsToLoad;let n;!s||!(n=qo(t))||n.prepare(t,i,s).forEach(o=>{Uh(t,o,a=>{if(typeof a!="object")o.icons.forEach(l=>{r.missing.add(l)});else try{const l=wa(r,a);if(!l.length)return;const c=r.pendingIcons;c&&l.forEach(h=>{c.delete(h)}),Tg(r,a)}catch(l){console.error(l)}vg(r)})})}))}const Fa=(r,e)=>{const t=pg(r,!0,Ph()),i=hg(t);if(!i.pending.length){let l=!0;return e&&setTimeout(()=>{l&&e(i.loaded,i.missing,i.pending,nc)}),()=>{l=!1}}const s=Object.create(null),n=[];let o,a;return i.pending.forEach(l=>{const{provider:c,prefix:h}=l;if(h===a&&c===o)return;o=c,a=h,n.push(Qe(c,h));const d=s[c]||(s[c]=Object.create(null));d[h]||(d[h]=[])}),i.pending.forEach(l=>{const{provider:c,prefix:h,name:d}=l,u=Qe(c,h),f=u.pendingIcons||(u.pendingIcons=new Set);f.has(d)||(f.add(d),s[c][h].push(d))}),n.forEach(l=>{const{provider:c,prefix:h}=l;s[c][h].length&&wg(l,s[c][h])}),e?fg(e,i,n):nc},Ag=r=>new Promise((e,t)=>{const i=typeof r=="string"?rn(r,!0):r;if(!i){t(r);return}Fa([i||r],s=>{if(s.length&&i){const n=Zs(i);if(n){e({...nn,...n});return}}t(r)})});function Rg(r){try{const e=typeof r=="string"?JSON.parse(r):r;if(typeof e.body=="string")return{...e}}catch{}}function Sg(r,e){const t=typeof r=="string"?rn(r,!0,!0):null;if(!t){const n=Rg(r);return{value:r,data:n}}const i=Zs(t);if(i!==void 0||!t.prefix)return{value:r,name:t,data:i};const s=Fa([t],()=>e(r,t,Zs(t)));return{value:r,name:t,loading:s}}function Ao(r){return r.hasAttribute("inline")}let Hh=!1;try{Hh=navigator.vendor.indexOf("Apple")===0}catch{}function Fg(r,e){switch(e){case"svg":case"bg":case"mask":return e}return e!=="style"&&(Hh||r.indexOf("<a")===-1)?"svg":r.indexOf("currentColor")===-1?"bg":"mask"}const Og=/(-?[0-9.]*[0-9]+[0-9.]*)/g,xg=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function ea(r,e,t){if(e===1)return r;if(t=t||100,typeof r=="number")return Math.ceil(r*e*t)/t;if(typeof r!="string")return r;const i=r.split(Og);if(i===null||!i.length)return r;const s=[];let n=i.shift(),o=xg.test(n);for(;;){if(o){const a=parseFloat(n);isNaN(a)?s.push(n):s.push(Math.ceil(a*e*t)/t)}else s.push(n);if(n=i.shift(),n===void 0)return s.join("");o=!o}}function Ng(r,e="defs"){let t="";const i=r.indexOf("<"+e);for(;i>=0;){const s=r.indexOf(">",i),n=r.indexOf("</"+e);if(s===-1||n===-1)break;const o=r.indexOf(">",n);if(o===-1)break;t+=r.slice(s+1,n).trim(),r=r.slice(0,i).trim()+r.slice(o+1)}return{defs:t,content:r}}function Pg(r,e){return r?"<defs>"+r+"</defs>"+e:e}function Lg(r,e,t){const i=Ng(r);return Pg(i.defs,e+i.content+t)}const Mg=r=>r==="unset"||r==="undefined"||r==="none";function Yh(r,e){const t={...nn,...r},i={...Fh,...e},s={left:t.left,top:t.top,width:t.width,height:t.height};let n=t.body;[t,i].forEach(m=>{const E=[],g=m.hFlip,I=m.vFlip;let T=m.rotate;g?I?T+=2:(E.push("translate("+(s.width+s.left).toString()+" "+(0-s.top).toString()+")"),E.push("scale(-1 1)"),s.top=s.left=0):I&&(E.push("translate("+(0-s.left).toString()+" "+(s.height+s.top).toString()+")"),E.push("scale(1 -1)"),s.top=s.left=0);let b;switch(T<0&&(T-=Math.floor(T/4)*4),T=T%4,T){case 1:b=s.height/2+s.top,E.unshift("rotate(90 "+b.toString()+" "+b.toString()+")");break;case 2:E.unshift("rotate(180 "+(s.width/2+s.left).toString()+" "+(s.height/2+s.top).toString()+")");break;case 3:b=s.width/2+s.left,E.unshift("rotate(-90 "+b.toString()+" "+b.toString()+")");break}T%2===1&&(s.left!==s.top&&(b=s.left,s.left=s.top,s.top=b),s.width!==s.height&&(b=s.width,s.width=s.height,s.height=b)),E.length&&(n=Lg(n,'<g transform="'+E.join(" ")+'">',"</g>"))});const o=i.width,a=i.height,l=s.width,c=s.height;let h,d;o===null?(d=a===null?"1em":a==="auto"?c:a,h=ea(d,l/c)):(h=o==="auto"?l:o,d=a===null?ea(h,c/l):a==="auto"?c:a);const u={},f=(m,E)=>{Mg(E)||(u[m]=E.toString())};f("width",h),f("height",d);const p=[s.left,s.top,l,c];return u.viewBox=p.join(" "),{attributes:u,viewBox:p,body:n}}function Oa(r,e){let t=r.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const i in e)t+=" "+i+'="'+e[i]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+t+">"+r+"</svg>"}function Dg(r){return r.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function Ug(r){return"data:image/svg+xml,"+Dg(r)}function Wh(r){return'url("'+Ug(r)+'")'}const kg=()=>{let r;try{if(r=fetch,typeof r=="function")return r}catch{}};let lr=kg();function Bg(r){lr=r}function zg(){return lr}function $g(r,e){const t=Gr(r);if(!t)return 0;let i;if(!t.maxURL)i=0;else{let s=0;t.resources.forEach(o=>{s=Math.max(s,o.length)});const n=e+".json?icons=";i=t.maxURL-s-t.path.length-n.length}return i}function Vg(r){return r===404}const Gg=(r,e,t)=>{const i=[],s=$g(r,e),n="icons";let o={type:n,provider:r,prefix:e,icons:[]},a=0;return t.forEach((l,c)=>{a+=l.length+1,a>=s&&c>0&&(i.push(o),o={type:n,provider:r,prefix:e,icons:[]},a=l.length),o.icons.push(l)}),i.push(o),i};function Hg(r){if(typeof r=="string"){const e=Gr(r);if(e)return e.path}return"/"}const Yg=(r,e,t)=>{if(!lr){t("abort",424);return}let i=Hg(e.provider);switch(e.type){case"icons":{const n=e.prefix,o=e.icons.join(","),a=new URLSearchParams({icons:o});i+=n+".json?"+a.toString();break}case"custom":{const n=e.uri;i+=n.slice(0,1)==="/"?n.slice(1):n;break}default:t("abort",400);return}let s=503;lr(r+i).then(n=>{const o=n.status;if(o!==200){setTimeout(()=>{t(Vg(o)?"abort":"next",o)});return}return s=501,n.json()}).then(n=>{if(typeof n!="object"||n===null){setTimeout(()=>{n===404?t("abort",n):t("next",s)});return}setTimeout(()=>{t("success",n)})}).catch(()=>{t("next",s)})},Wg={prepare:Gg,send:Yg};function rc(r,e){switch(r){case"local":case"session":fi[r]=e;break;case"all":for(const t in fi)fi[t]=e;break}}const Ro="data-style";let jh="";function jg(r){jh=r}function oc(r,e){let t=Array.from(r.childNodes).find(i=>i.hasAttribute&&i.hasAttribute(Ro));t||(t=document.createElement("style"),t.setAttribute(Ro,Ro),r.appendChild(t)),t.textContent=":host{display:inline-block;vertical-align:"+(e?"-0.125em":"0")+"}span,svg{display:block}"+jh}function Xh(){Kl("",Wg),Ph(!0);let r;try{r=window}catch{}if(r){if(Gh(),r.IconifyPreload!==void 0){const e=r.IconifyPreload,t="Invalid IconifyPreload syntax.";typeof e=="object"&&e!==null&&(e instanceof Array?e:[e]).forEach(i=>{try{(typeof i!="object"||i===null||i instanceof Array||typeof i.icons!="object"||typeof i.prefix!="string"||!ql(i))&&console.error(t)}catch{console.error(t)}})}if(r.IconifyProviders!==void 0){const e=r.IconifyProviders;if(typeof e=="object"&&e!==null)for(const t in e){const i="IconifyProviders["+t+"] is invalid.";try{const s=e[t];if(typeof s!="object"||!s||s.resources===void 0)continue;Jl(t,s)||console.error(i)}catch{console.error(i)}}}}return{enableCache:e=>rc(e,!0),disableCache:e=>rc(e,!1),iconLoaded:Ql,iconExists:Ql,getIcon:cg,listIcons:lg,addIcon:Lh,addCollection:ql,calculateSize:ea,buildIcon:Yh,iconToHTML:Oa,svgToURL:Wh,loadIcons:Fa,loadIcon:Ag,addAPIProvider:Jl,appendCustomStyle:jg,_api:{getAPIConfig:Gr,setAPIModule:Kl,sendAPIQuery:Uh,setFetch:Bg,getFetch:zg,listAPIProviders:Eg}}}const ia={"background-color":"currentColor"},Zh={"background-color":"transparent"},ac={image:"var(--svg)",repeat:"no-repeat",size:"100% 100%"},lc={"-webkit-mask":ia,mask:ia,background:Zh};for(const r in lc){const e=lc[r];for(const t in ac)e[r+"-"+t]=ac[t]}function cc(r){return r?r+(r.match(/^[-0-9.]+$/)?"px":""):"inherit"}function Xg(r,e,t){const i=document.createElement("span");let s=r.body;s.indexOf("<a")!==-1&&(s+="<!-- "+Date.now()+" -->");const n=r.attributes,o=Oa(s,{...n,width:e.width+"",height:e.height+""}),a=Wh(o),l=i.style,c={"--svg":a,width:cc(n.width),height:cc(n.height),...t?ia:Zh};for(const h in c)l.setProperty(h,c[h]);return i}let Ds;function Zg(){try{Ds=window.trustedTypes.createPolicy("iconify",{createHTML:r=>r})}catch{Ds=null}}function qg(r){return Ds===void 0&&Zg(),Ds?Ds.createHTML(r):r}function Qg(r){const e=document.createElement("span"),t=r.attributes;let i="";t.width||(i="width: inherit;"),t.height||(i+="height: inherit;"),i&&(t.style=i);const s=Oa(r.body,t);return e.innerHTML=qg(s),e.firstChild}function sa(r){return Array.from(r.childNodes).find(e=>{const t=e.tagName&&e.tagName.toUpperCase();return t==="SPAN"||t==="SVG"})}function hc(r,e){const t=e.icon.data,i=e.customisations,s=Yh(t,i);i.preserveAspectRatio&&(s.attributes.preserveAspectRatio=i.preserveAspectRatio);const n=e.renderedMode;let o;switch(n){case"svg":o=Qg(s);break;default:o=Xg(s,{...nn,...t},n==="mask")}const a=sa(r);a?o.tagName==="SPAN"&&a.tagName===o.tagName?a.setAttribute("style",o.getAttribute("style")):r.replaceChild(o,a):r.appendChild(o)}function dc(r,e,t){const i=t&&(t.rendered?t:t.lastRender);return{rendered:!1,inline:e,icon:r,lastRender:i}}function Kg(r="iconify-icon"){let e,t;try{e=window.customElements,t=window.HTMLElement}catch{return}if(!e||!t)return;const i=e.get(r);if(i)return i;const s=["icon","mode","inline","observe","width","height","rotate","flip"],n=class extends t{constructor(){super(),oi(this,"_shadowRoot"),oi(this,"_initialised",!1),oi(this,"_state"),oi(this,"_checkQueued",!1),oi(this,"_connected",!1),oi(this,"_observer",null),oi(this,"_visible",!0);const a=this._shadowRoot=this.attachShadow({mode:"open"}),l=Ao(this);oc(a,l),this._state=dc({value:""},l),this._queueCheck()}connectedCallback(){this._connected=!0,this.startObserver()}disconnectedCallback(){this._connected=!1,this.stopObserver()}static get observedAttributes(){return s.slice(0)}attributeChangedCallback(a){switch(a){case"inline":{const l=Ao(this),c=this._state;l!==c.inline&&(c.inline=l,oc(this._shadowRoot,l));break}case"observer":{this.observer?this.startObserver():this.stopObserver();break}default:this._queueCheck()}}get icon(){const a=this.getAttribute("icon");if(a&&a.slice(0,1)==="{")try{return JSON.parse(a)}catch{}return a}set icon(a){typeof a=="object"&&(a=JSON.stringify(a)),this.setAttribute("icon",a)}get inline(){return Ao(this)}set inline(a){a?this.setAttribute("inline","true"):this.removeAttribute("inline")}get observer(){return this.hasAttribute("observer")}set observer(a){a?this.setAttribute("observer","true"):this.removeAttribute("observer")}restartAnimation(){const a=this._state;if(a.rendered){const l=this._shadowRoot;if(a.renderedMode==="svg")try{l.lastChild.setCurrentTime(0);return}catch{}hc(l,a)}}get status(){const a=this._state;return a.rendered?"rendered":a.icon.data===null?"failed":"loading"}_queueCheck(){this._checkQueued||(this._checkQueued=!0,setTimeout(()=>{this._check()}))}_check(){if(!this._checkQueued)return;this._checkQueued=!1;const a=this._state,l=this.getAttribute("icon");if(l!==a.icon.value){this._iconChanged(l);return}if(!a.rendered||!this._visible)return;const c=this.getAttribute("mode"),h=Xl(this);(a.attrMode!==c||eg(a.customisations,h)||!sa(this._shadowRoot))&&this._renderIcon(a.icon,h,c)}_iconChanged(a){const l=Sg(a,(c,h,d)=>{const u=this._state;if(u.rendered||this.getAttribute("icon")!==c)return;const f={value:c,name:h,data:d};f.data?this._gotIconData(f):u.icon=f});l.data?this._gotIconData(l):this._state=dc(l,this._state.inline,this._state)}_forceRender(){if(!this._visible){const a=sa(this._shadowRoot);a&&this._shadowRoot.removeChild(a);return}this._queueCheck()}_gotIconData(a){this._checkQueued=!1,this._renderIcon(a,Xl(this),this.getAttribute("mode"))}_renderIcon(a,l,c){const h=Fg(a.data.body,c),d=this._state.inline;hc(this._shadowRoot,this._state={rendered:!0,icon:a,inline:d,customisations:l,attrMode:c,renderedMode:h})}startObserver(){if(!this._observer)try{this._observer=new IntersectionObserver(a=>{const l=a.some(c=>c.isIntersecting);l!==this._visible&&(this._visible=l,this._forceRender())}),this._observer.observe(this)}catch{if(this._observer){try{this._observer.disconnect()}catch{}this._observer=null}}}stopObserver(){this._observer&&(this._observer.disconnect(),this._observer=null,this._visible=!0,this._connected&&this._forceRender())}};s.forEach(a=>{a in n.prototype||Object.defineProperty(n.prototype,a,{get:function(){return this.getAttribute(a)},set:function(l){l!==null?this.setAttribute(a,l):this.removeAttribute(a)}})});const o=Xh();for(const a in o)n[a]=n.prototype[a]=o[a];return e.define(r,n),n}Kg()||Xh();var Jg=Object.defineProperty,t0=Object.getOwnPropertyDescriptor,me=(r,e,t,i)=>{for(var s=i>1?void 0:i?t0(e,t):e,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&Jg(e,t,s),s};const qh=class extends It{constructor(){super(),this.labelHidden=!1,this.active=!1,this.disabled=!1,this.vertical=!1,this.tooltipVisible=!1,this._stateBeforeLoading={disabled:!1,icon:""},this._loading=!1,this._parent=qi(),this._tooltip=qi(),this._mouseLeave=!1,this.onClick=e=>{e.stopPropagation(),this.disabled||this.dispatchEvent(new Event("click"))},this.showContextMenu=()=>{const e=this._contextMenu;e&&(e.visible=!0)},this.mouseLeave=!0}set loading(e){if(this._loading=e,e)this._stateBeforeLoading={disabled:this.disabled,icon:this.icon},this.disabled=e,this.icon="eos-icons:loading";else{const{disabled:t,icon:i}=this._stateBeforeLoading;this.disabled=t,this.icon=i}}get loading(){return this._loading}set mouseLeave(e){this._mouseLeave=e,e&&(this.tooltipVisible=!1,clearTimeout(this.timeoutID))}get mouseLeave(){return this._mouseLeave}computeTooltipPosition(){const{value:e}=this._parent,{value:t}=this._tooltip;e&&t&&bh(e,t,{placement:"bottom",middleware:[rh(10),Eh(),gh(),mh({padding:5})]}).then(i=>{const{x:s,y:n}=i;Object.assign(t.style,{left:`${s}px`,top:`${n}px`})})}onMouseEnter(){if(!(this.tooltipTitle||this.tooltipText))return;this.mouseLeave=!1;const e=this.tooltipTime??700;this.timeoutID=setTimeout(()=>{this.mouseLeave||(this.computeTooltipPosition(),this.tooltipVisible=!0)},e)}click(){this.disabled||super.click()}get _contextMenu(){return this.querySelector("bim-context-menu")}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.showContextMenu)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this.showContextMenu)}render(){const e=X`
|
|
248
|
+
<div ${we(this._tooltip)} class="tooltip">
|
|
249
|
+
${this.tooltipTitle?X`<p style="text-wrap: nowrap;">
|
|
250
|
+
<strong>${this.tooltipTitle}</strong>
|
|
251
|
+
</p>`:null}
|
|
252
|
+
${this.tooltipText?X`<p style="width: 9rem;">${this.tooltipText}</p>`:null}
|
|
253
|
+
</div>
|
|
254
|
+
`;return X`
|
|
255
|
+
<div ${we(this._parent)} class="parent" @click=${this.onClick}>
|
|
256
|
+
${this.label||this.icon?X`
|
|
257
|
+
<div
|
|
258
|
+
class="button"
|
|
259
|
+
@mouseenter=${this.onMouseEnter}
|
|
260
|
+
@mouseleave=${()=>this.mouseLeave=!0}
|
|
261
|
+
>
|
|
262
|
+
<bim-label
|
|
263
|
+
.icon=${this.icon}
|
|
264
|
+
.vertical=${this.vertical}
|
|
265
|
+
.labelHidden=${this.labelHidden}
|
|
266
|
+
>${this.label}</bim-label
|
|
267
|
+
>
|
|
268
|
+
</div>
|
|
269
|
+
`:null}
|
|
270
|
+
${this.tooltipTitle||this.tooltipText?e:null}
|
|
271
|
+
</div>
|
|
272
|
+
<slot></slot>
|
|
273
|
+
`}};qh.styles=yt`
|
|
274
|
+
:host {
|
|
275
|
+
--bim-label--c: var(--bim-ui_bg-contrast-100, white);
|
|
276
|
+
display: block;
|
|
277
|
+
flex: 1;
|
|
278
|
+
pointer-events: none;
|
|
279
|
+
background-color: var(--bim-button--bgc, var(--bim-ui_bg-contrast-20));
|
|
280
|
+
border-radius: var(--bim-ui_size-4xs);
|
|
281
|
+
transition: all 0.15s;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
:host(:not([disabled]):hover) {
|
|
285
|
+
cursor: pointer;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
bim-label {
|
|
289
|
+
pointer-events: none;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.parent {
|
|
293
|
+
--bim-icon--c: var(--bim-label--c);
|
|
294
|
+
position: relative;
|
|
295
|
+
display: flex;
|
|
296
|
+
height: 100%;
|
|
297
|
+
user-select: none;
|
|
298
|
+
row-gap: 0.125rem;
|
|
299
|
+
min-height: var(--bim-ui_size-5xl);
|
|
300
|
+
min-width: var(--bim-ui_size-5xl);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.button,
|
|
304
|
+
.children {
|
|
305
|
+
box-sizing: border-box;
|
|
306
|
+
display: flex;
|
|
307
|
+
align-items: center;
|
|
308
|
+
justify-content: center;
|
|
309
|
+
pointer-events: auto;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
.children {
|
|
313
|
+
padding: 0 0.375rem;
|
|
314
|
+
position: absolute;
|
|
315
|
+
height: 100%;
|
|
316
|
+
right: 0;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
:host(:not([label-hidden])[icon][vertical]) .parent {
|
|
320
|
+
min-height: 2.5rem;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.button {
|
|
324
|
+
flex-grow: 1;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
:host(:not([label-hidden])[label]) .button {
|
|
328
|
+
justify-content: var(--bim-button--jc, center);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
:host(:hover),
|
|
332
|
+
:host([active]) {
|
|
333
|
+
--bim-label--c: var(--bim-ui_main-contrast);
|
|
334
|
+
background-color: var(--bim-ui_main-base);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
:host(:not([label]):not([icon])) .children {
|
|
338
|
+
flex: 1;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
:host([vertical]) .parent {
|
|
342
|
+
justify-content: center;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
:host(:not([label-hidden])[label]) .button {
|
|
346
|
+
padding: 0 0.5rem;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
:host([disabled]) {
|
|
350
|
+
--bim-label--c: var(--bim-ui_bg-contrast-80);
|
|
351
|
+
background-color: gray;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
::slotted(bim-button) {
|
|
355
|
+
--bim-icon--fz: var(--bim-ui_size-base);
|
|
356
|
+
--bim-button--bdrs: var(--bim-ui_size-4xs);
|
|
357
|
+
--bim-button--olw: 0;
|
|
358
|
+
--bim-button--olc: transparent;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
.tooltip {
|
|
362
|
+
position: absolute;
|
|
363
|
+
padding: 0.75rem;
|
|
364
|
+
z-index: 99;
|
|
365
|
+
display: flex;
|
|
366
|
+
flex-flow: column;
|
|
367
|
+
row-gap: 0.375rem;
|
|
368
|
+
box-shadow: 0 0 10px 3px rgba(0 0 0 / 20%);
|
|
369
|
+
outline: 1px solid var(--bim-ui_bg-contrast-40);
|
|
370
|
+
font-size: var(--bim-ui_size-xs);
|
|
371
|
+
border-radius: var(--bim-ui_size-4xs);
|
|
372
|
+
background-color: var(--bim-ui_bg-contrast-20);
|
|
373
|
+
color: var(--bim-ui_bg-contrast-100);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
.tooltip p {
|
|
377
|
+
margin: 0;
|
|
378
|
+
padding: 0;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
:host(:not([tooltip-visible])) .tooltip {
|
|
382
|
+
display: none;
|
|
383
|
+
}
|
|
384
|
+
`;let ae=qh;me([W({type:String,reflect:!0})],ae.prototype,"label",2);me([W({type:Boolean,attribute:"label-hidden",reflect:!0})],ae.prototype,"labelHidden",2);me([W({type:Boolean,reflect:!0})],ae.prototype,"active",2);me([W({type:Boolean,reflect:!0,attribute:"disabled"})],ae.prototype,"disabled",2);me([W({type:String,reflect:!0})],ae.prototype,"icon",2);me([W({type:Boolean,reflect:!0})],ae.prototype,"vertical",2);me([W({type:Number,attribute:"tooltip-time",reflect:!0})],ae.prototype,"tooltipTime",2);me([W({type:Boolean,attribute:"tooltip-visible",reflect:!0})],ae.prototype,"tooltipVisible",2);me([W({type:String,attribute:"tooltip-title",reflect:!0})],ae.prototype,"tooltipTitle",2);me([W({type:String,attribute:"tooltip-text",reflect:!0})],ae.prototype,"tooltipText",2);me([W({type:Boolean,reflect:!0})],ae.prototype,"loading",1);var e0=Object.defineProperty,on=(r,e,t,i)=>{for(var s=void 0,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=o(e,t,s)||s);return s&&e0(e,t,s),s};const Qh=class extends It{constructor(){super(...arguments),this.checked=!1,this.inverted=!1,this.onValueChange=new Event("change")}get value(){return this.checked}onChange(e){e.stopPropagation(),this.checked=e.target.checked,this.dispatchEvent(this.onValueChange)}render(){return X`
|
|
385
|
+
<div class="parent">
|
|
386
|
+
${this.label?X`<bim-label .icon="${this.icon}">${this.label}</bim-label> `:null}
|
|
387
|
+
<input
|
|
388
|
+
type="checkbox"
|
|
389
|
+
aria-label=${this.label||this.name||"Checkbox Input"}
|
|
390
|
+
@change="${this.onChange}"
|
|
391
|
+
.checked="${this.checked}"
|
|
392
|
+
/>
|
|
393
|
+
</div>
|
|
394
|
+
`}};Qh.styles=yt`
|
|
395
|
+
:host {
|
|
396
|
+
display: block;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
.parent {
|
|
400
|
+
display: flex;
|
|
401
|
+
justify-content: space-between;
|
|
402
|
+
height: 1.75rem;
|
|
403
|
+
column-gap: 0.25rem;
|
|
404
|
+
width: 100%;
|
|
405
|
+
align-items: center;
|
|
406
|
+
transition: all 0.15s;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
:host([inverted]) .parent {
|
|
410
|
+
flex-direction: row-reverse;
|
|
411
|
+
justify-content: start;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
input {
|
|
415
|
+
height: 1rem;
|
|
416
|
+
width: 1rem;
|
|
417
|
+
cursor: pointer;
|
|
418
|
+
border: none;
|
|
419
|
+
outline: none;
|
|
420
|
+
accent-color: var(--bim-checkbox--c, var(--bim-ui_main-base));
|
|
421
|
+
transition: all 0.15s;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
input:focus {
|
|
425
|
+
outline: var(--bim-checkbox--olw, 2px) solid
|
|
426
|
+
var(--bim-checkbox--olc, var(--bim-ui_accent-base));
|
|
427
|
+
}
|
|
428
|
+
`;let es=Qh;on([W({type:String,reflect:!0})],es.prototype,"icon");on([W({type:String,reflect:!0})],es.prototype,"name");on([W({type:String,reflect:!0})],es.prototype,"label");on([W({type:Boolean,reflect:!0})],es.prototype,"checked");on([W({type:Boolean,reflect:!0})],es.prototype,"inverted");var i0=Object.defineProperty,is=(r,e,t,i)=>{for(var s=void 0,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=o(e,t,s)||s);return s&&i0(e,t,s),s};const Kh=class extends It{constructor(){super(...arguments),this.vertical=!1,this.color="#bcf124",this._colorInput=qi(),this._textInput=qi(),this.onValueChange=new Event("input"),this.onOpacityInput=e=>{const t=e.target;this.opacity=t.value,this.dispatchEvent(this.onValueChange)}}set value(e){const{color:t,opacity:i}=e;this.color=t,i&&(this.opacity=i)}get value(){const e={color:this.color};return this.opacity&&(e.opacity=this.opacity),e}onColorInput(e){e.stopPropagation();const{value:t}=this._colorInput;t&&(this.color=t.value,this.dispatchEvent(this.onValueChange))}onTextInput(e){e.stopPropagation();const{value:t}=this._textInput;if(!t)return;const{value:i}=t;let s=i.replace(/[^a-fA-F0-9]/g,"");s.startsWith("#")||(s=`#${s}`),t.value=s.slice(0,7),t.value.length===7&&(this.color=t.value,this.dispatchEvent(this.onValueChange))}focus(){const{value:e}=this._colorInput;e&&e.click()}render(){return X`
|
|
429
|
+
<div class="parent">
|
|
430
|
+
<bim-input
|
|
431
|
+
.label=${this.label}
|
|
432
|
+
.icon=${this.icon}
|
|
433
|
+
.vertical="${this.vertical}"
|
|
434
|
+
>
|
|
435
|
+
<div class="color-container">
|
|
436
|
+
<div
|
|
437
|
+
style="display: flex; align-items: center; gap: .375rem; height: 100%; flex: 1; padding: 0 0.5rem;"
|
|
438
|
+
>
|
|
439
|
+
<input
|
|
440
|
+
${we(this._colorInput)}
|
|
441
|
+
@input="${this.onColorInput}"
|
|
442
|
+
type="color"
|
|
443
|
+
aria-label=${this.label||this.name||"Color Input"}
|
|
444
|
+
value="${this.color}"
|
|
445
|
+
/>
|
|
446
|
+
<div
|
|
447
|
+
@click=${this.focus}
|
|
448
|
+
class="sample"
|
|
449
|
+
style="background-color: ${this.color}"
|
|
450
|
+
></div>
|
|
451
|
+
<input
|
|
452
|
+
${we(this._textInput)}
|
|
453
|
+
@input="${this.onTextInput}"
|
|
454
|
+
value="${this.color}"
|
|
455
|
+
type="text"
|
|
456
|
+
aria-label=${this.label||this.name||"Text Color Input"}
|
|
457
|
+
/>
|
|
458
|
+
</div>
|
|
459
|
+
${this.opacity!==void 0?X`<bim-number-input
|
|
460
|
+
@change=${this.onOpacityInput}
|
|
461
|
+
slider
|
|
462
|
+
suffix="%"
|
|
463
|
+
min="0"
|
|
464
|
+
value=${this.opacity}
|
|
465
|
+
max="100"
|
|
466
|
+
></bim-number-input>`:null}
|
|
467
|
+
</div>
|
|
468
|
+
</bim-input>
|
|
469
|
+
</div>
|
|
470
|
+
`}};Kh.styles=yt`
|
|
471
|
+
:host {
|
|
472
|
+
--bim-input--bgc: var(--bim-ui_bg-contrast-20);
|
|
473
|
+
flex: 1;
|
|
474
|
+
display: block;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
:host(:focus) {
|
|
478
|
+
--bim-input--olw: var(--bim-number-input--olw, 2px);
|
|
479
|
+
--bim-input--olc: var(--bim-ui_accent-base);
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
.parent {
|
|
483
|
+
display: flex;
|
|
484
|
+
gap: 0.375rem;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
.color-container {
|
|
488
|
+
position: relative;
|
|
489
|
+
outline: none;
|
|
490
|
+
display: flex;
|
|
491
|
+
height: 100%;
|
|
492
|
+
gap: 0.5rem;
|
|
493
|
+
justify-content: flex-start;
|
|
494
|
+
align-items: center;
|
|
495
|
+
flex: 1;
|
|
496
|
+
border-radius: var(--bim-color-input--bdrs, var(--bim-ui_size-4xs));
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
.color-container input[type="color"] {
|
|
500
|
+
position: absolute;
|
|
501
|
+
bottom: -0.25rem;
|
|
502
|
+
visibility: hidden;
|
|
503
|
+
width: 0;
|
|
504
|
+
height: 0;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
.color-container .sample {
|
|
508
|
+
width: 1rem;
|
|
509
|
+
height: 1rem;
|
|
510
|
+
border-radius: 0.125rem;
|
|
511
|
+
background-color: #fff;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
.color-container input[type="text"] {
|
|
515
|
+
height: 100%;
|
|
516
|
+
flex: 1;
|
|
517
|
+
width: 3.25rem;
|
|
518
|
+
text-transform: uppercase;
|
|
519
|
+
font-size: 0.75rem;
|
|
520
|
+
background-color: transparent;
|
|
521
|
+
padding: 0%;
|
|
522
|
+
outline: none;
|
|
523
|
+
border: none;
|
|
524
|
+
color: var(--bim-color-input--c, var(--bim-ui_bg-contrast-100));
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
bim-number-input {
|
|
528
|
+
flex-grow: 0;
|
|
529
|
+
}
|
|
530
|
+
`;let yi=Kh;is([W({type:String,reflect:!0})],yi.prototype,"name");is([W({type:String,reflect:!0})],yi.prototype,"label");is([W({type:String,reflect:!0})],yi.prototype,"icon");is([W({type:Boolean,reflect:!0})],yi.prototype,"vertical");is([W({type:Number,reflect:!0})],yi.prototype,"opacity");is([W({type:String,reflect:!0})],yi.prototype,"color");const s0=yt`
|
|
531
|
+
::-webkit-scrollbar {
|
|
532
|
+
width: 0.4rem;
|
|
533
|
+
height: 0.4rem;
|
|
534
|
+
overflow: hidden;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
::-webkit-scrollbar-thumb {
|
|
538
|
+
border-radius: 0.25rem;
|
|
539
|
+
background-color: var(
|
|
540
|
+
--bim-scrollbar--c,
|
|
541
|
+
color-mix(in lab, var(--bim-ui_main-base), white 15%)
|
|
542
|
+
);
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
::-webkit-scrollbar-track {
|
|
546
|
+
background-color: var(--bim-scrollbar--bgc, var(--bim-ui_bg-base));
|
|
547
|
+
}
|
|
548
|
+
`,n0=yt`
|
|
549
|
+
:root {
|
|
550
|
+
/* Grayscale Colors */
|
|
551
|
+
--bim-ui_gray-0: hsl(210 10% 5%);
|
|
552
|
+
--bim-ui_gray-1: hsl(210 10% 10%);
|
|
553
|
+
--bim-ui_gray-2: hsl(210 10% 20%);
|
|
554
|
+
--bim-ui_gray-3: hsl(210 10% 30%);
|
|
555
|
+
--bim-ui_gray-4: hsl(210 10% 40%);
|
|
556
|
+
--bim-ui_gray-6: hsl(210 10% 60%);
|
|
557
|
+
--bim-ui_gray-7: hsl(210 10% 70%);
|
|
558
|
+
--bim-ui_gray-8: hsl(210 10% 80%);
|
|
559
|
+
--bim-ui_gray-9: hsl(210 10% 90%);
|
|
560
|
+
--bim-ui_gray-10: hsl(210 10% 95%);
|
|
561
|
+
|
|
562
|
+
/* Brand Colors */
|
|
563
|
+
--bim-ui_main-base: #6528d7;
|
|
564
|
+
--bim-ui_accent-base: #bcf124;
|
|
565
|
+
|
|
566
|
+
/* Brand Colors Contrasts */
|
|
567
|
+
--bim-ui_main-contrast: var(--bim-ui_gray-10);
|
|
568
|
+
--bim-ui_accent-contrast: var(--bim-ui_gray-0);
|
|
569
|
+
|
|
570
|
+
/* Sizes */
|
|
571
|
+
--bim-ui_size-4xs: 0.375rem;
|
|
572
|
+
--bim-ui_size-3xs: 0.5rem;
|
|
573
|
+
--bim-ui_size-2xs: 0.625rem;
|
|
574
|
+
--bim-ui_size-xs: 0.75rem;
|
|
575
|
+
--bim-ui_size-sm: 0.875rem;
|
|
576
|
+
--bim-ui_size-base: 1rem;
|
|
577
|
+
--bim-ui_size-lg: 1.125rem;
|
|
578
|
+
--bim-ui_size-xl: 1.25rem;
|
|
579
|
+
--bim-ui_size-2xl: 1.375rem;
|
|
580
|
+
--bim-ui_size-3xl: 1.5rem;
|
|
581
|
+
--bim-ui_size-4xl: 1.625rem;
|
|
582
|
+
--bim-ui_size-5xl: 1.75rem;
|
|
583
|
+
--bim-ui_size-6xl: 1.875rem;
|
|
584
|
+
--bim-ui_size-7xl: 2rem;
|
|
585
|
+
--bim-ui_size-8xl: 2.125rem;
|
|
586
|
+
--bim-ui_size-9xl: 2.25rem;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
/* Background Colors */
|
|
590
|
+
@media (prefers-color-scheme: dark) {
|
|
591
|
+
:root {
|
|
592
|
+
--bim-ui_bg-base: var(--bim-ui_gray-0);
|
|
593
|
+
--bim-ui_bg-contrast-10: var(--bim-ui_gray-1);
|
|
594
|
+
--bim-ui_bg-contrast-20: var(--bim-ui_gray-2);
|
|
595
|
+
--bim-ui_bg-contrast-30: var(--bim-ui_gray-3);
|
|
596
|
+
--bim-ui_bg-contrast-40: var(--bim-ui_gray-4);
|
|
597
|
+
--bim-ui_bg-contrast-60: var(--bim-ui_gray-6);
|
|
598
|
+
--bim-ui_bg-contrast-80: var(--bim-ui_gray-8);
|
|
599
|
+
--bim-ui_bg-contrast-100: var(--bim-ui_gray-10);
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
@media (prefers-color-scheme: light) {
|
|
604
|
+
:root {
|
|
605
|
+
--bim-ui_bg-base: var(--bim-ui_gray-10);
|
|
606
|
+
--bim-ui_bg-contrast-10: var(--bim-ui_gray-9);
|
|
607
|
+
--bim-ui_bg-contrast-20: var(--bim-ui_gray-8);
|
|
608
|
+
--bim-ui_bg-contrast-30: var(--bim-ui_gray-7);
|
|
609
|
+
--bim-ui_bg-contrast-40: var(--bim-ui_gray-6);
|
|
610
|
+
--bim-ui_bg-contrast-60: var(--bim-ui_gray-4);
|
|
611
|
+
--bim-ui_bg-contrast-80: var(--bim-ui_gray-2);
|
|
612
|
+
--bim-ui_bg-contrast-100: var(--bim-ui_gray-0);
|
|
613
|
+
--bim-ui_accent-base: #6528d7;
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
html.bim-ui-dark {
|
|
618
|
+
--bim-ui_bg-base: var(--bim-ui_gray-0);
|
|
619
|
+
--bim-ui_bg-contrast-10: var(--bim-ui_gray-1);
|
|
620
|
+
--bim-ui_bg-contrast-20: var(--bim-ui_gray-2);
|
|
621
|
+
--bim-ui_bg-contrast-30: var(--bim-ui_gray-3);
|
|
622
|
+
--bim-ui_bg-contrast-40: var(--bim-ui_gray-4);
|
|
623
|
+
--bim-ui_bg-contrast-60: var(--bim-ui_gray-6);
|
|
624
|
+
--bim-ui_bg-contrast-80: var(--bim-ui_gray-8);
|
|
625
|
+
--bim-ui_bg-contrast-100: var(--bim-ui_gray-10);
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
html.bim-ui-light {
|
|
629
|
+
--bim-ui_bg-base: var(--bim-ui_gray-10);
|
|
630
|
+
--bim-ui_bg-contrast-10: var(--bim-ui_gray-9);
|
|
631
|
+
--bim-ui_bg-contrast-20: var(--bim-ui_gray-8);
|
|
632
|
+
--bim-ui_bg-contrast-30: var(--bim-ui_gray-7);
|
|
633
|
+
--bim-ui_bg-contrast-40: var(--bim-ui_gray-6);
|
|
634
|
+
--bim-ui_bg-contrast-60: var(--bim-ui_gray-4);
|
|
635
|
+
--bim-ui_bg-contrast-80: var(--bim-ui_gray-2);
|
|
636
|
+
--bim-ui_bg-contrast-100: var(--bim-ui_gray-0);
|
|
637
|
+
--bim-ui_accent-base: #6528d7;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
[data-context-dialog]::backdrop {
|
|
641
|
+
background-color: transparent;
|
|
642
|
+
}
|
|
643
|
+
`,ti={scrollbar:s0,globalStyles:n0},Jh=class Et{static set config(e){this._config={...Et._config,...e}}static get config(){return Et._config}static addGlobalStyles(){let e=document.querySelector("style[id='bim-ui']");if(e)return;e=document.createElement("style"),e.id="bim-ui",e.textContent=ti.globalStyles.cssText;const t=document.head.firstChild;t?document.head.insertBefore(e,t):document.head.append(e)}static defineCustomElement(e,t){customElements.get(e)||customElements.define(e,t)}static registerComponents(){Et.init()}static init(){Et.addGlobalStyles(),Et.defineCustomElement("bim-button",ae),Et.defineCustomElement("bim-checkbox",es),Et.defineCustomElement("bim-color-input",yi),Et.defineCustomElement("bim-context-menu",l0),Et.defineCustomElement("bim-dropdown",De),Et.defineCustomElement("bim-grid",Na),Et.defineCustomElement("bim-icon",m0),Et.defineCustomElement("bim-input",an),Et.defineCustomElement("bim-label",ss),Et.defineCustomElement("bim-number-input",Qt),Et.defineCustomElement("bim-option",zt),Et.defineCustomElement("bim-panel",_i),Et.defineCustomElement("bim-panel-section",ns),Et.defineCustomElement("bim-selector",rs),Et.defineCustomElement("bim-table",ce),Et.defineCustomElement("bim-tabs",vi),Et.defineCustomElement("bim-tab",ee),Et.defineCustomElement("bim-table-cell",ud),Et.defineCustomElement("bim-table-children",pd),Et.defineCustomElement("bim-table-group",gd),Et.defineCustomElement("bim-table-row",Ti),Et.defineCustomElement("bim-text-input",Re),Et.defineCustomElement("bim-toolbar",Zr),Et.defineCustomElement("bim-toolbar-group",jr),Et.defineCustomElement("bim-toolbar-section",ls),Et.defineCustomElement("bim-viewport",Rd)}static newRandomId(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let t="";for(let i=0;i<10;i++){const s=Math.floor(Math.random()*e.length);t+=e.charAt(s)}return t}};Jh._config={sectionLabelOnVerticalToolbar:!1};let r0=Jh;class Ae extends It{constructor(){super(...arguments),this._lazyLoadObserver=null,this._visibleElements=[],this.ELEMENTS_BEFORE_OBSERVER=20,this.useObserver=!1,this.elements=new Set,this.observe=e=>{if(!this.useObserver)return;for(const i of e)this.elements.add(i);const t=e.slice(this.ELEMENTS_BEFORE_OBSERVER);for(const i of t)i.remove();this.observeLastElement()}}set visibleElements(e){this._visibleElements=this.useObserver?e:[],this.requestUpdate()}get visibleElements(){return this._visibleElements}getLazyObserver(){if(!this.useObserver)return null;if(this._lazyLoadObserver)return this._lazyLoadObserver;const e=new IntersectionObserver(t=>{const i=t[0];if(!i.isIntersecting)return;const s=i.target;e.unobserve(s);const n=this.ELEMENTS_BEFORE_OBSERVER+this.visibleElements.length,o=[...this.elements][n];o&&(this.visibleElements=[...this.visibleElements,o],e.observe(o))},{threshold:.5});return e}observeLastElement(){const e=this.getLazyObserver();if(!e)return;const t=this.ELEMENTS_BEFORE_OBSERVER+this.visibleElements.length-1,i=[...this.elements][t];i&&e.observe(i)}resetVisibleElements(){const e=this.getLazyObserver();if(e){for(const t of this.elements)e.unobserve(t);this.visibleElements=[],this.observeLastElement()}}static create(e,t){const i=document.createDocumentFragment();if(e.length===0)return Zi(e(),i),i.firstElementChild;if(!t)throw new Error("UIComponent: Initial state is required for statefull components.");let s=t;const n=e,o=l=>(s={...s,...l},Zi(n(s),i),s);o(t);const a=()=>s;return[i.firstElementChild,o,a]}}var o0=Object.defineProperty,a0=Object.getOwnPropertyDescriptor,td=(r,e,t,i)=>{for(var s=a0(e,t),n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=o(e,t,s)||s);return s&&o0(e,t,s),s},kt;const xa=(kt=class extends It{constructor(){super(...arguments),this._previousContainer=null,this._visible=!1}get placement(){return this._placement}set placement(r){this._placement=r,this.updatePosition()}static removeMenus(){for(const r of kt.menus)r instanceof kt&&(r.visible=!1);kt.dialog.close(),kt.dialog.remove()}get visible(){return this._visible}set visible(r){var e;this._visible=r,r?(kt.dialog.parentElement||document.body.append(kt.dialog),this._previousContainer=this.parentElement,kt.dialog.style.top=`${window.scrollY||document.documentElement.scrollTop}px`,kt.dialog.append(this),kt.dialog.showModal(),this.updatePosition(),this.dispatchEvent(new Event("visible"))):((e=this._previousContainer)==null||e.append(this),this._previousContainer=null,this.dispatchEvent(new Event("hidden")))}async updatePosition(){if(!(this.visible&&this._previousContainer))return;const r=this.placement??"right",e=await bh(this._previousContainer,this,{placement:r,middleware:[rh(10),Eh(),gh(),mh({padding:5})]}),{x:t,y:i}=e;this.style.left=`${t}px`,this.style.top=`${i}px`}connectedCallback(){super.connectedCallback(),kt.menus.push(this)}render(){return X` <slot></slot> `}},kt.styles=[ti.scrollbar,yt`
|
|
644
|
+
:host {
|
|
645
|
+
pointer-events: auto;
|
|
646
|
+
position: absolute;
|
|
647
|
+
top: 0;
|
|
648
|
+
left: 0;
|
|
649
|
+
z-index: 999;
|
|
650
|
+
overflow: auto;
|
|
651
|
+
max-height: 20rem;
|
|
652
|
+
min-width: 3rem;
|
|
653
|
+
flex-direction: column;
|
|
654
|
+
box-shadow: 1px 2px 8px 2px rgba(0, 0, 0, 0.15);
|
|
655
|
+
padding: 0.5rem;
|
|
656
|
+
border-radius: var(--bim-ui_size-4xs);
|
|
657
|
+
display: flex;
|
|
658
|
+
background-color: var(
|
|
659
|
+
--bim-context-menu--bgc,
|
|
660
|
+
var(--bim-ui_bg-contrast-20)
|
|
661
|
+
);
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
:host(:not([visible])) {
|
|
665
|
+
display: none;
|
|
666
|
+
}
|
|
667
|
+
`],kt.dialog=Ae.create(()=>X` <dialog
|
|
668
|
+
@click=${r=>{r.target===kt.dialog&&kt.removeMenus()}}
|
|
669
|
+
@cancel=${()=>kt.removeMenus()}
|
|
670
|
+
data-context-dialog
|
|
671
|
+
style="
|
|
672
|
+
width: 0;
|
|
673
|
+
height: 0;
|
|
674
|
+
position: relative;
|
|
675
|
+
padding: 0;
|
|
676
|
+
border: none;
|
|
677
|
+
outline: none;
|
|
678
|
+
margin: none;
|
|
679
|
+
overflow: visible;
|
|
680
|
+
background-color: transparent;
|
|
681
|
+
"
|
|
682
|
+
></dialog>`),kt.menus=[],kt);td([W({type:String,reflect:!0})],xa.prototype,"placement");td([W({type:Boolean,reflect:!0})],xa.prototype,"visible");let l0=xa;const cr=(r,e={},t=!0)=>{let i={};for(const s of r.children){const n=s,o=n.getAttribute("name")||n.getAttribute("label"),a=e[o];if(o){if("value"in n&&typeof n.value<"u"&&n.value!==null){const l=n.value;if(typeof l=="object"&&!Array.isArray(l)&&Object.keys(l).length===0)continue;i[o]=a?a(n.value):n.value}else if(t){const l=cr(n,e);if(Object.keys(l).length===0)continue;i[o]=a?a(l):l}}else t&&(i={...i,...cr(n,e)})}return i},Hr=r=>r==="true"||r==="false"?r==="true":r&&!isNaN(Number(r))&&r.trim()!==""?Number(r):r,c0=[">=","<=","=",">","<","?","/","#"];function uc(r){const e=c0.find(o=>r.split(o).length===2),t=r.split(e).map(o=>o.trim()),[i,s]=t,n=s.startsWith("'")&&s.endsWith("'")?s.replace(/'/g,""):Hr(s);return{key:i,condition:e,value:n}}const na=r=>{try{const e=[],t=r.split(/&(?![^()]*\))/).map(i=>i.trim());for(const i of t){const s=!i.startsWith("(")&&!i.endsWith(")"),n=i.startsWith("(")&&i.endsWith(")");if(s){const o=uc(i);e.push(o)}if(n){const o={operator:"&",queries:i.replace(/^(\()|(\))$/g,"").split("&").map(a=>a.trim()).map((a,l)=>{const c=uc(a);return l>0&&(c.operator="&"),c})};e.push(o)}}return e}catch{return null}},fc=(r,e,t)=>{let i=!1;switch(e){case"=":i=r===t;break;case"?":i=String(r).includes(String(t));break;case"<":(typeof r=="number"||typeof t=="number")&&(i=r<t);break;case"<=":(typeof r=="number"||typeof t=="number")&&(i=r<=t);break;case">":(typeof r=="number"||typeof t=="number")&&(i=r>t);break;case">=":(typeof r=="number"||typeof t=="number")&&(i=r>=t);break;case"/":i=String(r).startsWith(String(t));break}return i};var h0=Object.defineProperty,d0=Object.getOwnPropertyDescriptor,ei=(r,e,t,i)=>{for(var s=i>1?void 0:i?d0(e,t):e,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&h0(e,t,s),s};const ed=class extends It{constructor(){super(...arguments),this.checked=!1,this.checkbox=!1,this.noMark=!1,this.vertical=!1}get value(){return this._value!==void 0?this._value:this.label?Hr(this.label):this.label}set value(e){this._value=e}render(){return X`
|
|
683
|
+
<div class="parent" .title=${this.label??""}>
|
|
684
|
+
${this.img||this.icon||this.label?X` <div style="display: flex; column-gap: 0.375rem">
|
|
685
|
+
${this.checkbox&&!this.noMark?X`<bim-checkbox
|
|
686
|
+
style="pointer-events: none"
|
|
687
|
+
.checked=${this.checked}
|
|
688
|
+
></bim-checkbox>`:null}
|
|
689
|
+
<bim-label
|
|
690
|
+
.vertical=${this.vertical}
|
|
691
|
+
.icon=${this.icon}
|
|
692
|
+
.img=${this.img}
|
|
693
|
+
>${this.label}</bim-label
|
|
694
|
+
>
|
|
695
|
+
</div>`:null}
|
|
696
|
+
${!this.checkbox&&!this.noMark&&this.checked?X`<svg
|
|
697
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
698
|
+
height="1.125rem"
|
|
699
|
+
viewBox="0 0 24 24"
|
|
700
|
+
width="1.125rem"
|
|
701
|
+
fill="#FFFFFF"
|
|
702
|
+
>
|
|
703
|
+
<path d="M0 0h24v24H0z" fill="none" />
|
|
704
|
+
<path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z" />
|
|
705
|
+
</svg>`:null}
|
|
706
|
+
<slot></slot>
|
|
707
|
+
</div>
|
|
708
|
+
`}};ed.styles=yt`
|
|
709
|
+
:host {
|
|
710
|
+
--bim-label--c: var(--bim-ui_bg-contrast-100);
|
|
711
|
+
display: block;
|
|
712
|
+
box-sizing: border-box;
|
|
713
|
+
flex: 1;
|
|
714
|
+
padding: 0rem 0.5rem;
|
|
715
|
+
border-radius: var(--bim-ui_size-4xs);
|
|
716
|
+
transition: all 0.15s;
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
:host(:hover) {
|
|
720
|
+
cursor: pointer;
|
|
721
|
+
background-color: color-mix(
|
|
722
|
+
in lab,
|
|
723
|
+
var(--bim-selector--bgc, var(--bim-ui_bg-contrast-20)),
|
|
724
|
+
var(--bim-ui_main-base) 10%
|
|
725
|
+
);
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
:host([checked]) {
|
|
729
|
+
--bim-label--c: color-mix(in lab, var(--bim-ui_main-base), white 30%);
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
:host([checked]) svg {
|
|
733
|
+
fill: color-mix(in lab, var(--bim-ui_main-base), white 30%);
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
.parent {
|
|
737
|
+
box-sizing: border-box;
|
|
738
|
+
display: flex;
|
|
739
|
+
justify-content: var(--bim-option--jc, space-between);
|
|
740
|
+
column-gap: 0.5rem;
|
|
741
|
+
align-items: center;
|
|
742
|
+
min-height: 1.75rem;
|
|
743
|
+
height: 100%;
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
input {
|
|
747
|
+
height: 1rem;
|
|
748
|
+
width: 1rem;
|
|
749
|
+
cursor: pointer;
|
|
750
|
+
border: none;
|
|
751
|
+
outline: none;
|
|
752
|
+
accent-color: var(--bim-checkbox--c, var(--bim-ui_main-base));
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
input:focus {
|
|
756
|
+
outline: var(--bim-checkbox--olw, 2px) solid
|
|
757
|
+
var(--bim-checkbox--olc, var(--bim-ui_accent-base));
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
bim-label {
|
|
761
|
+
pointer-events: none;
|
|
762
|
+
}
|
|
763
|
+
`;let zt=ed;ei([W({type:String,reflect:!0})],zt.prototype,"img",2);ei([W({type:String,reflect:!0})],zt.prototype,"label",2);ei([W({type:String,reflect:!0})],zt.prototype,"icon",2);ei([W({type:Boolean,reflect:!0})],zt.prototype,"checked",2);ei([W({type:Boolean,reflect:!0})],zt.prototype,"checkbox",2);ei([W({type:Boolean,attribute:"no-mark",reflect:!0})],zt.prototype,"noMark",2);ei([W({converter:{fromAttribute(r){return r&&Hr(r)}}})],zt.prototype,"value",1);ei([W({type:Boolean,reflect:!0})],zt.prototype,"vertical",2);var u0=Object.defineProperty,f0=Object.getOwnPropertyDescriptor,ii=(r,e,t,i)=>{for(var s=i>1?void 0:i?f0(e,t):e,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&u0(e,t,s),s};const id=class extends Ae{constructor(){super(),this.multiple=!1,this.required=!1,this.vertical=!1,this._visible=!1,this._value=new Set,this.onValueChange=new Event("change"),this._contextMenu=qi(),this.onOptionClick=e=>{const t=e.target,i=this._value.has(t);if(!this.multiple&&!this.required&&!i)this._value=new Set([t]);else if(!this.multiple&&!this.required&&i)this._value=new Set([]);else if(!this.multiple&&this.required&&!i)this._value=new Set([t]);else if(this.multiple&&!this.required&&!i)this._value=new Set([...this._value,t]);else if(this.multiple&&!this.required&&i){const s=[...this._value].filter(n=>n!==t);this._value=new Set(s)}else if(this.multiple&&this.required&&!i)this._value=new Set([...this._value,t]);else if(this.multiple&&this.required&&i){const s=[...this._value].filter(o=>o!==t),n=new Set(s);n.size!==0&&(this._value=n)}this.updateOptionsState(),this.dispatchEvent(this.onValueChange)},this.useObserver=!0}set visible(e){if(e){const{value:t}=this._contextMenu;if(!t)return;for(const i of this.elements)t.append(i);this._visible=!0}else{for(const t of this.elements)this.append(t);this._visible=!1,this.resetVisibleElements()}}get visible(){return this._visible}set value(e){if(this.required&&Object.keys(e).length===0)return;const t=new Set;for(const i of e){const s=this.findOption(i);if(s&&(t.add(s),!this.multiple&&Object.keys(e).length===1))break}this._value=t,this.updateOptionsState(),this.dispatchEvent(this.onValueChange)}get value(){return[...this._value].filter(e=>e instanceof zt&&e.checked).map(e=>e.value)}get _options(){const e=new Set([...this.elements]);for(const t of this.children)t instanceof zt&&e.add(t);return[...e]}onSlotChange(e){const t=e.target.assignedElements();this.observe(t);const i=new Set;for(const s of this.elements){if(!(s instanceof zt)){s.remove();continue}s.checked&&i.add(s),s.removeEventListener("click",this.onOptionClick),s.addEventListener("click",this.onOptionClick)}this._value=i}updateOptionsState(){for(const e of this._options)e instanceof zt&&(e.checked=this._value.has(e))}findOption(e){return this._options.find(t=>t instanceof zt?t.label===e||t.value===e:!1)}render(){let e,t,i;if(this._value.size===0)e="Select an option...";else if(this._value.size===1){const s=[...this._value][0];e=(s==null?void 0:s.label)||(s==null?void 0:s.value),t=s==null?void 0:s.img,i=s==null?void 0:s.icon}else e=`Multiple (${this._value.size})`;return X`
|
|
764
|
+
<bim-input
|
|
765
|
+
title=${this.label??""}
|
|
766
|
+
.label=${this.label}
|
|
767
|
+
.icon=${this.icon}
|
|
768
|
+
.vertical=${this.vertical}
|
|
769
|
+
>
|
|
770
|
+
<div class="input" @click=${()=>this.visible=!this.visible}>
|
|
771
|
+
<bim-label
|
|
772
|
+
.img=${t}
|
|
773
|
+
.icon=${i}
|
|
774
|
+
style="overflow: hidden;"
|
|
775
|
+
>${e}</bim-label
|
|
776
|
+
>
|
|
777
|
+
<svg
|
|
778
|
+
style="flex-shrink: 0; fill: var(--bim-dropdown--c, var(--bim-ui_bg-contrast-100))"
|
|
779
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
780
|
+
height="1.125rem"
|
|
781
|
+
viewBox="0 0 24 24"
|
|
782
|
+
width="1.125rem"
|
|
783
|
+
fill="#9ca3af"
|
|
784
|
+
>
|
|
785
|
+
<path d="M0 0h24v24H0V0z" fill="none" />
|
|
786
|
+
<path d="M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z" />
|
|
787
|
+
</svg>
|
|
788
|
+
<bim-context-menu
|
|
789
|
+
${we(this._contextMenu)}
|
|
790
|
+
.visible=${this.visible}
|
|
791
|
+
@hidden=${()=>{this.visible&&(this.visible=!1)}}
|
|
792
|
+
>
|
|
793
|
+
<slot @slotchange=${this.onSlotChange}></slot>
|
|
794
|
+
</bim-context-menu>
|
|
795
|
+
</div>
|
|
796
|
+
</bim-input>
|
|
797
|
+
`}};id.styles=[ti.scrollbar,yt`
|
|
798
|
+
:host {
|
|
799
|
+
--bim-input--bgc: var(
|
|
800
|
+
--bim-dropdown--bgc,
|
|
801
|
+
var(--bim-ui_bg-contrast-20)
|
|
802
|
+
);
|
|
803
|
+
--bim-input--olw: 2px;
|
|
804
|
+
--bim-input--olc: transparent;
|
|
805
|
+
--bim-input--bdrs: var(--bim-ui_size-4xs);
|
|
806
|
+
flex: 1;
|
|
807
|
+
display: block;
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
:host([visible]) {
|
|
811
|
+
--bim-input--olc: var(--bim-ui_accent-base);
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
.input {
|
|
815
|
+
--bim-label--fz: var(--bim-drodown--fz, var(--bim-ui_size-xs));
|
|
816
|
+
--bim-label--c: var(--bim-dropdown--c, var(--bim-ui_bg-contrast-100));
|
|
817
|
+
height: 100%;
|
|
818
|
+
display: flex;
|
|
819
|
+
flex: 1;
|
|
820
|
+
overflow: hidden;
|
|
821
|
+
column-gap: 0.25rem;
|
|
822
|
+
outline: none;
|
|
823
|
+
cursor: pointer;
|
|
824
|
+
align-items: center;
|
|
825
|
+
justify-content: space-between;
|
|
826
|
+
padding: 0 0.5rem;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
bim-label {
|
|
830
|
+
pointer-events: none;
|
|
831
|
+
}
|
|
832
|
+
`];let De=id;ii([W({type:String,reflect:!0})],De.prototype,"name",2);ii([W({type:String,reflect:!0})],De.prototype,"icon",2);ii([W({type:String,reflect:!0})],De.prototype,"label",2);ii([W({type:Boolean,reflect:!0})],De.prototype,"multiple",2);ii([W({type:Boolean,reflect:!0})],De.prototype,"required",2);ii([W({type:Boolean,reflect:!0})],De.prototype,"vertical",2);ii([W({type:Boolean,reflect:!0})],De.prototype,"visible",1);ii([ts()],De.prototype,"_value",2);var p0=Object.defineProperty,sd=(r,e,t,i)=>{for(var s=void 0,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=o(e,t,s)||s);return s&&p0(e,t,s),s};const nd=class extends It{constructor(){super(...arguments),this.floating=!1,this.layouts={}}getUniqueAreasFromTemplate(e){const t=e.split(`
|
|
833
|
+
`).map(i=>i.trim()).map(i=>i.split('"')[1]).filter(i=>i!==void 0).flatMap(i=>i.split(/\s+/));return[...new Set(t)].filter(i=>i!=="")}firstUpdated(){this._onLayoutChange=new Event("layoutchange")}render(){if(this.layout){if(this.layouts[this.layout]){this.innerHTML="";const e=this.layouts[this.layout],t=this.getUniqueAreasFromTemplate(e.template).map(i=>{const s=e.elements[i];return s&&(s.style.gridArea=i),s}).filter(i=>!!i);this.style.gridTemplate=e.template,this._onLayoutChange&&this.dispatchEvent(this._onLayoutChange),this.append(...t)}}else this.innerHTML="",this.style.gridTemplate="",this._onLayoutChange&&this.dispatchEvent(this._onLayoutChange);return X`<slot></slot>`}};nd.styles=yt`
|
|
834
|
+
:host {
|
|
835
|
+
display: grid;
|
|
836
|
+
height: 100%;
|
|
837
|
+
width: 100%;
|
|
838
|
+
overflow: hidden;
|
|
839
|
+
box-sizing: border-box;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
/* :host(:not([layout])) {
|
|
843
|
+
display: none;
|
|
844
|
+
} */
|
|
845
|
+
|
|
846
|
+
:host([floating]) {
|
|
847
|
+
--bim-panel--bdrs: var(--bim-ui_size-4xs);
|
|
848
|
+
background-color: transparent;
|
|
849
|
+
padding: 1rem;
|
|
850
|
+
gap: 1rem;
|
|
851
|
+
position: absolute;
|
|
852
|
+
pointer-events: none;
|
|
853
|
+
top: 0px;
|
|
854
|
+
left: 0px;
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
:host(:not([floating])) {
|
|
858
|
+
--bim-panel--bdrs: 0;
|
|
859
|
+
background-color: var(--bim-ui_bg-contrast-20);
|
|
860
|
+
gap: 1px;
|
|
861
|
+
}
|
|
862
|
+
`;let Na=nd;sd([W({type:Boolean,reflect:!0})],Na.prototype,"floating");sd([W({type:String,reflect:!0})],Na.prototype,"layout");const ra=class extends It{render(){return X`
|
|
863
|
+
<iconify-icon .icon=${this.icon} height="none"></iconify-icon>
|
|
864
|
+
`}};ra.styles=yt`
|
|
865
|
+
:host {
|
|
866
|
+
height: var(--bim-icon--fz, var(--bim-ui_size-sm));
|
|
867
|
+
width: var(--bim-icon--fz, var(--bim-ui_size-sm));
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
iconify-icon {
|
|
871
|
+
height: var(--bim-icon--fz, var(--bim-ui_size-sm));
|
|
872
|
+
width: var(--bim-icon--fz, var(--bim-ui_size-sm));
|
|
873
|
+
color: var(--bim-icon--c);
|
|
874
|
+
transition: all 0.15s;
|
|
875
|
+
}
|
|
876
|
+
`,ra.properties={icon:{type:String}};let m0=ra;var g0=Object.defineProperty,Yr=(r,e,t,i)=>{for(var s=void 0,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=o(e,t,s)||s);return s&&g0(e,t,s),s};const rd=class extends It{constructor(){super(...arguments),this.vertical=!1,this.onValueChange=new Event("change")}get value(){const e={};for(const t of this.children){const i=t;"value"in i?e[i.name||i.label]=i.value:"checked"in i&&(e[i.name||i.label]=i.checked)}return e}set value(e){const t=[...this.children];for(const i in e){const s=t.find(a=>{const l=a;return l.name===i||l.label===i});if(!s)continue;const n=s,o=e[i];typeof o=="boolean"?n.checked=o:n.value=o}}render(){return X`
|
|
877
|
+
<div class="parent">
|
|
878
|
+
${this.label||this.icon?X`<bim-label .icon=${this.icon}>${this.label}</bim-label>`:null}
|
|
879
|
+
<div class="input">
|
|
880
|
+
<slot></slot>
|
|
881
|
+
</div>
|
|
882
|
+
</div>
|
|
883
|
+
`}};rd.styles=yt`
|
|
884
|
+
:host {
|
|
885
|
+
flex: 1;
|
|
886
|
+
display: block;
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
.parent {
|
|
890
|
+
display: flex;
|
|
891
|
+
flex-wrap: wrap;
|
|
892
|
+
column-gap: 1rem;
|
|
893
|
+
row-gap: 0.375rem;
|
|
894
|
+
user-select: none;
|
|
895
|
+
flex: 1;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
:host(:not([vertical])) .parent {
|
|
899
|
+
justify-content: space-between;
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
:host([vertical]) .parent {
|
|
903
|
+
flex-direction: column;
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
.input {
|
|
907
|
+
overflow: hidden;
|
|
908
|
+
box-sizing: border-box;
|
|
909
|
+
display: flex;
|
|
910
|
+
align-items: center;
|
|
911
|
+
flex-wrap: wrap;
|
|
912
|
+
min-height: 1.75rem;
|
|
913
|
+
min-width: 3rem;
|
|
914
|
+
gap: var(--bim-input--g, var(--bim-ui_size-4xs));
|
|
915
|
+
padding: var(--bim-input--p, 0);
|
|
916
|
+
background-color: var(--bim-input--bgc, transparent);
|
|
917
|
+
outline: var(--bim-input--olw, 2px) solid
|
|
918
|
+
var(--bim-input--olc, transparent);
|
|
919
|
+
border-radius: var(--bim-input--bdrs, var(--bim-ui_size-4xs));
|
|
920
|
+
transition: all 0.15s;
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
:host(:not([vertical])) .input {
|
|
924
|
+
flex: 1;
|
|
925
|
+
justify-content: flex-end;
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
:host(:not([vertical])[label]) .input {
|
|
929
|
+
max-width: fit-content;
|
|
930
|
+
}
|
|
931
|
+
`;let an=rd;Yr([W({type:String,reflect:!0})],an.prototype,"name");Yr([W({type:String,reflect:!0})],an.prototype,"label");Yr([W({type:String,reflect:!0})],an.prototype,"icon");Yr([W({type:Boolean,reflect:!0})],an.prototype,"vertical");var E0=Object.defineProperty,ln=(r,e,t,i)=>{for(var s=void 0,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=o(e,t,s)||s);return s&&E0(e,t,s),s};const od=class extends It{constructor(){super(...arguments),this.labelHidden=!1,this.iconHidden=!1,this.vertical=!1}get value(){return this.textContent?Hr(this.textContent):this.textContent}render(){return X`
|
|
932
|
+
<div class="parent" .title=${this.textContent??""}>
|
|
933
|
+
${this.img?X`<img .src=${this.img} .alt=${this.textContent||""} />`:null}
|
|
934
|
+
${!this.iconHidden&&this.icon?X`<bim-icon .icon=${this.icon}></bim-icon>`:null}
|
|
935
|
+
<p><slot></slot></p>
|
|
936
|
+
</div>
|
|
937
|
+
`}};od.styles=yt`
|
|
938
|
+
:host {
|
|
939
|
+
--bim-icon--c: var(--bim-label--c);
|
|
940
|
+
color: var(--bim-label--c, var(--bim-ui_bg-contrast-60));
|
|
941
|
+
font-size: var(--bim-label--fz, var(--bim-ui_size-xs));
|
|
942
|
+
overflow: hidden;
|
|
943
|
+
display: block;
|
|
944
|
+
white-space: nowrap;
|
|
945
|
+
line-height: 1.1rem;
|
|
946
|
+
transition: all 0.15s;
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
.parent {
|
|
950
|
+
display: flex;
|
|
951
|
+
align-items: center;
|
|
952
|
+
column-gap: 0.25rem;
|
|
953
|
+
row-gap: 0.125rem;
|
|
954
|
+
user-select: none;
|
|
955
|
+
height: 100%;
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
:host([vertical]) .parent {
|
|
959
|
+
flex-direction: column;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
.parent p {
|
|
963
|
+
margin: 0;
|
|
964
|
+
text-overflow: ellipsis;
|
|
965
|
+
overflow: hidden;
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
:host([label-hidden]) .parent p,
|
|
969
|
+
:host(:empty) .parent p {
|
|
970
|
+
display: none;
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
img {
|
|
974
|
+
height: 100%;
|
|
975
|
+
aspect-ratio: 1;
|
|
976
|
+
border-radius: 100%;
|
|
977
|
+
margin-right: 0.125rem;
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
:host(:not([vertical])) img {
|
|
981
|
+
max-height: var(
|
|
982
|
+
--bim-label_icon--sz,
|
|
983
|
+
calc(var(--bim-label--fz, var(--bim-ui_size-xs)) * 1.8)
|
|
984
|
+
);
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
:host([vertical]) img {
|
|
988
|
+
max-height: var(
|
|
989
|
+
--bim-label_icon--sz,
|
|
990
|
+
calc(var(--bim-label--fz, var(--bim-ui_size-xs)) * 4)
|
|
991
|
+
);
|
|
992
|
+
}
|
|
993
|
+
`;let ss=od;ln([W({type:String,reflect:!0})],ss.prototype,"img");ln([W({type:Boolean,attribute:"label-hidden",reflect:!0})],ss.prototype,"labelHidden");ln([W({type:String,reflect:!0})],ss.prototype,"icon");ln([W({type:Boolean,attribute:"icon-hidden",reflect:!0})],ss.prototype,"iconHidden");ln([W({type:Boolean,reflect:!0})],ss.prototype,"vertical");var b0=Object.defineProperty,I0=Object.getOwnPropertyDescriptor,le=(r,e,t,i)=>{for(var s=i>1?void 0:i?I0(e,t):e,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&b0(e,t,s),s};const ad=class extends It{constructor(){super(...arguments),this._value=0,this.vertical=!1,this.slider=!1,this._input=qi(),this.onValueChange=new Event("change")}set value(e){this.setValue(e.toString())}get value(){return this._value}onChange(e){e.stopPropagation();const{value:t}=this._input;t&&this.setValue(t.value)}setValue(e){const{value:t}=this._input;let i=e;if(i=i.replace(/[^0-9.-]/g,""),i=i.replace(/(\..*)\./g,"$1"),i.endsWith(".")||(i.lastIndexOf("-")>0&&(i=i[0]+i.substring(1).replace(/-/g,"")),i==="-"||i==="-0"))return;let s=Number(i);Number.isNaN(s)||(s=this.min!==void 0?Math.max(s,this.min):s,s=this.max!==void 0?Math.min(s,this.max):s,this.value!==s&&(this._value=s,t&&(t.value=this.value.toString()),this.requestUpdate(),this.dispatchEvent(this.onValueChange)))}onBlur(){const{value:e}=this._input;e&&Number.isNaN(Number(e.value))&&(e.value=this.value.toString())}onSliderMouseDown(e){document.body.style.cursor="w-resize";const{clientX:t}=e,i=this.value;let s=!1;const n=l=>{var c;s=!0;const{clientX:h}=l,d=this.step??1,u=((c=d.toString().split(".")[1])==null?void 0:c.length)||0,f=1/(this.sensitivity??1),p=(h-t)/f;if(Math.floor(Math.abs(p))!==Math.abs(p))return;const m=i+p*d;this.setValue(m.toFixed(u))},o=()=>{this.slider=!0,this.removeEventListener("blur",o)},a=()=>{document.removeEventListener("mousemove",n),document.body.style.cursor="default",s?s=!1:(this.addEventListener("blur",o),this.slider=!1,requestAnimationFrame(()=>this.focus())),document.removeEventListener("mouseup",a)};document.addEventListener("mousemove",n),document.addEventListener("mouseup",a)}onFocus(e){e.stopPropagation();const t=i=>{i.key==="Escape"&&(this.blur(),window.removeEventListener("keydown",t))};window.addEventListener("keydown",t)}connectedCallback(){super.connectedCallback(),this.min&&this.min>this.value&&(this._value=this.min),this.max&&this.max<this.value&&(this._value=this.max)}focus(){const{value:e}=this._input;e&&e.focus()}render(){const e=X`
|
|
994
|
+
${this.pref||this.icon?X`<bim-label
|
|
995
|
+
style="pointer-events: auto"
|
|
996
|
+
@mousedown=${this.onSliderMouseDown}
|
|
997
|
+
.icon=${this.icon}
|
|
998
|
+
>${this.pref}</bim-label
|
|
999
|
+
>`:null}
|
|
1000
|
+
<input
|
|
1001
|
+
${we(this._input)}
|
|
1002
|
+
type="text"
|
|
1003
|
+
aria-label=${this.label||this.name||"Number Input"}
|
|
1004
|
+
size="1"
|
|
1005
|
+
@input=${a=>a.stopPropagation()}
|
|
1006
|
+
@change=${this.onChange}
|
|
1007
|
+
@blur=${this.onBlur}
|
|
1008
|
+
@focus=${this.onFocus}
|
|
1009
|
+
.value=${this.value.toString()}
|
|
1010
|
+
/>
|
|
1011
|
+
${this.suffix?X`<bim-label
|
|
1012
|
+
style="pointer-events: auto"
|
|
1013
|
+
@mousedown=${this.onSliderMouseDown}
|
|
1014
|
+
>${this.suffix}</bim-label
|
|
1015
|
+
>`:null}
|
|
1016
|
+
`,t=this.min??-1/0,i=this.max??1/0,s=100*(this.value-t)/(i-t),n=X`
|
|
1017
|
+
<style>
|
|
1018
|
+
.slider-indicator {
|
|
1019
|
+
width: ${`${s}%`};
|
|
1020
|
+
}
|
|
1021
|
+
</style>
|
|
1022
|
+
<div class="slider" @mousedown=${this.onSliderMouseDown}>
|
|
1023
|
+
<div class="slider-indicator"></div>
|
|
1024
|
+
${this.pref||this.icon?X`<bim-label
|
|
1025
|
+
style="z-index: 1; margin-right: 0.125rem"
|
|
1026
|
+
.icon=${this.icon}
|
|
1027
|
+
>${`${this.pref}: `}</bim-label
|
|
1028
|
+
>`:null}
|
|
1029
|
+
<bim-label style="z-index: 1;">${this.value}</bim-label>
|
|
1030
|
+
${this.suffix?X`<bim-label style="z-index: 1;">${this.suffix}</bim-label>`:null}
|
|
1031
|
+
</div>
|
|
1032
|
+
`,o=`${this.label||this.name||this.pref?`${this.label||this.name||this.pref}: `:""}${this.value}${this.suffix??""}`;return X`
|
|
1033
|
+
<bim-input
|
|
1034
|
+
title=${o}
|
|
1035
|
+
.label=${this.label}
|
|
1036
|
+
.icon=${this.icon}
|
|
1037
|
+
.vertical=${this.vertical}
|
|
1038
|
+
>
|
|
1039
|
+
${this.slider?n:e}
|
|
1040
|
+
</bim-input>
|
|
1041
|
+
`}};ad.styles=yt`
|
|
1042
|
+
:host {
|
|
1043
|
+
--bim-input--bgc: var(
|
|
1044
|
+
--bim-number-input--bgc,
|
|
1045
|
+
var(--bim-ui_bg-contrast-20)
|
|
1046
|
+
);
|
|
1047
|
+
--bim-input--olw: var(--bim-number-input--olw, 2px);
|
|
1048
|
+
--bim-input--olc: var(--bim-number-input--olc, transparent);
|
|
1049
|
+
--bim-input--bdrs: var(--bim-number-input--bdrs, var(--bim-ui_size-4xs));
|
|
1050
|
+
--bim-input--p: 0 0.375rem;
|
|
1051
|
+
flex: 1;
|
|
1052
|
+
display: block;
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
:host(:focus) {
|
|
1056
|
+
--bim-input--olw: var(--bim-number-input--olw, 2px);
|
|
1057
|
+
--bim-input--olc: var(
|
|
1058
|
+
--bim-number-input¡focus--c,
|
|
1059
|
+
var(--bim-ui_accent-base)
|
|
1060
|
+
);
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
:host(:not([slider])) bim-label {
|
|
1064
|
+
--bim-label--c: var(
|
|
1065
|
+
--bim-number-input_affixes--c,
|
|
1066
|
+
var(--bim-ui_bg-contrast-60)
|
|
1067
|
+
);
|
|
1068
|
+
--bim-label--fz: var(
|
|
1069
|
+
--bim-number-input_affixes--fz,
|
|
1070
|
+
var(--bim-ui_size-xs)
|
|
1071
|
+
);
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
p {
|
|
1075
|
+
margin: 0;
|
|
1076
|
+
padding: 0;
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
input {
|
|
1080
|
+
background-color: transparent;
|
|
1081
|
+
outline: none;
|
|
1082
|
+
border: none;
|
|
1083
|
+
padding: 0;
|
|
1084
|
+
flex-grow: 1;
|
|
1085
|
+
text-align: right;
|
|
1086
|
+
font-family: inherit;
|
|
1087
|
+
font-feature-settings: inherit;
|
|
1088
|
+
font-variation-settings: inherit;
|
|
1089
|
+
font-size: var(--bim-number-input--fz, var(--bim-ui_size-xs));
|
|
1090
|
+
color: var(--bim-number-input--c, var(--bim-ui_bg-contrast-100));
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
:host([suffix]:not([pref])) input {
|
|
1094
|
+
text-align: left;
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
:host([slider]) {
|
|
1098
|
+
--bim-input--p: 0;
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
:host([slider]) .slider {
|
|
1102
|
+
--bim-label--c: var(--bim-ui_bg-contrast-100);
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
.slider {
|
|
1106
|
+
position: relative;
|
|
1107
|
+
display: flex;
|
|
1108
|
+
justify-content: center;
|
|
1109
|
+
width: 100%;
|
|
1110
|
+
height: 100%;
|
|
1111
|
+
padding: 0 0.5rem;
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
.slider-indicator {
|
|
1115
|
+
height: 100%;
|
|
1116
|
+
background-color: var(--bim-ui_main-base);
|
|
1117
|
+
position: absolute;
|
|
1118
|
+
top: 0;
|
|
1119
|
+
left: 0;
|
|
1120
|
+
border-radius: var(--bim-input--bdrs, var(--bim-ui_size-4xs));
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
bim-input {
|
|
1124
|
+
display: flex;
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
bim-label {
|
|
1128
|
+
pointer-events: none;
|
|
1129
|
+
}
|
|
1130
|
+
`;let Qt=ad;le([W({type:String,reflect:!0})],Qt.prototype,"name",2);le([W({type:String,reflect:!0})],Qt.prototype,"icon",2);le([W({type:String,reflect:!0})],Qt.prototype,"label",2);le([W({type:String,reflect:!0})],Qt.prototype,"pref",2);le([W({type:Number,reflect:!0})],Qt.prototype,"min",2);le([W({type:Number,reflect:!0})],Qt.prototype,"value",1);le([W({type:Number,reflect:!0})],Qt.prototype,"step",2);le([W({type:Number,reflect:!0})],Qt.prototype,"sensitivity",2);le([W({type:Number,reflect:!0})],Qt.prototype,"max",2);le([W({type:String,reflect:!0})],Qt.prototype,"suffix",2);le([W({type:Boolean,reflect:!0})],Qt.prototype,"vertical",2);le([W({type:Boolean,reflect:!0})],Qt.prototype,"slider",2);var C0=Object.defineProperty,y0=Object.getOwnPropertyDescriptor,cn=(r,e,t,i)=>{for(var s=i>1?void 0:i?y0(e,t):e,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&C0(e,t,s),s};const ld=class extends It{constructor(){super(...arguments),this.onValueChange=new Event("change"),this._hidden=!1,this.headerHidden=!1,this.valueTransform={},this.activationButton=document.createElement("bim-button")}set hidden(e){this._hidden=e,this.activationButton.active=!e,this.dispatchEvent(new Event("hiddenchange"))}get hidden(){return this._hidden}get value(){return cr(this,this.valueTransform)}set value(e){const t=[...this.children];for(const i in e){const s=t.find(o=>{const a=o;return a.name===i||a.label===i});if(!s)continue;const n=s;n.value=e[i]}}connectedCallback(){super.connectedCallback(),this.activationButton.active=!this.hidden,this.activationButton.onclick=()=>this.hidden=!this.hidden}disconnectedCallback(){super.disconnectedCallback(),this.activationButton.remove()}collapseSections(){const e=this.querySelectorAll("bim-panel-section");for(const t of e)t.collapsed=!0}expandSections(){const e=this.querySelectorAll("bim-panel-section");for(const t of e)t.collapsed=!1}render(){return this.activationButton.icon=this.icon,this.activationButton.label=this.label||this.name,this.activationButton.tooltipTitle=this.label||this.name,X`
|
|
1131
|
+
<div class="parent">
|
|
1132
|
+
${this.label||this.name||this.icon?X`<bim-label .icon=${this.icon}>${this.label}</bim-label>`:null}
|
|
1133
|
+
<div class="sections">
|
|
1134
|
+
<slot></slot>
|
|
1135
|
+
</div>
|
|
1136
|
+
</div>
|
|
1137
|
+
`}};ld.styles=[ti.scrollbar,yt`
|
|
1138
|
+
:host {
|
|
1139
|
+
display: flex;
|
|
1140
|
+
border-radius: var(--bim-ui_size-base);
|
|
1141
|
+
background-color: var(--bim-ui_bg-base);
|
|
1142
|
+
overflow: auto;
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
:host([hidden]) {
|
|
1146
|
+
display: none;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
.parent {
|
|
1150
|
+
display: flex;
|
|
1151
|
+
flex: 1;
|
|
1152
|
+
flex-direction: column;
|
|
1153
|
+
pointer-events: auto;
|
|
1154
|
+
overflow: auto;
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
.parent bim-label {
|
|
1158
|
+
--bim-label--c: var(--bim-panel--c, var(--bim-ui_bg-contrast-80));
|
|
1159
|
+
--bim-label--fz: var(--bim-panel--fz, var(--bim-ui_size-sm));
|
|
1160
|
+
font-weight: 600;
|
|
1161
|
+
padding: 1rem;
|
|
1162
|
+
flex-shrink: 0;
|
|
1163
|
+
border-bottom: 1px solid var(--bim-ui_bg-contrast-20);
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
:host([header-hidden]) .parent bim-label {
|
|
1167
|
+
display: none;
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
.sections {
|
|
1171
|
+
display: flex;
|
|
1172
|
+
flex-direction: column;
|
|
1173
|
+
overflow: auto;
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
::slotted(bim-panel-section:not(:last-child)) {
|
|
1177
|
+
border-bottom: 1px solid var(--bim-ui_bg-contrast-20);
|
|
1178
|
+
}
|
|
1179
|
+
`];let _i=ld;cn([W({type:String,reflect:!0})],_i.prototype,"icon",2);cn([W({type:String,reflect:!0})],_i.prototype,"name",2);cn([W({type:String,reflect:!0})],_i.prototype,"label",2);cn([W({type:Boolean,reflect:!0})],_i.prototype,"hidden",1);cn([W({type:Boolean,attribute:"header-hidden",reflect:!0})],_i.prototype,"headerHidden",2);var _0=Object.defineProperty,hn=(r,e,t,i)=>{for(var s=void 0,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=o(e,t,s)||s);return s&&_0(e,t,s),s};const cd=class extends It{constructor(){super(...arguments),this.onValueChange=new Event("change"),this.valueTransform={}}get value(){const e=this.parentElement;let t;return e instanceof _i&&(t=e.valueTransform),Object.values(this.valueTransform).length!==0&&(t=this.valueTransform),cr(this,t)}set value(e){const t=[...this.children];for(const i in e){const s=t.find(o=>{const a=o;return a.name===i||a.label===i});if(!s)continue;const n=s;n.value=e[i]}}onHeaderClick(){this.fixed||(this.collapsed=!this.collapsed)}render(){const e=this.label||this.icon||this.name||this.fixed,t=X`<svg
|
|
1180
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
1181
|
+
height="1.125rem"
|
|
1182
|
+
viewBox="0 0 24 24"
|
|
1183
|
+
width="1.125rem"
|
|
1184
|
+
>
|
|
1185
|
+
<path d="M0 0h24v24H0V0z" fill="none" />
|
|
1186
|
+
<path d="M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z" />
|
|
1187
|
+
</svg>`,i=X`<svg
|
|
1188
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
1189
|
+
height="1.125rem"
|
|
1190
|
+
viewBox="0 0 24 24"
|
|
1191
|
+
width="1.125rem"
|
|
1192
|
+
>
|
|
1193
|
+
<path d="M0 0h24v24H0z" fill="none" />
|
|
1194
|
+
<path d="M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z" />
|
|
1195
|
+
</svg>`,s=this.collapsed?t:i,n=X`
|
|
1196
|
+
<div
|
|
1197
|
+
class="header"
|
|
1198
|
+
title=${this.label??""}
|
|
1199
|
+
@click=${this.onHeaderClick}
|
|
1200
|
+
>
|
|
1201
|
+
${this.label||this.icon||this.name?X`<bim-label .icon=${this.icon}>${this.label}</bim-label>`:null}
|
|
1202
|
+
${this.fixed?null:s}
|
|
1203
|
+
</div>
|
|
1204
|
+
`;return X`
|
|
1205
|
+
<div class="parent">
|
|
1206
|
+
${e?n:null}
|
|
1207
|
+
<div class="components">
|
|
1208
|
+
<slot></slot>
|
|
1209
|
+
</div>
|
|
1210
|
+
</div>
|
|
1211
|
+
`}};cd.styles=[ti.scrollbar,yt`
|
|
1212
|
+
:host {
|
|
1213
|
+
display: block;
|
|
1214
|
+
pointer-events: auto;
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
:host(:not([fixed])) .header:hover {
|
|
1218
|
+
--bim-label--c: var(--bim-ui_accent-base);
|
|
1219
|
+
color: var(--bim-ui_accent-base);
|
|
1220
|
+
cursor: pointer;
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
:host(:not([fixed])) .header:hover svg {
|
|
1224
|
+
fill: var(--bim-ui_accent-base);
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
.header {
|
|
1228
|
+
--bim-label--fz: var(--bim-ui_size-sm);
|
|
1229
|
+
--bim-label--c: var(--bim-ui_bg-contrast-80);
|
|
1230
|
+
display: flex;
|
|
1231
|
+
justify-content: space-between;
|
|
1232
|
+
align-items: center;
|
|
1233
|
+
font-weight: 600;
|
|
1234
|
+
height: 1.5rem;
|
|
1235
|
+
padding: 0.75rem 1rem;
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
.header svg {
|
|
1239
|
+
fill: var(--bim-ui_bg-contrast-80);
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
.title {
|
|
1243
|
+
display: flex;
|
|
1244
|
+
align-items: center;
|
|
1245
|
+
column-gap: 0.5rem;
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
.title p {
|
|
1249
|
+
font-size: var(--bim-ui_size-sm);
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1252
|
+
.components {
|
|
1253
|
+
display: flex;
|
|
1254
|
+
flex-direction: column;
|
|
1255
|
+
row-gap: 0.75rem;
|
|
1256
|
+
padding: 0.125rem 1rem 1rem;
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
:host(:not([fixed])[collapsed]) .components {
|
|
1260
|
+
display: none;
|
|
1261
|
+
height: 0px;
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
bim-label {
|
|
1265
|
+
pointer-events: none;
|
|
1266
|
+
}
|
|
1267
|
+
`];let ns=cd;hn([W({type:String,reflect:!0})],ns.prototype,"icon");hn([W({type:String,reflect:!0})],ns.prototype,"label");hn([W({type:String,reflect:!0})],ns.prototype,"name");hn([W({type:Boolean,reflect:!0})],ns.prototype,"fixed");hn([W({type:Boolean,reflect:!0})],ns.prototype,"collapsed");var T0=Object.defineProperty,dn=(r,e,t,i)=>{for(var s=void 0,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=o(e,t,s)||s);return s&&T0(e,t,s),s};const hd=class extends It{constructor(){super(...arguments),this.vertical=!1,this.onValueChange=new Event("change"),this._canEmitEvents=!1,this._value=document.createElement("bim-option"),this.onOptionClick=e=>{this._value=e.target,this.dispatchEvent(this.onValueChange);for(const t of this.children)t instanceof zt&&(t.checked=t===e.target)}}get _options(){return[...this.querySelectorAll("bim-option")]}set value(e){const t=this.findOption(e);if(t){for(const i of this._options)i.checked=i===t;this._value=t,this._canEmitEvents&&this.dispatchEvent(this.onValueChange)}}get value(){return this._value.value}onSlotChange(e){const t=e.target.assignedElements();for(const i of t)i instanceof zt&&(i.noMark=!0,i.removeEventListener("click",this.onOptionClick),i.addEventListener("click",this.onOptionClick))}findOption(e){return this._options.find(t=>t instanceof zt?t.label===e||t.value===e:!1)}firstUpdated(){const e=[...this.children].find(t=>t instanceof zt&&t.checked);e&&(this._value=e)}render(){return X`
|
|
1268
|
+
<bim-input
|
|
1269
|
+
.vertical=${this.vertical}
|
|
1270
|
+
.label=${this.label}
|
|
1271
|
+
.icon=${this.icon}
|
|
1272
|
+
>
|
|
1273
|
+
<slot @slotchange=${this.onSlotChange}></slot>
|
|
1274
|
+
</bim-input>
|
|
1275
|
+
`}};hd.styles=yt`
|
|
1276
|
+
:host {
|
|
1277
|
+
--bim-input--bgc: var(--bim-ui_bg-contrast-20);
|
|
1278
|
+
--bim-input--g: 0;
|
|
1279
|
+
--bim-option--jc: center;
|
|
1280
|
+
flex: 1;
|
|
1281
|
+
display: block;
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1284
|
+
::slotted(bim-option) {
|
|
1285
|
+
border-radius: 0;
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1288
|
+
::slotted(bim-option[checked]) {
|
|
1289
|
+
--bim-label--c: var(--bim-ui_main-contrast);
|
|
1290
|
+
background-color: var(--bim-ui_main-base);
|
|
1291
|
+
}
|
|
1292
|
+
`;let rs=hd;dn([W({type:String,reflect:!0})],rs.prototype,"name");dn([W({type:String,reflect:!0})],rs.prototype,"icon");dn([W({type:String,reflect:!0})],rs.prototype,"label");dn([W({type:Boolean,reflect:!0})],rs.prototype,"vertical");dn([ts()],rs.prototype,"_value");const v0=()=>X`
|
|
1293
|
+
<style>
|
|
1294
|
+
div {
|
|
1295
|
+
display: flex;
|
|
1296
|
+
gap: 0.375rem;
|
|
1297
|
+
border-radius: 0.25rem;
|
|
1298
|
+
min-height: 1.25rem;
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
[data-type="row"] {
|
|
1302
|
+
background-color: var(--bim-ui_bg-contrast-10);
|
|
1303
|
+
animation: row-loading 1s linear infinite alternate;
|
|
1304
|
+
padding: 0.5rem;
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
[data-type="cell"] {
|
|
1308
|
+
background-color: var(--bim-ui_bg-contrast-20);
|
|
1309
|
+
flex: 0.25;
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1312
|
+
@keyframes row-loading {
|
|
1313
|
+
0% {
|
|
1314
|
+
background-color: var(--bim-ui_bg-contrast-10);
|
|
1315
|
+
}
|
|
1316
|
+
100% {
|
|
1317
|
+
background-color: var(--bim-ui_bg-contrast-20);
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
</style>
|
|
1321
|
+
<div style="display: flex; flex-direction: column;">
|
|
1322
|
+
<div data-type="row" style="gap: 2rem">
|
|
1323
|
+
<div data-type="cell" style="flex: 1"></div>
|
|
1324
|
+
<div data-type="cell" style="flex: 2"></div>
|
|
1325
|
+
<div data-type="cell" style="flex: 1"></div>
|
|
1326
|
+
<div data-type="cell" style="flex: 0.5"></div>
|
|
1327
|
+
</div>
|
|
1328
|
+
<div style="display: flex;">
|
|
1329
|
+
<div data-type="row" style="flex: 1">
|
|
1330
|
+
<div data-type="cell" style="flex: 0.5"></div>
|
|
1331
|
+
</div>
|
|
1332
|
+
<div data-type="row" style="flex: 2">
|
|
1333
|
+
<div data-type="cell" style="flex: 0.75"></div>
|
|
1334
|
+
</div>
|
|
1335
|
+
<div data-type="row" style="flex: 1">
|
|
1336
|
+
<div data-type="cell"></div>
|
|
1337
|
+
</div>
|
|
1338
|
+
<div data-type="row" style="flex: 0.5">
|
|
1339
|
+
<div data-type="cell" style="flex: 0.75"></div>
|
|
1340
|
+
</div>
|
|
1341
|
+
</div>
|
|
1342
|
+
<div style="display: flex;">
|
|
1343
|
+
<div data-type="row" style="flex: 1">
|
|
1344
|
+
<div data-type="cell" style="flex: 0.75"></div>
|
|
1345
|
+
</div>
|
|
1346
|
+
<div data-type="row" style="flex: 2">
|
|
1347
|
+
<div data-type="cell"></div>
|
|
1348
|
+
</div>
|
|
1349
|
+
<div data-type="row" style="flex: 1">
|
|
1350
|
+
<div data-type="cell" style="flex: 0.5"></div>
|
|
1351
|
+
</div>
|
|
1352
|
+
<div data-type="row" style="flex: 0.5">
|
|
1353
|
+
<div data-type="cell" style="flex: 0.5"></div>
|
|
1354
|
+
</div>
|
|
1355
|
+
</div>
|
|
1356
|
+
<div style="display: flex;">
|
|
1357
|
+
<div data-type="row" style="flex: 1">
|
|
1358
|
+
<div data-type="cell"></div>
|
|
1359
|
+
</div>
|
|
1360
|
+
<div data-type="row" style="flex: 2">
|
|
1361
|
+
<div data-type="cell" style="flex: 0.5"></div>
|
|
1362
|
+
</div>
|
|
1363
|
+
<div data-type="row" style="flex: 1">
|
|
1364
|
+
<div data-type="cell" style="flex: 0.75"></div>
|
|
1365
|
+
</div>
|
|
1366
|
+
<div data-type="row" style="flex: 0.5">
|
|
1367
|
+
<div data-type="cell" style="flex: 0.7s5"></div>
|
|
1368
|
+
</div>
|
|
1369
|
+
</div>
|
|
1370
|
+
</div>
|
|
1371
|
+
`,w0=()=>X`
|
|
1372
|
+
<style>
|
|
1373
|
+
.loader {
|
|
1374
|
+
grid-area: Processing;
|
|
1375
|
+
position: relative;
|
|
1376
|
+
padding: 0.125rem;
|
|
1377
|
+
}
|
|
1378
|
+
.loader:before {
|
|
1379
|
+
content: "";
|
|
1380
|
+
position: absolute;
|
|
1381
|
+
}
|
|
1382
|
+
.loader .loaderBar {
|
|
1383
|
+
position: absolute;
|
|
1384
|
+
top: 0;
|
|
1385
|
+
right: 100%;
|
|
1386
|
+
bottom: 0;
|
|
1387
|
+
left: 0;
|
|
1388
|
+
background: var(--bim-ui_main-base);
|
|
1389
|
+
/* width: 25%; */
|
|
1390
|
+
width: 0;
|
|
1391
|
+
animation: borealisBar 2s linear infinite;
|
|
1392
|
+
}
|
|
1393
|
+
|
|
1394
|
+
@keyframes borealisBar {
|
|
1395
|
+
0% {
|
|
1396
|
+
left: 0%;
|
|
1397
|
+
right: 100%;
|
|
1398
|
+
width: 0%;
|
|
1399
|
+
}
|
|
1400
|
+
10% {
|
|
1401
|
+
left: 0%;
|
|
1402
|
+
right: 75%;
|
|
1403
|
+
width: 25%;
|
|
1404
|
+
}
|
|
1405
|
+
90% {
|
|
1406
|
+
right: 0%;
|
|
1407
|
+
left: 75%;
|
|
1408
|
+
width: 25%;
|
|
1409
|
+
}
|
|
1410
|
+
100% {
|
|
1411
|
+
left: 100%;
|
|
1412
|
+
right: 0%;
|
|
1413
|
+
width: 0%;
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
</style>
|
|
1417
|
+
<div class="loader">
|
|
1418
|
+
<div class="loaderBar"></div>
|
|
1419
|
+
</div>
|
|
1420
|
+
`;var A0=Object.defineProperty,R0=(r,e,t,i)=>{for(var s=void 0,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=o(e,t,s)||s);return s&&A0(e,t,s),s};const dd=class extends It{constructor(){super(...arguments),this.column="",this.columnIndex=0,this.rowData={}}get data(){return this.column?this.rowData[this.column]:null}render(){return X`
|
|
1421
|
+
<style>
|
|
1422
|
+
:host {
|
|
1423
|
+
grid-area: ${this.column??"unset"};
|
|
1424
|
+
}
|
|
1425
|
+
</style>
|
|
1426
|
+
<slot></slot>
|
|
1427
|
+
`}};dd.styles=yt`
|
|
1428
|
+
:host {
|
|
1429
|
+
padding: 0.375rem;
|
|
1430
|
+
display: flex;
|
|
1431
|
+
align-items: center;
|
|
1432
|
+
justify-content: center;
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
:host([data-column-index="0"]:not([data-no-indentation])) {
|
|
1436
|
+
justify-content: normal;
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
:host([data-column-index="0"]:not([data-cell-header]))
|
|
1440
|
+
::slotted(bim-label) {
|
|
1441
|
+
text-align: left;
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
::slotted(*) {
|
|
1445
|
+
--bim-input--bgc: transparent;
|
|
1446
|
+
--bim-input--olc: var(--bim-ui_bg-contrast-20);
|
|
1447
|
+
--bim-input--olw: 1px;
|
|
1448
|
+
}
|
|
1449
|
+
|
|
1450
|
+
::slotted(bim-input) {
|
|
1451
|
+
--bim-input--olw: 0;
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1454
|
+
::slotted(bim-label) {
|
|
1455
|
+
white-space: normal;
|
|
1456
|
+
text-align: center;
|
|
1457
|
+
}
|
|
1458
|
+
`;let ud=dd;R0([W({type:String,reflect:!0})],ud.prototype,"column");var S0=Object.defineProperty,F0=(r,e,t,i)=>{for(var s=void 0,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=o(e,t,s)||s);return s&&S0(e,t,s),s};const fd=class extends It{constructor(){super(...arguments),this._groups=[],this.data=[],this.table=this.closest("bim-table")}toggleGroups(e,t=!1){for(const i of this._groups)i.childrenHidden=typeof e>"u"?!i.childrenHidden:!e,t&&i.toggleChildren(e,t)}render(){return this._groups=[],X`
|
|
1459
|
+
<slot></slot>
|
|
1460
|
+
${this.data.map(e=>{const t=document.createElement("bim-table-group");return this._groups.push(t),t.table=this.table,t.data=e,t})}
|
|
1461
|
+
`}};fd.styles=yt`
|
|
1462
|
+
:host {
|
|
1463
|
+
--bim-button--bgc: transparent;
|
|
1464
|
+
position: relative;
|
|
1465
|
+
grid-area: Children;
|
|
1466
|
+
}
|
|
1467
|
+
|
|
1468
|
+
:host([hidden]) {
|
|
1469
|
+
display: none;
|
|
1470
|
+
}
|
|
1471
|
+
|
|
1472
|
+
::slotted(.branch.branch-vertical) {
|
|
1473
|
+
top: 0;
|
|
1474
|
+
bottom: 1.125rem;
|
|
1475
|
+
}
|
|
1476
|
+
`;let pd=fd;F0([W({type:Array,attribute:!1})],pd.prototype,"data");var O0=Object.defineProperty,x0=(r,e,t,i)=>{for(var s=void 0,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=o(e,t,s)||s);return s&&O0(e,t,s),s};const md=class extends It{constructor(){super(...arguments),this.data={data:{}},this.childrenHidden=!0,this.table=this.closest("bim-table")}connectedCallback(){super.connectedCallback(),this.table&&this.table.expanded?this.childrenHidden=!1:this.childrenHidden=!0}toggleChildren(e,t=!1){this._children&&(this.childrenHidden=typeof e>"u"?!this.childrenHidden:!e,t&&this._children.toggleGroups(e,t))}render(){if(!this.table)throw new Error("TableGroup: parent table wasn't found!");const e=this.table.getGroupIndentation(this.data)??0,t=X`
|
|
1477
|
+
${this.table.noIndentation?null:X`
|
|
1478
|
+
<style>
|
|
1479
|
+
.branch-vertical {
|
|
1480
|
+
left: ${e+(this.table.selectableRows?1.9375:.5625)}rem;
|
|
1481
|
+
}
|
|
1482
|
+
</style>
|
|
1483
|
+
<div class="branch branch-vertical"></div>
|
|
1484
|
+
`}
|
|
1485
|
+
`,i=document.createDocumentFragment();Zi(t,i);let s=null;this.table.noIndentation||(s=document.createElement("div"),s.classList.add("branch","branch-horizontal"),s.style.left=`${e-1+(this.table.selectableRows?2.05:.5625)}rem`);let n=null;if(!this.table.noIndentation){const l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.setAttribute("height","9.5"),l.setAttribute("width","7.5"),l.setAttribute("viewBox","0 0 4.6666672 7.3333333");const c=document.createElementNS("http://www.w3.org/2000/svg","path");c.setAttribute("d","m 1.7470835,6.9583848 2.5899999,-2.59 c 0.39,-0.39 0.39,-1.02 0,-1.41 L 1.7470835,0.36838483 c -0.63,-0.62000003 -1.71000005,-0.18 -1.71000005,0.70999997 v 5.17 c 0,0.9 1.08000005,1.34 1.71000005,0.71 z"),l.append(c);const h=document.createElementNS("http://www.w3.org/2000/svg","svg");h.setAttribute("height","6.5"),h.setAttribute("width","9.5"),h.setAttribute("viewBox","0 0 5.9111118 5.0175439");const d=document.createElementNS("http://www.w3.org/2000/svg","path");d.setAttribute("d","M -0.33616196,1.922522 2.253838,4.5125219 c 0.39,0.39 1.02,0.39 1.41,0 L 6.2538379,1.922522 c 0.6200001,-0.63 0.18,-1.71000007 -0.7099999,-1.71000007 H 0.37383804 c -0.89999997,0 -1.33999997,1.08000007 -0.71,1.71000007 z"),h.append(d),n=document.createElement("div"),n.addEventListener("click",u=>{u.stopPropagation(),this.toggleChildren()}),n.classList.add("caret"),n.style.left=`${(this.table.selectableRows?1.5:.125)+e}rem`,this.childrenHidden?n.append(l):n.append(h)}const o=document.createElement("bim-table-row");this.data.children&&!this.childrenHidden&&o.append(i),o.table=this.table,o.data=this.data.data,this.table.dispatchEvent(new CustomEvent("rowcreated",{detail:{row:o}})),n&&this.data.children&&o.append(n),e!==0&&(!this.data.children||this.childrenHidden)&&s&&o.append(s);let a;if(this.data.children){a=document.createElement("bim-table-children"),this._children=a,a.table=this.table,a.data=this.data.children;const l=document.createDocumentFragment();Zi(t,l),a.append(l)}return X`
|
|
1486
|
+
<div class="parent">${o} ${this.childrenHidden?null:a}</div>
|
|
1487
|
+
`}};md.styles=yt`
|
|
1488
|
+
:host {
|
|
1489
|
+
position: relative;
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1492
|
+
.parent {
|
|
1493
|
+
display: grid;
|
|
1494
|
+
grid-template-areas: "Data" "Children";
|
|
1495
|
+
}
|
|
1496
|
+
|
|
1497
|
+
.branch {
|
|
1498
|
+
position: absolute;
|
|
1499
|
+
z-index: 1;
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
.branch-vertical {
|
|
1503
|
+
border-left: 1px dotted var(--bim-ui_bg-contrast-40);
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
.branch-horizontal {
|
|
1507
|
+
top: 50%;
|
|
1508
|
+
width: 1rem;
|
|
1509
|
+
border-bottom: 1px dotted var(--bim-ui_bg-contrast-40);
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1512
|
+
.caret {
|
|
1513
|
+
position: absolute;
|
|
1514
|
+
z-index: 2;
|
|
1515
|
+
transform: translateY(-50%) rotate(0deg);
|
|
1516
|
+
top: 50%;
|
|
1517
|
+
display: flex;
|
|
1518
|
+
width: 0.95rem;
|
|
1519
|
+
height: 0.95rem;
|
|
1520
|
+
justify-content: center;
|
|
1521
|
+
align-items: center;
|
|
1522
|
+
cursor: pointer;
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
.caret svg {
|
|
1526
|
+
fill: var(--bim-ui_bg-contrast-60);
|
|
1527
|
+
}
|
|
1528
|
+
`;let gd=md;x0([W({type:Boolean,attribute:"children-hidden",reflect:!0})],gd.prototype,"childrenHidden");var N0=Object.defineProperty,os=(r,e,t,i)=>{for(var s=void 0,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=o(e,t,s)||s);return s&&N0(e,t,s),s};const Ed=class extends It{constructor(){super(...arguments),this.selected=!1,this.columns=[],this.hiddenColumns=[],this.data={},this.isHeader=!1,this.table=this.closest("bim-table"),this.onTableColumnsChange=()=>{this.table&&(this.columns=this.table.columns)},this.onTableColumnsHidden=()=>{this.table&&(this.hiddenColumns=this.table.hiddenColumns)},this._observer=new IntersectionObserver(e=>{this._intersecting=e[0].isIntersecting},{rootMargin:"36px"})}get _columnNames(){return this.columns.filter(e=>!this.hiddenColumns.includes(e.name)).map(e=>e.name)}get _columnWidths(){return this.columns.filter(e=>!this.hiddenColumns.includes(e.name)).map(e=>e.width)}get _isSelected(){var e;return(e=this.table)==null?void 0:e.selection.has(this.data)}onSelectionChange(e){if(!this.table)return;const t=e.target;this.selected=t.value,t.value?(this.table.selection.add(this.data),this.table.dispatchEvent(new CustomEvent("rowselected",{detail:{data:this.data}}))):(this.table.selection.delete(this.data),this.table.dispatchEvent(new CustomEvent("rowdeselected",{detail:{data:this.data}})))}connectedCallback(){super.connectedCallback(),this._observer.observe(this),this.table&&(this.columns=this.table.columns,this.hiddenColumns=this.table.hiddenColumns,this.table.addEventListener("columnschange",this.onTableColumnsChange),this.table.addEventListener("columnshidden",this.onTableColumnsHidden),this.toggleAttribute("selected",this._isSelected))}disconnectedCallback(){super.disconnectedCallback(),this._observer.unobserve(this),this.table&&(this.columns=[],this.hiddenColumns=[],this.table.removeEventListener("columnschange",this.onTableColumnsChange),this.table.removeEventListener("columnshidden",this.onTableColumnsHidden),this.toggleAttribute("selected",!1))}compute(){if(!this.table)throw new Error("TableRow: parent table wasn't found!");const e=this.table.getRowIndentation(this.data)??0,t=this.isHeader?this.data:this.table.applyDataTransform(this.data)??this.data,i=[];for(const s in t){if(this.hiddenColumns.includes(s))continue;const n=t[s];let o;if(typeof n=="string"||typeof n=="boolean"||typeof n=="number"?(o=document.createElement("bim-label"),o.textContent=String(n)):n instanceof HTMLElement?o=n:(o=document.createDocumentFragment(),Zi(n,o)),!o)continue;const a=document.createElement("bim-table-cell");a.append(o),a.column=s,this._columnNames.indexOf(s)===0&&!this.isHeader&&(a.style.marginLeft=`${(this.table.noIndentation?0:e)+.75}rem`);const l=this._columnNames.indexOf(s);a.setAttribute("data-column-index",String(l)),a.toggleAttribute("data-no-indentation",l===0&&this.table.noIndentation),a.toggleAttribute("data-cell-header",this.isHeader),a.rowData=this.data,this.table.dispatchEvent(new CustomEvent("cellcreated",{detail:{cell:a}})),i.push(a)}return this.style.gridTemplateAreas=`"${this.table.selectableRows?"Selection":""} ${this._columnNames.join(" ")}"`,this.style.gridTemplateColumns=`${this.table.selectableRows?"1.6rem":""} ${this._columnWidths.join(" ")}`,X`
|
|
1529
|
+
${!this.isHeader&&this.table.selectableRows?X`<bim-checkbox
|
|
1530
|
+
@change=${this.onSelectionChange}
|
|
1531
|
+
.checked=${this._isSelected}
|
|
1532
|
+
style="align-self: center; justify-self: center"
|
|
1533
|
+
></bim-checkbox>`:null}
|
|
1534
|
+
${i}
|
|
1535
|
+
<slot></slot>
|
|
1536
|
+
`}render(){return X`${this._intersecting?this.compute():X``}`}};Ed.styles=yt`
|
|
1537
|
+
:host {
|
|
1538
|
+
position: relative;
|
|
1539
|
+
grid-area: Data;
|
|
1540
|
+
display: grid;
|
|
1541
|
+
min-height: 2.25rem;
|
|
1542
|
+
transition: all 0.15s;
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
::slotted(.branch.branch-vertical) {
|
|
1546
|
+
top: 50%;
|
|
1547
|
+
bottom: 0;
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1550
|
+
:host([selected]) {
|
|
1551
|
+
background-color: color-mix(
|
|
1552
|
+
in lab,
|
|
1553
|
+
var(--bim-ui_bg-contrast-20) 30%,
|
|
1554
|
+
var(--bim-ui_main-base) 10%
|
|
1555
|
+
);
|
|
1556
|
+
}
|
|
1557
|
+
`;let Ti=Ed;os([W({type:Boolean,reflect:!0})],Ti.prototype,"selected");os([W({attribute:!1})],Ti.prototype,"columns");os([W({attribute:!1})],Ti.prototype,"hiddenColumns");os([W({attribute:!1})],Ti.prototype,"data");os([W({type:Boolean,attribute:"is-header",reflect:!0})],Ti.prototype,"isHeader");os([ts()],Ti.prototype,"_intersecting");var P0=Object.defineProperty,L0=Object.getOwnPropertyDescriptor,ge=(r,e,t,i)=>{for(var s=i>1?void 0:i?L0(e,t):e,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&P0(e,t,s),s};const bd=class extends It{constructor(){super(...arguments),this._columnsChange=new Event("columnschange"),this._filteredData=[],this.headersHidden=!1,this.minColWidth="4rem",this._columns=[],this._textDelimiters={comma:",",tab:" "},this._queryString=null,this._data=[],this.expanded=!1,this.preserveStructureOnFilter=!1,this.indentationInText=!1,this.dataTransform={},this.selectableRows=!1,this.selection=new Set,this.noIndentation=!1,this.loading=!1,this._errorLoading=!1,this._onColumnsHidden=new Event("columnshidden"),this._hiddenColumns=[],this.loadingErrorElement=null,this._stringFilterFunction=(e,t)=>Object.values(t.data).some(i=>String(i).toLowerCase().includes(e.toLowerCase())),this._queryFilterFunction=(e,t)=>{let i=!1;const s=na(e)??[];for(const n of s){if("queries"in n){i=!1;break}const{condition:o,value:a}=n;let{key:l}=n;if(l.startsWith("[")&&l.endsWith("]")){const c=l.replace("[","").replace("]","");l=c,i=Object.keys(t.data).filter(h=>h.includes(c)).map(h=>fc(t.data[h],o,a)).some(h=>h)}else i=fc(t.data[l],o,a);if(!i)break}return i}}set columns(e){const t=[];for(const i of e){const s=typeof i=="string"?{name:i,width:`minmax(${this.minColWidth}, 1fr)`}:i;t.push(s)}this._columns=t,this.computeMissingColumns(this.data),this.dispatchEvent(this._columnsChange)}get columns(){return this._columns}get _headerRowData(){const e={};for(const t of this.columns)if(typeof t=="string")e[t]=t;else{const{name:i}=t;e[i]=i}return e}get value(){return this._filteredData}set queryString(e){this.toggleAttribute("data-processing",!0),this._queryString=e&&e.trim()!==""?e.trim():null,this.updateFilteredData(),this.toggleAttribute("data-processing",!1)}get queryString(){return this._queryString}set data(e){this._data=e,this.updateFilteredData(),this.computeMissingColumns(e)&&(this.columns=this._columns)}get data(){return this._data}get dataAsync(){return new Promise(e=>{setTimeout(()=>{e(this.data)})})}set hiddenColumns(e){this._hiddenColumns=e,setTimeout(()=>{this.dispatchEvent(this._onColumnsHidden)})}get hiddenColumns(){return this._hiddenColumns}updateFilteredData(){this.queryString?(na(this.queryString)?(this.filterFunction=this._queryFilterFunction,this._filteredData=this.filter(this.queryString)):(this.filterFunction=this._stringFilterFunction,this._filteredData=this.filter(this.queryString)),this.preserveStructureOnFilter&&(this._expandedBeforeFilter===void 0&&(this._expandedBeforeFilter=this.expanded),this.expanded=!0)):(this.preserveStructureOnFilter&&this._expandedBeforeFilter!==void 0&&(this.expanded=this._expandedBeforeFilter,this._expandedBeforeFilter=void 0),this._filteredData=this.data)}computeMissingColumns(e){let t=!1;for(const i of e){const{children:s,data:n}=i;for(const o in n)this._columns.map(a=>typeof a=="string"?a:a.name).includes(o)||(this._columns.push({name:o,width:`minmax(${this.minColWidth}, 1fr)`}),t=!0);if(s){const o=this.computeMissingColumns(s);o&&!t&&(t=o)}}return t}generateText(e="comma",t=this.value,i="",s=!0){const n=this._textDelimiters[e];let o="";const a=this.columns.map(l=>l.name);if(s){this.indentationInText&&(o+=`Indentation${n}`);const l=`${a.join(n)}
|
|
1558
|
+
`;o+=l}for(const[l,c]of t.entries()){const{data:h,children:d}=c,u=this.indentationInText?`${i}${l+1}${n}`:"",f=a.map(m=>h[m]??""),p=`${u}${f.join(n)}
|
|
1559
|
+
`;o+=p,d&&(o+=this.generateText(e,c.children,`${i}${l+1}.`,!1))}return o}get csv(){return this.generateText("comma")}get tsv(){return this.generateText("tab")}applyDataTransform(e){const t={};for(const i of Object.keys(this.dataTransform)){const s=this.columns.find(n=>n.name===i);s&&s.forceDataTransform&&(i in e||(e[i]=""))}for(const i in e){const s=this.dataTransform[i];s?t[i]=s(e[i],e):t[i]=e[i]}return t}downloadData(e="BIM Table Data",t="json"){let i=null;if(t==="json"&&(i=new File([JSON.stringify(this.value,void 0,2)],`${e}.json`)),t==="csv"&&(i=new File([this.csv],`${e}.csv`)),t==="tsv"&&(i=new File([this.tsv],`${e}.tsv`)),!i)return;const s=document.createElement("a");s.href=URL.createObjectURL(i),s.download=i.name,s.click(),URL.revokeObjectURL(s.href)}getRowIndentation(e,t=this.value,i=0){for(const s of t){if(s.data===e)return i;if(s.children){const n=this.getRowIndentation(e,s.children,i+1);if(n!==null)return n}}return null}getGroupIndentation(e,t=this.value,i=0){for(const s of t){if(s===e)return i;if(s.children){const n=this.getGroupIndentation(e,s.children,i+1);if(n!==null)return n}}return null}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new Event("connected"))}disconnectedCallback(){super.disconnectedCallback(),this.dispatchEvent(new Event("disconnected"))}async loadData(e=!1){if(this._filteredData.length!==0&&!e||!this.loadFunction)return!1;this.loading=!0;try{const t=await this.loadFunction();return this.data=t,this.loading=!1,this._errorLoading=!1,!0}catch(t){return this.loading=!1,this._filteredData.length!==0||(t instanceof Error&&this.loadingErrorElement&&t.message.trim()!==""&&(this.loadingErrorElement.textContent=t.message),this._errorLoading=!0),!1}}filter(e,t=this.filterFunction??this._stringFilterFunction,i=this.data){const s=[];for(const n of i)if(t(e,n)){if(this.preserveStructureOnFilter){const o={data:n.data};if(n.children){const a=this.filter(e,t,n.children);a.length&&(o.children=a)}s.push(o)}else if(s.push({data:n.data}),n.children){const o=this.filter(e,t,n.children);s.push(...o)}}else if(n.children){const o=this.filter(e,t,n.children);this.preserveStructureOnFilter&&o.length?s.push({data:n.data,children:o}):s.push(...o)}return s}get _missingDataElement(){return this.querySelector("[slot='missing-data']")}render(){if(this.loading)return v0();if(this._errorLoading)return X`<slot name="error-loading"></slot>`;if(this._filteredData.length===0&&this._missingDataElement)return X`<slot name="missing-data"></slot>`;const e=document.createElement("bim-table-row");e.table=this,e.isHeader=!0,e.data=this._headerRowData,e.style.gridArea="Header",e.style.position="sticky",e.style.top="0",e.style.zIndex="5";const t=document.createElement("bim-table-children");return t.table=this,t.data=this.value,t.style.gridArea="Body",t.style.backgroundColor="transparent",X`
|
|
1560
|
+
<div class="parent">
|
|
1561
|
+
${this.headersHidden?null:e} ${w0()}
|
|
1562
|
+
<div style="overflow-x: hidden; grid-area: Body">${t}</div>
|
|
1563
|
+
</div>
|
|
1564
|
+
`}};bd.styles=[ti.scrollbar,yt`
|
|
1565
|
+
:host {
|
|
1566
|
+
position: relative;
|
|
1567
|
+
overflow: auto;
|
|
1568
|
+
display: block;
|
|
1569
|
+
pointer-events: auto;
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
:host(:not([data-processing])) .loader {
|
|
1573
|
+
display: none;
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
.parent {
|
|
1577
|
+
display: grid;
|
|
1578
|
+
grid-template:
|
|
1579
|
+
"Header" auto
|
|
1580
|
+
"Processing" auto
|
|
1581
|
+
"Body" 1fr
|
|
1582
|
+
"Footer" auto;
|
|
1583
|
+
overflow: auto;
|
|
1584
|
+
height: 100%;
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1587
|
+
.parent > bim-table-row[is-header] {
|
|
1588
|
+
color: var(--bim-table_header--c, var(--bim-ui_bg-contrast-100));
|
|
1589
|
+
background-color: var(
|
|
1590
|
+
--bim-table_header--bgc,
|
|
1591
|
+
var(--bim-ui_bg-contrast-20)
|
|
1592
|
+
);
|
|
1593
|
+
}
|
|
1594
|
+
|
|
1595
|
+
.controls {
|
|
1596
|
+
display: flex;
|
|
1597
|
+
gap: 0.375rem;
|
|
1598
|
+
flex-wrap: wrap;
|
|
1599
|
+
margin-bottom: 0.5rem;
|
|
1600
|
+
}
|
|
1601
|
+
`];let ce=bd;ge([ts()],ce.prototype,"_filteredData",2);ge([W({type:Boolean,attribute:"headers-hidden",reflect:!0})],ce.prototype,"headersHidden",2);ge([W({type:String,attribute:"min-col-width",reflect:!0})],ce.prototype,"minColWidth",2);ge([W({type:Array,attribute:!1})],ce.prototype,"columns",1);ge([W({type:Array,attribute:!1})],ce.prototype,"data",1);ge([W({type:Boolean,reflect:!0})],ce.prototype,"expanded",2);ge([W({type:Boolean,reflect:!0,attribute:"selectable-rows"})],ce.prototype,"selectableRows",2);ge([W({attribute:!1})],ce.prototype,"selection",2);ge([W({type:Boolean,attribute:"no-indentation",reflect:!0})],ce.prototype,"noIndentation",2);ge([W({type:Boolean,reflect:!0})],ce.prototype,"loading",2);ge([ts()],ce.prototype,"_errorLoading",2);var M0=Object.defineProperty,D0=Object.getOwnPropertyDescriptor,Wr=(r,e,t,i)=>{for(var s=i>1?void 0:i?D0(e,t):e,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&M0(e,t,s),s};const Id=class extends It{constructor(){super(...arguments),this._defaultName="__unnamed__",this.name=this._defaultName,this._hidden=!1}set hidden(e){this._hidden=e,this.dispatchEvent(new Event("hiddenchange"))}get hidden(){return this._hidden}connectedCallback(){super.connectedCallback();const{parentElement:e}=this;if(e&&this.name===this._defaultName){const t=[...e.children].indexOf(this);this.name=`${this._defaultName}${t}`}}render(){return X` <slot></slot> `}};Id.styles=yt`
|
|
1602
|
+
:host {
|
|
1603
|
+
display: block;
|
|
1604
|
+
height: 100%;
|
|
1605
|
+
}
|
|
1606
|
+
|
|
1607
|
+
:host([hidden]) {
|
|
1608
|
+
display: none;
|
|
1609
|
+
}
|
|
1610
|
+
`;let ee=Id;Wr([W({type:String,reflect:!0})],ee.prototype,"name",2);Wr([W({type:String,reflect:!0})],ee.prototype,"label",2);Wr([W({type:String,reflect:!0})],ee.prototype,"icon",2);Wr([W({type:Boolean,reflect:!0})],ee.prototype,"hidden",1);var U0=Object.defineProperty,k0=Object.getOwnPropertyDescriptor,as=(r,e,t,i)=>{for(var s=i>1?void 0:i?k0(e,t):e,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&U0(e,t,s),s};const Cd=class extends It{constructor(){super(...arguments),this._switchers=[],this.bottom=!1,this.switchersHidden=!1,this.floating=!1,this.switchersFull=!1,this.onTabHiddenChange=e=>{const t=e.target;t instanceof ee&&!t.hidden&&(t.removeEventListener("hiddenchange",this.onTabHiddenChange),this.tab=t.name,t.addEventListener("hiddenchange",this.onTabHiddenChange))}}set tab(e){this._tab=e;const t=[...this.children],i=t.find(s=>s instanceof ee&&s.name===e);for(const s of t){if(!(s instanceof ee))continue;s.hidden=i!==s;const n=this.getTabSwitcher(s.name);n&&n.toggleAttribute("data-active",!s.hidden)}}get tab(){return this._tab}getTabSwitcher(e){return this._switchers.find(t=>t.getAttribute("data-name")===e)}createSwitchers(){this._switchers=[];for(const e of this.children){if(!(e instanceof ee))continue;const t=document.createElement("div");t.addEventListener("click",()=>{this.tab===e.name?this.toggleAttribute("tab",!1):this.tab=e.name}),t.setAttribute("data-name",e.name),t.className="switcher";const i=document.createElement("bim-label");i.textContent=e.label??"",i.icon=e.icon,t.append(i),this._switchers.push(t)}}onSlotChange(e){this.createSwitchers();const t=e.target.assignedElements(),i=t.find(s=>s instanceof ee?this.tab?s.name===this.tab:!s.hidden:!1);i&&i instanceof ee&&(this.tab=i.name);for(const s of t){if(!(s instanceof ee)){s.remove();continue}s.removeEventListener("hiddenchange",this.onTabHiddenChange),i!==s&&(s.hidden=!0),s.addEventListener("hiddenchange",this.onTabHiddenChange)}}render(){return X`
|
|
1611
|
+
<div class="parent">
|
|
1612
|
+
<div class="switchers">${this._switchers}</div>
|
|
1613
|
+
<div class="content">
|
|
1614
|
+
<slot @slotchange=${this.onSlotChange}></slot>
|
|
1615
|
+
</div>
|
|
1616
|
+
</div>
|
|
1617
|
+
`}};Cd.styles=[ti.scrollbar,yt`
|
|
1618
|
+
* {
|
|
1619
|
+
box-sizing: border-box;
|
|
1620
|
+
}
|
|
1621
|
+
|
|
1622
|
+
:host {
|
|
1623
|
+
background-color: var(--bim-ui_bg-base);
|
|
1624
|
+
display: block;
|
|
1625
|
+
overflow: auto;
|
|
1626
|
+
}
|
|
1627
|
+
|
|
1628
|
+
.parent {
|
|
1629
|
+
display: grid;
|
|
1630
|
+
grid-template: "switchers" auto "content" 1fr;
|
|
1631
|
+
height: 100%;
|
|
1632
|
+
}
|
|
1633
|
+
|
|
1634
|
+
:host([bottom]) .parent {
|
|
1635
|
+
grid-template: "content" 1fr "switchers" auto;
|
|
1636
|
+
}
|
|
1637
|
+
|
|
1638
|
+
.switchers {
|
|
1639
|
+
display: flex;
|
|
1640
|
+
height: 2.25rem;
|
|
1641
|
+
font-weight: 600;
|
|
1642
|
+
grid-area: switchers;
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1645
|
+
.switcher {
|
|
1646
|
+
--bim-label--c: var(--bim-ui_bg-contrast-80);
|
|
1647
|
+
background-color: var(--bim-ui_bg-base);
|
|
1648
|
+
cursor: pointer;
|
|
1649
|
+
pointer-events: auto;
|
|
1650
|
+
padding: 0rem 0.75rem;
|
|
1651
|
+
display: flex;
|
|
1652
|
+
justify-content: center;
|
|
1653
|
+
transition: all 0.15s;
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
:host([switchers-full]) .switcher {
|
|
1657
|
+
flex: 1;
|
|
1658
|
+
}
|
|
1659
|
+
|
|
1660
|
+
.switcher:hover,
|
|
1661
|
+
.switcher[data-active] {
|
|
1662
|
+
--bim-label--c: var(--bim-ui_main-contrast);
|
|
1663
|
+
background-color: var(--bim-ui_main-base);
|
|
1664
|
+
}
|
|
1665
|
+
|
|
1666
|
+
.switchers bim-label {
|
|
1667
|
+
pointer-events: none;
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1670
|
+
:host([switchers-hidden]) .switchers {
|
|
1671
|
+
display: none;
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
.content {
|
|
1675
|
+
grid-area: content;
|
|
1676
|
+
overflow: auto;
|
|
1677
|
+
}
|
|
1678
|
+
|
|
1679
|
+
:host(:not([bottom])) .content {
|
|
1680
|
+
border-top: 1px solid var(--bim-ui_bg-contrast-20);
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
:host([bottom]) .content {
|
|
1684
|
+
border-bottom: 1px solid var(--bim-ui_bg-contrast-20);
|
|
1685
|
+
}
|
|
1686
|
+
|
|
1687
|
+
:host(:not([tab])) .content {
|
|
1688
|
+
display: none;
|
|
1689
|
+
}
|
|
1690
|
+
|
|
1691
|
+
:host([floating]) {
|
|
1692
|
+
background-color: transparent;
|
|
1693
|
+
}
|
|
1694
|
+
|
|
1695
|
+
:host([floating]) .switchers {
|
|
1696
|
+
justify-self: center;
|
|
1697
|
+
overflow: auto;
|
|
1698
|
+
}
|
|
1699
|
+
|
|
1700
|
+
:host([floating]:not([bottom])) .switchers {
|
|
1701
|
+
border-radius: var(--bim-ui_size-2xs) var(--bim-ui_size-2xs) 0 0;
|
|
1702
|
+
border-top: 1px solid var(--bim-ui_bg-contrast-20);
|
|
1703
|
+
border-left: 1px solid var(--bim-ui_bg-contrast-20);
|
|
1704
|
+
border-right: 1px solid var(--bim-ui_bg-contrast-20);
|
|
1705
|
+
}
|
|
1706
|
+
|
|
1707
|
+
:host([floating][bottom]) .switchers {
|
|
1708
|
+
border-radius: 0 0 var(--bim-ui_size-2xs) var(--bim-ui_size-2xs);
|
|
1709
|
+
border-bottom: 1px solid var(--bim-ui_bg-contrast-20);
|
|
1710
|
+
border-left: 1px solid var(--bim-ui_bg-contrast-20);
|
|
1711
|
+
border-right: 1px solid var(--bim-ui_bg-contrast-20);
|
|
1712
|
+
}
|
|
1713
|
+
|
|
1714
|
+
:host([floating]:not([tab])) .switchers {
|
|
1715
|
+
border-radius: var(--bim-ui_size-2xs);
|
|
1716
|
+
border-bottom: 1px solid var(--bim-ui_bg-contrast-20);
|
|
1717
|
+
}
|
|
1718
|
+
|
|
1719
|
+
:host([floating][bottom]:not([tab])) .switchers {
|
|
1720
|
+
border-top: 1px solid var(--bim-ui_bg-contrast-20);
|
|
1721
|
+
}
|
|
1722
|
+
|
|
1723
|
+
:host([floating]) .content {
|
|
1724
|
+
border: 1px solid var(--bim-ui_bg-contrast-20);
|
|
1725
|
+
border-radius: var(--bim-ui_size-2xs);
|
|
1726
|
+
background-color: var(--bim-ui_bg-base);
|
|
1727
|
+
}
|
|
1728
|
+
`];let vi=Cd;as([ts()],vi.prototype,"_switchers",2);as([W({type:Boolean,reflect:!0})],vi.prototype,"bottom",2);as([W({type:Boolean,attribute:"switchers-hidden",reflect:!0})],vi.prototype,"switchersHidden",2);as([W({type:Boolean,reflect:!0})],vi.prototype,"floating",2);as([W({type:String,reflect:!0})],vi.prototype,"tab",1);as([W({type:Boolean,attribute:"switchers-full",reflect:!0})],vi.prototype,"switchersFull",2);/**
|
|
1729
|
+
* @license
|
|
1730
|
+
* Copyright 2018 Google LLC
|
|
1731
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1732
|
+
*/const pc=r=>r??Dt;var B0=Object.defineProperty,z0=Object.getOwnPropertyDescriptor,Ue=(r,e,t,i)=>{for(var s=i>1?void 0:i?z0(e,t):e,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&B0(e,t,s),s};const yd=class extends It{constructor(){super(...arguments),this._inputTypes=["date","datetime-local","email","month","password","search","tel","text","time","url","week","area"],this.value="",this.vertical=!1,this._type="text",this.onValueChange=new Event("input")}set type(e){this._inputTypes.includes(e)&&(this._type=e)}get type(){return this._type}get query(){return na(this.value)}onInputChange(e){e.stopPropagation();const t=e.target;clearTimeout(this._debounceTimeoutID),this._debounceTimeoutID=setTimeout(()=>{this.value=t.value,this.dispatchEvent(this.onValueChange)},this.debounce)}focus(){setTimeout(()=>{var e;const t=(e=this.shadowRoot)==null?void 0:e.querySelector("input");t==null||t.focus()})}render(){return X`
|
|
1733
|
+
<bim-input
|
|
1734
|
+
.name=${this.name}
|
|
1735
|
+
.icon=${this.icon}
|
|
1736
|
+
.label=${this.label}
|
|
1737
|
+
.vertical=${this.vertical}
|
|
1738
|
+
>
|
|
1739
|
+
${this.type==="area"?X` <textarea
|
|
1740
|
+
aria-label=${this.label||this.name||"Text Input"}
|
|
1741
|
+
.value=${this.value}
|
|
1742
|
+
.rows=${this.rows??5}
|
|
1743
|
+
placeholder=${pc(this.placeholder)}
|
|
1744
|
+
@input=${this.onInputChange}
|
|
1745
|
+
></textarea>`:X` <input
|
|
1746
|
+
aria-label=${this.label||this.name||"Text Input"}
|
|
1747
|
+
.type=${this.type}
|
|
1748
|
+
.value=${this.value}
|
|
1749
|
+
placeholder=${pc(this.placeholder)}
|
|
1750
|
+
@input=${this.onInputChange}
|
|
1751
|
+
/>`}
|
|
1752
|
+
</bim-input>
|
|
1753
|
+
`}};yd.styles=[ti.scrollbar,yt`
|
|
1754
|
+
:host {
|
|
1755
|
+
--bim-input--bgc: var(--bim-ui_bg-contrast-20);
|
|
1756
|
+
flex: 1;
|
|
1757
|
+
display: block;
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
input,
|
|
1761
|
+
textarea {
|
|
1762
|
+
font-family: inherit;
|
|
1763
|
+
background-color: transparent;
|
|
1764
|
+
border: none;
|
|
1765
|
+
width: 100%;
|
|
1766
|
+
padding: var(--bim-ui_size-3xs);
|
|
1767
|
+
color: var(--bim-text-input--c, var(--bim-ui_bg-contrast-100));
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1770
|
+
input {
|
|
1771
|
+
outline: none;
|
|
1772
|
+
height: 100%;
|
|
1773
|
+
padding: 0 var(--bim-ui_size-3xs); /* Override padding */
|
|
1774
|
+
border-radius: var(--bim-text-input--bdrs, var(--bim-ui_size-4xs));
|
|
1775
|
+
}
|
|
1776
|
+
|
|
1777
|
+
textarea {
|
|
1778
|
+
line-height: 1.1rem;
|
|
1779
|
+
resize: vertical;
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
:host(:focus) {
|
|
1783
|
+
--bim-input--olc: var(--bim-ui_accent-base);
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1786
|
+
/* :host([disabled]) {
|
|
1787
|
+
--bim-input--bgc: var(--bim-ui_bg-contrast-20);
|
|
1788
|
+
} */
|
|
1789
|
+
`];let Re=yd;Ue([W({type:String,reflect:!0})],Re.prototype,"icon",2);Ue([W({type:String,reflect:!0})],Re.prototype,"label",2);Ue([W({type:String,reflect:!0})],Re.prototype,"name",2);Ue([W({type:String,reflect:!0})],Re.prototype,"placeholder",2);Ue([W({type:String,reflect:!0})],Re.prototype,"value",2);Ue([W({type:Boolean,reflect:!0})],Re.prototype,"vertical",2);Ue([W({type:Number,reflect:!0})],Re.prototype,"debounce",2);Ue([W({type:Number,reflect:!0})],Re.prototype,"rows",2);Ue([W({type:String,reflect:!0})],Re.prototype,"type",1);var $0=Object.defineProperty,V0=Object.getOwnPropertyDescriptor,_d=(r,e,t,i)=>{for(var s=i>1?void 0:i?V0(e,t):e,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&$0(e,t,s),s};const Td=class extends It{constructor(){super(...arguments),this.rows=2,this._vertical=!1}set vertical(e){this._vertical=e,this.updateChildren()}get vertical(){return this._vertical}updateChildren(){const e=this.children;for(const t of e)this.vertical?t.setAttribute("label-hidden",""):t.removeAttribute("label-hidden")}render(){return X`
|
|
1790
|
+
<style>
|
|
1791
|
+
.parent {
|
|
1792
|
+
grid-auto-flow: ${this.vertical?"row":"column"};
|
|
1793
|
+
grid-template-rows: repeat(${this.rows}, 1fr);
|
|
1794
|
+
}
|
|
1795
|
+
</style>
|
|
1796
|
+
<div class="parent">
|
|
1797
|
+
<slot @slotchange=${this.updateChildren}></slot>
|
|
1798
|
+
</div>
|
|
1799
|
+
`}};Td.styles=yt`
|
|
1800
|
+
.parent {
|
|
1801
|
+
display: grid;
|
|
1802
|
+
gap: 0.25rem;
|
|
1803
|
+
}
|
|
1804
|
+
|
|
1805
|
+
::slotted(bim-button[label]:not([vertical])) {
|
|
1806
|
+
--bim-button--jc: flex-start;
|
|
1807
|
+
}
|
|
1808
|
+
|
|
1809
|
+
::slotted(bim-button) {
|
|
1810
|
+
--bim-label--c: var(--bim-ui_bg-contrast-80);
|
|
1811
|
+
}
|
|
1812
|
+
`;let jr=Td;_d([W({type:Number,reflect:!0})],jr.prototype,"rows",2);_d([W({type:Boolean,reflect:!0})],jr.prototype,"vertical",1);var G0=Object.defineProperty,H0=Object.getOwnPropertyDescriptor,Xr=(r,e,t,i)=>{for(var s=i>1?void 0:i?H0(e,t):e,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&G0(e,t,s),s};const vd=class extends It{constructor(){super(...arguments),this._vertical=!1,this._labelHidden=!1}set vertical(e){this._vertical=e,this.updateChildren()}get vertical(){return this._vertical}set labelHidden(e){this._labelHidden=e,this.updateChildren()}get labelHidden(){return this._labelHidden}updateChildren(){const e=this.children;for(const t of e)t instanceof jr&&(t.vertical=this.vertical),t.toggleAttribute("label-hidden",this.vertical)}render(){return X`
|
|
1813
|
+
<div class="parent">
|
|
1814
|
+
<div class="children">
|
|
1815
|
+
<slot @slotchange=${this.updateChildren}></slot>
|
|
1816
|
+
</div>
|
|
1817
|
+
${!this.labelHidden&&(this.label||this.icon)?X`<bim-label .icon=${this.icon}>${this.label}</bim-label>`:null}
|
|
1818
|
+
</div>
|
|
1819
|
+
`}};vd.styles=yt`
|
|
1820
|
+
:host {
|
|
1821
|
+
--bim-label--fz: var(--bim-ui_size-xs);
|
|
1822
|
+
--bim-label--c: var(--bim-ui_bg-contrast-60);
|
|
1823
|
+
display: block;
|
|
1824
|
+
flex: 1;
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1827
|
+
:host(:not([vertical])) ::slotted(bim-button[vertical]) {
|
|
1828
|
+
--bim-icon--fz: var(--bim-ui_size-5xl);
|
|
1829
|
+
min-height: 3.75rem;
|
|
1830
|
+
}
|
|
1831
|
+
|
|
1832
|
+
::slotted(bim-button) {
|
|
1833
|
+
--bim-label--c: var(--bim-ui_bg-contrast-80);
|
|
1834
|
+
}
|
|
1835
|
+
|
|
1836
|
+
.parent {
|
|
1837
|
+
display: flex;
|
|
1838
|
+
flex-direction: column;
|
|
1839
|
+
gap: 0.5rem;
|
|
1840
|
+
align-items: center;
|
|
1841
|
+
padding: 0.5rem;
|
|
1842
|
+
height: 100%;
|
|
1843
|
+
box-sizing: border-box;
|
|
1844
|
+
justify-content: space-between;
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1847
|
+
:host([vertical]) .parent {
|
|
1848
|
+
flex-direction: row-reverse;
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1851
|
+
:host([vertical]) .parent > bim-label {
|
|
1852
|
+
writing-mode: tb;
|
|
1853
|
+
}
|
|
1854
|
+
|
|
1855
|
+
.children {
|
|
1856
|
+
display: flex;
|
|
1857
|
+
gap: 0.25rem;
|
|
1858
|
+
}
|
|
1859
|
+
|
|
1860
|
+
:host([vertical]) .children {
|
|
1861
|
+
flex-direction: column;
|
|
1862
|
+
}
|
|
1863
|
+
`;let ls=vd;Xr([W({type:String,reflect:!0})],ls.prototype,"label",2);Xr([W({type:String,reflect:!0})],ls.prototype,"icon",2);Xr([W({type:Boolean,reflect:!0})],ls.prototype,"vertical",1);Xr([W({type:Boolean,attribute:"label-hidden",reflect:!0})],ls.prototype,"labelHidden",1);var Y0=Object.defineProperty,W0=Object.getOwnPropertyDescriptor,Pa=(r,e,t,i)=>{for(var s=i>1?void 0:i?W0(e,t):e,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&Y0(e,t,s),s};const wd=class extends It{constructor(){super(...arguments),this.labelsHidden=!1,this._vertical=!1,this._hidden=!1}set vertical(e){this._vertical=e,this.updateSections()}get vertical(){return this._vertical}set hidden(e){this._hidden=e,this.dispatchEvent(new Event("hiddenchange"))}get hidden(){return this._hidden}updateSections(){const e=this.children;for(const t of e)t instanceof ls&&(t.labelHidden=this.vertical&&!r0.config.sectionLabelOnVerticalToolbar,t.vertical=this.vertical)}render(){return X`
|
|
1864
|
+
<div class="parent">
|
|
1865
|
+
<slot @slotchange=${this.updateSections}></slot>
|
|
1866
|
+
</div>
|
|
1867
|
+
`}};wd.styles=yt`
|
|
1868
|
+
:host {
|
|
1869
|
+
--bim-button--bgc: transparent;
|
|
1870
|
+
background-color: var(--bim-ui_bg-base);
|
|
1871
|
+
border-radius: var(--bim-ui_size-2xs);
|
|
1872
|
+
display: block;
|
|
1873
|
+
}
|
|
1874
|
+
|
|
1875
|
+
:host([hidden]) {
|
|
1876
|
+
display: none;
|
|
1877
|
+
}
|
|
1878
|
+
|
|
1879
|
+
.parent {
|
|
1880
|
+
display: flex;
|
|
1881
|
+
width: min-content;
|
|
1882
|
+
pointer-events: auto;
|
|
1883
|
+
}
|
|
1884
|
+
|
|
1885
|
+
:host([vertical]) .parent {
|
|
1886
|
+
flex-direction: column;
|
|
1887
|
+
}
|
|
1888
|
+
|
|
1889
|
+
:host([vertical]) {
|
|
1890
|
+
width: min-content;
|
|
1891
|
+
border-radius: var(--bim-ui_size-2xs);
|
|
1892
|
+
border: 1px solid var(--bim-ui_bg-contrast-20);
|
|
1893
|
+
}
|
|
1894
|
+
|
|
1895
|
+
::slotted(bim-toolbar-section:not(:last-child)) {
|
|
1896
|
+
border-right: 1px solid var(--bim-ui_bg-contrast-20);
|
|
1897
|
+
border-bottom: none;
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
:host([vertical]) ::slotted(bim-toolbar-section:not(:last-child)) {
|
|
1901
|
+
border-bottom: 1px solid var(--bim-ui_bg-contrast-20);
|
|
1902
|
+
border-right: none;
|
|
1903
|
+
}
|
|
1904
|
+
`;let Zr=wd;Pa([W({type:String,reflect:!0})],Zr.prototype,"icon",2);Pa([W({type:Boolean,attribute:"labels-hidden",reflect:!0})],Zr.prototype,"labelsHidden",2);Pa([W({type:Boolean,reflect:!0})],Zr.prototype,"vertical",1);var j0=Object.defineProperty,X0=(r,e,t,i)=>{for(var s=void 0,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=o(e,t,s)||s);return s&&j0(e,t,s),s};const Ad=class extends It{constructor(){super(),this._onResize=new Event("resize"),new ResizeObserver(()=>{setTimeout(()=>{this.dispatchEvent(this._onResize)})}).observe(this)}render(){return X`
|
|
1905
|
+
<div class="parent">
|
|
1906
|
+
<slot></slot>
|
|
1907
|
+
</div>
|
|
1908
|
+
`}};Ad.styles=yt`
|
|
1909
|
+
:host {
|
|
1910
|
+
display: grid;
|
|
1911
|
+
min-width: 0;
|
|
1912
|
+
min-height: 0;
|
|
1913
|
+
height: 100%;
|
|
1914
|
+
}
|
|
1915
|
+
|
|
1916
|
+
.parent {
|
|
1917
|
+
overflow: hidden;
|
|
1918
|
+
position: relative;
|
|
1919
|
+
}
|
|
1920
|
+
`;let Rd=Ad;X0([W({type:String,reflect:!0})],Rd.prototype,"name");/**
|
|
1921
|
+
* @license
|
|
1922
|
+
* Copyright 2018 Google LLC
|
|
1923
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1924
|
+
*/const Sd="important",Z0=" !"+Sd,xe=wh(class extends Ah{constructor(r){var e;if(super(r),r.type!==vh.ATTRIBUTE||r.name!=="style"||((e=r.strings)==null?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(r){return Object.keys(r).reduce((e,t)=>{const i=r[t];return i==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${i};`},"")}update(r,[e]){const{style:t}=r.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(const i of this.ft)e[i]==null&&(this.ft.delete(i),i.includes("-")?t.removeProperty(i):t[i]=null);for(const i in e){const s=e[i];if(s!=null){this.ft.add(i);const n=typeof s=="string"&&s.endsWith(Z0);i.includes("-")||n?t.setProperty(i,n?s.slice(0,-11):s,n?Sd:""):t[i]=s}}return Ii}});/**
|
|
1925
|
+
* @license
|
|
1926
|
+
* Copyright 2017 Google LLC
|
|
1927
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1928
|
+
*/const Us=globalThis,hr=Us.trustedTypes,mc=hr?hr.createPolicy("lit-html",{createHTML:r=>r}):void 0,Fd="$lit$",He=`lit$${Math.random().toFixed(9).slice(2)}$`,Od="?"+He,q0=`<${Od}>`,Ci=document,dr=()=>Ci.createComment(""),Qs=r=>r===null||typeof r!="object"&&typeof r!="function",La=Array.isArray,Q0=r=>La(r)||typeof(r==null?void 0:r[Symbol.iterator])=="function",So=`[
|
|
1929
|
+
\f\r]`,Ss=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,gc=/-->/g,Ec=/>/g,li=RegExp(`>|${So}(?:([^\\s"'>=/]+)(${So}*=${So}*(?:[^
|
|
1930
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),bc=/'/g,Ic=/"/g,xd=/^(?:script|style|textarea|title)$/i,Ks=Symbol.for("lit-noChange"),Bt=Symbol.for("lit-nothing"),Cc=new WeakMap,ui=Ci.createTreeWalker(Ci,129);function Nd(r,e){if(!La(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return mc!==void 0?mc.createHTML(e):e}const K0=(r,e)=>{const t=r.length-1,i=[];let s,n=e===2?"<svg>":e===3?"<math>":"",o=Ss;for(let a=0;a<t;a++){const l=r[a];let c,h,d=-1,u=0;for(;u<l.length&&(o.lastIndex=u,h=o.exec(l),h!==null);)u=o.lastIndex,o===Ss?h[1]==="!--"?o=gc:h[1]!==void 0?o=Ec:h[2]!==void 0?(xd.test(h[2])&&(s=RegExp("</"+h[2],"g")),o=li):h[3]!==void 0&&(o=li):o===li?h[0]===">"?(o=s??Ss,d=-1):h[1]===void 0?d=-2:(d=o.lastIndex-h[2].length,c=h[1],o=h[3]===void 0?li:h[3]==='"'?Ic:bc):o===Ic||o===bc?o=li:o===gc||o===Ec?o=Ss:(o=li,s=void 0);const f=o===li&&r[a+1].startsWith("/>")?" ":"";n+=o===Ss?l+q0:d>=0?(i.push(c),l.slice(0,d)+Fd+l.slice(d)+He+f):l+He+(d===-2?a:f)}return[Nd(r,n+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),i]};class Js{constructor({strings:e,_$litType$:t},i){let s;this.parts=[];let n=0,o=0;const a=e.length-1,l=this.parts,[c,h]=K0(e,t);if(this.el=Js.createElement(c,i),ui.currentNode=this.el.content,t===2||t===3){const d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(s=ui.nextNode())!==null&&l.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(const d of s.getAttributeNames())if(d.endsWith(Fd)){const u=h[o++],f=s.getAttribute(d).split(He),p=/([.?@])?(.*)/.exec(u);l.push({type:1,index:n,name:p[2],strings:f,ctor:p[1]==="."?tE:p[1]==="?"?eE:p[1]==="@"?iE:Qr}),s.removeAttribute(d)}else d.startsWith(He)&&(l.push({type:6,index:n}),s.removeAttribute(d));if(xd.test(s.tagName)){const d=s.textContent.split(He),u=d.length-1;if(u>0){s.textContent=hr?hr.emptyScript:"";for(let f=0;f<u;f++)s.append(d[f],dr()),ui.nextNode(),l.push({type:2,index:++n});s.append(d[u],dr())}}}else if(s.nodeType===8)if(s.data===Od)l.push({type:2,index:n});else{let d=-1;for(;(d=s.data.indexOf(He,d+1))!==-1;)l.push({type:7,index:n}),d+=He.length-1}n++}}static createElement(e,t){const i=Ci.createElement("template");return i.innerHTML=e,i}}function Qi(r,e,t=r,i){var o,a;if(e===Ks)return e;let s=i!==void 0?(o=t.o)==null?void 0:o[i]:t.l;const n=Qs(e)?void 0:e._$litDirective$;return(s==null?void 0:s.constructor)!==n&&((a=s==null?void 0:s._$AO)==null||a.call(s,!1),n===void 0?s=void 0:(s=new n(r),s._$AT(r,t,i)),i!==void 0?(t.o??(t.o=[]))[i]=s:t.l=s),s!==void 0&&(e=Qi(r,s._$AS(r,e.values),s,i)),e}class J0{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:i}=this._$AD,s=((e==null?void 0:e.creationScope)??Ci).importNode(t,!0);ui.currentNode=s;let n=ui.nextNode(),o=0,a=0,l=i[0];for(;l!==void 0;){if(o===l.index){let c;l.type===2?c=new qr(n,n.nextSibling,this,e):l.type===1?c=new l.ctor(n,l.name,l.strings,this,e):l.type===6&&(c=new sE(n,this,e)),this._$AV.push(c),l=i[++a]}o!==(l==null?void 0:l.index)&&(n=ui.nextNode(),o++)}return ui.currentNode=Ci,s}p(e){let t=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}}class qr{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this.v}constructor(e,t,i,s){this.type=2,this._$AH=Bt,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=s,this.v=(s==null?void 0:s.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Qi(this,e,t),Qs(e)?e===Bt||e==null||e===""?(this._$AH!==Bt&&this._$AR(),this._$AH=Bt):e!==this._$AH&&e!==Ks&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Q0(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==Bt&&Qs(this._$AH)?this._$AA.nextSibling.data=e:this.T(Ci.createTextNode(e)),this._$AH=e}$(e){var n;const{values:t,_$litType$:i}=e,s=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=Js.createElement(Nd(i.h,i.h[0]),this.options)),i);if(((n=this._$AH)==null?void 0:n._$AD)===s)this._$AH.p(t);else{const o=new J0(s,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=Cc.get(e.strings);return t===void 0&&Cc.set(e.strings,t=new Js(e)),t}k(e){La(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,s=0;for(const n of e)s===t.length?t.push(i=new qr(this.O(dr()),this.O(dr()),this,this.options)):i=t[s],i._$AI(n),s++;s<t.length&&(this._$AR(i&&i._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,t);e&&e!==this._$AB;){const s=e.nextSibling;e.remove(),e=s}}setConnected(e){var t;this._$AM===void 0&&(this.v=e,(t=this._$AP)==null||t.call(this,e))}}class Qr{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,s,n){this.type=1,this._$AH=Bt,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=n,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=Bt}_$AI(e,t=this,i,s){const n=this.strings;let o=!1;if(n===void 0)e=Qi(this,e,t,0),o=!Qs(e)||e!==this._$AH&&e!==Ks,o&&(this._$AH=e);else{const a=e;let l,c;for(e=n[0],l=0;l<n.length-1;l++)c=Qi(this,a[i+l],t,l),c===Ks&&(c=this._$AH[l]),o||(o=!Qs(c)||c!==this._$AH[l]),c===Bt?e=Bt:e!==Bt&&(e+=(c??"")+n[l+1]),this._$AH[l]=c}o&&!s&&this.j(e)}j(e){e===Bt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class tE extends Qr{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Bt?void 0:e}}class eE extends Qr{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Bt)}}class iE extends Qr{constructor(e,t,i,s,n){super(e,t,i,s,n),this.type=5}_$AI(e,t=this){if((e=Qi(this,e,t,0)??Bt)===Ks)return;const i=this._$AH,s=e===Bt&&i!==Bt||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,n=e!==Bt&&(i===Bt||s);s&&this.element.removeEventListener(this.name,this,i),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}}class sE{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){Qi(this,e)}}const Fo=Us.litHtmlPolyfillSupport;Fo==null||Fo(Js,qr),(Us.litHtmlVersions??(Us.litHtmlVersions=[])).push("3.2.0");/**
|
|
1931
|
+
* @license
|
|
1932
|
+
* Copyright 2020 Google LLC
|
|
1933
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1934
|
+
*/const nE=()=>new rE;class rE{}const oE=r=>{const{components:e,topic:t,onCancel:i,onSubmit:s,styles:n}=r,o=s??(()=>{}),a=e.get(Mt),l=(t==null?void 0:t.title)??null,c=(t==null?void 0:t.status)??null,h=(t==null?void 0:t.type)??null,d=(t==null?void 0:t.priority)??null,u=(t==null?void 0:t.assignedTo)??null,f=(t==null?void 0:t.labels)??null,p=(t==null?void 0:t.stage)??null,m=(t==null?void 0:t.description)??null,E=t!=null&&t.dueDate?t.dueDate.toISOString().split("T")[0]:null,g=new Set([...a.config.statuses]);c&&g.add(c);const I=new Set([...a.config.types]);h&&I.add(h);const T=new Set([...a.config.priorities]);d&&T.add(d);const b=new Set([...a.config.users]);u&&b.add(u);const v=new Set([...a.config.labels]);if(f)for(const R of f)v.add(R);const A=new Set([...a.config.stages]);p&&A.add(p);const S=nE(),N=async()=>{const{value:R}=S;if(!R)return;Object.values(R.valueTransform).length===0&&(R.valueTransform={dueDate:M=>{if(typeof M=="string"&&M.trim()!=="")return new Date(M)},status:M=>{if(Array.isArray(M)&&M.length!==0)return M[0]},type:M=>{if(Array.isArray(M)&&M.length!==0)return M[0]},priority:M=>{if(Array.isArray(M)&&M.length!==0)return M[0]},assignedTo:M=>{if(Array.isArray(M)&&M.length!==0)return M[0]}});const P=R.value;if(t)t.set(P),await o(t);else{const M=a.create(P);await o(M)}};return X`
|
|
1935
|
+
<bim-panel style="border-radius: var(--bim-ui_size-base); outline: 2px solid var(--bim-ui_bg-contrast-20); width: 22rem;">
|
|
1936
|
+
<bim-panel-section ${we(S)} fixed label="New Topic" name="topic">
|
|
1937
|
+
<div style="display: flex; gap: 0.375rem">
|
|
1938
|
+
<bim-text-input vertical label="Title" name="title" .value=${l}></bim-text-input>
|
|
1939
|
+
${t?X`
|
|
1940
|
+
<bim-dropdown vertical label="Status" name="status" required>
|
|
1941
|
+
${[...g].map(R=>X`<bim-option label=${R} .checked=${c===R}></bim-option>`)}
|
|
1942
|
+
</bim-dropdown>`:X``}
|
|
1943
|
+
</div>
|
|
1944
|
+
<div style="display: flex; gap: 0.375rem">
|
|
1945
|
+
<bim-dropdown vertical label="Type" name="type" required>
|
|
1946
|
+
${[...I].map(R=>X`<bim-option label=${R} .checked=${h===R}></bim-option>`)}
|
|
1947
|
+
</bim-dropdown>
|
|
1948
|
+
<bim-dropdown vertical label="Priority" name="priority">
|
|
1949
|
+
${[...T].map(R=>X`<bim-option label=${R} .checked=${d===R}></bim-option>`)}
|
|
1950
|
+
</bim-dropdown>
|
|
1951
|
+
</div>
|
|
1952
|
+
<div style="display: flex; gap: 0.375rem">
|
|
1953
|
+
<bim-dropdown vertical label="Labels" name="labels" multiple>
|
|
1954
|
+
${[...v].map(R=>X`<bim-option label=${R} .checked=${f==null?void 0:f.has(R)}></bim-option>`)}
|
|
1955
|
+
</bim-dropdown>
|
|
1956
|
+
<bim-dropdown vertical label="Assignee" name="assignedTo">
|
|
1957
|
+
${[...b].map(R=>{const P=n!=null&&n.users?n.users[R]:null,M=P?P.name:R,w=P==null?void 0:P.picture;return X`<bim-option label=${M} value=${R} .img=${w} .checked=${u===R}></bim-option>`})}
|
|
1958
|
+
</bim-dropdown>
|
|
1959
|
+
</div>
|
|
1960
|
+
<div style="display: flex; gap: 0.375rem">
|
|
1961
|
+
<bim-text-input vertical type="date" label="Due Date" name="dueDate" .value=${E}></bim-text-input>
|
|
1962
|
+
<bim-dropdown vertical label="Stage" name="stage">
|
|
1963
|
+
${[...A].map(R=>X`<bim-option label=${R} .checked=${p===R}></bim-option>`)}
|
|
1964
|
+
</bim-dropdown>
|
|
1965
|
+
</div>
|
|
1966
|
+
<bim-text-input vertical label="Description" name="description" type="area" .value=${m??null}></bim-text-input>
|
|
1967
|
+
<div style="justify-content: right; display: flex; gap: 0.375rem">
|
|
1968
|
+
<style>
|
|
1969
|
+
#A7T9K {
|
|
1970
|
+
background-color: transparent;
|
|
1971
|
+
}
|
|
1972
|
+
|
|
1973
|
+
#A7T9K:hover {
|
|
1974
|
+
--bim-label--c: #FF5252;
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1977
|
+
#W3F2J:hover {
|
|
1978
|
+
background-color: #329936;
|
|
1979
|
+
}
|
|
1980
|
+
</style>
|
|
1981
|
+
<bim-button @click=${i} style="flex: 0" id="A7T9K" label="Cancel"></bim-button>
|
|
1982
|
+
<bim-button @click=${N} style="flex: 0" id="W3F2J" label=${t?"Update Topic":"Add Topic"} icon=${t?"tabler:refresh":"mi:add"}></bim-button>
|
|
1983
|
+
</div>
|
|
1984
|
+
</bim-panel-section>
|
|
1985
|
+
</bim-panel>
|
|
1986
|
+
`},aE=r=>Ae.create(oE,r),lE=r=>{var c;const{components:e,topic:t,actions:i}=r,s={selectComponents:!0,colorizeComponent:!0,resetColors:!0,updateCamera:!0,delete:!0,unlink:!!t,...i},n=e.get(Ht),o=((c=r.topic)==null?void 0:c.viewpoints)??n.list.keys(),a=[];for(const h of o){const d=n.list.get(h);d&&a.push(d)}return X`
|
|
1987
|
+
<bim-table ${we(h=>{if(!h)return;const d=h;d.addEventListener("cellcreated",({detail:u})=>{const{cell:f}=u;f.style.padding="0.25rem"}),d.headersHidden=!0,d.hiddenColumns=["Guid"],d.columns=["Title",{name:"Actions",width:"auto"}],d.dataTransform={Actions:(u,f)=>{const{Guid:p}=f;if(!(p&&typeof p=="string"))return p;const m=e.get(Ht),E=m.list.get(p);return E?X`
|
|
1988
|
+
<bim-button icon="ph:eye-fill" @click=${()=>E.go()}></bim-button>
|
|
1989
|
+
${Object.values(s).includes(!0)?X`
|
|
1990
|
+
<bim-button icon="prime:ellipsis-v">
|
|
1991
|
+
<bim-context-menu>
|
|
1992
|
+
${s.selectComponents?X`<bim-button label="Select Components" @click=${()=>console.log(E.selection)}></bim-button> `:null}
|
|
1993
|
+
${s.colorizeComponent?X`<bim-button label="Colorize Components" @click=${()=>E.colorize()}></bim-button> `:null}
|
|
1994
|
+
${s.resetColors?X`<bim-button label="Reset Colors" @click=${()=>E.resetColors()}></bim-button> `:null}
|
|
1995
|
+
${s.updateCamera?X`<bim-button label="Update Camera" @click=${()=>E.updateCamera()}></bim-button> `:null}
|
|
1996
|
+
${s.unlink?X`<bim-button .disabled=${!t} label="Unlink" @click=${()=>t==null?void 0:t.viewpoints.delete(E.guid)}></bim-button> `:null}
|
|
1997
|
+
${s.delete?X`<bim-button label="Delete" @click=${()=>m.list.delete(E.guid)}></bim-button>`:null}
|
|
1998
|
+
</bim-context-menu>
|
|
1999
|
+
</bim-button>
|
|
2000
|
+
`:null}
|
|
2001
|
+
`:p}},d.data=a.map((u,f)=>({data:{Guid:u.guid,Title:u.title??`Viewpoint ${r.topic?f+1:""}`,Actions:""}}))})}>
|
|
2002
|
+
<bim-label slot="missing-data" icon="ph:warning-fill" style="--bim-icon--c: gold;">No viewpoints to show</bim-label>
|
|
2003
|
+
</bim-table>
|
|
2004
|
+
`},Ma=(r,e=!0)=>{const t=Ae.create(lE,r),{components:i,topic:s}=r;if(e){const[,n]=t,o=i.get(Ht);o.list.onItemUpdated.add(()=>n()),o.list.onItemDeleted.add(()=>n()),o.list.onCleared.add(()=>n()),s?(s.viewpoints.onItemAdded.add(()=>n()),s.viewpoints.onItemDeleted.add(()=>n()),s.viewpoints.onCleared.add(()=>n())):o.list.onItemSet.add(()=>n())}return t},cE={"jhon.doe@example.com":{name:"Jhon Doe",picture:"https://www.profilebakery.com/wp-content/uploads/2023/04/Profile-Image-AI.jpg"}},hE=(r,e)=>{const i=(e??cE)[r],s=(i==null?void 0:i.name)??r,n=s.trim().split(/\s+/);let o,a;return n[0]&&n[0][0]&&(o=n[0][0].toUpperCase(),n[0][1]&&(a=n[0][1].toUpperCase())),n[1]&&n[1][0]&&(a=n[1][0].toUpperCase()),X`
|
|
2005
|
+
<div style="display: flex; gap: 0.25rem; overflow: hidden;">
|
|
2006
|
+
${!(i!=null&&i.picture)&&(o||a)?X`
|
|
2007
|
+
<bim-label
|
|
2008
|
+
style=${xe({borderRadius:"999px",padding:"0.375rem",backgroundColor:"var(--bim-ui_bg-contrast-20)",aspectRatio:"1",fontSize:"0.7rem"})}>${o}${a}</bim-label>
|
|
2009
|
+
`:null}
|
|
2010
|
+
<bim-label .img=${i==null?void 0:i.picture}>${s}</bim-label>
|
|
2011
|
+
</div>
|
|
2012
|
+
`},dE=r=>{const{topic:e,styles:t,viewpoint:i,actions:s}=r,n={delete:!0,...s};return X`<bim-table @cellcreated=${({detail:a})=>{const{cell:l}=a;l.style.marginLeft="0"}} ${we(a=>{if(!a)return;const l=a;l.headersHidden=!0,l.hiddenColumns=["guid","author"],l.dataTransform={Comment:(h,d)=>{const{guid:u}=d;if(typeof u!="string")return h;const f=e.comments.get(u);if(!f)return h;const p=()=>{e.comments.delete(u)};return X`
|
|
2013
|
+
<div style="display: flex; flex-direction: column; gap: 0.25rem; flex: 1">
|
|
2014
|
+
<div style="display: flex; justify-content: space-between;">
|
|
2015
|
+
<div style="display: flex; gap: 0.375rem;">
|
|
2016
|
+
${hE(f.author,t)}
|
|
2017
|
+
<bim-label style="color: var(--bim-ui_bg-contrast-40)">@ ${f.date.toDateString()}</bim-label>
|
|
2018
|
+
</div>
|
|
2019
|
+
<div>
|
|
2020
|
+
<style>
|
|
2021
|
+
#TCDBT {
|
|
2022
|
+
background-color: transparent;
|
|
2023
|
+
--bim-label--c: var(--bim-ui_bg-contrast-60)
|
|
2024
|
+
}
|
|
2025
|
+
|
|
2026
|
+
#TCDBT:hover {
|
|
2027
|
+
--bim-label--c: #FF5252;
|
|
2028
|
+
}
|
|
2029
|
+
</style>
|
|
2030
|
+
${n!=null&&n.delete?X`<bim-button @click=${p} id="TCDBT" icon="majesticons:delete-bin"></bim-button>`:null}
|
|
2031
|
+
</div>
|
|
2032
|
+
</div>
|
|
2033
|
+
<bim-label style="margin-left: 1.7rem; white-space: normal">${f.comment}</bim-label>
|
|
2034
|
+
</div>
|
|
2035
|
+
`}};let c=e.comments.values();i&&(c=[...e.comments.values()].filter(h=>h.viewpoint===i)),l.data=[...c].map(h=>({data:{guid:h.guid,Comment:h.comment,author:(()=>{const d=t;if(!d)return h.author;const u=d[h.author];return(u==null?void 0:u.name)??h.author})()}}))})}><bim-label slot="missing-data" icon="ph:warning-fill" style="--bim-icon--c: gold;">This topic has no comments</bim-label></bim-table>`},uE=(r,e=!0)=>{const t=Ae.create(dE,r);if(e){const{topic:i}=r,[s,n]=t;i.comments.onItemSet.add(()=>n()),i.comments.onItemUpdated.add(()=>n()),i.comments.onItemDeleted.add(()=>n()),i.comments.onCleared.add(()=>n())}return t},Wn={users:{"jhon.doe@example.com":{name:"Jhon Doe"}},priorities:{"On hold":{icon:"flowbite:circle-pause-outline",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#767676"}},Minor:{icon:"mingcute:arrows-down-fill",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#4CAF50"}},Normal:{icon:"fa6-solid:grip-lines",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FB8C00"}},Major:{icon:"mingcute:arrows-up-fill",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Critical:{icon:"ph:warning",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FB8C00"}}},statuses:{Active:{icon:"prime:circle-fill",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)"}},"In Progress":{icon:"prime:circle-fill",style:{backgroundColor:"#fa89004d","--bim-label--c":"#FB8C00","--bim-icon--c":"#FB8C00"}},"In Review":{icon:"prime:circle-fill",style:{backgroundColor:"#9c6bff4d","--bim-label--c":"#9D6BFF","--bim-icon--c":"#9D6BFF"}},Done:{icon:"prime:circle-fill",style:{backgroundColor:"#4CAF504D","--bim-label--c":"#4CAF50","--bim-icon--c":"#4CAF50"}},Closed:{icon:"prime:circle-fill",style:{backgroundColor:"#414141","--bim-label--c":"#727272","--bim-icon--c":"#727272"}}},types:{Clash:{icon:"gg:close-r",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FB8C00"}},Issue:{icon:"mdi:bug-outline",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Failure:{icon:"mdi:bug-outline",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Inquiry:{icon:"majesticons:comment-line",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Fault:{icon:"ph:warning",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Remark:{icon:"ph:note-blank-bold",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FB8C00"}},Request:{icon:"mynaui:edit-one",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#9D6BFF"}}}},Oo={padding:"0.25rem 0.5rem",borderRadius:"999px","--bim-label--c":"var(--bim-ui_bg-contrast-100)"},yc=(r,e)=>{const i=((e==null?void 0:e.users)??Wn.users)[r],s=(i==null?void 0:i.name)??r,n=s.trim().split(/\s+/);let o,a;return n[0]&&n[0][0]&&(o=n[0][0].toUpperCase(),n[0][1]&&(a=n[0][1].toUpperCase())),n[1]&&n[1][0]&&(a=n[1][0].toUpperCase()),X`
|
|
2036
|
+
<div style="display: flex; gap: 0.25rem; overflow: hidden;">
|
|
2037
|
+
${!(i!=null&&i.picture)&&(o||a)?X`
|
|
2038
|
+
<bim-label
|
|
2039
|
+
style=${xe({borderRadius:"999px",padding:"0.375rem",backgroundColor:"var(--bim-ui_bg-contrast-20)",aspectRatio:"1",fontSize:"0.7rem"})}>${o}${a}</bim-label>
|
|
2040
|
+
`:null}
|
|
2041
|
+
<bim-label .img=${i==null?void 0:i.picture}>${s}</bim-label>
|
|
2042
|
+
</div>
|
|
2043
|
+
`},fE=r=>{const{components:e,dataStyles:t,onTopicEnter:i}=r,s=e.get(Mt),n=r.topics??s.list.values();return X`
|
|
2044
|
+
<bim-table @cellcreated=${({detail:a})=>{const{cell:l}=a;l.style.marginLeft="0"}} ${we(a=>{if(!a)return;const l=a;l.hiddenColumns=["Guid"],l.columns=["Title"],l.selectableRows=!0,l.dataTransform={Title:(c,h)=>{const{Guid:d}=h;if(typeof d!="string")return c;const u=s.list.get(d);return u?X`
|
|
2045
|
+
<div style="display: flex; overflow: hidden;">
|
|
2046
|
+
<style>
|
|
2047
|
+
#BBETO {
|
|
2048
|
+
background-color: transparent
|
|
2049
|
+
}
|
|
2050
|
+
|
|
2051
|
+
#BBETO:hover {
|
|
2052
|
+
--bim-label--c: var(--bim-ui_accent-base)
|
|
2053
|
+
}
|
|
2054
|
+
</style>
|
|
2055
|
+
<bim-button @click=${()=>{i&&i(u)}} id="BBETO" icon="iconamoon:enter-duotone"></bim-button>
|
|
2056
|
+
<bim-label>${c}</bim-label>
|
|
2057
|
+
</div>`:c},Priority:c=>{if(typeof c!="string")return c;const d=((t==null?void 0:t.priorities)??Wn.priorities)[c];return X`
|
|
2058
|
+
<bim-label
|
|
2059
|
+
.icon=${d==null?void 0:d.icon}
|
|
2060
|
+
style=${xe({...Oo,...d==null?void 0:d.style})}
|
|
2061
|
+
>${c}
|
|
2062
|
+
</bim-label>
|
|
2063
|
+
`},Status:c=>{if(typeof c!="string")return c;const d=((t==null?void 0:t.statuses)??Wn.statuses)[c];return X`
|
|
2064
|
+
<bim-label
|
|
2065
|
+
.icon=${d==null?void 0:d.icon}
|
|
2066
|
+
style=${xe({...Oo,...d==null?void 0:d.style})}
|
|
2067
|
+
>${c}
|
|
2068
|
+
</bim-label>
|
|
2069
|
+
`},Type:c=>{if(typeof c!="string")return c;const d=((t==null?void 0:t.types)??Wn.types)[c];return X`
|
|
2070
|
+
<bim-label
|
|
2071
|
+
.icon=${d==null?void 0:d.icon}
|
|
2072
|
+
style=${xe({...Oo,...d==null?void 0:d.style})}
|
|
2073
|
+
>${c}
|
|
2074
|
+
</bim-label>
|
|
2075
|
+
`},Author:c=>typeof c!="string"?c:yc(c,t),Assignee:c=>typeof c!="string"?c:yc(c,t)},l.data=[...n].map(c=>{var h;return{data:{Guid:c.guid,Title:c.title,Status:c.status,Description:c.description??"",Author:c.creationAuthor,Assignee:c.assignedTo??"",Date:c.creationDate.toDateString(),DueDate:((h=c.dueDate)==null?void 0:h.toDateString())??"",Type:c.type,Priority:c.priority??""}}})})}>
|
|
2076
|
+
<bim-label slot="missing-data" icon="ph:warning-fill" style="--bim-icon--c: gold;">There are no topics to display</bim-label>
|
|
2077
|
+
</bim-table>`},Pd=(r,e=!0)=>{const t=Ae.create(fE,r);if(e){const{components:i,topics:s}=r,[,n]=t,o=i.get(Mt);if(o.list.onItemUpdated.add(()=>n()),o.list.onItemDeleted.add(()=>n()),s)for(const a of s)a.relatedTopics.onItemAdded.add(()=>n()),a.relatedTopics.onItemDeleted.add(()=>n()),a.relatedTopics.onCleared.add(()=>n());else o.list.onItemSet.add(()=>n())}return t},jn={users:{"jhon.doe@example.com":{name:"Jhon Doe"}},priorities:{"On hold":{icon:"flowbite:circle-pause-outline",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#767676"}},Minor:{icon:"mingcute:arrows-down-fill",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#4CAF50"}},Normal:{icon:"fa6-solid:grip-lines",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FB8C00"}},Major:{icon:"mingcute:arrows-up-fill",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Critical:{icon:"ph:warning",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FB8C00"}}},statuses:{Active:{icon:"prime:circle-fill",style:{backgroundColor:"#2E2E2E"}},"In Progress":{icon:"prime:circle-fill",style:{backgroundColor:"#fa89004d","--bim-label--c":"#FB8C00","--bim-icon--c":"#FB8C00"}},"In Review":{icon:"prime:circle-fill",style:{backgroundColor:"#9c6bff4d","--bim-label--c":"#9D6BFF","--bim-icon--c":"#9D6BFF"}},Done:{icon:"prime:circle-fill",style:{backgroundColor:"#4CAF504D","--bim-label--c":"#4CAF50","--bim-icon--c":"#4CAF50"}},Closed:{icon:"prime:circle-fill",style:{backgroundColor:"#2E2E2E","--bim-label--c":"#727272","--bim-icon--c":"#727272"}}},types:{Clash:{icon:"gg:close-r",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FB8C00"}},Issue:{icon:"mdi:bug-outline",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Failure:{icon:"mdi:bug-outline",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Inquiry:{icon:"majesticons:comment-line",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Fault:{icon:"ph:warning",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Remark:{icon:"ph:note-blank-bold",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FB8C00"}},Request:{icon:"mynaui:edit-one",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#9D6BFF"}}}},xo={padding:"0.25rem 0.5rem",borderRadius:"999px","--bim-label--c":"white"},No=(r,e)=>{const i=((e==null?void 0:e.users)??jn.users)[r],s=(i==null?void 0:i.name)??r,n=s.trim().split(/\s+/);let o,a;return n[0]&&n[0][0]&&(o=n[0][0].toUpperCase(),n[0][1]&&(a=n[0][1].toUpperCase())),n[1]&&n[1][0]&&(a=n[1][0].toUpperCase()),X`
|
|
2078
|
+
<div style="display: flex; gap: 0.25rem; overflow: hidden;">
|
|
2079
|
+
${!(i!=null&&i.picture)&&(o||a)?X`
|
|
2080
|
+
<bim-label
|
|
2081
|
+
style=${xe({borderRadius:"999px",padding:"0.375rem",backgroundColor:"var(--bim-ui_bg-contrast-20)",aspectRatio:"1",fontSize:"0.7rem"})}>${o}${a}</bim-label>
|
|
2082
|
+
`:null}
|
|
2083
|
+
<bim-label .img=${i==null?void 0:i.picture}>${s}</bim-label>
|
|
2084
|
+
</div>
|
|
2085
|
+
`},[ur,pE]=Ae.create(r=>{const{topic:e}=r,t=document.createElement("bim-text-input");t.type="area";const i=()=>{t.value="",ur.close(),ur.remove()};return X`
|
|
2086
|
+
<dialog>
|
|
2087
|
+
${e?X`
|
|
2088
|
+
<bim-panel style="border-radius: var(--bim-ui_size-base); outline: 2px solid var(--bim-ui_bg-contrast-20); width: 20rem;">
|
|
2089
|
+
<bim-panel-section label="New Comment" fixed>
|
|
2090
|
+
${t}
|
|
2091
|
+
<div style="justify-content: right; display: flex; gap: 0.375rem">
|
|
2092
|
+
<style>
|
|
2093
|
+
#PAISD {
|
|
2094
|
+
background-color: transparent;
|
|
2095
|
+
}
|
|
2096
|
+
|
|
2097
|
+
#PAISD:hover {
|
|
2098
|
+
--bim-label--c: #FF5252;
|
|
2099
|
+
}
|
|
2100
|
+
|
|
2101
|
+
#MDOG9:hover {
|
|
2102
|
+
background-color: #329936;
|
|
2103
|
+
}
|
|
2104
|
+
</style>
|
|
2105
|
+
<bim-button @click=${i} style="flex: 0" id="PAISD" label="Cancel"></bim-button>
|
|
2106
|
+
<bim-button @click=${()=>{const n=t.value;!e||n.trim()===""||(e.createComment(n),i())}} style="flex: 0" id="MDOG9" label="Add Comment"} icon="mi:add"}></bim-button>
|
|
2107
|
+
</div>
|
|
2108
|
+
</bim-panel-section>
|
|
2109
|
+
</bim-panel>
|
|
2110
|
+
`:X`<bim-label>No topic refereced</bim-label>`}
|
|
2111
|
+
</dialog>
|
|
2112
|
+
`},{}),[fr,mE]=Ae.create(r=>{const{components:e,topic:t}=r;let i;e&&(i=Ma({components:e,actions:{delete:!1,updateCamera:!1,colorizeComponent:!1,resetColors:!1,selectComponents:!1}})[0],i.selectableRows=!0);const s=()=>{fr.close(),fr.remove(),i==null||i.remove()};return X`
|
|
2113
|
+
<dialog>
|
|
2114
|
+
${t?X`
|
|
2115
|
+
<bim-panel style="border-radius: var(--bim-ui_size-base); outline: 2px solid var(--bim-ui_bg-contrast-20); width: 20rem;">
|
|
2116
|
+
<bim-panel-section label="Link Viewpoints" fixed>
|
|
2117
|
+
${i}
|
|
2118
|
+
<div style="justify-content: right; display: flex; gap: 0.375rem">
|
|
2119
|
+
<style>
|
|
2120
|
+
#PAISD {
|
|
2121
|
+
background-color: transparent;
|
|
2122
|
+
}
|
|
2123
|
+
|
|
2124
|
+
#PAISD:hover {
|
|
2125
|
+
--bim-label--c: #FF5252;
|
|
2126
|
+
}
|
|
2127
|
+
|
|
2128
|
+
#MDOG9:hover {
|
|
2129
|
+
background-color: #329936;
|
|
2130
|
+
}
|
|
2131
|
+
</style>
|
|
2132
|
+
<bim-button @click=${s} style="flex: 0" id="PAISD" label="Cancel"></bim-button>
|
|
2133
|
+
<bim-button @click=${()=>{if(!(i&&t))return;const o=i.selection;for(const a of o){const{Guid:l}=a;typeof l=="string"&&t.viewpoints.add(l)}s()}} style="flex: 0" id="MDOG9" label="Link Viewpoints"} icon="mi:add"}></bim-button>
|
|
2134
|
+
</div>
|
|
2135
|
+
</bim-panel-section>
|
|
2136
|
+
</bim-panel>
|
|
2137
|
+
`:X`<bim-label>No topic refereced</bim-label>`}
|
|
2138
|
+
</dialog>
|
|
2139
|
+
`},{}),[pr,gE]=Ae.create(r=>{const{components:e,topic:t}=r;let i;if(e){const a=[...e.get(Mt).list.values()].filter(l=>l!==t);i=Pd({components:e,topics:a})[0],i.selectableRows=!0,i.hiddenColumns=["Guid","Author","Assignee","Date","DueDate"]}const s=()=>{pr.close(),pr.remove(),i==null||i.remove()};return X`
|
|
2140
|
+
<dialog>
|
|
2141
|
+
<bim-panel style="border-radius: var(--bim-ui_size-base); outline: 2px solid var(--bim-ui_bg-contrast-20); width: 50rem;">
|
|
2142
|
+
<bim-panel-section label="Link Viewpoints" fixed>
|
|
2143
|
+
${i}
|
|
2144
|
+
<div style="justify-content: right; display: flex; gap: 0.375rem">
|
|
2145
|
+
<style>
|
|
2146
|
+
#PAISD {
|
|
2147
|
+
background-color: transparent;
|
|
2148
|
+
}
|
|
2149
|
+
|
|
2150
|
+
#PAISD:hover {
|
|
2151
|
+
--bim-label--c: #FF5252;
|
|
2152
|
+
}
|
|
2153
|
+
|
|
2154
|
+
#MDOG9:hover {
|
|
2155
|
+
background-color: #329936;
|
|
2156
|
+
}
|
|
2157
|
+
</style>
|
|
2158
|
+
<bim-button @click=${s} style="flex: 0" id="PAISD" label="Cancel"></bim-button>
|
|
2159
|
+
<bim-button @click=${()=>{if(!(i&&t))return;const o=i.selection;for(const a of o){const{Guid:l}=a;typeof l=="string"&&t.relatedTopics.add(l)}s()}} style="flex: 0" id="MDOG9" label="Link Topics"} icon="mi:add"}></bim-button>
|
|
2160
|
+
</div>
|
|
2161
|
+
</bim-panel-section>
|
|
2162
|
+
</bim-panel>
|
|
2163
|
+
</dialog>
|
|
2164
|
+
`},{}),EE=r=>{const{components:e,topic:t,styles:i,onUpdateInformation:s,actions:n,world:o}=r,a={update:!0,addComments:!0,linkViewpoints:!0,addViewpoints:!0,linkTopics:!0,...n},l=(i==null?void 0:i.priorities)??jn.priorities,c=(i==null?void 0:i.statuses)??jn.statuses,h=(i==null?void 0:i.types)??jn.types;let d;t!=null&&t.priority&&(d=l[t.priority]);let u;t!=null&&t.type&&(u=h[t.type]);let f;t!=null&&t.type&&(f=c[t.status]);let p,m,E;t&&(p=uE({topic:t,styles:i==null?void 0:i.users})[0],m=Ma({components:e,topic:t})[0]);const g=()=>{if(!(t&&o))return;const A=e.get(Ht).create(o);t.viewpoints.add(A.guid)},I=()=>{pE({topic:t}),document.body.append(ur),ur.showModal()},T=()=>{mE({components:e,topic:t}),document.body.append(fr),fr.showModal()},b=()=>{gE({components:e,topic:t}),document.body.append(pr),pr.showModal()};return X`
|
|
2165
|
+
<bim-panel>
|
|
2166
|
+
${t?X`
|
|
2167
|
+
<bim-panel-section label="Information" icon="ph:info-bold" collapsed>
|
|
2168
|
+
<div>
|
|
2169
|
+
<bim-label>Title</bim-label>
|
|
2170
|
+
<bim-label style="--bim-label--c: var(--bim-ui_bg-contrast-100)">${t.title}</bim-label>
|
|
2171
|
+
</div>
|
|
2172
|
+
<div>
|
|
2173
|
+
<bim-label>Description</bim-label>
|
|
2174
|
+
<bim-label style="--bim-label--c: var(--bim-ui_bg-contrast-100)">${t.description}</bim-label>
|
|
2175
|
+
</div>
|
|
2176
|
+
<div style="display: flex; gap: 0.375rem">
|
|
2177
|
+
<bim-label>Status</bim-label>
|
|
2178
|
+
<bim-label .icon=${f==null?void 0:f.icon} style=${xe({...xo,...f==null?void 0:f.style})}
|
|
2179
|
+
>${t.status}
|
|
2180
|
+
</bim-label>
|
|
2181
|
+
</div>
|
|
2182
|
+
<div style="display: flex; gap: 0.375rem">
|
|
2183
|
+
<bim-label>Type</bim-label>
|
|
2184
|
+
<bim-label .icon=${u==null?void 0:u.icon} style=${xe({...xo,...u==null?void 0:u.style})}
|
|
2185
|
+
>${t.type}
|
|
2186
|
+
</bim-label>
|
|
2187
|
+
</div>
|
|
2188
|
+
${t.priority?X`
|
|
2189
|
+
<div style="display: flex; gap: 0.375rem">
|
|
2190
|
+
<bim-label>Priority</bim-label>
|
|
2191
|
+
<bim-label .icon=${d==null?void 0:d.icon} style=${xe({...xo,...d==null?void 0:d.style})}
|
|
2192
|
+
>${t.priority}
|
|
2193
|
+
</bim-label>
|
|
2194
|
+
</div>`:null}
|
|
2195
|
+
<div style="display: flex; gap: 0.375rem">
|
|
2196
|
+
<bim-label>Author</bim-label>
|
|
2197
|
+
${No(t.creationAuthor,i)}
|
|
2198
|
+
</div>
|
|
2199
|
+
${t.assignedTo?X`
|
|
2200
|
+
<div style="display: flex; gap: 0.375rem">
|
|
2201
|
+
<bim-label>Assignee</bim-label>
|
|
2202
|
+
${No(t.assignedTo,i)}
|
|
2203
|
+
</div>`:null}
|
|
2204
|
+
${t.dueDate?X`
|
|
2205
|
+
<div style="display: flex; gap: 0.375rem">
|
|
2206
|
+
<bim-label>Due Date</bim-label>
|
|
2207
|
+
<bim-label style="--bim-label--c: var(--bim-ui_bg-contrast-100)">${t.dueDate.toDateString()}</bim-label>
|
|
2208
|
+
</div>`:null}
|
|
2209
|
+
${t.modifiedAuthor?X`
|
|
2210
|
+
<div style="display: flex; gap: 0.375rem">
|
|
2211
|
+
<bim-label>Modified By</bim-label>
|
|
2212
|
+
${No(t.modifiedAuthor,i)}
|
|
2213
|
+
</div>`:null}
|
|
2214
|
+
${t.modifiedDate?X`
|
|
2215
|
+
<div style="display: flex; gap: 0.375rem">
|
|
2216
|
+
<bim-label>Modified Date</bim-label>
|
|
2217
|
+
<bim-label style="--bim-label--c: var(--bim-ui_bg-contrast-100)">${t.modifiedDate.toDateString()}</bim-label>
|
|
2218
|
+
</div>`:null}
|
|
2219
|
+
${t.labels.size!==0?X`
|
|
2220
|
+
<div style="display: flex; gap: 0.375rem">
|
|
2221
|
+
<bim-label>Labels</bim-label>
|
|
2222
|
+
<bim-label style="--bim-label--c: var(--bim-ui_bg-contrast-100)">${[...t.labels].join(", ")}</bim-label>
|
|
2223
|
+
</div>`:null}
|
|
2224
|
+
${a.update?X`
|
|
2225
|
+
<bim-button @click=${()=>{s&&s(t)}} label="Update Information" icon="tabler:refresh"></bim-button>
|
|
2226
|
+
`:null}
|
|
2227
|
+
</bim-panel-section>
|
|
2228
|
+
<bim-panel-section label="Comments" icon="majesticons:comment-line">
|
|
2229
|
+
${p}
|
|
2230
|
+
${a.addComments?X`
|
|
2231
|
+
<bim-button @click=${I} label="Add Comment" icon="majesticons:comment-line"></bim-button>
|
|
2232
|
+
`:null}
|
|
2233
|
+
</bim-panel-section>
|
|
2234
|
+
<bim-panel-section label="Viewpoints" icon="tabler:camera">
|
|
2235
|
+
${m}
|
|
2236
|
+
${a.linkViewpoints||a.addViewpoints?X`
|
|
2237
|
+
<div style="display: flex; gap: 0.375rem">
|
|
2238
|
+
${a.addViewpoints?X`<bim-button @click=${g} .disabled=${!o} label="Add Viewpoint" icon="mi:add"></bim-button> `:null}
|
|
2239
|
+
${a.linkViewpoints?X`<bim-button @click=${T} label="Link Viewpoint" icon="tabler:camera"></bim-button>`:null}
|
|
2240
|
+
</div>
|
|
2241
|
+
`:null}
|
|
2242
|
+
</bim-panel-section>
|
|
2243
|
+
<!-- <bim-panel-section label="Related Topics" icon="material-symbols:topic-outline">
|
|
2244
|
+
${E}
|
|
2245
|
+
${a.linkViewpoints?X`
|
|
2246
|
+
<bim-button @click=${b} label="Link Topic" icon="material-symbols:topic-outline"></bim-button>
|
|
2247
|
+
`:null}
|
|
2248
|
+
</bim-panel-section> -->
|
|
2249
|
+
`:X`<bim-label>No topic selected!</bim-label>`}
|
|
2250
|
+
</bim-panel>
|
|
2251
|
+
`},bE=(r,e=!0)=>{const t=Ae.create(EE,r);if(e){const{components:i}=r,[s,n]=t;i.get(Mt).list.onItemUpdated.add(({value:a})=>{const{topic:l}=n(),{guid:c}=a;c===(l==null?void 0:l.guid)&&n()})}return t};class Mt extends Ot{constructor(){super(...arguments);y(this,"enabled",!1);y(this,"_xmlParser",new Hp.XMLParser({allowBooleanAttributes:!0,attributeNamePrefix:"",ignoreAttributes:!1,ignoreDeclaration:!0,ignorePiTags:!0,numberParseOptions:{leadingZeros:!0,hex:!0},parseAttributeValue:!0,preserveOrder:!1,processEntities:!1,removeNSPrefix:!0,trimValues:!0}));y(this,"config",{author:"jhon.doe@example.com",version:"2.1",types:new Set(["Clash","Failure","Fault","Inquiry","Issue","Remark","Request"]),statuses:new Set(["Active","In Progress","Done","In Review","Closed"]),priorities:new Set(["On hold","Minor","Normal","Major","Critical"]),labels:new Set,stages:new Set,users:new Set,includeSelectionTag:!1,updateExtensionsOnImport:!0,strict:!1,includeAllExtensionsOnExport:!0,fallbackVersionOnImport:"2.1",ignoreIncompleteTopicsOnImport:!1});y(this,"list",new pi);y(this,"onSetup",new K);y(this,"isSetup",!1);y(this,"onBCFImported",new K);y(this,"onDisposed",new K)}setup(t){this.isSetup||(this.config={...this.config,...t},this.isSetup=!0,this.enabled=!0,this.onSetup.trigger())}create(t){const i=new Gs(this.components);return t&&(i.guid=t.guid??i.guid,i.set(t)),this.list.set(i.guid,i),i}dispose(){this.list.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}get usedTypes(){const t=[...this.list].map(([i,s])=>s.type);return new Set(t)}get usedStatuses(){const t=[...this.list].map(([i,s])=>s.status);return new Set(t)}get usedPriorities(){const t=[...this.list].map(([i,s])=>s.priority).filter(i=>i);return new Set(t)}get usedStages(){const t=[...this.list].map(([i,s])=>s.stage).filter(i=>i);return new Set(t)}get usedUsers(){const t=[];for(const[i,s]of this.list){t.push(s.creationAuthor),s.assignedTo&&t.push(s.assignedTo),s.modifiedAuthor&&t.push(s.modifiedAuthor);for(const[n,o]of s.comments)t.push(o.author),o.modifiedAuthor&&t.push(o.modifiedAuthor)}return new Set(t)}get usedLabels(){const t=[];for(const[i,s]of this.list)t.push(...s.labels);return new Set(t)}updateExtensions(){for(const[t,i]of this.list){for(const s of i.labels)this.config.labels.add(s);this.config.types.add(i.type),i.priority&&this.config.priorities.add(i.priority),i.stage&&this.config.stages.add(i.stage),this.config.statuses.add(i.status),this.config.users.add(i.creationAuthor),i.assignedTo&&this.config.users.add(i.assignedTo),i.modifiedAuthor&&this.config.users.add(i.modifiedAuthor);for(const[s,n]of i.comments)this.config.users.add(n.author),n.modifiedAuthor&&this.config.users.add(n.modifiedAuthor)}}updateViewpointReferences(){const t=this.components.get(Ht);for(const[i,s]of this.list)for(const n of s.viewpoints)t.list.has(n)||s.viewpoints.delete(n)}async export(t=this.list.values()){const i=new Tl;i.file("bcf.version",`<?xml version="1.0" encoding="UTF-8"?>
|
|
2252
|
+
<Version VersionId="${this.config.version}" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/buildingSMART/BCF-XML/release_3_0/Schemas/version.xsd"
|
|
2253
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
|
2254
|
+
</Version>`),i.file("bcf.extensions",this.serializeExtensions());const n=await(await fetch("https://thatopen.github.io/engine_components/resources/favicon.ico")).blob(),o=this.components.get(Ht);for(const l of t){const c=i.folder(l.guid);c.file("markup.bcf",l.serialize());for(const h of l.viewpoints){const d=o.list.get(h);d&&(c.file(`${h}.jpeg`,n,{binary:!0}),c.file(`${h}.bcfv`,await d.serialize()))}}return await i.generateAsync({type:"blob"})}serializeExtensions(){const t=[...this.config.types].map(l=>`<TopicType>${l}</TopicType>`).join(`
|
|
2255
|
+
`),i=[...this.config.statuses].map(l=>`<TopicStatus>${l}</TopicStatus>`).join(`
|
|
2256
|
+
`),s=[...this.config.priorities].map(l=>`<Priority>${l}</Priority>`).join(`
|
|
2257
|
+
`),n=[...this.config.labels].map(l=>`<TopicLabel>${l}</TopicLabel>`).join(`
|
|
2258
|
+
`),o=[...this.config.stages].map(l=>`<Stage>${l}</Stage>`).join(`
|
|
2259
|
+
`),a=[...this.config.users].map(l=>`<User>${l}</User>`).join(`
|
|
2260
|
+
`);return`
|
|
2261
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2262
|
+
<Extensions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="your-schema-location.xsd">
|
|
2263
|
+
${t.length!==0?`<TopicTypes>
|
|
2264
|
+
${t}
|
|
2265
|
+
</TopicTypes>`:""}
|
|
2266
|
+
${i.length!==0?`<TopicStatuses>
|
|
2267
|
+
${i}
|
|
2268
|
+
</TopicStatuses>`:""}
|
|
2269
|
+
${s.length!==0?`<Priorities>
|
|
2270
|
+
${s}
|
|
2271
|
+
</Priorities>`:""}
|
|
2272
|
+
${n.length!==0?`<TopicLabels>
|
|
2273
|
+
${n}
|
|
2274
|
+
</TopicLabels>`:""}
|
|
2275
|
+
${o.length!==0?`<Stages>
|
|
2276
|
+
${o}
|
|
2277
|
+
</Stages>`:""}
|
|
2278
|
+
${a.length!==0?`<Users>
|
|
2279
|
+
${a}
|
|
2280
|
+
</Users>`:""}
|
|
2281
|
+
</Extensions>
|
|
2282
|
+
`}processMarkupComment(t){const{Guid:i,Date:s,Author:n,Comment:o,Viewpoint:a}=t;if(!(i&&s&&n&&(Jn||a)))return null;const l=this.components.get(Ht),c=new Jn(this.components,o??"");return c.guid=i,c.date=new Date(s),c.author=n,c.viewpoint=a!=null&&a.Guid?l.list.get(a.Guid):void 0,c.modifiedAuthor=t.ModifiedAuthor,c.modifiedDate=t.ModifiedDate?new Date(t.ModifiedDate):void 0,c}getMarkupComments(t,i){var a;let s;if(i==="2.1"&&(s=t.Comment),i==="3"&&(s=(a=t.Topic.Comments)==null?void 0:a.Comment),!s)return[];s=Array.isArray(s)?s:[s];const n=s.map(l=>this.processMarkupComment(l)).filter(l=>l);return Array.isArray(n)?n:[n]}getMarkupLabels(t,i){var o;let s;return i==="2.1"&&(s=t.Topic.Labels),i==="3"&&(s=(o=t.Topic.Labels)==null?void 0:o.Label),s?Array.isArray(s)?s:[s]:[]}getMarkupViewpoints(t,i){var n;let s;return i==="2.1"&&(s=t.Viewpoints),i==="3"&&(s=(n=t.Topic.Viewpoints)==null?void 0:n.ViewPoint),s?(s=Array.isArray(s)?s:[s],s):[]}getMarkupRelatedTopics(t,i){var o;let s;return i==="2.1"&&(s=t.Topic.RelatedTopic),i==="3"&&(s=(o=t.Topic.RelatedTopics)==null?void 0:o.RelatedTopic),s?(Array.isArray(s)?s:[s]).map(a=>a.Guid):[]}async load(t,i){var E;const{fallbackVersionOnImport:s,ignoreIncompleteTopicsOnImport:n}=this.config,o=new Tl;await o.loadAsync(i);const a=Object.values(o.files);let l=s;const c=a.find(g=>g.name.endsWith(".version"));if(c){const g=await c.async("string"),I=this._xmlParser.parse(g).Version.VersionId;l=String(I)}if(!(l&&(l==="2.1"||l==="3")))throw new Error(`BCFTopics: ${l} is not supported.`);const h=[],d=this.components.get(Ht),u=a.filter(g=>g.name.endsWith(".bcfv"));for(const g of u){const I=await g.async("string"),T=this._xmlParser.parse(I).VisualizationInfo;if(!T){console.warn("Missing VisualizationInfo in Viewpoint");continue}const b={},{Guid:v,ClippingPlanes:A,Components:S,OrthogonalCamera:N,PerspectiveCamera:R}=T;if(v&&(b.guid=v),S){const{Selection:M,Visibility:w}=S;if(M&&M.Component){const C=Array.isArray(M.Component)?M.Component:[M.Component];b.selectionComponents=C.map(U=>U.IfcGuid).filter(U=>U)}if(w&&"DefaultVisibility"in w&&(b.defaultVisibility=w.DefaultVisibility),w&&w.Exceptions&&"Component"in w.Exceptions){const{Component:C}=w.Exceptions,U=Array.isArray(C)?C:[C];b.exceptionComponents=U.map(q=>q.IfcGuid).filter(q=>q)}let L;l==="2.1"&&(L=S.ViewSetupHints),l==="3"&&(L=(E=S.Visibility)==null?void 0:E.ViewSetupHints),L&&("OpeningsVisible"in L&&(b.openingsVisible=L.OpeningsVisible),"SpacesVisible"in L&&(b.spacesVisible=L.SpacesVisible),"SpaceBoundariesVisible"in L&&(b.spaceBoundariesVisible=L.SpaceBoundariesVisible))}if(N||R){const M=T.PerspectiveCamera??T.OrthogonalCamera,{CameraViewPoint:w,CameraDirection:L}=M,C=new D.Vector3(Number(w.X),Number(w.Z),Number(-w.Y)),U=new D.Vector3(Number(L.X),Number(L.Z),Number(-L.Y)),q={position:{x:C.x,y:C.y,z:C.z},direction:{x:U.x,y:U.y,z:U.z},aspectRatio:"AspectRatio"in M?M.AspectRatio:1};"ViewToWorldScale"in M&&(b.camera={...q,viewToWorldScale:M.ViewToWorldScale}),"FieldOfView"in M&&(b.camera={...q,fov:M.FieldOfView})}const P=new ka(this.components,t,{data:b,setCamera:!1});if(S){const{Coloring:M}=S;if(M&&M.Color){const w=Array.isArray(M.Color)?M.Color:[M.Color];for(const L of w){const{Color:C,Component:U}=L,G=(Array.isArray(U)?U:[U]).map(st=>st.IfcGuid);P.componentColors.set(C,G)}}}if(h.push(P),A){const M=this.components.get(Kn),w=Array.isArray(A.ClippingPlane)?A.ClippingPlane:[A.ClippingPlane];for(const L of w){const{Location:C,Direction:U}=L;if(!(C&&U))continue;const q=new D.Vector3(C.X,C.Z,-C.Y),G=new D.Vector3(U.X,-U.Z,U.Y),st=M.createFromNormalAndCoplanarPoint(t,G,q);st.visible=!1,st.enabled=!1,P.clippingPlanes.add(st)}}}const f={},p=[],m=a.filter(g=>g.name.endsWith(".bcf"));for(const g of m){const I=await g.async("string"),T=this._xmlParser.parse(I).Markup,b=T.Topic,{Guid:v,Type:A,Status:S,Title:N,CreationDate:R,CreationAuthor:P}=b;if(n&&!(v&&A&&S&&N&&R&&P))continue;const M=new Gs(this.components);M.guid=v??M.guid;const w=this.getMarkupRelatedTopics(T,l);f[M.guid]=new Set(w),M.type=A??M.type,M.status=S??M.status,M.title=N??M.title,M.creationDate=R?new Date(R):M.creationDate,M.creationAuthor=P??M.creationAuthor,M.serverAssignedId=b.ServerAssignedId,M.priority=b.Priority,M.index=b.Index,M.modifiedDate=b.ModifiedDate?new Date(b.ModifiedDate):void 0,M.modifiedAuthor=b.ModifiedAuthor,M.dueDate=b.DueDate?new Date(b.DueDate):void 0,M.assignedTo=b.AssignedTo,M.description=b.Description,M.stage=b.Stage;const L=this.getMarkupLabels(T,l);for(const q of L)M.labels.add(q);const C=this.getMarkupComments(T,l);for(const q of C)M.comments.set(q.guid,q);const U=this.getMarkupViewpoints(T,l);for(const q of U){if(!(q&&q.Guid))continue;const G=d.list.get(q.Guid);G&&M.viewpoints.add(G.guid)}this.list.set(M.guid,M),p.push(M)}for(const g in f){const I=this.list.get(g);if(!I)continue;const T=f[g];for(const b of T)I.relatedTopics.add(b)}return this.onBCFImported.trigger(p),{viewpoints:h,topics:p}}}y(Mt,"uuid","de977976-e4f6-4e4f-a01a-204727839802");const fe=class fe extends Ot{constructor(t){super(t);y(this,"enabled",!0);y(this,"onDisposed",new K);y(this,"_absoluteMin");y(this,"_absoluteMax");y(this,"_meshes",[]);this.components.add(fe.uuid,this),this._absoluteMin=fe.newBound(!0),this._absoluteMax=fe.newBound(!1)}static getDimensions(t){const{min:i,max:s}=t,n=Math.abs(s.x-i.x),o=Math.abs(s.y-i.y),a=Math.abs(s.z-i.z),l=new D.Vector3;return l.subVectors(s,i).divideScalar(2).add(i),{width:n,height:o,depth:a,center:l}}static newBound(t){const i=t?1:-1;return new D.Vector3(i*Number.MAX_VALUE,i*Number.MAX_VALUE,i*Number.MAX_VALUE)}static getBounds(t,i,s){const n=s||this.newBound(!1),o=i||this.newBound(!0);for(const a of t)a.x<o.x&&(o.x=a.x),a.y<o.y&&(o.y=a.y),a.z<o.z&&(o.z=a.z),a.x>n.x&&(n.x=a.x),a.y>n.y&&(n.y=a.y),a.z>n.z&&(n.z=a.z);return new D.Box3(i,s)}dispose(){const t=this.components.get(Pe);for(const i of this._meshes)t.destroy(i);this._meshes=[],this.onDisposed.trigger(fe.uuid),this.onDisposed.reset()}get(){const t=this._absoluteMin.clone(),i=this._absoluteMax.clone();return new D.Box3(t,i)}getSphere(){const t=this._absoluteMin.clone(),i=this._absoluteMax.clone(),s=Math.abs((i.x-t.x)/2),n=Math.abs((i.y-t.y)/2),o=Math.abs((i.z-t.z)/2),a=new D.Vector3(t.x+s,t.y+n,t.z+o),l=a.distanceTo(t);return new D.Sphere(a,l)}getMesh(){const t=new D.Box3(this._absoluteMin,this._absoluteMax),i=fe.getDimensions(t),{width:s,height:n,depth:o,center:a}=i,l=new D.BoxGeometry(s,n,o),c=new D.Mesh(l);return this._meshes.push(c),c.position.copy(a),c}reset(){this._absoluteMin=fe.newBound(!0),this._absoluteMax=fe.newBound(!1)}add(t){for(const i of t.items)this.addMesh(i.mesh)}addMesh(t,i){if(!t.geometry.index)return;const s=fe.getFragmentBounds(t);t.updateMatrixWorld();const n=t.matrixWorld,o=new D.Matrix4,a=t instanceof D.InstancedMesh,l=new Set;if(t instanceof We.FragmentMesh){i||(i=t.fragment.ids);for(const c of i){const h=t.fragment.getInstancesIDs(c);if(h)for(const d of h)l.add(d)}}else l.add(0);for(const c of l){const h=s.min.clone(),d=s.max.clone();a&&(t.getMatrixAt(c,o),h.applyMatrix4(o),d.applyMatrix4(o)),h.applyMatrix4(n),d.applyMatrix4(n),h.x<this._absoluteMin.x&&(this._absoluteMin.x=h.x),h.y<this._absoluteMin.y&&(this._absoluteMin.y=h.y),h.z<this._absoluteMin.z&&(this._absoluteMin.z=h.z),h.x>this._absoluteMax.x&&(this._absoluteMax.x=h.x),h.y>this._absoluteMax.y&&(this._absoluteMax.y=h.y),h.z>this._absoluteMax.z&&(this._absoluteMax.z=h.z),d.x>this._absoluteMax.x&&(this._absoluteMax.x=d.x),d.y>this._absoluteMax.y&&(this._absoluteMax.y=d.y),d.z>this._absoluteMax.z&&(this._absoluteMax.z=d.z),d.x<this._absoluteMin.x&&(this._absoluteMin.x=d.x),d.y<this._absoluteMin.y&&(this._absoluteMin.y=d.y),d.z<this._absoluteMin.z&&(this._absoluteMin.z=d.z)}}addFragmentIdMap(t){const i=this.components.get(wt);for(const s in t){const n=i.list.get(s);if(!n)continue;const o=t[s];this.addMesh(n.mesh,o)}}static getFragmentBounds(t){const i=t.geometry.attributes.position,s=Number.MAX_VALUE,n=-s,o=new D.Vector3(s,s,s),a=new D.Vector3(n,n,n);if(!t.geometry.index)throw new Error("Geometry must be indexed!");const l=Array.from(t.geometry.index.array);for(let c=0;c<l.length;c++){if(c%3===0&&l[c]===0&&l[c+1]===0&&l[c+2]===0){c+=2;continue}const h=l[c],d=i.getX(h),u=i.getY(h),f=i.getZ(h);d<o.x&&(o.x=d),u<o.y&&(o.y=u),f<o.z&&(o.z=f),d>a.x&&(a.x=d),u>a.y&&(a.y=u),f>a.z&&(a.z=f)}return new D.Box3(o,a)}};y(fe,"uuid","d1444724-dba6-4cdd-a0c7-68ee1450d166");let mr=fe;const Da=new Set([1123145078,574549367,1675464909,2059837836,3798115385,32440307,3125803723,3207858831,2740243338,2624227202,4240577450,3615266464,3724593414,220341763,477187591,1878645084,1300840506,3303107099,1607154358,1878645084,846575682,1351298697,2417041796,3049322572,3331915920,1416205885,776857604,3285139300,3958052878,2827736869,2732653382,673634403,3448662350,4142052618,2924175390,803316827,2556980723,1809719519,2205249479,807026263,3737207727,1660063152,2347385850,2705031697,3732776249,2485617015,2611217952,1704287377,2937912522,2770003689,1281925730,1484403080,3448662350,4142052618,3800577675,4006246654,3590301190,1383045692,2775532180,2047409740,370225590,3593883385,2665983363,4124623270,812098782,3649129432,987898635,1105321065,3510044353,1635779807,2603310189,3406155212,1310608509,4261334040,2736907675,3649129432,1136057603,1260505505,4182860854,2713105998,2898889636,59481748,3749851601,3486308946,3150382593,1062206242,3264961684,15328376,1485152156,370225590,1981873012,2859738748,45288368,2614616156,2732653382,775493141,2147822146,2601014836,2629017746,1186437898,2367409068,1213902940,3632507154,3900360178,476780140,1472233963,2804161546,3008276851,738692330,374418227,315944413,3905492369,3570813810,2571569899,178912537,2294589976,1437953363,2133299955,572779678,3092502836,388784114,2624227202,1425443689,3057273783,2347385850,1682466193,2519244187,2839578677,3958567839,2513912981,2830218821,427810014]),vr=class vr extends Ot{constructor(t){super(t);y(this,"enabled",!0);t.add(vr.uuid,this)}async export(t,i,s=!1,n=!0){const o={},a=new Set(t.GetIfcEntityList(i)),l=new Set([tt.IFCPROJECT,tt.IFCSITE,tt.IFCBUILDING,tt.IFCBUILDINGSTOREY,tt.IFCSPACE]);for(const c of l)a.add(c);for(const c of a){if(Da.has(c))continue;const h=l.has(c)&&n,d=t.GetLineIDsWithType(i,c);for(const u of d){const f=t.GetLine(0,u,h,s);o[f.expressID]=f}}return o}};y(vr,"uuid","b32c4332-cd67-436e-ba7f-196646c7a635");let gr=vr;const Ld={103090709:"IFCPROJECT",4097777520:"IFCSITE",4031249490:"IFCBUILDING",3124254112:"IFCBUILDINGSTOREY",3856911033:"IFCSPACE",1674181508:"IFCANNOTATION",25142252:"IFCCONTROLLER",32344328:"IFCBOILER",76236018:"IFCLAMP",90941305:"IFCPUMP",177149247:"IFCAIRTERMINALBOX",182646315:"IFCFLOWINSTRUMENT",263784265:"IFCFURNISHINGELEMENT",264262732:"IFCELECTRICGENERATOR",277319702:"IFCAUDIOVISUALAPPLIANCE",310824031:"IFCPIPEFITTING",331165859:"IFCSTAIR",342316401:"IFCDUCTFITTING",377706215:"IFCMECHANICALFASTENER",395920057:"IFCDOOR",402227799:"IFCELECTRICMOTOR",413509423:"IFCSYSTEMFURNITUREELEMENT",484807127:"IFCEVAPORATOR",486154966:"IFCWINDOWSTANDARDCASE",629592764:"IFCLIGHTFIXTURE",630975310:"IFCUNITARYCONTROLELEMENT",635142910:"IFCCABLECARRIERFITTING",639361253:"IFCCOIL",647756555:"IFCFASTENER",707683696:"IFCFLOWSTORAGEDEVICE",738039164:"IFCPROTECTIVEDEVICE",753842376:"IFCBEAM",812556717:"IFCTANK",819412036:"IFCFILTER",843113511:"IFCCOLUMN",862014818:"IFCELECTRICDISTRIBUTIONBOARD",900683007:"IFCFOOTING",905975707:"IFCCOLUMNSTANDARDCASE",926996030:"IFCVOIDINGFEATURE",979691226:"IFCREINFORCINGBAR",987401354:"IFCFLOWSEGMENT",1003880860:"IFCELECTRICTIMECONTROL",1051757585:"IFCCABLEFITTING",1052013943:"IFCDISTRIBUTIONCHAMBERELEMENT",1062813311:"IFCDISTRIBUTIONCONTROLELEMENT",1073191201:"IFCMEMBER",1095909175:"IFCBUILDINGELEMENTPROXY",1156407060:"IFCPLATESTANDARDCASE",1162798199:"IFCSWITCHINGDEVICE",1329646415:"IFCSHADINGDEVICE",1335981549:"IFCDISCRETEACCESSORY",1360408905:"IFCDUCTSILENCER",1404847402:"IFCSTACKTERMINAL",1426591983:"IFCFIRESUPPRESSIONTERMINAL",1437502449:"IFCMEDICALDEVICE",1509553395:"IFCFURNITURE",1529196076:"IFCSLAB",1620046519:"IFCTRANSPORTELEMENT",1634111441:"IFCAIRTERMINAL",1658829314:"IFCENERGYCONVERSIONDEVICE",1677625105:"IFCCIVILELEMENT",1687234759:"IFCPILE",1904799276:"IFCELECTRICAPPLIANCE",1911478936:"IFCMEMBERSTANDARDCASE",1945004755:"IFCDISTRIBUTIONELEMENT",1973544240:"IFCCOVERING",1999602285:"IFCSPACEHEATER",2016517767:"IFCROOF",2056796094:"IFCAIRTOAIRHEATRECOVERY",2058353004:"IFCFLOWCONTROLLER",2068733104:"IFCHUMIDIFIER",2176052936:"IFCJUNCTIONBOX",2188021234:"IFCFLOWMETER",2223149337:"IFCFLOWTERMINAL",2262370178:"IFCRAILING",2272882330:"IFCCONDENSER",2295281155:"IFCPROTECTIVEDEVICETRIPPINGUNIT",2320036040:"IFCREINFORCINGMESH",2347447852:"IFCTENDONANCHOR",2391383451:"IFCVIBRATIONISOLATOR",2391406946:"IFCWALL",2474470126:"IFCMOTORCONNECTION",2769231204:"IFCVIRTUALELEMENT",2814081492:"IFCENGINE",2906023776:"IFCBEAMSTANDARDCASE",2938176219:"IFCBURNER",2979338954:"IFCBUILDINGELEMENTPART",3024970846:"IFCRAMP",3026737570:"IFCTUBEBUNDLE",3027962421:"IFCSLABSTANDARDCASE",3040386961:"IFCDISTRIBUTIONFLOWELEMENT",3053780830:"IFCSANITARYTERMINAL",3079942009:"IFCOPENINGSTANDARDCASE",3087945054:"IFCALARM",3101698114:"IFCSURFACEFEATURE",3127900445:"IFCSLABELEMENTEDCASE",3132237377:"IFCFLOWMOVINGDEVICE",3171933400:"IFCPLATE",3221913625:"IFCCOMMUNICATIONSAPPLIANCE",3242481149:"IFCDOORSTANDARDCASE",3283111854:"IFCRAMPFLIGHT",3296154744:"IFCCHIMNEY",3304561284:"IFCWINDOW",3310460725:"IFCELECTRICFLOWSTORAGEDEVICE",3319311131:"IFCHEATEXCHANGER",3415622556:"IFCFAN",3420628829:"IFCSOLARDEVICE",3493046030:"IFCGEOGRAPHICELEMENT",3495092785:"IFCCURTAINWALL",3508470533:"IFCFLOWTREATMENTDEVICE",3512223829:"IFCWALLSTANDARDCASE",3518393246:"IFCDUCTSEGMENT",3571504051:"IFCCOMPRESSOR",3588315303:"IFCOPENINGELEMENT",3612865200:"IFCPIPESEGMENT",3640358203:"IFCCOOLINGTOWER",3651124850:"IFCPROJECTIONELEMENT",3694346114:"IFCOUTLET",3747195512:"IFCEVAPORATIVECOOLER",3758799889:"IFCCABLECARRIERSEGMENT",3824725483:"IFCTENDON",3825984169:"IFCTRANSFORMER",3902619387:"IFCCHILLER",4074379575:"IFCDAMPER",4086658281:"IFCSENSOR",4123344466:"IFCELEMENTASSEMBLY",4136498852:"IFCCOOLEDBEAM",4156078855:"IFCWALLELEMENTEDCASE",4175244083:"IFCINTERCEPTOR",4207607924:"IFCVALVE",4217484030:"IFCCABLESEGMENT",4237592921:"IFCWASTETERMINAL",4252922144:"IFCSTAIRFLIGHT",4278956645:"IFCFLOWFITTING",4288193352:"IFCACTUATOR",4292641817:"IFCUNITARYEQUIPMENT",3009204131:"IFCGRID"};class IE{getAll(e,t){const i={},s=Object.keys(Ld).map(n=>parseInt(n,10));for(let n=0;n<s.length;n++){const o=s[n],a=e.GetLineIDsWithType(t,o),l=a.size();for(let c=0;c<l;c++)i[a.get(c)]=o}return i}}const Ua={950732822:"IFCURIREFERENCE",4075327185:"IFCTIME",1209108979:"IFCTEMPERATURERATEOFCHANGEMEASURE",3457685358:"IFCSOUNDPRESSURELEVELMEASURE",4157543285:"IFCSOUNDPOWERLEVELMEASURE",2798247006:"IFCPROPERTYSETDEFINITIONSET",1790229001:"IFCPOSITIVEINTEGER",525895558:"IFCNONNEGATIVELENGTHMEASURE",1774176899:"IFCLINEINDEX",1275358634:"IFCLANGUAGEID",2541165894:"IFCDURATION",3701338814:"IFCDAYINWEEKNUMBER",2195413836:"IFCDATETIME",937566702:"IFCDATE",1683019596:"IFCCARDINALPOINTREFERENCE",2314439260:"IFCBINARY",1500781891:"IFCAREADENSITYMEASURE",3683503648:"IFCARCINDEX",4065007721:"IFCYEARNUMBER",1718600412:"IFCWARPINGMOMENTMEASURE",51269191:"IFCWARPINGCONSTANTMEASURE",2593997549:"IFCVOLUMETRICFLOWRATEMEASURE",3458127941:"IFCVOLUMEMEASURE",3345633955:"IFCVAPORPERMEABILITYMEASURE",1278329552:"IFCTORQUEMEASURE",2591213694:"IFCTIMESTAMP",2726807636:"IFCTIMEMEASURE",743184107:"IFCTHERMODYNAMICTEMPERATUREMEASURE",2016195849:"IFCTHERMALTRANSMITTANCEMEASURE",857959152:"IFCTHERMALRESISTANCEMEASURE",2281867870:"IFCTHERMALEXPANSIONCOEFFICIENTMEASURE",2645777649:"IFCTHERMALCONDUCTIVITYMEASURE",232962298:"IFCTHERMALADMITTANCEMEASURE",296282323:"IFCTEXTTRANSFORMATION",603696268:"IFCTEXTFONTNAME",3490877962:"IFCTEXTDECORATION",1460886941:"IFCTEXTALIGNMENT",2801250643:"IFCTEXT",58845555:"IFCTEMPERATUREGRADIENTMEASURE",361837227:"IFCSPECULARROUGHNESS",2757832317:"IFCSPECULAREXPONENT",3477203348:"IFCSPECIFICHEATCAPACITYMEASURE",993287707:"IFCSOUNDPRESSUREMEASURE",846465480:"IFCSOUNDPOWERMEASURE",3471399674:"IFCSOLIDANGLEMEASURE",408310005:"IFCSHEARMODULUSMEASURE",2190458107:"IFCSECTIONALAREAINTEGRALMEASURE",3467162246:"IFCSECTIONMODULUSMEASURE",2766185779:"IFCSECONDINMINUTE",3211557302:"IFCROTATIONALSTIFFNESSMEASURE",1755127002:"IFCROTATIONALMASSMEASURE",2133746277:"IFCROTATIONALFREQUENCYMEASURE",200335297:"IFCREAL",96294661:"IFCRATIOMEASURE",3972513137:"IFCRADIOACTIVITYMEASURE",3665567075:"IFCPRESSUREMEASURE",2169031380:"IFCPRESENTABLETEXT",1364037233:"IFCPOWERMEASURE",1245737093:"IFCPOSITIVERATIOMEASURE",3054510233:"IFCPOSITIVEPLANEANGLEMEASURE",2815919920:"IFCPOSITIVELENGTHMEASURE",4042175685:"IFCPLANEANGLEMEASURE",2642773653:"IFCPLANARFORCEMEASURE",2260317790:"IFCPARAMETERVALUE",929793134:"IFCPHMEASURE",2395907400:"IFCNUMERICMEASURE",2095195183:"IFCNORMALISEDRATIOMEASURE",765770214:"IFCMONTHINYEARNUMBER",2615040989:"IFCMONETARYMEASURE",3114022597:"IFCMOMENTOFINERTIAMEASURE",1648970520:"IFCMOLECULARWEIGHTMEASURE",3177669450:"IFCMOISTUREDIFFUSIVITYMEASURE",1753493141:"IFCMODULUSOFSUBGRADEREACTIONMEASURE",1052454078:"IFCMODULUSOFROTATIONALSUBGRADEREACTIONMEASURE",2173214787:"IFCMODULUSOFLINEARSUBGRADEREACTIONMEASURE",3341486342:"IFCMODULUSOFELASTICITYMEASURE",102610177:"IFCMINUTEINHOUR",3531705166:"IFCMASSPERLENGTHMEASURE",3124614049:"IFCMASSMEASURE",4017473158:"IFCMASSFLOWRATEMEASURE",1477762836:"IFCMASSDENSITYMEASURE",2486716878:"IFCMAGNETICFLUXMEASURE",286949696:"IFCMAGNETICFLUXDENSITYMEASURE",151039812:"IFCLUMINOUSINTENSITYMEASURE",2755797622:"IFCLUMINOUSINTENSITYDISTRIBUTIONMEASURE",2095003142:"IFCLUMINOUSFLUXMEASURE",503418787:"IFCLOGICAL",3086160713:"IFCLINEARVELOCITYMEASURE",1307019551:"IFCLINEARSTIFFNESSMEASURE",2128979029:"IFCLINEARMOMENTMEASURE",191860431:"IFCLINEARFORCEMEASURE",1243674935:"IFCLENGTHMEASURE",3258342251:"IFCLABEL",2054016361:"IFCKINEMATICVISCOSITYMEASURE",3192672207:"IFCISOTHERMALMOISTURECAPACITYMEASURE",3686016028:"IFCIONCONCENTRATIONMEASURE",3809634241:"IFCINTEGERCOUNTRATEMEASURE",1939436016:"IFCINTEGER",2679005408:"IFCINDUCTANCEMEASURE",3358199106:"IFCILLUMINANCEMEASURE",983778844:"IFCIDENTIFIER",2589826445:"IFCHOURINDAY",1158859006:"IFCHEATINGVALUEMEASURE",3113092358:"IFCHEATFLUXDENSITYMEASURE",3064340077:"IFCGLOBALLYUNIQUEID",3044325142:"IFCFREQUENCYMEASURE",1361398929:"IFCFORCEMEASURE",2590844177:"IFCFONTWEIGHT",2715512545:"IFCFONTVARIANT",1102727119:"IFCFONTSTYLE",2078135608:"IFCENERGYMEASURE",2506197118:"IFCELECTRICVOLTAGEMEASURE",2951915441:"IFCELECTRICRESISTANCEMEASURE",3790457270:"IFCELECTRICCURRENTMEASURE",2093906313:"IFCELECTRICCONDUCTANCEMEASURE",3818826038:"IFCELECTRICCHARGEMEASURE",1827137117:"IFCELECTRICCAPACITANCEMEASURE",69416015:"IFCDYNAMICVISCOSITYMEASURE",524656162:"IFCDOSEEQUIVALENTMEASURE",4134073009:"IFCDIMENSIONCOUNT",1514641115:"IFCDESCRIPTIVEMEASURE",300323983:"IFCDAYLIGHTSAVINGHOUR",86635668:"IFCDAYINMONTHNUMBER",94842927:"IFCCURVATUREMEASURE",1778710042:"IFCCOUNTMEASURE",3238673880:"IFCCONTEXTDEPENDENTMEASURE",3812528620:"IFCCOMPOUNDPLANEANGLEMEASURE",2991860651:"IFCCOMPLEXNUMBER",1867003952:"IFCBOXALIGNMENT",2735952531:"IFCBOOLEAN",2650437152:"IFCAREAMEASURE",632304761:"IFCANGULARVELOCITYMEASURE",360377573:"IFCAMOUNTOFSUBSTANCEMEASURE",4182062534:"IFCACCELERATIONMEASURE",3699917729:"IFCABSORBEDDOSEMEASURE",1971632696:"IFCGEOSLICE",2680139844:"IFCGEOMODEL",24726584:"IFCELECTRICFLOWTREATMENTDEVICE",3693000487:"IFCDISTRIBUTIONBOARD",3460952963:"IFCCONVEYORSEGMENT",3999819293:"IFCCAISSONFOUNDATION",3314249567:"IFCBOREHOLE",4196446775:"IFCBEARING",325726236:"IFCALIGNMENT",3425753595:"IFCTRACKELEMENT",991950508:"IFCSIGNAL",3798194928:"IFCREINFORCEDSOIL",3290496277:"IFCRAIL",1383356374:"IFCPAVEMENT",2182337498:"IFCNAVIGATIONELEMENT",234836483:"IFCMOORINGDEVICE",2078563270:"IFCMOBILETELECOMMUNICATIONSAPPLIANCE",1638804497:"IFCLIQUIDTERMINAL",1154579445:"IFCLINEARPOSITIONINGELEMENT",2696325953:"IFCKERB",2713699986:"IFCGEOTECHNICALASSEMBLY",2142170206:"IFCELECTRICFLOWTREATMENTDEVICETYPE",3376911765:"IFCEARTHWORKSFILL",1077100507:"IFCEARTHWORKSELEMENT",3071239417:"IFCEARTHWORKSCUT",479945903:"IFCDISTRIBUTIONBOARDTYPE",3426335179:"IFCDEEPFOUNDATION",1502416096:"IFCCOURSE",2940368186:"IFCCONVEYORSEGMENTTYPE",3203706013:"IFCCAISSONFOUNDATIONTYPE",3862327254:"IFCBUILTSYSTEM",1876633798:"IFCBUILTELEMENT",963979645:"IFCBRIDGEPART",644574406:"IFCBRIDGE",3649138523:"IFCBEARINGTYPE",1662888072:"IFCALIGNMENTVERTICAL",317615605:"IFCALIGNMENTSEGMENT",1545765605:"IFCALIGNMENTHORIZONTAL",4266260250:"IFCALIGNMENTCANT",3956297820:"IFCVIBRATIONDAMPERTYPE",1530820697:"IFCVIBRATIONDAMPER",840318589:"IFCVEHICLE",1953115116:"IFCTRANSPORTATIONDEVICE",618700268:"IFCTRACKELEMENTTYPE",2281632017:"IFCTENDONCONDUITTYPE",3663046924:"IFCTENDONCONDUIT",42703149:"IFCSINESPIRAL",1894708472:"IFCSIGNALTYPE",3599934289:"IFCSIGNTYPE",33720170:"IFCSIGN",1027922057:"IFCSEVENTHORDERPOLYNOMIALSPIRAL",544395925:"IFCSEGMENTEDREFERENCECURVE",3649235739:"IFCSECONDORDERPOLYNOMIALSPIRAL",550521510:"IFCROADPART",146592293:"IFCROAD",3818125796:"IFCRELADHERESTOELEMENT",4021432810:"IFCREFERENT",1891881377:"IFCRAILWAYPART",3992365140:"IFCRAILWAY",1763565496:"IFCRAILTYPE",1946335990:"IFCPOSITIONINGELEMENT",514975943:"IFCPAVEMENTTYPE",506776471:"IFCNAVIGATIONELEMENTTYPE",710110818:"IFCMOORINGDEVICETYPE",1950438474:"IFCMOBILETELECOMMUNICATIONSAPPLIANCETYPE",976884017:"IFCMARINEPART",525669439:"IFCMARINEFACILITY",1770583370:"IFCLIQUIDTERMINALTYPE",2176059722:"IFCLINEARELEMENT",679976338:"IFCKERBTYPE",3948183225:"IFCIMPACTPROTECTIONDEVICETYPE",2568555532:"IFCIMPACTPROTECTIONDEVICE",2898700619:"IFCGRADIENTCURVE",1594536857:"IFCGEOTECHNICALSTRATUM",4230923436:"IFCGEOTECHNICALELEMENT",4228831410:"IFCFACILITYPARTCOMMON",1310830890:"IFCFACILITYPART",24185140:"IFCFACILITY",4234616927:"IFCDIRECTRIXDERIVEDREFERENCESWEPTAREASOLID",1306400036:"IFCDEEPFOUNDATIONTYPE",4189326743:"IFCCOURSETYPE",2000195564:"IFCCOSINESPIRAL",3497074424:"IFCCLOTHOID",1626504194:"IFCBUILTELEMENTTYPE",3651464721:"IFCVEHICLETYPE",1229763772:"IFCTRIANGULATEDIRREGULARNETWORK",3665877780:"IFCTRANSPORTATIONDEVICETYPE",782932809:"IFCTHIRDORDERPOLYNOMIALSPIRAL",2735484536:"IFCSPIRAL",1356537516:"IFCSECTIONEDSURFACE",1290935644:"IFCSECTIONEDSOLIDHORIZONTAL",1862484736:"IFCSECTIONEDSOLID",1441486842:"IFCRELPOSITIONS",1033248425:"IFCRELASSOCIATESPROFILEDEF",3381221214:"IFCPOLYNOMIALCURVE",2485787929:"IFCOFFSETCURVEBYDISTANCES",590820931:"IFCOFFSETCURVE",3465909080:"IFCINDEXEDPOLYGONALTEXTUREMAP",593015953:"IFCDIRECTRIXCURVESWEPTAREASOLID",4212018352:"IFCCURVESEGMENT",3425423356:"IFCAXIS2PLACEMENTLINEAR",823603102:"IFCSEGMENT",2165702409:"IFCPOINTBYDISTANCEEXPRESSION",182550632:"IFCOPENCROSSPROFILEDEF",388784114:"IFCLINEARPLACEMENT",536804194:"IFCALIGNMENTHORIZONTALSEGMENT",3752311538:"IFCALIGNMENTCANTSEGMENT",1010789467:"IFCTEXTURECOORDINATEINDICESWITHVOIDS",222769930:"IFCTEXTURECOORDINATEINDICES",2691318326:"IFCQUANTITYNUMBER",3633395639:"IFCALIGNMENTVERTICALSEGMENT",2879124712:"IFCALIGNMENTPARAMETERSEGMENT",25142252:"IFCCONTROLLER",3087945054:"IFCALARM",4288193352:"IFCACTUATOR",630975310:"IFCUNITARYCONTROLELEMENT",4086658281:"IFCSENSOR",2295281155:"IFCPROTECTIVEDEVICETRIPPINGUNIT",182646315:"IFCFLOWINSTRUMENT",1426591983:"IFCFIRESUPPRESSIONTERMINAL",819412036:"IFCFILTER",3415622556:"IFCFAN",1003880860:"IFCELECTRICTIMECONTROL",402227799:"IFCELECTRICMOTOR",264262732:"IFCELECTRICGENERATOR",3310460725:"IFCELECTRICFLOWSTORAGEDEVICE",862014818:"IFCELECTRICDISTRIBUTIONBOARD",1904799276:"IFCELECTRICAPPLIANCE",1360408905:"IFCDUCTSILENCER",3518393246:"IFCDUCTSEGMENT",342316401:"IFCDUCTFITTING",562808652:"IFCDISTRIBUTIONCIRCUIT",4074379575:"IFCDAMPER",3640358203:"IFCCOOLINGTOWER",4136498852:"IFCCOOLEDBEAM",2272882330:"IFCCONDENSER",3571504051:"IFCCOMPRESSOR",3221913625:"IFCCOMMUNICATIONSAPPLIANCE",639361253:"IFCCOIL",3902619387:"IFCCHILLER",4217484030:"IFCCABLESEGMENT",1051757585:"IFCCABLEFITTING",3758799889:"IFCCABLECARRIERSEGMENT",635142910:"IFCCABLECARRIERFITTING",2938176219:"IFCBURNER",32344328:"IFCBOILER",2906023776:"IFCBEAMSTANDARDCASE",277319702:"IFCAUDIOVISUALAPPLIANCE",2056796094:"IFCAIRTOAIRHEATRECOVERY",177149247:"IFCAIRTERMINALBOX",1634111441:"IFCAIRTERMINAL",486154966:"IFCWINDOWSTANDARDCASE",4237592921:"IFCWASTETERMINAL",4156078855:"IFCWALLELEMENTEDCASE",4207607924:"IFCVALVE",4292641817:"IFCUNITARYEQUIPMENT",3179687236:"IFCUNITARYCONTROLELEMENTTYPE",3026737570:"IFCTUBEBUNDLE",3825984169:"IFCTRANSFORMER",812556717:"IFCTANK",1162798199:"IFCSWITCHINGDEVICE",385403989:"IFCSTRUCTURALLOADCASE",1404847402:"IFCSTACKTERMINAL",1999602285:"IFCSPACEHEATER",3420628829:"IFCSOLARDEVICE",3027962421:"IFCSLABSTANDARDCASE",3127900445:"IFCSLABELEMENTEDCASE",1329646415:"IFCSHADINGDEVICE",3053780830:"IFCSANITARYTERMINAL",2572171363:"IFCREINFORCINGBARTYPE",1232101972:"IFCRATIONALBSPLINECURVEWITHKNOTS",90941305:"IFCPUMP",655969474:"IFCPROTECTIVEDEVICETRIPPINGUNITTYPE",738039164:"IFCPROTECTIVEDEVICE",1156407060:"IFCPLATESTANDARDCASE",3612865200:"IFCPIPESEGMENT",310824031:"IFCPIPEFITTING",3694346114:"IFCOUTLET",144952367:"IFCOUTERBOUNDARYCURVE",2474470126:"IFCMOTORCONNECTION",1911478936:"IFCMEMBERSTANDARDCASE",1437502449:"IFCMEDICALDEVICE",629592764:"IFCLIGHTFIXTURE",76236018:"IFCLAMP",2176052936:"IFCJUNCTIONBOX",4175244083:"IFCINTERCEPTOR",2068733104:"IFCHUMIDIFIER",3319311131:"IFCHEATEXCHANGER",2188021234:"IFCFLOWMETER",1209101575:"IFCEXTERNALSPATIALELEMENT",484807127:"IFCEVAPORATOR",3747195512:"IFCEVAPORATIVECOOLER",2814081492:"IFCENGINE",2417008758:"IFCELECTRICDISTRIBUTIONBOARDTYPE",3242481149:"IFCDOORSTANDARDCASE",3205830791:"IFCDISTRIBUTIONSYSTEM",400855858:"IFCCOMMUNICATIONSAPPLIANCETYPE",905975707:"IFCCOLUMNSTANDARDCASE",1677625105:"IFCCIVILELEMENT",3296154744:"IFCCHIMNEY",2674252688:"IFCCABLEFITTINGTYPE",2188180465:"IFCBURNERTYPE",1177604601:"IFCBUILDINGSYSTEM",39481116:"IFCBUILDINGELEMENTPARTTYPE",1136057603:"IFCBOUNDARYCURVE",2461110595:"IFCBSPLINECURVEWITHKNOTS",1532957894:"IFCAUDIOVISUALAPPLIANCETYPE",4088093105:"IFCWORKCALENDAR",4009809668:"IFCWINDOWTYPE",926996030:"IFCVOIDINGFEATURE",2391383451:"IFCVIBRATIONISOLATOR",2415094496:"IFCTENDONTYPE",3081323446:"IFCTENDONANCHORTYPE",413509423:"IFCSYSTEMFURNITUREELEMENT",3101698114:"IFCSURFACEFEATURE",3657597509:"IFCSTRUCTURALSURFACEACTION",2757150158:"IFCSTRUCTURALCURVEREACTION",1004757350:"IFCSTRUCTURALCURVEACTION",338393293:"IFCSTAIRTYPE",1072016465:"IFCSOLARDEVICETYPE",4074543187:"IFCSHADINGDEVICETYPE",2157484638:"IFCSEAMCURVE",2781568857:"IFCROOFTYPE",2310774935:"IFCREINFORCINGMESHTYPE",964333572:"IFCREINFORCINGELEMENTTYPE",683857671:"IFCRATIONALBSPLINESURFACEWITHKNOTS",1469900589:"IFCRAMPTYPE",2839578677:"IFCPOLYGONALFACESET",1158309216:"IFCPILETYPE",3079942009:"IFCOPENINGSTANDARDCASE",1114901282:"IFCMEDICALDEVICETYPE",3113134337:"IFCINTERSECTIONCURVE",3946677679:"IFCINTERCEPTORTYPE",2571569899:"IFCINDEXEDPOLYCURVE",3493046030:"IFCGEOGRAPHICELEMENT",1509553395:"IFCFURNITURE",1893162501:"IFCFOOTINGTYPE",2853485674:"IFCEXTERNALSPATIALSTRUCTUREELEMENT",4148101412:"IFCEVENT",132023988:"IFCENGINETYPE",2397081782:"IFCELEMENTASSEMBLYTYPE",2323601079:"IFCDOORTYPE",1213902940:"IFCCYLINDRICALSURFACE",1525564444:"IFCCONSTRUCTIONPRODUCTRESOURCETYPE",4105962743:"IFCCONSTRUCTIONMATERIALRESOURCETYPE",2185764099:"IFCCONSTRUCTIONEQUIPMENTRESOURCETYPE",15328376:"IFCCOMPOSITECURVEONSURFACE",3875453745:"IFCCOMPLEXPROPERTYTEMPLATE",3893394355:"IFCCIVILELEMENTTYPE",2197970202:"IFCCHIMNEYTYPE",167062518:"IFCBSPLINESURFACEWITHKNOTS",2887950389:"IFCBSPLINESURFACE",2603310189:"IFCADVANCEDBREPWITHVOIDS",1635779807:"IFCADVANCEDBREP",2916149573:"IFCTRIANGULATEDFACESET",1935646853:"IFCTOROIDALSURFACE",2387106220:"IFCTESSELLATEDFACESET",3206491090:"IFCTASKTYPE",699246055:"IFCSURFACECURVE",4095615324:"IFCSUBCONTRACTRESOURCETYPE",603775116:"IFCSTRUCTURALSURFACEREACTION",4015995234:"IFCSPHERICALSURFACE",2481509218:"IFCSPATIALZONETYPE",463610769:"IFCSPATIALZONE",710998568:"IFCSPATIALELEMENTTYPE",1412071761:"IFCSPATIALELEMENT",3663146110:"IFCSIMPLEPROPERTYTEMPLATE",3243963512:"IFCREVOLVEDAREASOLIDTAPERED",816062949:"IFCREPARAMETRISEDCOMPOSITECURVESEGMENT",1521410863:"IFCRELSPACEBOUNDARY2NDLEVEL",3523091289:"IFCRELSPACEBOUNDARY1STLEVEL",427948657:"IFCRELINTERFERESELEMENTS",307848117:"IFCRELDEFINESBYTEMPLATE",1462361463:"IFCRELDEFINESBYOBJECT",2565941209:"IFCRELDECLARES",1027710054:"IFCRELASSIGNSTOGROUPBYFACTOR",3521284610:"IFCPROPERTYTEMPLATE",492091185:"IFCPROPERTYSETTEMPLATE",653396225:"IFCPROJECTLIBRARY",569719735:"IFCPROCEDURETYPE",3967405729:"IFCPREDEFINEDPROPERTYSET",1682466193:"IFCPCURVE",428585644:"IFCLABORRESOURCETYPE",2294589976:"IFCINDEXEDPOLYGONALFACEWITHVOIDS",178912537:"IFCINDEXEDPOLYGONALFACE",4095422895:"IFCGEOGRAPHICELEMENTTYPE",2652556860:"IFCFIXEDREFERENCESWEPTAREASOLID",2804161546:"IFCEXTRUDEDAREASOLIDTAPERED",4024345920:"IFCEVENTTYPE",2629017746:"IFCCURVEBOUNDEDSURFACE",1815067380:"IFCCREWRESOURCETYPE",3419103109:"IFCCONTEXT",2574617495:"IFCCONSTRUCTIONRESOURCETYPE",2059837836:"IFCCARTESIANPOINTLIST3D",1675464909:"IFCCARTESIANPOINTLIST2D",574549367:"IFCCARTESIANPOINTLIST",3406155212:"IFCADVANCEDFACE",3698973494:"IFCTYPERESOURCE",3736923433:"IFCTYPEPROCESS",901063453:"IFCTESSELLATEDITEM",1096409881:"IFCSWEPTDISKSOLIDPOLYGONAL",1042787934:"IFCRESOURCETIME",1608871552:"IFCRESOURCECONSTRAINTRELATIONSHIP",2943643501:"IFCRESOURCEAPPROVALRELATIONSHIP",2090586900:"IFCQUANTITYSET",1482703590:"IFCPROPERTYTEMPLATEDEFINITION",3778827333:"IFCPREDEFINEDPROPERTIES",2998442950:"IFCMIRROREDPROFILEDEF",853536259:"IFCMATERIALRELATIONSHIP",3404854881:"IFCMATERIALPROFILESETUSAGETAPERING",3079605661:"IFCMATERIALPROFILESETUSAGE",2852063980:"IFCMATERIALCONSTITUENTSET",3708119e3:"IFCMATERIALCONSTITUENT",1585845231:"IFCLAGTIME",2133299955:"IFCINDEXEDTRIANGLETEXTUREMAP",1437953363:"IFCINDEXEDTEXTUREMAP",3570813810:"IFCINDEXEDCOLOURMAP",1437805879:"IFCEXTERNALREFERENCERELATIONSHIP",297599258:"IFCEXTENDEDPROPERTIES",211053100:"IFCEVENTTIME",2713554722:"IFCCONVERSIONBASEDUNITWITHOFFSET",3285139300:"IFCCOLOURRGBLIST",1236880293:"IFCWORKTIME",1199560280:"IFCTIMEPERIOD",3611470254:"IFCTEXTUREVERTEXLIST",2771591690:"IFCTASKTIMERECURRING",1549132990:"IFCTASKTIME",2043862942:"IFCTABLECOLUMN",2934153892:"IFCSURFACEREINFORCEMENTAREA",609421318:"IFCSTRUCTURALLOADORRESULT",3478079324:"IFCSTRUCTURALLOADCONFIGURATION",1054537805:"IFCSCHEDULINGTIME",2439245199:"IFCRESOURCELEVELRELATIONSHIP",2433181523:"IFCREFERENCE",3915482550:"IFCRECURRENCEPATTERN",986844984:"IFCPROPERTYABSTRACTION",3843373140:"IFCPROJECTEDCRS",677532197:"IFCPRESENTATIONITEM",1507914824:"IFCMATERIALUSAGEDEFINITION",552965576:"IFCMATERIALPROFILEWITHOFFSETS",164193824:"IFCMATERIALPROFILESET",2235152071:"IFCMATERIALPROFILE",1847252529:"IFCMATERIALLAYERWITHOFFSETS",760658860:"IFCMATERIALDEFINITION",3057273783:"IFCMAPCONVERSION",4294318154:"IFCEXTERNALINFORMATION",1466758467:"IFCCOORDINATEREFERENCESYSTEM",1785450214:"IFCCOORDINATEOPERATION",775493141:"IFCCONNECTIONVOLUMEGEOMETRY",979691226:"IFCREINFORCINGBAR",3700593921:"IFCELECTRICDISTRIBUTIONPOINT",1062813311:"IFCDISTRIBUTIONCONTROLELEMENT",1052013943:"IFCDISTRIBUTIONCHAMBERELEMENT",578613899:"IFCCONTROLLERTYPE",2454782716:"IFCCHAMFEREDGEFEATURE",753842376:"IFCBEAM",3001207471:"IFCALARMTYPE",2874132201:"IFCACTUATORTYPE",3304561284:"IFCWINDOW",3512223829:"IFCWALLSTANDARDCASE",2391406946:"IFCWALL",3313531582:"IFCVIBRATIONISOLATORTYPE",2347447852:"IFCTENDONANCHOR",3824725483:"IFCTENDON",2515109513:"IFCSTRUCTURALANALYSISMODEL",4252922144:"IFCSTAIRFLIGHT",331165859:"IFCSTAIR",1529196076:"IFCSLAB",1783015770:"IFCSENSORTYPE",1376911519:"IFCROUNDEDEDGEFEATURE",2016517767:"IFCROOF",2320036040:"IFCREINFORCINGMESH",3027567501:"IFCREINFORCINGELEMENT",3055160366:"IFCRATIONALBEZIERCURVE",3283111854:"IFCRAMPFLIGHT",3024970846:"IFCRAMP",2262370178:"IFCRAILING",3171933400:"IFCPLATE",1687234759:"IFCPILE",1073191201:"IFCMEMBER",900683007:"IFCFOOTING",3508470533:"IFCFLOWTREATMENTDEVICE",2223149337:"IFCFLOWTERMINAL",707683696:"IFCFLOWSTORAGEDEVICE",987401354:"IFCFLOWSEGMENT",3132237377:"IFCFLOWMOVINGDEVICE",4037862832:"IFCFLOWINSTRUMENTTYPE",4278956645:"IFCFLOWFITTING",2058353004:"IFCFLOWCONTROLLER",4222183408:"IFCFIRESUPPRESSIONTERMINALTYPE",1810631287:"IFCFILTERTYPE",346874300:"IFCFANTYPE",1658829314:"IFCENERGYCONVERSIONDEVICE",857184966:"IFCELECTRICALELEMENT",1634875225:"IFCELECTRICALCIRCUIT",712377611:"IFCELECTRICTIMECONTROLTYPE",1217240411:"IFCELECTRICMOTORTYPE",1365060375:"IFCELECTRICHEATERTYPE",1534661035:"IFCELECTRICGENERATORTYPE",3277789161:"IFCELECTRICFLOWSTORAGEDEVICETYPE",663422040:"IFCELECTRICAPPLIANCETYPE",855621170:"IFCEDGEFEATURE",2030761528:"IFCDUCTSILENCERTYPE",3760055223:"IFCDUCTSEGMENTTYPE",869906466:"IFCDUCTFITTINGTYPE",395920057:"IFCDOOR",3041715199:"IFCDISTRIBUTIONPORT",3040386961:"IFCDISTRIBUTIONFLOWELEMENT",1945004755:"IFCDISTRIBUTIONELEMENT",2063403501:"IFCDISTRIBUTIONCONTROLELEMENTTYPE",1599208980:"IFCDISTRIBUTIONCHAMBERELEMENTTYPE",2635815018:"IFCDISCRETEACCESSORYTYPE",1335981549:"IFCDISCRETEACCESSORY",4147604152:"IFCDIAMETERDIMENSION",3961806047:"IFCDAMPERTYPE",3495092785:"IFCCURTAINWALL",1973544240:"IFCCOVERING",2954562838:"IFCCOOLINGTOWERTYPE",335055490:"IFCCOOLEDBEAMTYPE",488727124:"IFCCONSTRUCTIONPRODUCTRESOURCE",1060000209:"IFCCONSTRUCTIONMATERIALRESOURCE",3898045240:"IFCCONSTRUCTIONEQUIPMENTRESOURCE",1163958913:"IFCCONDITIONCRITERION",2188551683:"IFCCONDITION",2816379211:"IFCCONDENSERTYPE",3850581409:"IFCCOMPRESSORTYPE",843113511:"IFCCOLUMN",2301859152:"IFCCOILTYPE",2611217952:"IFCCIRCLE",2951183804:"IFCCHILLERTYPE",1285652485:"IFCCABLESEGMENTTYPE",3293546465:"IFCCABLECARRIERSEGMENTTYPE",395041908:"IFCCABLECARRIERFITTINGTYPE",1909888760:"IFCBUILDINGELEMENTPROXYTYPE",1095909175:"IFCBUILDINGELEMENTPROXY",2979338954:"IFCBUILDINGELEMENTPART",52481810:"IFCBUILDINGELEMENTCOMPONENT",3299480353:"IFCBUILDINGELEMENT",231477066:"IFCBOILERTYPE",1916977116:"IFCBEZIERCURVE",819618141:"IFCBEAMTYPE",1967976161:"IFCBSPLINECURVE",3460190687:"IFCASSET",2470393545:"IFCANGULARDIMENSION",1871374353:"IFCAIRTOAIRHEATRECOVERYTYPE",3352864051:"IFCAIRTERMINALTYPE",1411407467:"IFCAIRTERMINALBOXTYPE",3821786052:"IFCACTIONREQUEST",1213861670:"IFC2DCOMPOSITECURVE",1033361043:"IFCZONE",3342526732:"IFCWORKSCHEDULE",4218914973:"IFCWORKPLAN",1028945134:"IFCWORKCONTROL",1133259667:"IFCWASTETERMINALTYPE",1898987631:"IFCWALLTYPE",2769231204:"IFCVIRTUALELEMENT",728799441:"IFCVALVETYPE",1911125066:"IFCUNITARYEQUIPMENTTYPE",1600972822:"IFCTUBEBUNDLETYPE",3593883385:"IFCTRIMMEDCURVE",1620046519:"IFCTRANSPORTELEMENT",1692211062:"IFCTRANSFORMERTYPE",1637806684:"IFCTIMESERIESSCHEDULE",5716631:"IFCTANKTYPE",2254336722:"IFCSYSTEM",2315554128:"IFCSWITCHINGDEVICETYPE",148013059:"IFCSUBCONTRACTRESOURCE",1975003073:"IFCSTRUCTURALSURFACECONNECTION",2986769608:"IFCSTRUCTURALRESULTGROUP",1235345126:"IFCSTRUCTURALPOINTREACTION",734778138:"IFCSTRUCTURALPOINTCONNECTION",2082059205:"IFCSTRUCTURALPOINTACTION",3987759626:"IFCSTRUCTURALPLANARACTIONVARYING",1621171031:"IFCSTRUCTURALPLANARACTION",1252848954:"IFCSTRUCTURALLOADGROUP",1721250024:"IFCSTRUCTURALLINEARACTIONVARYING",1807405624:"IFCSTRUCTURALLINEARACTION",2445595289:"IFCSTRUCTURALCURVEMEMBERVARYING",214636428:"IFCSTRUCTURALCURVEMEMBER",4243806635:"IFCSTRUCTURALCURVECONNECTION",1179482911:"IFCSTRUCTURALCONNECTION",682877961:"IFCSTRUCTURALACTION",1039846685:"IFCSTAIRFLIGHTTYPE",3112655638:"IFCSTACKTERMINALTYPE",3812236995:"IFCSPACETYPE",652456506:"IFCSPACEPROGRAM",1305183839:"IFCSPACEHEATERTYPE",3856911033:"IFCSPACE",2533589738:"IFCSLABTYPE",4097777520:"IFCSITE",4105383287:"IFCSERVICELIFE",3517283431:"IFCSCHEDULETIMECONTROL",1768891740:"IFCSANITARYTERMINALTYPE",2863920197:"IFCRELASSIGNSTASKS",160246688:"IFCRELAGGREGATES",2324767716:"IFCRAMPFLIGHTTYPE",2893384427:"IFCRAILINGTYPE",3248260540:"IFCRADIUSDIMENSION",2250791053:"IFCPUMPTYPE",1842657554:"IFCPROTECTIVEDEVICETYPE",3651124850:"IFCPROJECTIONELEMENT",3642467123:"IFCPROJECTORDERRECORD",2904328755:"IFCPROJECTORDER",2744685151:"IFCPROCEDURE",3740093272:"IFCPORT",3724593414:"IFCPOLYLINE",4017108033:"IFCPLATETYPE",4231323485:"IFCPIPESEGMENTTYPE",804291784:"IFCPIPEFITTINGTYPE",3327091369:"IFCPERMIT",2382730787:"IFCPERFORMANCEHISTORY",2837617999:"IFCOUTLETTYPE",3425660407:"IFCORDERACTION",3588315303:"IFCOPENINGELEMENT",4143007308:"IFCOCCUPANT",1916936684:"IFCMOVE",977012517:"IFCMOTORCONNECTIONTYPE",3181161470:"IFCMEMBERTYPE",2108223431:"IFCMECHANICALFASTENERTYPE",377706215:"IFCMECHANICALFASTENER",2506943328:"IFCLINEARDIMENSION",1161773419:"IFCLIGHTFIXTURETYPE",1051575348:"IFCLAMPTYPE",3827777499:"IFCLABORRESOURCE",4288270099:"IFCJUNCTIONBOXTYPE",2391368822:"IFCINVENTORY",1806887404:"IFCHUMIDIFIERTYPE",1251058090:"IFCHEATEXCHANGERTYPE",2706460486:"IFCGROUP",3009204131:"IFCGRID",200128114:"IFCGASTERMINALTYPE",814719939:"IFCFURNITURESTANDARD",263784265:"IFCFURNISHINGELEMENT",3009222698:"IFCFLOWTREATMENTDEVICETYPE",2297155007:"IFCFLOWTERMINALTYPE",1339347760:"IFCFLOWSTORAGEDEVICETYPE",1834744321:"IFCFLOWSEGMENTTYPE",1482959167:"IFCFLOWMOVINGDEVICETYPE",3815607619:"IFCFLOWMETERTYPE",3198132628:"IFCFLOWFITTINGTYPE",3907093117:"IFCFLOWCONTROLLERTYPE",1287392070:"IFCFEATUREELEMENTSUBTRACTION",2143335405:"IFCFEATUREELEMENTADDITION",2827207264:"IFCFEATUREELEMENT",2489546625:"IFCFASTENERTYPE",647756555:"IFCFASTENER",3737207727:"IFCFACETEDBREPWITHVOIDS",807026263:"IFCFACETEDBREP",3390157468:"IFCEVAPORATORTYPE",3174744832:"IFCEVAPORATIVECOOLERTYPE",3272907226:"IFCEQUIPMENTSTANDARD",1962604670:"IFCEQUIPMENTELEMENT",2107101300:"IFCENERGYCONVERSIONDEVICETYPE",1704287377:"IFCELLIPSE",2590856083:"IFCELEMENTCOMPONENTTYPE",1623761950:"IFCELEMENTCOMPONENT",4123344466:"IFCELEMENTASSEMBLY",1758889154:"IFCELEMENT",360485395:"IFCELECTRICALBASEPROPERTIES",3849074793:"IFCDISTRIBUTIONFLOWELEMENTTYPE",3256556792:"IFCDISTRIBUTIONELEMENTTYPE",681481545:"IFCDIMENSIONCURVEDIRECTEDCALLOUT",1457835157:"IFCCURTAINWALLTYPE",3295246426:"IFCCREWRESOURCE",1916426348:"IFCCOVERINGTYPE",1419761937:"IFCCOSTSCHEDULE",3895139033:"IFCCOSTITEM",3293443760:"IFCCONTROL",2559216714:"IFCCONSTRUCTIONRESOURCE",2510884976:"IFCCONIC",3732776249:"IFCCOMPOSITECURVE",300633059:"IFCCOLUMNTYPE",2937912522:"IFCCIRCLEHOLLOWPROFILEDEF",3124254112:"IFCBUILDINGSTOREY",1950629157:"IFCBUILDINGELEMENTTYPE",4031249490:"IFCBUILDING",1260505505:"IFCBOUNDEDCURVE",3649129432:"IFCBOOLEANCLIPPINGRESULT",1334484129:"IFCBLOCK",3207858831:"IFCASYMMETRICISHAPEPROFILEDEF",1674181508:"IFCANNOTATION",2296667514:"IFCACTOR",2097647324:"IFCTRANSPORTELEMENTTYPE",3473067441:"IFCTASK",1580310250:"IFCSYSTEMFURNITUREELEMENTTYPE",4124788165:"IFCSURFACEOFREVOLUTION",2809605785:"IFCSURFACEOFLINEAREXTRUSION",2028607225:"IFCSURFACECURVESWEPTAREASOLID",4070609034:"IFCSTRUCTUREDDIMENSIONCALLOUT",2218152070:"IFCSTRUCTURALSURFACEMEMBERVARYING",3979015343:"IFCSTRUCTURALSURFACEMEMBER",3689010777:"IFCSTRUCTURALREACTION",530289379:"IFCSTRUCTURALMEMBER",3136571912:"IFCSTRUCTURALITEM",3544373492:"IFCSTRUCTURALACTIVITY",451544542:"IFCSPHERE",3893378262:"IFCSPATIALSTRUCTUREELEMENTTYPE",2706606064:"IFCSPATIALSTRUCTUREELEMENT",3626867408:"IFCRIGHTCIRCULARCYLINDER",4158566097:"IFCRIGHTCIRCULARCONE",1856042241:"IFCREVOLVEDAREASOLID",2914609552:"IFCRESOURCE",1401173127:"IFCRELVOIDSELEMENT",3451746338:"IFCRELSPACEBOUNDARY",366585022:"IFCRELSERVICESBUILDINGS",4122056220:"IFCRELSEQUENCE",1058617721:"IFCRELSCHEDULESCOSTITEMS",1245217292:"IFCRELREFERENCEDINSPATIALSTRUCTURE",750771296:"IFCRELPROJECTSELEMENT",202636808:"IFCRELOVERRIDESPROPERTIES",2051452291:"IFCRELOCCUPIESSPACES",3268803585:"IFCRELNESTS",4189434867:"IFCRELINTERACTIONREQUIREMENTS",279856033:"IFCRELFLOWCONTROLELEMENTS",3940055652:"IFCRELFILLSELEMENT",781010003:"IFCRELDEFINESBYTYPE",4186316022:"IFCRELDEFINESBYPROPERTIES",693640335:"IFCRELDEFINES",2551354335:"IFCRELDECOMPOSES",2802773753:"IFCRELCOVERSSPACES",886880790:"IFCRELCOVERSBLDGELEMENTS",3242617779:"IFCRELCONTAINEDINSPATIALSTRUCTURE",3678494232:"IFCRELCONNECTSWITHREALIZINGELEMENTS",504942748:"IFCRELCONNECTSWITHECCENTRICITY",1638771189:"IFCRELCONNECTSSTRUCTURALMEMBER",3912681535:"IFCRELCONNECTSSTRUCTURALELEMENT",2127690289:"IFCRELCONNECTSSTRUCTURALACTIVITY",3190031847:"IFCRELCONNECTSPORTS",4201705270:"IFCRELCONNECTSPORTTOELEMENT",3945020480:"IFCRELCONNECTSPATHELEMENTS",1204542856:"IFCRELCONNECTSELEMENTS",826625072:"IFCRELCONNECTS",2851387026:"IFCRELASSOCIATESPROFILEPROPERTIES",2655215786:"IFCRELASSOCIATESMATERIAL",3840914261:"IFCRELASSOCIATESLIBRARY",982818633:"IFCRELASSOCIATESDOCUMENT",2728634034:"IFCRELASSOCIATESCONSTRAINT",919958153:"IFCRELASSOCIATESCLASSIFICATION",4095574036:"IFCRELASSOCIATESAPPROVAL",1327628568:"IFCRELASSOCIATESAPPLIEDVALUE",1865459582:"IFCRELASSOCIATES",205026976:"IFCRELASSIGNSTORESOURCE",3372526763:"IFCRELASSIGNSTOPROJECTORDER",2857406711:"IFCRELASSIGNSTOPRODUCT",4278684876:"IFCRELASSIGNSTOPROCESS",1307041759:"IFCRELASSIGNSTOGROUP",2495723537:"IFCRELASSIGNSTOCONTROL",1683148259:"IFCRELASSIGNSTOACTOR",3939117080:"IFCRELASSIGNS",3454111270:"IFCRECTANGULARTRIMMEDSURFACE",2798486643:"IFCRECTANGULARPYRAMID",2770003689:"IFCRECTANGLEHOLLOWPROFILEDEF",3219374653:"IFCPROXY",1451395588:"IFCPROPERTYSET",4194566429:"IFCPROJECTIONCURVE",103090709:"IFCPROJECT",4208778838:"IFCPRODUCT",2945172077:"IFCPROCESS",220341763:"IFCPLANE",603570806:"IFCPLANARBOX",3566463478:"IFCPERMEABLECOVERINGPROPERTIES",3505215534:"IFCOFFSETCURVE3D",3388369263:"IFCOFFSETCURVE2D",3888040117:"IFCOBJECT",1425443689:"IFCMANIFOLDSOLIDBREP",1281925730:"IFCLINE",572779678:"IFCLSHAPEPROFILEDEF",1484403080:"IFCISHAPEPROFILEDEF",987898635:"IFCGEOMETRICCURVESET",1268542332:"IFCFURNITURETYPE",4238390223:"IFCFURNISHINGELEMENTTYPE",3455213021:"IFCFLUIDFLOWPROPERTIES",315944413:"IFCFILLAREASTYLETILES",4203026998:"IFCFILLAREASTYLETILESYMBOLWITHSTYLE",374418227:"IFCFILLAREASTYLEHATCHING",2047409740:"IFCFACEBASEDSURFACEMODEL",477187591:"IFCEXTRUDEDAREASOLID",80994333:"IFCENERGYPROPERTIES",2835456948:"IFCELLIPSEPROFILEDEF",2777663545:"IFCELEMENTARYSURFACE",339256511:"IFCELEMENTTYPE",1883228015:"IFCELEMENTQUANTITY",1472233963:"IFCEDGELOOP",4006246654:"IFCDRAUGHTINGPREDEFINEDCURVEFONT",445594917:"IFCDRAUGHTINGPREDEFINEDCOLOUR",3073041342:"IFCDRAUGHTINGCALLOUT",526551008:"IFCDOORSTYLE",1714330368:"IFCDOORPANELPROPERTIES",2963535650:"IFCDOORLININGPROPERTIES",32440307:"IFCDIRECTION",4054601972:"IFCDIMENSIONCURVETERMINATOR",606661476:"IFCDIMENSIONCURVE",693772133:"IFCDEFINEDSYMBOL",2827736869:"IFCCURVEBOUNDEDPLANE",2601014836:"IFCCURVE",2147822146:"IFCCSGSOLID",2506170314:"IFCCSGPRIMITIVE3D",194851669:"IFCCRANERAILFSHAPEPROFILEDEF",4133800736:"IFCCRANERAILASHAPEPROFILEDEF",2485617015:"IFCCOMPOSITECURVESEGMENT",2205249479:"IFCCLOSEDSHELL",1383045692:"IFCCIRCLEPROFILEDEF",1416205885:"IFCCARTESIANTRANSFORMATIONOPERATOR3DNONUNIFORM",3331915920:"IFCCARTESIANTRANSFORMATIONOPERATOR3D",3486308946:"IFCCARTESIANTRANSFORMATIONOPERATOR2DNONUNIFORM",3749851601:"IFCCARTESIANTRANSFORMATIONOPERATOR2D",59481748:"IFCCARTESIANTRANSFORMATIONOPERATOR",1123145078:"IFCCARTESIANPOINT",2898889636:"IFCCSHAPEPROFILEDEF",2713105998:"IFCBOXEDHALFSPACE",2581212453:"IFCBOUNDINGBOX",4182860854:"IFCBOUNDEDSURFACE",2736907675:"IFCBOOLEANRESULT",2740243338:"IFCAXIS2PLACEMENT3D",3125803723:"IFCAXIS2PLACEMENT2D",4261334040:"IFCAXIS1PLACEMENT",1302238472:"IFCANNOTATIONSURFACE",2265737646:"IFCANNOTATIONFILLAREAOCCURRENCE",669184980:"IFCANNOTATIONFILLAREA",3288037868:"IFCANNOTATIONCURVEOCCURRENCE",2543172580:"IFCZSHAPEPROFILEDEF",1299126871:"IFCWINDOWSTYLE",512836454:"IFCWINDOWPANELPROPERTIES",336235671:"IFCWINDOWLININGPROPERTIES",2759199220:"IFCVERTEXLOOP",1417489154:"IFCVECTOR",427810014:"IFCUSHAPEPROFILEDEF",2347495698:"IFCTYPEPRODUCT",1628702193:"IFCTYPEOBJECT",1345879162:"IFCTWODIRECTIONREPEATFACTOR",2715220739:"IFCTRAPEZIUMPROFILEDEF",3124975700:"IFCTEXTLITERALWITHEXTENT",4282788508:"IFCTEXTLITERAL",3028897424:"IFCTERMINATORSYMBOL",3071757647:"IFCTSHAPEPROFILEDEF",230924584:"IFCSWEPTSURFACE",1260650574:"IFCSWEPTDISKSOLID",2247615214:"IFCSWEPTAREASOLID",1878645084:"IFCSURFACESTYLERENDERING",2513912981:"IFCSURFACE",2233826070:"IFCSUBEDGE",3653947884:"IFCSTRUCTURALSTEELPROFILEPROPERTIES",3843319758:"IFCSTRUCTURALPROFILEPROPERTIES",1190533807:"IFCSTRUCTURALLOADSINGLEFORCEWARPING",1597423693:"IFCSTRUCTURALLOADSINGLEFORCE",1973038258:"IFCSTRUCTURALLOADSINGLEDISPLACEMENTDISTORTION",2473145415:"IFCSTRUCTURALLOADSINGLEDISPLACEMENT",2668620305:"IFCSTRUCTURALLOADPLANARFORCE",1595516126:"IFCSTRUCTURALLOADLINEARFORCE",390701378:"IFCSPACETHERMALLOADPROPERTIES",1202362311:"IFCSOUNDVALUE",2485662743:"IFCSOUNDPROPERTIES",723233188:"IFCSOLIDMODEL",2609359061:"IFCSLIPPAGECONNECTIONCONDITION",4124623270:"IFCSHELLBASEDSURFACEMODEL",2411513650:"IFCSERVICELIFEFACTOR",1509187699:"IFCSECTIONEDSPINE",2778083089:"IFCROUNDEDRECTANGLEPROFILEDEF",478536968:"IFCRELATIONSHIP",3765753017:"IFCREINFORCEMENTDEFINITIONPROPERTIES",3413951693:"IFCREGULARTIMESERIES",3615266464:"IFCRECTANGLEPROFILEDEF",110355661:"IFCPROPERTYTABLEVALUE",3650150729:"IFCPROPERTYSINGLEVALUE",3357820518:"IFCPROPERTYSETDEFINITION",941946838:"IFCPROPERTYREFERENCEVALUE",2752243245:"IFCPROPERTYLISTVALUE",4166981789:"IFCPROPERTYENUMERATEDVALUE",1680319473:"IFCPROPERTYDEFINITION",871118103:"IFCPROPERTYBOUNDEDVALUE",673634403:"IFCPRODUCTDEFINITIONSHAPE",179317114:"IFCPREDEFINEDPOINTMARKERSYMBOL",433424934:"IFCPREDEFINEDDIMENSIONSYMBOL",2559016684:"IFCPREDEFINEDCURVEFONT",759155922:"IFCPREDEFINEDCOLOUR",2775532180:"IFCPOLYGONALBOUNDEDHALFSPACE",2924175390:"IFCPOLYLOOP",1423911732:"IFCPOINTONSURFACE",4022376103:"IFCPOINTONCURVE",2067069095:"IFCPOINT",1663979128:"IFCPLANAREXTENT",2004835150:"IFCPLACEMENT",597895409:"IFCPIXELTEXTURE",3021840470:"IFCPHYSICALCOMPLEXQUANTITY",2519244187:"IFCPATH",2529465313:"IFCPARAMETERIZEDPROFILEDEF",1029017970:"IFCORIENTEDEDGE",2665983363:"IFCOPENSHELL",2833995503:"IFCONEDIRECTIONREPEATFACTOR",219451334:"IFCOBJECTDEFINITION",1430189142:"IFCMECHANICALCONCRETEMATERIALPROPERTIES",2022407955:"IFCMATERIALDEFINITIONREPRESENTATION",2347385850:"IFCMAPPEDITEM",1008929658:"IFCLOOP",2624227202:"IFCLOCALPLACEMENT",3422422726:"IFCLIGHTSOURCESPOT",1520743889:"IFCLIGHTSOURCEPOSITIONAL",4266656042:"IFCLIGHTSOURCEGONIOMETRIC",2604431987:"IFCLIGHTSOURCEDIRECTIONAL",125510826:"IFCLIGHTSOURCEAMBIENT",1402838566:"IFCLIGHTSOURCE",3741457305:"IFCIRREGULARTIMESERIES",3905492369:"IFCIMAGETEXTURE",2445078500:"IFCHYGROSCOPICMATERIALPROPERTIES",812098782:"IFCHALFSPACESOLID",178086475:"IFCGRIDPLACEMENT",3590301190:"IFCGEOMETRICSET",4142052618:"IFCGEOMETRICREPRESENTATIONSUBCONTEXT",2453401579:"IFCGEOMETRICREPRESENTATIONITEM",3448662350:"IFCGEOMETRICREPRESENTATIONCONTEXT",1446786286:"IFCGENERALPROFILEPROPERTIES",803998398:"IFCGENERALMATERIALPROPERTIES",3857492461:"IFCFUELPROPERTIES",738692330:"IFCFILLAREASTYLE",4219587988:"IFCFAILURECONNECTIONCONDITION",3008276851:"IFCFACESURFACE",803316827:"IFCFACEOUTERBOUND",1809719519:"IFCFACEBOUND",2556980723:"IFCFACE",1860660968:"IFCEXTENDEDMATERIALPROPERTIES",476780140:"IFCEDGECURVE",3900360178:"IFCEDGE",4170525392:"IFCDRAUGHTINGPREDEFINEDTEXTFONT",3732053477:"IFCDOCUMENTREFERENCE",1694125774:"IFCDIMENSIONPAIR",2273265877:"IFCDIMENSIONCALLOUTRELATIONSHIP",3632507154:"IFCDERIVEDPROFILEDEF",3800577675:"IFCCURVESTYLE",2889183280:"IFCCONVERSIONBASEDUNIT",3050246964:"IFCCONTEXTDEPENDENTUNIT",45288368:"IFCCONNECTIONPOINTECCENTRICITY",1981873012:"IFCCONNECTIONCURVEGEOMETRY",370225590:"IFCCONNECTEDFACESET",1485152156:"IFCCOMPOSITEPROFILEDEF",2542286263:"IFCCOMPLEXPROPERTY",776857604:"IFCCOLOURRGB",647927063:"IFCCLASSIFICATIONREFERENCE",3150382593:"IFCCENTERLINEPROFILEDEF",616511568:"IFCBLOBTEXTURE",2705031697:"IFCARBITRARYPROFILEDEFWITHVOIDS",1310608509:"IFCARBITRARYOPENPROFILEDEF",3798115385:"IFCARBITRARYCLOSEDPROFILEDEF",2297822566:"IFCANNOTATIONTEXTOCCURRENCE",3612888222:"IFCANNOTATIONSYMBOLOCCURRENCE",962685235:"IFCANNOTATIONSURFACEOCCURRENCE",2442683028:"IFCANNOTATIONOCCURRENCE",1065908215:"IFCWATERPROPERTIES",891718957:"IFCVIRTUALGRIDINTERSECTION",1907098498:"IFCVERTEXPOINT",3304826586:"IFCVERTEXBASEDTEXTUREMAP",2799835756:"IFCVERTEX",180925521:"IFCUNITASSIGNMENT",1735638870:"IFCTOPOLOGYREPRESENTATION",1377556343:"IFCTOPOLOGICALREPRESENTATIONITEM",581633288:"IFCTIMESERIESVALUE",1718945513:"IFCTIMESERIESREFERENCERELATIONSHIP",3101149627:"IFCTIMESERIES",3317419933:"IFCTHERMALMATERIALPROPERTIES",1210645708:"IFCTEXTUREVERTEX",2552916305:"IFCTEXTUREMAP",1742049831:"IFCTEXTURECOORDINATEGENERATOR",280115917:"IFCTEXTURECOORDINATE",1484833681:"IFCTEXTSTYLEWITHBOXCHARACTERISTICS",1640371178:"IFCTEXTSTYLETEXTMODEL",2636378356:"IFCTEXTSTYLEFORDEFINEDFONT",1983826977:"IFCTEXTSTYLEFONTMODEL",1447204868:"IFCTEXTSTYLE",912023232:"IFCTELECOMADDRESS",531007025:"IFCTABLEROW",985171141:"IFCTABLE",1290481447:"IFCSYMBOLSTYLE",626085974:"IFCSURFACETEXTURE",1351298697:"IFCSURFACESTYLEWITHTEXTURES",846575682:"IFCSURFACESTYLESHADING",1607154358:"IFCSURFACESTYLEREFRACTION",3303107099:"IFCSURFACESTYLELIGHTING",1300840506:"IFCSURFACESTYLE",3049322572:"IFCSTYLEDREPRESENTATION",3958052878:"IFCSTYLEDITEM",2830218821:"IFCSTYLEMODEL",3408363356:"IFCSTRUCTURALLOADTEMPERATURE",2525727697:"IFCSTRUCTURALLOADSTATIC",2162789131:"IFCSTRUCTURALLOAD",2273995522:"IFCSTRUCTURALCONNECTIONCONDITION",3692461612:"IFCSIMPLEPROPERTY",4240577450:"IFCSHAPEREPRESENTATION",3982875396:"IFCSHAPEMODEL",867548509:"IFCSHAPEASPECT",4165799628:"IFCSECTIONREINFORCEMENTPROPERTIES",2042790032:"IFCSECTIONPROPERTIES",448429030:"IFCSIUNIT",2341007311:"IFCROOT",3679540991:"IFCRIBPLATEPROFILEPROPERTIES",1660063152:"IFCREPRESENTATIONMAP",3008791417:"IFCREPRESENTATIONITEM",3377609919:"IFCREPRESENTATIONCONTEXT",1076942058:"IFCREPRESENTATION",1222501353:"IFCRELAXATION",1580146022:"IFCREINFORCEMENTBARPROPERTIES",2692823254:"IFCREFERENCESVALUEDOCUMENT",825690147:"IFCQUANTITYWEIGHT",2405470396:"IFCQUANTITYVOLUME",3252649465:"IFCQUANTITYTIME",931644368:"IFCQUANTITYLENGTH",2093928680:"IFCQUANTITYCOUNT",2044713172:"IFCQUANTITYAREA",3710013099:"IFCPROPERTYENUMERATION",148025276:"IFCPROPERTYDEPENDENCYRELATIONSHIP",3896028662:"IFCPROPERTYCONSTRAINTRELATIONSHIP",2598011224:"IFCPROPERTY",2802850158:"IFCPROFILEPROPERTIES",3958567839:"IFCPROFILEDEF",2267347899:"IFCPRODUCTSOFCOMBUSTIONPROPERTIES",2095639259:"IFCPRODUCTREPRESENTATION",2417041796:"IFCPRESENTATIONSTYLEASSIGNMENT",3119450353:"IFCPRESENTATIONSTYLE",1304840413:"IFCPRESENTATIONLAYERWITHSTYLE",2022622350:"IFCPRESENTATIONLAYERASSIGNMENT",1775413392:"IFCPREDEFINEDTEXTFONT",3213052703:"IFCPREDEFINEDTERMINATORSYMBOL",990879717:"IFCPREDEFINEDSYMBOL",3727388367:"IFCPREDEFINEDITEM",3355820592:"IFCPOSTALADDRESS",2226359599:"IFCPHYSICALSIMPLEQUANTITY",2483315170:"IFCPHYSICALQUANTITY",101040310:"IFCPERSONANDORGANIZATION",2077209135:"IFCPERSON",1207048766:"IFCOWNERHISTORY",1411181986:"IFCORGANIZATIONRELATIONSHIP",4251960020:"IFCORGANIZATION",1227763645:"IFCOPTICALMATERIALPROPERTIES",2251480897:"IFCOBJECTIVE",3701648758:"IFCOBJECTPLACEMENT",1918398963:"IFCNAMEDUNIT",2706619895:"IFCMONETARYUNIT",3368373690:"IFCMETRIC",677618848:"IFCMECHANICALSTEELMATERIALPROPERTIES",4256014907:"IFCMECHANICALMATERIALPROPERTIES",2597039031:"IFCMEASUREWITHUNIT",3265635763:"IFCMATERIALPROPERTIES",2199411900:"IFCMATERIALLIST",1303795690:"IFCMATERIALLAYERSETUSAGE",3303938423:"IFCMATERIALLAYERSET",248100487:"IFCMATERIALLAYER",1847130766:"IFCMATERIALCLASSIFICATIONRELATIONSHIP",1838606355:"IFCMATERIAL",30780891:"IFCLOCALTIME",1566485204:"IFCLIGHTINTENSITYDISTRIBUTION",4162380809:"IFCLIGHTDISTRIBUTIONDATA",3452421091:"IFCLIBRARYREFERENCE",2655187982:"IFCLIBRARYINFORMATION",3020489413:"IFCIRREGULARTIMESERIESVALUE",852622518:"IFCGRIDAXIS",3548104201:"IFCEXTERNALLYDEFINEDTEXTFONT",3207319532:"IFCEXTERNALLYDEFINEDSYMBOL",1040185647:"IFCEXTERNALLYDEFINEDSURFACESTYLE",2242383968:"IFCEXTERNALLYDEFINEDHATCHSTYLE",3200245327:"IFCEXTERNALREFERENCE",1648886627:"IFCENVIRONMENTALIMPACTVALUE",3796139169:"IFCDRAUGHTINGCALLOUTRELATIONSHIP",770865208:"IFCDOCUMENTINFORMATIONRELATIONSHIP",1154170062:"IFCDOCUMENTINFORMATION",1376555844:"IFCDOCUMENTELECTRONICFORMAT",2949456006:"IFCDIMENSIONALEXPONENTS",1045800335:"IFCDERIVEDUNITELEMENT",1765591967:"IFCDERIVEDUNIT",1072939445:"IFCDATEANDTIME",3510044353:"IFCCURVESTYLEFONTPATTERN",2367409068:"IFCCURVESTYLEFONTANDSCALING",1105321065:"IFCCURVESTYLEFONT",539742890:"IFCCURRENCYRELATIONSHIP",602808272:"IFCCOSTVALUE",1065062679:"IFCCOORDINATEDUNIVERSALTIMEOFFSET",347226245:"IFCCONSTRAINTRELATIONSHIP",613356794:"IFCCONSTRAINTCLASSIFICATIONRELATIONSHIP",1658513725:"IFCCONSTRAINTAGGREGATIONRELATIONSHIP",1959218052:"IFCCONSTRAINT",2732653382:"IFCCONNECTIONSURFACEGEOMETRY",4257277454:"IFCCONNECTIONPORTGEOMETRY",2614616156:"IFCCONNECTIONPOINTGEOMETRY",2859738748:"IFCCONNECTIONGEOMETRY",3264961684:"IFCCOLOURSPECIFICATION",3639012971:"IFCCLASSIFICATIONNOTATIONFACET",938368621:"IFCCLASSIFICATIONNOTATION",1098599126:"IFCCLASSIFICATIONITEMRELATIONSHIP",1767535486:"IFCCLASSIFICATIONITEM",747523909:"IFCCLASSIFICATION",622194075:"IFCCALENDARDATE",2069777674:"IFCBOUNDARYNODECONDITIONWARPING",1387855156:"IFCBOUNDARYNODECONDITION",3367102660:"IFCBOUNDARYFACECONDITION",1560379544:"IFCBOUNDARYEDGECONDITION",4037036970:"IFCBOUNDARYCONDITION",3869604511:"IFCAPPROVALRELATIONSHIP",390851274:"IFCAPPROVALPROPERTYRELATIONSHIP",2080292479:"IFCAPPROVALACTORRELATIONSHIP",130549933:"IFCAPPROVAL",1110488051:"IFCAPPLIEDVALUERELATIONSHIP",411424972:"IFCAPPLIEDVALUE",639542469:"IFCAPPLICATION",618182010:"IFCADDRESS",3630933823:"IFCACTORROLE",599546466:"FILE_DESCRIPTION",1390159747:"FILE_NAME",1109904537:"FILE_SCHEMA"};class je{static async getUnits(e){var o,a,l;const{IFCUNITASSIGNMENT:t}=tt,i=await e.getAllPropertiesOfType(t);if(!i)return 1;const s=Object.keys(i),n=i[parseInt(s[0],10)];for(const c of n.Units){if(c.value===void 0||c.value===null)continue;const h=await e.getProperties(c.value);if(!h||!h.UnitType||!h.UnitType.value||h.UnitType.value!=="LENGTHUNIT")continue;let u=1,f=1;return h.Name.value==="METRE"&&(f=1),h.Name.value==="FOOT"&&(f=.3048),((o=h.Prefix)==null?void 0:o.value)==="MILLI"?u=.001:((a=h.Prefix)==null?void 0:a.value)==="CENTI"?u=.01:((l=h.Prefix)==null?void 0:l.value)==="DECI"&&(u=.1),f*u}return 1}static async findItemByGuid(e,t){var s;const i=e.getAllPropertiesIDs();for(const n of i){const o=await e.getProperties(n);if(o&&((s=o.GlobalId)==null?void 0:s.value)===t)return o}return null}static async getRelationMap(e,t,i){var l;const n=i??(async()=>{}),o={},a=e.getAllPropertiesIDs();for(const c of a){const h=await e.getProperties(c);if(!h)continue;const d=h.type===t,u=Object.keys(h).find(g=>g.startsWith("Relating")),f=Object.keys(h).find(g=>g.startsWith("Related"));if(!(d&&u&&f))continue;const p=await e.getProperties((l=h[u])==null?void 0:l.value),m=h[f];if(!p||!m||!(m&&Array.isArray(m)))continue;const E=m.map(g=>g.value);await n(p.expressID,E),o[p.expressID]=E}return o}static async getQsetQuantities(e,t,i){const n=i??(()=>{}),o=await e.getProperties(t);return!o||o.type!==tt.IFCELEMENTQUANTITY?null:(o.Quantities??[{}]).map(c=>(c.value&&n(c.value),c.value)).filter(c=>c!==null)}static async getPsetProps(e,t,i){const n=i??(()=>{}),o=await e.getProperties(t);return!o||o.type!==tt.IFCPROPERTYSET?null:(o.HasProperties??[{}]).map(c=>(c.value&&n(c.value),c.value)).filter(c=>c!==null)}static async getPsetRel(e,t){var a;if(!await e.getProperties(t))return null;const s=await e.getAllPropertiesOfType(tt.IFCRELDEFINESBYPROPERTIES);if(!s)return null;const n=Object.values(s);let o=null;for(const l of n)((a=l.RelatingPropertyDefinition)==null?void 0:a.value)===t&&(o=l.expressID);return o}static async getQsetRel(e,t){return je.getPsetRel(e,t)}static async getEntityName(e,t){var o;const i=await e.getProperties(t);if(!i)return{key:null,name:null};const s=Object.keys(i).find(a=>a.endsWith("Name"))??null,n=s?(o=i[s])==null?void 0:o.value:null;return{key:s,name:n}}static async getQuantityValue(e,t){const i=await e.getProperties(t);if(!i)return{key:null,value:null};const s=Object.keys(i).find(o=>o.endsWith("Value"))??null;let n;return s===null||i[s]===void 0||i[s]===null?n=null:n=i[s].value,{key:s,value:n}}static isRel(e){return Ua[e].startsWith("IFCREL")}static async attributeExists(e,t,i){const s=await e.getProperties(t);return s?Object.keys(s).includes(i):!1}static async groupEntitiesByType(e,t){var s;const i=new Map;for(const n of t){const o=await e.getProperties(n);if(!o)continue;const a=o.type;i.get(a)||i.set(a,new Set),(s=i.get(a))==null||s.add(n)}return i}}class CE{constructor(){y(this,"factor",1);y(this,"complement",1)}apply(e){const i=this.getScaleMatrix().multiply(e);e.copy(i)}setUp(e){var n,o,a;this.factor=1;const t=this.getLengthUnits(e);if(!t)return;const i=t==null,s=t.Name===void 0||t.Name===null;i||s||(t.Name.value==="FOOT"&&(this.factor=.3048),((n=t.Prefix)==null?void 0:n.value)==="MILLI"?this.complement=.001:((o=t.Prefix)==null?void 0:o.value)==="CENTI"?this.complement=.01:((a=t.Prefix)==null?void 0:a.value)==="DECI"&&(this.complement=.01))}getLengthUnits(e){try{const i=e.GetLineIDsWithType(0,tt.IFCUNITASSIGNMENT).get(0),s=e.GetLine(0,i);for(const n of s.Units){if(!n||n.value===null||n.value===void 0)continue;const o=e.GetLine(0,n.value);if(o.UnitType&&o.UnitType.value==="LENGTHUNIT")return o}return null}catch{return console.log("Could not get units"),null}}getScaleMatrix(){const e=this.factor;return new D.Matrix4().fromArray([e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1])}}class Md{constructor(){y(this,"itemsByFloor",{});y(this,"_units",new CE)}setUp(e){this._units.setUp(e),this.cleanUp();try{const t=e.GetLineIDsWithType(0,tt.IFCRELCONTAINEDINSPATIALSTRUCTURE),i=new Set,s=e.GetLineIDsWithType(0,tt.IFCSPACE);for(let c=0;c<s.size();c++)i.add(s.get(c));const n=e.GetLineIDsWithType(0,tt.IFCRELAGGREGATES),o=n.size();for(let c=0;c<o;c++){const h=n.get(c),d=e.GetLine(0,h);if(!d||!d.RelatingObject||!d.RelatedObjects)continue;const u=d.RelatingObject.value,f=d.RelatedObjects;for(const p of f){const m=p.value;i.has(m)&&(this.itemsByFloor[m]=u)}}const a={},l=t.size();for(let c=0;c<l;c++){const h=t.get(c),d=e.GetLine(0,h);if(!d||!d.RelatingStructure||!d.RelatedElements)continue;const u=d.RelatingStructure.value,f=d.RelatedElements;if(i.has(u))for(const p of f){a[u]||(a[u]=[]);const m=p.value;a[u].push(m)}else for(const p of f){const m=p.value;this.itemsByFloor[m]=u}}for(const c in a){const h=this.itemsByFloor[c];if(h!==void 0){const d=a[c];for(const u of d)this.itemsByFloor[u]=h}}for(let c=0;c<o;c++){const h=n.get(c),d=e.GetLine(0,h);if(!d||!d.RelatingObject||!d.RelatedObjects)continue;const u=d.RelatingObject.value,f=d.RelatedObjects;for(const p of f){const m=p.value,E=this.itemsByFloor[u];E!==void 0&&(this.itemsByFloor[m]=E)}}}catch{console.log("Could not get floors.")}}cleanUp(){this.itemsByFloor={}}}class Kr{constructor(){y(this,"includeProperties",!0);y(this,"optionalCategories",[tt.IFCSPACE]);y(this,"coordinate",!0);y(this,"wasm",{path:"",absolute:!1,logLevel:tt.LogLevel.LOG_LEVEL_OFF});y(this,"excludedCategories",new Set);y(this,"includedCategories",new Set);y(this,"saveLocations",!1);y(this,"webIfc",{COORDINATE_TO_ORIGIN:!0});y(this,"autoSetWasm",!0);y(this,"customLocateFileHandler",null)}}class Dd{constructor(){y(this,"defLineMat",new D.LineBasicMaterial({color:16777215}))}read(e){const t=e.GetAllAlignments(0),i=e.GetAllCrossSections2D(0),s=e.GetAllCrossSections3D(0),n={IfcAlignment:t,IfcCrossSection2D:i,IfcCrossSection3D:s};return this.get(n)}get(e){if(e.IfcAlignment){const t=new Map;for(const i of e.IfcAlignment){const s=new We.Alignment;s.absolute=this.getCurves(i.curve3D,s),s.horizontal=this.getCurves(i.horizontal,s),s.vertical=this.getCurves(i.vertical,s),t.set(t.size,s)}return{alignments:t,coordinationMatrix:new D.Matrix4}}}getCurves(e,t){const i=[];let s=0;for(const n of e){const o={};if(n.data)for(const u of n.data){const[f,p]=u.split(": "),m=parseFloat(p);o[f]=m||p}const{points:a}=n,l=new Float32Array(a.length*3);for(let u=0;u<a.length;u++){const{x:f,y:p,z:m}=a[u];l[u*3]=f,l[u*3+1]=p,l[u*3+2]=m||0}const c=new D.BufferAttribute(l,3),h=new D.EdgesGeometry;h.setAttribute("position",c);const d=new We.CurveMesh(s,o,t,h,this.defLineMat);i.push(d.curve),s++}return i}}class Ud{getNameInfo(e){var d;const t={},{arguments:i}=e.GetHeaderLine(0,tt.FILE_NAME)||{};if(!i)return t;const[s,n,o,a,l,c,h]=i;if(s!=null&&s.value&&(t.name=s.value),n!=null&&n.value&&(t.creationDate=new Date(n.value)),o){t.author={};const[u,f]=o;u!=null&&u.value&&(t.author.name=u.value),f!=null&&f.value&&(t.author.email=f.value)}return(d=a[0])!=null&&d.value&&(t.organization=a[0].value),l!=null&&l.value&&(t.preprocessorVersion=l==null?void 0:l.value),c!=null&&c.value&&(t.originatingSystem=c==null?void 0:c.value),h!=null&&h.value&&(t.authorization=h==null?void 0:h.value),t}getDescriptionInfo(e){var o;const t={},{arguments:i}=e.GetHeaderLine(0,tt.FILE_DESCRIPTION)||{};if(!i)return t;const[s,n]=i;if((o=s[0])!=null&&o.value){const a=s[0].value.match(/\[([^\]]+)\]/);a&&a[1]&&(t.viewDefinition=a[1])}return n!=null&&n.value&&(t.implementationLevel=n.value),t}}class kd{static get(e,t){const i=[tt.IFCPROJECT,tt.IFCSITE,tt.IFCBUILDING,tt.IFCBUILDINGSTOREY,tt.IFCSPACE,tt.IFCROAD,tt.IFCFACILITY,tt.IFCFACILITYPART,tt.IFCBRIDGE],s=e.data;for(const n of i){const o=t.GetLineIDsWithType(0,n),a=o.size();for(let l=0;l<a;l++){const c=o.get(l);s.has(c)||s.set(c,[[],[0,n]])}}}}const Vs=class Vs extends Ot{constructor(t){super(t);y(this,"onDisposed",new K);y(this,"onIfcStartedLoading",new K);y(this,"onSetup",new K);y(this,"settings",new Kr);y(this,"webIfc",new tt.IfcAPI);y(this,"enabled",!0);y(this,"_material",new D.MeshLambertMaterial);y(this,"_spatialTree",new Md);y(this,"_metaData",new Ud);y(this,"_fragmentInstances",new Map);y(this,"_civil",new Dd);y(this,"_visitedFragments",new Map);y(this,"_materialT",new D.MeshLambertMaterial({transparent:!0,opacity:.5}));this.components.add(Vs.uuid,this),this.settings.excludedCategories.add(tt.IFCOPENINGELEMENT)}dispose(){this.webIfc=null,this.onDisposed.trigger(Vs.uuid),this.onDisposed.reset()}async setup(t){this.settings={...this.settings,...t},this.settings.autoSetWasm&&await this.autoSetWasm(),this.onSetup.trigger()}async load(t,i=!0){const s=performance.now();this.onIfcStartedLoading.trigger(),await this.readIfcFile(t);const n=await this.getAllGeometries(),a=await this.components.get(gr).export(this.webIfc,0);n.setLocalProperties(a);const l=this.components.get(wt);l.groups.set(n.uuid,n);for(const c of n.items)l.list.set(c.id,c),c.mesh.uuid=c.id,c.group=n;l.onFragmentsLoaded.trigger(n),i&&l.coordinate([n]);for(const[c]of n.data){const h=a[c];if(!h||!h.GlobalId)continue;const d=h.GlobalId.value||h.GlobalId;n.globalToExpressIDs.set(d,c)}return kd.get(n,this.webIfc),this.cleanUp(),console.log(`Streaming the IFC took ${performance.now()-s} ms!`),n}async readIfcFile(t){const{path:i,absolute:s,logLevel:n}=this.settings.wasm;return this.webIfc.SetWasmPath(i,s),await this.webIfc.Init(this.settings.customLocateFileHandler||void 0),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModel(t,this.settings.webIfc)}cleanUp(){try{this.webIfc.Dispose()}catch{console.log("Web-ifc wasn't disposed.")}this.webIfc=null,this.webIfc=new tt.IfcAPI,this._visitedFragments.clear(),this._fragmentInstances.clear()}async getAllGeometries(){this._spatialTree.setUp(this.webIfc);const t=this.webIfc.GetIfcEntityList(0),i=new We.FragmentsGroup;i.ifcMetadata={name:"",description:"",...this._metaData.getNameInfo(this.webIfc),...this._metaData.getDescriptionInfo(this.webIfc),schema:this.webIfc.GetModelSchema(0)||"IFC2X3",maxExpressID:this.webIfc.GetMaxExpressID(0)};const s=[];for(const o of t){if(!this.webIfc.IsIfcElement(o)&&o!==tt.IFCSPACE)continue;const a=this.settings.includedCategories;if(a.size>0&&!a.has(o))continue;if(this.settings.excludedCategories.has(o))continue;const l=this.webIfc.GetLineIDsWithType(0,o),c=l.size();for(let h=0;h<c;h++){const d=l.get(h);s.push(d);const u=this._spatialTree.itemsByFloor[d]||0;i.data.set(d,[[],[u,o]])}}this._spatialTree.cleanUp(),this.webIfc.StreamMeshes(0,s,o=>{this.getMesh(o,i)});for(const o of this._visitedFragments){const{index:a,fragment:l}=o[1];i.keyFragments.set(a,l.id)}for(const o of i.items){const a=this._fragmentInstances.get(o.id);if(!a)throw new Error("Fragment not found!");const l=[];for(const[c,h]of a)l.push(h);o.add(l)}const n=this.webIfc.GetCoordinationMatrix(0);return i.coordinationMatrix.fromArray(n),i.civilData=this._civil.read(this.webIfc),i}getMesh(t,i){const s=t.geometries.size(),n=t.expressID;for(let o=0;o<s;o++){const a=t.geometries.get(o),{x:l,y:c,z:h,w:d}=a.color,u=d!==1,{geometryExpressID:f}=a,p=`${f}-${u}`;if(!this._visitedFragments.has(p)){const v=this.getGeometry(this.webIfc,f),A=u?this._materialT:this._material,S=new We.Fragment(v,A,1);i.add(S.mesh),i.items.push(S);const N=this._visitedFragments.size;this._visitedFragments.set(p,{index:N,fragment:S})}const m=new D.Color().setRGB(l,c,h,"srgb"),E=new D.Matrix4;E.fromArray(a.flatTransformation);const g=this._visitedFragments.get(p);if(g===void 0)throw new Error("Error getting geometry data for streaming!");const I=i.data.get(n);if(!I)throw new Error("Data not found!");I[0].push(g.index);const{fragment:T}=g;this._fragmentInstances.has(T.id)||this._fragmentInstances.set(T.id,new Map);const b=this._fragmentInstances.get(T.id);if(!b)throw new Error("Instances not found!");if(b.has(n)){const v=b.get(n);if(!v)throw new Error("Instance not found!");v.transforms.push(E),v.colors&&v.colors.push(m)}else b.set(n,{id:n,transforms:[E],colors:[m]})}}getGeometry(t,i){const s=t.GetGeometry(0,i),n=t.GetIndexArray(s.GetIndexData(),s.GetIndexDataSize()),o=t.GetVertexArray(s.GetVertexData(),s.GetVertexDataSize()),a=new Float32Array(o.length/2),l=new Float32Array(o.length/2);for(let u=0;u<o.length;u+=6)a[u/2]=o[u],a[u/2+1]=o[u+1],a[u/2+2]=o[u+2],l[u/2]=o[u+3],l[u/2+1]=o[u+4],l[u/2+2]=o[u+5];const c=new D.BufferGeometry,h=new D.BufferAttribute(a,3),d=new D.BufferAttribute(l,3);return c.setAttribute("position",h),c.setAttribute("normal",d),c.setIndex(Array.from(n)),s.delete(),c}async autoSetWasm(){const t=await fetch(`https://unpkg.com/@thatopen/components@${Zn.release}/package.json`);if(!t.ok){console.warn("Couldn't get openbim-components package.json. Set wasm settings manually.");return}const i=await t.json();if(!("web-ifc"in i.peerDependencies))console.warn("Couldn't get web-ifc from peer dependencies in openbim-components. Set wasm settings manually.");else{const s=i.peerDependencies["web-ifc"];this.settings.wasm.path=`https://unpkg.com/web-ifc@${s}/`,this.settings.wasm.absolute=!0}}};y(Vs,"uuid","a659add7-1418-4771-a0d6-7d4d438e4624");let Er=Vs;const Ve=class Ve extends Ot{constructor(t){super(t);y(this,"onDisposed",new K);y(this,"onRequestFile",new K);y(this,"ifcToExport",null);y(this,"onElementToPset",new K);y(this,"onPropToPset",new K);y(this,"onPsetRemoved",new K);y(this,"onDataChanged",new K);y(this,"wasm",{path:"/",absolute:!1});y(this,"enabled",!0);y(this,"attributeListeners",{});y(this,"selectedModel");y(this,"changeMap",{});this.components.add(Ve.uuid,this)}dispose(){this.selectedModel=void 0,this.attributeListeners={},this.changeMap={},this.onElementToPset.reset(),this.onPropToPset.reset(),this.onPsetRemoved.reset(),this.onDataChanged.reset(),this.onDisposed.trigger(Ve.uuid),this.onDisposed.reset()}static getIFCSchema(t){const i=t.ifcMetadata.schema;if(!i)throw new Error("IFC Schema not found");return i.startsWith("IFC2X3")?"IFC2X3":i.startsWith("IFC4")&&i.replace("IFC4","")===""?"IFC4":i.startsWith("IFC4X3")?"IFC4X3":i}async setData(t,...i){for(const s of i){const n=s.expressID;n&&(await t.setProperties(n,s),this.registerChange(t,n))}}async newPset(t,i,s){const n=Ve.getIFCSchema(t),{ownerHistoryHandle:o}=await this.getOwnerHistory(t),a=this.newGUID(t),l=new tt[n].IfcLabel(i),c=s?new tt[n].IfcText(s):null,h=new tt[n].IfcPropertySet(a,o,l,c,[]);h.expressID=this.increaseMaxID(t);const d=this.newGUID(t),u=new tt[n].IfcRelDefinesByProperties(d,o,null,null,[],new tt.Handle(h.expressID));return u.expressID=this.increaseMaxID(t),await this.setData(t,h,u),{pset:h,rel:u}}async removePset(t,...i){for(const s of i){const n=await t.getProperties(s);if((n==null?void 0:n.type)!==tt.IFCPROPERTYSET)continue;const o=await je.getPsetRel(t,s);if(o&&(await t.setProperties(o,null),this.registerChange(t,o)),n){for(const a of n.HasProperties)await t.setProperties(a.value,null);await t.setProperties(s,null),this.onPsetRemoved.trigger({model:t,psetID:s}),this.registerChange(t,s)}}}newSingleStringProperty(t,i,s,n){return this.newSingleProperty(t,i,s,n)}newSingleNumericProperty(t,i,s,n){return this.newSingleProperty(t,i,s,n)}newSingleBooleanProperty(t,i,s,n){return this.newSingleProperty(t,i,s,n)}async removePsetProp(t,i,s){const n=await t.getProperties(i),o=await t.getProperties(s);!n||!o||n.type===tt.IFCPROPERTYSET&&o&&(n.HasProperties=n.HasProperties.filter(a=>a.value!==s),await t.setProperties(s,null),this.registerChange(t,i,s))}async addElementToPset(t,i,...s){const n=await je.getPsetRel(t,i);if(!n)return;const o=await t.getProperties(n);if(!o)return;for(const l of s){const c=new tt.Handle(l);o.RelatedObjects.push(c),this.onElementToPset.trigger({model:t,psetID:i,elementID:l})}this.registerChange(t,i);const a=this.components.get(gi);for(const l of s)a.addEntityRelations(t,l,"IsDefinedBy",i)}async addPropToPset(t,i,...s){const n=await t.getProperties(i);if(n){for(const o of s){if(n.HasProperties.includes(o))continue;const a=new tt.Handle(o);n.HasProperties.push(a),this.onPropToPset.trigger({model:t,psetID:i,propID:o})}this.registerChange(t,i)}}async saveToIfc(t,i){const s=this.components.get(Er),n=s.webIfc,o=await s.readIfcFile(i),a=this.changeMap[t.uuid]??[];for(const c of a){const h=await t.getProperties(c);if(h)try{n.WriteLine(o,h)}catch{}else try{n.DeleteLine(o,c)}catch{}}const l=n.SaveModel(o);return s.webIfc.CloseModel(o),s.cleanUp(),l}async setAttributeListener(t,i,s){this.attributeListeners[t.uuid]||(this.attributeListeners[t.uuid]={});const n=this.attributeListeners[t.uuid][i]?this.attributeListeners[t.uuid][i][s]:null;if(n)return n;const o=await t.getProperties(i);if(!o)throw new Error(`Entity with expressID ${i} doesn't exists.`);const a=o[s];if(Array.isArray(a)||!a)throw new Error(`Attribute ${s} is array or null, and it can't have a listener.`);const l=a.value;if(l===void 0||l==null)throw new Error(`Attribute ${s} has a badly defined handle.`);const c=new K;return Object.defineProperty(o[s],"value",{get(){return this._value},async set(h){this._value=h,c.trigger(h)}}),o[s].value=l,this.attributeListeners[t.uuid][i]||(this.attributeListeners[t.uuid][i]={}),this.attributeListeners[t.uuid][i][s]=c,c}increaseMaxID(t){return t.ifcMetadata.maxExpressID++,t.ifcMetadata.maxExpressID}newGUID(t){const i=Ve.getIFCSchema(t);return new tt[i].IfcGloballyUniqueId(Le.create())}async getOwnerHistory(t){const i=await t.getAllPropertiesOfType(tt.IFCOWNERHISTORY);if(!i)throw new Error("No OwnerHistory was found.");const s=Object.keys(i).map(a=>parseInt(a,10)),n=i[s[0]],o=new tt.Handle(n.expressID);return{ownerHistory:n,ownerHistoryHandle:o}}registerChange(t,...i){this.changeMap[t.uuid]||(this.changeMap[t.uuid]=new Set);for(const s of i)this.changeMap[t.uuid].add(s),this.onDataChanged.trigger({model:t,expressID:s})}async newSingleProperty(t,i,s,n){const o=Ve.getIFCSchema(t),a=new tt[o].IfcIdentifier(s),l=new tt[o][i](n),c=new tt[o].IfcPropertySingleValue(a,null,l,null);return c.expressID=this.increaseMaxID(t),await this.setData(t,c),c}};y(Ve,"uuid","58c2d9f0-183c-48d6-a402-dfcf5b9a34df");let oa=Ve;const wr=class wr extends Ot{constructor(t){super(t);y(this,"enabled",!0);y(this,"list",{});y(this,"onDisposed",new K);y(this,"onFragmentsDisposed",t=>{const{groupID:i,fragmentIDs:s}=t;for(const n in this.list){const o=this.list[n],a=Object.keys(o);if(a.includes(i))delete o[i],Object.values(o).length===0&&delete this.list[n];else for(const l of a){const c=o[l];for(const h of s)delete c.map[h];Object.values(c).length===0&&delete o[l]}}});t.add(wr.uuid,this),t.get(wt).onFragmentsDisposed.add(this.onFragmentsDisposed)}dispose(){this.list={},this.components.get(wt).onFragmentsDisposed.remove(this.onFragmentsDisposed),this.onDisposed.trigger(),this.onDisposed.reset()}remove(t){for(const i in this.list){const s=this.list[i];for(const n in s){const o=s[n];delete o.map[t]}}}find(t){const i=this.components.get(wt);if(!t){const a={};for(const[l,c]of i.list)a[l]=new Set(c.ids);return a}const s=Object.keys(t).length,n={};for(const a in t){const l=t[a];if(!this.list[a]){console.warn(`Classification ${a} does not exist.`);continue}for(const c of l){const h=this.list[a][c];if(h)for(const d in h.map){n[d]||(n[d]=new Map);for(const u of h.map[d]){const f=n[d].get(u);f===void 0?n[d].set(u,1):n[d].set(u,f+1)}}}}const o={};for(const a in n){const l=n[a];for(const[c,h]of l){if(h===void 0)throw new Error("Malformed fragments map!");h===s&&(o[a]||(o[a]=new Set),o[a].add(c))}}return o}byModel(t,i){this.list.models||(this.list.models={});const s=this.list.models;s[t]||(s[t]={map:{},id:null,name:t});const n=s[t];for(const[o,a]of i.data){const l=a[0];for(const c of l){const h=i.keyFragments.get(c);h&&(n.map[h]||(n.map[h]=new Set),n.map[h].add(o))}}}async byPredefinedType(t){var n;this.list.predefinedTypes||(this.list.predefinedTypes={});const i=this.list.predefinedTypes,s=t.getAllPropertiesIDs();for(const o of s){const a=await t.getProperties(o);if(!a)continue;const l=String((n=a.PredefinedType)==null?void 0:n.value).toUpperCase();i[l]||(i[l]={map:{},id:null,name:l});const c=i[l];for(const[h,d]of t.data){const u=d[0];for(const f of u){const p=t.keyFragments.get(f);if(!p)throw new Error("Fragment ID not found!");c.map[p]||(c.map[p]=new Set),c.map[p].add(a.expressID)}}}}byEntity(t){this.list.entities||(this.list.entities={});for(const[i,s]of t.data){const o=s[1][1],a=Ua[o];this.saveItem(t,"entities",a,i)}}async byIfcRel(t,i,s){je.isRel(i)&&await je.getRelationMap(t,i,async(n,o)=>{const{name:a}=await je.getEntityName(t,n);for(const l of o)this.saveItem(t,s,a??"NO REL NAME",l)})}async bySpatialStructure(t,i={}){var c,h;const s=this.components.get(gi),n=s.relationMaps[t.uuid];if(!n)throw new Error(`Classifier: model relations of ${t.name||t.uuid} have to exists to group by spatial structure.`);const o="spatialStructures",l=i.useProperties===void 0||i.useProperties;for(const[d]of n){if(i.isolate){const m=t.data.get(d);if(!m)continue;const E=m[1][1];if(E===void 0||!i.isolate.has(E))continue}const u=s.getEntityRelations(t,d,"Decomposes");if(u)for(const m of u){let E=m.toString();if(l){const g=await t.getProperties(m);if(!g)continue;E=(c=g.Name)==null?void 0:c.value}this.saveItem(t,o,E,d,m)}const f=s.getEntityRelations(t,d,"ContainsElements");if(!f)continue;let p=d.toString();if(l){const m=await t.getProperties(d);if(!m)continue;p=(h=m.Name)==null?void 0:h.value}for(const m of f){this.saveItem(t,o,p,m,d);const E=s.getEntityRelations(t,Number(m),"IsDecomposedBy");if(E)for(const g of E)this.saveItem(t,o,p,g,d)}}}setColor(t,i,s=!1){const n=this.components.get(wt);for(const o in t){const a=n.list.get(o);if(!a)continue;const l=t[o];a.setColor(i,l,s)}}resetColor(t){const i=this.components.get(wt);for(const s in t){const n=i.list.get(s);if(!n)continue;const o=t[s];n.resetColor(o)}}saveItem(t,i,s,n,o=null){this.list[i]||(this.list[i]={});const a=t.data.get(n);if(a)for(const l of a[0]){const c=t.keyFragments.get(l);if(c){const h=this.list[i];h[s]||(h[s]={map:{},id:o,name:s}),h[s].map[c]||(h[s].map[c]=new Set),h[s].map[c].add(n)}}}};y(wr,"uuid","e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7");let Ki=wr;const Ar=class Ar extends Ot{constructor(t){super(t);y(this,"onDisposed",new K);y(this,"enabled",!0);y(this,"height",10);y(this,"groupName","spatialStructures");y(this,"list",new Set);t.add(Ar.uuid,this)}dispose(){this.list.clear(),this.onDisposed.trigger(),this.onDisposed.reset()}set(t){if(!this.enabled)return;const i=this.components.get(Ki),s=this.components.get(wt),n=t?1:-1;let o=0;const a=i.list[this.groupName],l=new D.Matrix4;for(const c in a){l.elements[13]=o*n*this.height;for(const h in a[c].map){const d=s.list.get(h),u=c+h,f=this.list.has(u);if(!d||t&&f||!t&&!f)continue;t?this.list.add(u):this.list.delete(u);const p=a[c].map[h];d.applyTransform(p,l),d.mesh.computeBoundingSphere(),d.mesh.computeBoundingBox()}o++}}};y(Ar,"uuid","d260618b-ce88-4c7d-826c-6debb91de3e2");let aa=Ar;const Rr=class Rr extends Ot{constructor(t){super(t);y(this,"enabled",!0);this.components.add(Rr.uuid,this)}set(t,i){const s=this.components.get(wt);if(!i){for(const[n,o]of s.list)o&&(o.setVisibility(t),this.updateCulledVisibility(o));return}for(const n in i){const o=i[n],a=s.list.get(n);a&&(a.setVisibility(t,o),this.updateCulledVisibility(a))}}isolate(t){this.set(!1),this.set(!0,t)}updateCulledVisibility(t){const i=this.components.get(Qn);for(const[s,n]of i.list){const o=n.colorMeshes.get(t.id);o&&(o.count=t.mesh.count)}}};y(Rr,"uuid","dd9ccf2d-8a21-4821-b7f6-2949add16a29");let br=Rr;class Bd extends Kr{constructor(){super(...arguments);y(this,"minGeometrySize",10);y(this,"minAssetsSize",1e3)}}const Sr=class Sr extends Ot{constructor(t){super(t);y(this,"onGeometryStreamed",new K);y(this,"onAssetStreamed",new K);y(this,"onProgress",new K);y(this,"onIfcLoaded",new K);y(this,"onDisposed",new K);y(this,"settings",new Bd);y(this,"enabled",!0);y(this,"webIfc",new tt.IfcAPI);y(this,"_spatialTree",new Md);y(this,"_metaData",new Ud);y(this,"_visitedGeometries",new Map);y(this,"_streamSerializer",new We.StreamSerializer);y(this,"_geometries",new Map);y(this,"_geometryCount",0);y(this,"_civil",new Dd);y(this,"_groupSerializer",new We.Serializer);y(this,"_assets",[]);y(this,"_meshesWithHoles",new Set);this.components.add(Sr.uuid,this),this.settings.excludedCategories.add(tt.IFCOPENINGELEMENT)}dispose(){this.onIfcLoaded.reset(),this.onGeometryStreamed.reset(),this.onAssetStreamed.reset(),this.webIfc=null,this.onDisposed.trigger(),this.onDisposed.reset()}async streamFromBuffer(t){await this.readIfcFile(t),await this.streamAllGeometries(),this.cleanUp()}async streamFromCallBack(t){await this.streamIfcFile(t),await this.streamAllGeometries(),this.cleanUp()}async readIfcFile(t){const{path:i,absolute:s,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(i,s),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModel(t,this.settings.webIfc)}async streamIfcFile(t){const{path:i,absolute:s,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(i,s),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModelFromCallback(t,this.settings.webIfc)}async streamAllGeometries(){const{minGeometrySize:t,minAssetsSize:i}=this.settings;this._spatialTree.setUp(this.webIfc);const s=this.webIfc.GetIfcEntityList(0),n=[[]],o=new We.FragmentsGroup;o.ifcMetadata={name:"",description:"",...this._metaData.getNameInfo(this.webIfc),...this._metaData.getDescriptionInfo(this.webIfc),schema:this.webIfc.GetModelSchema(0)||"IFC2X3",maxExpressID:this.webIfc.GetMaxExpressID(0)};let a=0,l=0;for(const m of s){if(!this.webIfc.IsIfcElement(m)&&m!==tt.IFCSPACE||this.settings.excludedCategories.has(m))continue;const E=this.webIfc.GetLineIDsWithType(0,m),g=E.size();for(let I=0;I<g;I++){a>t&&(a=0,l++,n.push([]));const T=E.get(I);n[l].push(T);const b=this.webIfc.GetLine(0,T);if(b.GlobalId){const A=(b==null?void 0:b.GlobalId.value)||(b==null?void 0:b.GlobalId);o.globalToExpressIDs.set(A,T)}const v=this._spatialTree.itemsByFloor[T]||0;o.data.set(T,[[],[v,m]]),a++}}this._spatialTree.cleanUp();let c=.01,h=0;for(const m of n){h++,this.webIfc.StreamMeshes(0,m,g=>{this.getMesh(this.webIfc,g,o)}),this._geometryCount>t&&await this.streamGeometries(),this._assets.length>i&&await this.streamAssets();const E=h/n.length;E>c&&(c+=.01,c=Math.max(c,E),this.onProgress.trigger(Math.round(c*100)/100))}this._geometryCount&&await this.streamGeometries(),this._assets.length&&await this.streamAssets();const{opaque:d,transparent:u}=o.geometryIDs;for(const[m,{index:E,uuid:g}]of this._visitedGeometries)o.keyFragments.set(E,g),(m>1?d:u).set(m,E);kd.get(o,this.webIfc);const f=this.webIfc.GetCoordinationMatrix(0);o.coordinationMatrix.fromArray(f),o.civilData=this._civil.read(this.webIfc);const p=this._groupSerializer.export(o);this.onIfcLoaded.trigger(p),o.dispose(!0)}cleanUp(){try{this.webIfc.Dispose()}catch{}this.webIfc=null,this.webIfc=new tt.IfcAPI,this._visitedGeometries.clear(),this._geometries.clear(),this._assets=[],this._meshesWithHoles.clear()}getMesh(t,i,s){const n=i.geometries.size(),o=i.expressID,a={id:o,geometries:[]};for(let l=0;l<n;l++){const c=i.geometries.get(l),h=c.geometryExpressID,d=c.color.w===1?1:-1,u=h*d;if(!this._visitedGeometries.has(u)){this._visitedGeometries.has(h)||this.getGeometry(t,h);const v=this._visitedGeometries.size,A=D.MathUtils.generateUUID();this._visitedGeometries.set(u,{uuid:A,index:v})}const f=this._visitedGeometries.get(u);if(f===void 0)throw new Error("Error getting geometry data for streaming!");const p=s.data.get(o);if(!p)throw new Error("Data not found!");p[0].push(f.index);const{x:m,y:E,z:g,w:I}=c.color,T=[m,E,g,I],b=c.flatTransformation;a.geometries.push({color:T,geometryID:h,transformation:b})}this._assets.push(a)}getGeometry(t,i){const s=t.GetGeometry(0,i),n=t.GetIndexArray(s.GetIndexData(),s.GetIndexDataSize()),o=t.GetVertexArray(s.GetVertexData(),s.GetVertexDataSize()),a=new Float32Array(o.length/2),l=new Float32Array(o.length/2);for(let f=0;f<o.length;f+=6)a[f/2]=o[f],a[f/2+1]=o[f+1],a[f/2+2]=o[f+2],l[f/2]=o[f+3],l[f/2+1]=o[f+4],l[f/2+2]=o[f+5];const c=Oc(a),h=new Float32Array(c.transformation.elements),d=[c.center.x,c.center.y,c.center.z];let u=!1;for(let f=0;f<a.length-2;f+=3){const p=a[f],m=a[f+1],E=a[f+2],g=l[f],I=l[f+1],T=l[f+2];if(xc(d,[p,m,E],[g,I,T])){u=!0;break}}this._geometries.set(i,{position:a,normal:l,index:n,boundingBox:h,hasHoles:u}),s.delete(),this._geometryCount++}async streamAssets(){await this.onAssetStreamed.trigger(this._assets),this._assets=null,this._assets=[]}async streamGeometries(){let t=this._streamSerializer.export(this._geometries),i={};for(const[s,{boundingBox:n,hasHoles:o}]of this._geometries)i[s]={boundingBox:n,hasHoles:o};this.onGeometryStreamed.trigger({data:i,buffer:t}),i=null,t=null,this._geometries.clear(),this._geometryCount=0}};y(Sr,"uuid","d9999a00-e1f5-4d3f-8cfe-c56e08609764");let la=Sr;class zd extends Kr{constructor(){super(...arguments);y(this,"propertiesSize",100)}}class $d extends Ot{constructor(){super(...arguments);y(this,"onPropertiesStreamed",new Ns);y(this,"onProgress",new Ns);y(this,"onIndicesStreamed",new Ns);y(this,"onDisposed",new K);y(this,"enabled",!0);y(this,"settings",new zd);y(this,"webIfc",new tt.IfcAPI)}async dispose(){this.onIndicesStreamed.reset(),this.onPropertiesStreamed.reset(),this.webIfc=null,this.onDisposed.reset()}async streamFromBuffer(t){await this.readIfcFile(t),await this.streamAllProperties(),this.cleanUp()}async streamFromCallBack(t){await this.streamIfcFile(t),await this.streamAllProperties(),this.cleanUp()}async readIfcFile(t){const{path:i,absolute:s,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(i,s),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModel(t,this.settings.webIfc)}async streamIfcFile(t){const{path:i,absolute:s,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(i,s),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModelFromCallback(t,this.settings.webIfc)}async streamAllProperties(){const{propertiesSize:t}=this.settings,i=new Set(this.webIfc.GetIfcEntityList(0)),s=new Set([tt.IFCPROJECT,tt.IFCSITE,tt.IFCBUILDING,tt.IFCBUILDINGSTOREY,tt.IFCSPACE]);for(const c of s)i.add(c);let n=.01,o=0;for(const c of i){if(o++,Da.has(c))continue;const h=s.has(c),d=this.webIfc.GetLineIDsWithType(0,c),u=d.size();let f=0;for(let m=0;m<u-t;m+=t){const E={};for(let g=0;g<t;g++){f++;const I=d.get(m+g);try{const T=this.webIfc.GetLine(0,I,h);E[T.expressID]=T}catch{console.log(`Could not get property: ${I}`)}}await this.onPropertiesStreamed.trigger({type:c,data:E})}if(f!==u){const m={};for(let E=f;E<u;E++){const g=d.get(E);try{const I=this.webIfc.GetLine(0,g,h);m[I.expressID]=I}catch{console.log(`Could not get property: ${g}`)}}await this.onPropertiesStreamed.trigger({type:c,data:m})}o/i.size>n&&(n=Math.round(n*100)/100,await this.onProgress.trigger(n),n+=.01)}await this.onProgress.trigger(1);const l=await this.components.get(gi).processFromWebIfc(this.webIfc,0);await this.onIndicesStreamed.trigger(l)}cleanUp(){this.webIfc.Dispose(),this.webIfc=null,this.webIfc=new tt.IfcAPI}}y($d,"uuid","88d2c89c-ce32-47d7-8cb6-d51e4b311a0b");class ka{constructor(e,t,i){y(this,"title");y(this,"guid",Le.create());y(this,"clippingPlanes",new $i);y(this,"camera",{aspectRatio:0,fov:0,direction:{x:0,y:0,z:80},position:{x:0,y:0,z:0}});y(this,"exceptionComponents",new $i);y(this,"selectionComponents",new $i);y(this,"componentColors",new pi);y(this,"spacesVisible",!1);y(this,"spaceBoundariesVisible",!1);y(this,"openingsVisible",!1);y(this,"defaultVisibility",!0);y(this,"_components");y(this,"world");const s={setCamera:!0,...i},{data:n,setCamera:o}=s;this._components=e,this.world=t,n&&(this.guid=n.guid??this.guid,this.set(n)),o&&this.updateCamera()}get _selectionModelIdMap(){const e=this._components.get(wt),t={};for(const[i,s]of e.groups){i in t||(t[i]=new Set);for(const n of this.selectionComponents){const o=s.globalToExpressIDs.get(n);o&&t[i].add(o)}}return t}get _exceptionModelIdMap(){const e=this._components.get(wt),t={};for(const[i,s]of e.groups){i in t||(t[i]=new Set);for(const n of this.exceptionComponents){const o=s.globalToExpressIDs.get(n);o&&t[i].add(o)}}return t}get selection(){return this._components.get(wt).modelIdToFragmentIdMap(this._selectionModelIdMap)}get exception(){return this._components.get(wt).modelIdToFragmentIdMap(this._exceptionModelIdMap)}get projection(){return"fov"in this.camera?"Perspective":"Orthographic"}get position(){const e=this._components.get(wt),{position:t}=this.camera,{x:i,y:s,z:n}=t,o=new D.Vector3(i,s,n);return e.applyBaseCoordinateSystem(o,new D.Matrix4),o}get direction(){const{direction:e}=this.camera,{x:t,y:i,z:s}=e;return new D.Vector3(t,i,s)}get _managerVersion(){return this._components.get(Mt).config.version}get topics(){return[...this._components.get(Mt).list.values()].filter(s=>s.viewpoints.has(this.guid))}async addComponentsFromMap(e){var s;const t=this._components.get(wt);for(const n in e){const o=t.list.get(n);if(!(o&&o.group))continue;const a=o.group,l=e[n];for(const c of l){const h=await a.getProperties(c);if(!h)continue;const d=(s=h.GlobalId)==null?void 0:s.value;d&&this.selectionComponents.add(d)}}this._components.get(Ht).list.set(this.guid,this)}set(e){const t=e,i=this;for(const n in e){if(n==="guid")continue;const o=t[n];n in this&&(i[n]=o)}return this._components.get(Ht).list.set(this.guid,this),this}async go(e=!0){const{camera:t}=this.world;if(!t.hasCameraControls())throw new Error("Viewpoint: the world's camera need controls to set the viewpoint.");t instanceof Yc&&t.projection.set(this.projection);const i=this.position,s=this.direction;let n={x:i.x+s.x*80,y:i.y+s.y*80,z:i.z+s.z*80};const o=this.selection;if(Object.keys(o).length===0){const h=this._components.get(mi).get(this.world).castRayFromVector(i,this.direction);h&&(n=h.point)}else{const l=this._components.get(mr);l.reset(),l.addFragmentIdMap(o),n=l.getSphere().center,l.reset()}const a=this._components.get(br);a.set(this.defaultVisibility),a.set(!this.defaultVisibility,this.exception),a.set(!0,o),await t.controls.setLookAt(i.x,i.y,i.z,n.x,n.y,n.z,e)}updateCamera(){const{camera:e,renderer:t}=this.world;if(!t)throw new Error("Viewpoint: the world needs to have a renderer!");if(!e.hasCameraControls())throw new Error("Viewpoint: world's camera need camera controls!");const i=new D.Vector3;e.controls.getPosition(i);const s=e.three,n=new D.Vector3(0,0,-1).applyEuler(s.rotation),{width:o,height:a}=t.getSize();let l=o/a;Number.isNaN(l)&&(l=1);const c=this._components.get(wt);i.applyMatrix4(c.baseCoordinationMatrix.clone().invert());const h={aspectRatio:l,position:{x:i.x,y:i.y,z:i.z},direction:{x:n.x,y:n.y,z:n.z}};s instanceof D.PerspectiveCamera?this.camera={...h,fov:s.fov}:s instanceof D.OrthographicCamera&&(this.camera={...h,viewToWorldScale:s.top-s.bottom}),this._components.get(Ht).list.set(this.guid,this)}colorize(){const e=this._components.get(Ht),t=this._components.get(wt),i=this._components.get(Ki);for(const[s,n]of this.componentColors){const o=t.guidToFragmentIdMap(n),a=new D.Color(`#${s}`);i.setColor(o,a,e.config.overwriteColors)}}resetColors(){const e=this._components.get(wt),t=this._components.get(Ki);for(const[i,s]of this.componentColors){const n=e.guidToFragmentIdMap(s);t.resetColor(n)}}async createComponentTags(e){var n,o;const t=this._components.get(wt),i=this._components.get(Mt);let s="";if(i.config.includeSelectionTag){const a=e==="selection"?this._selectionModelIdMap:this._exceptionModelIdMap;for(const l in a){const c=t.groups.get(l);if(!c)continue;const h=a[l];for(const d of h){const u=await c.getProperties(d);if(!u)continue;const f=(n=u.GlobalId)==null?void 0:n.value;if(!f)continue;const p=(o=u.Tag)==null?void 0:o.value;let m=null;p&&(m=`AuthoringToolId="${p}"`),s+=`
|
|
2283
|
+
<Component IfcGuid="${f}" ${m??""} />`}}}else s=[...this.selectionComponents].map(a=>`<Component IfcGuid="${a}" />`).join(`
|
|
2284
|
+
`);return s}async serialize(e=this._managerVersion){const t=this._components.get(wt),i=this.position;i.applyMatrix4(t.baseCoordinationMatrix.clone().invert());const s=this.direction;s.normalize();const n=new D.Matrix4().makeRotationX(Math.PI/2),o=s.clone().applyMatrix4(n);o.normalize();const a=`<CameraViewPoint>
|
|
2285
|
+
<X>${i.x}</X>
|
|
2286
|
+
<Y>${-i.z}</Y>
|
|
2287
|
+
<Z>${i.y}</Z>
|
|
2288
|
+
</CameraViewPoint>`,l=`<CameraDirection>
|
|
2289
|
+
<X>${s.x}</X>
|
|
2290
|
+
<Y>${-s.z}</Y>
|
|
2291
|
+
<Z>${s.y}</Z>
|
|
2292
|
+
</CameraDirection>`,c=`<CameraUpVector>
|
|
2293
|
+
<X>${o.x}</X>
|
|
2294
|
+
<Y>${-o.z}</Y>
|
|
2295
|
+
<Z>${o.y}</Z>
|
|
2296
|
+
</CameraUpVector>`,h=`<AspectRatio>${this.camera.aspectRatio}</AspectRatio>`;let d="";"viewToWorld"in this.camera?d=`<OrthogonalCamera>
|
|
2297
|
+
${a}
|
|
2298
|
+
${l}
|
|
2299
|
+
${c}
|
|
2300
|
+
${h}
|
|
2301
|
+
<ViewToWorldScale>${this.camera.viewToWorld}</ViewToWorldScale>
|
|
2302
|
+
</OrthogonalCamera>`:"fov"in this.camera&&(d=`<PerspectiveCamera>
|
|
2303
|
+
${a}
|
|
2304
|
+
${l}
|
|
2305
|
+
${c}
|
|
2306
|
+
${h}
|
|
2307
|
+
<FieldOfView>${this.camera.fov}</FieldOfView>
|
|
2308
|
+
</PerspectiveCamera>`);const u=`<ViewSetupHints SpacesVisible="${this.spacesVisible??!1}" SpaceBoundariesVisible="${this.spaceBoundariesVisible??!1}" OpeningsVisible="${this.openingsVisible??!1}" />`,f=(await this.createComponentTags("selection")).trim(),p=(await this.createComponentTags("exception")).trim();return`<?xml version="1.0" encoding="UTF-8"?>
|
|
2309
|
+
<VisualizationInfo Guid="${this.guid}">
|
|
2310
|
+
<Components>
|
|
2311
|
+
${e==="2.1"?u:""}
|
|
2312
|
+
${f.length!==0?`<Selection>${f}</Selection>`:""}
|
|
2313
|
+
<Visibility DefaultVisibility="${this.defaultVisibility}">
|
|
2314
|
+
${e==="3"?u:""}
|
|
2315
|
+
${p.length!==0?`<Exceptions>${p}</Exceptions>`:""}
|
|
2316
|
+
</Visibility>
|
|
2317
|
+
</Components>
|
|
2318
|
+
${d}
|
|
2319
|
+
</VisualizationInfo>`}}const Fr=class Fr extends Ot{constructor(t){super(t);y(this,"enabled",!0);y(this,"list",new pi);y(this,"isSetup",!1);y(this,"onSetup",new K);y(this,"config",{overwriteColors:!1});y(this,"onDisposed",new K);t.add(Fr.uuid,this)}create(t,i){const s=new ka(this.components,t,{data:i});return i||this.list.set(s.guid,s),s}setup(){}dispose(){this.list.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}};y(Fr,"uuid","ee867824-a796-408d-8aa0-4e5962a83c66");let Ht=Fr;class Vd{constructor(e){y(this,"onDisposed",new K);y(this,"onAfterUpdate",new K);y(this,"onBeforeUpdate",new K);y(this,"onResize",new K);y(this,"frontOffset",0);y(this,"overrideMaterial",new D.MeshDepthMaterial);y(this,"backgroundColor",new D.Color(395274));y(this,"renderer");y(this,"enabled",!0);y(this,"world");y(this,"_lockRotation",!0);y(this,"_camera");y(this,"_plane");y(this,"_size",new D.Vector2(320,160));y(this,"_tempVector1",new D.Vector3);y(this,"_tempVector2",new D.Vector3);y(this,"_tempTarget",new D.Vector3);y(this,"down",new D.Vector3(0,-1,0));y(this,"updatePlanes",()=>{if(!this.world.renderer)throw new Error("The given world must have a renderer!");const e=[],t=this.world.renderer.three;for(const i of t.clippingPlanes)e.push(i);e.push(this._plane),this.renderer.clippingPlanes=e});if(this.world=e,!this.world.renderer)throw new Error("The given world must have a renderer!");this.renderer=new D.WebGLRenderer,this.renderer.setSize(this._size.x,this._size.y);const t=1,i=this._size.x/this._size.y;this._camera=new D.OrthographicCamera(t*i/-2,t*i/2,t/2,t/-2),this.world.renderer.onClippingPlanesUpdated.add(this.updatePlanes),this._camera.position.set(0,200,0),this._camera.zoom=.1,this._camera.rotation.x=-Math.PI/2,this._plane=new D.Plane(this.down,200),this.updatePlanes()}get lockRotation(){return this._lockRotation}set lockRotation(e){this._lockRotation=e,e&&(this._camera.rotation.z=0)}get zoom(){return this._camera.zoom}set zoom(e){this._camera.zoom=e,this._camera.updateProjectionMatrix()}dispose(){this.enabled=!1,this.onBeforeUpdate.reset(),this.onAfterUpdate.reset(),this.onResize.reset(),this.overrideMaterial.dispose(),this.renderer.forceContextLoss(),this.renderer.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}get(){return this._camera}update(){if(!this.enabled)return;this.onBeforeUpdate.trigger();const e=this.world.scene.three,t=this.world.camera;if(!t.hasCameraControls())throw new Error("The given world must use camera controls!");if(!(e instanceof D.Scene))throw new Error("The given world must have a THREE.Scene as a root!");const i=t.controls;if(i.getPosition(this._tempVector1),this._camera.position.x=this._tempVector1.x,this._camera.position.z=this._tempVector1.z,this.frontOffset!==0&&(i.getTarget(this._tempVector2),this._tempVector2.sub(this._tempVector1),this._tempVector2.normalize().multiplyScalar(this.frontOffset),this._camera.position.x+=this._tempVector2.x,this._camera.position.z+=this._tempVector2.z),!this._lockRotation){i.getTarget(this._tempTarget);const n=Math.atan2(this._tempTarget.x-this._tempVector1.x,this._tempTarget.z-this._tempVector1.z);this._camera.rotation.z=n+Math.PI}this._plane.set(this.down,this._tempVector1.y);const s=e.background;e.background=this.backgroundColor,this.renderer.render(e,this._camera),e.background=s,this.onAfterUpdate.trigger()}getSize(){return this._size}resize(e=this._size){this._size.copy(e),this.renderer.setSize(e.x,e.y);const t=e.x/e.y,i=1;this._camera.left=i*t/-2,this._camera.right=i*t/2,this._camera.top=i/2,this._camera.bottom=-i/2,this._camera.updateProjectionMatrix(),this.onResize.trigger(e)}}const Or=class Or extends Ot{constructor(t){super(t);y(this,"onAfterUpdate",new K);y(this,"onBeforeUpdate",new K);y(this,"onDisposed",new K);y(this,"enabled",!0);y(this,"list",new Map);this.components.add(Or.uuid,this)}create(t){if(this.list.has(t.uuid))throw new Error("This world already has a minimap!");const i=new Vd(t);return this.list.set(t.uuid,i),i}delete(t){const i=this.list.get(t);i&&i.dispose(),this.list.delete(t)}dispose(){for(const[t,i]of this.list)i.dispose();this.list.clear(),this.onDisposed.trigger()}update(){for(const[t,i]of this.list)i.update()}};y(Or,"uuid","39ad6aad-84c8-4adf-a1e0-7f25313a9e7f");let ca=Or;const xr=class xr extends Ot{constructor(t){super(t);y(this,"enabled",!0);t.add(xr.uuid,this)}static distanceFromPointToLine(t,i,s,n=!1){const o=new D.Line3,a=new D.Vector3;return o.set(i,s),o.closestPointToPoint(t,n,a),a.distanceTo(t)}getFace(t,i,s){if(!t.geometry.index)throw new Error("Geometry must be indexed!");const n=new Map,o=t.geometry.index.array,{plane:a}=this.getFaceData(i,s,t),l=[];for(let u=0;u<o.length/3;u++){const{plane:f,edges:p}=this.getFaceData(u,s,t);if(f.equals(a)){l.push({index:u,edges:p});for(const{id:m,points:E,distance:g}of p)n.set(m,{points:E,distance:g})}}let c=0;const h=new Map,d=new Map;for(const{index:u,edges:f}of l){const p=new Map;for(const{id:v}of f)if(h.has(v)){const A=h.get(v);p.set(v,A)}const m=f.map(v=>v.id);if(!p.size){const v=c++;for(const{id:A}of f)h.set(A,v);d.set(v,{edges:new Set(m),indices:new Set([u])});continue}let E=null;const g=new Set,I=new Set(m);for(const[v,A]of p){E===null?E=A:A!==E&&g.add(A),h.delete(v);const{edges:S}=d.get(A);S.delete(v),I.delete(v)}if(E===null)throw new Error("Error computing face!");const T=d.get(E),{indices:b}=T;b.add(u);for(const v of I){h.set(v,E);const{edges:A}=T;A.add(v)}for(const v of g){const A=d.get(v),{edges:S,indices:N}=A,R=d.get(E),{edges:P,indices:M}=R;for(const w of S)P.add(w),h.set(w,E);for(const w of N)M.add(w);d.delete(v)}}for(const[u,{indices:f,edges:p}]of d)if(f.has(i)){const m=[];for(const E of p){const g=n.get(E);m.push(g)}return{edges:m,indices:f}}return null}getVerticesAndNormal(t,i,s){if(!t.geometry.index)throw new Error("Geometry must be indexed!");const n=t.geometry.index.array,o=t.geometry.attributes.position.array,a=t.geometry.attributes.normal.array,l=n[i*3]*3,c=n[i*3+1]*3,h=n[i*3+2]*3,d=new D.Vector3(o[l],o[l+1],o[l+2]),u=new D.Vector3(o[c],o[c+1],o[c+2]),f=new D.Vector3(o[h],o[h+1],o[h+2]),p=new D.Vector3(a[l],a[l+1],a[l+2]),m=new D.Vector3(a[c],a[c+1],a[c+2]),E=new D.Vector3(a[h],a[h+1],a[h+2]),g=(p.x+m.x+E.x)/3,I=(p.y+m.y+E.y)/3,T=(p.z+m.z+E.z)/3,b=new D.Vector3(g,I,T);if(s!==void 0&&t instanceof D.InstancedMesh){const v=new D.Matrix4;t.getMatrixAt(s,v);const A=new D.Matrix4;A.extractRotation(v),b.applyMatrix4(A),d.applyMatrix4(v),u.applyMatrix4(v),f.applyMatrix4(v)}return{p1:d,p2:u,p3:f,faceNormal:b}}round(t){t.x=Math.trunc(t.x*1e3)/1e3,t.y=Math.trunc(t.y*1e3)/1e3,t.z=Math.trunc(t.z*1e3)/1e3}getVolumeFromFragments(t){const i=this.components.get(wt),s=new D.Matrix4,n=[];for(const a in t){const l=i.list.get(a);if(!l)continue;const c=t[a];let h=0;for(const f of c){const p=l.getInstancesIDs(f);p&&(h+=p.size)}const d=new D.InstancedMesh(l.mesh.geometry,void 0,h);let u=0;for(const f of c){const p=l.getInstancesIDs(f);if(p)for(const m of p)l.mesh.getMatrixAt(m,s),d.setMatrixAt(u++,s)}n.push(d)}const o=this.getVolumeFromMeshes(n);for(const a of n)a.geometry=null,a.material=[],a.dispose();return o}getVolumeFromMeshes(t){let i=0;for(const s of t)i+=this.getVolumeOfMesh(s);return i}getFaceData(t,i,s){const n=this.getVerticesAndNormal(s,t,i),{p1:o,p2:a,p3:l,faceNormal:c}=n;this.round(o),this.round(a),this.round(l),this.round(c);const h=[{id:`${o.x}|${o.y}|${o.z}`,value:o},{id:`${a.x}|${a.y}|${a.z}`,value:a},{id:`${l.x}|${l.y}|${l.z}`,value:l}];h.sort((T,b)=>T.id<b.id?-1:T.id>b.id?1:0);const[{id:d,value:u},{id:f,value:p},{id:m,value:E}]=h,g=[{id:`${d}|${f}`,distance:u.distanceTo(p),points:[u,p]},{id:`${f}|${m}`,distance:p.distanceTo(E),points:[p,E]},{id:`${d}|${m}`,distance:u.distanceTo(E),points:[u,E]}],I=new D.Plane;return I.setFromNormalAndCoplanarPoint(c,o),I.constant=Math.round(I.constant*10)/10,{plane:I,edges:g}}getVolumeOfMesh(t){let i=0;const s=new D.Vector3,n=new D.Vector3,o=new D.Vector3,{index:a}=t.geometry,l=t.geometry.attributes.position.array;if(!a)return console.warn("Geometry must be indexed to compute its volume!"),0;const c=[];if(t instanceof D.InstancedMesh)for(let d=0;d<t.count;d++){const u=new D.Matrix4;t.getMatrixAt(d,u),c.push(u)}else c.push(new D.Matrix4().identity());const{matrixWorld:h}=t;for(let d=0;d<a.array.length-2;d+=3)for(const u of c){const f=u.multiply(h),p=a.array[d]*3,m=a.array[d+1]*3,E=a.array[d+2]*3;s.set(l[p],l[p+1],l[p+2]).applyMatrix4(f),n.set(l[m],l[m+1],l[m+2]).applyMatrix4(f),o.set(l[E],l[E+1],l[E+2]).applyMatrix4(f),i+=this.getSignedVolumeOfTriangle(s,n,o)}return Math.abs(i)}getSignedVolumeOfTriangle(t,i,s){const n=s.x*i.y*t.z,o=i.x*s.y*t.z,a=s.x*t.y*i.z,l=t.x*s.y*i.z,c=i.x*t.y*s.z,h=t.x*i.y*s.z;return 1/6*(-n+o+a-l-c+h)}};y(xr,"uuid","267ca032-672f-4cb0-afa9-d24e904f39d6");let ha=xr;exports.AsyncEvent=Ns;exports.BCFTopics=Mt;exports.Base=Lr;exports.BaseCamera=Rc;exports.BaseRenderer=Sc;exports.BaseScene=Fc;exports.BaseWorldItem=Mr;exports.BoundingBoxer=mr;exports.Classifier=Ki;exports.Clipper=Kn;exports.Comment=Jn;exports.Component=Ot;exports.Components=Zn;exports.CullerRenderer=Dc;exports.Cullers=Qn;exports.DataMap=pi;exports.DataSet=$i;exports.Disposer=Pe;exports.Event=K;exports.Exploder=aa;exports.FirstPersonMode=$c;exports.FragmentsManager=wt;exports.GeometryTypes=Da;exports.Grids=Go;exports.Hider=br;exports.IfcCategories=IE;exports.IfcCategoryMap=Ua;exports.IfcElements=Ld;exports.IfcFragmentSettings=Kr;exports.IfcGeometryTiler=la;exports.IfcJsonExporter=gr;exports.IfcLoader=Er;exports.IfcPropertiesManager=oa;exports.IfcPropertiesTiler=$d;exports.IfcPropertiesUtils=je;exports.IfcRelationsIndexer=gi;exports.IfcStreamingSettings=Bd;exports.MaterialsUtils=Vo;exports.MeasurementUtils=ha;exports.MeshCullerRenderer=Uc;exports.MiniMap=Vd;exports.MiniMaps=ca;exports.Mouse=kc;exports.OrbitMode=Vc;exports.OrthoPerspectiveCamera=Yc;exports.PlanMode=Gc;exports.ProjectionManager=Hc;exports.PropertiesStreamingSettings=zd;exports.Raycasters=mi;exports.ShadowedScene=bf;exports.SimpleCamera=Gi;exports.SimpleGrid=zc;exports.SimplePlane=Dr;exports.SimpleRaycaster=Bc;exports.SimpleRenderer=hf;exports.SimpleScene=Pc;exports.SimpleWorld=Nc;exports.Topic=Gs;exports.UUID=Le;exports.VertexPicker=cf;exports.Viewpoint=ka;exports.Viewpoints=Ht;exports.Worlds=qn;exports.bcfTopicsList=Pd;exports.isPointInFrontOfPlane=xc;exports.obbFromPoints=Oc;exports.readPixelsAsync=ma;exports.topicForm=aE;exports.topicPanel=bE;exports.viewpointsList=Ma;
|