gl-draw 0.4.5 → 0.4.7

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.
@@ -1,4 +1,4 @@
1
- import*as it from"idb-keyval";import*as It from"three";import*as Zt from"three/examples/jsm/renderers/CSS2DRenderer";import*as at from"three/examples/jsm/renderers/CSS3DRenderer";import*as ot from"popmotion";import*as Ft from"three/examples/jsm//utils/BufferGeometryUtils";import*as Xe from"d3-array";import*as Xt from"earcut";import*as Ht from"@turf/boolean-clockwise";import*as Kt from"delaunator";import*as $t from"@turf/boolean-point-in-polygon";import*as We from"d3-geo";import*as Yt from"d3-geo-voronoi";import*as Jt from"d3-scale";var Qt={666:function(j){var k=function(P){"use strict";var O=Object.prototype,x=O.hasOwnProperty,V,L=typeof Symbol=="function"?Symbol:{},B=L.iterator||"@@iterator",H=L.asyncIterator||"@@asyncIterator",S=L.toStringTag||"@@toStringTag";function T(h,l,v){return Object.defineProperty(h,l,{value:v,enumerable:!0,configurable:!0,writable:!0}),h[l]}try{T({},"")}catch(h){T=function(l,v,E){return l[v]=E}}function J(h,l,v,E){var w=l&&l.prototype instanceof oe?l:oe,q=Object.create(w.prototype),U=new Ae(E||[]);return q._invoke=pe(h,v,U),q}P.wrap=J;function Q(h,l,v){try{return{type:"normal",arg:h.call(l,v)}}catch(E){return{type:"throw",arg:E}}}var z="suspendedStart",c="suspendedYield",fe="executing",re="completed",Y={};function oe(){}function W(){}function F(){}var G={};T(G,B,function(){return this});var K=Object.getPrototypeOf,I=K&&K(K(ze([])));I&&I!==O&&x.call(I,B)&&(G=I);var $=F.prototype=oe.prototype=Object.create(G);W.prototype=F,T($,"constructor",F),T(F,"constructor",W),W.displayName=T(F,S,"GeneratorFunction");function X(h){["next","throw","return"].forEach(function(l){T(h,l,function(v){return this._invoke(l,v)})})}P.isGeneratorFunction=function(h){var l=typeof h=="function"&&h.constructor;return l?l===W||(l.displayName||l.name)==="GeneratorFunction":!1},P.mark=function(h){return Object.setPrototypeOf?Object.setPrototypeOf(h,F):(h.__proto__=F,T(h,S,"GeneratorFunction")),h.prototype=Object.create($),h},P.awrap=function(h){return{__await:h}};function ee(h,l){function v(q,U,ne,he){var ie=Q(h[q],h,U);if(ie.type==="throw")he(ie.arg);else{var Le=ie.arg,Se=Le.value;return Se&&typeof Se=="object"&&x.call(Se,"__await")?l.resolve(Se.__await).then(function(ve){v("next",ve,ne,he)},function(ve){v("throw",ve,ne,he)}):l.resolve(Se).then(function(ve){Le.value=ve,ne(Le)},function(ve){return v("throw",ve,ne,he)})}}var E;function w(q,U){function ne(){return new l(function(he,ie){v(q,U,he,ie)})}return E=E?E.then(ne,ne):ne()}this._invoke=w}X(ee.prototype),T(ee.prototype,H,function(){return this}),P.AsyncIterator=ee,P.async=function(h,l,v,E,w){w===void 0&&(w=Promise);var q=new ee(J(h,l,v,E),w);return P.isGeneratorFunction(l)?q:q.next().then(function(U){return U.done?U.value:q.next()})};function pe(h,l,v){var E=z;return function(q,U){if(E===fe)throw new Error("Generator is already running");if(E===re){if(q==="throw")throw U;return Ee()}for(v.method=q,v.arg=U;;){var ne=v.delegate;if(ne){var he=ye(ne,v);if(he){if(he===Y)continue;return he}}if(v.method==="next")v.sent=v._sent=v.arg;else if(v.method==="throw"){if(E===z)throw E=re,v.arg;v.dispatchException(v.arg)}else v.method==="return"&&v.abrupt("return",v.arg);E=fe;var ie=Q(h,l,v);if(ie.type==="normal"){if(E=v.done?re:c,ie.arg===Y)continue;return{value:ie.arg,done:v.done}}else ie.type==="throw"&&(E=re,v.method="throw",v.arg=ie.arg)}}}function ye(h,l){var v=h.iterator[l.method];if(v===V){if(l.delegate=null,l.method==="throw"){if(h.iterator.return&&(l.method="return",l.arg=V,ye(h,l),l.method==="throw"))return Y;l.method="throw",l.arg=new TypeError("The iterator does not provide a 'throw' method")}return Y}var E=Q(v,h.iterator,l.arg);if(E.type==="throw")return l.method="throw",l.arg=E.arg,l.delegate=null,Y;var w=E.arg;if(!w)return l.method="throw",l.arg=new TypeError("iterator result is not an object"),l.delegate=null,Y;if(w.done)l[h.resultName]=w.value,l.next=h.nextLoc,l.method!=="return"&&(l.method="next",l.arg=V);else return w;return l.delegate=null,Y}X($),T($,S,"Generator"),T($,B,function(){return this}),T($,"toString",function(){return"[object Generator]"});function te(h){var l={tryLoc:h[0]};1 in h&&(l.catchLoc=h[1]),2 in h&&(l.finallyLoc=h[2],l.afterLoc=h[3]),this.tryEntries.push(l)}function D(h){var l=h.completion||{};l.type="normal",delete l.arg,h.completion=l}function Ae(h){this.tryEntries=[{tryLoc:"root"}],h.forEach(te,this),this.reset(!0)}P.keys=function(h){var l=[];for(var v in h)l.push(v);return l.reverse(),function E(){for(;l.length;){var w=l.pop();if(w in h)return E.value=w,E.done=!1,E}return E.done=!0,E}};function ze(h){if(h){var l=h[B];if(l)return l.call(h);if(typeof h.next=="function")return h;if(!isNaN(h.length)){var v=-1,E=function w(){for(;++v<h.length;)if(x.call(h,v))return w.value=h[v],w.done=!1,w;return w.value=V,w.done=!0,w};return E.next=E}}return{next:Ee}}P.values=ze;function Ee(){return{value:V,done:!0}}return Ae.prototype={constructor:Ae,reset:function(h){if(this.prev=0,this.next=0,this.sent=this._sent=V,this.done=!1,this.delegate=null,this.method="next",this.arg=V,this.tryEntries.forEach(D),!h)for(var l in this)l.charAt(0)==="t"&&x.call(this,l)&&!isNaN(+l.slice(1))&&(this[l]=V)},stop:function(){this.done=!0;var h=this.tryEntries[0],l=h.completion;if(l.type==="throw")throw l.arg;return this.rval},dispatchException:function(h){if(this.done)throw h;var l=this;function v(he,ie){return q.type="throw",q.arg=h,l.next=he,ie&&(l.method="next",l.arg=V),!!ie}for(var E=this.tryEntries.length-1;E>=0;--E){var w=this.tryEntries[E],q=w.completion;if(w.tryLoc==="root")return v("end");if(w.tryLoc<=this.prev){var U=x.call(w,"catchLoc"),ne=x.call(w,"finallyLoc");if(U&&ne){if(this.prev<w.catchLoc)return v(w.catchLoc,!0);if(this.prev<w.finallyLoc)return v(w.finallyLoc)}else if(U){if(this.prev<w.catchLoc)return v(w.catchLoc,!0)}else if(ne){if(this.prev<w.finallyLoc)return v(w.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(h,l){for(var v=this.tryEntries.length-1;v>=0;--v){var E=this.tryEntries[v];if(E.tryLoc<=this.prev&&x.call(E,"finallyLoc")&&this.prev<E.finallyLoc){var w=E;break}}w&&(h==="break"||h==="continue")&&w.tryLoc<=l&&l<=w.finallyLoc&&(w=null);var q=w?w.completion:{};return q.type=h,q.arg=l,w?(this.method="next",this.next=w.finallyLoc,Y):this.complete(q)},complete:function(h,l){if(h.type==="throw")throw h.arg;return h.type==="break"||h.type==="continue"?this.next=h.arg:h.type==="return"?(this.rval=this.arg=h.arg,this.method="return",this.next="end"):h.type==="normal"&&l&&(this.next=l),Y},finish:function(h){for(var l=this.tryEntries.length-1;l>=0;--l){var v=this.tryEntries[l];if(v.finallyLoc===h)return this.complete(v.completion,v.afterLoc),D(v),Y}},catch:function(h){for(var l=this.tryEntries.length-1;l>=0;--l){var v=this.tryEntries[l];if(v.tryLoc===h){var E=v.completion;if(E.type==="throw"){var w=E.arg;D(v)}return w}}throw new Error("illegal catch attempt")},delegateYield:function(h,l,v){return this.delegate={iterator:ze(h),resultName:l,nextLoc:v},this.method==="next"&&(this.arg=V),Y}},P}(j.exports);try{regeneratorRuntime=k}catch(P){typeof globalThis=="object"?globalThis.regeneratorRuntime=k:Function("r","regeneratorRuntime = r")(k)}},695:function(j,k,P){P.d(k,{Z:function(){return O}});function O(x){if(x.geometry&&x.geometry.dispose(),x.material){var V=Array.isArray(x.material)?x.material:[x.material];V.forEach(function(L){var B,H,S,T,J,Q,z,c,fe,re,Y,oe,W;(B=L.map)===null||B===void 0||B.dispose(),(H=L.lightMap)===null||H===void 0||H.dispose(),(S=L.bumpMap)===null||S===void 0||S.dispose(),(T=L.normalMap)===null||T===void 0||T.dispose(),(J=L.specularMap)===null||J===void 0||J.dispose(),(Q=L.envMap)===null||Q===void 0||Q.dispose(),(z=L.alphaMap)===null||z===void 0||z.dispose(),(c=L.aoMap)===null||c===void 0||c.dispose(),(fe=L.displacementMap)===null||fe===void 0||fe.dispose(),(re=L.emissiveMap)===null||re===void 0||re.dispose(),(Y=L.gradientMap)===null||Y===void 0||Y.dispose(),(oe=L.metalnessMap)===null||oe===void 0||oe.dispose(),(W=L.roughnessMap)===null||W===void 0||W.dispose(),L.dispose()})}}},521:function(j,k,P){P.d(k,{wf:function(){return L.Z}});var O=P(666),x=P.n(O),V=null,L=P(695),B=P(949);function H(W){if(W.material){var F=Array.isArray(W.material)?W.material:[W.material];F.forEach(function(G){var K,I;(K=G.color)===null||K===void 0||K.convertSRGBToLinear(),(I=G.emissive)===null||I===void 0||I.convertSRGBToLinear(),G.map&&(G.map.encoding=THREE.sRGBEncoding),G.emissiveMap&&(G.emissiveMap.encoding=THREE.sRGBEncoding)})}}var S=P(568),T=P(924),J=W=>{var F={};return P.d(F,W),F},Q=W=>()=>W,z=J({get:()=>it.get,set:()=>it.set}),c=P(484),fe=null,re=null,Y=function(){var W=(0,S.Z)(x().mark(function F(G,K){var I,$,X,ee,pe,ye;return x().wrap(function(D){for(;;)switch(D.prev=D.next){case 0:return I=K.version,D.next=4,(0,z.get)(G);case 4:if(X=D.sent,!(X&&X[I])){D.next=9;break}$=X[I],D.next=15;break;case 9:return D.next=11,(0,c.Z)(fetch(G).then(function(Ae){if(Ae.ok)return Ae.blob();throw new Error}));case 11:ee=D.sent,pe=ee.res,ye=ee.err,ye||($=pe,(0,z.set)(G,(0,T.Z)({},I,pe)));case 15:return D.abrupt("return",$?{url:URL.createObjectURL($)}:{url:G});case 16:case"end":return D.stop()}},F)}));return function(G,K){return W.apply(this,arguments)}}(),oe=P(705)},484:function(j,k,P){P.d(k,{Z:function(){return x}});var O=P(42);function x(V){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return V.then(function(B){return(0,O.Z)({err:null,res:B},L)}).catch(function(B){return(0,O.Z)({err:B,res:void 0},L)})}},705:function(j,k,P){P.d(k,{C:function(){return L},y:function(){return V}});var O=P(949),x=new Map,V=function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{generateTopUV:function(H,S,T,J,Q){var z=S[T*3],c=S[T*3+1],fe=S[J*3],re=S[J*3+1],Y=S[Q*3],oe=S[Q*3+1],W;if(x.has(H))W=x.get(H);else{var F=B.box3||new O.Box3;if(!B.box3){var G=H.parameters.shapes.getPoints();F.setFromArray(G.map(function(ee){return[ee.x,ee.y,0]}).flat())}var K=F.getSize(new O.Vector3);B.split&&(K.y/=B.split),W={box:F,size:K},x.set(H,W)}var I=W.box,$=W.size,X=B.split?1-B.split:0;return[new O.Vector2((z-I.min.x)/$.x,(c-I.min.y)/$.y+X),new O.Vector2((fe-I.min.x)/$.x,(re-I.min.y)/$.y+X),new O.Vector2((Y-I.min.x)/$.x,(oe-I.min.y)/$.y+X)]},generateSideWallUV:function(H,S,T,J,Q,z){var c=S[T*3],fe=S[T*3+1],re=S[T*3+2],Y=S[J*3],oe=S[J*3+1],W=S[J*3+2],F=S[Q*3],G=S[Q*3+1],K=S[Q*3+2],I=S[z*3],$=S[z*3+1],X=S[z*3+2],ee;if(x.has(S))ee=x.get(S);else{var pe=new O.Box3;pe.setFromArray(S);var ye=pe.getSize(new O.Vector3);B.split&&(ye.z/=1-B.split),ee={box:pe,size:ye},x.set(S,ee)}var te=ee.box,D=ee.size;return Math.abs(fe-oe)<Math.abs(c-Y)?[new O.Vector2((c-te.min.x)/D.x,(re-te.min.z)/D.z),new O.Vector2((Y-te.min.x)/D.x,(W-te.min.z)/D.z),new O.Vector2((F-te.min.x)/D.x,(K-te.min.z)/D.z),new O.Vector2((I-te.min.x)/D.x,(X-te.min.z)/D.z)]:[new O.Vector2((fe-te.min.y)/D.y,(re-te.min.z)/D.z),new O.Vector2((oe-te.min.y)/D.y,(W-te.min.z)/D.z),new O.Vector2((G-te.min.y)/D.y,(K-te.min.z)/D.z),new O.Vector2(($-te.min.y)/D.y,(X-te.min.z)/D.z)]}}},L=function(){x.clear()}},949:function(j){var k=O=>{var x={};return N.d(x,O),x},P=O=>()=>O;j.exports=It},568:function(j,k,P){P.d(k,{Z:function(){return x}});function O(V,L,B,H,S,T,J){try{var Q=V[T](J),z=Q.value}catch(c){B(c);return}Q.done?L(z):Promise.resolve(z).then(H,S)}function x(V){return function(){var L=this,B=arguments;return new Promise(function(H,S){var T=V.apply(L,B);function J(z){O(T,H,S,J,Q,"next",z)}function Q(z){O(T,H,S,J,Q,"throw",z)}J(void 0)})}}},924:function(j,k,P){P.d(k,{Z:function(){return O}});function O(x,V,L){return V in x?Object.defineProperty(x,V,{value:L,enumerable:!0,configurable:!0,writable:!0}):x[V]=L,x}},42:function(j,k,P){P.d(k,{Z:function(){return x}});var O=P(924);function x(V){for(var L=1;L<arguments.length;L++){var B=arguments[L]!=null?arguments[L]:{},H=Object.keys(B);typeof Object.getOwnPropertySymbols=="function"&&(H=H.concat(Object.getOwnPropertySymbols(B).filter(function(S){return Object.getOwnPropertyDescriptor(B,S).enumerable}))),H.forEach(function(S){(0,O.Z)(V,S,B[S])})}return V}}},st={};function N(j){var k=st[j];if(k!==void 0)return k.exports;var P=st[j]={exports:{}};return Qt[j](P,P.exports,N),P.exports}(function(){N.n=function(j){var k=j&&j.__esModule?function(){return j.default}:function(){return j};return N.d(k,{a:k}),k}})(),function(){N.d=function(j,k){for(var P in k)N.o(k,P)&&!N.o(j,P)&&Object.defineProperty(j,P,{enumerable:!0,get:k[P]})}}(),function(){N.o=function(j,k){return Object.prototype.hasOwnProperty.call(j,k)}}();var _e={};(function(){N.d(_e,{Ei:function(){return Vt},Yo:function(){return Ut},Ee:function(){return Le},x1:function(){return _t},VJ:function(){return be},r7:function(){return Ue},XA:function(){return He},NB:function(){return lt},xv:function(){return E},nk:function(){return ut}});function j(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function k(e,n){return k=Object.setPrototypeOf||function(i,a){return i.__proto__=a,i},k(e,n)}function P(e,n){return k(e,n)}function O(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),n&&P(e,n)}var x=N(42);function V(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,i)}return r}function L(e,n){return n=n!=null?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):V(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}),e}function B(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function H(e){return H=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},H(e)}function S(e){return H(e)}function T(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function J(e){return e&&e.constructor===Symbol?"symbol":typeof e}function Q(e,n){return n&&(J(n)==="object"||typeof n=="function")?n:T(e)}function z(e){var n=B();return function(){var i=S(e),a;if(n){var t=S(this).constructor;a=Reflect.construct(i,arguments,t)}else a=i.apply(this,arguments);return Q(this,a)}}var c=N(949);function fe(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function re(e,n,r){return fe()?re=Reflect.construct:re=function(a,t,o){var s=[null];s.push.apply(s,t);var f=Function.bind.apply(a,s),p=new f;return o&&P(p,o.prototype),p},re.apply(null,arguments)}function Y(e,n,r){return re.apply(null,arguments)}function oe(e,n){for(var r=0;r<n.length;r++){var i=n[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function W(e,n,r){return n&&oe(e.prototype,n),r&&oe(e,r),e}function F(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=new Array(n);r<n;r++)i[r]=e[r];return i}function G(e){if(Array.isArray(e))return F(e)}function K(e){if(typeof Symbol!="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function I(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function $(e,n){if(!!e){if(typeof e=="string")return F(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return F(e,n)}}function X(e){return G(e)||K(e)||$(e)||I()}var ee=N(484);function pe(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r={};return r.promise=new Promise(function(i,a){r.resolve=i,r.reject=a}),e&&(r.promise=(0,ee.Z)(r.promise,n)),r}var ye=e=>{var n={};return N.d(n,e),n},te=e=>()=>e,D=ye({CSS2DObject:()=>Zt.CSS2DObject}),Ae=e=>{var n={};return N.d(n,e),n},ze=e=>()=>e,Ee=Ae({CSS3DObject:()=>at.CSS3DObject,CSS3DSprite:()=>at.CSS3DSprite}),h=N(521),l=function(e){e&&((0,h.wf)(e),e.children.forEach(function(n){n.userData.BaseObject_||l(n)}))},v=function(){"use strict";function e(){j(this,e),this.objecttype__="BaseObject",this.userData={},this.pm=pe(),this.visible=!1}var n=e.prototype;return n.init=function(){},n.create=function(){},n.render=function(){},n.update=function(i,a){},n.resize=function(i,a){},n.show=function(){return this.object3d&&(this.object3d.visible=!0),this.visible=!0,this},n.hide=function(){return this.object3d&&(this.object3d.visible=!1),this.visible=!1,this},n.isVisible=function(){return this.visible},n.createMesh=function(){for(var i=arguments.length,a=new Array(i),t=0;t<i;t++)a[t]=arguments[t];return this.object3d=Y(c.Mesh,X(a)),this},n.createGroup=function(){return this.object3d=new c.Group,this},n.createPoints=function(){for(var i=arguments.length,a=new Array(i),t=0;t<i;t++)a[t]=arguments[t];return this.object3d=Y(c.Points,X(a)),this},n.createCSS2DObject=function(i){return this.object3d=new D.CSS2DObject(i),this},n.createCSS3DObject=function(i){return this.object3d=new Ee.CSS3DObject(i),this},n.createCSS3DSprite=function(i){return this.object3d=new Ee.CSS3DSprite(i),this},n.createSprite=function(i){return this.object3d=new c.Sprite(i),this},n.add=function(){for(var i=arguments.length,a=new Array(i),t=0;t<i;t++)a[t]=arguments[t];var o;return(o=this.object3d).add.apply(o,X(a)),this},n.remove=function(){for(var i=arguments.length,a=new Array(i),t=0;t<i;t++)a[t]=arguments[t];var o;return(o=this.object3d).remove.apply(o,X(a)),this},n.getSize=function(){var i=new c.Box3().setFromObject(this.object3d);return{min:i.min,max:i.max,size:i.getSize(new c.Vector3)}},n.traverse=function(i){i(this),this.children.forEach(function(a){a.traverse(i)})},n.dispose=function(){l(this.object3d)},W(e,[{key:"parent",get:function(){var i=this.object3d.parent;return(i==null?void 0:i.userData.BaseObject_)||this.pencil.scene}},{key:"children",get:function(){return this.object3d.children.map(function(i){return i.userData.BaseObject_}).filter(function(i){return!!i})}}]),e}(),E=function(e){"use strict";O(r,e);var n=z(r);function r(a){j(this,r);var t;return t=n.call(this),t.width=0,t.canvas=document.createElement("canvas"),t.options=(0,x.Z)({},{scale:.5,fontSize:28,fontFamily:"system-ui,-apple-system,BlinkMacSystemFont,sans-serif",fontWeight:"normal",flipX:!1,sprite:!1,sizeAttenuation:!0},a),t}var i=r.prototype;return i.create=function(){var t=this.options,o=t.position,s=t.lookAt,f=t.sprite,p=t.text,d=t.sizeAttenuation;if(f){var g=new c.Sprite(new c.SpriteMaterial({transparent:!0,sizeAttenuation:d}));this.object3d=g}else{var _=new c.MeshBasicMaterial({side:c.DoubleSide,transparent:!0}),y=new c.PlaneGeometry(1,1,1,1);this.createMesh(y,_)}this.object3d.position.copy(o),s&&this.object3d.lookAt(s),this.setText(p)},i.setText=function(t,o){var s=(0,x.Z)(L((0,x.Z)({},this.options),{text:t}),o||{}),f=s.text,p=s.fontSize,d=s.fontFamily,g=s.fontWeight,_=s.flipX,y=s.scale,m=this.canvas;m.width=p*f.length*2,m.height=p;var b=m.getContext("2d");b.font="".concat(g," ").concat(p,"px/1 ").concat(d);var u=b.measureText(f).width;m.width=u,this.width=u,b=m.getContext("2d"),b.clearRect(0,0,m.width,m.height),_&&b.scale(-1,1),b.font="".concat(g," ").concat(p,"px/1 ").concat(d),b.textBaseline="middle",b.fillStyle="#ffffff",b.fillText(f,_?u*-1:0,m.height/2),b.restore();var M=new c.Texture(m);M.anisotropy=16,M.needsUpdate=!0;var A=this.object3d;A.material.map&&A.material.map.dispose(),A.material.map=M,A.material.needsUpdate=!0,A.scale.set(M.image.width*y,M.image.height*y,1)},r}(v),w=N(568),q=N(666),U=N.n(q),ne=+c.REVISION<144,he=ne?"ExtrudeBufferGeometry":"ExtrudeGeometry",ie=ne?"PlaneBufferGeometry":"PlaneGeometry",Le=function(e){"use strict";O(r,e);var n=z(r);function r(a){j(this,r);var t;return t=n.call(this),t.options=a,t}var i=r.prototype;return i.getMaterial=function(){var t=this;return(0,w.Z)(U().mark(function o(){var s,f,p,d,g,_,y,m,b,u;return U().wrap(function(A){for(;;)switch(A.prev=A.next){case 0:return s=t.options,f=s.transparent,p=s.blending,d=s.src,g=s.depthWrite,_=s.alphaTest,y=s.sprite,m=s.sizeAttenuation,A.next=3,new c.TextureLoader().loadAsync(d);case 3:return b=A.sent,u=y?new c.SpriteMaterial({map:b,transparent:f!=null?f:!1,blending:p!=null?p:c.NormalBlending,depthWrite:g!=null?g:!0,alphaTest:_!=null?_:0,sizeAttenuation:m!=null?m:!0}):new c.MeshBasicMaterial({map:b,transparent:f!=null?f:!1,blending:p!=null?p:c.NormalBlending,depthWrite:g!=null?g:!0,alphaTest:_!=null?_:0}),A.abrupt("return",u);case 6:case"end":return A.stop()}},o)}))()},i.create=function(){var t=this;return(0,w.Z)(U().mark(function o(){var s,f,p,d,g,_,y,m;return U().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(s=t.options,f=s.scale,p=s.position,d=s.src,g=s.cache,_=s.sprite,!(g&&!g.get(d))){u.next=7;break}return g.init(d),u.next=5,t.getMaterial();case 5:y=u.sent,g.set(d,y);case 7:if(!g){u.next=13;break}return u.next=10,g.get(d);case 10:u.t0=u.sent,u.next=16;break;case 13:return u.next=15,t.getMaterial();case 15:u.t0=u.sent;case 16:m=u.t0,t.texture=m.map,_?t.createSprite(m):t.createMesh(new c[ie](1,1),m),f&&t.setScale(f),p&&t.object3d.position.copy(p);case 21:case"end":return u.stop()}},o)}))()},i.setScale=function(t){this.object3d.scale.set(this.texture.image.width*t,this.texture.image.height*t,1)},r}(v);function Se(e,n){for(;!Object.prototype.hasOwnProperty.call(e,n)&&(e=S(e),e!==null););return e}function ve(e,n,r){return typeof Reflect!="undefined"&&Reflect.get?ve=Reflect.get:ve=function(a,t,o){var s=Se(a,t);if(!!s){var f=Object.getOwnPropertyDescriptor(s,t);return f.get?f.get.call(o||a):f.value}},ve(e,n,r)}function Ge(e,n,r){return ve(e,n,r)}var ut=function(e){"use strict";O(r,e);var n=z(r);function r(a){j(this,r);var t;return t=n.call(this),t.options=(0,x.Z)({},{autoPlay:!0,loop:!0},a),t}var i=r.prototype;return i.getMaterial=function(){var t=this.options,o=t.src,s=t.transparent,f=t.blending,p=t.depthWrite,d=t.format,g=t.autoPlay,_=t.loop,y=t.alphaTest,m=t.sprite,b=pe(),u=document.createElement("video");return u.addEventListener("loadedmetadata",function(){var M=new c.VideoTexture(u);M.format=d!=null?d:c.RGBAFormat,M.needsUpdate=!0;var A=m?new c.SpriteMaterial({map:M,transparent:s!=null?s:!1,blending:f!=null?f:c.NormalBlending,depthWrite:p!=null?p:!0,alphaTest:y!=null?y:0}):new c.MeshBasicMaterial({map:M,transparent:s!=null?s:!1,blending:f!=null?f:c.NormalBlending,depthWrite:p!=null?p:!0,alphaTest:y!=null?y:0});b.resolve(A)},!1),u.src=o,u.muted=!0,u.autoplay=g,u.loop=_,u.preload="auto",b.promise},i.create=function(){var t=this;return(0,w.Z)(U().mark(function o(){var s,f,p,d,g,_,y,m;return U().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(s=t.options,f=s.scale,p=s.position,d=s.src,g=s.cache,_=s.sprite,!(g&&!g.get(d))){u.next=7;break}return g.init(d),u.next=5,t.getMaterial();case 5:y=u.sent,g.set(d,y);case 7:if(!g){u.next=13;break}return u.next=10,g.get(d);case 10:u.t0=u.sent,u.next=16;break;case 13:return u.next=15,t.getMaterial();case 15:u.t0=u.sent;case 16:m=u.t0,t.video=m.map.image,_?t.createSprite(m):t.createMesh(new c[ie](1,1),m),f&&t.setScale(f),p&&t.object3d.position.copy(p);case 21:case"end":return u.stop()}},o)}))()},i.setScale=function(t){this.object3d.scale.set(this.video.videoWidth*t,this.video.videoHeight*t,1)},i.render=function(){var t=this.options.autoPlay;t&&this.video.play()},i.dispose=function(){this.video.pause(),this.video.src="",this.video.load(),Ge(S(r.prototype),"dispose",this).call(this)},r}(v),ct=function(e){"use strict";O(r,e);var n=z(r);function r(a){j(this,r);var t;return t=n.call(this),t.options=(0,x.Z)({},a),t}var i=r.prototype;return i.create=function(){var t=this.options,o=t.position,s=t.children,f=t.onClick,p=t.zIndexFix,d=document.createElement("div");this.element=d,d.appendChild(s),this.createCSS2DObject(d),o&&this.object3d.position.copy(o),f&&this.clickTarge.forEach(function(g){g.addEventListener("click",f)}),p&&(this.object3d.userData.zIndexFix=p)},i.getMaterial=function(t){return(0,w.Z)(U().mark(function o(){var s,f,p,d;return U().wrap(function(_){for(;;)switch(_.prev=_.next){case 0:return s=document.createElement("canvas"),s.width=256,s.height=256,f=s.getContext("2d"),f.fillStyle="#ff0000",f.fillRect(0,0,256,256),p=new c.CanvasTexture(s),d=new c.SpriteMaterial({map:p,opacity:t?1:0,transparent:!0,alphaTest:.1,sizeAttenuation:!1}),_.abrupt("return",d);case 9:case"end":return _.stop()}},o)}))()},i.createPickObject=function(t){var o=t.show,s=o===void 0?!1:o,f=t.scale,p=f===void 0?new c.Vector3(1,1,1):f,d=t.position,g=d===void 0?new c.Vector3(0,0,0):d,_=t.cache,y=this;return(0,w.Z)(U().mark(function m(){var b,u,M,A;return U().wrap(function(C){for(;;)switch(C.prev=C.next){case 0:if(b="node-create-pick-object",!(_&&!_.get(b))){C.next=7;break}return _.init(b),C.next=5,y.getMaterial(s);case 5:u=C.sent,_.set(b,u);case 7:if(!_){C.next=13;break}return C.next=10,_.get(b);case 10:C.t0=C.sent,C.next=16;break;case 13:return C.next=15,y.getMaterial(s);case 15:C.t0=C.sent;case 16:M=C.t0,A=new c.Sprite(M),A.scale.set(M.map.image.width*p.x,M.map.image.height*p.y,1),A.position.copy(g),y.add(A),y.pickObject=A;case 22:case"end":return C.stop()}},m)}))()},i.dispose=function(){var t=this.options.onClick;t&&this.clickTarge.forEach(function(o){o.removeEventListener("click",t)}),Ge(S(r.prototype),"dispose",this).call(this)},W(r,[{key:"clickTarge",get:function(){var t=this,o=this.options.clickTarge;if(o){var s=o.map(function(f){return X(t.element.querySelectorAll(f))}).flat();return s}return[this.element]}}]),r}(v),lt=ct,ft=`
1
+ import*as it from"idb-keyval";import*as It from"three";import*as Zt from"three/examples/jsm/renderers/CSS2DRenderer";import*as at from"three/examples/jsm/renderers/CSS3DRenderer";import*as ot from"popmotion";import*as Ft from"three/examples/jsm//utils/BufferGeometryUtils";import*as Fe from"d3-array";import*as Kt from"earcut";import*as Xt from"@turf/boolean-clockwise";import*as Ht from"delaunator";import*as $t from"@turf/boolean-point-in-polygon";import*as De from"d3-geo";import*as Yt from"d3-geo-voronoi";import*as Jt from"d3-scale";var Qt={666:function(k){var R=function(A){"use strict";var O=Object.prototype,M=O.hasOwnProperty,T,L=typeof Symbol=="function"?Symbol:{},z=L.iterator||"@@iterator",Z=L.asyncIterator||"@@asyncIterator",S=L.toStringTag||"@@toStringTag";function B(h,l,v){return Object.defineProperty(h,l,{value:v,enumerable:!0,configurable:!0,writable:!0}),h[l]}try{B({},"")}catch(h){B=function(l,v,C){return l[v]=C}}function K(h,l,v,C){var w=l&&l.prototype instanceof Q?l:Q,J=Object.create(w.prototype),V=new ce(C||[]);return J._invoke=ye(h,v,V),J}A.wrap=K;function X(h,l,v){try{return{type:"normal",arg:h.call(l,v)}}catch(C){return{type:"throw",arg:C}}}var D="suspendedStart",c="suspendedYield",he="executing",re="completed",W={};function Q(){}function j(){}function G(){}var q={};B(q,z,function(){return this});var ne=Object.getPrototypeOf,ee=ne&&ne(ne(Ce([])));ee&&ee!==O&&M.call(ee,z)&&(q=ee);var F=G.prototype=Q.prototype=Object.create(q);j.prototype=G,B(F,"constructor",G),B(G,"constructor",j),j.displayName=B(G,S,"GeneratorFunction");function I(h){["next","throw","return"].forEach(function(l){B(h,l,function(v){return this._invoke(l,v)})})}A.isGeneratorFunction=function(h){var l=typeof h=="function"&&h.constructor;return l?l===j||(l.displayName||l.name)==="GeneratorFunction":!1},A.mark=function(h){return Object.setPrototypeOf?Object.setPrototypeOf(h,G):(h.__proto__=G,B(h,S,"GeneratorFunction")),h.prototype=Object.create(F),h},A.awrap=function(h){return{__await:h}};function te(h,l){function v(J,V,ae,pe){var oe=X(h[J],h,V);if(oe.type==="throw")pe(oe.arg);else{var ke=oe.arg,Ee=ke.value;return Ee&&typeof Ee=="object"&&M.call(Ee,"__await")?l.resolve(Ee.__await).then(function(be){v("next",be,ae,pe)},function(be){v("throw",be,ae,pe)}):l.resolve(Ee).then(function(be){ke.value=be,ae(ke)},function(be){return v("throw",be,ae,pe)})}}var C;function w(J,V){function ae(){return new l(function(pe,oe){v(J,V,pe,oe)})}return C=C?C.then(ae,ae):ae()}this._invoke=w}I(te.prototype),B(te.prototype,Z,function(){return this}),A.AsyncIterator=te,A.async=function(h,l,v,C,w){w===void 0&&(w=Promise);var J=new te(K(h,l,v,C),w);return A.isGeneratorFunction(l)?J:J.next().then(function(V){return V.done?V.value:J.next()})};function ye(h,l,v){var C=D;return function(J,V){if(C===he)throw new Error("Generator is already running");if(C===re){if(J==="throw")throw V;return je()}for(v.method=J,v.arg=V;;){var ae=v.delegate;if(ae){var pe=xe(ae,v);if(pe){if(pe===W)continue;return pe}}if(v.method==="next")v.sent=v._sent=v.arg;else if(v.method==="throw"){if(C===D)throw C=re,v.arg;v.dispatchException(v.arg)}else v.method==="return"&&v.abrupt("return",v.arg);C=he;var oe=X(h,l,v);if(oe.type==="normal"){if(C=v.done?re:c,oe.arg===W)continue;return{value:oe.arg,done:v.done}}else oe.type==="throw"&&(C=re,v.method="throw",v.arg=oe.arg)}}}function xe(h,l){var v=h.iterator[l.method];if(v===T){if(l.delegate=null,l.method==="throw"){if(h.iterator.return&&(l.method="return",l.arg=T,xe(h,l),l.method==="throw"))return W;l.method="throw",l.arg=new TypeError("The iterator does not provide a 'throw' method")}return W}var C=X(v,h.iterator,l.arg);if(C.type==="throw")return l.method="throw",l.arg=C.arg,l.delegate=null,W;var w=C.arg;if(!w)return l.method="throw",l.arg=new TypeError("iterator result is not an object"),l.delegate=null,W;if(w.done)l[h.resultName]=w.value,l.next=h.nextLoc,l.method!=="return"&&(l.method="next",l.arg=T);else return w;return l.delegate=null,W}I(F),B(F,S,"Generator"),B(F,z,function(){return this}),B(F,"toString",function(){return"[object Generator]"});function Y(h){var l={tryLoc:h[0]};1 in h&&(l.catchLoc=h[1]),2 in h&&(l.finallyLoc=h[2],l.afterLoc=h[3]),this.tryEntries.push(l)}function $(h){var l=h.completion||{};l.type="normal",delete l.arg,h.completion=l}function ce(h){this.tryEntries=[{tryLoc:"root"}],h.forEach(Y,this),this.reset(!0)}A.keys=function(h){var l=[];for(var v in h)l.push(v);return l.reverse(),function C(){for(;l.length;){var w=l.pop();if(w in h)return C.value=w,C.done=!1,C}return C.done=!0,C}};function Ce(h){if(h){var l=h[z];if(l)return l.call(h);if(typeof h.next=="function")return h;if(!isNaN(h.length)){var v=-1,C=function w(){for(;++v<h.length;)if(M.call(h,v))return w.value=h[v],w.done=!1,w;return w.value=T,w.done=!0,w};return C.next=C}}return{next:je}}A.values=Ce;function je(){return{value:T,done:!0}}return ce.prototype={constructor:ce,reset:function(h){if(this.prev=0,this.next=0,this.sent=this._sent=T,this.done=!1,this.delegate=null,this.method="next",this.arg=T,this.tryEntries.forEach($),!h)for(var l in this)l.charAt(0)==="t"&&M.call(this,l)&&!isNaN(+l.slice(1))&&(this[l]=T)},stop:function(){this.done=!0;var h=this.tryEntries[0],l=h.completion;if(l.type==="throw")throw l.arg;return this.rval},dispatchException:function(h){if(this.done)throw h;var l=this;function v(pe,oe){return J.type="throw",J.arg=h,l.next=pe,oe&&(l.method="next",l.arg=T),!!oe}for(var C=this.tryEntries.length-1;C>=0;--C){var w=this.tryEntries[C],J=w.completion;if(w.tryLoc==="root")return v("end");if(w.tryLoc<=this.prev){var V=M.call(w,"catchLoc"),ae=M.call(w,"finallyLoc");if(V&&ae){if(this.prev<w.catchLoc)return v(w.catchLoc,!0);if(this.prev<w.finallyLoc)return v(w.finallyLoc)}else if(V){if(this.prev<w.catchLoc)return v(w.catchLoc,!0)}else if(ae){if(this.prev<w.finallyLoc)return v(w.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(h,l){for(var v=this.tryEntries.length-1;v>=0;--v){var C=this.tryEntries[v];if(C.tryLoc<=this.prev&&M.call(C,"finallyLoc")&&this.prev<C.finallyLoc){var w=C;break}}w&&(h==="break"||h==="continue")&&w.tryLoc<=l&&l<=w.finallyLoc&&(w=null);var J=w?w.completion:{};return J.type=h,J.arg=l,w?(this.method="next",this.next=w.finallyLoc,W):this.complete(J)},complete:function(h,l){if(h.type==="throw")throw h.arg;return h.type==="break"||h.type==="continue"?this.next=h.arg:h.type==="return"?(this.rval=this.arg=h.arg,this.method="return",this.next="end"):h.type==="normal"&&l&&(this.next=l),W},finish:function(h){for(var l=this.tryEntries.length-1;l>=0;--l){var v=this.tryEntries[l];if(v.finallyLoc===h)return this.complete(v.completion,v.afterLoc),$(v),W}},catch:function(h){for(var l=this.tryEntries.length-1;l>=0;--l){var v=this.tryEntries[l];if(v.tryLoc===h){var C=v.completion;if(C.type==="throw"){var w=C.arg;$(v)}return w}}throw new Error("illegal catch attempt")},delegateYield:function(h,l,v){return this.delegate={iterator:Ce(h),resultName:l,nextLoc:v},this.method==="next"&&(this.arg=T),W}},A}(k.exports);try{regeneratorRuntime=R}catch(A){typeof globalThis=="object"?globalThis.regeneratorRuntime=R:Function("r","regeneratorRuntime = r")(R)}},695:function(k,R,A){A.d(R,{Z:function(){return O}});function O(M){if(M.geometry&&M.geometry.dispose(),M.material){var T=Array.isArray(M.material)?M.material:[M.material];T.forEach(function(L){var z,Z,S,B,K,X,D,c,he,re,W,Q,j;(z=L.map)===null||z===void 0||z.dispose(),(Z=L.lightMap)===null||Z===void 0||Z.dispose(),(S=L.bumpMap)===null||S===void 0||S.dispose(),(B=L.normalMap)===null||B===void 0||B.dispose(),(K=L.specularMap)===null||K===void 0||K.dispose(),(X=L.envMap)===null||X===void 0||X.dispose(),(D=L.alphaMap)===null||D===void 0||D.dispose(),(c=L.aoMap)===null||c===void 0||c.dispose(),(he=L.displacementMap)===null||he===void 0||he.dispose(),(re=L.emissiveMap)===null||re===void 0||re.dispose(),(W=L.gradientMap)===null||W===void 0||W.dispose(),(Q=L.metalnessMap)===null||Q===void 0||Q.dispose(),(j=L.roughnessMap)===null||j===void 0||j.dispose(),L.dispose()})}}},584:function(k,R,A){A.d(R,{wf:function(){return L.Z}});var O=A(666),M=A.n(O),T=null,L=A(695),z=A(949);function Z(W){if(W.material){var Q=Array.isArray(W.material)?W.material:[W.material];Q.forEach(function(j){var G,q;(G=j.color)===null||G===void 0||G.convertSRGBToLinear(),(q=j.emissive)===null||q===void 0||q.convertSRGBToLinear(),j.map&&(j.map.encoding=THREE.sRGBEncoding),j.emissiveMap&&(j.emissiveMap.encoding=THREE.sRGBEncoding)})}}var S=A(568),B=A(924),K=A(77),X=A(484),D=null,c=null,he=function(){var W=(0,S.Z)(M().mark(function Q(j,G){var q,ne,ee,F,I,te,ye,xe,Y;return M().wrap(function(ce){for(;;)switch(ce.prev=ce.next){case 0:return q=G.type,ne=q===void 0?"blob":q,ee=G.version,F=ee===void 0?"1":ee,ce.next=4,(0,K.get)(j);case 4:if(te=ce.sent,!(te&&te[F])){ce.next=9;break}I=te[F],ce.next=15;break;case 9:return ce.next=11,(0,X.Z)(fetch(j).then(function(Ce){if(Ce.ok)return Ce[ne]();throw new Error}));case 11:ye=ce.sent,xe=ye.res,Y=ye.err,Y||(I=xe,(0,K.set)(j,(0,B.Z)({},F,xe)));case 15:return ce.abrupt("return",I?{url:ne==="json"?j:URL.createObjectURL(I),store:I}:{url:j});case 16:case"end":return ce.stop()}},Q)}));return function(j,G){return W.apply(this,arguments)}}(),re=A(705)},484:function(k,R,A){A.d(R,{Z:function(){return M}});var O=A(42);function M(T){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return T.then(function(z){return(0,O.Z)({err:null,res:z},L)}).catch(function(z){return(0,O.Z)({err:z,res:void 0},L)})}},705:function(k,R,A){A.d(R,{C:function(){return L},y:function(){return T}});var O=A(949),M=new Map,T=function(){var z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{generateTopUV:function(Z,S,B,K,X){var D=S[B*3],c=S[B*3+1],he=S[K*3],re=S[K*3+1],W=S[X*3],Q=S[X*3+1],j;if(M.has(Z))j=M.get(Z);else{var G=z.box3||new O.Box3;if(!z.box3){var q=Z.parameters.shapes.getPoints();G.setFromArray(q.map(function(te){return[te.x,te.y,0]}).flat())}var ne=G.getSize(new O.Vector3);z.split&&(ne.y/=z.split),j={box:G,size:ne},M.set(Z,j)}var ee=j.box,F=j.size,I=z.split?1-z.split:0;return[new O.Vector2((D-ee.min.x)/F.x,(c-ee.min.y)/F.y+I),new O.Vector2((he-ee.min.x)/F.x,(re-ee.min.y)/F.y+I),new O.Vector2((W-ee.min.x)/F.x,(Q-ee.min.y)/F.y+I)]},generateSideWallUV:function(Z,S,B,K,X,D){var c=S[B*3],he=S[B*3+1],re=S[B*3+2],W=S[K*3],Q=S[K*3+1],j=S[K*3+2],G=S[X*3],q=S[X*3+1],ne=S[X*3+2],ee=S[D*3],F=S[D*3+1],I=S[D*3+2],te;if(M.has(S))te=M.get(S);else{var ye=new O.Box3;ye.setFromArray(S);var xe=ye.getSize(new O.Vector3);z.split&&(xe.z/=1-z.split),te={box:ye,size:xe},M.set(S,te)}var Y=te.box,$=te.size;return Math.abs(he-Q)<Math.abs(c-W)?[new O.Vector2((c-Y.min.x)/$.x,(re-Y.min.z)/$.z),new O.Vector2((W-Y.min.x)/$.x,(j-Y.min.z)/$.z),new O.Vector2((G-Y.min.x)/$.x,(ne-Y.min.z)/$.z),new O.Vector2((ee-Y.min.x)/$.x,(I-Y.min.z)/$.z)]:[new O.Vector2((he-Y.min.y)/$.y,(re-Y.min.z)/$.z),new O.Vector2((Q-Y.min.y)/$.y,(j-Y.min.z)/$.z),new O.Vector2((q-Y.min.y)/$.y,(ne-Y.min.z)/$.z),new O.Vector2((F-Y.min.y)/$.y,(I-Y.min.z)/$.z)]}}},L=function(){M.clear()}},77:function(k,R,A){var O=T=>{var L={};return A.d(L,T),L},M=T=>()=>T;k.exports=O({get:()=>it.get,set:()=>it.set})},949:function(k){var R=O=>{var M={};return N.d(M,O),M},A=O=>()=>O;k.exports=It},568:function(k,R,A){A.d(R,{Z:function(){return M}});function O(T,L,z,Z,S,B,K){try{var X=T[B](K),D=X.value}catch(c){z(c);return}X.done?L(D):Promise.resolve(D).then(Z,S)}function M(T){return function(){var L=this,z=arguments;return new Promise(function(Z,S){var B=T.apply(L,z);function K(D){O(B,Z,S,K,X,"next",D)}function X(D){O(B,Z,S,K,X,"throw",D)}K(void 0)})}}},924:function(k,R,A){A.d(R,{Z:function(){return O}});function O(M,T,L){return T in M?Object.defineProperty(M,T,{value:L,enumerable:!0,configurable:!0,writable:!0}):M[T]=L,M}},42:function(k,R,A){A.d(R,{Z:function(){return M}});var O=A(924);function M(T){for(var L=1;L<arguments.length;L++){var z=arguments[L]!=null?arguments[L]:{},Z=Object.keys(z);typeof Object.getOwnPropertySymbols=="function"&&(Z=Z.concat(Object.getOwnPropertySymbols(z).filter(function(S){return Object.getOwnPropertyDescriptor(z,S).enumerable}))),Z.forEach(function(S){(0,O.Z)(T,S,z[S])})}return T}}},st={};function N(k){var R=st[k];if(R!==void 0)return R.exports;var A=st[k]={exports:{}};return Qt[k](A,A.exports,N),A.exports}(function(){N.n=function(k){var R=k&&k.__esModule?function(){return k.default}:function(){return k};return N.d(R,{a:R}),R}})(),function(){N.d=function(k,R){for(var A in R)N.o(R,A)&&!N.o(k,A)&&Object.defineProperty(k,A,{enumerable:!0,get:R[A]})}}(),function(){N.o=function(k,R){return Object.prototype.hasOwnProperty.call(k,R)}}();var Ae={};(function(){N.d(Ae,{Ei:function(){return Vt},Yo:function(){return Ut},Ee:function(){return ke},x1:function(){return _t},VJ:function(){return Pe},r7:function(){return Ve},XA:function(){return Ke},NB:function(){return lt},xv:function(){return C},nk:function(){return ut}});function k(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function R(e,n){return R=Object.setPrototypeOf||function(i,a){return i.__proto__=a,i},R(e,n)}function A(e,n){return R(e,n)}function O(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),n&&A(e,n)}var M=N(42);function T(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,i)}return r}function L(e,n){return n=n!=null?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):T(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}),e}function z(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function Z(e){return Z=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Z(e)}function S(e){return Z(e)}function B(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function K(e){return e&&e.constructor===Symbol?"symbol":typeof e}function X(e,n){return n&&(K(n)==="object"||typeof n=="function")?n:B(e)}function D(e){var n=z();return function(){var i=S(e),a;if(n){var t=S(this).constructor;a=Reflect.construct(i,arguments,t)}else a=i.apply(this,arguments);return X(this,a)}}var c=N(949);function he(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function re(e,n,r){return he()?re=Reflect.construct:re=function(a,t,o){var s=[null];s.push.apply(s,t);var f=Function.bind.apply(a,s),p=new f;return o&&A(p,o.prototype),p},re.apply(null,arguments)}function W(e,n,r){return re.apply(null,arguments)}function Q(e,n){for(var r=0;r<n.length;r++){var i=n[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function j(e,n,r){return n&&Q(e.prototype,n),r&&Q(e,r),e}function G(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=new Array(n);r<n;r++)i[r]=e[r];return i}function q(e){if(Array.isArray(e))return G(e)}function ne(e){if(typeof Symbol!="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function ee(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function F(e,n){if(!!e){if(typeof e=="string")return G(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return G(e,n)}}function I(e){return q(e)||ne(e)||F(e)||ee()}var te=N(484);function ye(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r={};return r.promise=new Promise(function(i,a){r.resolve=i,r.reject=a}),e&&(r.promise=(0,te.Z)(r.promise,n)),r}var xe=e=>{var n={};return N.d(n,e),n},Y=e=>()=>e,$=xe({CSS2DObject:()=>Zt.CSS2DObject}),ce=e=>{var n={};return N.d(n,e),n},Ce=e=>()=>e,je=ce({CSS3DObject:()=>at.CSS3DObject,CSS3DSprite:()=>at.CSS3DSprite}),h=N(584),l=function(e){e&&((0,h.wf)(e),e.children.forEach(function(n){n.userData.BaseObject_||l(n)}))},v=function(){"use strict";function e(){k(this,e),this.objecttype__="BaseObject",this.userData={},this.pm=ye(),this.visible=!1}var n=e.prototype;return n.init=function(){},n.create=function(){},n.render=function(){},n.update=function(i,a){},n.resize=function(i,a){},n.show=function(){return this.object3d&&(this.object3d.visible=!0),this.visible=!0,this},n.hide=function(){return this.object3d&&(this.object3d.visible=!1),this.visible=!1,this},n.isVisible=function(){return this.visible},n.createMesh=function(){for(var i=arguments.length,a=new Array(i),t=0;t<i;t++)a[t]=arguments[t];return this.object3d=W(c.Mesh,I(a)),this},n.createGroup=function(){return this.object3d=new c.Group,this},n.createPoints=function(){for(var i=arguments.length,a=new Array(i),t=0;t<i;t++)a[t]=arguments[t];return this.object3d=W(c.Points,I(a)),this},n.createCSS2DObject=function(i){return this.object3d=new $.CSS2DObject(i),this},n.createCSS3DObject=function(i){return this.object3d=new je.CSS3DObject(i),this},n.createCSS3DSprite=function(i){return this.object3d=new je.CSS3DSprite(i),this},n.createSprite=function(i){return this.object3d=new c.Sprite(i),this},n.add=function(){for(var i=arguments.length,a=new Array(i),t=0;t<i;t++)a[t]=arguments[t];var o;return(o=this.object3d).add.apply(o,I(a)),this},n.remove=function(){for(var i=arguments.length,a=new Array(i),t=0;t<i;t++)a[t]=arguments[t];var o;return(o=this.object3d).remove.apply(o,I(a)),this},n.getSize=function(){var i=new c.Box3().setFromObject(this.object3d);return{min:i.min,max:i.max,size:i.getSize(new c.Vector3)}},n.traverse=function(i){i(this),this.children.forEach(function(a){a.traverse(i)})},n.dispose=function(){l(this.object3d)},j(e,[{key:"parent",get:function(){var i=this.object3d.parent;return(i==null?void 0:i.userData.BaseObject_)||this.pencil.scene}},{key:"children",get:function(){return this.object3d.children.map(function(i){return i.userData.BaseObject_}).filter(function(i){return!!i})}}]),e}(),C=function(e){"use strict";O(r,e);var n=D(r);function r(a){k(this,r);var t;return t=n.call(this),t.width=0,t.canvas=document.createElement("canvas"),t.options=(0,M.Z)({},{scale:.5,fontSize:28,fontFamily:"system-ui,-apple-system,BlinkMacSystemFont,sans-serif",fontWeight:"normal",flipX:!1,sprite:!1,sizeAttenuation:!0},a),t}var i=r.prototype;return i.create=function(){var t=this.options,o=t.position,s=t.lookAt,f=t.sprite,p=t.text,d=t.sizeAttenuation;if(f){var m=new c.Sprite(new c.SpriteMaterial({transparent:!0,sizeAttenuation:d}));this.object3d=m}else{var _=new c.MeshBasicMaterial({side:c.DoubleSide,transparent:!0}),y=new c.PlaneGeometry(1,1,1,1);this.createMesh(y,_)}this.object3d.position.copy(o),s&&this.object3d.lookAt(s),this.setText(p)},i.setText=function(t,o){var s=(0,M.Z)(L((0,M.Z)({},this.options),{text:t}),o||{}),f=s.text,p=s.fontSize,d=s.fontFamily,m=s.fontWeight,_=s.flipX,y=s.scale,g=this.canvas;g.width=p*f.length*2,g.height=p;var b=g.getContext("2d");b.font="".concat(m," ").concat(p,"px/1 ").concat(d);var u=b.measureText(f).width;g.width=u,this.width=u,b=g.getContext("2d"),b.clearRect(0,0,g.width,g.height),_&&b.scale(-1,1),b.font="".concat(m," ").concat(p,"px/1 ").concat(d),b.textBaseline="middle",b.fillStyle="#ffffff",b.fillText(f,_?u*-1:0,g.height/2),b.restore();var E=new c.Texture(g);E.anisotropy=16,E.needsUpdate=!0;var x=this.object3d;x.material.map&&x.material.map.dispose(),x.material.map=E,x.material.needsUpdate=!0,x.scale.set(E.image.width*y,E.image.height*y,1)},r}(v),w=N(568),J=N(666),V=N.n(J),ae=+c.REVISION<144,pe=ae?"ExtrudeBufferGeometry":"ExtrudeGeometry",oe=ae?"PlaneBufferGeometry":"PlaneGeometry",ke=function(e){"use strict";O(r,e);var n=D(r);function r(a){k(this,r);var t;return t=n.call(this),t.options=a,t}var i=r.prototype;return i.getMaterial=function(){var t=this;return(0,w.Z)(V().mark(function o(){var s,f,p,d,m,_,y,g,b,u;return V().wrap(function(x){for(;;)switch(x.prev=x.next){case 0:return s=t.options,f=s.transparent,p=s.blending,d=s.src,m=s.depthWrite,_=s.alphaTest,y=s.sprite,g=s.sizeAttenuation,x.next=3,new c.TextureLoader().loadAsync(d);case 3:return b=x.sent,u=y?new c.SpriteMaterial({map:b,transparent:f!=null?f:!1,blending:p!=null?p:c.NormalBlending,depthWrite:m!=null?m:!0,alphaTest:_!=null?_:0,sizeAttenuation:g!=null?g:!0}):new c.MeshBasicMaterial({map:b,transparent:f!=null?f:!1,blending:p!=null?p:c.NormalBlending,depthWrite:m!=null?m:!0,alphaTest:_!=null?_:0}),x.abrupt("return",u);case 6:case"end":return x.stop()}},o)}))()},i.create=function(){var t=this;return(0,w.Z)(V().mark(function o(){var s,f,p,d,m,_,y,g;return V().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(s=t.options,f=s.scale,p=s.position,d=s.src,m=s.cache,_=s.sprite,!(m&&!m.get(d))){u.next=7;break}return m.init(d),u.next=5,t.getMaterial();case 5:y=u.sent,m.set(d,y);case 7:if(!m){u.next=13;break}return u.next=10,m.get(d);case 10:u.t0=u.sent,u.next=16;break;case 13:return u.next=15,t.getMaterial();case 15:u.t0=u.sent;case 16:g=u.t0,t.texture=g.map,_?t.createSprite(g):t.createMesh(new c[oe](1,1),g),f&&t.setScale(f),p&&t.object3d.position.copy(p);case 21:case"end":return u.stop()}},o)}))()},i.setScale=function(t){this.object3d.scale.set(this.texture.image.width*t,this.texture.image.height*t,1)},r}(v);function Ee(e,n){for(;!Object.prototype.hasOwnProperty.call(e,n)&&(e=S(e),e!==null););return e}function be(e,n,r){return typeof Reflect!="undefined"&&Reflect.get?be=Reflect.get:be=function(a,t,o){var s=Ee(a,t);if(!!s){var f=Object.getOwnPropertyDescriptor(s,t);return f.get?f.get.call(o||a):f.value}},be(e,n,r)}function We(e,n,r){return be(e,n,r)}var ut=function(e){"use strict";O(r,e);var n=D(r);function r(a){k(this,r);var t;return t=n.call(this),t.options=(0,M.Z)({},{autoPlay:!0,loop:!0},a),t}var i=r.prototype;return i.getMaterial=function(){var t=this.options,o=t.src,s=t.transparent,f=t.blending,p=t.depthWrite,d=t.format,m=t.autoPlay,_=t.loop,y=t.alphaTest,g=t.sprite,b=ye(),u=document.createElement("video");return u.addEventListener("loadedmetadata",function(){var E=new c.VideoTexture(u);E.format=d!=null?d:c.RGBAFormat,E.needsUpdate=!0;var x=g?new c.SpriteMaterial({map:E,transparent:s!=null?s:!1,blending:f!=null?f:c.NormalBlending,depthWrite:p!=null?p:!0,alphaTest:y!=null?y:0}):new c.MeshBasicMaterial({map:E,transparent:s!=null?s:!1,blending:f!=null?f:c.NormalBlending,depthWrite:p!=null?p:!0,alphaTest:y!=null?y:0});b.resolve(x)},!1),u.src=o,u.muted=!0,u.autoplay=m,u.loop=_,u.preload="auto",b.promise},i.create=function(){var t=this;return(0,w.Z)(V().mark(function o(){var s,f,p,d,m,_,y,g;return V().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(s=t.options,f=s.scale,p=s.position,d=s.src,m=s.cache,_=s.sprite,!(m&&!m.get(d))){u.next=7;break}return m.init(d),u.next=5,t.getMaterial();case 5:y=u.sent,m.set(d,y);case 7:if(!m){u.next=13;break}return u.next=10,m.get(d);case 10:u.t0=u.sent,u.next=16;break;case 13:return u.next=15,t.getMaterial();case 15:u.t0=u.sent;case 16:g=u.t0,t.video=g.map.image,_?t.createSprite(g):t.createMesh(new c[oe](1,1),g),f&&t.setScale(f),p&&t.object3d.position.copy(p);case 21:case"end":return u.stop()}},o)}))()},i.setScale=function(t){this.object3d.scale.set(this.video.videoWidth*t,this.video.videoHeight*t,1)},i.render=function(){var t=this.options.autoPlay;t&&this.video.play()},i.dispose=function(){this.video.pause(),this.video.src="",this.video.load(),We(S(r.prototype),"dispose",this).call(this)},r}(v),ct=function(e){"use strict";O(r,e);var n=D(r);function r(a){k(this,r);var t;return t=n.call(this),t.options=(0,M.Z)({},{event:"click"},a),t}var i=r.prototype;return i.create=function(){var t=this.options,o=t.position,s=t.children,f=t.handler,p=t.event,d=t.zIndexFix,m=document.createElement("div");this.element=m,m.appendChild(s),this.createCSS2DObject(m),o&&this.object3d.position.copy(o),f&&p&&this.clickTarge.forEach(function(_){_.addEventListener(p,f)}),d&&(this.object3d.userData.zIndexFix=d)},i.getMaterial=function(t){return(0,w.Z)(V().mark(function o(){var s,f,p,d;return V().wrap(function(_){for(;;)switch(_.prev=_.next){case 0:return s=document.createElement("canvas"),s.width=256,s.height=256,f=s.getContext("2d"),f.fillStyle="#ff0000",f.fillRect(0,0,256,256),p=new c.CanvasTexture(s),d=new c.SpriteMaterial({map:p,opacity:t?1:0,transparent:!0,alphaTest:.1,sizeAttenuation:!1}),_.abrupt("return",d);case 9:case"end":return _.stop()}},o)}))()},i.createPickObject=function(t){var o=t.show,s=o===void 0?!1:o,f=t.scale,p=f===void 0?new c.Vector3(1,1,1):f,d=t.position,m=d===void 0?new c.Vector3(0,0,0):d,_=t.cache,y=this;return(0,w.Z)(V().mark(function g(){var b,u,E,x;return V().wrap(function(P){for(;;)switch(P.prev=P.next){case 0:if(b="node-create-pick-object",!(_&&!_.get(b))){P.next=7;break}return _.init(b),P.next=5,y.getMaterial(s);case 5:u=P.sent,_.set(b,u);case 7:if(!_){P.next=13;break}return P.next=10,_.get(b);case 10:P.t0=P.sent,P.next=16;break;case 13:return P.next=15,y.getMaterial(s);case 15:P.t0=P.sent;case 16:E=P.t0,x=new c.Sprite(E),x.scale.set(E.map.image.width*p.x,E.map.image.height*p.y,1),x.position.copy(m),y.add(x),y.pickObject=x;case 22:case"end":return P.stop()}},g)}))()},i.dispose=function(){var t=this.options,o=t.handler,s=t.event;o&&s&&this.clickTarge.forEach(function(f){f.removeEventListener(s,o)}),We(S(r.prototype),"dispose",this).call(this)},j(r,[{key:"clickTarge",get:function(){var t=this,o=this.options.eventTarge;if(o){var s=o.map(function(f){return I(t.element.querySelectorAll(f))}).flat();return s}return[this.element]}}]),r}(v),lt=ct,ft=`
2
2
  `.concat(c.ShaderChunk.logdepthbuf_pars_vertex,`
3
3
  `).concat(c.ShaderChunk.fog_pars_vertex,`
4
4
  attribute vec3 previous;
@@ -129,4 +129,4 @@ void main() {
129
129
  gl_FragColor.a *= step(vCounters, visibility);
130
130
  `).concat(c.ShaderChunk.fog_fragment,`
131
131
  }
132
- `),be=function(e){"use strict";O(r,e);var n=z(r);function r(){j(this,r);var i;return i=n.call(this),i.isMeshLine=!0,i.type="MeshLine",i.positions=[],i.previous=[],i.next=[],i.side=[],i.width=[],i.indices_array=[],i.uvs=[],i.counters=[],i._points=[],i._geom=null,i.widthCallback=null,i.matrixWorld=new c.Matrix4,Object.defineProperties(T(i),{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(t){this.setGeometry(t,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(t){this.setPoints(t,this.widthCallback)}}}),i}return r}(c.BufferGeometry);be.prototype.setMatrixWorld=function(e){this.matrixWorld=e},be.prototype.setGeometry=function(e,n){this._geometry=e,this.setPoints(e.getAttribute("position").array,n)},be.prototype.setPoints=function(e,n){if(!(e instanceof Float32Array)&&!(e instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=e,this.widthCallback=n,this.positions=[],this.counters=[],e.length&&e[0]instanceof c.Vector3)for(var r=0;r<e.length;r++){var i=e[r],a=r/e.length;this.positions.push(i.x,i.y,i.z),this.positions.push(i.x,i.y,i.z),this.counters.push(a),this.counters.push(a)}else for(var r=0;r<e.length;r+=3){var a=r/e.length;this.positions.push(e[r],e[r+1],e[r+2]),this.positions.push(e[r],e[r+1],e[r+2]),this.counters.push(a),this.counters.push(a)}this.process()};function He(e,n){var r=new c.Matrix4,i=new c.Ray,a=new c.Sphere,t=new c.Vector3,o=this.geometry;if(o.boundingSphere||o.computeBoundingSphere(),a.copy(o.boundingSphere),a.applyMatrix4(this.matrixWorld),e.ray.intersectSphere(a,t)!==!1){r.copy(this.matrixWorld).invert(),i.copy(e.ray).applyMatrix4(r);var s=new c.Vector3,f=new c.Vector3,p=new c.Vector3,d=this instanceof c.LineSegments?2:1,g=o.index,_=o.attributes;if(g!==null)for(var y=g.array,m=_.position.array,b=_.width.array,u=0,M=y.length-1;u<M;u+=d){var A=y[u],Z=y[u+1];s.fromArray(m,A*3),f.fromArray(m,Z*3);var C=b[Math.floor(u/3)]!==void 0?b[Math.floor(u/3)]:1,ae=e.params.Line.threshold+this.material.lineWidth*C/2,se=ae*ae,ce=i.distanceSqToSegment(s,f,t,p);if(!(ce>se)){t.applyMatrix4(this.matrixWorld);var le=e.ray.origin.distanceTo(t);le<e.near||le>e.far||(n.push({distance:le,point:p.clone().applyMatrix4(this.matrixWorld),index:u,face:null,faceIndex:null,object:this}),u=M)}}}}be.prototype.raycast=He,be.prototype.compareV3=function(e,n){var r=e*6,i=n*6;return this.positions[r]===this.positions[i]&&this.positions[r+1]===this.positions[i+1]&&this.positions[r+2]===this.positions[i+2]},be.prototype.copyV3=function(e){var n=e*6;return[this.positions[n],this.positions[n+1],this.positions[n+2]]},be.prototype.process=function(){var e=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var n,r;this.compareV3(0,e-1)?r=this.copyV3(e-2):r=this.copyV3(0),this.previous.push(r[0],r[1],r[2]),this.previous.push(r[0],r[1],r[2]);for(var i=0;i<e;i++){if(this.side.push(1),this.side.push(-1),this.widthCallback?n=this.widthCallback(i/(e-1)):n=1,this.width.push(n),this.width.push(n),this.uvs.push(i/(e-1),0),this.uvs.push(i/(e-1),1),i<e-1){r=this.copyV3(i),this.previous.push(r[0],r[1],r[2]),this.previous.push(r[0],r[1],r[2]);var a=i*2;this.indices_array.push(a,a+1,a+2),this.indices_array.push(a+2,a+1,a+3)}i>0&&(r=this.copyV3(i),this.next.push(r[0],r[1],r[2]),this.next.push(r[0],r[1],r[2]))}this.compareV3(e-1,0)?r=this.copyV3(1):r=this.copyV3(e-1),this.next.push(r[0],r[1],r[2]),this.next.push(r[0],r[1],r[2]),!this._attributes||this._attributes.position.count!==this.positions.length?this._attributes={position:new c.BufferAttribute(new Float32Array(this.positions),3),previous:new c.BufferAttribute(new Float32Array(this.previous),3),next:new c.BufferAttribute(new Float32Array(this.next),3),side:new c.BufferAttribute(new Float32Array(this.side),1),width:new c.BufferAttribute(new Float32Array(this.width),1),uv:new c.BufferAttribute(new Float32Array(this.uvs),2),index:new c.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new c.BufferAttribute(new Float32Array(this.counters),1)}:(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()};function Ve(e,n,r,i,a){var t;if(e=e.subarray||e.slice?e:e.buffer,r=r.subarray||r.slice?r:r.buffer,e=n?e.subarray?e.subarray(n,a&&n+a):e.slice(n,a&&n+a):e,r.set)r.set(e,i);else for(t=0;t<e.length;t++)r[t+i]=e[t];return r}be.prototype.advance=function(e){var n=this._attributes.position.array,r=this._attributes.previous.array,i=this._attributes.next.array,a=n.length;Ve(n,0,r,0,a),Ve(n,6,n,0,a-6),n[a-6]=e.x,n[a-5]=e.y,n[a-4]=e.z,n[a-3]=e.x,n[a-2]=e.y,n[a-1]=e.z,Ve(n,6,i,0,a-6),i[a-6]=e.x,i[a-5]=e.y,i[a-4]=e.z,i[a-3]=e.x,i[a-2]=e.y,i[a-1]=e.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0},c.ShaderChunk.meshline_vert=ft,c.ShaderChunk.meshline_frag=ht;var Ue=function(e){"use strict";O(r,e);var n=z(r);function r(i){j(this,r);var a;return a=n.call(this,{uniforms:Object.assign({},c.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new c.Color(16777215)},opacity:{value:1},resolution:{value:new c.Vector2(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new c.Vector2(1,1)},offset:{value:new c.Vector2(1,1)},lineLightAnimation:{value:1},time:{value:0},size:{value:300},speed:{value:.3},lightWidth:{value:.1},uCenter:{value:new c.Vector2(0,0)},lightColor:{value:new c.Color(16777215)}}),vertexShader:c.ShaderChunk.meshline_vert,fragmentShader:c.ShaderChunk.meshline_frag}),a.isMeshLineMaterial=!0,a.type="MeshLineMaterial",Object.defineProperties(T(a),{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(o){this.uniforms.lineWidth.value=o}},lineLightAnimation:{enumerable:!0,get:function(){return this.uniforms.lineLightAnimation.value},set:function(o){this.uniforms.lineLightAnimation.value=o}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(o){this.uniforms.map.value=o}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(o){this.uniforms.useMap.value=o}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(o){this.uniforms.alphaMap.value=o}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(o){this.uniforms.useAlphaMap.value=o}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(o){this.uniforms.color.value=o}},lightColor:{enumerable:!0,get:function(){return this.uniforms.lightColor.value},set:function(o){this.uniforms.lightColor.value=o}},time:{enumerable:!0,get:function(){return this.uniforms.time.value},set:function(o){this.uniforms.time.value=o}},uCenter:{enumerable:!0,get:function(){return this.uniforms.uCenter.value},set:function(o){this.uniforms.uCenter.value=o}},size:{enumerable:!0,get:function(){return this.uniforms.size.value},set:function(o){this.uniforms.size.value=o}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(o){this.uniforms.opacity.value=o}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(o){this.uniforms.resolution.value.copy(o)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(o){this.uniforms.sizeAttenuation.value=o}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(o){this.uniforms.dashArray.value=o,this.useDash=o!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(o){this.uniforms.dashOffset.value=o}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(o){this.uniforms.dashRatio.value=o}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(o){this.uniforms.useDash.value=o}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(o){this.uniforms.visibility.value=o}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(o){this.uniforms.alphaTest.value=o}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(o){this.uniforms.repeat.value.copy(o)}}}),a.setValues(i),a}return r}(c.ShaderMaterial);Ue.prototype.copy=function(e){return c.ShaderMaterial.prototype.copy.call(this,e),this.lineWidth=e.lineWidth,this.map=e.map,this.useMap=e.useMap,this.alphaMap=e.alphaMap,this.useAlphaMap=e.useAlphaMap,this.color.copy(e.color),this.opacity=e.opacity,this.resolution.copy(e.resolution),this.sizeAttenuation=e.sizeAttenuation,this.dashArray.copy(e.dashArray),this.dashOffset.copy(e.dashOffset),this.dashRatio.copy(e.dashRatio),this.useDash=e.useDash,this.visibility=e.visibility,this.alphaTest=e.alphaTest,this.repeat.copy(e.repeat),this};function pt(e,n){if(e==null)return{};var r={},i=Object.keys(e),a,t;for(t=0;t<i.length;t++)a=i[t],!(n.indexOf(a)>=0)&&(r[a]=e[a]);return r}function vt(e,n){if(e==null)return{};var r=pt(e,n),i,a;if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);for(a=0;a<t.length;a++)i=t[a],!(n.indexOf(i)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,i)||(r[i]=e[i]))}return r}var dt=e=>{var n={};return N.d(n,e),n},cr=e=>()=>e,Ke=dt({animate:()=>ot.animate,linear:()=>ot.linear}),mt=e=>{var n={};return N.d(n,e),n},lr=e=>()=>e,$e=mt({mergeBufferGeometries:()=>Ft.mergeBufferGeometries});function Ye(e){var n=e.setPointWidth,r=e.nodes,i=new c.BufferGeometry,a=new be;return i.setFromPoints(r),a.setGeometry(i,n),a}var gt={color:new c.Color("#ffffff"),lineWidth:3,sizeAttenuation:0},_t=function(e){"use strict";O(r,e);var n=z(r);function r(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};j(this,r);var t;return t=n.call(this),t.options=(0,x.Z)({},gt,a),t}var i=r.prototype;return i.create=function(){var t=this,o=this.options,s=o.duration,f=o.delay,p=o.onComplete,d=o.setPointWidth,g=o.key,_=o.nodes,y=o.nodesArr,m=o.coordinatesArr,b=o.projection,u=o.workerController,M=o.useGroups,A=vt(o,["duration","delay","onComplete","setPointWidth","key","nodes","nodesArr","coordinatesArr","projection","workerController","useGroups"]),Z=this.pencil.getSize(),C=Z.width,ae=Z.height,se=new Ue(L((0,x.Z)({},A),{resolution:new c.Vector2(C,ae)}));if(this.material=se,_)this.createMesh(Ye({nodes:_,setPointWidth:d}),se);else if(y){var ce=$e.mergeBufferGeometries(y.map(function(le){return Ye({nodes:le,setPointWidth:d})}),M!=null?M:!1);this.createMesh(ce,se)}else if(m&&u)return new Promise(function(le){u.postMessage({coordinatesArr:m,projection:b,useGroups:M},function(ue){var ge=new c.BufferGeometry;Object.keys(ue).forEach(function(R){R==="index"?ge.setIndex(new c.BufferAttribute(ue[R].array,ue[R].itemSize)):ge.setAttribute(R,new c.BufferAttribute(ue[R].array,ue[R].itemSize))}),t.createMesh(ge,se),le("")})})},i.resize=function(t,o){this.material.uniforms.resolution.value.set(t,o)},i.animate=function(){var t=this.options,o=t.duration,s=t.delay,f=t.onComplete,p=this.material.uniforms.offset,d=s!=null?s:0,g=(0,Ke.animate)({from:p.value,to:{x:0},duration:o!=null?o:1e3,elapsed:-d,repeat:1/0,onComplete:f,ease:Ke.linear,onUpdate:function(_){p.value.x=_.x}});this.tween=g},i.dispose=function(){var t;Ge(S(r.prototype),"dispose",this).call(this),(t=this.tween)===null||t===void 0||t.stop()},r}(v);function yt(e){if(Array.isArray(e))return e}function bt(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function we(e,n){return yt(e)||K(e,n)||$(e,n)||bt()}var wt=e=>{var n={};return N.d(n,e),n},fr=e=>()=>e,Oe=wt({extent:()=>Xe.extent,mean:()=>Xe.mean,merge:()=>Xe.merge}),xt=e=>{var n={};return N.d(n,e),n},hr=e=>()=>e,Ne=xt({default:()=>Xt.default}),Mt=e=>{var n={};return N.d(n,e),n},pr=e=>()=>e,At=Mt({default:()=>Ht.default});function Pt(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=(90-n)*Math.PI/180,a=(90-e)*Math.PI/180;return[r*Math.sin(i)*Math.cos(a),r*Math.cos(i),r*Math.sin(i)*Math.sin(a)]}var St=e=>{var n={};return N.d(n,e),n},vr=e=>()=>e,Ct=St({default:()=>Kt.default}),Ot=e=>{var n={};return N.d(n,e),n},dr=e=>()=>e,Et=Ot({default:()=>$t.default}),Lt=e=>{var n={};return N.d(n,e),n},mr=e=>()=>e,je=Lt({geoBounds:()=>We.geoBounds,geoContains:()=>We.geoContains,geoDistance:()=>We.geoDistance,geoInterpolate:()=>We.geoInterpolate}),jt=e=>{var n={};return N.d(n,e),n},gr=e=>()=>e,kt=jt({geoVoronoi:()=>Yt.geoVoronoi}),Rt=e=>{var n={};return N.d(n,e),n},_r=e=>()=>e,Je=Rt({scaleLinear:()=>Jt.scaleLinear});function Tt(e,n){return e.map(function(r){var i=[],a;return r.forEach(function(t){if(a){var o=(0,je.geoDistance)(t,a)*180/Math.PI;if(o>n)for(var s=(0,je.geoInterpolate)(a,t),f=1/Math.ceil(o/n),p=f;p<1;)i.push(s(p)),p+=f}i.push(a=t)}),i})}function Bt(e){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.minLng,i=n.maxLng,a=n.minLat,t=n.maxLat,o=Math.round(Math.pow(360/e,2)/Math.PI),s=(1+Math.sqrt(5))/2,f=function(u){return u/s*360%360-180},p=function(u){return Math.acos(2*u/o-1)/Math.PI*180-90},d=function(u){return o*(Math.cos((u+90)*Math.PI/180)+1)/2},g=[t!==void 0?Math.ceil(d(t)):0,a!==void 0?Math.floor(d(a)):o-1],_=r===void 0&&i===void 0?function(){return!0}:r===void 0?function(u){return u<=i}:i===void 0?function(u){return u>=r}:i>=r?function(u){return u>=r&&u<=i}:function(u){return u>=r||u<=i},y=[],m=g[0];m<=g[1];m++){var b=f(m);_(b)&&y.push([b,p(m)])}return y}function Ie(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return r?(0,je.geoContains)(n,e):(0,Et.default)(e,n)}function zt(e,n){var r={type:"Polygon",coordinates:e},i=we((0,je.geoBounds)(r),2),a=we(i[0],2),t=a[0],o=a[1],s=we(i[1],2),f=s[0],p=s[1];if(Math.min(Math.abs(f-t),Math.abs(p-o))<n)return[];var d=t>f||p>=89||o<=-89;return Bt(n,{minLng:t,maxLng:f,minLat:o,maxLat:p}).filter(function(g){return Ie(g,r,d)})}function Dt(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.resolution,i=r===void 0?1/0:r,a=Tt(e,i),t=(0,Oe.merge)(a),o=zt(e,i),s=X(t).concat(X(o)),f={type:"Polygon",coordinates:e},p=we((0,je.geoBounds)(f),2),d=we(p[0],2),g=d[0],_=d[1],y=we(p[1],2),m=y[0],b=y[1],u=g>m||b>=89||_<=-89,M=[];if(u){var A=(0,kt.geoVoronoi)(s).triangles(),Z=new Map(s.map(function(de,Pe){var Me=we(de,2),me=Me[0],Te=Me[1];return["".concat(me,"-").concat(Te),Pe]}));A.features.forEach(function(de){var Pe,Me=de.geometry.coordinates[0].slice(0,3).reverse(),me=[];if(Me.forEach(function(Be){var xe=we(Be,2),Fe=xe[0],Nt=xe[1],nt="".concat(Fe,"-").concat(Nt);Z.has(nt)&&me.push(Z.get(nt))}),me.length===3){if(me.some(function(Be){return Be<t.length})){var Te=de.properties.circumcenter;if(!Ie(Te,f,u))return}(Pe=M).push.apply(Pe,X(me))}})}else if(o.length)for(var le=function(de,Pe){var Me,me=[2,1,0].map(function(xe){return ue.triangles[de+xe]}),Te=me.map(function(xe){return s[xe]});if(me.some(function(xe){return xe<t.length})){var Be=[0,1].map(function(xe){return(0,Oe.mean)(Te,function(Fe){return Fe[xe]})});if(!Ie(Be,f,u))return"continue"}(Me=M).push.apply(Me,X(me))},ue=Ct.default.from(s),ge=0,R=ue.triangles.length;ge<R;ge+=3)le(ge,R);else{var C=Ne.default.flatten(a),ae=C.vertices,se=C.holes,ce=se===void 0?[]:se;M=(0,Ne.default)(ae,ce,2)}var Ce=(0,Je.scaleLinear)((0,Oe.extent)(s,function(de){return de[0]}),[0,1]),ke=(0,Je.scaleLinear)((0,Oe.extent)(s,function(de){return de[1]}),[0,1]),De=s.map(function(de){var Pe=we(de,2),Me=Pe[0],me=Pe[1];return[Ce(Me),ke(me)]}),Re={points:s,indices:M,uvs:De};return{contour:a,triangles:Re}}var Wt=Dt,Qe=new c.BufferGeometry().setAttribute?"setAttribute":"addAttribute";function Ze(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=e.map(function(a){return a.map(function(t){var o=we(t,2),s=o[0],f=o[1];return r?Pt(s,f,n):[s,f,n]})});return Ne.default.flatten(i)}function qe(e,n,r){for(var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=Ze(e,n,i),t=a.vertices,o=a.holes,s=Ze(e,r,i),f=s.vertices,p=(0,Oe.merge)([f,t]),d=Math.round(f.length/3),g=new Set(o),_=0,y=[],m=0;m<d;m++){var b=m+1;if(b===d)b=_;else if(g.has(b)){var u=b;b=_,_=u}y.push(m,m+d,b+d),y.push(b+d,b,m)}for(var M=[],A=1;A>=0;A--)for(var Z=0;Z<d;Z+=1)M.push(Z/(d-1),A);return{indices:y,vertices:p,uvs:M,topVerts:f}}function et(e,n,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return{indices:i?e.indices:e.indices.slice().reverse(),vertices:Ze([e.points],n,a).vertices,uvs:r}}var Gt=function(e){"use strict";O(r,e);var n=z(r);function r(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};j(this,r);var t;t=n.call(this),t.type="PolygonBufferGeometry",t.parameters=(0,x.Z)({},{polygonGeoJson:i,startHeight:0,endHeight:1,closedBottom:!0,closedTop:!0,includeSides:!0,curvatureResolution:5,cartesian:!0,userDataRsoOffset:0},a);var o=t.parameters,s=o.startHeight,f=o.endHeight,p=o.closedBottom,d=o.closedTop,g=o.includeSides,_=o.curvatureResolution,y=o.cartesian,m=o.userDataRsoOffset;(0,At.default)(i[0])||i[0].reverse();var b=Wt(i,{resolution:_}),u=b.contour,M=b.triangles,A=(0,Oe.merge)(M.uvs),Z=[],C=[],ae=[],se=0,ce=function(ue){var ge=Math.round(Z.length/3),R=ae.length;Z=Z.concat(ue.vertices),C=C.concat(ue.uvs),ae=ae.concat(ge?ue.indices.map(function(Ce){return Ce+ge}):ue.indices),t.addGroup(R,ae.length-R,se++)};if(g){var le=qe(u,s,f,y);ce(le),t.userData.rso=m?qe(u,s,f+m,y):le}return p&&ce(et(M,s,A,!1,y)),d&&ce(et(M,f,A,!0,y)),t.setIndex(ae),t[Qe]("position",new c.Float32BufferAttribute(Z,3)),t[Qe]("uv",new c.Float32BufferAttribute(C,2)),t.computeVertexNormals(),t}return r}(c.BufferGeometry),Vt=function(e){"use strict";O(r,e);var n=z(r);function r(a){j(this,r);var t;return t=n.call(this),t.options=(0,x.Z)({},{geojson:[[[]]],startHeight:0,height:5,closedBottom:!0,closedTop:!0,curvatureResolution:1,cartesian:!0,userDataRsoOffset:0},a),t}var i=r.prototype;return i.create=function(){var t=this.options,o=t.startHeight,s=t.height,f=t.closedBottom,p=t.closedTop,d=t.curvatureResolution,g=t.userDataRsoOffset,_=t.cartesian,y=new Gt(this.options.geojson,{startHeight:o,endHeight:o+s,closedBottom:f,closedTop:p,curvatureResolution:d,cartesian:_,userDataRsoOffset:g});this.createMesh(y,this.options.material)},r}(v),tt=N(705);function rt(e){var n=e.split,r=e.depth,i=e.points,a=new c[he](new c.Shape(i),{depth:r,bevelEnabled:!1,UVGenerator:(0,tt.y)({split:n})});return(0,tt.C)(),a}var Ut=function(e){"use strict";O(r,e);var n=z(r);function r(a){j(this,r);var t;return t=n.call(this),t.options=L((0,x.Z)({},a),{materialOptions:(0,x.Z)({},{split:.1},a.materialOptions||{})}),t}var i=r.prototype;return i.create=function(){var t=this;return(0,w.Z)(U().mark(function o(){var s,f,p,d,g,_,y,m,b,u,M,A,Z,C,ae,se,ce,le,ue;return U().wrap(function(R){for(;;)switch(R.prev=R.next){case 0:if(s=t.options,f=s.points,p=s.pointsArr,d=s.coordinatesArr,g=s.useGroups,_=s.depth,y=s.material,m=s.materialOptions,b=s.workerController,u=s.projection,M=s.cache,A=0,Z=y,!(!y&&m)){R.next=23;break}if(A=m.split,C=m.topColor,ae=m.sideColor,se=m.sideMap,ce="ExtrudePolygonMaterial:".concat(ae||se).concat(C||""),!(M&&!M.get(ce))){R.next=13;break}return M.init(ce),R.next=11,t.getMaterial(m);case 11:le=R.sent,M.set(ce,le);case 13:if(!M){R.next=19;break}return R.next=16,M.get(ce);case 16:R.t0=R.sent,R.next=22;break;case 19:return R.next=21,t.getMaterial(m);case 21:R.t0=R.sent;case 22:Z=R.t0;case 23:if(!f){R.next=27;break}t.createMesh(rt({points:f,depth:_,split:A}),y),R.next=33;break;case 27:if(!p){R.next=31;break}ue=$e.mergeBufferGeometries(p.map(function(Ce){return rt({points:Ce,depth:_,split:A})}),g!=null?g:!1),t.createMesh(ue,y),R.next=33;break;case 31:if(!(d&&b)){R.next=33;break}return R.abrupt("return",new Promise(function(Ce){b.postMessage({coordinatesArr:d,depth:_,split:A,useGroups:g,projection:u},function(ke){var De=new c.BufferGeometry;Object.keys(ke).forEach(function(Re){De.setAttribute(Re,new c.BufferAttribute(ke[Re].array,ke[Re].itemSize))}),t.createMesh(De,Z),Ce("")})}));case 33:case"end":return R.stop()}},o)}))()},i.getMaterial=function(t){var o=this,s=t.topColor,f=t.sideColor,p=t.sideMap,d=t.type,g=t.parameters,_=t.createCanvasObjectURL,y=t.split,m=t.maxAnisotropy;return new Promise(function(b){var u=p?document.createElement("img"):{src:"",onload:function(){},width:1024,height:1024};u.onload=function(){var M=y,A=document.createElement("canvas"),Z=A.getContext("2d");A.height=u.height/(1-M),A.width=u.width,M&&s&&(Z.fillStyle=s,Z.fillRect(0,0,u.width,A.height*M)),p&&u instanceof HTMLImageElement?Z.drawImage(u,0,A.height*M,u.width,u.height):f&&(Z.fillStyle=f,Z.fillRect(0,A.height*M,u.width,u.height)),_&&A.toBlob(function(se){console.log(URL.createObjectURL(se))});var C=new c.CanvasTexture(A);C.anisotropy=m||o.pencil.renderer.capabilities.getMaxAnisotropy();var ae=new c[d||"MeshBasicMaterial"]((0,x.Z)({map:C},g||{}));b(ae)},p?u.src=p:u instanceof HTMLImageElement||u.onload()})},i.setMaterialColor=function(t){var o=this;return(0,w.Z)(U().mark(function s(){var f,p,d,g,_,y,m,b,u,M,A;return U().wrap(function(C){for(;;)switch(C.prev=C.next){case 0:if(f=o.options,p=f.materialOptions,d=f.cache,g=p.sideColor,_=p.sideMap,y=p.topColor,m=t.sideColor,b=t.topColor,!(b||m)){C.next=22;break}if(u="ExtrudePolygonMaterial:".concat(m||g||_||"").concat(b||y||""),!(d&&!d.get(u))){C.next=11;break}return d.init(u),C.next=9,o.getMaterial((0,x.Z)({},p,t));case 9:M=C.sent,d.set(u,M);case 11:if(!d){C.next=17;break}return C.next=14,d.get(u);case 14:C.t0=C.sent,C.next=20;break;case 17:return C.next=19,o.getMaterial((0,x.Z)({},p,t));case 19:C.t0=C.sent;case 20:A=C.t0,o.object3d.material=A;case 22:case"end":return C.stop()}},s)}))()},r}(v)})();var qt=_e.Ei,er=_e.Yo,tr=_e.Ee,rr=_e.x1,nr=_e.VJ,ir=_e.r7,ar=_e.XA,or=_e.NB,sr=_e.xv,ur=_e.nk;export{qt as ConicPolygon,er as ExtrudePolygon,tr as Image,rr as Line,nr as MeshLine,ir as MeshLineMaterial,ar as MeshLineRaycast,or as Node,sr as Text,ur as Video};
132
+ `),Pe=function(e){"use strict";O(r,e);var n=D(r);function r(){k(this,r);var i;return i=n.call(this),i.isMeshLine=!0,i.type="MeshLine",i.positions=[],i.previous=[],i.next=[],i.side=[],i.width=[],i.indices_array=[],i.uvs=[],i.counters=[],i._points=[],i._geom=null,i.widthCallback=null,i.matrixWorld=new c.Matrix4,Object.defineProperties(B(i),{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(t){this.setGeometry(t,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(t){this.setPoints(t,this.widthCallback)}}}),i}return r}(c.BufferGeometry);Pe.prototype.setMatrixWorld=function(e){this.matrixWorld=e},Pe.prototype.setGeometry=function(e,n){this._geometry=e,this.setPoints(e.getAttribute("position").array,n)},Pe.prototype.setPoints=function(e,n){if(!(e instanceof Float32Array)&&!(e instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=e,this.widthCallback=n,this.positions=[],this.counters=[],e.length&&e[0]instanceof c.Vector3)for(var r=0;r<e.length;r++){var i=e[r],a=r/e.length;this.positions.push(i.x,i.y,i.z),this.positions.push(i.x,i.y,i.z),this.counters.push(a),this.counters.push(a)}else for(var r=0;r<e.length;r+=3){var a=r/e.length;this.positions.push(e[r],e[r+1],e[r+2]),this.positions.push(e[r],e[r+1],e[r+2]),this.counters.push(a),this.counters.push(a)}this.process()};function Ke(e,n){var r=new c.Matrix4,i=new c.Ray,a=new c.Sphere,t=new c.Vector3,o=this.geometry;if(o.boundingSphere||o.computeBoundingSphere(),a.copy(o.boundingSphere),a.applyMatrix4(this.matrixWorld),e.ray.intersectSphere(a,t)!==!1){r.copy(this.matrixWorld).invert(),i.copy(e.ray).applyMatrix4(r);var s=new c.Vector3,f=new c.Vector3,p=new c.Vector3,d=this instanceof c.LineSegments?2:1,m=o.index,_=o.attributes;if(m!==null)for(var y=m.array,g=_.position.array,b=_.width.array,u=0,E=y.length-1;u<E;u+=d){var x=y[u],U=y[u+1];s.fromArray(g,x*3),f.fromArray(g,U*3);var P=b[Math.floor(u/3)]!==void 0?b[Math.floor(u/3)]:1,se=e.params.Line.threshold+this.material.lineWidth*P/2,de=se*se,fe=i.distanceSqToSegment(s,f,t,p);if(!(fe>de)){t.applyMatrix4(this.matrixWorld);var le=e.ray.origin.distanceTo(t);le<e.near||le>e.far||(n.push({distance:le,point:p.clone().applyMatrix4(this.matrixWorld),index:u,face:null,faceIndex:null,object:this}),u=E)}}}}Pe.prototype.raycast=Ke,Pe.prototype.compareV3=function(e,n){var r=e*6,i=n*6;return this.positions[r]===this.positions[i]&&this.positions[r+1]===this.positions[i+1]&&this.positions[r+2]===this.positions[i+2]},Pe.prototype.copyV3=function(e){var n=e*6;return[this.positions[n],this.positions[n+1],this.positions[n+2]]},Pe.prototype.process=function(){var e=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var n,r;this.compareV3(0,e-1)?r=this.copyV3(e-2):r=this.copyV3(0),this.previous.push(r[0],r[1],r[2]),this.previous.push(r[0],r[1],r[2]);for(var i=0;i<e;i++){if(this.side.push(1),this.side.push(-1),this.widthCallback?n=this.widthCallback(i/(e-1)):n=1,this.width.push(n),this.width.push(n),this.uvs.push(i/(e-1),0),this.uvs.push(i/(e-1),1),i<e-1){r=this.copyV3(i),this.previous.push(r[0],r[1],r[2]),this.previous.push(r[0],r[1],r[2]);var a=i*2;this.indices_array.push(a,a+1,a+2),this.indices_array.push(a+2,a+1,a+3)}i>0&&(r=this.copyV3(i),this.next.push(r[0],r[1],r[2]),this.next.push(r[0],r[1],r[2]))}this.compareV3(e-1,0)?r=this.copyV3(1):r=this.copyV3(e-1),this.next.push(r[0],r[1],r[2]),this.next.push(r[0],r[1],r[2]),!this._attributes||this._attributes.position.count!==this.positions.length?this._attributes={position:new c.BufferAttribute(new Float32Array(this.positions),3),previous:new c.BufferAttribute(new Float32Array(this.previous),3),next:new c.BufferAttribute(new Float32Array(this.next),3),side:new c.BufferAttribute(new Float32Array(this.side),1),width:new c.BufferAttribute(new Float32Array(this.width),1),uv:new c.BufferAttribute(new Float32Array(this.uvs),2),index:new c.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new c.BufferAttribute(new Float32Array(this.counters),1)}:(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()};function Ge(e,n,r,i,a){var t;if(e=e.subarray||e.slice?e:e.buffer,r=r.subarray||r.slice?r:r.buffer,e=n?e.subarray?e.subarray(n,a&&n+a):e.slice(n,a&&n+a):e,r.set)r.set(e,i);else for(t=0;t<e.length;t++)r[t+i]=e[t];return r}Pe.prototype.advance=function(e){var n=this._attributes.position.array,r=this._attributes.previous.array,i=this._attributes.next.array,a=n.length;Ge(n,0,r,0,a),Ge(n,6,n,0,a-6),n[a-6]=e.x,n[a-5]=e.y,n[a-4]=e.z,n[a-3]=e.x,n[a-2]=e.y,n[a-1]=e.z,Ge(n,6,i,0,a-6),i[a-6]=e.x,i[a-5]=e.y,i[a-4]=e.z,i[a-3]=e.x,i[a-2]=e.y,i[a-1]=e.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0},c.ShaderChunk.meshline_vert=ft,c.ShaderChunk.meshline_frag=ht;var Ve=function(e){"use strict";O(r,e);var n=D(r);function r(i){k(this,r);var a;return a=n.call(this,{uniforms:Object.assign({},c.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new c.Color(16777215)},opacity:{value:1},resolution:{value:new c.Vector2(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new c.Vector2(1,1)},offset:{value:new c.Vector2(1,1)},lineLightAnimation:{value:1},time:{value:0},size:{value:300},speed:{value:.3},lightWidth:{value:.1},uCenter:{value:new c.Vector2(0,0)},lightColor:{value:new c.Color(16777215)}}),vertexShader:c.ShaderChunk.meshline_vert,fragmentShader:c.ShaderChunk.meshline_frag}),a.isMeshLineMaterial=!0,a.type="MeshLineMaterial",Object.defineProperties(B(a),{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(o){this.uniforms.lineWidth.value=o}},lineLightAnimation:{enumerable:!0,get:function(){return this.uniforms.lineLightAnimation.value},set:function(o){this.uniforms.lineLightAnimation.value=o}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(o){this.uniforms.map.value=o}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(o){this.uniforms.useMap.value=o}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(o){this.uniforms.alphaMap.value=o}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(o){this.uniforms.useAlphaMap.value=o}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(o){this.uniforms.color.value=o}},lightColor:{enumerable:!0,get:function(){return this.uniforms.lightColor.value},set:function(o){this.uniforms.lightColor.value=o}},time:{enumerable:!0,get:function(){return this.uniforms.time.value},set:function(o){this.uniforms.time.value=o}},uCenter:{enumerable:!0,get:function(){return this.uniforms.uCenter.value},set:function(o){this.uniforms.uCenter.value=o}},size:{enumerable:!0,get:function(){return this.uniforms.size.value},set:function(o){this.uniforms.size.value=o}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(o){this.uniforms.opacity.value=o}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(o){this.uniforms.resolution.value.copy(o)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(o){this.uniforms.sizeAttenuation.value=o}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(o){this.uniforms.dashArray.value=o,this.useDash=o!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(o){this.uniforms.dashOffset.value=o}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(o){this.uniforms.dashRatio.value=o}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(o){this.uniforms.useDash.value=o}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(o){this.uniforms.visibility.value=o}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(o){this.uniforms.alphaTest.value=o}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(o){this.uniforms.repeat.value.copy(o)}}}),a.setValues(i),a}return r}(c.ShaderMaterial);Ve.prototype.copy=function(e){return c.ShaderMaterial.prototype.copy.call(this,e),this.lineWidth=e.lineWidth,this.map=e.map,this.useMap=e.useMap,this.alphaMap=e.alphaMap,this.useAlphaMap=e.useAlphaMap,this.color.copy(e.color),this.opacity=e.opacity,this.resolution.copy(e.resolution),this.sizeAttenuation=e.sizeAttenuation,this.dashArray.copy(e.dashArray),this.dashOffset.copy(e.dashOffset),this.dashRatio.copy(e.dashRatio),this.useDash=e.useDash,this.visibility=e.visibility,this.alphaTest=e.alphaTest,this.repeat.copy(e.repeat),this};function pt(e,n){if(e==null)return{};var r={},i=Object.keys(e),a,t;for(t=0;t<i.length;t++)a=i[t],!(n.indexOf(a)>=0)&&(r[a]=e[a]);return r}function vt(e,n){if(e==null)return{};var r=pt(e,n),i,a;if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);for(a=0;a<t.length;a++)i=t[a],!(n.indexOf(i)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,i)||(r[i]=e[i]))}return r}var dt=e=>{var n={};return N.d(n,e),n},cr=e=>()=>e,Xe=dt({animate:()=>ot.animate,linear:()=>ot.linear}),mt=e=>{var n={};return N.d(n,e),n},lr=e=>()=>e,He=mt({mergeBufferGeometries:()=>Ft.mergeBufferGeometries});function $e(e){var n=e.setPointWidth,r=e.nodes,i=new c.BufferGeometry,a=new Pe;return i.setFromPoints(r),a.setGeometry(i,n),a}var gt={color:new c.Color("#ffffff"),lineWidth:3,sizeAttenuation:0},_t=function(e){"use strict";O(r,e);var n=D(r);function r(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};k(this,r);var t;return t=n.call(this),t.options=(0,M.Z)({},gt,a),t}var i=r.prototype;return i.create=function(){var t=this,o=this.options,s=o.duration,f=o.delay,p=o.onComplete,d=o.setPointWidth,m=o.key,_=o.nodes,y=o.nodesArr,g=o.coordinatesArr,b=o.projection,u=o.worker,E=o.workerKey,x=o.useGroups,U=vt(o,["duration","delay","onComplete","setPointWidth","key","nodes","nodesArr","coordinatesArr","projection","worker","workerKey","useGroups"]),P=this.pencil.getSize(),se=P.width,de=P.height,fe=new Ve(L((0,M.Z)({},U),{resolution:new c.Vector2(se,de)}));if(this.material=fe,_)this.createMesh($e({nodes:_,setPointWidth:d}),fe);else if(y){var le=He.mergeBufferGeometries(y.map(function(ve){return $e({nodes:ve,setPointWidth:d})}),x!=null?x:!1);this.createMesh(le,fe)}else if(g&&u)return new Promise(function(ve){u.postMessage({coordinatesArr:g,projection:b,useGroups:x,workerKey:E},function(ue){var me=new c.BufferGeometry;Object.keys(ue).forEach(function(ge){ge==="index"?me.setIndex(new c.BufferAttribute(ue[ge].array,ue[ge].itemSize)):me.setAttribute(ge,new c.BufferAttribute(ue[ge].array,ue[ge].itemSize))}),t.createMesh(me,fe),ve("")})})},i.resize=function(t,o){this.material.uniforms.resolution.value.set(t,o)},i.animate=function(){var t=this.options,o=t.duration,s=t.delay,f=t.onComplete,p=this.material.uniforms.offset,d=s!=null?s:0,m=(0,Xe.animate)({from:p.value,to:{x:0},duration:o!=null?o:1e3,elapsed:-d,repeat:1/0,onComplete:f,ease:Xe.linear,onUpdate:function(_){p.value.x=_.x}});this.tween=m},i.dispose=function(){var t;We(S(r.prototype),"dispose",this).call(this),(t=this.tween)===null||t===void 0||t.stop()},r}(v);function yt(e){if(Array.isArray(e))return e}function bt(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Se(e,n){return yt(e)||ne(e,n)||F(e,n)||bt()}var wt=e=>{var n={};return N.d(n,e),n},fr=e=>()=>e,Le=wt({extent:()=>Fe.extent,mean:()=>Fe.mean,merge:()=>Fe.merge}),xt=e=>{var n={};return N.d(n,e),n},hr=e=>()=>e,Ue=xt({default:()=>Kt.default}),Mt=e=>{var n={};return N.d(n,e),n},pr=e=>()=>e,At=Mt({default:()=>Xt.default});function Pt(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=(90-n)*Math.PI/180,a=(90-e)*Math.PI/180;return[r*Math.sin(i)*Math.cos(a),r*Math.cos(i),r*Math.sin(i)*Math.sin(a)]}var St=e=>{var n={};return N.d(n,e),n},vr=e=>()=>e,Ot=St({default:()=>Ht.default}),Ct=e=>{var n={};return N.d(n,e),n},dr=e=>()=>e,Et=Ct({default:()=>$t.default}),Lt=e=>{var n={};return N.d(n,e),n},mr=e=>()=>e,Re=Lt({geoBounds:()=>De.geoBounds,geoContains:()=>De.geoContains,geoDistance:()=>De.geoDistance,geoInterpolate:()=>De.geoInterpolate}),jt=e=>{var n={};return N.d(n,e),n},gr=e=>()=>e,kt=jt({geoVoronoi:()=>Yt.geoVoronoi}),Rt=e=>{var n={};return N.d(n,e),n},_r=e=>()=>e,Ye=Rt({scaleLinear:()=>Jt.scaleLinear});function Tt(e,n){return e.map(function(r){var i=[],a;return r.forEach(function(t){if(a){var o=(0,Re.geoDistance)(t,a)*180/Math.PI;if(o>n)for(var s=(0,Re.geoInterpolate)(a,t),f=1/Math.ceil(o/n),p=f;p<1;)i.push(s(p)),p+=f}i.push(a=t)}),i})}function Bt(e){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.minLng,i=n.maxLng,a=n.minLat,t=n.maxLat,o=Math.round(Math.pow(360/e,2)/Math.PI),s=(1+Math.sqrt(5))/2,f=function(u){return u/s*360%360-180},p=function(u){return Math.acos(2*u/o-1)/Math.PI*180-90},d=function(u){return o*(Math.cos((u+90)*Math.PI/180)+1)/2},m=[t!==void 0?Math.ceil(d(t)):0,a!==void 0?Math.floor(d(a)):o-1],_=r===void 0&&i===void 0?function(){return!0}:r===void 0?function(u){return u<=i}:i===void 0?function(u){return u>=r}:i>=r?function(u){return u>=r&&u<=i}:function(u){return u>=r||u<=i},y=[],g=m[0];g<=m[1];g++){var b=f(g);_(b)&&y.push([b,p(g)])}return y}function Ne(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return r?(0,Re.geoContains)(n,e):(0,Et.default)(e,n)}function zt(e,n){var r={type:"Polygon",coordinates:e},i=Se((0,Re.geoBounds)(r),2),a=Se(i[0],2),t=a[0],o=a[1],s=Se(i[1],2),f=s[0],p=s[1];if(Math.min(Math.abs(f-t),Math.abs(p-o))<n)return[];var d=t>f||p>=89||o<=-89;return Bt(n,{minLng:t,maxLng:f,minLat:o,maxLat:p}).filter(function(m){return Ne(m,r,d)})}function Dt(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.resolution,i=r===void 0?1/0:r,a=Tt(e,i),t=(0,Le.merge)(a),o=zt(e,i),s=I(t).concat(I(o)),f={type:"Polygon",coordinates:e},p=Se((0,Re.geoBounds)(f),2),d=Se(p[0],2),m=d[0],_=d[1],y=Se(p[1],2),g=y[0],b=y[1],u=m>g||b>=89||_<=-89,E=[];if(u){var x=(0,kt.geoVoronoi)(s).triangles(),U=new Map(s.map(function(ie,Me){var _e=Se(ie,2),we=_e[0],Be=_e[1];return["".concat(we,"-").concat(Be),Me]}));x.features.forEach(function(ie){var Me,_e=ie.geometry.coordinates[0].slice(0,3).reverse(),we=[];if(_e.forEach(function(ze){var Oe=Se(ze,2),Ze=Oe[0],Nt=Oe[1],nt="".concat(Ze,"-").concat(Nt);U.has(nt)&&we.push(U.get(nt))}),we.length===3){if(we.some(function(ze){return ze<t.length})){var Be=ie.properties.circumcenter;if(!Ne(Be,f,u))return}(Me=E).push.apply(Me,I(we))}})}else if(o.length)for(var le=function(ie,Me){var _e,we=[2,1,0].map(function(Oe){return ve.triangles[ie+Oe]}),Be=we.map(function(Oe){return s[Oe]});if(we.some(function(Oe){return Oe<t.length})){var ze=[0,1].map(function(Oe){return(0,Le.mean)(Be,function(Ze){return Ze[Oe]})});if(!Ne(ze,f,u))return"continue"}(_e=E).push.apply(_e,I(we))},ve=Ot.default.from(s),ue=0,me=ve.triangles.length;ue<me;ue+=3)le(ue,me);else{var P=Ue.default.flatten(a),se=P.vertices,de=P.holes,fe=de===void 0?[]:de;E=(0,Ue.default)(se,fe,2)}var ge=(0,Ye.scaleLinear)((0,Le.extent)(s,function(ie){return ie[0]}),[0,1]),rt=(0,Ye.scaleLinear)((0,Le.extent)(s,function(ie){return ie[1]}),[0,1]),H=s.map(function(ie){var Me=Se(ie,2),_e=Me[0],we=Me[1];return[ge(_e),rt(we)]}),Te={points:s,indices:E,uvs:H};return{contour:a,triangles:Te}}var Wt=Dt,Je=new c.BufferGeometry().setAttribute?"setAttribute":"addAttribute";function Ie(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=e.map(function(a){return a.map(function(t){var o=Se(t,2),s=o[0],f=o[1];return r?Pt(s,f,n):[s,f,n]})});return Ue.default.flatten(i)}function Qe(e,n,r){for(var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=Ie(e,n,i),t=a.vertices,o=a.holes,s=Ie(e,r,i),f=s.vertices,p=(0,Le.merge)([f,t]),d=Math.round(f.length/3),m=new Set(o),_=0,y=[],g=0;g<d;g++){var b=g+1;if(b===d)b=_;else if(m.has(b)){var u=b;b=_,_=u}y.push(g,g+d,b+d),y.push(b+d,b,g)}for(var E=[],x=1;x>=0;x--)for(var U=0;U<d;U+=1)E.push(U/(d-1),x);return{indices:y,vertices:p,uvs:E,topVerts:f}}function qe(e,n,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return{indices:i?e.indices:e.indices.slice().reverse(),vertices:Ie([e.points],n,a).vertices,uvs:r}}var Gt=function(e){"use strict";O(r,e);var n=D(r);function r(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};k(this,r);var t;t=n.call(this),t.type="PolygonBufferGeometry",t.parameters=(0,M.Z)({},{polygonGeoJson:i,startHeight:0,endHeight:1,closedBottom:!0,closedTop:!0,includeSides:!0,curvatureResolution:5,cartesian:!0,userDataRsoOffset:0},a);var o=t.parameters,s=o.startHeight,f=o.endHeight,p=o.closedBottom,d=o.closedTop,m=o.includeSides,_=o.curvatureResolution,y=o.cartesian,g=o.userDataRsoOffset;(0,At.default)(i[0])||i[0].reverse();var b=Wt(i,{resolution:_}),u=b.contour,E=b.triangles,x=(0,Le.merge)(E.uvs),U=[],P=[],se=[],de=0,fe=function(ve){var ue=Math.round(U.length/3),me=se.length;U=U.concat(ve.vertices),P=P.concat(ve.uvs),se=se.concat(ue?ve.indices.map(function(ge){return ge+ue}):ve.indices),t.addGroup(me,se.length-me,de++)};if(m){var le=Qe(u,s,f,y);fe(le),t.userData.rso=g?Qe(u,s,f+g,y):le}return p&&fe(qe(E,s,x,!1,y)),d&&fe(qe(E,f,x,!0,y)),t.setIndex(se),t[Je]("position",new c.Float32BufferAttribute(U,3)),t[Je]("uv",new c.Float32BufferAttribute(P,2)),t.computeVertexNormals(),t}return r}(c.BufferGeometry),Vt=function(e){"use strict";O(r,e);var n=D(r);function r(a){k(this,r);var t;return t=n.call(this),t.options=(0,M.Z)({},{geojson:[[[]]],startHeight:0,height:5,closedBottom:!0,closedTop:!0,curvatureResolution:1,cartesian:!0,userDataRsoOffset:0},a),t}var i=r.prototype;return i.create=function(){var t=this.options,o=t.startHeight,s=t.height,f=t.closedBottom,p=t.closedTop,d=t.curvatureResolution,m=t.userDataRsoOffset,_=t.cartesian,y=new Gt(this.options.geojson,{startHeight:o,endHeight:o+s,closedBottom:f,closedTop:p,curvatureResolution:d,cartesian:_,userDataRsoOffset:m});this.createMesh(y,this.options.material)},r}(v),et=N(705);function tt(e){var n=e.split,r=e.depth,i=e.points,a=new c[pe](new c.Shape(i),{depth:r,bevelEnabled:!1,UVGenerator:(0,et.y)({split:n})});return(0,et.C)(),a}var Ut=function(e){"use strict";O(r,e);var n=D(r);function r(a){k(this,r);var t;return t=n.call(this),t.options=L((0,M.Z)({},a),{materialOptions:(0,M.Z)({},{split:.1},a.materialOptions||{})}),t}var i=r.prototype;return i.create=function(){var t=this;return(0,w.Z)(V().mark(function o(){var s,f,p,d,m,_,y,g,b,u,E,x,U,P,se,de,fe,le,ve,ue,me,ge;return V().wrap(function(H){for(;;)switch(H.prev=H.next){case 0:if(s=t.options,f=s.points,p=s.pointsArr,d=s.coordinatesArr,m=s.useGroups,_=s.depth,y=s.material,g=s.materialOptions,b=s.worker,u=s.workerKey,E=s.projection,x=s.cache,U=0,P=y,!(!y&&g)){H.next=23;break}if(U=g.split,se=g.topColor,de=g.sideColor,fe=g.sideMap,le="ExtrudePolygonMaterial:".concat(de||fe).concat(se||""),!(x&&!x.get(le))){H.next=13;break}return x.init(le),H.next=11,t.getMaterial(g);case 11:ve=H.sent,x.set(le,ve);case 13:if(!x){H.next=19;break}return H.next=16,x.get(le);case 16:H.t0=H.sent,H.next=22;break;case 19:return H.next=21,t.getMaterial(g);case 21:H.t0=H.sent;case 22:P=H.t0;case 23:if(ue=Array.isArray(_)?_:[_],!f){H.next=28;break}t.createMesh(tt({points:f,depth:ue[0],split:U}),y),H.next=34;break;case 28:if(!p){H.next=32;break}ge=He.mergeBufferGeometries(p.map(function(Te,ie){return tt({points:Te,depth:(me=ue[ie])!==null&&me!==void 0?me:ue[0],split:U})}),m!=null?m:!1),t.createMesh(ge,y),H.next=34;break;case 32:if(!(d&&b)){H.next=34;break}return H.abrupt("return",new Promise(function(Te){b.postMessage({coordinatesArr:d,depth:_,split:U,useGroups:m,projection:E,workerKey:u},function(ie){var Me=new c.BufferGeometry;Object.keys(ie).forEach(function(_e){Me.setAttribute(_e,new c.BufferAttribute(ie[_e].array,ie[_e].itemSize))}),t.createMesh(Me,P),Te("")})}));case 34:case"end":return H.stop()}},o)}))()},i.getMaterial=function(t){var o=this,s=t.topColor,f=t.sideColor,p=t.sideMap,d=t.type,m=t.parameters,_=t.createCanvasObjectURL,y=t.split,g=t.maxAnisotropy;return new Promise(function(b){var u=p?document.createElement("img"):{src:"",onload:function(){},width:1024,height:1024};u.onload=function(){var E=y,x=document.createElement("canvas"),U=x.getContext("2d");x.height=u.height/(1-E),x.width=u.width,E&&s&&(U.fillStyle=s,U.fillRect(0,0,u.width,x.height*E)),p&&u instanceof HTMLImageElement?U.drawImage(u,0,x.height*E,u.width,u.height):f&&(U.fillStyle=f,U.fillRect(0,x.height*E,u.width,u.height)),_&&x.toBlob(function(de){console.log(URL.createObjectURL(de))});var P=new c.CanvasTexture(x);P.anisotropy=g||o.pencil.renderer.capabilities.getMaxAnisotropy();var se=new c[d||"MeshBasicMaterial"]((0,M.Z)({map:P},m||{}));b(se)},p?u.src=p:u instanceof HTMLImageElement||u.onload()})},i.setMaterialColor=function(t){var o=this;return(0,w.Z)(V().mark(function s(){var f,p,d,m,_,y,g,b,u,E,x;return V().wrap(function(P){for(;;)switch(P.prev=P.next){case 0:if(f=o.options,p=f.materialOptions,d=f.cache,m=p.sideColor,_=p.sideMap,y=p.topColor,g=t.sideColor,b=t.topColor,!(b||g)){P.next=22;break}if(u="ExtrudePolygonMaterial:".concat(g||m||_||"").concat(b||y||""),!(d&&!d.get(u))){P.next=11;break}return d.init(u),P.next=9,o.getMaterial((0,M.Z)({},p,t));case 9:E=P.sent,d.set(u,E);case 11:if(!d){P.next=17;break}return P.next=14,d.get(u);case 14:P.t0=P.sent,P.next=20;break;case 17:return P.next=19,o.getMaterial((0,M.Z)({},p,t));case 19:P.t0=P.sent;case 20:x=P.t0,o.object3d.material=x;case 22:case"end":return P.stop()}},s)}))()},r}(v)})();var qt=Ae.Ei,er=Ae.Yo,tr=Ae.Ee,rr=Ae.x1,nr=Ae.VJ,ir=Ae.r7,ar=Ae.XA,or=Ae.NB,sr=Ae.xv,ur=Ae.nk;export{qt as ConicPolygon,er as ExtrudePolygon,tr as Image,rr as Line,nr as MeshLine,ir as MeshLineMaterial,ar as MeshLineRaycast,or as Node,sr as Text,ur as Video};
@@ -13,7 +13,8 @@ interface Options {
13
13
  scale: number;
14
14
  };
15
15
  key?: string;
16
- workerController?: WorkerController;
16
+ worker?: WorkerController;
17
+ workerKey?: string;
17
18
  useGroups?: boolean;
18
19
  duration?: number;
19
20
  delay?: number;
@@ -5,8 +5,9 @@ import { CSS2DObject } from 'three/examples/jsm/renderers/CSS2DRenderer';
5
5
  interface Options {
6
6
  children: HTMLElement;
7
7
  position?: THREE.Vector3;
8
- onClick?: (event: MouseEvent) => void;
9
- clickTarge?: string[];
8
+ event?: string;
9
+ eventTarge?: string[];
10
+ handler?: (event: Event) => void;
10
11
  zIndexFix?: number;
11
12
  }
12
13
  export declare class Node extends BaseObject {
@@ -1,9 +1,15 @@
1
1
  declare type GetWk = () => Worker;
2
+ interface Options {
3
+ cache?: boolean;
4
+ cacheVersion?: string;
5
+ }
2
6
  export default class {
3
7
  workerList: {
4
8
  worker: Worker;
5
9
  inUse: boolean;
6
10
  }[];
11
+ options: Required<Options>;
12
+ constructor(options?: Options);
7
13
  install(): void;
8
14
  init(scriptURL: string | GetWk, length: number): void;
9
15
  messageList: {
@@ -1 +1 @@
1
- (function(){var X={666:function(y){var b=function(f){"use strict";var A=Object.prototype,T=A.hasOwnProperty,d,O=typeof Symbol=="function"?Symbol:{},E=O.iterator||"@@iterator",L=O.asyncIterator||"@@asyncIterator",j=O.toStringTag||"@@toStringTag";function p(r,t,a){return Object.defineProperty(r,t,{value:a,enumerable:!0,configurable:!0,writable:!0}),r[t]}try{p({},"")}catch(r){p=function(t,a,c){return t[a]=c}}function S(r,t,a,c){var l=t&&t.prototype instanceof z?t:z,C=Object.create(l.prototype),D=new m(c||[]);return C._invoke=h(r,a,D),C}f.wrap=S;function M(r,t,a){try{return{type:"normal",arg:r.call(t,a)}}catch(c){return{type:"throw",arg:c}}}var R="suspendedStart",N="suspendedYield",W="executing",U="completed",k={};function z(){}function _(){}function w(){}var n={};p(n,E,function(){return this});var s=Object.getPrototypeOf,o=s&&s(s(Z([])));o&&o!==A&&T.call(o,E)&&(n=o);var e=w.prototype=z.prototype=Object.create(n);_.prototype=w,p(e,"constructor",w),p(w,"constructor",_),_.displayName=p(w,j,"GeneratorFunction");function i(r){["next","throw","return"].forEach(function(t){p(r,t,function(a){return this._invoke(t,a)})})}f.isGeneratorFunction=function(r){var t=typeof r=="function"&&r.constructor;return t?t===_||(t.displayName||t.name)==="GeneratorFunction":!1},f.mark=function(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,w):(r.__proto__=w,p(r,j,"GeneratorFunction")),r.prototype=Object.create(e),r},f.awrap=function(r){return{__await:r}};function u(r,t){function a(C,D,I,V){var H=M(r[C],r,D);if(H.type==="throw")V(H.arg);else{var K=H.arg,B=K.value;return B&&typeof B=="object"&&T.call(B,"__await")?t.resolve(B.__await).then(function(F){a("next",F,I,V)},function(F){a("throw",F,I,V)}):t.resolve(B).then(function(F){K.value=F,I(K)},function(F){return a("throw",F,I,V)})}}var c;function l(C,D){function I(){return new t(function(V,H){a(C,D,V,H)})}return c=c?c.then(I,I):I()}this._invoke=l}i(u.prototype),p(u.prototype,L,function(){return this}),f.AsyncIterator=u,f.async=function(r,t,a,c,l){l===void 0&&(l=Promise);var C=new u(S(r,t,a,c),l);return f.isGeneratorFunction(t)?C:C.next().then(function(D){return D.done?D.value:C.next()})};function h(r,t,a){var c=R;return function(C,D){if(c===W)throw new Error("Generator is already running");if(c===U){if(C==="throw")throw D;return G()}for(a.method=C,a.arg=D;;){var I=a.delegate;if(I){var V=v(I,a);if(V){if(V===k)continue;return V}}if(a.method==="next")a.sent=a._sent=a.arg;else if(a.method==="throw"){if(c===R)throw c=U,a.arg;a.dispatchException(a.arg)}else a.method==="return"&&a.abrupt("return",a.arg);c=W;var H=M(r,t,a);if(H.type==="normal"){if(c=a.done?U:N,H.arg===k)continue;return{value:H.arg,done:a.done}}else H.type==="throw"&&(c=U,a.method="throw",a.arg=H.arg)}}}function v(r,t){var a=r.iterator[t.method];if(a===d){if(t.delegate=null,t.method==="throw"){if(r.iterator.return&&(t.method="return",t.arg=d,v(r,t),t.method==="throw"))return k;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return k}var c=M(a,r.iterator,t.arg);if(c.type==="throw")return t.method="throw",t.arg=c.arg,t.delegate=null,k;var l=c.arg;if(!l)return t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,k;if(l.done)t[r.resultName]=l.value,t.next=r.nextLoc,t.method!=="return"&&(t.method="next",t.arg=d);else return l;return t.delegate=null,k}i(e),p(e,j,"Generator"),p(e,E,function(){return this}),p(e,"toString",function(){return"[object Generator]"});function P(r){var t={tryLoc:r[0]};1 in r&&(t.catchLoc=r[1]),2 in r&&(t.finallyLoc=r[2],t.afterLoc=r[3]),this.tryEntries.push(t)}function g(r){var t=r.completion||{};t.type="normal",delete t.arg,r.completion=t}function m(r){this.tryEntries=[{tryLoc:"root"}],r.forEach(P,this),this.reset(!0)}f.keys=function(r){var t=[];for(var a in r)t.push(a);return t.reverse(),function c(){for(;t.length;){var l=t.pop();if(l in r)return c.value=l,c.done=!1,c}return c.done=!0,c}};function Z(r){if(r){var t=r[E];if(t)return t.call(r);if(typeof r.next=="function")return r;if(!isNaN(r.length)){var a=-1,c=function l(){for(;++a<r.length;)if(T.call(r,a))return l.value=r[a],l.done=!1,l;return l.value=d,l.done=!0,l};return c.next=c}}return{next:G}}f.values=Z;function G(){return{value:d,done:!0}}return m.prototype={constructor:m,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=d,this.done=!1,this.delegate=null,this.method="next",this.arg=d,this.tryEntries.forEach(g),!r)for(var t in this)t.charAt(0)==="t"&&T.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=d)},stop:function(){this.done=!0;var r=this.tryEntries[0],t=r.completion;if(t.type==="throw")throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var t=this;function a(V,H){return C.type="throw",C.arg=r,t.next=V,H&&(t.method="next",t.arg=d),!!H}for(var c=this.tryEntries.length-1;c>=0;--c){var l=this.tryEntries[c],C=l.completion;if(l.tryLoc==="root")return a("end");if(l.tryLoc<=this.prev){var D=T.call(l,"catchLoc"),I=T.call(l,"finallyLoc");if(D&&I){if(this.prev<l.catchLoc)return a(l.catchLoc,!0);if(this.prev<l.finallyLoc)return a(l.finallyLoc)}else if(D){if(this.prev<l.catchLoc)return a(l.catchLoc,!0)}else if(I){if(this.prev<l.finallyLoc)return a(l.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(r,t){for(var a=this.tryEntries.length-1;a>=0;--a){var c=this.tryEntries[a];if(c.tryLoc<=this.prev&&T.call(c,"finallyLoc")&&this.prev<c.finallyLoc){var l=c;break}}l&&(r==="break"||r==="continue")&&l.tryLoc<=t&&t<=l.finallyLoc&&(l=null);var C=l?l.completion:{};return C.type=r,C.arg=t,l?(this.method="next",this.next=l.finallyLoc,k):this.complete(C)},complete:function(r,t){if(r.type==="throw")throw r.arg;return r.type==="break"||r.type==="continue"?this.next=r.arg:r.type==="return"?(this.rval=this.arg=r.arg,this.method="return",this.next="end"):r.type==="normal"&&t&&(this.next=t),k},finish:function(r){for(var t=this.tryEntries.length-1;t>=0;--t){var a=this.tryEntries[t];if(a.finallyLoc===r)return this.complete(a.completion,a.afterLoc),g(a),k}},catch:function(r){for(var t=this.tryEntries.length-1;t>=0;--t){var a=this.tryEntries[t];if(a.tryLoc===r){var c=a.completion;if(c.type==="throw"){var l=c.arg;g(a)}return l}}throw new Error("illegal catch attempt")},delegateYield:function(r,t,a){return this.delegate={iterator:Z(r),resultName:t,nextLoc:a},this.method==="next"&&(this.arg=d),k}},f}(y.exports);try{regeneratorRuntime=b}catch(f){typeof globalThis=="object"?globalThis.regeneratorRuntime=b:Function("r","regeneratorRuntime = r")(b)}},519:function(y,b,f){"use strict";f.d(b,{makePromiseCreator:function(){return A.Z}});var A=f(282),T=f(666),d=f.n(T),O=null,E=f(644);function L(k){if(k.material){var z=Array.isArray(k.material)?k.material:[k.material];z.forEach(function(_){var w,n;(w=_.color)===null||w===void 0||w.convertSRGBToLinear(),(n=_.emissive)===null||n===void 0||n.convertSRGBToLinear(),_.map&&(_.map.encoding=THREE.sRGBEncoding),_.emissiveMap&&(_.emissiveMap.encoding=THREE.sRGBEncoding)})}}var j=f(568),p=f(924),S=require("idb-keyval"),M=f(484),R=null,N=null,W=function(){var k=(0,j.Z)(d().mark(function z(_,w){var n,s,o,e,i,u;return d().wrap(function(v){for(;;)switch(v.prev=v.next){case 0:return n=w.version,v.next=4,(0,S.get)(_);case 4:if(o=v.sent,!(o&&o[n])){v.next=9;break}s=o[n],v.next=15;break;case 9:return v.next=11,(0,M.Z)(fetch(_).then(function(P){if(P.ok)return P.blob();throw new Error}));case 11:e=v.sent,i=e.res,u=e.err,u||(s=i,(0,S.set)(_,(0,p.Z)({},n,i)));case 15:return v.abrupt("return",s?{url:URL.createObjectURL(s)}:{url:_});case 16:case"end":return v.stop()}},z)}));return function(_,w){return k.apply(this,arguments)}}(),U=f(705)},282:function(y,b,f){"use strict";f.d(b,{Z:function(){return T}});var A=f(484);function T(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E={};return E.promise=new Promise(function(L,j){E.resolve=L,E.reject=j}),d&&(E.promise=(0,A.Z)(E.promise,O)),E}},484:function(y,b,f){"use strict";f.d(b,{Z:function(){return T}});var A=f(42);function T(d){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return d.then(function(E){return(0,A.Z)({err:null,res:E},O)}).catch(function(E){return(0,A.Z)({err:E,res:void 0},O)})}},705:function(y,b,f){"use strict";var A=f(644),T=f.n(A),d=new Map,O=function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{generateTopUV:function(j,p,S,M,R){var N=p[S*3],W=p[S*3+1],U=p[M*3],k=p[M*3+1],z=p[R*3],_=p[R*3+1],w;if(d.has(j))w=d.get(j);else{var n=L.box3||new THREE.Box3;if(!L.box3){var s=j.parameters.shapes.getPoints();n.setFromArray(s.map(function(h){return[h.x,h.y,0]}).flat())}var o=n.getSize(new THREE.Vector3);L.split&&(o.y/=L.split),w={box:n,size:o},d.set(j,w)}var e=w.box,i=w.size,u=L.split?1-L.split:0;return[new THREE.Vector2((N-e.min.x)/i.x,(W-e.min.y)/i.y+u),new THREE.Vector2((U-e.min.x)/i.x,(k-e.min.y)/i.y+u),new THREE.Vector2((z-e.min.x)/i.x,(_-e.min.y)/i.y+u)]},generateSideWallUV:function(j,p,S,M,R,N){var W=p[S*3],U=p[S*3+1],k=p[S*3+2],z=p[M*3],_=p[M*3+1],w=p[M*3+2],n=p[R*3],s=p[R*3+1],o=p[R*3+2],e=p[N*3],i=p[N*3+1],u=p[N*3+2],h;if(d.has(p))h=d.get(p);else{var v=new THREE.Box3;v.setFromArray(p);var P=v.getSize(new THREE.Vector3);L.split&&(P.z/=1-L.split),h={box:v,size:P},d.set(p,h)}var g=h.box,m=h.size;return Math.abs(U-_)<Math.abs(W-z)?[new THREE.Vector2((W-g.min.x)/m.x,(k-g.min.z)/m.z),new THREE.Vector2((z-g.min.x)/m.x,(w-g.min.z)/m.z),new THREE.Vector2((n-g.min.x)/m.x,(o-g.min.z)/m.z),new THREE.Vector2((e-g.min.x)/m.x,(u-g.min.z)/m.z)]:[new THREE.Vector2((U-g.min.y)/m.y,(k-g.min.z)/m.z),new THREE.Vector2((_-g.min.y)/m.y,(w-g.min.z)/m.z),new THREE.Vector2((s-g.min.y)/m.y,(o-g.min.z)/m.z),new THREE.Vector2((i-g.min.y)/m.y,(u-g.min.z)/m.z)]}}},E=function(){d.clear()}},644:function(y){"use strict";y.exports=require("three")},568:function(y,b,f){"use strict";f.d(b,{Z:function(){return T}});function A(d,O,E,L,j,p,S){try{var M=d[p](S),R=M.value}catch(N){E(N);return}M.done?O(R):Promise.resolve(R).then(L,j)}function T(d){return function(){var O=this,E=arguments;return new Promise(function(L,j){var p=d.apply(O,E);function S(R){A(p,L,j,S,M,"next",R)}function M(R){A(p,L,j,S,M,"throw",R)}S(void 0)})}}},924:function(y,b,f){"use strict";f.d(b,{Z:function(){return A}});function A(T,d,O){return d in T?Object.defineProperty(T,d,{value:O,enumerable:!0,configurable:!0,writable:!0}):T[d]=O,T}},42:function(y,b,f){"use strict";f.d(b,{Z:function(){return T}});var A=f(924);function T(d){for(var O=1;O<arguments.length;O++){var E=arguments[O]!=null?arguments[O]:{},L=Object.keys(E);typeof Object.getOwnPropertySymbols=="function"&&(L=L.concat(Object.getOwnPropertySymbols(E).filter(function(j){return Object.getOwnPropertyDescriptor(E,j).enumerable}))),L.forEach(function(j){(0,A.Z)(d,j,E[j])})}return d}}},Y={};function x(y){var b=Y[y];if(b!==void 0)return b.exports;var f=Y[y]={exports:{}};return X[y](f,f.exports,x),f.exports}(function(){x.n=function(y){var b=y&&y.__esModule?function(){return y.default}:function(){return y};return x.d(b,{a:b}),b}})(),function(){x.d=function(y,b){for(var f in b)x.o(b,f)&&!x.o(y,f)&&Object.defineProperty(y,f,{enumerable:!0,get:b[f]})}}(),function(){x.o=function(y,b){return Object.prototype.hasOwnProperty.call(y,b)}}(),function(){x.r=function(y){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(y,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(y,"__esModule",{value:!0})}}();var $={};(function(){"use strict";x.r($),x.d($,{Cache:function(){return f},Data:function(){return _},Draw:function(){return z},Wk:function(){return w}});function y(n,s){if(!(n instanceof s))throw new TypeError("Cannot call a class as a function")}var b=x(519),f=function(){"use strict";function n(){y(this,n),this.cache=new Map}var s=n.prototype;return s.install=function(){},s.init=function(e){var i=(0,b.makePromiseCreator)();this.cache.set(e,i)},s.get=function(e){var i;return(i=this.cache.get(e))===null||i===void 0?void 0:i.promise},s.set=function(e,i){var u=this.cache.get(e);u?u.resolve(i):console.warn("init cache first")},s.dispose=function(){this.cache.forEach(function(e,i){e.reject("stop set cache:".concat(i))}),this.cache.clear()},n}(),A=x(568);function T(n,s){for(var o=0;o<s.length;o++){var e=s[o];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(n,e.key,e)}}function d(n,s,o){return s&&T(n.prototype,s),o&&T(n,o),n}function O(n){if(Array.isArray(n))return n}function E(n){if(typeof Symbol!="undefined"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)}function L(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function j(n,s){(s==null||s>n.length)&&(s=n.length);for(var o=0,e=new Array(s);o<s;o++)e[o]=n[o];return e}function p(n,s){if(!!n){if(typeof n=="string")return j(n,s);var o=Object.prototype.toString.call(n).slice(8,-1);if(o==="Object"&&n.constructor&&(o=n.constructor.name),o==="Map"||o==="Set")return Array.from(o);if(o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return j(n,s)}}function S(n,s){return O(n)||E(n,s)||p(n,s)||L()}function M(n){if(Array.isArray(n))return j(n)}function R(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function N(n){return M(n)||E(n)||p(n)||R()}var W=x(666),U=x.n(W),k=x(644),z=function(){"use strict";function n(o){y(this,n),this.objectNamesToFactories=new Map,this.objects=new Map,this.objects_=o}var s=n.prototype;return s.install=function(e){this.pencil=e,this.initObjectFactories()},s.initObjectFactories=function(){var e=this,i=this.objects_;Object.keys(i).forEach(function(u){var h=function(){function v(){y(this,v)}var P=v.prototype;return P.create=function(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new i[u](m)},v}();e.objectNamesToFactories.set(u,h)})},s.getObject=function(e,i){e.includes("#")&&console.warn("getObject:err:\u4E0D\u652F\u6301 #",e);var u=(i||{}).key,h="".concat(e).concat(u?"#".concat(u):""),v=this.objects.get(h);return v},s.getAllObject=function(e,i){e.includes("#")&&console.warn("getAllObject:err:\u4E0D\u652F\u6301 #",e);var u=(i||{}).key,h="".concat(e).concat(u?"#".concat(u):""),v=[];return this.objects.forEach(function(P,g){(g.startsWith("".concat(h,"#"))||g===h)&&v.push(P)}),v},s.draw=function(e,i,u){var h=this;return(0,A.Z)(U().mark(function v(){var P,g,m,Z,G,r,t;return U().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(P=h.objectNamesToFactories.get(e),!P){c.next=15;break}return g=(i||{}).key,m="".concat(e).concat(g?"#".concat(g):""),h.objects.has(m)&&(Z=k.MathUtils.generateUUID(),m+="#".concat(Z)),G=(i==null?void 0:i.target)||u,typeof G=="string"?r=h.objects.get(G):(G==null?void 0:G.objecttype__)==="BaseObject"?r=G:r=h.pencil.scene,t=new P().create(i),t.pencil=h.pencil,t.key=m,h.objects.set(m,t),c.next=14,h.addMesh(t,r);case 14:return c.abrupt("return",t);case 15:throw new Error("Unrecognized:".concat(e));case 16:case"end":return c.stop()}},v)}))()},s.addMesh=function(e,i){return(0,A.Z)(U().mark(function u(){return U().wrap(function(v){for(;;)switch(v.prev=v.next){case 0:return v.next=2,e.create();case 2:e.object3d&&(e.object3d.userData.BaseObject_=e,i.add(e.object3d)),e.visible=!0,e.render(),e.pm.resolve();case 6:case"end":return v.stop()}},u)}))()},s.erase=function(){for(var e=arguments.length,i=new Array(e),u=0;u<e;u++)i[u]=arguments[u];var h=this;N(i).forEach(function(v){var P=[];if(typeof v=="string"){var g,m=S(v.split("#"),2),Z=m[0],G=m[1];(g=P).push.apply(g,N(h.getAllObject(Z,{key:G})))}else P.push(v);P.forEach(function(r){h.removeMesh(r)})})},s.removeMesh=function(e){var i=this,u=e.parent;e.object3d&&u.remove(e.object3d),e.traverse(function(h){h.visible=!1,h.dispose(),i.objects.delete(h.key)})},s.update=function(e,i){this.objects.forEach(function(u){u.update(e,i)})},s.setSize=function(e,i){this.objects.forEach(function(u){u.resize(e,i)})},s.dispose=function(){this.objects.forEach(function(e,i){e.dispose(),e.pm.reject("stop draw:".concat(i))}),this.objects.clear(),this.objectNamesToFactories.clear()},d(n,[{key:"objectsPromise",get:function(){var e=[];return this.objects.forEach(function(i){e.push(i.pm.promise)}),e}}]),n}(),_=function(){"use strict";function n(){y(this,n),this.data={}}var s=n.prototype;return s.install=function(){},s.setData=function(e,i){var u,h;this.data[e]=i,(h=(u=this).cb)===null||h===void 0||h.call(u,e)},s.runAll=function(){var e=this;Object.keys(this.data).forEach(function(i){var u,h;(h=(u=e).cb)===null||h===void 0||h.call(u,i)})},s.dispose=function(){this.data={},this.cb=void 0},n}(),w=function(){"use strict";function n(){y(this,n),this.messageList=[]}var s=n.prototype;return s.install=function(){},s.init=function(e,i){var u=this;this.workerList=Array.from({length:i},function(h,v){var P=typeof e=="string"?new Worker(e):e();return P.onmessage=function(g){var m=g.data,Z=m.res,G=m.uuid,r=u.messageList.find(function(t){var a=t.uuid;return G===a});r==null||r.cb(Z),u.workerList[v].inUse=!1,u.checkMessage()},{worker:P,inUse:!1}})},s.postMessage=function(e,i){this.messageList.push({req:e,cb:i,uuid:k.MathUtils.generateUUID(),inUse:!1}),this.checkMessage()},s.checkMessage=function(){var e=this.workerList.find(function(u){var h=u.inUse;return!h});if(e){var i=this.messageList.find(function(u){var h=u.inUse;return!h});i&&(i.inUse=!0,e.inUse=!0,e.worker.postMessage({req:i.req,uuid:i.uuid}))}},s.dispose=function(){this.workerList.forEach(function(e){var i=e.worker;i.terminate()}),this.workerList=[],this.messageList=[]},n}()})(),module.exports=$})();
1
+ (function(){var X={666:function(_){var g=function(v){"use strict";var S=Object.prototype,j=S.hasOwnProperty,d,T=typeof Symbol=="function"?Symbol:{},b=T.iterator||"@@iterator",O=T.asyncIterator||"@@asyncIterator",w=T.toStringTag||"@@toStringTag";function p(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{p({},"")}catch(e){p=function(t,n,h){return t[n]=h}}function M(e,t,n,h){var c=t&&t.prototype instanceof G?t:G,L=Object.create(c.prototype),k=new f(h||[]);return L._invoke=r(e,n,k),L}v.wrap=M;function C(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(h){return{type:"throw",arg:h}}}var R="suspendedStart",Z="suspendedYield",W="executing",I="completed",E={};function G(){}function y(){}function m(){}var P={};p(P,b,function(){return this});var D=Object.getPrototypeOf,z=D&&D(D(A([])));z&&z!==S&&j.call(z,b)&&(P=z);var a=m.prototype=G.prototype=Object.create(P);y.prototype=m,p(a,"constructor",m),p(m,"constructor",y),y.displayName=p(m,w,"GeneratorFunction");function i(e){["next","throw","return"].forEach(function(t){p(e,t,function(n){return this._invoke(t,n)})})}v.isGeneratorFunction=function(e){var t=typeof e=="function"&&e.constructor;return t?t===y||(t.displayName||t.name)==="GeneratorFunction":!1},v.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,p(e,w,"GeneratorFunction")),e.prototype=Object.create(a),e},v.awrap=function(e){return{__await:e}};function o(e,t){function n(L,k,V,H){var N=C(e[L],e,k);if(N.type==="throw")H(N.arg);else{var $=N.arg,B=$.value;return B&&typeof B=="object"&&j.call(B,"__await")?t.resolve(B.__await).then(function(F){n("next",F,V,H)},function(F){n("throw",F,V,H)}):t.resolve(B).then(function(F){$.value=F,V($)},function(F){return n("throw",F,V,H)})}}var h;function c(L,k){function V(){return new t(function(H,N){n(L,k,H,N)})}return h=h?h.then(V,V):V()}this._invoke=c}i(o.prototype),p(o.prototype,O,function(){return this}),v.AsyncIterator=o,v.async=function(e,t,n,h,c){c===void 0&&(c=Promise);var L=new o(M(e,t,n,h),c);return v.isGeneratorFunction(t)?L:L.next().then(function(k){return k.done?k.value:L.next()})};function r(e,t,n){var h=R;return function(L,k){if(h===W)throw new Error("Generator is already running");if(h===I){if(L==="throw")throw k;return U()}for(n.method=L,n.arg=k;;){var V=n.delegate;if(V){var H=s(V,n);if(H){if(H===E)continue;return H}}if(n.method==="next")n.sent=n._sent=n.arg;else if(n.method==="throw"){if(h===R)throw h=I,n.arg;n.dispatchException(n.arg)}else n.method==="return"&&n.abrupt("return",n.arg);h=W;var N=C(e,t,n);if(N.type==="normal"){if(h=n.done?I:Z,N.arg===E)continue;return{value:N.arg,done:n.done}}else N.type==="throw"&&(h=I,n.method="throw",n.arg=N.arg)}}}function s(e,t){var n=e.iterator[t.method];if(n===d){if(t.delegate=null,t.method==="throw"){if(e.iterator.return&&(t.method="return",t.arg=d,s(e,t),t.method==="throw"))return E;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return E}var h=C(n,e.iterator,t.arg);if(h.type==="throw")return t.method="throw",t.arg=h.arg,t.delegate=null,E;var c=h.arg;if(!c)return t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,E;if(c.done)t[e.resultName]=c.value,t.next=e.nextLoc,t.method!=="return"&&(t.method="next",t.arg=d);else return c;return t.delegate=null,E}i(a),p(a,w,"Generator"),p(a,b,function(){return this}),p(a,"toString",function(){return"[object Generator]"});function l(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function u(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function f(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(l,this),this.reset(!0)}v.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function h(){for(;t.length;){var c=t.pop();if(c in e)return h.value=c,h.done=!1,h}return h.done=!0,h}};function A(e){if(e){var t=e[b];if(t)return t.call(e);if(typeof e.next=="function")return e;if(!isNaN(e.length)){var n=-1,h=function c(){for(;++n<e.length;)if(j.call(e,n))return c.value=e[n],c.done=!1,c;return c.value=d,c.done=!0,c};return h.next=h}}return{next:U}}v.values=A;function U(){return{value:d,done:!0}}return f.prototype={constructor:f,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=d,this.done=!1,this.delegate=null,this.method="next",this.arg=d,this.tryEntries.forEach(u),!e)for(var t in this)t.charAt(0)==="t"&&j.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=d)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if(t.type==="throw")throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(H,N){return L.type="throw",L.arg=e,t.next=H,N&&(t.method="next",t.arg=d),!!N}for(var h=this.tryEntries.length-1;h>=0;--h){var c=this.tryEntries[h],L=c.completion;if(c.tryLoc==="root")return n("end");if(c.tryLoc<=this.prev){var k=j.call(c,"catchLoc"),V=j.call(c,"finallyLoc");if(k&&V){if(this.prev<c.catchLoc)return n(c.catchLoc,!0);if(this.prev<c.finallyLoc)return n(c.finallyLoc)}else if(k){if(this.prev<c.catchLoc)return n(c.catchLoc,!0)}else if(V){if(this.prev<c.finallyLoc)return n(c.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var h=this.tryEntries[n];if(h.tryLoc<=this.prev&&j.call(h,"finallyLoc")&&this.prev<h.finallyLoc){var c=h;break}}c&&(e==="break"||e==="continue")&&c.tryLoc<=t&&t<=c.finallyLoc&&(c=null);var L=c?c.completion:{};return L.type=e,L.arg=t,c?(this.method="next",this.next=c.finallyLoc,E):this.complete(L)},complete:function(e,t){if(e.type==="throw")throw e.arg;return e.type==="break"||e.type==="continue"?this.next=e.arg:e.type==="return"?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):e.type==="normal"&&t&&(this.next=t),E},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),u(n),E}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var h=n.completion;if(h.type==="throw"){var c=h.arg;u(n)}return c}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:A(e),resultName:t,nextLoc:n},this.method==="next"&&(this.arg=d),E}},v}(_.exports);try{regeneratorRuntime=g}catch(v){typeof globalThis=="object"?globalThis.regeneratorRuntime=g:Function("r","regeneratorRuntime = r")(g)}},584:function(_,g,v){"use strict";v.d(g,{makePromiseCreator:function(){return S.Z}});var S=v(282),j=v(666),d=v.n(j),T=null,b=v(644);function O(E){if(E.material){var G=Array.isArray(E.material)?E.material:[E.material];G.forEach(function(y){var m,P;(m=y.color)===null||m===void 0||m.convertSRGBToLinear(),(P=y.emissive)===null||P===void 0||P.convertSRGBToLinear(),y.map&&(y.map.encoding=THREE.sRGBEncoding),y.emissiveMap&&(y.emissiveMap.encoding=THREE.sRGBEncoding)})}}var w=v(568),p=v(924),M=v(360),C=v(484),R=null,Z=null,W=function(){var E=(0,w.Z)(d().mark(function G(y,m){var P,D,z,a,i,o,r,s,l;return d().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:return P=m.type,D=P===void 0?"blob":P,z=m.version,a=z===void 0?"1":z,f.next=4,(0,M.get)(y);case 4:if(o=f.sent,!(o&&o[a])){f.next=9;break}i=o[a],f.next=15;break;case 9:return f.next=11,(0,C.Z)(fetch(y).then(function(A){if(A.ok)return A[D]();throw new Error}));case 11:r=f.sent,s=r.res,l=r.err,l||(i=s,(0,M.set)(y,(0,p.Z)({},a,s)));case 15:return f.abrupt("return",i?{url:D==="json"?y:URL.createObjectURL(i),store:i}:{url:y});case 16:case"end":return f.stop()}},G)}));return function(y,m){return E.apply(this,arguments)}}(),I=v(705)},282:function(_,g,v){"use strict";v.d(g,{Z:function(){return j}});var S=v(484);function j(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},b={};return b.promise=new Promise(function(O,w){b.resolve=O,b.reject=w}),d&&(b.promise=(0,S.Z)(b.promise,T)),b}},484:function(_,g,v){"use strict";v.d(g,{Z:function(){return j}});var S=v(42);function j(d){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return d.then(function(b){return(0,S.Z)({err:null,res:b},T)}).catch(function(b){return(0,S.Z)({err:b,res:void 0},T)})}},705:function(_,g,v){"use strict";var S=v(644),j=v.n(S),d=new Map,T=function(){var O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{generateTopUV:function(w,p,M,C,R){var Z=p[M*3],W=p[M*3+1],I=p[C*3],E=p[C*3+1],G=p[R*3],y=p[R*3+1],m;if(d.has(w))m=d.get(w);else{var P=O.box3||new THREE.Box3;if(!O.box3){var D=w.parameters.shapes.getPoints();P.setFromArray(D.map(function(r){return[r.x,r.y,0]}).flat())}var z=P.getSize(new THREE.Vector3);O.split&&(z.y/=O.split),m={box:P,size:z},d.set(w,m)}var a=m.box,i=m.size,o=O.split?1-O.split:0;return[new THREE.Vector2((Z-a.min.x)/i.x,(W-a.min.y)/i.y+o),new THREE.Vector2((I-a.min.x)/i.x,(E-a.min.y)/i.y+o),new THREE.Vector2((G-a.min.x)/i.x,(y-a.min.y)/i.y+o)]},generateSideWallUV:function(w,p,M,C,R,Z){var W=p[M*3],I=p[M*3+1],E=p[M*3+2],G=p[C*3],y=p[C*3+1],m=p[C*3+2],P=p[R*3],D=p[R*3+1],z=p[R*3+2],a=p[Z*3],i=p[Z*3+1],o=p[Z*3+2],r;if(d.has(p))r=d.get(p);else{var s=new THREE.Box3;s.setFromArray(p);var l=s.getSize(new THREE.Vector3);O.split&&(l.z/=1-O.split),r={box:s,size:l},d.set(p,r)}var u=r.box,f=r.size;return Math.abs(I-y)<Math.abs(W-G)?[new THREE.Vector2((W-u.min.x)/f.x,(E-u.min.z)/f.z),new THREE.Vector2((G-u.min.x)/f.x,(m-u.min.z)/f.z),new THREE.Vector2((P-u.min.x)/f.x,(z-u.min.z)/f.z),new THREE.Vector2((a-u.min.x)/f.x,(o-u.min.z)/f.z)]:[new THREE.Vector2((I-u.min.y)/f.y,(E-u.min.z)/f.z),new THREE.Vector2((y-u.min.y)/f.y,(m-u.min.z)/f.z),new THREE.Vector2((D-u.min.y)/f.y,(z-u.min.z)/f.z),new THREE.Vector2((i-u.min.y)/f.y,(o-u.min.z)/f.z)]}}},b=function(){d.clear()}},360:function(_){"use strict";_.exports=require("idb-keyval")},644:function(_){"use strict";_.exports=require("three")},568:function(_,g,v){"use strict";v.d(g,{Z:function(){return j}});function S(d,T,b,O,w,p,M){try{var C=d[p](M),R=C.value}catch(Z){b(Z);return}C.done?T(R):Promise.resolve(R).then(O,w)}function j(d){return function(){var T=this,b=arguments;return new Promise(function(O,w){var p=d.apply(T,b);function M(R){S(p,O,w,M,C,"next",R)}function C(R){S(p,O,w,M,C,"throw",R)}M(void 0)})}}},924:function(_,g,v){"use strict";v.d(g,{Z:function(){return S}});function S(j,d,T){return d in j?Object.defineProperty(j,d,{value:T,enumerable:!0,configurable:!0,writable:!0}):j[d]=T,j}},42:function(_,g,v){"use strict";v.d(g,{Z:function(){return j}});var S=v(924);function j(d){for(var T=1;T<arguments.length;T++){var b=arguments[T]!=null?arguments[T]:{},O=Object.keys(b);typeof Object.getOwnPropertySymbols=="function"&&(O=O.concat(Object.getOwnPropertySymbols(b).filter(function(w){return Object.getOwnPropertyDescriptor(b,w).enumerable}))),O.forEach(function(w){(0,S.Z)(d,w,b[w])})}return d}}},Y={};function x(_){var g=Y[_];if(g!==void 0)return g.exports;var v=Y[_]={exports:{}};return X[_](v,v.exports,x),v.exports}(function(){x.n=function(_){var g=_&&_.__esModule?function(){return _.default}:function(){return _};return x.d(g,{a:g}),g}})(),function(){x.d=function(_,g){for(var v in g)x.o(g,v)&&!x.o(_,v)&&Object.defineProperty(_,v,{enumerable:!0,get:g[v]})}}(),function(){x.o=function(_,g){return Object.prototype.hasOwnProperty.call(_,g)}}(),function(){x.r=function(_){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(_,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(_,"__esModule",{value:!0})}}();var K={};(function(){"use strict";x.r(K),x.d(K,{Cache:function(){return v},Data:function(){return y},Draw:function(){return G},Wk:function(){return z}});function _(a,i){if(!(a instanceof i))throw new TypeError("Cannot call a class as a function")}var g=x(584),v=function(){"use strict";function a(){_(this,a),this.cache=new Map}var i=a.prototype;return i.install=function(){},i.init=function(r){var s=(0,g.makePromiseCreator)();this.cache.set(r,s)},i.get=function(r){var s;return(s=this.cache.get(r))===null||s===void 0?void 0:s.promise},i.set=function(r,s){var l=this.cache.get(r);l?l.resolve(s):console.warn("init cache first")},i.dispose=function(){this.cache.forEach(function(r,s){r.reject("stop set cache:".concat(s))}),this.cache.clear()},a}(),S=x(568);function j(a,i){for(var o=0;o<i.length;o++){var r=i[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(a,r.key,r)}}function d(a,i,o){return i&&j(a.prototype,i),o&&j(a,o),a}function T(a){if(Array.isArray(a))return a}function b(a){if(typeof Symbol!="undefined"&&a[Symbol.iterator]!=null||a["@@iterator"]!=null)return Array.from(a)}function O(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function w(a,i){(i==null||i>a.length)&&(i=a.length);for(var o=0,r=new Array(i);o<i;o++)r[o]=a[o];return r}function p(a,i){if(!!a){if(typeof a=="string")return w(a,i);var o=Object.prototype.toString.call(a).slice(8,-1);if(o==="Object"&&a.constructor&&(o=a.constructor.name),o==="Map"||o==="Set")return Array.from(o);if(o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return w(a,i)}}function M(a,i){return T(a)||b(a,i)||p(a,i)||O()}function C(a){if(Array.isArray(a))return w(a)}function R(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Z(a){return C(a)||b(a)||p(a)||R()}var W=x(666),I=x.n(W),E=x(644),G=function(){"use strict";function a(o){_(this,a),this.objectNamesToFactories=new Map,this.objects=new Map,this.objects_=o}var i=a.prototype;return i.install=function(r){this.pencil=r,this.initObjectFactories()},i.initObjectFactories=function(){var r=this,s=this.objects_;Object.keys(s).forEach(function(l){var u=function(){function f(){_(this,f)}var A=f.prototype;return A.create=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new s[l](e)},f}();r.objectNamesToFactories.set(l,u)})},i.getObject=function(r,s){r.includes("#")&&console.warn("getObject:err:\u4E0D\u652F\u6301 #",r);var l=(s||{}).key,u="".concat(r).concat(l?"#".concat(l):""),f=this.objects.get(u);return f},i.getAllObject=function(r,s){r.includes("#")&&console.warn("getAllObject:err:\u4E0D\u652F\u6301 #",r);var l=(s||{}).key,u="".concat(r).concat(l?"#".concat(l):""),f=[];return this.objects.forEach(function(A,U){(U.startsWith("".concat(u,"#"))||U===u)&&f.push(A)}),f},i.draw=function(r,s,l){var u=this;return(0,S.Z)(I().mark(function f(){var A,U,e,t,n,h,c;return I().wrap(function(k){for(;;)switch(k.prev=k.next){case 0:if(A=u.objectNamesToFactories.get(r),!A){k.next=15;break}return U=(s||{}).key,e="".concat(r).concat(U?"#".concat(U):""),u.objects.has(e)&&(t=E.MathUtils.generateUUID(),e+="#".concat(t)),n=(s==null?void 0:s.target)||l,typeof n=="string"?h=u.objects.get(n):(n==null?void 0:n.objecttype__)==="BaseObject"?h=n:h=u.pencil.scene,c=new A().create(s),c.pencil=u.pencil,c.key=e,u.objects.set(e,c),k.next=14,u.addMesh(c,h);case 14:return k.abrupt("return",c);case 15:throw new Error("Unrecognized:".concat(r));case 16:case"end":return k.stop()}},f)}))()},i.addMesh=function(r,s){return(0,S.Z)(I().mark(function l(){return I().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:return f.next=2,r.create();case 2:r.object3d&&(r.object3d.userData.BaseObject_=r,s.add(r.object3d)),r.visible=!0,r.render(),r.pm.resolve();case 6:case"end":return f.stop()}},l)}))()},i.erase=function(){for(var r=arguments.length,s=new Array(r),l=0;l<r;l++)s[l]=arguments[l];var u=this;Z(s).forEach(function(f){var A=[];if(typeof f=="string"){var U,e=M(f.split("#"),2),t=e[0],n=e[1];(U=A).push.apply(U,Z(u.getAllObject(t,{key:n})))}else A.push(f);A.forEach(function(h){u.removeMesh(h)})})},i.removeMesh=function(r){var s=this,l=r.parent;r.object3d&&l.remove(r.object3d),r.traverse(function(u){u.visible=!1,u.dispose(),s.objects.delete(u.key)})},i.update=function(r,s){this.objects.forEach(function(l){l.update(r,s)})},i.setSize=function(r,s){this.objects.forEach(function(l){l.resize(r,s)})},i.dispose=function(){this.objects.forEach(function(r,s){r.dispose(),r.pm.reject("stop draw:".concat(s))}),this.objects.clear(),this.objectNamesToFactories.clear()},d(a,[{key:"objectsPromise",get:function(){var r=[];return this.objects.forEach(function(s){r.push(s.pm.promise)}),r}}]),a}(),y=function(){"use strict";function a(){_(this,a),this.data={}}var i=a.prototype;return i.install=function(){},i.setData=function(r,s){var l,u;this.data[r]=s,(u=(l=this).cb)===null||u===void 0||u.call(l,r)},i.runAll=function(){var r=this;Object.keys(this.data).forEach(function(s){var l,u;(u=(l=r).cb)===null||u===void 0||u.call(l,s)})},i.dispose=function(){this.data={},this.cb=void 0},a}(),m=x(924),P=x(42),D=x(360),z=function(){"use strict";function a(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};_(this,a),this.messageList=[],this.options=(0,P.Z)({},{cache:!1,cacheVersion:"1"},o)}var i=a.prototype;return i.install=function(){},i.init=function(r,s){var l=this,u=this.options,f=u.cache,A=u.cacheVersion;this.workerList=Array.from({length:s},function(U,e){var t=typeof r=="string"?new Worker(r):r();return t.onmessage=function(n){var h=n.data,c=h.res,L=h.uuid,k=l.messageList.find(function(V){var H=V.uuid;return L===H});k==null||k.cb(c),l.workerList[e].inUse=!1,l.checkMessage(),f&&(0,D.set)(L,(0,m.Z)({},A,c))},{worker:t,inUse:!1}})},i.postMessage=function(r,s){var l=this,u=this.options,f=u.cache,A=u.cacheVersion;if(f&&!r.workerKey){console.warn("worker cache need workerKey");return}var U=r.workerKey||E.MathUtils.generateUUID();(f?(0,D.get)(U):Promise.resolve()).then(function(e){e&&e[A]?s(e[A]):(l.messageList.push({req:r,cb:s,uuid:U,inUse:!1}),l.checkMessage())})},i.checkMessage=function(){var r=this.workerList.find(function(l){var u=l.inUse;return!u});if(r){var s=this.messageList.find(function(l){var u=l.inUse;return!u});s&&(s.inUse=!0,r.inUse=!0,r.worker.postMessage({req:s.req,uuid:s.uuid}))}},i.dispose=function(){this.workerList.forEach(function(r){var s=r.worker;s.terminate()}),this.workerList=[],this.messageList=[]},a}()})(),module.exports=K})();
@@ -1 +1 @@
1
- import*as X from"idb-keyval";import*as J from"three";var Q={666:function(b){var g=function(f){"use strict";var T=Object.prototype,m=T.hasOwnProperty,d,j=typeof Symbol=="function"?Symbol:{},_=j.iterator||"@@iterator",O=j.asyncIterator||"@@asyncIterator",p=j.toStringTag||"@@toStringTag";function E(r,t,o){return Object.defineProperty(r,t,{value:o,enumerable:!0,configurable:!0,writable:!0}),r[t]}try{E({},"")}catch(r){E=function(t,o,c){return t[o]=c}}function S(r,t,o,c){var h=t&&t.prototype instanceof V?t:V,x=Object.create(h.prototype),U=new P(c||[]);return x._invoke=l(r,o,U),x}f.wrap=S;function C(r,t,o){try{return{type:"normal",arg:r.call(t,o)}}catch(c){return{type:"throw",arg:c}}}var A="suspendedStart",H="suspendedYield",W="executing",R="completed",M={};function V(){}function k(){}function L(){}var n={};E(n,_,function(){return this});var i=Object.getPrototypeOf,a=i&&i(i(Z([])));a&&a!==T&&m.call(a,_)&&(n=a);var e=L.prototype=V.prototype=Object.create(n);k.prototype=L,E(e,"constructor",L),E(L,"constructor",k),k.displayName=E(L,p,"GeneratorFunction");function s(r){["next","throw","return"].forEach(function(t){E(r,t,function(o){return this._invoke(t,o)})})}f.isGeneratorFunction=function(r){var t=typeof r=="function"&&r.constructor;return t?t===k||(t.displayName||t.name)==="GeneratorFunction":!1},f.mark=function(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,L):(r.__proto__=L,E(r,p,"GeneratorFunction")),r.prototype=Object.create(e),r},f.awrap=function(r){return{__await:r}};function u(r,t){function o(x,U,G,N){var D=C(r[x],r,U);if(D.type==="throw")N(D.arg);else{var $=D.arg,F=$.value;return F&&typeof F=="object"&&m.call(F,"__await")?t.resolve(F.__await).then(function(B){o("next",B,G,N)},function(B){o("throw",B,G,N)}):t.resolve(F).then(function(B){$.value=B,G($)},function(B){return o("throw",B,G,N)})}}var c;function h(x,U){function G(){return new t(function(N,D){o(x,U,N,D)})}return c=c?c.then(G,G):G()}this._invoke=h}s(u.prototype),E(u.prototype,O,function(){return this}),f.AsyncIterator=u,f.async=function(r,t,o,c,h){h===void 0&&(h=Promise);var x=new u(S(r,t,o,c),h);return f.isGeneratorFunction(t)?x:x.next().then(function(U){return U.done?U.value:x.next()})};function l(r,t,o){var c=A;return function(x,U){if(c===W)throw new Error("Generator is already running");if(c===R){if(x==="throw")throw U;return z()}for(o.method=x,o.arg=U;;){var G=o.delegate;if(G){var N=w(G,o);if(N){if(N===M)continue;return N}}if(o.method==="next")o.sent=o._sent=o.arg;else if(o.method==="throw"){if(c===A)throw c=R,o.arg;o.dispatchException(o.arg)}else o.method==="return"&&o.abrupt("return",o.arg);c=W;var D=C(r,t,o);if(D.type==="normal"){if(c=o.done?R:H,D.arg===M)continue;return{value:D.arg,done:o.done}}else D.type==="throw"&&(c=R,o.method="throw",o.arg=D.arg)}}}function w(r,t){var o=r.iterator[t.method];if(o===d){if(t.delegate=null,t.method==="throw"){if(r.iterator.return&&(t.method="return",t.arg=d,w(r,t),t.method==="throw"))return M;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return M}var c=C(o,r.iterator,t.arg);if(c.type==="throw")return t.method="throw",t.arg=c.arg,t.delegate=null,M;var h=c.arg;if(!h)return t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,M;if(h.done)t[r.resultName]=h.value,t.next=r.nextLoc,t.method!=="return"&&(t.method="next",t.arg=d);else return h;return t.delegate=null,M}s(e),E(e,p,"Generator"),E(e,_,function(){return this}),E(e,"toString",function(){return"[object Generator]"});function y(r){var t={tryLoc:r[0]};1 in r&&(t.catchLoc=r[1]),2 in r&&(t.finallyLoc=r[2],t.afterLoc=r[3]),this.tryEntries.push(t)}function v(r){var t=r.completion||{};t.type="normal",delete t.arg,r.completion=t}function P(r){this.tryEntries=[{tryLoc:"root"}],r.forEach(y,this),this.reset(!0)}f.keys=function(r){var t=[];for(var o in r)t.push(o);return t.reverse(),function c(){for(;t.length;){var h=t.pop();if(h in r)return c.value=h,c.done=!1,c}return c.done=!0,c}};function Z(r){if(r){var t=r[_];if(t)return t.call(r);if(typeof r.next=="function")return r;if(!isNaN(r.length)){var o=-1,c=function h(){for(;++o<r.length;)if(m.call(r,o))return h.value=r[o],h.done=!1,h;return h.value=d,h.done=!0,h};return c.next=c}}return{next:z}}f.values=Z;function z(){return{value:d,done:!0}}return P.prototype={constructor:P,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=d,this.done=!1,this.delegate=null,this.method="next",this.arg=d,this.tryEntries.forEach(v),!r)for(var t in this)t.charAt(0)==="t"&&m.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=d)},stop:function(){this.done=!0;var r=this.tryEntries[0],t=r.completion;if(t.type==="throw")throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var t=this;function o(N,D){return x.type="throw",x.arg=r,t.next=N,D&&(t.method="next",t.arg=d),!!D}for(var c=this.tryEntries.length-1;c>=0;--c){var h=this.tryEntries[c],x=h.completion;if(h.tryLoc==="root")return o("end");if(h.tryLoc<=this.prev){var U=m.call(h,"catchLoc"),G=m.call(h,"finallyLoc");if(U&&G){if(this.prev<h.catchLoc)return o(h.catchLoc,!0);if(this.prev<h.finallyLoc)return o(h.finallyLoc)}else if(U){if(this.prev<h.catchLoc)return o(h.catchLoc,!0)}else if(G){if(this.prev<h.finallyLoc)return o(h.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(r,t){for(var o=this.tryEntries.length-1;o>=0;--o){var c=this.tryEntries[o];if(c.tryLoc<=this.prev&&m.call(c,"finallyLoc")&&this.prev<c.finallyLoc){var h=c;break}}h&&(r==="break"||r==="continue")&&h.tryLoc<=t&&t<=h.finallyLoc&&(h=null);var x=h?h.completion:{};return x.type=r,x.arg=t,h?(this.method="next",this.next=h.finallyLoc,M):this.complete(x)},complete:function(r,t){if(r.type==="throw")throw r.arg;return r.type==="break"||r.type==="continue"?this.next=r.arg:r.type==="return"?(this.rval=this.arg=r.arg,this.method="return",this.next="end"):r.type==="normal"&&t&&(this.next=t),M},finish:function(r){for(var t=this.tryEntries.length-1;t>=0;--t){var o=this.tryEntries[t];if(o.finallyLoc===r)return this.complete(o.completion,o.afterLoc),v(o),M}},catch:function(r){for(var t=this.tryEntries.length-1;t>=0;--t){var o=this.tryEntries[t];if(o.tryLoc===r){var c=o.completion;if(c.type==="throw"){var h=c.arg;v(o)}return h}}throw new Error("illegal catch attempt")},delegateYield:function(r,t,o){return this.delegate={iterator:Z(r),resultName:t,nextLoc:o},this.method==="next"&&(this.arg=d),M}},f}(b.exports);try{regeneratorRuntime=g}catch(f){typeof globalThis=="object"?globalThis.regeneratorRuntime=g:Function("r","regeneratorRuntime = r")(g)}},521:function(b,g,f){f.d(g,{Mf:function(){return T.Z}});var T=f(282),m=f(666),d=f.n(m),j=null,_=f(949);function O(k){if(k.material){var L=Array.isArray(k.material)?k.material:[k.material];L.forEach(function(n){var i,a;(i=n.color)===null||i===void 0||i.convertSRGBToLinear(),(a=n.emissive)===null||a===void 0||a.convertSRGBToLinear(),n.map&&(n.map.encoding=THREE.sRGBEncoding),n.emissiveMap&&(n.emissiveMap.encoding=THREE.sRGBEncoding)})}}var p=f(568),E=f(924),S=k=>{var L={};return f.d(L,k),L},C=k=>()=>k,A=S({get:()=>X.get,set:()=>X.set}),H=f(484),W=null,R=null,M=function(){var k=(0,p.Z)(d().mark(function L(n,i){var a,e,s,u,l,w;return d().wrap(function(v){for(;;)switch(v.prev=v.next){case 0:return a=i.version,v.next=4,(0,A.get)(n);case 4:if(s=v.sent,!(s&&s[a])){v.next=9;break}e=s[a],v.next=15;break;case 9:return v.next=11,(0,H.Z)(fetch(n).then(function(P){if(P.ok)return P.blob();throw new Error}));case 11:u=v.sent,l=u.res,w=u.err,w||(e=l,(0,A.set)(n,(0,E.Z)({},a,l)));case 15:return v.abrupt("return",e?{url:URL.createObjectURL(e)}:{url:n});case 16:case"end":return v.stop()}},L)}));return function(n,i){return k.apply(this,arguments)}}(),V=f(705)},282:function(b,g,f){f.d(g,{Z:function(){return m}});var T=f(484);function m(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},_={};return _.promise=new Promise(function(O,p){_.resolve=O,_.reject=p}),d&&(_.promise=(0,T.Z)(_.promise,j)),_}},484:function(b,g,f){f.d(g,{Z:function(){return m}});var T=f(42);function m(d){var j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return d.then(function(_){return(0,T.Z)({err:null,res:_},j)}).catch(function(_){return(0,T.Z)({err:_,res:void 0},j)})}},705:function(b,g,f){var T=f(949),m=new Map,d=function(){var _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{generateTopUV:function(O,p,E,S,C){var A=p[E*3],H=p[E*3+1],W=p[S*3],R=p[S*3+1],M=p[C*3],V=p[C*3+1],k;if(m.has(O))k=m.get(O);else{var L=_.box3||new THREE.Box3;if(!_.box3){var n=O.parameters.shapes.getPoints();L.setFromArray(n.map(function(u){return[u.x,u.y,0]}).flat())}var i=L.getSize(new THREE.Vector3);_.split&&(i.y/=_.split),k={box:L,size:i},m.set(O,k)}var a=k.box,e=k.size,s=_.split?1-_.split:0;return[new THREE.Vector2((A-a.min.x)/e.x,(H-a.min.y)/e.y+s),new THREE.Vector2((W-a.min.x)/e.x,(R-a.min.y)/e.y+s),new THREE.Vector2((M-a.min.x)/e.x,(V-a.min.y)/e.y+s)]},generateSideWallUV:function(O,p,E,S,C,A){var H=p[E*3],W=p[E*3+1],R=p[E*3+2],M=p[S*3],V=p[S*3+1],k=p[S*3+2],L=p[C*3],n=p[C*3+1],i=p[C*3+2],a=p[A*3],e=p[A*3+1],s=p[A*3+2],u;if(m.has(p))u=m.get(p);else{var l=new THREE.Box3;l.setFromArray(p);var w=l.getSize(new THREE.Vector3);_.split&&(w.z/=1-_.split),u={box:l,size:w},m.set(p,u)}var y=u.box,v=u.size;return Math.abs(W-V)<Math.abs(H-M)?[new THREE.Vector2((H-y.min.x)/v.x,(R-y.min.z)/v.z),new THREE.Vector2((M-y.min.x)/v.x,(k-y.min.z)/v.z),new THREE.Vector2((L-y.min.x)/v.x,(i-y.min.z)/v.z),new THREE.Vector2((a-y.min.x)/v.x,(s-y.min.z)/v.z)]:[new THREE.Vector2((W-y.min.y)/v.y,(R-y.min.z)/v.z),new THREE.Vector2((V-y.min.y)/v.y,(k-y.min.z)/v.z),new THREE.Vector2((n-y.min.y)/v.y,(i-y.min.z)/v.z),new THREE.Vector2((e-y.min.y)/v.y,(s-y.min.z)/v.z)]}}},j=function(){m.clear()}},949:function(b,g,f){var T=d=>{var j={};return f.d(j,d),j},m=d=>()=>d;b.exports=T({MathUtils:()=>J.MathUtils})},568:function(b,g,f){f.d(g,{Z:function(){return m}});function T(d,j,_,O,p,E,S){try{var C=d[E](S),A=C.value}catch(H){_(H);return}C.done?j(A):Promise.resolve(A).then(O,p)}function m(d){return function(){var j=this,_=arguments;return new Promise(function(O,p){var E=d.apply(j,_);function S(A){T(E,O,p,S,C,"next",A)}function C(A){T(E,O,p,S,C,"throw",A)}S(void 0)})}}},924:function(b,g,f){f.d(g,{Z:function(){return T}});function T(m,d,j){return d in m?Object.defineProperty(m,d,{value:j,enumerable:!0,configurable:!0,writable:!0}):m[d]=j,m}},42:function(b,g,f){f.d(g,{Z:function(){return m}});var T=f(924);function m(d){for(var j=1;j<arguments.length;j++){var _=arguments[j]!=null?arguments[j]:{},O=Object.keys(_);typeof Object.getOwnPropertySymbols=="function"&&(O=O.concat(Object.getOwnPropertySymbols(_).filter(function(p){return Object.getOwnPropertyDescriptor(_,p).enumerable}))),O.forEach(function(p){(0,T.Z)(d,p,_[p])})}return d}}},Y={};function I(b){var g=Y[b];if(g!==void 0)return g.exports;var f=Y[b]={exports:{}};return Q[b](f,f.exports,I),f.exports}(function(){I.n=function(b){var g=b&&b.__esModule?function(){return b.default}:function(){return b};return I.d(g,{a:g}),g}})(),function(){I.d=function(b,g){for(var f in g)I.o(g,f)&&!I.o(b,f)&&Object.defineProperty(b,f,{enumerable:!0,get:g[f]})}}(),function(){I.o=function(b,g){return Object.prototype.hasOwnProperty.call(b,g)}}();var K={};(function(){I.d(K,{Ct:function(){return f},Vw:function(){return k},hG:function(){return V},Wk:function(){return L}});function b(n,i){if(!(n instanceof i))throw new TypeError("Cannot call a class as a function")}var g=I(521),f=function(){"use strict";function n(){b(this,n),this.cache=new Map}var i=n.prototype;return i.install=function(){},i.init=function(e){var s=(0,g.Mf)();this.cache.set(e,s)},i.get=function(e){var s;return(s=this.cache.get(e))===null||s===void 0?void 0:s.promise},i.set=function(e,s){var u=this.cache.get(e);u?u.resolve(s):console.warn("init cache first")},i.dispose=function(){this.cache.forEach(function(e,s){e.reject("stop set cache:".concat(s))}),this.cache.clear()},n}(),T=I(568);function m(n,i){for(var a=0;a<i.length;a++){var e=i[a];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(n,e.key,e)}}function d(n,i,a){return i&&m(n.prototype,i),a&&m(n,a),n}function j(n){if(Array.isArray(n))return n}function _(n){if(typeof Symbol!="undefined"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)}function O(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function p(n,i){(i==null||i>n.length)&&(i=n.length);for(var a=0,e=new Array(i);a<i;a++)e[a]=n[a];return e}function E(n,i){if(!!n){if(typeof n=="string")return p(n,i);var a=Object.prototype.toString.call(n).slice(8,-1);if(a==="Object"&&n.constructor&&(a=n.constructor.name),a==="Map"||a==="Set")return Array.from(a);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return p(n,i)}}function S(n,i){return j(n)||_(n,i)||E(n,i)||O()}function C(n){if(Array.isArray(n))return p(n)}function A(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function H(n){return C(n)||_(n)||E(n)||A()}var W=I(666),R=I.n(W),M=I(949),V=function(){"use strict";function n(a){b(this,n),this.objectNamesToFactories=new Map,this.objects=new Map,this.objects_=a}var i=n.prototype;return i.install=function(e){this.pencil=e,this.initObjectFactories()},i.initObjectFactories=function(){var e=this,s=this.objects_;Object.keys(s).forEach(function(u){var l=function(){function w(){b(this,w)}var y=w.prototype;return y.create=function(){var P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new s[u](P)},w}();e.objectNamesToFactories.set(u,l)})},i.getObject=function(e,s){e.includes("#")&&console.warn("getObject:err:\u4E0D\u652F\u6301 #",e);var u=(s||{}).key,l="".concat(e).concat(u?"#".concat(u):""),w=this.objects.get(l);return w},i.getAllObject=function(e,s){e.includes("#")&&console.warn("getAllObject:err:\u4E0D\u652F\u6301 #",e);var u=(s||{}).key,l="".concat(e).concat(u?"#".concat(u):""),w=[];return this.objects.forEach(function(y,v){(v.startsWith("".concat(l,"#"))||v===l)&&w.push(y)}),w},i.draw=function(e,s,u){var l=this;return(0,T.Z)(R().mark(function w(){var y,v,P,Z,z,r,t;return R().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(y=l.objectNamesToFactories.get(e),!y){c.next=15;break}return v=(s||{}).key,P="".concat(e).concat(v?"#".concat(v):""),l.objects.has(P)&&(Z=M.MathUtils.generateUUID(),P+="#".concat(Z)),z=(s==null?void 0:s.target)||u,typeof z=="string"?r=l.objects.get(z):(z==null?void 0:z.objecttype__)==="BaseObject"?r=z:r=l.pencil.scene,t=new y().create(s),t.pencil=l.pencil,t.key=P,l.objects.set(P,t),c.next=14,l.addMesh(t,r);case 14:return c.abrupt("return",t);case 15:throw new Error("Unrecognized:".concat(e));case 16:case"end":return c.stop()}},w)}))()},i.addMesh=function(e,s){return(0,T.Z)(R().mark(function u(){return R().wrap(function(w){for(;;)switch(w.prev=w.next){case 0:return w.next=2,e.create();case 2:e.object3d&&(e.object3d.userData.BaseObject_=e,s.add(e.object3d)),e.visible=!0,e.render(),e.pm.resolve();case 6:case"end":return w.stop()}},u)}))()},i.erase=function(){for(var e=arguments.length,s=new Array(e),u=0;u<e;u++)s[u]=arguments[u];var l=this;H(s).forEach(function(w){var y=[];if(typeof w=="string"){var v,P=S(w.split("#"),2),Z=P[0],z=P[1];(v=y).push.apply(v,H(l.getAllObject(Z,{key:z})))}else y.push(w);y.forEach(function(r){l.removeMesh(r)})})},i.removeMesh=function(e){var s=this,u=e.parent;e.object3d&&u.remove(e.object3d),e.traverse(function(l){l.visible=!1,l.dispose(),s.objects.delete(l.key)})},i.update=function(e,s){this.objects.forEach(function(u){u.update(e,s)})},i.setSize=function(e,s){this.objects.forEach(function(u){u.resize(e,s)})},i.dispose=function(){this.objects.forEach(function(e,s){e.dispose(),e.pm.reject("stop draw:".concat(s))}),this.objects.clear(),this.objectNamesToFactories.clear()},d(n,[{key:"objectsPromise",get:function(){var e=[];return this.objects.forEach(function(s){e.push(s.pm.promise)}),e}}]),n}(),k=function(){"use strict";function n(){b(this,n),this.data={}}var i=n.prototype;return i.install=function(){},i.setData=function(e,s){var u,l;this.data[e]=s,(l=(u=this).cb)===null||l===void 0||l.call(u,e)},i.runAll=function(){var e=this;Object.keys(this.data).forEach(function(s){var u,l;(l=(u=e).cb)===null||l===void 0||l.call(u,s)})},i.dispose=function(){this.data={},this.cb=void 0},n}(),L=function(){"use strict";function n(){b(this,n),this.messageList=[]}var i=n.prototype;return i.install=function(){},i.init=function(e,s){var u=this;this.workerList=Array.from({length:s},function(l,w){var y=typeof e=="string"?new Worker(e):e();return y.onmessage=function(v){var P=v.data,Z=P.res,z=P.uuid,r=u.messageList.find(function(t){var o=t.uuid;return z===o});r==null||r.cb(Z),u.workerList[w].inUse=!1,u.checkMessage()},{worker:y,inUse:!1}})},i.postMessage=function(e,s){this.messageList.push({req:e,cb:s,uuid:M.MathUtils.generateUUID(),inUse:!1}),this.checkMessage()},i.checkMessage=function(){var e=this.workerList.find(function(u){var l=u.inUse;return!l});if(e){var s=this.messageList.find(function(u){var l=u.inUse;return!l});s&&(s.inUse=!0,e.inUse=!0,e.worker.postMessage({req:s.req,uuid:s.uuid}))}},i.dispose=function(){this.workerList.forEach(function(e){var s=e.worker;s.terminate()}),this.workerList=[],this.messageList=[]},n}()})();var q=K.Ct,tt=K.Vw,et=K.hG,rt=K.Wk;export{q as Cache,tt as Data,et as Draw,rt as Wk};
1
+ import*as X from"idb-keyval";import*as J from"three";var Q={666:function(b){var g=function(l){"use strict";var T=Object.prototype,m=T.hasOwnProperty,v,w=typeof Symbol=="function"?Symbol:{},y=w.iterator||"@@iterator",P=w.asyncIterator||"@@asyncIterator",p=w.toStringTag||"@@toStringTag";function E(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{E({},"")}catch(e){E=function(t,n,h){return t[n]=h}}function S(e,t,n,h){var f=t&&t.prototype instanceof G?t:G,O=Object.create(f.prototype),L=new d(h||[]);return O._invoke=r(e,n,L),O}l.wrap=S;function C(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(h){return{type:"throw",arg:h}}}var R="suspendedStart",W="suspendedYield",Z="executing",H="completed",j={};function G(){}function _(){}function k(){}var M={};E(M,y,function(){return this});var z=Object.getPrototypeOf,x=z&&z(z(A([])));x&&x!==T&&m.call(x,y)&&(M=x);var a=k.prototype=G.prototype=Object.create(M);_.prototype=k,E(a,"constructor",k),E(k,"constructor",_),_.displayName=E(k,p,"GeneratorFunction");function i(e){["next","throw","return"].forEach(function(t){E(e,t,function(n){return this._invoke(t,n)})})}l.isGeneratorFunction=function(e){var t=typeof e=="function"&&e.constructor;return t?t===_||(t.displayName||t.name)==="GeneratorFunction":!1},l.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,k):(e.__proto__=k,E(e,p,"GeneratorFunction")),e.prototype=Object.create(a),e},l.awrap=function(e){return{__await:e}};function o(e,t){function n(O,L,D,I){var N=C(e[O],e,L);if(N.type==="throw")I(N.arg);else{var $=N.arg,F=$.value;return F&&typeof F=="object"&&m.call(F,"__await")?t.resolve(F.__await).then(function(B){n("next",B,D,I)},function(B){n("throw",B,D,I)}):t.resolve(F).then(function(B){$.value=B,D($)},function(B){return n("throw",B,D,I)})}}var h;function f(O,L){function D(){return new t(function(I,N){n(O,L,I,N)})}return h=h?h.then(D,D):D()}this._invoke=f}i(o.prototype),E(o.prototype,P,function(){return this}),l.AsyncIterator=o,l.async=function(e,t,n,h,f){f===void 0&&(f=Promise);var O=new o(S(e,t,n,h),f);return l.isGeneratorFunction(t)?O:O.next().then(function(L){return L.done?L.value:O.next()})};function r(e,t,n){var h=R;return function(O,L){if(h===Z)throw new Error("Generator is already running");if(h===H){if(O==="throw")throw L;return U()}for(n.method=O,n.arg=L;;){var D=n.delegate;if(D){var I=c(D,n);if(I){if(I===j)continue;return I}}if(n.method==="next")n.sent=n._sent=n.arg;else if(n.method==="throw"){if(h===R)throw h=H,n.arg;n.dispatchException(n.arg)}else n.method==="return"&&n.abrupt("return",n.arg);h=Z;var N=C(e,t,n);if(N.type==="normal"){if(h=n.done?H:W,N.arg===j)continue;return{value:N.arg,done:n.done}}else N.type==="throw"&&(h=H,n.method="throw",n.arg=N.arg)}}}function c(e,t){var n=e.iterator[t.method];if(n===v){if(t.delegate=null,t.method==="throw"){if(e.iterator.return&&(t.method="return",t.arg=v,c(e,t),t.method==="throw"))return j;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return j}var h=C(n,e.iterator,t.arg);if(h.type==="throw")return t.method="throw",t.arg=h.arg,t.delegate=null,j;var f=h.arg;if(!f)return t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,j;if(f.done)t[e.resultName]=f.value,t.next=e.nextLoc,t.method!=="return"&&(t.method="next",t.arg=v);else return f;return t.delegate=null,j}i(a),E(a,p,"Generator"),E(a,y,function(){return this}),E(a,"toString",function(){return"[object Generator]"});function s(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function u(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function d(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(s,this),this.reset(!0)}l.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function h(){for(;t.length;){var f=t.pop();if(f in e)return h.value=f,h.done=!1,h}return h.done=!0,h}};function A(e){if(e){var t=e[y];if(t)return t.call(e);if(typeof e.next=="function")return e;if(!isNaN(e.length)){var n=-1,h=function f(){for(;++n<e.length;)if(m.call(e,n))return f.value=e[n],f.done=!1,f;return f.value=v,f.done=!0,f};return h.next=h}}return{next:U}}l.values=A;function U(){return{value:v,done:!0}}return d.prototype={constructor:d,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=v,this.done=!1,this.delegate=null,this.method="next",this.arg=v,this.tryEntries.forEach(u),!e)for(var t in this)t.charAt(0)==="t"&&m.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=v)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if(t.type==="throw")throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(I,N){return O.type="throw",O.arg=e,t.next=I,N&&(t.method="next",t.arg=v),!!N}for(var h=this.tryEntries.length-1;h>=0;--h){var f=this.tryEntries[h],O=f.completion;if(f.tryLoc==="root")return n("end");if(f.tryLoc<=this.prev){var L=m.call(f,"catchLoc"),D=m.call(f,"finallyLoc");if(L&&D){if(this.prev<f.catchLoc)return n(f.catchLoc,!0);if(this.prev<f.finallyLoc)return n(f.finallyLoc)}else if(L){if(this.prev<f.catchLoc)return n(f.catchLoc,!0)}else if(D){if(this.prev<f.finallyLoc)return n(f.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var h=this.tryEntries[n];if(h.tryLoc<=this.prev&&m.call(h,"finallyLoc")&&this.prev<h.finallyLoc){var f=h;break}}f&&(e==="break"||e==="continue")&&f.tryLoc<=t&&t<=f.finallyLoc&&(f=null);var O=f?f.completion:{};return O.type=e,O.arg=t,f?(this.method="next",this.next=f.finallyLoc,j):this.complete(O)},complete:function(e,t){if(e.type==="throw")throw e.arg;return e.type==="break"||e.type==="continue"?this.next=e.arg:e.type==="return"?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):e.type==="normal"&&t&&(this.next=t),j},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),u(n),j}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var h=n.completion;if(h.type==="throw"){var f=h.arg;u(n)}return f}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:A(e),resultName:t,nextLoc:n},this.method==="next"&&(this.arg=v),j}},l}(b.exports);try{regeneratorRuntime=g}catch(l){typeof globalThis=="object"?globalThis.regeneratorRuntime=g:Function("r","regeneratorRuntime = r")(g)}},584:function(b,g,l){l.d(g,{Mf:function(){return T.Z}});var T=l(282),m=l(666),v=l.n(m),w=null,y=l(949);function P(j){if(j.material){var G=Array.isArray(j.material)?j.material:[j.material];G.forEach(function(_){var k,M;(k=_.color)===null||k===void 0||k.convertSRGBToLinear(),(M=_.emissive)===null||M===void 0||M.convertSRGBToLinear(),_.map&&(_.map.encoding=THREE.sRGBEncoding),_.emissiveMap&&(_.emissiveMap.encoding=THREE.sRGBEncoding)})}}var p=l(568),E=l(924),S=l(77),C=l(484),R=null,W=null,Z=function(){var j=(0,p.Z)(v().mark(function G(_,k){var M,z,x,a,i,o,r,c,s;return v().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return M=k.type,z=M===void 0?"blob":M,x=k.version,a=x===void 0?"1":x,d.next=4,(0,S.get)(_);case 4:if(o=d.sent,!(o&&o[a])){d.next=9;break}i=o[a],d.next=15;break;case 9:return d.next=11,(0,C.Z)(fetch(_).then(function(A){if(A.ok)return A[z]();throw new Error}));case 11:r=d.sent,c=r.res,s=r.err,s||(i=c,(0,S.set)(_,(0,E.Z)({},a,c)));case 15:return d.abrupt("return",i?{url:z==="json"?_:URL.createObjectURL(i),store:i}:{url:_});case 16:case"end":return d.stop()}},G)}));return function(_,k){return j.apply(this,arguments)}}(),H=l(705)},282:function(b,g,l){l.d(g,{Z:function(){return m}});var T=l(484);function m(){var v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},y={};return y.promise=new Promise(function(P,p){y.resolve=P,y.reject=p}),v&&(y.promise=(0,T.Z)(y.promise,w)),y}},484:function(b,g,l){l.d(g,{Z:function(){return m}});var T=l(42);function m(v){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return v.then(function(y){return(0,T.Z)({err:null,res:y},w)}).catch(function(y){return(0,T.Z)({err:y,res:void 0},w)})}},705:function(b,g,l){var T=l(949),m=new Map,v=function(){var y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{generateTopUV:function(P,p,E,S,C){var R=p[E*3],W=p[E*3+1],Z=p[S*3],H=p[S*3+1],j=p[C*3],G=p[C*3+1],_;if(m.has(P))_=m.get(P);else{var k=y.box3||new THREE.Box3;if(!y.box3){var M=P.parameters.shapes.getPoints();k.setFromArray(M.map(function(o){return[o.x,o.y,0]}).flat())}var z=k.getSize(new THREE.Vector3);y.split&&(z.y/=y.split),_={box:k,size:z},m.set(P,_)}var x=_.box,a=_.size,i=y.split?1-y.split:0;return[new THREE.Vector2((R-x.min.x)/a.x,(W-x.min.y)/a.y+i),new THREE.Vector2((Z-x.min.x)/a.x,(H-x.min.y)/a.y+i),new THREE.Vector2((j-x.min.x)/a.x,(G-x.min.y)/a.y+i)]},generateSideWallUV:function(P,p,E,S,C,R){var W=p[E*3],Z=p[E*3+1],H=p[E*3+2],j=p[S*3],G=p[S*3+1],_=p[S*3+2],k=p[C*3],M=p[C*3+1],z=p[C*3+2],x=p[R*3],a=p[R*3+1],i=p[R*3+2],o;if(m.has(p))o=m.get(p);else{var r=new THREE.Box3;r.setFromArray(p);var c=r.getSize(new THREE.Vector3);y.split&&(c.z/=1-y.split),o={box:r,size:c},m.set(p,o)}var s=o.box,u=o.size;return Math.abs(Z-G)<Math.abs(W-j)?[new THREE.Vector2((W-s.min.x)/u.x,(H-s.min.z)/u.z),new THREE.Vector2((j-s.min.x)/u.x,(_-s.min.z)/u.z),new THREE.Vector2((k-s.min.x)/u.x,(z-s.min.z)/u.z),new THREE.Vector2((x-s.min.x)/u.x,(i-s.min.z)/u.z)]:[new THREE.Vector2((Z-s.min.y)/u.y,(H-s.min.z)/u.z),new THREE.Vector2((G-s.min.y)/u.y,(_-s.min.z)/u.z),new THREE.Vector2((M-s.min.y)/u.y,(z-s.min.z)/u.z),new THREE.Vector2((a-s.min.y)/u.y,(i-s.min.z)/u.z)]}}},w=function(){m.clear()}},77:function(b,g,l){var T=v=>{var w={};return l.d(w,v),w},m=v=>()=>v;b.exports=T({get:()=>X.get,set:()=>X.set})},949:function(b,g,l){var T=v=>{var w={};return l.d(w,v),w},m=v=>()=>v;b.exports=T({MathUtils:()=>J.MathUtils})},568:function(b,g,l){l.d(g,{Z:function(){return m}});function T(v,w,y,P,p,E,S){try{var C=v[E](S),R=C.value}catch(W){y(W);return}C.done?w(R):Promise.resolve(R).then(P,p)}function m(v){return function(){var w=this,y=arguments;return new Promise(function(P,p){var E=v.apply(w,y);function S(R){T(E,P,p,S,C,"next",R)}function C(R){T(E,P,p,S,C,"throw",R)}S(void 0)})}}},924:function(b,g,l){l.d(g,{Z:function(){return T}});function T(m,v,w){return v in m?Object.defineProperty(m,v,{value:w,enumerable:!0,configurable:!0,writable:!0}):m[v]=w,m}},42:function(b,g,l){l.d(g,{Z:function(){return m}});var T=l(924);function m(v){for(var w=1;w<arguments.length;w++){var y=arguments[w]!=null?arguments[w]:{},P=Object.keys(y);typeof Object.getOwnPropertySymbols=="function"&&(P=P.concat(Object.getOwnPropertySymbols(y).filter(function(p){return Object.getOwnPropertyDescriptor(y,p).enumerable}))),P.forEach(function(p){(0,T.Z)(v,p,y[p])})}return v}}},Y={};function V(b){var g=Y[b];if(g!==void 0)return g.exports;var l=Y[b]={exports:{}};return Q[b](l,l.exports,V),l.exports}(function(){V.n=function(b){var g=b&&b.__esModule?function(){return b.default}:function(){return b};return V.d(g,{a:g}),g}})(),function(){V.d=function(b,g){for(var l in g)V.o(g,l)&&!V.o(b,l)&&Object.defineProperty(b,l,{enumerable:!0,get:g[l]})}}(),function(){V.o=function(b,g){return Object.prototype.hasOwnProperty.call(b,g)}}();var K={};(function(){V.d(K,{Ct:function(){return l},Vw:function(){return _},hG:function(){return G},Wk:function(){return x}});function b(a,i){if(!(a instanceof i))throw new TypeError("Cannot call a class as a function")}var g=V(584),l=function(){"use strict";function a(){b(this,a),this.cache=new Map}var i=a.prototype;return i.install=function(){},i.init=function(r){var c=(0,g.Mf)();this.cache.set(r,c)},i.get=function(r){var c;return(c=this.cache.get(r))===null||c===void 0?void 0:c.promise},i.set=function(r,c){var s=this.cache.get(r);s?s.resolve(c):console.warn("init cache first")},i.dispose=function(){this.cache.forEach(function(r,c){r.reject("stop set cache:".concat(c))}),this.cache.clear()},a}(),T=V(568);function m(a,i){for(var o=0;o<i.length;o++){var r=i[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(a,r.key,r)}}function v(a,i,o){return i&&m(a.prototype,i),o&&m(a,o),a}function w(a){if(Array.isArray(a))return a}function y(a){if(typeof Symbol!="undefined"&&a[Symbol.iterator]!=null||a["@@iterator"]!=null)return Array.from(a)}function P(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function p(a,i){(i==null||i>a.length)&&(i=a.length);for(var o=0,r=new Array(i);o<i;o++)r[o]=a[o];return r}function E(a,i){if(!!a){if(typeof a=="string")return p(a,i);var o=Object.prototype.toString.call(a).slice(8,-1);if(o==="Object"&&a.constructor&&(o=a.constructor.name),o==="Map"||o==="Set")return Array.from(o);if(o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return p(a,i)}}function S(a,i){return w(a)||y(a,i)||E(a,i)||P()}function C(a){if(Array.isArray(a))return p(a)}function R(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function W(a){return C(a)||y(a)||E(a)||R()}var Z=V(666),H=V.n(Z),j=V(949),G=function(){"use strict";function a(o){b(this,a),this.objectNamesToFactories=new Map,this.objects=new Map,this.objects_=o}var i=a.prototype;return i.install=function(r){this.pencil=r,this.initObjectFactories()},i.initObjectFactories=function(){var r=this,c=this.objects_;Object.keys(c).forEach(function(s){var u=function(){function d(){b(this,d)}var A=d.prototype;return A.create=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new c[s](e)},d}();r.objectNamesToFactories.set(s,u)})},i.getObject=function(r,c){r.includes("#")&&console.warn("getObject:err:\u4E0D\u652F\u6301 #",r);var s=(c||{}).key,u="".concat(r).concat(s?"#".concat(s):""),d=this.objects.get(u);return d},i.getAllObject=function(r,c){r.includes("#")&&console.warn("getAllObject:err:\u4E0D\u652F\u6301 #",r);var s=(c||{}).key,u="".concat(r).concat(s?"#".concat(s):""),d=[];return this.objects.forEach(function(A,U){(U.startsWith("".concat(u,"#"))||U===u)&&d.push(A)}),d},i.draw=function(r,c,s){var u=this;return(0,T.Z)(H().mark(function d(){var A,U,e,t,n,h,f;return H().wrap(function(L){for(;;)switch(L.prev=L.next){case 0:if(A=u.objectNamesToFactories.get(r),!A){L.next=15;break}return U=(c||{}).key,e="".concat(r).concat(U?"#".concat(U):""),u.objects.has(e)&&(t=j.MathUtils.generateUUID(),e+="#".concat(t)),n=(c==null?void 0:c.target)||s,typeof n=="string"?h=u.objects.get(n):(n==null?void 0:n.objecttype__)==="BaseObject"?h=n:h=u.pencil.scene,f=new A().create(c),f.pencil=u.pencil,f.key=e,u.objects.set(e,f),L.next=14,u.addMesh(f,h);case 14:return L.abrupt("return",f);case 15:throw new Error("Unrecognized:".concat(r));case 16:case"end":return L.stop()}},d)}))()},i.addMesh=function(r,c){return(0,T.Z)(H().mark(function s(){return H().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return d.next=2,r.create();case 2:r.object3d&&(r.object3d.userData.BaseObject_=r,c.add(r.object3d)),r.visible=!0,r.render(),r.pm.resolve();case 6:case"end":return d.stop()}},s)}))()},i.erase=function(){for(var r=arguments.length,c=new Array(r),s=0;s<r;s++)c[s]=arguments[s];var u=this;W(c).forEach(function(d){var A=[];if(typeof d=="string"){var U,e=S(d.split("#"),2),t=e[0],n=e[1];(U=A).push.apply(U,W(u.getAllObject(t,{key:n})))}else A.push(d);A.forEach(function(h){u.removeMesh(h)})})},i.removeMesh=function(r){var c=this,s=r.parent;r.object3d&&s.remove(r.object3d),r.traverse(function(u){u.visible=!1,u.dispose(),c.objects.delete(u.key)})},i.update=function(r,c){this.objects.forEach(function(s){s.update(r,c)})},i.setSize=function(r,c){this.objects.forEach(function(s){s.resize(r,c)})},i.dispose=function(){this.objects.forEach(function(r,c){r.dispose(),r.pm.reject("stop draw:".concat(c))}),this.objects.clear(),this.objectNamesToFactories.clear()},v(a,[{key:"objectsPromise",get:function(){var r=[];return this.objects.forEach(function(c){r.push(c.pm.promise)}),r}}]),a}(),_=function(){"use strict";function a(){b(this,a),this.data={}}var i=a.prototype;return i.install=function(){},i.setData=function(r,c){var s,u;this.data[r]=c,(u=(s=this).cb)===null||u===void 0||u.call(s,r)},i.runAll=function(){var r=this;Object.keys(this.data).forEach(function(c){var s,u;(u=(s=r).cb)===null||u===void 0||u.call(s,c)})},i.dispose=function(){this.data={},this.cb=void 0},a}(),k=V(924),M=V(42),z=V(77),x=function(){"use strict";function a(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};b(this,a),this.messageList=[],this.options=(0,M.Z)({},{cache:!1,cacheVersion:"1"},o)}var i=a.prototype;return i.install=function(){},i.init=function(r,c){var s=this,u=this.options,d=u.cache,A=u.cacheVersion;this.workerList=Array.from({length:c},function(U,e){var t=typeof r=="string"?new Worker(r):r();return t.onmessage=function(n){var h=n.data,f=h.res,O=h.uuid,L=s.messageList.find(function(D){var I=D.uuid;return O===I});L==null||L.cb(f),s.workerList[e].inUse=!1,s.checkMessage(),d&&(0,z.set)(O,(0,k.Z)({},A,f))},{worker:t,inUse:!1}})},i.postMessage=function(r,c){var s=this,u=this.options,d=u.cache,A=u.cacheVersion;if(d&&!r.workerKey){console.warn("worker cache need workerKey");return}var U=r.workerKey||j.MathUtils.generateUUID();(d?(0,z.get)(U):Promise.resolve()).then(function(e){e&&e[A]?c(e[A]):(s.messageList.push({req:r,cb:c,uuid:U,inUse:!1}),s.checkMessage())})},i.checkMessage=function(){var r=this.workerList.find(function(s){var u=s.inUse;return!u});if(r){var c=this.messageList.find(function(s){var u=s.inUse;return!u});c&&(c.inUse=!0,r.inUse=!0,r.worker.postMessage({req:c.req,uuid:c.uuid}))}},i.dispose=function(){this.workerList.forEach(function(r){var c=r.worker;c.terminate()}),this.workerList=[],this.messageList=[]},a}()})();var q=K.Ct,tt=K.Vw,et=K.hG,rt=K.Wk;export{q as Cache,tt as Data,et as Draw,rt as Wk};
@@ -1,8 +1,13 @@
1
1
  import { del, clear } from 'idb-keyval';
2
2
  export declare const clearCache: typeof del;
3
3
  export declare const clearAllCache: typeof clear;
4
- export declare const getCache: (url: string, { version, }: {
5
- version: string;
4
+ export declare const getCache: (url: string, { type, version, }: {
5
+ type?: "blob" | "json" | undefined;
6
+ version?: string | undefined;
6
7
  }) => Promise<{
7
8
  url: string;
9
+ store: any;
10
+ } | {
11
+ url: string;
12
+ store?: undefined;
8
13
  }>;
@@ -1 +1 @@
1
- (function(){var H={666:function(v){var c=function(i){"use strict";var u=Object.prototype,f=u.hasOwnProperty,e,n=typeof Symbol=="function"?Symbol:{},o=n.iterator||"@@iterator",s=n.asyncIterator||"@@asyncIterator",m=n.toStringTag||"@@toStringTag";function l(r,t,a){return Object.defineProperty(r,t,{value:a,enumerable:!0,configurable:!0,writable:!0}),r[t]}try{l({},"")}catch(r){l=function(t,a,_){return t[a]=_}}function g(r,t,a,_){var h=t&&t.prototype instanceof G?t:G,A=Object.create(h.prototype),I=new M(_||[]);return A._invoke=P(r,a,I),A}i.wrap=g;function E(r,t,a){try{return{type:"normal",arg:r.call(t,a)}}catch(_){return{type:"throw",arg:_}}}var O="suspendedStart",j="suspendedYield",R="executing",Z="completed",T={};function G(){}function D(){}function C(){}var W={};l(W,o,function(){return this});var S=Object.getPrototypeOf,k=S&&S(S($([])));k&&k!==u&&f.call(k,o)&&(W=k);var d=C.prototype=G.prototype=Object.create(W);D.prototype=C,l(d,"constructor",C),l(C,"constructor",D),D.displayName=l(C,m,"GeneratorFunction");function p(r){["next","throw","return"].forEach(function(t){l(r,t,function(a){return this._invoke(t,a)})})}i.isGeneratorFunction=function(r){var t=typeof r=="function"&&r.constructor;return t?t===D||(t.displayName||t.name)==="GeneratorFunction":!1},i.mark=function(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,C):(r.__proto__=C,l(r,m,"GeneratorFunction")),r.prototype=Object.create(d),r},i.awrap=function(r){return{__await:r}};function y(r,t){function a(A,I,U,N){var V=E(r[A],r,I);if(V.type==="throw")N(V.arg);else{var Y=V.arg,x=Y.value;return x&&typeof x=="object"&&f.call(x,"__await")?t.resolve(x.__await).then(function(K){a("next",K,U,N)},function(K){a("throw",K,U,N)}):t.resolve(x).then(function(K){Y.value=K,U(Y)},function(K){return a("throw",K,U,N)})}}var _;function h(A,I){function U(){return new t(function(N,V){a(A,I,N,V)})}return _=_?_.then(U,U):U()}this._invoke=h}p(y.prototype),l(y.prototype,s,function(){return this}),i.AsyncIterator=y,i.async=function(r,t,a,_,h){h===void 0&&(h=Promise);var A=new y(g(r,t,a,_),h);return i.isGeneratorFunction(t)?A:A.next().then(function(I){return I.done?I.value:A.next()})};function P(r,t,a){var _=O;return function(A,I){if(_===R)throw new Error("Generator is already running");if(_===Z){if(A==="throw")throw I;return B()}for(a.method=A,a.arg=I;;){var U=a.delegate;if(U){var N=z(U,a);if(N){if(N===T)continue;return N}}if(a.method==="next")a.sent=a._sent=a.arg;else if(a.method==="throw"){if(_===O)throw _=Z,a.arg;a.dispatchException(a.arg)}else a.method==="return"&&a.abrupt("return",a.arg);_=R;var V=E(r,t,a);if(V.type==="normal"){if(_=a.done?Z:j,V.arg===T)continue;return{value:V.arg,done:a.done}}else V.type==="throw"&&(_=Z,a.method="throw",a.arg=V.arg)}}}function z(r,t){var a=r.iterator[t.method];if(a===e){if(t.delegate=null,t.method==="throw"){if(r.iterator.return&&(t.method="return",t.arg=e,z(r,t),t.method==="throw"))return T;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return T}var _=E(a,r.iterator,t.arg);if(_.type==="throw")return t.method="throw",t.arg=_.arg,t.delegate=null,T;var h=_.arg;if(!h)return t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,T;if(h.done)t[r.resultName]=h.value,t.next=r.nextLoc,t.method!=="return"&&(t.method="next",t.arg=e);else return h;return t.delegate=null,T}p(d),l(d,m,"Generator"),l(d,o,function(){return this}),l(d,"toString",function(){return"[object Generator]"});function L(r){var t={tryLoc:r[0]};1 in r&&(t.catchLoc=r[1]),2 in r&&(t.finallyLoc=r[2],t.afterLoc=r[3]),this.tryEntries.push(t)}function w(r){var t=r.completion||{};t.type="normal",delete t.arg,r.completion=t}function M(r){this.tryEntries=[{tryLoc:"root"}],r.forEach(L,this),this.reset(!0)}i.keys=function(r){var t=[];for(var a in r)t.push(a);return t.reverse(),function _(){for(;t.length;){var h=t.pop();if(h in r)return _.value=h,_.done=!1,_}return _.done=!0,_}};function $(r){if(r){var t=r[o];if(t)return t.call(r);if(typeof r.next=="function")return r;if(!isNaN(r.length)){var a=-1,_=function h(){for(;++a<r.length;)if(f.call(r,a))return h.value=r[a],h.done=!1,h;return h.value=e,h.done=!0,h};return _.next=_}}return{next:B}}i.values=$;function B(){return{value:e,done:!0}}return M.prototype={constructor:M,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(w),!r)for(var t in this)t.charAt(0)==="t"&&f.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=e)},stop:function(){this.done=!0;var r=this.tryEntries[0],t=r.completion;if(t.type==="throw")throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var t=this;function a(N,V){return A.type="throw",A.arg=r,t.next=N,V&&(t.method="next",t.arg=e),!!V}for(var _=this.tryEntries.length-1;_>=0;--_){var h=this.tryEntries[_],A=h.completion;if(h.tryLoc==="root")return a("end");if(h.tryLoc<=this.prev){var I=f.call(h,"catchLoc"),U=f.call(h,"finallyLoc");if(I&&U){if(this.prev<h.catchLoc)return a(h.catchLoc,!0);if(this.prev<h.finallyLoc)return a(h.finallyLoc)}else if(I){if(this.prev<h.catchLoc)return a(h.catchLoc,!0)}else if(U){if(this.prev<h.finallyLoc)return a(h.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(r,t){for(var a=this.tryEntries.length-1;a>=0;--a){var _=this.tryEntries[a];if(_.tryLoc<=this.prev&&f.call(_,"finallyLoc")&&this.prev<_.finallyLoc){var h=_;break}}h&&(r==="break"||r==="continue")&&h.tryLoc<=t&&t<=h.finallyLoc&&(h=null);var A=h?h.completion:{};return A.type=r,A.arg=t,h?(this.method="next",this.next=h.finallyLoc,T):this.complete(A)},complete:function(r,t){if(r.type==="throw")throw r.arg;return r.type==="break"||r.type==="continue"?this.next=r.arg:r.type==="return"?(this.rval=this.arg=r.arg,this.method="return",this.next="end"):r.type==="normal"&&t&&(this.next=t),T},finish:function(r){for(var t=this.tryEntries.length-1;t>=0;--t){var a=this.tryEntries[t];if(a.finallyLoc===r)return this.complete(a.completion,a.afterLoc),w(a),T}},catch:function(r){for(var t=this.tryEntries.length-1;t>=0;--t){var a=this.tryEntries[t];if(a.tryLoc===r){var _=a.completion;if(_.type==="throw"){var h=_.arg;w(a)}return h}}throw new Error("illegal catch attempt")},delegateYield:function(r,t,a){return this.delegate={iterator:$(r),resultName:t,nextLoc:a},this.method==="next"&&(this.arg=e),T}},i}(v.exports);try{regeneratorRuntime=c}catch(i){typeof globalThis=="object"?globalThis.regeneratorRuntime=c:Function("r","regeneratorRuntime = r")(c)}},695:function(v,c,i){"use strict";i.d(c,{Z:function(){return u}});function u(f){if(f.geometry&&f.geometry.dispose(),f.material){var e=Array.isArray(f.material)?f.material:[f.material];e.forEach(function(n){var o,s,m,l,g,E,O,j,R,Z,T,G,D;(o=n.map)===null||o===void 0||o.dispose(),(s=n.lightMap)===null||s===void 0||s.dispose(),(m=n.bumpMap)===null||m===void 0||m.dispose(),(l=n.normalMap)===null||l===void 0||l.dispose(),(g=n.specularMap)===null||g===void 0||g.dispose(),(E=n.envMap)===null||E===void 0||E.dispose(),(O=n.alphaMap)===null||O===void 0||O.dispose(),(j=n.aoMap)===null||j===void 0||j.dispose(),(R=n.displacementMap)===null||R===void 0||R.dispose(),(Z=n.emissiveMap)===null||Z===void 0||Z.dispose(),(T=n.gradientMap)===null||T===void 0||T.dispose(),(G=n.metalnessMap)===null||G===void 0||G.dispose(),(D=n.roughnessMap)===null||D===void 0||D.dispose(),n.dispose()})}}},490:function(v,c,i){"use strict";i.d(c,{U:function(){return f},v:function(){return u}});var u=function(e){for(var n=e.offsetLeft,o=e.offsetParent;o!==null;)n+=o.offsetLeft,o=o.offsetParent;var s;return document.compatMode==="BackCompat"||document.documentElement.scrollTop===0?s=document.body.scrollLeft:s=document.documentElement.scrollLeft,n-s},f=function(e){for(var n=e.offsetTop,o=e.offsetParent;o!==null;)n+=o.offsetTop,o=o.offsetParent;var s;return document.compatMode==="BackCompat"||document.documentElement.scrollTop===0?s=document.body.scrollTop:s=document.documentElement.scrollTop,n-s}},738:function(v,c,i){"use strict";i.d(c,{Z:function(){return f}});function u(e){return Object.prototype.toString.call(e)==="[object Object]"}function f(e){if(u(e)===!1)return!1;var n=e.constructor;if(n===void 0)return!0;var o=n.prototype;return!(u(o)===!1||o.hasOwnProperty("isPrototypeOf")===!1)}},282:function(v,c,i){"use strict";i.d(c,{Z:function(){return f}});var u=i(484);function f(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o={};return o.promise=new Promise(function(s,m){o.resolve=s,o.reject=m}),e&&(o.promise=(0,u.Z)(o.promise,n)),o}},713:function(v,c,i){"use strict";i.d(c,{Z:function(){return u}});function u(f,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,o=(90-e)*Math.PI/180,s=(90-f)*Math.PI/180;return[n*Math.sin(o)*Math.cos(s),n*Math.cos(o),n*Math.sin(o)*Math.sin(s)]}},618:function(v,c,i){"use strict";i.d(c,{Z:function(){return e}});var u=i(438),f=function(){"use strict";function n(s){(0,u.Z)(this,n),this.onTick_=s,this.cancelPending_=null}var o=n.prototype;return o.tickAfter=function(m){var l=this;this.stop();var g=!0,E;this.cancelPending_=function(){clearTimeout(E),g=!1};var O=function(){g&&l.onTick_()};return E=window.setTimeout(O,m),this},o.stop=function(){this.cancelPending_&&(this.cancelPending_(),this.cancelPending_=null)},n}(),e=function(){"use strict";function n(s){(0,u.Z)(this,n),this.onTick_=s,this.ticker_=null}var o=n.prototype;return o.tickNow=function(){return this.stop(),this.onTick_(),this},o.tickAfter=function(m){var l=this;return this.stop(),this.ticker_=new f(function(){l.onTick_()}).tickAfter(m),this},o.tickEvery=function(m){var l=this;return this.stop(),this.ticker_=new f(function(){var g;(g=l.ticker_)===null||g===void 0||g.tickAfter(m),l.onTick_()}).tickAfter(m),this},o.stop=function(){this.ticker_&&(this.ticker_.stop(),this.ticker_=null)},n}()},484:function(v,c,i){"use strict";i.d(c,{Z:function(){return f}});var u=i(42);function f(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return e.then(function(o){return(0,u.Z)({err:null,res:o},n)}).catch(function(o){return(0,u.Z)({err:o,res:void 0},n)})}},705:function(v,c,i){"use strict";i.d(c,{C:function(){return o},y:function(){return n}});var u=i(644),f=i.n(u),e=new Map,n=function(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{generateTopUV:function(m,l,g,E,O){var j=l[g*3],R=l[g*3+1],Z=l[E*3],T=l[E*3+1],G=l[O*3],D=l[O*3+1],C;if(e.has(m))C=e.get(m);else{var W=s.box3||new u.Box3;if(!s.box3){var S=m.parameters.shapes.getPoints();W.setFromArray(S.map(function(P){return[P.x,P.y,0]}).flat())}var k=W.getSize(new u.Vector3);s.split&&(k.y/=s.split),C={box:W,size:k},e.set(m,C)}var d=C.box,p=C.size,y=s.split?1-s.split:0;return[new u.Vector2((j-d.min.x)/p.x,(R-d.min.y)/p.y+y),new u.Vector2((Z-d.min.x)/p.x,(T-d.min.y)/p.y+y),new u.Vector2((G-d.min.x)/p.x,(D-d.min.y)/p.y+y)]},generateSideWallUV:function(m,l,g,E,O,j){var R=l[g*3],Z=l[g*3+1],T=l[g*3+2],G=l[E*3],D=l[E*3+1],C=l[E*3+2],W=l[O*3],S=l[O*3+1],k=l[O*3+2],d=l[j*3],p=l[j*3+1],y=l[j*3+2],P;if(e.has(l))P=e.get(l);else{var z=new u.Box3;z.setFromArray(l);var L=z.getSize(new u.Vector3);s.split&&(L.z/=1-s.split),P={box:z,size:L},e.set(l,P)}var w=P.box,M=P.size;return Math.abs(Z-D)<Math.abs(R-G)?[new u.Vector2((R-w.min.x)/M.x,(T-w.min.z)/M.z),new u.Vector2((G-w.min.x)/M.x,(C-w.min.z)/M.z),new u.Vector2((W-w.min.x)/M.x,(k-w.min.z)/M.z),new u.Vector2((d-w.min.x)/M.x,(y-w.min.z)/M.z)]:[new u.Vector2((Z-w.min.y)/M.y,(T-w.min.z)/M.z),new u.Vector2((D-w.min.y)/M.y,(C-w.min.z)/M.z),new u.Vector2((S-w.min.y)/M.y,(k-w.min.z)/M.z),new u.Vector2((p-w.min.y)/M.y,(y-w.min.z)/M.z)]}}},o=function(){e.clear()}},644:function(v){"use strict";v.exports=require("three")},943:function(v,c,i){"use strict";i.d(c,{Z:function(){return u}});function u(f,e){(e==null||e>f.length)&&(e=f.length);for(var n=0,o=new Array(e);n<e;n++)o[n]=f[n];return o}},982:function(v,c,i){"use strict";i.d(c,{Z:function(){return f}});var u=i(943);function f(e){if(Array.isArray(e))return(0,u.Z)(e)}},568:function(v,c,i){"use strict";i.d(c,{Z:function(){return f}});function u(e,n,o,s,m,l,g){try{var E=e[l](g),O=E.value}catch(j){o(j);return}E.done?n(O):Promise.resolve(O).then(s,m)}function f(e){return function(){var n=this,o=arguments;return new Promise(function(s,m){var l=e.apply(n,o);function g(O){u(l,s,m,g,E,"next",O)}function E(O){u(l,s,m,g,E,"throw",O)}g(void 0)})}}},438:function(v,c,i){"use strict";i.d(c,{Z:function(){return u}});function u(f,e){if(!(f instanceof e))throw new TypeError("Cannot call a class as a function")}},924:function(v,c,i){"use strict";i.d(c,{Z:function(){return u}});function u(f,e,n){return e in f?Object.defineProperty(f,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):f[e]=n,f}},375:function(v,c,i){"use strict";i.d(c,{Z:function(){return u}});function u(f){if(typeof Symbol!="undefined"&&f[Symbol.iterator]!=null||f["@@iterator"]!=null)return Array.from(f)}},270:function(v,c,i){"use strict";i.d(c,{Z:function(){return u}});function u(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},42:function(v,c,i){"use strict";i.d(c,{Z:function(){return f}});var u=i(924);function f(e){for(var n=1;n<arguments.length;n++){var o=arguments[n]!=null?arguments[n]:{},s=Object.keys(o);typeof Object.getOwnPropertySymbols=="function"&&(s=s.concat(Object.getOwnPropertySymbols(o).filter(function(m){return Object.getOwnPropertyDescriptor(o,m).enumerable}))),s.forEach(function(m){(0,u.Z)(e,m,o[m])})}return e}},342:function(v,c,i){"use strict";i.d(c,{Z:function(){return o}});var u=i(982),f=i(375),e=i(270),n=i(566);function o(s){return(0,u.Z)(s)||(0,f.Z)(s)||(0,n.Z)(s)||(0,e.Z)()}},566:function(v,c,i){"use strict";i.d(c,{Z:function(){return f}});var u=i(943);function f(e,n){if(!!e){if(typeof e=="string")return(0,u.Z)(e,n);var o=Object.prototype.toString.call(e).slice(8,-1);if(o==="Object"&&e.constructor&&(o=e.constructor.name),o==="Map"||o==="Set")return Array.from(o);if(o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return(0,u.Z)(e,n)}}}},X={};function b(v){var c=X[v];if(c!==void 0)return c.exports;var i=X[v]={exports:{}};return H[v](i,i.exports,b),i.exports}(function(){b.n=function(v){var c=v&&v.__esModule?function(){return v.default}:function(){return v};return b.d(c,{a:c}),c}})(),function(){b.d=function(v,c){for(var i in c)b.o(c,i)&&!b.o(v,i)&&Object.defineProperty(v,i,{enumerable:!0,get:c[i]})}}(),function(){b.o=function(v,c){return Object.prototype.hasOwnProperty.call(v,c)}}(),function(){b.r=function(v){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(v,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(v,"__esModule",{value:!0})}}();var F={};(function(){"use strict";b.r(F),b.d(F,{Chain:function(){return m},Timer:function(){return i.Z},claerUVGenerator:function(){return W.C},clearAllCache:function(){return G},clearCache:function(){return T},colorCorrection:function(){return O},disposeMesh:function(){return g.Z},getCache:function(){return D},getElementViewLeft:function(){return C.v},getElementViewTop:function(){return C.U},getUVGenerator:function(){return W.y},isPlainObject:function(){return j.Z},makePromiseCreator:function(){return v.Z},polar2Cartesian:function(){return l.Z},to:function(){return c.Z}});var v=b(282),c=b(484),i=b(618),u=b(568),f=b(438),e=b(42),n=b(342),o=b(666),s=b.n(o),m=function(){"use strict";function S(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};(0,f.Z)(this,S),this.index=0,this.repeatCount=0,this.repeatNum=0,this.isPlaying=!1,this.chainedList=[],this.children=[],this.options=(0,e.Z)({},{isdev:!1},d)}var k=S.prototype;return k.start=function(){return this.isPlaying?this:(this.index=0,this.isPlaying=!0,this.play())},k.stop1=function(){return this.isPlaying?(this.isPlaying=!1,this.repeatCount=0,this):this},k.stop=function(){return this.traverse(function(p){return p.stop1()}),this},k.dispose=function(){return this.stop(),this.chainedList=[],this.children=[],this},k.play=function(){var p=this;return(0,u.Z)(s().mark(function y(){var P;return s().wrap(function(L){for(;;)switch(L.prev=L.next){case 0:if(P=p.chainedList[p.index],!(P&&p.isPlaying)){L.next=9;break}return L.next=4,Promise.all(P.map(function(w){return typeof w=="function"?w(p.repeatCount):w.start()}));case 4:return p.index+=1,L.next=7,p.play();case 7:L.next=17;break;case 9:if(!(!P&&p.isPlaying&&p.repeatCount<p.repeatNum)){L.next=16;break}return p.repeatCount+=1,p.index=0,L.next=14,p.play();case 14:L.next=17;break;case 16:!P&&p.isPlaying&&p.repeatCount===p.repeatNum&&p.stop();case 17:case"end":return L.stop()}},y)}))()},k.chain=function(){for(var p=arguments.length,y=new Array(p),P=0;P<p;P++)y[P]=arguments[P];var z=this;return(0,n.Z)(y).forEach(function(L){L instanceof S&&z.children.push(L)}),this.chainedList.push((0,n.Z)(y)),this},k.repeat=function(p){return this.repeatNum=p,this},k.timeout=function(p){return this.chain(function(){return new Promise(function(y){return setTimeout(y,p)})}),this},k.traverse=function(p){p(this),this.children.forEach(function(y){y.traverse(p)})},S}(),l=b(713),g=b(695),E=b(644);function O(S){if(S.material){var k=Array.isArray(S.material)?S.material:[S.material];k.forEach(function(d){var p,y;(p=d.color)===null||p===void 0||p.convertSRGBToLinear(),(y=d.emissive)===null||y===void 0||y.convertSRGBToLinear(),d.map&&(d.map.encoding=E.sRGBEncoding),d.emissiveMap&&(d.emissiveMap.encoding=E.sRGBEncoding)})}}var j=b(738),R=b(924),Z=require("idb-keyval"),T=Z.del,G=Z.clear,D=function(){var S=(0,u.Z)(s().mark(function k(d,p){var y,P,z,L,w,M;return s().wrap(function(B){for(;;)switch(B.prev=B.next){case 0:return y=p.version,B.next=4,(0,Z.get)(d);case 4:if(z=B.sent,!(z&&z[y])){B.next=9;break}P=z[y],B.next=15;break;case 9:return B.next=11,(0,c.Z)(fetch(d).then(function(r){if(r.ok)return r.blob();throw new Error}));case 11:L=B.sent,w=L.res,M=L.err,M||(P=w,(0,Z.set)(d,(0,R.Z)({},y,w)));case 15:return B.abrupt("return",P?{url:URL.createObjectURL(P)}:{url:d});case 16:case"end":return B.stop()}},k)}));return function(d,p){return S.apply(this,arguments)}}(),C=b(490),W=b(705)})(),module.exports=F})();
1
+ (function(){var H={666:function(v){var c=function(o){"use strict";var u=Object.prototype,f=u.hasOwnProperty,n,i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",m=i.toStringTag||"@@toStringTag";function l(r,t,e){return Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}),r[t]}try{l({},"")}catch(r){l=function(t,e,_){return t[e]=_}}function w(r,t,e,_){var p=t&&t.prototype instanceof G?t:G,A=Object.create(p.prototype),z=new O(_||[]);return A._invoke=k(r,e,z),A}o.wrap=w;function E(r,t,e){try{return{type:"normal",arg:r.call(t,e)}}catch(_){return{type:"throw",arg:_}}}var M="suspendedStart",j="suspendedYield",V="executing",Z="completed",L={};function G(){}function D(){}function C(){}var B={};l(B,a,function(){return this});var S=Object.getPrototypeOf,P=S&&S(S(N([])));P&&P!==u&&f.call(P,a)&&(B=P);var d=C.prototype=G.prototype=Object.create(B);D.prototype=C,l(d,"constructor",C),l(C,"constructor",D),D.displayName=l(C,m,"GeneratorFunction");function h(r){["next","throw","return"].forEach(function(t){l(r,t,function(e){return this._invoke(t,e)})})}o.isGeneratorFunction=function(r){var t=typeof r=="function"&&r.constructor;return t?t===D||(t.displayName||t.name)==="GeneratorFunction":!1},o.mark=function(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,C):(r.__proto__=C,l(r,m,"GeneratorFunction")),r.prototype=Object.create(d),r},o.awrap=function(r){return{__await:r}};function g(r,t){function e(A,z,I,W){var U=E(r[A],r,z);if(U.type==="throw")W(U.arg);else{var Y=U.arg,$=Y.value;return $&&typeof $=="object"&&f.call($,"__await")?t.resolve($.__await).then(function(x){e("next",x,I,W)},function(x){e("throw",x,I,W)}):t.resolve($).then(function(x){Y.value=x,I(Y)},function(x){return e("throw",x,I,W)})}}var _;function p(A,z){function I(){return new t(function(W,U){e(A,z,W,U)})}return _=_?_.then(I,I):I()}this._invoke=p}h(g.prototype),l(g.prototype,s,function(){return this}),o.AsyncIterator=g,o.async=function(r,t,e,_,p){p===void 0&&(p=Promise);var A=new g(w(r,t,e,_),p);return o.isGeneratorFunction(t)?A:A.next().then(function(z){return z.done?z.value:A.next()})};function k(r,t,e){var _=M;return function(A,z){if(_===V)throw new Error("Generator is already running");if(_===Z){if(A==="throw")throw z;return K()}for(e.method=A,e.arg=z;;){var I=e.delegate;if(I){var W=R(I,e);if(W){if(W===L)continue;return W}}if(e.method==="next")e.sent=e._sent=e.arg;else if(e.method==="throw"){if(_===M)throw _=Z,e.arg;e.dispatchException(e.arg)}else e.method==="return"&&e.abrupt("return",e.arg);_=V;var U=E(r,t,e);if(U.type==="normal"){if(_=e.done?Z:j,U.arg===L)continue;return{value:U.arg,done:e.done}}else U.type==="throw"&&(_=Z,e.method="throw",e.arg=U.arg)}}}function R(r,t){var e=r.iterator[t.method];if(e===n){if(t.delegate=null,t.method==="throw"){if(r.iterator.return&&(t.method="return",t.arg=n,R(r,t),t.method==="throw"))return L;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return L}var _=E(e,r.iterator,t.arg);if(_.type==="throw")return t.method="throw",t.arg=_.arg,t.delegate=null,L;var p=_.arg;if(!p)return t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,L;if(p.done)t[r.resultName]=p.value,t.next=r.nextLoc,t.method!=="return"&&(t.method="next",t.arg=n);else return p;return t.delegate=null,L}h(d),l(d,m,"Generator"),l(d,a,function(){return this}),l(d,"toString",function(){return"[object Generator]"});function T(r){var t={tryLoc:r[0]};1 in r&&(t.catchLoc=r[1]),2 in r&&(t.finallyLoc=r[2],t.afterLoc=r[3]),this.tryEntries.push(t)}function y(r){var t=r.completion||{};t.type="normal",delete t.arg,r.completion=t}function O(r){this.tryEntries=[{tryLoc:"root"}],r.forEach(T,this),this.reset(!0)}o.keys=function(r){var t=[];for(var e in r)t.push(e);return t.reverse(),function _(){for(;t.length;){var p=t.pop();if(p in r)return _.value=p,_.done=!1,_}return _.done=!0,_}};function N(r){if(r){var t=r[a];if(t)return t.call(r);if(typeof r.next=="function")return r;if(!isNaN(r.length)){var e=-1,_=function p(){for(;++e<r.length;)if(f.call(r,e))return p.value=r[e],p.done=!1,p;return p.value=n,p.done=!0,p};return _.next=_}}return{next:K}}o.values=N;function K(){return{value:n,done:!0}}return O.prototype={constructor:O,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(y),!r)for(var t in this)t.charAt(0)==="t"&&f.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=n)},stop:function(){this.done=!0;var r=this.tryEntries[0],t=r.completion;if(t.type==="throw")throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var t=this;function e(W,U){return A.type="throw",A.arg=r,t.next=W,U&&(t.method="next",t.arg=n),!!U}for(var _=this.tryEntries.length-1;_>=0;--_){var p=this.tryEntries[_],A=p.completion;if(p.tryLoc==="root")return e("end");if(p.tryLoc<=this.prev){var z=f.call(p,"catchLoc"),I=f.call(p,"finallyLoc");if(z&&I){if(this.prev<p.catchLoc)return e(p.catchLoc,!0);if(this.prev<p.finallyLoc)return e(p.finallyLoc)}else if(z){if(this.prev<p.catchLoc)return e(p.catchLoc,!0)}else if(I){if(this.prev<p.finallyLoc)return e(p.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(r,t){for(var e=this.tryEntries.length-1;e>=0;--e){var _=this.tryEntries[e];if(_.tryLoc<=this.prev&&f.call(_,"finallyLoc")&&this.prev<_.finallyLoc){var p=_;break}}p&&(r==="break"||r==="continue")&&p.tryLoc<=t&&t<=p.finallyLoc&&(p=null);var A=p?p.completion:{};return A.type=r,A.arg=t,p?(this.method="next",this.next=p.finallyLoc,L):this.complete(A)},complete:function(r,t){if(r.type==="throw")throw r.arg;return r.type==="break"||r.type==="continue"?this.next=r.arg:r.type==="return"?(this.rval=this.arg=r.arg,this.method="return",this.next="end"):r.type==="normal"&&t&&(this.next=t),L},finish:function(r){for(var t=this.tryEntries.length-1;t>=0;--t){var e=this.tryEntries[t];if(e.finallyLoc===r)return this.complete(e.completion,e.afterLoc),y(e),L}},catch:function(r){for(var t=this.tryEntries.length-1;t>=0;--t){var e=this.tryEntries[t];if(e.tryLoc===r){var _=e.completion;if(_.type==="throw"){var p=_.arg;y(e)}return p}}throw new Error("illegal catch attempt")},delegateYield:function(r,t,e){return this.delegate={iterator:N(r),resultName:t,nextLoc:e},this.method==="next"&&(this.arg=n),L}},o}(v.exports);try{regeneratorRuntime=c}catch(o){typeof globalThis=="object"?globalThis.regeneratorRuntime=c:Function("r","regeneratorRuntime = r")(c)}},695:function(v,c,o){"use strict";o.d(c,{Z:function(){return u}});function u(f){if(f.geometry&&f.geometry.dispose(),f.material){var n=Array.isArray(f.material)?f.material:[f.material];n.forEach(function(i){var a,s,m,l,w,E,M,j,V,Z,L,G,D;(a=i.map)===null||a===void 0||a.dispose(),(s=i.lightMap)===null||s===void 0||s.dispose(),(m=i.bumpMap)===null||m===void 0||m.dispose(),(l=i.normalMap)===null||l===void 0||l.dispose(),(w=i.specularMap)===null||w===void 0||w.dispose(),(E=i.envMap)===null||E===void 0||E.dispose(),(M=i.alphaMap)===null||M===void 0||M.dispose(),(j=i.aoMap)===null||j===void 0||j.dispose(),(V=i.displacementMap)===null||V===void 0||V.dispose(),(Z=i.emissiveMap)===null||Z===void 0||Z.dispose(),(L=i.gradientMap)===null||L===void 0||L.dispose(),(G=i.metalnessMap)===null||G===void 0||G.dispose(),(D=i.roughnessMap)===null||D===void 0||D.dispose(),i.dispose()})}}},490:function(v,c,o){"use strict";o.d(c,{U:function(){return f},v:function(){return u}});var u=function(n){for(var i=n.offsetLeft,a=n.offsetParent;a!==null;)i+=a.offsetLeft,a=a.offsetParent;var s;return document.compatMode==="BackCompat"||document.documentElement.scrollTop===0?s=document.body.scrollLeft:s=document.documentElement.scrollLeft,i-s},f=function(n){for(var i=n.offsetTop,a=n.offsetParent;a!==null;)i+=a.offsetTop,a=a.offsetParent;var s;return document.compatMode==="BackCompat"||document.documentElement.scrollTop===0?s=document.body.scrollTop:s=document.documentElement.scrollTop,i-s}},738:function(v,c,o){"use strict";o.d(c,{Z:function(){return f}});function u(n){return Object.prototype.toString.call(n)==="[object Object]"}function f(n){if(u(n)===!1)return!1;var i=n.constructor;if(i===void 0)return!0;var a=i.prototype;return!(u(a)===!1||a.hasOwnProperty("isPrototypeOf")===!1)}},282:function(v,c,o){"use strict";o.d(c,{Z:function(){return f}});var u=o(484);function f(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a={};return a.promise=new Promise(function(s,m){a.resolve=s,a.reject=m}),n&&(a.promise=(0,u.Z)(a.promise,i)),a}},713:function(v,c,o){"use strict";o.d(c,{Z:function(){return u}});function u(f,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=(90-n)*Math.PI/180,s=(90-f)*Math.PI/180;return[i*Math.sin(a)*Math.cos(s),i*Math.cos(a),i*Math.sin(a)*Math.sin(s)]}},618:function(v,c,o){"use strict";o.d(c,{Z:function(){return n}});var u=o(438),f=function(){"use strict";function i(s){(0,u.Z)(this,i),this.onTick_=s,this.cancelPending_=null}var a=i.prototype;return a.tickAfter=function(m){var l=this;this.stop();var w=!0,E;this.cancelPending_=function(){clearTimeout(E),w=!1};var M=function(){w&&l.onTick_()};return E=window.setTimeout(M,m),this},a.stop=function(){this.cancelPending_&&(this.cancelPending_(),this.cancelPending_=null)},i}(),n=function(){"use strict";function i(s){(0,u.Z)(this,i),this.onTick_=s,this.ticker_=null}var a=i.prototype;return a.tickNow=function(){return this.stop(),this.onTick_(),this},a.tickAfter=function(m){var l=this;return this.stop(),this.ticker_=new f(function(){l.onTick_()}).tickAfter(m),this},a.tickEvery=function(m){var l=this;return this.stop(),this.ticker_=new f(function(){var w;(w=l.ticker_)===null||w===void 0||w.tickAfter(m),l.onTick_()}).tickAfter(m),this},a.stop=function(){this.ticker_&&(this.ticker_.stop(),this.ticker_=null)},i}()},484:function(v,c,o){"use strict";o.d(c,{Z:function(){return f}});var u=o(42);function f(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return n.then(function(a){return(0,u.Z)({err:null,res:a},i)}).catch(function(a){return(0,u.Z)({err:a,res:void 0},i)})}},705:function(v,c,o){"use strict";o.d(c,{C:function(){return a},y:function(){return i}});var u=o(644),f=o.n(u),n=new Map,i=function(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{generateTopUV:function(m,l,w,E,M){var j=l[w*3],V=l[w*3+1],Z=l[E*3],L=l[E*3+1],G=l[M*3],D=l[M*3+1],C;if(n.has(m))C=n.get(m);else{var B=s.box3||new u.Box3;if(!s.box3){var S=m.parameters.shapes.getPoints();B.setFromArray(S.map(function(k){return[k.x,k.y,0]}).flat())}var P=B.getSize(new u.Vector3);s.split&&(P.y/=s.split),C={box:B,size:P},n.set(m,C)}var d=C.box,h=C.size,g=s.split?1-s.split:0;return[new u.Vector2((j-d.min.x)/h.x,(V-d.min.y)/h.y+g),new u.Vector2((Z-d.min.x)/h.x,(L-d.min.y)/h.y+g),new u.Vector2((G-d.min.x)/h.x,(D-d.min.y)/h.y+g)]},generateSideWallUV:function(m,l,w,E,M,j){var V=l[w*3],Z=l[w*3+1],L=l[w*3+2],G=l[E*3],D=l[E*3+1],C=l[E*3+2],B=l[M*3],S=l[M*3+1],P=l[M*3+2],d=l[j*3],h=l[j*3+1],g=l[j*3+2],k;if(n.has(l))k=n.get(l);else{var R=new u.Box3;R.setFromArray(l);var T=R.getSize(new u.Vector3);s.split&&(T.z/=1-s.split),k={box:R,size:T},n.set(l,k)}var y=k.box,O=k.size;return Math.abs(Z-D)<Math.abs(V-G)?[new u.Vector2((V-y.min.x)/O.x,(L-y.min.z)/O.z),new u.Vector2((G-y.min.x)/O.x,(C-y.min.z)/O.z),new u.Vector2((B-y.min.x)/O.x,(P-y.min.z)/O.z),new u.Vector2((d-y.min.x)/O.x,(g-y.min.z)/O.z)]:[new u.Vector2((Z-y.min.y)/O.y,(L-y.min.z)/O.z),new u.Vector2((D-y.min.y)/O.y,(C-y.min.z)/O.z),new u.Vector2((S-y.min.y)/O.y,(P-y.min.z)/O.z),new u.Vector2((h-y.min.y)/O.y,(g-y.min.z)/O.z)]}}},a=function(){n.clear()}},360:function(v){"use strict";v.exports=require("idb-keyval")},644:function(v){"use strict";v.exports=require("three")},943:function(v,c,o){"use strict";o.d(c,{Z:function(){return u}});function u(f,n){(n==null||n>f.length)&&(n=f.length);for(var i=0,a=new Array(n);i<n;i++)a[i]=f[i];return a}},982:function(v,c,o){"use strict";o.d(c,{Z:function(){return f}});var u=o(943);function f(n){if(Array.isArray(n))return(0,u.Z)(n)}},568:function(v,c,o){"use strict";o.d(c,{Z:function(){return f}});function u(n,i,a,s,m,l,w){try{var E=n[l](w),M=E.value}catch(j){a(j);return}E.done?i(M):Promise.resolve(M).then(s,m)}function f(n){return function(){var i=this,a=arguments;return new Promise(function(s,m){var l=n.apply(i,a);function w(M){u(l,s,m,w,E,"next",M)}function E(M){u(l,s,m,w,E,"throw",M)}w(void 0)})}}},438:function(v,c,o){"use strict";o.d(c,{Z:function(){return u}});function u(f,n){if(!(f instanceof n))throw new TypeError("Cannot call a class as a function")}},924:function(v,c,o){"use strict";o.d(c,{Z:function(){return u}});function u(f,n,i){return n in f?Object.defineProperty(f,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):f[n]=i,f}},375:function(v,c,o){"use strict";o.d(c,{Z:function(){return u}});function u(f){if(typeof Symbol!="undefined"&&f[Symbol.iterator]!=null||f["@@iterator"]!=null)return Array.from(f)}},270:function(v,c,o){"use strict";o.d(c,{Z:function(){return u}});function u(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},42:function(v,c,o){"use strict";o.d(c,{Z:function(){return f}});var u=o(924);function f(n){for(var i=1;i<arguments.length;i++){var a=arguments[i]!=null?arguments[i]:{},s=Object.keys(a);typeof Object.getOwnPropertySymbols=="function"&&(s=s.concat(Object.getOwnPropertySymbols(a).filter(function(m){return Object.getOwnPropertyDescriptor(a,m).enumerable}))),s.forEach(function(m){(0,u.Z)(n,m,a[m])})}return n}},342:function(v,c,o){"use strict";o.d(c,{Z:function(){return a}});var u=o(982),f=o(375),n=o(270),i=o(566);function a(s){return(0,u.Z)(s)||(0,f.Z)(s)||(0,i.Z)(s)||(0,n.Z)()}},566:function(v,c,o){"use strict";o.d(c,{Z:function(){return f}});var u=o(943);function f(n,i){if(!!n){if(typeof n=="string")return(0,u.Z)(n,i);var a=Object.prototype.toString.call(n).slice(8,-1);if(a==="Object"&&n.constructor&&(a=n.constructor.name),a==="Map"||a==="Set")return Array.from(a);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return(0,u.Z)(n,i)}}}},X={};function b(v){var c=X[v];if(c!==void 0)return c.exports;var o=X[v]={exports:{}};return H[v](o,o.exports,b),o.exports}(function(){b.n=function(v){var c=v&&v.__esModule?function(){return v.default}:function(){return v};return b.d(c,{a:c}),c}})(),function(){b.d=function(v,c){for(var o in c)b.o(c,o)&&!b.o(v,o)&&Object.defineProperty(v,o,{enumerable:!0,get:c[o]})}}(),function(){b.o=function(v,c){return Object.prototype.hasOwnProperty.call(v,c)}}(),function(){b.r=function(v){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(v,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(v,"__esModule",{value:!0})}}();var F={};(function(){"use strict";b.r(F),b.d(F,{Chain:function(){return m},Timer:function(){return o.Z},claerUVGenerator:function(){return B.C},clearAllCache:function(){return G},clearCache:function(){return L},colorCorrection:function(){return M},disposeMesh:function(){return w.Z},getCache:function(){return D},getElementViewLeft:function(){return C.v},getElementViewTop:function(){return C.U},getUVGenerator:function(){return B.y},isPlainObject:function(){return j.Z},makePromiseCreator:function(){return v.Z},polar2Cartesian:function(){return l.Z},to:function(){return c.Z}});var v=b(282),c=b(484),o=b(618),u=b(568),f=b(438),n=b(42),i=b(342),a=b(666),s=b.n(a),m=function(){"use strict";function S(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};(0,f.Z)(this,S),this.index=0,this.repeatCount=0,this.repeatNum=0,this.isPlaying=!1,this.chainedList=[],this.children=[],this.options=(0,n.Z)({},{isdev:!1},d)}var P=S.prototype;return P.start=function(){return this.isPlaying?this:(this.index=0,this.isPlaying=!0,this.play())},P.stop1=function(){return this.isPlaying?(this.isPlaying=!1,this.repeatCount=0,this):this},P.stop=function(){return this.traverse(function(h){return h.stop1()}),this},P.dispose=function(){return this.stop(),this.chainedList=[],this.children=[],this},P.play=function(){var h=this;return(0,u.Z)(s().mark(function g(){var k;return s().wrap(function(T){for(;;)switch(T.prev=T.next){case 0:if(k=h.chainedList[h.index],!(k&&h.isPlaying)){T.next=9;break}return T.next=4,Promise.all(k.map(function(y){return typeof y=="function"?y(h.repeatCount):y.start()}));case 4:return h.index+=1,T.next=7,h.play();case 7:T.next=17;break;case 9:if(!(!k&&h.isPlaying&&h.repeatCount<h.repeatNum)){T.next=16;break}return h.repeatCount+=1,h.index=0,T.next=14,h.play();case 14:T.next=17;break;case 16:!k&&h.isPlaying&&h.repeatCount===h.repeatNum&&h.stop();case 17:case"end":return T.stop()}},g)}))()},P.chain=function(){for(var h=arguments.length,g=new Array(h),k=0;k<h;k++)g[k]=arguments[k];var R=this;return(0,i.Z)(g).forEach(function(T){T instanceof S&&R.children.push(T)}),this.chainedList.push((0,i.Z)(g)),this},P.repeat=function(h){return this.repeatNum=h,this},P.timeout=function(h){return this.chain(function(){return new Promise(function(g){return setTimeout(g,h)})}),this},P.traverse=function(h){h(this),this.children.forEach(function(g){g.traverse(h)})},S}(),l=b(713),w=b(695),E=b(644);function M(S){if(S.material){var P=Array.isArray(S.material)?S.material:[S.material];P.forEach(function(d){var h,g;(h=d.color)===null||h===void 0||h.convertSRGBToLinear(),(g=d.emissive)===null||g===void 0||g.convertSRGBToLinear(),d.map&&(d.map.encoding=E.sRGBEncoding),d.emissiveMap&&(d.emissiveMap.encoding=E.sRGBEncoding)})}}var j=b(738),V=b(924),Z=b(360),L=Z.del,G=Z.clear,D=function(){var S=(0,u.Z)(s().mark(function P(d,h){var g,k,R,T,y,O,N,K,r;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return g=h.type,k=g===void 0?"blob":g,R=h.version,T=R===void 0?"1":R,e.next=4,(0,Z.get)(d);case 4:if(O=e.sent,!(O&&O[T])){e.next=9;break}y=O[T],e.next=15;break;case 9:return e.next=11,(0,c.Z)(fetch(d).then(function(_){if(_.ok)return _[k]();throw new Error}));case 11:N=e.sent,K=N.res,r=N.err,r||(y=K,(0,Z.set)(d,(0,V.Z)({},T,K)));case 15:return e.abrupt("return",y?{url:k==="json"?d:URL.createObjectURL(y),store:y}:{url:d});case 16:case"end":return e.stop()}},P)}));return function(d,h){return S.apply(this,arguments)}}(),C=b(490),B=b(705)})(),module.exports=F})();