gl-draw 0.3.10 → 0.3.12

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 tt from"idb-keyval";import*as W from"three";import*as Ut from"three/examples/jsm/renderers/CSS2DRenderer";import*as rt from"three/examples/jsm/renderers/CSS3DRenderer";import*as nt from"popmotion";import*as Nt from"three/examples/jsm//utils/BufferGeometryUtils";import*as Fe from"d3-array";import*as Ft from"earcut";import*as It from"@turf/boolean-clockwise";import*as Zt from"delaunator";import*as Xt from"@turf/boolean-point-in-polygon";import*as Re from"d3-geo";import*as Ht from"d3-geo-voronoi";import*as Kt from"d3-scale";var $t={666:function(L){var j=function(w){"use strict";var P=Object.prototype,M=P.hasOwnProperty,B,O=typeof Symbol=="function"?Symbol:{},T=O.iterator||"@@iterator",Z=O.asyncIterator||"@@asyncIterator",x=O.toStringTag||"@@toStringTag";function k(f,u,p){return Object.defineProperty(f,u,{value:p,enumerable:!0,configurable:!0,writable:!0}),f[u]}try{k({},"")}catch(f){k=function(u,p,S){return u[p]=S}}function Y(f,u,p,S){var g=u&&u.prototype instanceof ie?u:ie,Q=Object.create(g.prototype),K=new Se(S||[]);return Q._invoke=ue(f,p,K),Q}w.wrap=Y;function J(f,u,p){try{return{type:"normal",arg:f.call(u,p)}}catch(S){return{type:"throw",arg:S}}}var R="suspendedStart",s="suspendedYield",oe="executing",re="completed",$={};function ie(){}function G(){}function F(){}var D={};k(D,T,function(){return this});var X=Object.getPrototypeOf,U=X&&X(X(Te([])));U&&U!==P&&M.call(U,T)&&(D=U);var H=F.prototype=ie.prototype=Object.create(D);G.prototype=F,k(H,"constructor",F),k(F,"constructor",G),G.displayName=k(F,x,"GeneratorFunction");function I(f){["next","throw","return"].forEach(function(u){k(f,u,function(p){return this._invoke(u,p)})})}w.isGeneratorFunction=function(f){var u=typeof f=="function"&&f.constructor;return u?u===G||(u.displayName||u.name)==="GeneratorFunction":!1},w.mark=function(f){return Object.setPrototypeOf?Object.setPrototypeOf(f,F):(f.__proto__=F,k(f,x,"GeneratorFunction")),f.prototype=Object.create(H),f},w.awrap=function(f){return{__await:f}};function q(f,u){function p(Q,K,ae,se){var ne=J(f[Q],f,K);if(ne.type==="throw")se(ne.arg);else{var Oe=ne.arg,Ce=Oe.value;return Ce&&typeof Ce=="object"&&M.call(Ce,"__await")?u.resolve(Ce.__await).then(function(xe){p("next",xe,ae,se)},function(xe){p("throw",xe,ae,se)}):u.resolve(Ce).then(function(xe){Oe.value=xe,ae(Oe)},function(xe){return p("throw",xe,ae,se)})}}var S;function g(Q,K){function ae(){return new u(function(se,ne){p(Q,K,se,ne)})}return S=S?S.then(ae,ae):ae()}this._invoke=g}I(q.prototype),k(q.prototype,Z,function(){return this}),w.AsyncIterator=q,w.async=function(f,u,p,S,g){g===void 0&&(g=Promise);var Q=new q(Y(f,u,p,S),g);return w.isGeneratorFunction(u)?Q:Q.next().then(function(K){return K.done?K.value:Q.next()})};function ue(f,u,p){var S=R;return function(Q,K){if(S===oe)throw new Error("Generator is already running");if(S===re){if(Q==="throw")throw K;return Le()}for(p.method=Q,p.arg=K;;){var ae=p.delegate;if(ae){var se=_e(ae,p);if(se){if(se===$)continue;return se}}if(p.method==="next")p.sent=p._sent=p.arg;else if(p.method==="throw"){if(S===R)throw S=re,p.arg;p.dispatchException(p.arg)}else p.method==="return"&&p.abrupt("return",p.arg);S=oe;var ne=J(f,u,p);if(ne.type==="normal"){if(S=p.done?re:s,ne.arg===$)continue;return{value:ne.arg,done:p.done}}else ne.type==="throw"&&(S=re,p.method="throw",p.arg=ne.arg)}}}function _e(f,u){var p=f.iterator[u.method];if(p===B){if(u.delegate=null,u.method==="throw"){if(f.iterator.return&&(u.method="return",u.arg=B,_e(f,u),u.method==="throw"))return $;u.method="throw",u.arg=new TypeError("The iterator does not provide a 'throw' method")}return $}var S=J(p,f.iterator,u.arg);if(S.type==="throw")return u.method="throw",u.arg=S.arg,u.delegate=null,$;var g=S.arg;if(!g)return u.method="throw",u.arg=new TypeError("iterator result is not an object"),u.delegate=null,$;if(g.done)u[f.resultName]=g.value,u.next=f.nextLoc,u.method!=="return"&&(u.method="next",u.arg=B);else return g;return u.delegate=null,$}I(H),k(H,x,"Generator"),k(H,T,function(){return this}),k(H,"toString",function(){return"[object Generator]"});function ee(f){var u={tryLoc:f[0]};1 in f&&(u.catchLoc=f[1]),2 in f&&(u.finallyLoc=f[2],u.afterLoc=f[3]),this.tryEntries.push(u)}function z(f){var u=f.completion||{};u.type="normal",delete u.arg,f.completion=u}function Se(f){this.tryEntries=[{tryLoc:"root"}],f.forEach(ee,this),this.reset(!0)}w.keys=function(f){var u=[];for(var p in f)u.push(p);return u.reverse(),function S(){for(;u.length;){var g=u.pop();if(g in f)return S.value=g,S.done=!1,S}return S.done=!0,S}};function Te(f){if(f){var u=f[T];if(u)return u.call(f);if(typeof f.next=="function")return f;if(!isNaN(f.length)){var p=-1,S=function g(){for(;++p<f.length;)if(M.call(f,p))return g.value=f[p],g.done=!1,g;return g.value=B,g.done=!0,g};return S.next=S}}return{next:Le}}w.values=Te;function Le(){return{value:B,done:!0}}return Se.prototype={constructor:Se,reset:function(f){if(this.prev=0,this.next=0,this.sent=this._sent=B,this.done=!1,this.delegate=null,this.method="next",this.arg=B,this.tryEntries.forEach(z),!f)for(var u in this)u.charAt(0)==="t"&&M.call(this,u)&&!isNaN(+u.slice(1))&&(this[u]=B)},stop:function(){this.done=!0;var f=this.tryEntries[0],u=f.completion;if(u.type==="throw")throw u.arg;return this.rval},dispatchException:function(f){if(this.done)throw f;var u=this;function p(se,ne){return Q.type="throw",Q.arg=f,u.next=se,ne&&(u.method="next",u.arg=B),!!ne}for(var S=this.tryEntries.length-1;S>=0;--S){var g=this.tryEntries[S],Q=g.completion;if(g.tryLoc==="root")return p("end");if(g.tryLoc<=this.prev){var K=M.call(g,"catchLoc"),ae=M.call(g,"finallyLoc");if(K&&ae){if(this.prev<g.catchLoc)return p(g.catchLoc,!0);if(this.prev<g.finallyLoc)return p(g.finallyLoc)}else if(K){if(this.prev<g.catchLoc)return p(g.catchLoc,!0)}else if(ae){if(this.prev<g.finallyLoc)return p(g.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(f,u){for(var p=this.tryEntries.length-1;p>=0;--p){var S=this.tryEntries[p];if(S.tryLoc<=this.prev&&M.call(S,"finallyLoc")&&this.prev<S.finallyLoc){var g=S;break}}g&&(f==="break"||f==="continue")&&g.tryLoc<=u&&u<=g.finallyLoc&&(g=null);var Q=g?g.completion:{};return Q.type=f,Q.arg=u,g?(this.method="next",this.next=g.finallyLoc,$):this.complete(Q)},complete:function(f,u){if(f.type==="throw")throw f.arg;return f.type==="break"||f.type==="continue"?this.next=f.arg:f.type==="return"?(this.rval=this.arg=f.arg,this.method="return",this.next="end"):f.type==="normal"&&u&&(this.next=u),$},finish:function(f){for(var u=this.tryEntries.length-1;u>=0;--u){var p=this.tryEntries[u];if(p.finallyLoc===f)return this.complete(p.completion,p.afterLoc),z(p),$}},catch:function(f){for(var u=this.tryEntries.length-1;u>=0;--u){var p=this.tryEntries[u];if(p.tryLoc===f){var S=p.completion;if(S.type==="throw"){var g=S.arg;z(p)}return g}}throw new Error("illegal catch attempt")},delegateYield:function(f,u,p){return this.delegate={iterator:Te(f),resultName:u,nextLoc:p},this.method==="next"&&(this.arg=B),$}},w}(L.exports);try{regeneratorRuntime=j}catch(w){typeof globalThis=="object"?globalThis.regeneratorRuntime=j:Function("r","regeneratorRuntime = r")(j)}},695:function(L,j,w){w.d(j,{Z:function(){return P}});function P(M){if(M.geometry&&M.geometry.dispose(),M.material){var B=Array.isArray(M.material)?M.material:[M.material];B.forEach(function(O){var T,Z,x,k,Y,J,R,s,oe,re,$,ie,G;(T=O.map)===null||T===void 0||T.dispose(),(Z=O.lightMap)===null||Z===void 0||Z.dispose(),(x=O.bumpMap)===null||x===void 0||x.dispose(),(k=O.normalMap)===null||k===void 0||k.dispose(),(Y=O.specularMap)===null||Y===void 0||Y.dispose(),(J=O.envMap)===null||J===void 0||J.dispose(),(R=O.alphaMap)===null||R===void 0||R.dispose(),(s=O.aoMap)===null||s===void 0||s.dispose(),(oe=O.displacementMap)===null||oe===void 0||oe.dispose(),(re=O.emissiveMap)===null||re===void 0||re.dispose(),($=O.gradientMap)===null||$===void 0||$.dispose(),(ie=O.metalnessMap)===null||ie===void 0||ie.dispose(),(G=O.roughnessMap)===null||G===void 0||G.dispose(),O.dispose()})}}},521:function(L,j,w){w.d(j,{wf:function(){return O.Z}});var P=w(666),M=w.n(P),B=null,O=w(695),T=w(949);function Z(G){if(G.material){var F=Array.isArray(G.material)?G.material:[G.material];F.forEach(function(D){var X,U;(X=D.color)===null||X===void 0||X.convertSRGBToLinear(),(U=D.emissive)===null||U===void 0||U.convertSRGBToLinear(),D.map&&(D.map.encoding=THREE.sRGBEncoding),D.emissiveMap&&(D.emissiveMap.encoding=THREE.sRGBEncoding)})}}var x=w(568),k=w(924),Y=G=>{var F={};return w.d(F,G),F},J=G=>()=>G,R=Y({get:()=>tt.get,set:()=>tt.set}),s=w(484),oe=null,re=null,$=function(){var G=(0,x.Z)(M().mark(function F(D,X){var U,H,I,q,ue,_e;return M().wrap(function(z){for(;;)switch(z.prev=z.next){case 0:return U=X.version,z.next=4,(0,R.get)(D);case 4:if(I=z.sent,!(I&&I[U])){z.next=9;break}H=I[U],z.next=15;break;case 9:return z.next=11,(0,s.Z)(fetch(D).then(function(Se){if(Se.ok)return Se.blob();throw new Error}));case 11:q=z.sent,ue=q.res,_e=q.err,_e||(H=ue,(0,R.set)(D,(0,k.Z)({},U,ue)));case 15:return z.abrupt("return",H?{url:URL.createObjectURL(H)}:{url:D});case 16:case"end":return z.stop()}},F)}));return function(D,X){return G.apply(this,arguments)}}(),ie=w(705)},484:function(L,j,w){w.d(j,{Z:function(){return M}});var P=w(42);function M(B){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return B.then(function(T){return(0,P.Z)({err:null,res:T},O)}).catch(function(T){return(0,P.Z)({err:T,res:void 0},O)})}},705:function(L,j,w){w.d(j,{C:function(){return O},y:function(){return B}});var P=w(949),M=new Map,B=function(){var T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{generateTopUV:function(Z,x,k,Y,J){var R=x[k*3],s=x[k*3+1],oe=x[Y*3],re=x[Y*3+1],$=x[J*3],ie=x[J*3+1],G;if(M.has(Z))G=M.get(Z);else{var F=T.box3||new P.Box3;if(!T.box3){var D=Z.parameters.shapes.getPoints();F.setFromArray(D.map(function(q){return[q.x,q.y,0]}).flat())}var X=F.getSize(new P.Vector3);T.split&&(X.y/=T.split),G={box:F,size:X},M.set(Z,G)}var U=G.box,H=G.size,I=T.split?1-T.split:0;return[new P.Vector2((R-U.min.x)/H.x,(s-U.min.y)/H.y+I),new P.Vector2((oe-U.min.x)/H.x,(re-U.min.y)/H.y+I),new P.Vector2(($-U.min.x)/H.x,(ie-U.min.y)/H.y+I)]},generateSideWallUV:function(Z,x,k,Y,J,R){var s=x[k*3],oe=x[k*3+1],re=x[k*3+2],$=x[Y*3],ie=x[Y*3+1],G=x[Y*3+2],F=x[J*3],D=x[J*3+1],X=x[J*3+2],U=x[R*3],H=x[R*3+1],I=x[R*3+2],q;if(M.has(x))q=M.get(x);else{var ue=new P.Box3;ue.setFromArray(x);var _e=ue.getSize(new P.Vector3);T.split&&(_e.z/=1-T.split),q={box:ue,size:_e},M.set(x,q)}var ee=q.box,z=q.size;return Math.abs(oe-ie)<Math.abs(s-$)?[new P.Vector2((s-ee.min.x)/z.x,(re-ee.min.z)/z.z),new P.Vector2(($-ee.min.x)/z.x,(G-ee.min.z)/z.z),new P.Vector2((F-ee.min.x)/z.x,(X-ee.min.z)/z.z),new P.Vector2((U-ee.min.x)/z.x,(I-ee.min.z)/z.z)]:[new P.Vector2((oe-ee.min.y)/z.x,(re-ee.min.z)/z.z),new P.Vector2((ie-ee.min.y)/z.x,(G-ee.min.z)/z.z),new P.Vector2((D-ee.min.y)/z.x,(X-ee.min.z)/z.z),new P.Vector2((H-ee.min.y)/z.x,(I-ee.min.z)/z.z)]}}},O=function(){M.clear()}},949:function(L,j,w){var P=B=>{var O={};return w.d(O,B),O},M=B=>()=>B;L.exports=P({Box3:()=>W.Box3,BufferAttribute:()=>W.BufferAttribute,BufferGeometry:()=>W.BufferGeometry,CanvasTexture:()=>W.CanvasTexture,Color:()=>W.Color,DoubleSide:()=>W.DoubleSide,ExtrudeGeometry:()=>W.ExtrudeGeometry,Float32BufferAttribute:()=>W.Float32BufferAttribute,Group:()=>W.Group,LineSegments:()=>W.LineSegments,Matrix4:()=>W.Matrix4,Mesh:()=>W.Mesh,MeshBasicMaterial:()=>W.MeshBasicMaterial,NormalBlending:()=>W.NormalBlending,PlaneBufferGeometry:()=>W.PlaneBufferGeometry,PlaneGeometry:()=>W.PlaneGeometry,Points:()=>W.Points,RGBAFormat:()=>W.RGBAFormat,Ray:()=>W.Ray,ShaderChunk:()=>W.ShaderChunk,ShaderMaterial:()=>W.ShaderMaterial,Shape:()=>W.Shape,Sphere:()=>W.Sphere,Sprite:()=>W.Sprite,SpriteMaterial:()=>W.SpriteMaterial,Texture:()=>W.Texture,TextureLoader:()=>W.TextureLoader,UniformsLib:()=>W.UniformsLib,Vector2:()=>W.Vector2,Vector3:()=>W.Vector3,VideoTexture:()=>W.VideoTexture})},568:function(L,j,w){w.d(j,{Z:function(){return M}});function P(B,O,T,Z,x,k,Y){try{var J=B[k](Y),R=J.value}catch(s){T(s);return}J.done?O(R):Promise.resolve(R).then(Z,x)}function M(B){return function(){var O=this,T=arguments;return new Promise(function(Z,x){var k=B.apply(O,T);function Y(R){P(k,Z,x,Y,J,"next",R)}function J(R){P(k,Z,x,Y,J,"throw",R)}Y(void 0)})}}},924:function(L,j,w){w.d(j,{Z:function(){return P}});function P(M,B,O){return B in M?Object.defineProperty(M,B,{value:O,enumerable:!0,configurable:!0,writable:!0}):M[B]=O,M}},42:function(L,j,w){w.d(j,{Z:function(){return M}});var P=w(924);function M(B){for(var O=1;O<arguments.length;O++){var T=arguments[O]!=null?arguments[O]:{},Z=Object.keys(T);typeof Object.getOwnPropertySymbols=="function"&&(Z=Z.concat(Object.getOwnPropertySymbols(T).filter(function(x){return Object.getOwnPropertyDescriptor(T,x).enumerable}))),Z.forEach(function(x){(0,P.Z)(B,x,T[x])})}return B}}},it={};function N(L){var j=it[L];if(j!==void 0)return j.exports;var w=it[L]={exports:{}};return $t[L](w,w.exports,N),w.exports}(function(){N.n=function(L){var j=L&&L.__esModule?function(){return L.default}:function(){return L};return N.d(j,{a:j}),j}})(),function(){N.d=function(L,j){for(var w in j)N.o(j,w)&&!N.o(L,w)&&Object.defineProperty(L,w,{enumerable:!0,get:j[w]})}}(),function(){N.o=function(L,j){return Object.prototype.hasOwnProperty.call(L,j)}}();var me={};(function(){N.d(me,{Ei:function(){return Rt},Yo:function(){return zt},Ee:function(){return ae},x1:function(){return pt},VJ:function(){return ge},r7:function(){return Ge},XA:function(){return Ie},NB:function(){return at},xv:function(){return S},nk:function(){return Ce}});function L(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function j(e,n){return j=Object.setPrototypeOf||function(i,a){return i.__proto__=a,i},j(e,n)}function w(e,n){return j(e,n)}function P(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&&w(e,n)}var M=N(42);function B(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 O(e,n){return n=n!=null?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):B(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}),e}function T(){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 x(e){return Z(e)}function k(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Y(e){return e&&e.constructor===Symbol?"symbol":typeof e}function J(e,n){return n&&(Y(n)==="object"||typeof n=="function")?n:k(e)}function R(e){var n=T();return function(){var i=x(e),a;if(n){var t=x(this).constructor;a=Reflect.construct(i,arguments,t)}else a=i.apply(this,arguments);return J(this,a)}}var s=N(949);function oe(){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 oe()?re=Reflect.construct:re=function(a,t,o){var c=[null];c.push.apply(c,t);var h=Function.bind.apply(a,c),v=new h;return o&&w(v,o.prototype),v},re.apply(null,arguments)}function $(e,n,r){return re.apply(null,arguments)}function ie(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 G(e,n,r){return n&&ie(e.prototype,n),r&&ie(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 D(e){if(Array.isArray(e))return F(e)}function X(e){if(typeof Symbol!="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}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.")}function H(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 I(e){return D(e)||X(e)||H(e)||U()}var q=N(484);function ue(){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,q.Z)(r.promise,n)),r}var _e=e=>{var n={};return N.d(n,e),n},ee=e=>()=>e,z=_e({CSS2DObject:()=>Ut.CSS2DObject}),Se=e=>{var n={};return N.d(n,e),n},Te=e=>()=>e,Le=Se({CSS3DObject:()=>rt.CSS3DObject,CSS3DSprite:()=>rt.CSS3DSprite}),f=N(521),u=function(e){e&&((0,f.wf)(e),e.children.forEach(function(n){n.userData.BaseObject_||u(n)}))},p=function(){"use strict";function e(){L(this,e),this.objecttype__="BaseObject",this.userData={},this.pm=ue(),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=$(s.Mesh,I(a)),this},n.createGroup=function(){return this.object3d=new s.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=$(s.Points,I(a)),this},n.createCSS2DObject=function(i){return this.object3d=new z.CSS2DObject(i),this},n.createCSS3DObject=function(i){return this.object3d=new Le.CSS3DObject(i),this},n.createCSS3DSprite=function(i){return this.object3d=new Le.CSS3DSprite(i),this},n.createSprite=function(i){return this.object3d=new s.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 s.Box3().setFromObject(this.object3d);return{min:i.min,max:i.max,size:i.getSize(new s.Vector3)}},n.traverse=function(i){i(this),this.children.forEach(function(a){a.traverse(i)})},n.dispose=function(){u(this.object3d)},G(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}(),S=function(e){"use strict";P(r,e);var n=R(r);function r(a){L(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,c=t.lookAt,h=t.sprite,v=t.text,d=t.sizeAttenuation;if(h){var m=new s.Sprite(new s.SpriteMaterial({transparent:!0,sizeAttenuation:d}));this.object3d=m}else{var _=new s.MeshBasicMaterial({side:s.DoubleSide,transparent:!0}),b=new s.PlaneGeometry(1,1,1,1);this.createMesh(b,_)}this.object3d.position.copy(o),c&&this.object3d.lookAt(c),this.setText(v)},i.setText=function(t,o){var c=(0,M.Z)(O((0,M.Z)({},this.options),{text:t}),o||{}),h=c.text,v=c.fontSize,d=c.fontFamily,m=c.fontWeight,_=c.flipX,b=c.scale,y=this.canvas;y.width=v*h.length*2,y.height=v;var A=y.getContext("2d");A.font="".concat(m," ").concat(v,"px/1 ").concat(d);var l=A.measureText(h).width;y.width=l,this.width=l,A=y.getContext("2d"),A.clearRect(0,0,y.width,y.height),_&&A.scale(-1,1),A.font="".concat(m," ").concat(v,"px/1 ").concat(d),A.textBaseline="middle",A.fillStyle="#ffffff",A.fillText(h,_?l*-1:0,y.height/2),A.restore();var C=new s.Texture(y);C.anisotropy=16,C.needsUpdate=!0;var E=this.object3d;E.material.map&&E.material.map.dispose(),E.material.map=C,E.material.needsUpdate=!0,E.scale.set(C.image.width*b,C.image.height*b,1)},r}(p),g=N(568),Q=N(666),K=N.n(Q),ae=function(e){"use strict";P(r,e);var n=R(r);function r(a){L(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,g.Z)(K().mark(function o(){var c,h,v,d,m,_,b,y,A,l;return K().wrap(function(E){for(;;)switch(E.prev=E.next){case 0:return c=t.options,h=c.transparent,v=c.blending,d=c.src,m=c.depthWrite,_=c.alphaTest,b=c.sprite,y=c.sizeAttenuation,E.next=3,new s.TextureLoader().loadAsync(d);case 3:return A=E.sent,l=b?new s.SpriteMaterial({map:A,transparent:h!=null?h:!1,blending:v!=null?v:s.NormalBlending,depthWrite:m!=null?m:!0,alphaTest:_!=null?_:0,sizeAttenuation:y!=null?y:!0}):new s.MeshBasicMaterial({map:A,transparent:h!=null?h:!1,blending:v!=null?v:s.NormalBlending,depthWrite:m!=null?m:!0,alphaTest:_!=null?_:0}),E.abrupt("return",l);case 6:case"end":return E.stop()}},o)}))()},i.create=function(){var t=this;return(0,g.Z)(K().mark(function o(){var c,h,v,d,m,_,b,y;return K().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if(c=t.options,h=c.scale,v=c.position,d=c.src,m=c.cache,_=c.sprite,!(m&&!m.get(d))){l.next=7;break}return m.init(d),l.next=5,t.getMaterial();case 5:b=l.sent,m.set(d,b);case 7:if(!m){l.next=13;break}return l.next=10,m.get(d);case 10:l.t0=l.sent,l.next=16;break;case 13:return l.next=15,t.getMaterial();case 15:l.t0=l.sent;case 16:y=l.t0,t.texture=y.map,_?t.createSprite(y):t.createMesh(new s.PlaneBufferGeometry(1,1),y),h&&t.setScale(h),v&&t.object3d.position.copy(v);case 21:case"end":return l.stop()}},o)}))()},i.setScale=function(t){this.object3d.scale.set(this.texture.image.width*t,this.texture.image.height*t,1)},r}(p);function se(e,n){for(;!Object.prototype.hasOwnProperty.call(e,n)&&(e=x(e),e!==null););return e}function ne(e,n,r){return typeof Reflect!="undefined"&&Reflect.get?ne=Reflect.get:ne=function(a,t,o){var c=se(a,t);if(!!c){var h=Object.getOwnPropertyDescriptor(c,t);return h.get?h.get.call(o||a):h.value}},ne(e,n,r)}function Oe(e,n,r){return ne(e,n,r)}var Ce=function(e){"use strict";P(r,e);var n=R(r);function r(a){L(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,c=t.transparent,h=t.blending,v=t.depthWrite,d=t.format,m=t.autoPlay,_=t.loop,b=t.alphaTest,y=t.sprite,A=ue(),l=document.createElement("video");return l.addEventListener("loadedmetadata",function(){var C=new s.VideoTexture(l);C.format=d!=null?d:s.RGBAFormat,C.needsUpdate=!0;var E=y?new s.SpriteMaterial({map:C,transparent:c!=null?c:!1,blending:h!=null?h:s.NormalBlending,depthWrite:v!=null?v:!0,alphaTest:b!=null?b:0}):new s.MeshBasicMaterial({map:C,transparent:c!=null?c:!1,blending:h!=null?h:s.NormalBlending,depthWrite:v!=null?v:!0,alphaTest:b!=null?b:0});A.resolve(E)},!1),l.src=o,l.muted=!0,l.autoplay=m,l.loop=_,l.preload="auto",A.promise},i.create=function(){var t=this;return(0,g.Z)(K().mark(function o(){var c,h,v,d,m,_,b,y;return K().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if(c=t.options,h=c.scale,v=c.position,d=c.src,m=c.cache,_=c.sprite,!(m&&!m.get(d))){l.next=7;break}return m.init(d),l.next=5,t.getMaterial();case 5:b=l.sent,m.set(d,b);case 7:if(!m){l.next=13;break}return l.next=10,m.get(d);case 10:l.t0=l.sent,l.next=16;break;case 13:return l.next=15,t.getMaterial();case 15:l.t0=l.sent;case 16:y=l.t0,t.video=y.map.image,_?t.createSprite(y):t.createMesh(new s.PlaneBufferGeometry(1,1),y),h&&t.setScale(h),v&&t.object3d.position.copy(v);case 21:case"end":return l.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(),Oe(x(r.prototype),"dispose",this).call(this)},r}(p),xe=function(e){"use strict";P(r,e);var n=R(r);function r(a){L(this,r);var t;return t=n.call(this),t.options=(0,M.Z)({},a),t}var i=r.prototype;return i.create=function(){var t=this.options,o=t.position,c=t.children,h=t.onClick,v=t.zIndexFix,d=document.createElement("div");this.element=d,d.appendChild(c),this.createCSS2DObject(d),o&&this.object3d.position.copy(o),h&&this.clickTarge.forEach(function(m){m.addEventListener("click",h)}),v&&(this.object3d.userData.zIndexFix=v)},i.getMaterial=function(t){return(0,g.Z)(K().mark(function o(){var c,h,v,d;return K().wrap(function(_){for(;;)switch(_.prev=_.next){case 0:return c=document.createElement("canvas"),c.width=256,c.height=256,h=c.getContext("2d"),h.fillStyle="#ff0000",h.fillRect(0,0,256,256),v=new s.CanvasTexture(c),d=new s.SpriteMaterial({map:v,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,c=o===void 0?!1:o,h=t.scale,v=h===void 0?new s.Vector3(1,1,1):h,d=t.position,m=d===void 0?new s.Vector3(0,0,0):d,_=t.cache,b=this;return(0,g.Z)(K().mark(function y(){var A,l,C,E;return K().wrap(function(V){for(;;)switch(V.prev=V.next){case 0:if(A="node-create-pick-object",!(_&&!_.get(A))){V.next=7;break}return _.init(A),V.next=5,b.getMaterial(c);case 5:l=V.sent,_.set(A,l);case 7:if(!_){V.next=13;break}return V.next=10,_.get(A);case 10:V.t0=V.sent,V.next=16;break;case 13:return V.next=15,b.getMaterial(c);case 15:V.t0=V.sent;case 16:C=V.t0,E=new s.Sprite(C),E.scale.set(C.map.image.width*v.x,C.map.image.height*v.y,1),E.position.copy(m),b.add(E),b.pickObject=E;case 22:case"end":return V.stop()}},y)}))()},i.dispose=function(){var t=this.options.onClick;t&&this.clickTarge.forEach(function(o){o.removeEventListener("click",t)}),Oe(x(r.prototype),"dispose",this).call(this)},G(r,[{key:"clickTarge",get:function(){var t=this,o=this.options.clickTarge;if(o){var c=o.map(function(h){return I(t.element.querySelectorAll(h))}).flat();return c}return[this.element]}}]),r}(p),at=xe,ot=`
1
+ import*as tt from"idb-keyval";import*as It from"three";import*as Ft from"three/examples/jsm/renderers/CSS2DRenderer";import*as rt from"three/examples/jsm/renderers/CSS3DRenderer";import*as nt from"popmotion";import*as Zt from"three/examples/jsm//utils/BufferGeometryUtils";import*as Ie 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 Te from"d3-geo";import*as Yt from"d3-geo-voronoi";import*as Jt from"d3-scale";var Qt={666:function(L){var j=function(w){"use strict";var P=Object.prototype,x=P.hasOwnProperty,W,O=typeof Symbol=="function"?Symbol:{},R=O.iterator||"@@iterator",F=O.asyncIterator||"@@asyncIterator",A=O.toStringTag||"@@toStringTag";function k(f,u,p){return Object.defineProperty(f,u,{value:p,enumerable:!0,configurable:!0,writable:!0}),f[u]}try{k({},"")}catch(f){k=function(u,p,S){return u[p]=S}}function $(f,u,p,S){var g=u&&u.prototype instanceof ie?u:ie,J=Object.create(g.prototype),H=new Me(S||[]);return J._invoke=se(f,p,H),J}w.wrap=$;function Y(f,u,p){try{return{type:"normal",arg:f.call(u,p)}}catch(S){return{type:"throw",arg:S}}}var T="suspendedStart",s="suspendedYield",ae="executing",te="completed",K={};function ie(){}function z(){}function N(){}var D={};k(D,R,function(){return this});var Z=Object.getPrototypeOf,U=Z&&Z(Z(Re([])));U&&U!==P&&x.call(U,R)&&(D=U);var X=N.prototype=ie.prototype=Object.create(D);z.prototype=N,k(X,"constructor",N),k(N,"constructor",z),z.displayName=k(N,A,"GeneratorFunction");function I(f){["next","throw","return"].forEach(function(u){k(f,u,function(p){return this._invoke(u,p)})})}w.isGeneratorFunction=function(f){var u=typeof f=="function"&&f.constructor;return u?u===z||(u.displayName||u.name)==="GeneratorFunction":!1},w.mark=function(f){return Object.setPrototypeOf?Object.setPrototypeOf(f,N):(f.__proto__=N,k(f,A,"GeneratorFunction")),f.prototype=Object.create(X),f},w.awrap=function(f){return{__await:f}};function Q(f,u){function p(J,H,re,oe){var ne=Y(f[J],f,H);if(ne.type==="throw")oe(ne.arg);else{var Ee=ne.arg,Se=Ee.value;return Se&&typeof Se=="object"&&x.call(Se,"__await")?u.resolve(Se.__await).then(function(ce){p("next",ce,re,oe)},function(ce){p("throw",ce,re,oe)}):u.resolve(Se).then(function(ce){Ee.value=ce,re(Ee)},function(ce){return p("throw",ce,re,oe)})}}var S;function g(J,H){function re(){return new u(function(oe,ne){p(J,H,oe,ne)})}return S=S?S.then(re,re):re()}this._invoke=g}I(Q.prototype),k(Q.prototype,F,function(){return this}),w.AsyncIterator=Q,w.async=function(f,u,p,S,g){g===void 0&&(g=Promise);var J=new Q($(f,u,p,S),g);return w.isGeneratorFunction(u)?J:J.next().then(function(H){return H.done?H.value:J.next()})};function se(f,u,p){var S=T;return function(J,H){if(S===ae)throw new Error("Generator is already running");if(S===te){if(J==="throw")throw H;return Ce()}for(p.method=J,p.arg=H;;){var re=p.delegate;if(re){var oe=_e(re,p);if(oe){if(oe===K)continue;return oe}}if(p.method==="next")p.sent=p._sent=p.arg;else if(p.method==="throw"){if(S===T)throw S=te,p.arg;p.dispatchException(p.arg)}else p.method==="return"&&p.abrupt("return",p.arg);S=ae;var ne=Y(f,u,p);if(ne.type==="normal"){if(S=p.done?te:s,ne.arg===K)continue;return{value:ne.arg,done:p.done}}else ne.type==="throw"&&(S=te,p.method="throw",p.arg=ne.arg)}}}function _e(f,u){var p=f.iterator[u.method];if(p===W){if(u.delegate=null,u.method==="throw"){if(f.iterator.return&&(u.method="return",u.arg=W,_e(f,u),u.method==="throw"))return K;u.method="throw",u.arg=new TypeError("The iterator does not provide a 'throw' method")}return K}var S=Y(p,f.iterator,u.arg);if(S.type==="throw")return u.method="throw",u.arg=S.arg,u.delegate=null,K;var g=S.arg;if(!g)return u.method="throw",u.arg=new TypeError("iterator result is not an object"),u.delegate=null,K;if(g.done)u[f.resultName]=g.value,u.next=f.nextLoc,u.method!=="return"&&(u.method="next",u.arg=W);else return g;return u.delegate=null,K}I(X),k(X,A,"Generator"),k(X,R,function(){return this}),k(X,"toString",function(){return"[object Generator]"});function q(f){var u={tryLoc:f[0]};1 in f&&(u.catchLoc=f[1]),2 in f&&(u.finallyLoc=f[2],u.afterLoc=f[3]),this.tryEntries.push(u)}function B(f){var u=f.completion||{};u.type="normal",delete u.arg,f.completion=u}function Me(f){this.tryEntries=[{tryLoc:"root"}],f.forEach(q,this),this.reset(!0)}w.keys=function(f){var u=[];for(var p in f)u.push(p);return u.reverse(),function S(){for(;u.length;){var g=u.pop();if(g in f)return S.value=g,S.done=!1,S}return S.done=!0,S}};function Re(f){if(f){var u=f[R];if(u)return u.call(f);if(typeof f.next=="function")return f;if(!isNaN(f.length)){var p=-1,S=function g(){for(;++p<f.length;)if(x.call(f,p))return g.value=f[p],g.done=!1,g;return g.value=W,g.done=!0,g};return S.next=S}}return{next:Ce}}w.values=Re;function Ce(){return{value:W,done:!0}}return Me.prototype={constructor:Me,reset:function(f){if(this.prev=0,this.next=0,this.sent=this._sent=W,this.done=!1,this.delegate=null,this.method="next",this.arg=W,this.tryEntries.forEach(B),!f)for(var u in this)u.charAt(0)==="t"&&x.call(this,u)&&!isNaN(+u.slice(1))&&(this[u]=W)},stop:function(){this.done=!0;var f=this.tryEntries[0],u=f.completion;if(u.type==="throw")throw u.arg;return this.rval},dispatchException:function(f){if(this.done)throw f;var u=this;function p(oe,ne){return J.type="throw",J.arg=f,u.next=oe,ne&&(u.method="next",u.arg=W),!!ne}for(var S=this.tryEntries.length-1;S>=0;--S){var g=this.tryEntries[S],J=g.completion;if(g.tryLoc==="root")return p("end");if(g.tryLoc<=this.prev){var H=x.call(g,"catchLoc"),re=x.call(g,"finallyLoc");if(H&&re){if(this.prev<g.catchLoc)return p(g.catchLoc,!0);if(this.prev<g.finallyLoc)return p(g.finallyLoc)}else if(H){if(this.prev<g.catchLoc)return p(g.catchLoc,!0)}else if(re){if(this.prev<g.finallyLoc)return p(g.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(f,u){for(var p=this.tryEntries.length-1;p>=0;--p){var S=this.tryEntries[p];if(S.tryLoc<=this.prev&&x.call(S,"finallyLoc")&&this.prev<S.finallyLoc){var g=S;break}}g&&(f==="break"||f==="continue")&&g.tryLoc<=u&&u<=g.finallyLoc&&(g=null);var J=g?g.completion:{};return J.type=f,J.arg=u,g?(this.method="next",this.next=g.finallyLoc,K):this.complete(J)},complete:function(f,u){if(f.type==="throw")throw f.arg;return f.type==="break"||f.type==="continue"?this.next=f.arg:f.type==="return"?(this.rval=this.arg=f.arg,this.method="return",this.next="end"):f.type==="normal"&&u&&(this.next=u),K},finish:function(f){for(var u=this.tryEntries.length-1;u>=0;--u){var p=this.tryEntries[u];if(p.finallyLoc===f)return this.complete(p.completion,p.afterLoc),B(p),K}},catch:function(f){for(var u=this.tryEntries.length-1;u>=0;--u){var p=this.tryEntries[u];if(p.tryLoc===f){var S=p.completion;if(S.type==="throw"){var g=S.arg;B(p)}return g}}throw new Error("illegal catch attempt")},delegateYield:function(f,u,p){return this.delegate={iterator:Re(f),resultName:u,nextLoc:p},this.method==="next"&&(this.arg=W),K}},w}(L.exports);try{regeneratorRuntime=j}catch(w){typeof globalThis=="object"?globalThis.regeneratorRuntime=j:Function("r","regeneratorRuntime = r")(j)}},695:function(L,j,w){w.d(j,{Z:function(){return P}});function P(x){if(x.geometry&&x.geometry.dispose(),x.material){var W=Array.isArray(x.material)?x.material:[x.material];W.forEach(function(O){var R,F,A,k,$,Y,T,s,ae,te,K,ie,z;(R=O.map)===null||R===void 0||R.dispose(),(F=O.lightMap)===null||F===void 0||F.dispose(),(A=O.bumpMap)===null||A===void 0||A.dispose(),(k=O.normalMap)===null||k===void 0||k.dispose(),($=O.specularMap)===null||$===void 0||$.dispose(),(Y=O.envMap)===null||Y===void 0||Y.dispose(),(T=O.alphaMap)===null||T===void 0||T.dispose(),(s=O.aoMap)===null||s===void 0||s.dispose(),(ae=O.displacementMap)===null||ae===void 0||ae.dispose(),(te=O.emissiveMap)===null||te===void 0||te.dispose(),(K=O.gradientMap)===null||K===void 0||K.dispose(),(ie=O.metalnessMap)===null||ie===void 0||ie.dispose(),(z=O.roughnessMap)===null||z===void 0||z.dispose(),O.dispose()})}}},521:function(L,j,w){w.d(j,{wf:function(){return O.Z}});var P=w(666),x=w.n(P),W=null,O=w(695),R=w(949);function F(z){if(z.material){var N=Array.isArray(z.material)?z.material:[z.material];N.forEach(function(D){var Z,U;(Z=D.color)===null||Z===void 0||Z.convertSRGBToLinear(),(U=D.emissive)===null||U===void 0||U.convertSRGBToLinear(),D.map&&(D.map.encoding=THREE.sRGBEncoding),D.emissiveMap&&(D.emissiveMap.encoding=THREE.sRGBEncoding)})}}var A=w(568),k=w(924),$=z=>{var N={};return w.d(N,z),N},Y=z=>()=>z,T=$({get:()=>tt.get,set:()=>tt.set}),s=w(484),ae=null,te=null,K=function(){var z=(0,A.Z)(x().mark(function N(D,Z){var U,X,I,Q,se,_e;return x().wrap(function(B){for(;;)switch(B.prev=B.next){case 0:return U=Z.version,B.next=4,(0,T.get)(D);case 4:if(I=B.sent,!(I&&I[U])){B.next=9;break}X=I[U],B.next=15;break;case 9:return B.next=11,(0,s.Z)(fetch(D).then(function(Me){if(Me.ok)return Me.blob();throw new Error}));case 11:Q=B.sent,se=Q.res,_e=Q.err,_e||(X=se,(0,T.set)(D,(0,k.Z)({},U,se)));case 15:return B.abrupt("return",X?{url:URL.createObjectURL(X)}:{url:D});case 16:case"end":return B.stop()}},N)}));return function(D,Z){return z.apply(this,arguments)}}(),ie=w(705)},484:function(L,j,w){w.d(j,{Z:function(){return x}});var P=w(42);function x(W){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return W.then(function(R){return(0,P.Z)({err:null,res:R},O)}).catch(function(R){return(0,P.Z)({err:R,res:void 0},O)})}},705:function(L,j,w){w.d(j,{C:function(){return O},y:function(){return W}});var P=w(949),x=new Map,W=function(){var R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{generateTopUV:function(F,A,k,$,Y){var T=A[k*3],s=A[k*3+1],ae=A[$*3],te=A[$*3+1],K=A[Y*3],ie=A[Y*3+1],z;if(x.has(F))z=x.get(F);else{var N=R.box3||new P.Box3;if(!R.box3){var D=F.parameters.shapes.getPoints();N.setFromArray(D.map(function(Q){return[Q.x,Q.y,0]}).flat())}var Z=N.getSize(new P.Vector3);R.split&&(Z.y/=R.split),z={box:N,size:Z},x.set(F,z)}var U=z.box,X=z.size,I=R.split?1-R.split:0;return[new P.Vector2((T-U.min.x)/X.x,(s-U.min.y)/X.y+I),new P.Vector2((ae-U.min.x)/X.x,(te-U.min.y)/X.y+I),new P.Vector2((K-U.min.x)/X.x,(ie-U.min.y)/X.y+I)]},generateSideWallUV:function(F,A,k,$,Y,T){var s=A[k*3],ae=A[k*3+1],te=A[k*3+2],K=A[$*3],ie=A[$*3+1],z=A[$*3+2],N=A[Y*3],D=A[Y*3+1],Z=A[Y*3+2],U=A[T*3],X=A[T*3+1],I=A[T*3+2],Q;if(x.has(A))Q=x.get(A);else{var se=new P.Box3;se.setFromArray(A);var _e=se.getSize(new P.Vector3);R.split&&(_e.z/=1-R.split),Q={box:se,size:_e},x.set(A,Q)}var q=Q.box,B=Q.size;return Math.abs(ae-ie)<Math.abs(s-K)?[new P.Vector2((s-q.min.x)/B.x,(te-q.min.z)/B.z),new P.Vector2((K-q.min.x)/B.x,(z-q.min.z)/B.z),new P.Vector2((N-q.min.x)/B.x,(Z-q.min.z)/B.z),new P.Vector2((U-q.min.x)/B.x,(I-q.min.z)/B.z)]:[new P.Vector2((ae-q.min.y)/B.x,(te-q.min.z)/B.z),new P.Vector2((ie-q.min.y)/B.x,(z-q.min.z)/B.z),new P.Vector2((D-q.min.y)/B.x,(Z-q.min.z)/B.z),new P.Vector2((X-q.min.y)/B.x,(I-q.min.z)/B.z)]}}},O=function(){x.clear()}},949:function(L){var j=P=>{var x={};return V.d(x,P),x},w=P=>()=>P;L.exports=It},568:function(L,j,w){w.d(j,{Z:function(){return x}});function P(W,O,R,F,A,k,$){try{var Y=W[k]($),T=Y.value}catch(s){R(s);return}Y.done?O(T):Promise.resolve(T).then(F,A)}function x(W){return function(){var O=this,R=arguments;return new Promise(function(F,A){var k=W.apply(O,R);function $(T){P(k,F,A,$,Y,"next",T)}function Y(T){P(k,F,A,$,Y,"throw",T)}$(void 0)})}}},924:function(L,j,w){w.d(j,{Z:function(){return P}});function P(x,W,O){return W in x?Object.defineProperty(x,W,{value:O,enumerable:!0,configurable:!0,writable:!0}):x[W]=O,x}},42:function(L,j,w){w.d(j,{Z:function(){return x}});var P=w(924);function x(W){for(var O=1;O<arguments.length;O++){var R=arguments[O]!=null?arguments[O]:{},F=Object.keys(R);typeof Object.getOwnPropertySymbols=="function"&&(F=F.concat(Object.getOwnPropertySymbols(R).filter(function(A){return Object.getOwnPropertyDescriptor(R,A).enumerable}))),F.forEach(function(A){(0,P.Z)(W,A,R[A])})}return W}}},it={};function V(L){var j=it[L];if(j!==void 0)return j.exports;var w=it[L]={exports:{}};return Qt[L](w,w.exports,V),w.exports}(function(){V.n=function(L){var j=L&&L.__esModule?function(){return L.default}:function(){return L};return V.d(j,{a:j}),j}})(),function(){V.d=function(L,j){for(var w in j)V.o(j,w)&&!V.o(L,w)&&Object.defineProperty(L,w,{enumerable:!0,get:j[w]})}}(),function(){V.o=function(L,j){return Object.prototype.hasOwnProperty.call(L,j)}}();var me={};(function(){V.d(me,{Ei:function(){return Dt},Yo:function(){return Wt},Ee:function(){return Ee},x1:function(){return dt},VJ:function(){return ge},r7:function(){return De},XA:function(){return Fe},NB:function(){return st},xv:function(){return S},nk:function(){return at}});function L(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function j(e,n){return j=Object.setPrototypeOf||function(i,a){return i.__proto__=a,i},j(e,n)}function w(e,n){return j(e,n)}function P(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&&w(e,n)}var x=V(42);function W(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 O(e,n){return n=n!=null?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):W(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}),e}function R(){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 F(e){return F=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},F(e)}function A(e){return F(e)}function k(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $(e){return e&&e.constructor===Symbol?"symbol":typeof e}function Y(e,n){return n&&($(n)==="object"||typeof n=="function")?n:k(e)}function T(e){var n=R();return function(){var i=A(e),a;if(n){var t=A(this).constructor;a=Reflect.construct(i,arguments,t)}else a=i.apply(this,arguments);return Y(this,a)}}var s=V(949);function ae(){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 te(e,n,r){return ae()?te=Reflect.construct:te=function(a,t,o){var c=[null];c.push.apply(c,t);var h=Function.bind.apply(a,c),v=new h;return o&&w(v,o.prototype),v},te.apply(null,arguments)}function K(e,n,r){return te.apply(null,arguments)}function ie(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 z(e,n,r){return n&&ie(e.prototype,n),r&&ie(e,r),e}function N(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 D(e){if(Array.isArray(e))return N(e)}function Z(e){if(typeof Symbol!="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}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.")}function X(e,n){if(!!e){if(typeof e=="string")return N(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 N(e,n)}}function I(e){return D(e)||Z(e)||X(e)||U()}var Q=V(484);function se(){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,Q.Z)(r.promise,n)),r}var _e=e=>{var n={};return V.d(n,e),n},q=e=>()=>e,B=_e({CSS2DObject:()=>Ft.CSS2DObject}),Me=e=>{var n={};return V.d(n,e),n},Re=e=>()=>e,Ce=Me({CSS3DObject:()=>rt.CSS3DObject,CSS3DSprite:()=>rt.CSS3DSprite}),f=V(521),u=function(e){e&&((0,f.wf)(e),e.children.forEach(function(n){n.userData.BaseObject_||u(n)}))},p=function(){"use strict";function e(){L(this,e),this.objecttype__="BaseObject",this.userData={},this.pm=se(),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=K(s.Mesh,I(a)),this},n.createGroup=function(){return this.object3d=new s.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=K(s.Points,I(a)),this},n.createCSS2DObject=function(i){return this.object3d=new B.CSS2DObject(i),this},n.createCSS3DObject=function(i){return this.object3d=new Ce.CSS3DObject(i),this},n.createCSS3DSprite=function(i){return this.object3d=new Ce.CSS3DSprite(i),this},n.createSprite=function(i){return this.object3d=new s.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 s.Box3().setFromObject(this.object3d);return{min:i.min,max:i.max,size:i.getSize(new s.Vector3)}},n.traverse=function(i){i(this),this.children.forEach(function(a){a.traverse(i)})},n.dispose=function(){u(this.object3d)},z(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}(),S=function(e){"use strict";P(r,e);var n=T(r);function r(a){L(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,c=t.lookAt,h=t.sprite,v=t.text,d=t.sizeAttenuation;if(h){var m=new s.Sprite(new s.SpriteMaterial({transparent:!0,sizeAttenuation:d}));this.object3d=m}else{var _=new s.MeshBasicMaterial({side:s.DoubleSide,transparent:!0}),b=new s.PlaneGeometry(1,1,1,1);this.createMesh(b,_)}this.object3d.position.copy(o),c&&this.object3d.lookAt(c),this.setText(v)},i.setText=function(t,o){var c=(0,x.Z)(O((0,x.Z)({},this.options),{text:t}),o||{}),h=c.text,v=c.fontSize,d=c.fontFamily,m=c.fontWeight,_=c.flipX,b=c.scale,y=this.canvas;y.width=v*h.length*2,y.height=v;var M=y.getContext("2d");M.font="".concat(m," ").concat(v,"px/1 ").concat(d);var l=M.measureText(h).width;y.width=l,this.width=l,M=y.getContext("2d"),M.clearRect(0,0,y.width,y.height),_&&M.scale(-1,1),M.font="".concat(m," ").concat(v,"px/1 ").concat(d),M.textBaseline="middle",M.fillStyle="#ffffff",M.fillText(h,_?l*-1:0,y.height/2),M.restore();var C=new s.Texture(y);C.anisotropy=16,C.needsUpdate=!0;var E=this.object3d;E.material.map&&E.material.map.dispose(),E.material.map=C,E.material.needsUpdate=!0,E.scale.set(C.image.width*b,C.image.height*b,1)},r}(p),g=V(568),J=V(666),H=V.n(J),re=+s.REVISION<144,oe=re?"ExtrudeBufferGeometry":"ExtrudeGeometry",ne=re?"PlaneBufferGeometry":"PlaneGeometry",Ee=function(e){"use strict";P(r,e);var n=T(r);function r(a){L(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,g.Z)(H().mark(function o(){var c,h,v,d,m,_,b,y,M,l;return H().wrap(function(E){for(;;)switch(E.prev=E.next){case 0:return c=t.options,h=c.transparent,v=c.blending,d=c.src,m=c.depthWrite,_=c.alphaTest,b=c.sprite,y=c.sizeAttenuation,E.next=3,new s.TextureLoader().loadAsync(d);case 3:return M=E.sent,l=b?new s.SpriteMaterial({map:M,transparent:h!=null?h:!1,blending:v!=null?v:s.NormalBlending,depthWrite:m!=null?m:!0,alphaTest:_!=null?_:0,sizeAttenuation:y!=null?y:!0}):new s.MeshBasicMaterial({map:M,transparent:h!=null?h:!1,blending:v!=null?v:s.NormalBlending,depthWrite:m!=null?m:!0,alphaTest:_!=null?_:0}),E.abrupt("return",l);case 6:case"end":return E.stop()}},o)}))()},i.create=function(){var t=this;return(0,g.Z)(H().mark(function o(){var c,h,v,d,m,_,b,y;return H().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if(c=t.options,h=c.scale,v=c.position,d=c.src,m=c.cache,_=c.sprite,!(m&&!m.get(d))){l.next=7;break}return m.init(d),l.next=5,t.getMaterial();case 5:b=l.sent,m.set(d,b);case 7:if(!m){l.next=13;break}return l.next=10,m.get(d);case 10:l.t0=l.sent,l.next=16;break;case 13:return l.next=15,t.getMaterial();case 15:l.t0=l.sent;case 16:y=l.t0,t.texture=y.map,_?t.createSprite(y):t.createMesh(new s[ne](1,1),y),h&&t.setScale(h),v&&t.object3d.position.copy(v);case 21:case"end":return l.stop()}},o)}))()},i.setScale=function(t){this.object3d.scale.set(this.texture.image.width*t,this.texture.image.height*t,1)},r}(p);function Se(e,n){for(;!Object.prototype.hasOwnProperty.call(e,n)&&(e=A(e),e!==null););return e}function ce(e,n,r){return typeof Reflect!="undefined"&&Reflect.get?ce=Reflect.get:ce=function(a,t,o){var c=Se(a,t);if(!!c){var h=Object.getOwnPropertyDescriptor(c,t);return h.get?h.get.call(o||a):h.value}},ce(e,n,r)}function Be(e,n,r){return ce(e,n,r)}var at=function(e){"use strict";P(r,e);var n=T(r);function r(a){L(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,c=t.transparent,h=t.blending,v=t.depthWrite,d=t.format,m=t.autoPlay,_=t.loop,b=t.alphaTest,y=t.sprite,M=se(),l=document.createElement("video");return l.addEventListener("loadedmetadata",function(){var C=new s.VideoTexture(l);C.format=d!=null?d:s.RGBAFormat,C.needsUpdate=!0;var E=y?new s.SpriteMaterial({map:C,transparent:c!=null?c:!1,blending:h!=null?h:s.NormalBlending,depthWrite:v!=null?v:!0,alphaTest:b!=null?b:0}):new s.MeshBasicMaterial({map:C,transparent:c!=null?c:!1,blending:h!=null?h:s.NormalBlending,depthWrite:v!=null?v:!0,alphaTest:b!=null?b:0});M.resolve(E)},!1),l.src=o,l.muted=!0,l.autoplay=m,l.loop=_,l.preload="auto",M.promise},i.create=function(){var t=this;return(0,g.Z)(H().mark(function o(){var c,h,v,d,m,_,b,y;return H().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if(c=t.options,h=c.scale,v=c.position,d=c.src,m=c.cache,_=c.sprite,!(m&&!m.get(d))){l.next=7;break}return m.init(d),l.next=5,t.getMaterial();case 5:b=l.sent,m.set(d,b);case 7:if(!m){l.next=13;break}return l.next=10,m.get(d);case 10:l.t0=l.sent,l.next=16;break;case 13:return l.next=15,t.getMaterial();case 15:l.t0=l.sent;case 16:y=l.t0,t.video=y.map.image,_?t.createSprite(y):t.createMesh(new s[ne](1,1),y),h&&t.setScale(h),v&&t.object3d.position.copy(v);case 21:case"end":return l.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(),Be(A(r.prototype),"dispose",this).call(this)},r}(p),ot=function(e){"use strict";P(r,e);var n=T(r);function r(a){L(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,c=t.children,h=t.onClick,v=t.zIndexFix,d=document.createElement("div");this.element=d,d.appendChild(c),this.createCSS2DObject(d),o&&this.object3d.position.copy(o),h&&this.clickTarge.forEach(function(m){m.addEventListener("click",h)}),v&&(this.object3d.userData.zIndexFix=v)},i.getMaterial=function(t){return(0,g.Z)(H().mark(function o(){var c,h,v,d;return H().wrap(function(_){for(;;)switch(_.prev=_.next){case 0:return c=document.createElement("canvas"),c.width=256,c.height=256,h=c.getContext("2d"),h.fillStyle="#ff0000",h.fillRect(0,0,256,256),v=new s.CanvasTexture(c),d=new s.SpriteMaterial({map:v,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,c=o===void 0?!1:o,h=t.scale,v=h===void 0?new s.Vector3(1,1,1):h,d=t.position,m=d===void 0?new s.Vector3(0,0,0):d,_=t.cache,b=this;return(0,g.Z)(H().mark(function y(){var M,l,C,E;return H().wrap(function(G){for(;;)switch(G.prev=G.next){case 0:if(M="node-create-pick-object",!(_&&!_.get(M))){G.next=7;break}return _.init(M),G.next=5,b.getMaterial(c);case 5:l=G.sent,_.set(M,l);case 7:if(!_){G.next=13;break}return G.next=10,_.get(M);case 10:G.t0=G.sent,G.next=16;break;case 13:return G.next=15,b.getMaterial(c);case 15:G.t0=G.sent;case 16:C=G.t0,E=new s.Sprite(C),E.scale.set(C.map.image.width*v.x,C.map.image.height*v.y,1),E.position.copy(m),b.add(E),b.pickObject=E;case 22:case"end":return G.stop()}},y)}))()},i.dispose=function(){var t=this.options.onClick;t&&this.clickTarge.forEach(function(o){o.removeEventListener("click",t)}),Be(A(r.prototype),"dispose",this).call(this)},z(r,[{key:"clickTarge",get:function(){var t=this,o=this.options.clickTarge;if(o){var c=o.map(function(h){return I(t.element.querySelectorAll(h))}).flat();return c}return[this.element]}}]),r}(p),st=ot,ut=`
2
2
  `.concat(s.ShaderChunk.logdepthbuf_pars_vertex,`
3
3
  `).concat(s.ShaderChunk.fog_pars_vertex,`
4
4
  attribute vec3 previous;
@@ -95,7 +95,7 @@ import*as tt from"idb-keyval";import*as W from"three";import*as Ut from"three/ex
95
95
  vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
96
96
  `).concat(s.ShaderChunk.fog_vertex,`
97
97
  }
98
- `),st=`
98
+ `),ct=`
99
99
  `.concat(s.ShaderChunk.fog_pars_fragment,`
100
100
  `).concat(s.ShaderChunk.logdepthbuf_pars_fragment,`
101
101
 
@@ -129,4 +129,4 @@ void main() {
129
129
  gl_FragColor.a *= step(vCounters, visibility);
130
130
  `).concat(s.ShaderChunk.fog_fragment,`
131
131
  }
132
- `),ge=function(e){"use strict";P(r,e);var n=R(r);function r(){L(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 s.Matrix4,Object.defineProperties(k(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}(s.BufferGeometry);ge.prototype.setMatrixWorld=function(e){this.matrixWorld=e},ge.prototype.setGeometry=function(e,n){this._geometry=e,this.setPoints(e.getAttribute("position").array,n)},ge.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 s.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 Ie(e,n){var r=new s.Matrix4,i=new s.Ray,a=new s.Sphere,t=new s.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 c=new s.Vector3,h=new s.Vector3,v=new s.Vector3,d=this instanceof s.LineSegments?2:1,m=o.index,_=o.attributes;if(m!==null)for(var b=m.array,y=_.position.array,A=_.width.array,l=0,C=b.length-1;l<C;l+=d){var E=b[l],te=b[l+1];c.fromArray(y,E*3),h.fromArray(y,te*3);var V=A[Math.floor(l/3)]!==void 0?A[Math.floor(l/3)]:1,le=e.params.Line.threshold+this.material.lineWidth*V/2,de=le*le,Ae=i.distanceSqToSegment(c,h,t,v);if(!(Ae>de)){t.applyMatrix4(this.matrixWorld);var fe=e.ray.origin.distanceTo(t);fe<e.near||fe>e.far||(n.push({distance:fe,point:v.clone().applyMatrix4(this.matrixWorld),index:l,face:null,faceIndex:null,object:this}),l=C)}}}}ge.prototype.raycast=Ie,ge.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]},ge.prototype.copyV3=function(e){var n=e*6;return[this.positions[n],this.positions[n+1],this.positions[n+2]]},ge.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 s.BufferAttribute(new Float32Array(this.positions),3),previous:new s.BufferAttribute(new Float32Array(this.previous),3),next:new s.BufferAttribute(new Float32Array(this.next),3),side:new s.BufferAttribute(new Float32Array(this.side),1),width:new s.BufferAttribute(new Float32Array(this.width),1),uv:new s.BufferAttribute(new Float32Array(this.uvs),2),index:new s.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new s.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 ze(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}ge.prototype.advance=function(e){var n=this._attributes.position.array,r=this._attributes.previous.array,i=this._attributes.next.array,a=n.length;ze(n,0,r,0,a),ze(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,ze(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},s.ShaderChunk.meshline_vert=ot,s.ShaderChunk.meshline_frag=st;var Ge=function(e){"use strict";P(r,e);var n=R(r);function r(i){L(this,r);var a;return a=n.call(this,{uniforms:Object.assign({},s.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new s.Color(16777215)},opacity:{value:1},resolution:{value:new s.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 s.Vector2(1,1)},offset:{value:new s.Vector2(1,1)},lineLightAnimation:{value:1},time:{value:0},size:{value:300},speed:{value:.3},lightWidth:{value:.1},uCenter:{value:new s.Vector2(0,0)},lightColor:{value:new s.Color(16777215)}}),vertexShader:s.ShaderChunk.meshline_vert,fragmentShader:s.ShaderChunk.meshline_frag}),a.isMeshLineMaterial=!0,a.type="MeshLineMaterial",Object.defineProperties(k(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}(s.ShaderMaterial);Ge.prototype.copy=function(e){return s.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 ut(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 ct(e,n){if(e==null)return{};var r=ut(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 lt=e=>{var n={};return N.d(n,e),n},or=e=>()=>e,Ze=lt({animate:()=>nt.animate,linear:()=>nt.linear}),ft=e=>{var n={};return N.d(n,e),n},sr=e=>()=>e,Xe=ft({mergeBufferGeometries:()=>Nt.mergeBufferGeometries});function He(e){var n=e.setPointWidth,r=e.nodes,i=new s.BufferGeometry,a=new ge;return i.setFromPoints(r),a.setGeometry(i,n),a}var ht={color:new s.Color("#ffffff"),lineWidth:3,sizeAttenuation:0},pt=function(e){"use strict";P(r,e);var n=R(r);function r(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};L(this,r);var t;return t=n.call(this),t.options=(0,M.Z)({},ht,a),t}var i=r.prototype;return i.create=function(){var t=this,o=this.options,c=o.duration,h=o.delay,v=o.onComplete,d=o.setPointWidth,m=o.key,_=o.nodes,b=o.nodesArr,y=o.coordinatesArr,A=o.projection,l=o.workerController,C=o.useGroups,E=ct(o,["duration","delay","onComplete","setPointWidth","key","nodes","nodesArr","coordinatesArr","projection","workerController","useGroups"]),te=this.pencil.getSize(),V=te.width,le=te.height,de=new Ge(O((0,M.Z)({},E),{resolution:new s.Vector2(V,le)}));if(this.material=de,_)this.createMesh(He({nodes:_,setPointWidth:d}),de);else if(b){var Ae=Xe.mergeBufferGeometries(b.map(function(fe){return He({nodes:fe,setPointWidth:d})}),C!=null?C:!1);this.createMesh(Ae,de)}else if(y&&l)return new Promise(function(fe){l.postMessage({coordinatesArr:y,projection:A,useGroups:C},function(ce){var be=new s.BufferGeometry;Object.keys(ce).forEach(function(he){he==="index"?be.setIndex(new s.BufferAttribute(ce[he].array,ce[he].itemSize)):be.setAttribute(he,new s.BufferAttribute(ce[he].array,ce[he].itemSize))}),t.createMesh(be,de),fe("")})})},i.resize=function(t,o){this.material.uniforms.resolution.value.set(t,o)},i.animate=function(){var t=this.options,o=t.duration,c=t.delay,h=t.onComplete,v=this.material.uniforms.offset,d=c!=null?c:0,m=(0,Ze.animate)({from:v.value,to:{x:0},duration:o!=null?o:1e3,elapsed:-d,repeat:1/0,onComplete:h,ease:Ze.linear,onUpdate:function(_){v.value.x=_.x}});this.tween=m},i.dispose=function(){var t;Oe(x(r.prototype),"dispose",this).call(this),(t=this.tween)===null||t===void 0||t.stop()},r}(p);function vt(e){if(Array.isArray(e))return e}function dt(){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 ye(e,n){return vt(e)||X(e,n)||H(e,n)||dt()}var mt=e=>{var n={};return N.d(n,e),n},ur=e=>()=>e,Ee=mt({extent:()=>Fe.extent,mean:()=>Fe.mean,merge:()=>Fe.merge}),_t=e=>{var n={};return N.d(n,e),n},cr=e=>()=>e,De=_t({default:()=>Ft.default}),gt=e=>{var n={};return N.d(n,e),n},lr=e=>()=>e,yt=gt({default:()=>It.default});function bt(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 wt=e=>{var n={};return N.d(n,e),n},fr=e=>()=>e,xt=wt({default:()=>Zt.default}),At=e=>{var n={};return N.d(n,e),n},hr=e=>()=>e,Mt=At({default:()=>Xt.default}),St=e=>{var n={};return N.d(n,e),n},pr=e=>()=>e,je=St({geoBounds:()=>Re.geoBounds,geoContains:()=>Re.geoContains,geoDistance:()=>Re.geoDistance,geoInterpolate:()=>Re.geoInterpolate}),Pt=e=>{var n={};return N.d(n,e),n},vr=e=>()=>e,Ot=Pt({geoVoronoi:()=>Ht.geoVoronoi}),Ct=e=>{var n={};return N.d(n,e),n},dr=e=>()=>e,Ke=Ct({scaleLinear:()=>Kt.scaleLinear});function Et(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 c=(0,je.geoInterpolate)(a,t),h=1/Math.ceil(o/n),v=h;v<1;)i.push(c(v)),v+=h}i.push(a=t)}),i})}function Lt(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),c=(1+Math.sqrt(5))/2,h=function(l){return l/c*360%360-180},v=function(l){return Math.acos(2*l/o-1)/Math.PI*180-90},d=function(l){return o*(Math.cos((l+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(l){return l<=i}:i===void 0?function(l){return l>=r}:i>=r?function(l){return l>=r&&l<=i}:function(l){return l>=r||l<=i},b=[],y=m[0];y<=m[1];y++){var A=h(y);_(A)&&b.push([A,v(y)])}return b}function We(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return r?(0,je.geoContains)(n,e):(0,Mt.default)(e,n)}function jt(e,n){var r={type:"Polygon",coordinates:e},i=ye((0,je.geoBounds)(r),2),a=ye(i[0],2),t=a[0],o=a[1],c=ye(i[1],2),h=c[0],v=c[1];if(Math.min(Math.abs(h-t),Math.abs(v-o))<n)return[];var d=t>h||v>=89||o<=-89;return Lt(n,{minLng:t,maxLng:h,minLat:o,maxLat:v}).filter(function(m){return We(m,r,d)})}function Bt(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.resolution,i=r===void 0?1/0:r,a=Et(e,i),t=(0,Ee.merge)(a),o=jt(e,i),c=I(t).concat(I(o)),h={type:"Polygon",coordinates:e},v=ye((0,je.geoBounds)(h),2),d=ye(v[0],2),m=d[0],_=d[1],b=ye(v[1],2),y=b[0],A=b[1],l=m>y||A>=89||_<=-89,C=[];if(l){var E=(0,Ot.geoVoronoi)(c).triangles(),te=new Map(c.map(function(pe,Pe){var Me=ye(pe,2),ve=Me[0],Be=Me[1];return["".concat(ve,"-").concat(Be),Pe]}));E.features.forEach(function(pe){var Pe,Me=pe.geometry.coordinates[0].slice(0,3).reverse(),ve=[];if(Me.forEach(function(ke){var we=ye(ke,2),Ne=we[0],Vt=we[1],et="".concat(Ne,"-").concat(Vt);te.has(et)&&ve.push(te.get(et))}),ve.length===3){if(ve.some(function(ke){return ke<t.length})){var Be=pe.properties.circumcenter;if(!We(Be,h,l))return}(Pe=C).push.apply(Pe,I(ve))}})}else if(o.length)for(var fe=function(pe,Pe){var Me,ve=[2,1,0].map(function(we){return ce.triangles[pe+we]}),Be=ve.map(function(we){return c[we]});if(ve.some(function(we){return we<t.length})){var ke=[0,1].map(function(we){return(0,Ee.mean)(Be,function(Ne){return Ne[we]})});if(!We(ke,h,l))return"continue"}(Me=C).push.apply(Me,I(ve))},ce=xt.default.from(c),be=0,he=ce.triangles.length;be<he;be+=3)fe(be,he);else{var V=De.default.flatten(a),le=V.vertices,de=V.holes,Ae=de===void 0?[]:de;C=(0,De.default)(le,Ae,2)}var Ue=(0,Ke.scaleLinear)((0,Ee.extent)(c,function(pe){return pe[0]}),[0,1]),Gt=(0,Ke.scaleLinear)((0,Ee.extent)(c,function(pe){return pe[1]}),[0,1]),Dt=c.map(function(pe){var Pe=ye(pe,2),Me=Pe[0],ve=Pe[1];return[Ue(Me),Gt(ve)]}),Wt={points:c,indices:C,uvs:Dt};return{contour:a,triangles:Wt}}var kt=Bt,$e=new s.BufferGeometry().setAttribute?"setAttribute":"addAttribute";function Ve(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=ye(t,2),c=o[0],h=o[1];return r?bt(c,h,n):[c,h,n]})});return De.default.flatten(i)}function Ye(e,n,r){for(var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=Ve(e,n,i),t=a.vertices,o=a.holes,c=Ve(e,r,i),h=c.vertices,v=(0,Ee.merge)([h,t]),d=Math.round(h.length/3),m=new Set(o),_=0,b=[],y=0;y<d;y++){var A=y+1;if(A===d)A=_;else if(m.has(A)){var l=A;A=_,_=l}b.push(y,y+d,A+d),b.push(A+d,A,y)}for(var C=[],E=1;E>=0;E--)for(var te=0;te<d;te+=1)C.push(te/(d-1),E);return{indices:b,vertices:v,uvs:C,topVerts:h}}function Je(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:Ve([e.points],n,a).vertices,uvs:r}}var Tt=function(e){"use strict";P(r,e);var n=R(r);function r(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};L(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,c=o.startHeight,h=o.endHeight,v=o.closedBottom,d=o.closedTop,m=o.includeSides,_=o.curvatureResolution,b=o.cartesian,y=o.userDataRsoOffset;(0,yt.default)(i[0])||i[0].reverse();var A=kt(i,{resolution:_}),l=A.contour,C=A.triangles,E=(0,Ee.merge)(C.uvs),te=[],V=[],le=[],de=0,Ae=function(ce){var be=Math.round(te.length/3),he=le.length;te=te.concat(ce.vertices),V=V.concat(ce.uvs),le=le.concat(be?ce.indices.map(function(Ue){return Ue+be}):ce.indices),t.addGroup(he,le.length-he,de++)};if(m){var fe=Ye(l,c,h,b);Ae(fe),t.userData.rso=y?Ye(l,c,h+y,b):fe}return v&&Ae(Je(C,c,E,!1,b)),d&&Ae(Je(C,h,E,!0,b)),t.setIndex(le),t[$e]("position",new s.Float32BufferAttribute(te,3)),t[$e]("uv",new s.Float32BufferAttribute(V,2)),t.computeVertexNormals(),t}return r}(s.BufferGeometry),Rt=function(e){"use strict";P(r,e);var n=R(r);function r(a){L(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,c=t.height,h=t.closedBottom,v=t.closedTop,d=t.curvatureResolution,m=t.userDataRsoOffset,_=t.cartesian,b=new Tt(this.options.geojson,{startHeight:o,endHeight:o+c,closedBottom:h,closedTop:v,curvatureResolution:d,cartesian:_,userDataRsoOffset:m});this.createMesh(b,this.options.material)},r}(p),Qe=N(705);function qe(e){var n=e.split,r=e.depth,i=e.points,a=new s.ExtrudeGeometry(new s.Shape(i),{depth:r,bevelEnabled:!1,UVGenerator:(0,Qe.y)({split:n})});return(0,Qe.C)(),a}var zt=function(e){"use strict";P(r,e);var n=R(r);function r(a){L(this,r);var t;return t=n.call(this),t.options=(0,M.Z)({},a),t}var i=r.prototype;return i.create=function(){var t=this,o=this.options,c=o.points,h=o.pointsArr,v=o.coordinatesArr,d=o.material,m=o.useGroups,_=o.depth,b=o.split,y=o.workerController,A=o.projection;if(c)this.createMesh(qe({points:c,depth:_,split:b}),d);else if(h){var l=Xe.mergeBufferGeometries(h.map(function(C){return qe({points:C,depth:_,split:b})}),m!=null?m:!1);this.createMesh(l,d)}else if(v&&y)return new Promise(function(C){y.postMessage({coordinatesArr:v,depth:_,split:b,useGroups:m,projection:A},function(E){var te=new s.BufferGeometry;Object.keys(E).forEach(function(V){te.setAttribute(V,new s.BufferAttribute(E[V].array,E[V].itemSize))}),t.createMesh(te,d),C("")})})},r}(p)})();var Yt=me.Ei,Jt=me.Yo,Qt=me.Ee,qt=me.x1,er=me.VJ,tr=me.r7,rr=me.XA,nr=me.NB,ir=me.xv,ar=me.nk;export{Yt as ConicPolygon,Jt as ExtrudePolygon,Qt as Image,qt as Line,er as MeshLine,tr as MeshLineMaterial,rr as MeshLineRaycast,nr as Node,ir as Text,ar as Video};
132
+ `),ge=function(e){"use strict";P(r,e);var n=T(r);function r(){L(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 s.Matrix4,Object.defineProperties(k(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}(s.BufferGeometry);ge.prototype.setMatrixWorld=function(e){this.matrixWorld=e},ge.prototype.setGeometry=function(e,n){this._geometry=e,this.setPoints(e.getAttribute("position").array,n)},ge.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 s.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 Fe(e,n){var r=new s.Matrix4,i=new s.Ray,a=new s.Sphere,t=new s.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 c=new s.Vector3,h=new s.Vector3,v=new s.Vector3,d=this instanceof s.LineSegments?2:1,m=o.index,_=o.attributes;if(m!==null)for(var b=m.array,y=_.position.array,M=_.width.array,l=0,C=b.length-1;l<C;l+=d){var E=b[l],ee=b[l+1];c.fromArray(y,E*3),h.fromArray(y,ee*3);var G=M[Math.floor(l/3)]!==void 0?M[Math.floor(l/3)]:1,le=e.params.Line.threshold+this.material.lineWidth*G/2,de=le*le,xe=i.distanceSqToSegment(c,h,t,v);if(!(xe>de)){t.applyMatrix4(this.matrixWorld);var fe=e.ray.origin.distanceTo(t);fe<e.near||fe>e.far||(n.push({distance:fe,point:v.clone().applyMatrix4(this.matrixWorld),index:l,face:null,faceIndex:null,object:this}),l=C)}}}}ge.prototype.raycast=Fe,ge.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]},ge.prototype.copyV3=function(e){var n=e*6;return[this.positions[n],this.positions[n+1],this.positions[n+2]]},ge.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 s.BufferAttribute(new Float32Array(this.positions),3),previous:new s.BufferAttribute(new Float32Array(this.previous),3),next:new s.BufferAttribute(new Float32Array(this.next),3),side:new s.BufferAttribute(new Float32Array(this.side),1),width:new s.BufferAttribute(new Float32Array(this.width),1),uv:new s.BufferAttribute(new Float32Array(this.uvs),2),index:new s.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new s.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 ze(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}ge.prototype.advance=function(e){var n=this._attributes.position.array,r=this._attributes.previous.array,i=this._attributes.next.array,a=n.length;ze(n,0,r,0,a),ze(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,ze(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},s.ShaderChunk.meshline_vert=ut,s.ShaderChunk.meshline_frag=ct;var De=function(e){"use strict";P(r,e);var n=T(r);function r(i){L(this,r);var a;return a=n.call(this,{uniforms:Object.assign({},s.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new s.Color(16777215)},opacity:{value:1},resolution:{value:new s.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 s.Vector2(1,1)},offset:{value:new s.Vector2(1,1)},lineLightAnimation:{value:1},time:{value:0},size:{value:300},speed:{value:.3},lightWidth:{value:.1},uCenter:{value:new s.Vector2(0,0)},lightColor:{value:new s.Color(16777215)}}),vertexShader:s.ShaderChunk.meshline_vert,fragmentShader:s.ShaderChunk.meshline_frag}),a.isMeshLineMaterial=!0,a.type="MeshLineMaterial",Object.defineProperties(k(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}(s.ShaderMaterial);De.prototype.copy=function(e){return s.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 lt(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 ft(e,n){if(e==null)return{};var r=lt(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 ht=e=>{var n={};return V.d(n,e),n},cr=e=>()=>e,Ze=ht({animate:()=>nt.animate,linear:()=>nt.linear}),pt=e=>{var n={};return V.d(n,e),n},lr=e=>()=>e,Xe=pt({mergeBufferGeometries:()=>Zt.mergeBufferGeometries});function He(e){var n=e.setPointWidth,r=e.nodes,i=new s.BufferGeometry,a=new ge;return i.setFromPoints(r),a.setGeometry(i,n),a}var vt={color:new s.Color("#ffffff"),lineWidth:3,sizeAttenuation:0},dt=function(e){"use strict";P(r,e);var n=T(r);function r(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};L(this,r);var t;return t=n.call(this),t.options=(0,x.Z)({},vt,a),t}var i=r.prototype;return i.create=function(){var t=this,o=this.options,c=o.duration,h=o.delay,v=o.onComplete,d=o.setPointWidth,m=o.key,_=o.nodes,b=o.nodesArr,y=o.coordinatesArr,M=o.projection,l=o.workerController,C=o.useGroups,E=ft(o,["duration","delay","onComplete","setPointWidth","key","nodes","nodesArr","coordinatesArr","projection","workerController","useGroups"]),ee=this.pencil.getSize(),G=ee.width,le=ee.height,de=new De(O((0,x.Z)({},E),{resolution:new s.Vector2(G,le)}));if(this.material=de,_)this.createMesh(He({nodes:_,setPointWidth:d}),de);else if(b){var xe=Xe.mergeBufferGeometries(b.map(function(fe){return He({nodes:fe,setPointWidth:d})}),C!=null?C:!1);this.createMesh(xe,de)}else if(y&&l)return new Promise(function(fe){l.postMessage({coordinatesArr:y,projection:M,useGroups:C},function(ue){var be=new s.BufferGeometry;Object.keys(ue).forEach(function(he){he==="index"?be.setIndex(new s.BufferAttribute(ue[he].array,ue[he].itemSize)):be.setAttribute(he,new s.BufferAttribute(ue[he].array,ue[he].itemSize))}),t.createMesh(be,de),fe("")})})},i.resize=function(t,o){this.material.uniforms.resolution.value.set(t,o)},i.animate=function(){var t=this.options,o=t.duration,c=t.delay,h=t.onComplete,v=this.material.uniforms.offset,d=c!=null?c:0,m=(0,Ze.animate)({from:v.value,to:{x:0},duration:o!=null?o:1e3,elapsed:-d,repeat:1/0,onComplete:h,ease:Ze.linear,onUpdate:function(_){v.value.x=_.x}});this.tween=m},i.dispose=function(){var t;Be(A(r.prototype),"dispose",this).call(this),(t=this.tween)===null||t===void 0||t.stop()},r}(p);function mt(e){if(Array.isArray(e))return e}function _t(){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 ye(e,n){return mt(e)||Z(e,n)||X(e,n)||_t()}var gt=e=>{var n={};return V.d(n,e),n},fr=e=>()=>e,Oe=gt({extent:()=>Ie.extent,mean:()=>Ie.mean,merge:()=>Ie.merge}),yt=e=>{var n={};return V.d(n,e),n},hr=e=>()=>e,We=yt({default:()=>Xt.default}),bt=e=>{var n={};return V.d(n,e),n},pr=e=>()=>e,wt=bt({default:()=>Ht.default});function xt(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 At=e=>{var n={};return V.d(n,e),n},vr=e=>()=>e,Mt=At({default:()=>Kt.default}),Pt=e=>{var n={};return V.d(n,e),n},dr=e=>()=>e,St=Pt({default:()=>$t.default}),Ot=e=>{var n={};return V.d(n,e),n},mr=e=>()=>e,Le=Ot({geoBounds:()=>Te.geoBounds,geoContains:()=>Te.geoContains,geoDistance:()=>Te.geoDistance,geoInterpolate:()=>Te.geoInterpolate}),Ct=e=>{var n={};return V.d(n,e),n},_r=e=>()=>e,Et=Ct({geoVoronoi:()=>Yt.geoVoronoi}),Lt=e=>{var n={};return V.d(n,e),n},gr=e=>()=>e,Ke=Lt({scaleLinear:()=>Jt.scaleLinear});function jt(e,n){return e.map(function(r){var i=[],a;return r.forEach(function(t){if(a){var o=(0,Le.geoDistance)(t,a)*180/Math.PI;if(o>n)for(var c=(0,Le.geoInterpolate)(a,t),h=1/Math.ceil(o/n),v=h;v<1;)i.push(c(v)),v+=h}i.push(a=t)}),i})}function kt(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),c=(1+Math.sqrt(5))/2,h=function(l){return l/c*360%360-180},v=function(l){return Math.acos(2*l/o-1)/Math.PI*180-90},d=function(l){return o*(Math.cos((l+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(l){return l<=i}:i===void 0?function(l){return l>=r}:i>=r?function(l){return l>=r&&l<=i}:function(l){return l>=r||l<=i},b=[],y=m[0];y<=m[1];y++){var M=h(y);_(M)&&b.push([M,v(y)])}return b}function Ge(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return r?(0,Le.geoContains)(n,e):(0,St.default)(e,n)}function Rt(e,n){var r={type:"Polygon",coordinates:e},i=ye((0,Le.geoBounds)(r),2),a=ye(i[0],2),t=a[0],o=a[1],c=ye(i[1],2),h=c[0],v=c[1];if(Math.min(Math.abs(h-t),Math.abs(v-o))<n)return[];var d=t>h||v>=89||o<=-89;return kt(n,{minLng:t,maxLng:h,minLat:o,maxLat:v}).filter(function(m){return Ge(m,r,d)})}function Tt(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.resolution,i=r===void 0?1/0:r,a=jt(e,i),t=(0,Oe.merge)(a),o=Rt(e,i),c=I(t).concat(I(o)),h={type:"Polygon",coordinates:e},v=ye((0,Le.geoBounds)(h),2),d=ye(v[0],2),m=d[0],_=d[1],b=ye(v[1],2),y=b[0],M=b[1],l=m>y||M>=89||_<=-89,C=[];if(l){var E=(0,Et.geoVoronoi)(c).triangles(),ee=new Map(c.map(function(pe,Pe){var Ae=ye(pe,2),ve=Ae[0],je=Ae[1];return["".concat(ve,"-").concat(je),Pe]}));E.features.forEach(function(pe){var Pe,Ae=pe.geometry.coordinates[0].slice(0,3).reverse(),ve=[];if(Ae.forEach(function(ke){var we=ye(ke,2),Ne=we[0],Nt=we[1],et="".concat(Ne,"-").concat(Nt);ee.has(et)&&ve.push(ee.get(et))}),ve.length===3){if(ve.some(function(ke){return ke<t.length})){var je=pe.properties.circumcenter;if(!Ge(je,h,l))return}(Pe=C).push.apply(Pe,I(ve))}})}else if(o.length)for(var fe=function(pe,Pe){var Ae,ve=[2,1,0].map(function(we){return ue.triangles[pe+we]}),je=ve.map(function(we){return c[we]});if(ve.some(function(we){return we<t.length})){var ke=[0,1].map(function(we){return(0,Oe.mean)(je,function(Ne){return Ne[we]})});if(!Ge(ke,h,l))return"continue"}(Ae=C).push.apply(Ae,I(ve))},ue=Mt.default.from(c),be=0,he=ue.triangles.length;be<he;be+=3)fe(be,he);else{var G=We.default.flatten(a),le=G.vertices,de=G.holes,xe=de===void 0?[]:de;C=(0,We.default)(le,xe,2)}var Ue=(0,Ke.scaleLinear)((0,Oe.extent)(c,function(pe){return pe[0]}),[0,1]),Gt=(0,Ke.scaleLinear)((0,Oe.extent)(c,function(pe){return pe[1]}),[0,1]),Vt=c.map(function(pe){var Pe=ye(pe,2),Ae=Pe[0],ve=Pe[1];return[Ue(Ae),Gt(ve)]}),Ut={points:c,indices:C,uvs:Vt};return{contour:a,triangles:Ut}}var Bt=Tt,$e=new s.BufferGeometry().setAttribute?"setAttribute":"addAttribute";function Ve(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=ye(t,2),c=o[0],h=o[1];return r?xt(c,h,n):[c,h,n]})});return We.default.flatten(i)}function Ye(e,n,r){for(var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=Ve(e,n,i),t=a.vertices,o=a.holes,c=Ve(e,r,i),h=c.vertices,v=(0,Oe.merge)([h,t]),d=Math.round(h.length/3),m=new Set(o),_=0,b=[],y=0;y<d;y++){var M=y+1;if(M===d)M=_;else if(m.has(M)){var l=M;M=_,_=l}b.push(y,y+d,M+d),b.push(M+d,M,y)}for(var C=[],E=1;E>=0;E--)for(var ee=0;ee<d;ee+=1)C.push(ee/(d-1),E);return{indices:b,vertices:v,uvs:C,topVerts:h}}function Je(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:Ve([e.points],n,a).vertices,uvs:r}}var zt=function(e){"use strict";P(r,e);var n=T(r);function r(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};L(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,c=o.startHeight,h=o.endHeight,v=o.closedBottom,d=o.closedTop,m=o.includeSides,_=o.curvatureResolution,b=o.cartesian,y=o.userDataRsoOffset;(0,wt.default)(i[0])||i[0].reverse();var M=Bt(i,{resolution:_}),l=M.contour,C=M.triangles,E=(0,Oe.merge)(C.uvs),ee=[],G=[],le=[],de=0,xe=function(ue){var be=Math.round(ee.length/3),he=le.length;ee=ee.concat(ue.vertices),G=G.concat(ue.uvs),le=le.concat(be?ue.indices.map(function(Ue){return Ue+be}):ue.indices),t.addGroup(he,le.length-he,de++)};if(m){var fe=Ye(l,c,h,b);xe(fe),t.userData.rso=y?Ye(l,c,h+y,b):fe}return v&&xe(Je(C,c,E,!1,b)),d&&xe(Je(C,h,E,!0,b)),t.setIndex(le),t[$e]("position",new s.Float32BufferAttribute(ee,3)),t[$e]("uv",new s.Float32BufferAttribute(G,2)),t.computeVertexNormals(),t}return r}(s.BufferGeometry),Dt=function(e){"use strict";P(r,e);var n=T(r);function r(a){L(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,c=t.height,h=t.closedBottom,v=t.closedTop,d=t.curvatureResolution,m=t.userDataRsoOffset,_=t.cartesian,b=new zt(this.options.geojson,{startHeight:o,endHeight:o+c,closedBottom:h,closedTop:v,curvatureResolution:d,cartesian:_,userDataRsoOffset:m});this.createMesh(b,this.options.material)},r}(p),Qe=V(705);function qe(e){var n=e.split,r=e.depth,i=e.points,a=new s[oe](new s.Shape(i),{depth:r,bevelEnabled:!1,UVGenerator:(0,Qe.y)({split:n})});return(0,Qe.C)(),a}var Wt=function(e){"use strict";P(r,e);var n=T(r);function r(a){L(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,o=this.options,c=o.points,h=o.pointsArr,v=o.coordinatesArr,d=o.material,m=o.useGroups,_=o.depth,b=o.split,y=o.workerController,M=o.projection;if(c)this.createMesh(qe({points:c,depth:_,split:b}),d);else if(h){var l=Xe.mergeBufferGeometries(h.map(function(C){return qe({points:C,depth:_,split:b})}),m!=null?m:!1);this.createMesh(l,d)}else if(v&&y)return new Promise(function(C){y.postMessage({coordinatesArr:v,depth:_,split:b,useGroups:m,projection:M},function(E){var ee=new s.BufferGeometry;Object.keys(E).forEach(function(G){ee.setAttribute(G,new s.BufferAttribute(E[G].array,E[G].itemSize))}),t.createMesh(ee,d),C("")})})},r}(p)})();var qt=me.Ei,er=me.Yo,tr=me.Ee,rr=me.x1,nr=me.VJ,ir=me.r7,ar=me.XA,or=me.NB,sr=me.xv,ur=me.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};
@@ -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 R?t:R,x=Object.create(l.prototype),D=new m(c||[]);return x._invoke=h(r,a,D),x}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 C="suspendedStart",N="suspendedYield",W="executing",U="completed",k={};function R(){}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=R.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(x,D,I,V){var H=M(r[x],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(x,D){function I(){return new t(function(V,H){a(x,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 x=new u(S(r,t,a,c),l);return f.isGeneratorFunction(t)?x:x.next().then(function(D){return D.done?D.value:x.next()})};function h(r,t,a){var c=C;return function(x,D){if(c===W)throw new Error("Generator is already running");if(c===U){if(x==="throw")throw D;return G()}for(a.method=x,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===C)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 x.type="throw",x.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],x=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 x=l?l.completion:{};return x.type=r,x.arg=t,l?(this.method="next",this.next=l.finallyLoc,k):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),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 R=Array.isArray(k.material)?k.material:[k.material];R.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),C=null,N=null,W=function(){var k=(0,j.Z)(d().mark(function R(_,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()}},R)}));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,C){var N=p[S*3],W=p[S*3+1],U=p[M*3],k=p[M*3+1],R=p[C*3],_=p[C*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((R-e.min.x)/i.x,(_-e.min.y)/i.y+u)]},generateSideWallUV:function(j,p,S,M,C,N){var W=p[S*3],U=p[S*3+1],k=p[S*3+2],R=p[M*3],_=p[M*3+1],w=p[M*3+2],n=p[C*3],s=p[C*3+1],o=p[C*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-R)?[new THREE.Vector2((W-g.min.x)/m.x,(k-g.min.z)/m.z),new THREE.Vector2((R-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.x,(k-g.min.z)/m.z),new THREE.Vector2((_-g.min.y)/m.x,(w-g.min.z)/m.z),new THREE.Vector2((s-g.min.y)/m.x,(o-g.min.z)/m.z),new THREE.Vector2((i-g.min.y)/m.x,(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),C=M.value}catch(N){E(N);return}M.done?O(C):Promise.resolve(C).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(C){A(p,L,j,S,M,"next",C)}function M(C){A(p,L,j,S,M,"throw",C)}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 z(y){var b=Y[y];if(b!==void 0)return b.exports;var f=Y[y]={exports:{}};return X[y](f,f.exports,z),f.exports}(function(){z.n=function(y){var b=y&&y.__esModule?function(){return y.default}:function(){return y};return z.d(b,{a:b}),b}})(),function(){z.d=function(y,b){for(var f in b)z.o(b,f)&&!z.o(y,f)&&Object.defineProperty(y,f,{enumerable:!0,get:b[f]})}}(),function(){z.o=function(y,b){return Object.prototype.hasOwnProperty.call(y,b)}}(),function(){z.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";z.r($),z.d($,{Cache:function(){return f},Data:function(){return _},Draw:function(){return R},Wk:function(){return w}});function y(n,s){if(!(n instanceof s))throw new TypeError("Cannot call a class as a function")}var b=z(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=z(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 C(){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)||C()}var W=z(666),U=z.n(W),k=z(644),R=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(m){var b=function(f){"use strict";var P=Object.prototype,k=P.hasOwnProperty,v,O=typeof Symbol=="function"?Symbol:{},w=O.iterator||"@@iterator",L=O.asyncIterator||"@@asyncIterator",E=O.toStringTag||"@@toStringTag";function h(r,t,i){return Object.defineProperty(r,t,{value:i,enumerable:!0,configurable:!0,writable:!0}),r[t]}try{h({},"")}catch(r){h=function(t,i,p){return t[i]=p}}function A(r,t,i,p){var l=t&&t.prototype instanceof x?t:x,C=Object.create(l.prototype),D=new j(p||[]);return C._invoke=y(r,i,D),C}f.wrap=A;function S(r,t,i){try{return{type:"normal",arg:r.call(t,i)}}catch(p){return{type:"throw",arg:p}}}var R="suspendedStart",N="suspendedYield",Z="executing",z="completed",T={};function x(){}function d(){}function n(){}var o={};h(o,w,function(){return this});var s=Object.getPrototypeOf,e=s&&s(s(G([])));e&&e!==P&&k.call(e,w)&&(o=e);var a=n.prototype=x.prototype=Object.create(o);d.prototype=n,h(a,"constructor",n),h(n,"constructor",d),d.displayName=h(n,E,"GeneratorFunction");function u(r){["next","throw","return"].forEach(function(t){h(r,t,function(i){return this._invoke(t,i)})})}f.isGeneratorFunction=function(r){var t=typeof r=="function"&&r.constructor;return t?t===d||(t.displayName||t.name)==="GeneratorFunction":!1},f.mark=function(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,n):(r.__proto__=n,h(r,E,"GeneratorFunction")),r.prototype=Object.create(a),r},f.awrap=function(r){return{__await:r}};function c(r,t){function i(C,D,I,W){var H=S(r[C],r,D);if(H.type==="throw")W(H.arg);else{var K=H.arg,B=K.value;return B&&typeof B=="object"&&k.call(B,"__await")?t.resolve(B.__await).then(function(F){i("next",F,I,W)},function(F){i("throw",F,I,W)}):t.resolve(B).then(function(F){K.value=F,I(K)},function(F){return i("throw",F,I,W)})}}var p;function l(C,D){function I(){return new t(function(W,H){i(C,D,W,H)})}return p=p?p.then(I,I):I()}this._invoke=l}u(c.prototype),h(c.prototype,L,function(){return this}),f.AsyncIterator=c,f.async=function(r,t,i,p,l){l===void 0&&(l=Promise);var C=new c(A(r,t,i,p),l);return f.isGeneratorFunction(t)?C:C.next().then(function(D){return D.done?D.value:C.next()})};function y(r,t,i){var p=R;return function(C,D){if(p===Z)throw new Error("Generator is already running");if(p===z){if(C==="throw")throw D;return V()}for(i.method=C,i.arg=D;;){var I=i.delegate;if(I){var W=g(I,i);if(W){if(W===T)continue;return W}}if(i.method==="next")i.sent=i._sent=i.arg;else if(i.method==="throw"){if(p===R)throw p=z,i.arg;i.dispatchException(i.arg)}else i.method==="return"&&i.abrupt("return",i.arg);p=Z;var H=S(r,t,i);if(H.type==="normal"){if(p=i.done?z:N,H.arg===T)continue;return{value:H.arg,done:i.done}}else H.type==="throw"&&(p=z,i.method="throw",i.arg=H.arg)}}}function g(r,t){var i=r.iterator[t.method];if(i===v){if(t.delegate=null,t.method==="throw"){if(r.iterator.return&&(t.method="return",t.arg=v,g(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 p=S(i,r.iterator,t.arg);if(p.type==="throw")return t.method="throw",t.arg=p.arg,t.delegate=null,T;var l=p.arg;if(!l)return t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,T;if(l.done)t[r.resultName]=l.value,t.next=r.nextLoc,t.method!=="return"&&(t.method="next",t.arg=v);else return l;return t.delegate=null,T}u(a),h(a,E,"Generator"),h(a,w,function(){return this}),h(a,"toString",function(){return"[object Generator]"});function M(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 _(r){var t=r.completion||{};t.type="normal",delete t.arg,r.completion=t}function j(r){this.tryEntries=[{tryLoc:"root"}],r.forEach(M,this),this.reset(!0)}f.keys=function(r){var t=[];for(var i in r)t.push(i);return t.reverse(),function p(){for(;t.length;){var l=t.pop();if(l in r)return p.value=l,p.done=!1,p}return p.done=!0,p}};function G(r){if(r){var t=r[w];if(t)return t.call(r);if(typeof r.next=="function")return r;if(!isNaN(r.length)){var i=-1,p=function l(){for(;++i<r.length;)if(k.call(r,i))return l.value=r[i],l.done=!1,l;return l.value=v,l.done=!0,l};return p.next=p}}return{next:V}}f.values=G;function V(){return{value:v,done:!0}}return j.prototype={constructor:j,reset:function(r){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(_),!r)for(var t in this)t.charAt(0)==="t"&&k.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=v)},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 i(W,H){return C.type="throw",C.arg=r,t.next=W,H&&(t.method="next",t.arg=v),!!H}for(var p=this.tryEntries.length-1;p>=0;--p){var l=this.tryEntries[p],C=l.completion;if(l.tryLoc==="root")return i("end");if(l.tryLoc<=this.prev){var D=k.call(l,"catchLoc"),I=k.call(l,"finallyLoc");if(D&&I){if(this.prev<l.catchLoc)return i(l.catchLoc,!0);if(this.prev<l.finallyLoc)return i(l.finallyLoc)}else if(D){if(this.prev<l.catchLoc)return i(l.catchLoc,!0)}else if(I){if(this.prev<l.finallyLoc)return i(l.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(r,t){for(var i=this.tryEntries.length-1;i>=0;--i){var p=this.tryEntries[i];if(p.tryLoc<=this.prev&&k.call(p,"finallyLoc")&&this.prev<p.finallyLoc){var l=p;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,T):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),T},finish:function(r){for(var t=this.tryEntries.length-1;t>=0;--t){var i=this.tryEntries[t];if(i.finallyLoc===r)return this.complete(i.completion,i.afterLoc),_(i),T}},catch:function(r){for(var t=this.tryEntries.length-1;t>=0;--t){var i=this.tryEntries[t];if(i.tryLoc===r){var p=i.completion;if(p.type==="throw"){var l=p.arg;_(i)}return l}}throw new Error("illegal catch attempt")},delegateYield:function(r,t,i){return this.delegate={iterator:G(r),resultName:t,nextLoc:i},this.method==="next"&&(this.arg=v),T}},f}(m.exports);try{regeneratorRuntime=b}catch(f){typeof globalThis=="object"?globalThis.regeneratorRuntime=b:Function("r","regeneratorRuntime = r")(b)}},519:function(m,b,f){"use strict";f.d(b,{makePromiseCreator:function(){return P.Z}});var P=f(282),k=f(666),v=f.n(k),O=null,w=f(644);function L(T){if(T.material){var x=Array.isArray(T.material)?T.material:[T.material];x.forEach(function(d){var n,o;(n=d.color)===null||n===void 0||n.convertSRGBToLinear(),(o=d.emissive)===null||o===void 0||o.convertSRGBToLinear(),d.map&&(d.map.encoding=THREE.sRGBEncoding),d.emissiveMap&&(d.emissiveMap.encoding=THREE.sRGBEncoding)})}}var E=f(568),h=f(924),A=require("idb-keyval"),S=f(484),R=null,N=null,Z=function(){var T=(0,E.Z)(v().mark(function x(d,n){var o,s,e,a,u,c;return v().wrap(function(g){for(;;)switch(g.prev=g.next){case 0:return o=n.version,g.next=4,(0,A.get)(d);case 4:if(e=g.sent,!(e&&e[o])){g.next=9;break}s=e[o],g.next=15;break;case 9:return g.next=11,(0,S.Z)(fetch(d).then(function(M){if(M.ok)return M.blob();throw new Error}));case 11:a=g.sent,u=a.res,c=a.err,c||(s=u,(0,A.set)(d,(0,h.Z)({},o,u)));case 15:return g.abrupt("return",s?{url:URL.createObjectURL(s)}:{url:d});case 16:case"end":return g.stop()}},x)}));return function(d,n){return T.apply(this,arguments)}}(),z=f(705)},282:function(m,b,f){"use strict";f.d(b,{Z:function(){return k}});var P=f(484);function k(){var v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},w={};return w.promise=new Promise(function(L,E){w.resolve=L,w.reject=E}),v&&(w.promise=(0,P.Z)(w.promise,O)),w}},484:function(m,b,f){"use strict";f.d(b,{Z:function(){return k}});var P=f(42);function k(v){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return v.then(function(w){return(0,P.Z)({err:null,res:w},O)}).catch(function(w){return(0,P.Z)({err:w,res:void 0},O)})}},705:function(m,b,f){"use strict";var P=f(644),k=f.n(P),v=new Map,O=function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{generateTopUV:function(E,h,A,S,R){var N=h[A*3],Z=h[A*3+1],z=h[S*3],T=h[S*3+1],x=h[R*3],d=h[R*3+1],n;if(v.has(E))n=v.get(E);else{var o=L.box3||new THREE.Box3;if(!L.box3){var s=E.parameters.shapes.getPoints();o.setFromArray(s.map(function(y){return[y.x,y.y,0]}).flat())}var e=o.getSize(new THREE.Vector3);L.split&&(e.y/=L.split),n={box:o,size:e},v.set(E,n)}var a=n.box,u=n.size,c=L.split?1-L.split:0;return[new THREE.Vector2((N-a.min.x)/u.x,(Z-a.min.y)/u.y+c),new THREE.Vector2((z-a.min.x)/u.x,(T-a.min.y)/u.y+c),new THREE.Vector2((x-a.min.x)/u.x,(d-a.min.y)/u.y+c)]},generateSideWallUV:function(E,h,A,S,R,N){var Z=h[A*3],z=h[A*3+1],T=h[A*3+2],x=h[S*3],d=h[S*3+1],n=h[S*3+2],o=h[R*3],s=h[R*3+1],e=h[R*3+2],a=h[N*3],u=h[N*3+1],c=h[N*3+2],y;if(v.has(h))y=v.get(h);else{var g=new THREE.Box3;g.setFromArray(h);var M=g.getSize(new THREE.Vector3);L.split&&(M.z/=1-L.split),y={box:g,size:M},v.set(h,y)}var _=y.box,j=y.size;return Math.abs(z-d)<Math.abs(Z-x)?[new THREE.Vector2((Z-_.min.x)/j.x,(T-_.min.z)/j.z),new THREE.Vector2((x-_.min.x)/j.x,(n-_.min.z)/j.z),new THREE.Vector2((o-_.min.x)/j.x,(e-_.min.z)/j.z),new THREE.Vector2((a-_.min.x)/j.x,(c-_.min.z)/j.z)]:[new THREE.Vector2((z-_.min.y)/j.x,(T-_.min.z)/j.z),new THREE.Vector2((d-_.min.y)/j.x,(n-_.min.z)/j.z),new THREE.Vector2((s-_.min.y)/j.x,(e-_.min.z)/j.z),new THREE.Vector2((u-_.min.y)/j.x,(c-_.min.z)/j.z)]}}},w=function(){v.clear()}},644:function(m){"use strict";m.exports=require("three")},568:function(m,b,f){"use strict";f.d(b,{Z:function(){return k}});function P(v,O,w,L,E,h,A){try{var S=v[h](A),R=S.value}catch(N){w(N);return}S.done?O(R):Promise.resolve(R).then(L,E)}function k(v){return function(){var O=this,w=arguments;return new Promise(function(L,E){var h=v.apply(O,w);function A(R){P(h,L,E,A,S,"next",R)}function S(R){P(h,L,E,A,S,"throw",R)}A(void 0)})}}},924:function(m,b,f){"use strict";f.d(b,{Z:function(){return P}});function P(k,v,O){return v in k?Object.defineProperty(k,v,{value:O,enumerable:!0,configurable:!0,writable:!0}):k[v]=O,k}},42:function(m,b,f){"use strict";f.d(b,{Z:function(){return k}});var P=f(924);function k(v){for(var O=1;O<arguments.length;O++){var w=arguments[O]!=null?arguments[O]:{},L=Object.keys(w);typeof Object.getOwnPropertySymbols=="function"&&(L=L.concat(Object.getOwnPropertySymbols(w).filter(function(E){return Object.getOwnPropertyDescriptor(w,E).enumerable}))),L.forEach(function(E){(0,P.Z)(v,E,w[E])})}return v}}},Y={};function U(m){var b=Y[m];if(b!==void 0)return b.exports;var f=Y[m]={exports:{}};return X[m](f,f.exports,U),f.exports}(function(){U.n=function(m){var b=m&&m.__esModule?function(){return m.default}:function(){return m};return U.d(b,{a:b}),b}})(),function(){U.d=function(m,b){for(var f in b)U.o(b,f)&&!U.o(m,f)&&Object.defineProperty(m,f,{enumerable:!0,get:b[f]})}}(),function(){U.o=function(m,b){return Object.prototype.hasOwnProperty.call(m,b)}}(),function(){U.r=function(m){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(m,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(m,"__esModule",{value:!0})}}();var $={};(function(){"use strict";U.r($),U.d($,{Cache:function(){return f},Data:function(){return x},Draw:function(){return T},Wk:function(){return d}});function m(n,o){if(!(n instanceof o))throw new TypeError("Cannot call a class as a function")}var b=U(519),f=function(){"use strict";function n(){m(this,n),this.cache=new Map}var o=n.prototype;return o.install=function(){},o.init=function(e){var a=(0,b.makePromiseCreator)();this.cache.set(e,a)},o.get=function(e){var a;return(a=this.cache.get(e))===null||a===void 0?void 0:a.promise},o.set=function(e,a){var u=this.cache.get(e);u?u.resolve(a):console.warn("init cache first")},o.dispose=function(){this.cache.forEach(function(e,a){e.reject("stop set cache:".concat(a))}),this.cache.clear()},n}(),P=U(568);function k(n,o){for(var s=0;s<o.length;s++){var e=o[s];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(n,e.key,e)}}function v(n,o,s){return o&&k(n.prototype,o),s&&k(n,s),n}function O(n){if(Array.isArray(n))return n}function w(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 E(n,o){(o==null||o>n.length)&&(o=n.length);for(var s=0,e=new Array(o);s<o;s++)e[s]=n[s];return e}function h(n,o){if(!!n){if(typeof n=="string")return E(n,o);var s=Object.prototype.toString.call(n).slice(8,-1);if(s==="Object"&&n.constructor&&(s=n.constructor.name),s==="Map"||s==="Set")return Array.from(s);if(s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return E(n,o)}}function A(n,o){return O(n)||w(n,o)||h(n,o)||L()}function S(n){if(Array.isArray(n))return E(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 S(n)||w(n)||h(n)||R()}var Z=U(666),z=U.n(Z),T=function(){"use strict";function n(s){m(this,n),this.objectNamesToFactories=new Map,this.objects=new Map,this.objects_=s}var o=n.prototype;return o.install=function(e){this.pencil=e,this.initObjectFactories()},o.initObjectFactories=function(){var e=this,a=this.objects_;Object.keys(a).forEach(function(u){var c=function(){function y(){m(this,y)}var g=y.prototype;return g.create=function(){var _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new a[u](_)},y}();e.objectNamesToFactories.set(u,c)})},o.getObject=function(e,a){e.includes("#")&&console.warn("getObject:err:\u4E0D\u652F\u6301 #",e);var u=(a||{}).key,c="".concat(e).concat(u?"#".concat(u):""),y=this.objects.get(c);return y},o.getAllObject=function(e,a){e.includes("#")&&console.warn("getAllObject:err:\u4E0D\u652F\u6301 #",e);var u=(a||{}).key,c="".concat(e).concat(u?"#".concat(u):""),y=[];return this.objects.forEach(function(g,M){(M.startsWith("".concat(c,"#"))||M===c)&&y.push(g)}),y},o.draw=function(e,a,u){var c=this;return(0,P.Z)(z().mark(function y(){var g,M,_,j,G,V,r;return z().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:if(g=c.objectNamesToFactories.get(e),!g){i.next=15;break}return M=(a||{}).key,_="".concat(e).concat(M?"#".concat(M):""),c.objects.has(_)&&(j=crypto.randomUUID(),_+="#".concat(j)),G=(a==null?void 0:a.target)||u,typeof G=="string"?V=c.objects.get(G):(G==null?void 0:G.objecttype__)==="BaseObject"?V=G:V=c.pencil.scene,r=new g().create(a),r.pencil=c.pencil,r.key=_,c.objects.set(_,r),i.next=14,c.addMesh(r,V);case 14:return i.abrupt("return",r);case 15:throw new Error("Unrecognized:".concat(e));case 16:case"end":return i.stop()}},y)}))()},o.addMesh=function(e,a){return(0,P.Z)(z().mark(function u(){return z().wrap(function(y){for(;;)switch(y.prev=y.next){case 0:return y.next=2,e.create();case 2:e.object3d&&(e.object3d.userData.BaseObject_=e,a.add(e.object3d)),e.visible=!0,e.render(),e.pm.resolve();case 6:case"end":return y.stop()}},u)}))()},o.erase=function(){for(var e=arguments.length,a=new Array(e),u=0;u<e;u++)a[u]=arguments[u];var c=this;N(a).forEach(function(y){var g=[];if(typeof y=="string"){var M,_=A(y.split("#"),2),j=_[0],G=_[1];(M=g).push.apply(M,N(c.getAllObject(j,{key:G})))}else g.push(y);g.forEach(function(V){c.removeMesh(V)})})},o.removeMesh=function(e){var a=this,u=e.parent;e.object3d&&u.remove(e.object3d),e.traverse(function(c){c.visible=!1,c.dispose(),a.objects.delete(c.key)})},o.update=function(e,a){this.objects.forEach(function(u){u.update(e,a)})},o.setSize=function(e,a){this.objects.forEach(function(u){u.resize(e,a)})},o.dispose=function(){this.objects.forEach(function(e,a){e.dispose(),e.pm.reject("stop draw:".concat(a))}),this.objects.clear(),this.objectNamesToFactories.clear()},v(n,[{key:"objectsPromise",get:function(){var e=[];return this.objects.forEach(function(a){e.push(a.pm.promise)}),e}}]),n}(),x=function(){"use strict";function n(){m(this,n),this.data={}}var o=n.prototype;return o.install=function(){},o.setData=function(e,a){var u,c;this.data[e]=a,(c=(u=this).cb)===null||c===void 0||c.call(u,e)},o.runAll=function(){var e=this;Object.keys(this.data).forEach(function(a){var u,c;(c=(u=e).cb)===null||c===void 0||c.call(u,a)})},o.dispose=function(){this.data={},this.cb=void 0},n}(),d=function(){"use strict";function n(){m(this,n),this.messageList=[]}var o=n.prototype;return o.install=function(){},o.init=function(e,a){var u=this;this.workerList=Array.from({length:a},function(c,y){var g=typeof e=="string"?new Worker(e):e();return g.onmessage=function(M){var _=M.data,j=_.res,G=_.uuid,V=u.messageList.find(function(r){var t=r.uuid;return G===t});V==null||V.cb(j),u.workerList[y].inUse=!1,u.checkMessage()},{worker:g,inUse:!1}})},o.postMessage=function(e,a){this.messageList.push({req:e,cb:a,uuid:crypto.randomUUID(),inUse:!1}),this.checkMessage()},o.checkMessage=function(){var e=this.workerList.find(function(u){var c=u.inUse;return!c});if(e){var a=this.messageList.find(function(u){var c=u.inUse;return!c});a&&(a.inUse=!0,e.inUse=!0,e.worker.postMessage({req:a.req,uuid:a.uuid}))}},o.dispose=function(){this.workerList.forEach(function(e){var a=e.worker;a.terminate()}),this.workerList=[],this.messageList=[]},n}()})(),module.exports=$})();
@@ -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,P=Object.create(h.prototype),U=new M(c||[]);return P._invoke=l(r,o,U),P}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",x={};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(P,U,G,N){var D=C(r[P],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(P,U){function G(){return new t(function(N,D){o(P,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 P=new u(S(r,t,o,c),h);return f.isGeneratorFunction(t)?P:P.next().then(function(U){return U.done?U.value:P.next()})};function l(r,t,o){var c=A;return function(P,U){if(c===W)throw new Error("Generator is already running");if(c===R){if(P==="throw")throw U;return z()}for(o.method=P,o.arg=U;;){var G=o.delegate;if(G){var N=w(G,o);if(N){if(N===x)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===x)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 x;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return x}var c=C(o,r.iterator,t.arg);if(c.type==="throw")return t.method="throw",t.arg=c.arg,t.delegate=null,x;var h=c.arg;if(!h)return t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,x;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,x}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 M(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 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(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 P.type="throw",P.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],P=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 P=h?h.completion:{};return P.type=r,P.arg=t,h?(this.method="next",this.next=h.finallyLoc,x):this.complete(P)},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),x},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),x}},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),x}},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,x=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(M){if(M.ok)return M.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],x=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((x-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],x=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-x)?[new THREE.Vector2((H-y.min.x)/v.x,(R-y.min.z)/v.z),new THREE.Vector2((x-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.x,(R-y.min.z)/v.z),new THREE.Vector2((V-y.min.y)/v.x,(k-y.min.z)/v.z),new THREE.Vector2((n-y.min.y)/v.x,(i-y.min.z)/v.z),new THREE.Vector2((e-y.min.y)/v.x,(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),x=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 M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new s[u](M)},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,M,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,M="".concat(e).concat(v?"#".concat(v):""),l.objects.has(M)&&(Z=x.MathUtils.generateUUID(),M+="#".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=M,l.objects.set(M,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,M=S(w.split("#"),2),Z=M[0],z=M[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 M=v.data,Z=M.res,z=M.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:x.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"three";var J={666:function(w){var y=function(f){"use strict";var T=Object.prototype,m=T.hasOwnProperty,d,j=typeof Symbol=="function"?Symbol:{},_=j.iterator||"@@iterator",O=j.asyncIterator||"@@asyncIterator",l=j.toStringTag||"@@toStringTag";function E(r,e,i){return Object.defineProperty(r,e,{value:i,enumerable:!0,configurable:!0,writable:!0}),r[e]}try{E({},"")}catch(r){E=function(e,i,v){return e[i]=v}}function x(r,e,i,v){var h=e&&e.prototype instanceof W?e:W,P=Object.create(h.prototype),z=new H(v||[]);return P._invoke=g(r,i,z),P}f.wrap=x;function M(r,e,i){try{return{type:"normal",arg:r.call(e,i)}}catch(v){return{type:"throw",arg:v}}}var A="suspendedStart",D="suspendedYield",Z="executing",C="completed",S={};function W(){}function k(){}function a(){}var n={};E(n,_,function(){return this});var s=Object.getPrototypeOf,t=s&&s(s(R([])));t&&t!==T&&m.call(t,_)&&(n=t);var o=a.prototype=W.prototype=Object.create(n);k.prototype=a,E(o,"constructor",a),E(a,"constructor",k),k.displayName=E(a,l,"GeneratorFunction");function u(r){["next","throw","return"].forEach(function(e){E(r,e,function(i){return this._invoke(e,i)})})}f.isGeneratorFunction=function(r){var e=typeof r=="function"&&r.constructor;return e?e===k||(e.displayName||e.name)==="GeneratorFunction":!1},f.mark=function(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,a):(r.__proto__=a,E(r,l,"GeneratorFunction")),r.prototype=Object.create(o),r},f.awrap=function(r){return{__await:r}};function c(r,e){function i(P,z,G,N){var U=M(r[P],r,z);if(U.type==="throw")N(U.arg);else{var $=U.arg,F=$.value;return F&&typeof F=="object"&&m.call(F,"__await")?e.resolve(F.__await).then(function(B){i("next",B,G,N)},function(B){i("throw",B,G,N)}):e.resolve(F).then(function(B){$.value=B,G($)},function(B){return i("throw",B,G,N)})}}var v;function h(P,z){function G(){return new e(function(N,U){i(P,z,N,U)})}return v=v?v.then(G,G):G()}this._invoke=h}u(c.prototype),E(c.prototype,O,function(){return this}),f.AsyncIterator=c,f.async=function(r,e,i,v,h){h===void 0&&(h=Promise);var P=new c(x(r,e,i,v),h);return f.isGeneratorFunction(e)?P:P.next().then(function(z){return z.done?z.value:P.next()})};function g(r,e,i){var v=A;return function(P,z){if(v===Z)throw new Error("Generator is already running");if(v===C){if(P==="throw")throw z;return I()}for(i.method=P,i.arg=z;;){var G=i.delegate;if(G){var N=L(G,i);if(N){if(N===S)continue;return N}}if(i.method==="next")i.sent=i._sent=i.arg;else if(i.method==="throw"){if(v===A)throw v=C,i.arg;i.dispatchException(i.arg)}else i.method==="return"&&i.abrupt("return",i.arg);v=Z;var U=M(r,e,i);if(U.type==="normal"){if(v=i.done?C:D,U.arg===S)continue;return{value:U.arg,done:i.done}}else U.type==="throw"&&(v=C,i.method="throw",i.arg=U.arg)}}}function L(r,e){var i=r.iterator[e.method];if(i===d){if(e.delegate=null,e.method==="throw"){if(r.iterator.return&&(e.method="return",e.arg=d,L(r,e),e.method==="throw"))return S;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return S}var v=M(i,r.iterator,e.arg);if(v.type==="throw")return e.method="throw",e.arg=v.arg,e.delegate=null,S;var h=v.arg;if(!h)return e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,S;if(h.done)e[r.resultName]=h.value,e.next=r.nextLoc,e.method!=="return"&&(e.method="next",e.arg=d);else return h;return e.delegate=null,S}u(o),E(o,l,"Generator"),E(o,_,function(){return this}),E(o,"toString",function(){return"[object Generator]"});function b(r){var e={tryLoc:r[0]};1 in r&&(e.catchLoc=r[1]),2 in r&&(e.finallyLoc=r[2],e.afterLoc=r[3]),this.tryEntries.push(e)}function p(r){var e=r.completion||{};e.type="normal",delete e.arg,r.completion=e}function H(r){this.tryEntries=[{tryLoc:"root"}],r.forEach(b,this),this.reset(!0)}f.keys=function(r){var e=[];for(var i in r)e.push(i);return e.reverse(),function v(){for(;e.length;){var h=e.pop();if(h in r)return v.value=h,v.done=!1,v}return v.done=!0,v}};function R(r){if(r){var e=r[_];if(e)return e.call(r);if(typeof r.next=="function")return r;if(!isNaN(r.length)){var i=-1,v=function h(){for(;++i<r.length;)if(m.call(r,i))return h.value=r[i],h.done=!1,h;return h.value=d,h.done=!0,h};return v.next=v}}return{next:I}}f.values=R;function I(){return{value:d,done:!0}}return H.prototype={constructor:H,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(p),!r)for(var e in this)e.charAt(0)==="t"&&m.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=d)},stop:function(){this.done=!0;var r=this.tryEntries[0],e=r.completion;if(e.type==="throw")throw e.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function i(N,U){return P.type="throw",P.arg=r,e.next=N,U&&(e.method="next",e.arg=d),!!U}for(var v=this.tryEntries.length-1;v>=0;--v){var h=this.tryEntries[v],P=h.completion;if(h.tryLoc==="root")return i("end");if(h.tryLoc<=this.prev){var z=m.call(h,"catchLoc"),G=m.call(h,"finallyLoc");if(z&&G){if(this.prev<h.catchLoc)return i(h.catchLoc,!0);if(this.prev<h.finallyLoc)return i(h.finallyLoc)}else if(z){if(this.prev<h.catchLoc)return i(h.catchLoc,!0)}else if(G){if(this.prev<h.finallyLoc)return i(h.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(r,e){for(var i=this.tryEntries.length-1;i>=0;--i){var v=this.tryEntries[i];if(v.tryLoc<=this.prev&&m.call(v,"finallyLoc")&&this.prev<v.finallyLoc){var h=v;break}}h&&(r==="break"||r==="continue")&&h.tryLoc<=e&&e<=h.finallyLoc&&(h=null);var P=h?h.completion:{};return P.type=r,P.arg=e,h?(this.method="next",this.next=h.finallyLoc,S):this.complete(P)},complete:function(r,e){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"&&e&&(this.next=e),S},finish:function(r){for(var e=this.tryEntries.length-1;e>=0;--e){var i=this.tryEntries[e];if(i.finallyLoc===r)return this.complete(i.completion,i.afterLoc),p(i),S}},catch:function(r){for(var e=this.tryEntries.length-1;e>=0;--e){var i=this.tryEntries[e];if(i.tryLoc===r){var v=i.completion;if(v.type==="throw"){var h=v.arg;p(i)}return h}}throw new Error("illegal catch attempt")},delegateYield:function(r,e,i){return this.delegate={iterator:R(r),resultName:e,nextLoc:i},this.method==="next"&&(this.arg=d),S}},f}(w.exports);try{regeneratorRuntime=y}catch(f){typeof globalThis=="object"?globalThis.regeneratorRuntime=y:Function("r","regeneratorRuntime = r")(y)}},521:function(w,y,f){f.d(y,{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 a=Array.isArray(k.material)?k.material:[k.material];a.forEach(function(n){var s,t;(s=n.color)===null||s===void 0||s.convertSRGBToLinear(),(t=n.emissive)===null||t===void 0||t.convertSRGBToLinear(),n.map&&(n.map.encoding=THREE.sRGBEncoding),n.emissiveMap&&(n.emissiveMap.encoding=THREE.sRGBEncoding)})}}var l=f(568),E=f(924),x=k=>{var a={};return f.d(a,k),a},M=k=>()=>k,A=x({get:()=>X.get,set:()=>X.set}),D=f(484),Z=null,C=null,S=function(){var k=(0,l.Z)(d().mark(function a(n,s){var t,o,u,c,g,L;return d().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return t=s.version,p.next=4,(0,A.get)(n);case 4:if(u=p.sent,!(u&&u[t])){p.next=9;break}o=u[t],p.next=15;break;case 9:return p.next=11,(0,D.Z)(fetch(n).then(function(H){if(H.ok)return H.blob();throw new Error}));case 11:c=p.sent,g=c.res,L=c.err,L||(o=g,(0,A.set)(n,(0,E.Z)({},t,g)));case 15:return p.abrupt("return",o?{url:URL.createObjectURL(o)}:{url:n});case 16:case"end":return p.stop()}},a)}));return function(n,s){return k.apply(this,arguments)}}(),W=f(705)},282:function(w,y,f){f.d(y,{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,l){_.resolve=O,_.reject=l}),d&&(_.promise=(0,T.Z)(_.promise,j)),_}},484:function(w,y,f){f.d(y,{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(w,y,f){var T=f(949),m=new Map,d=function(){var _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{generateTopUV:function(O,l,E,x,M){var A=l[E*3],D=l[E*3+1],Z=l[x*3],C=l[x*3+1],S=l[M*3],W=l[M*3+1],k;if(m.has(O))k=m.get(O);else{var a=_.box3||new THREE.Box3;if(!_.box3){var n=O.parameters.shapes.getPoints();a.setFromArray(n.map(function(c){return[c.x,c.y,0]}).flat())}var s=a.getSize(new THREE.Vector3);_.split&&(s.y/=_.split),k={box:a,size:s},m.set(O,k)}var t=k.box,o=k.size,u=_.split?1-_.split:0;return[new THREE.Vector2((A-t.min.x)/o.x,(D-t.min.y)/o.y+u),new THREE.Vector2((Z-t.min.x)/o.x,(C-t.min.y)/o.y+u),new THREE.Vector2((S-t.min.x)/o.x,(W-t.min.y)/o.y+u)]},generateSideWallUV:function(O,l,E,x,M,A){var D=l[E*3],Z=l[E*3+1],C=l[E*3+2],S=l[x*3],W=l[x*3+1],k=l[x*3+2],a=l[M*3],n=l[M*3+1],s=l[M*3+2],t=l[A*3],o=l[A*3+1],u=l[A*3+2],c;if(m.has(l))c=m.get(l);else{var g=new THREE.Box3;g.setFromArray(l);var L=g.getSize(new THREE.Vector3);_.split&&(L.z/=1-_.split),c={box:g,size:L},m.set(l,c)}var b=c.box,p=c.size;return Math.abs(Z-W)<Math.abs(D-S)?[new THREE.Vector2((D-b.min.x)/p.x,(C-b.min.z)/p.z),new THREE.Vector2((S-b.min.x)/p.x,(k-b.min.z)/p.z),new THREE.Vector2((a-b.min.x)/p.x,(s-b.min.z)/p.z),new THREE.Vector2((t-b.min.x)/p.x,(u-b.min.z)/p.z)]:[new THREE.Vector2((Z-b.min.y)/p.x,(C-b.min.z)/p.z),new THREE.Vector2((W-b.min.y)/p.x,(k-b.min.z)/p.z),new THREE.Vector2((n-b.min.y)/p.x,(s-b.min.z)/p.z),new THREE.Vector2((o-b.min.y)/p.x,(u-b.min.z)/p.z)]}}},j=function(){m.clear()}},949:function(w,y,f){var T=d=>{var j={};return f.d(j,d),j},m=d=>()=>d;w.exports=T({})},568:function(w,y,f){f.d(y,{Z:function(){return m}});function T(d,j,_,O,l,E,x){try{var M=d[E](x),A=M.value}catch(D){_(D);return}M.done?j(A):Promise.resolve(A).then(O,l)}function m(d){return function(){var j=this,_=arguments;return new Promise(function(O,l){var E=d.apply(j,_);function x(A){T(E,O,l,x,M,"next",A)}function M(A){T(E,O,l,x,M,"throw",A)}x(void 0)})}}},924:function(w,y,f){f.d(y,{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(w,y,f){f.d(y,{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(l){return Object.getOwnPropertyDescriptor(_,l).enumerable}))),O.forEach(function(l){(0,T.Z)(d,l,_[l])})}return d}}},Y={};function V(w){var y=Y[w];if(y!==void 0)return y.exports;var f=Y[w]={exports:{}};return J[w](f,f.exports,V),f.exports}(function(){V.n=function(w){var y=w&&w.__esModule?function(){return w.default}:function(){return w};return V.d(y,{a:y}),y}})(),function(){V.d=function(w,y){for(var f in y)V.o(y,f)&&!V.o(w,f)&&Object.defineProperty(w,f,{enumerable:!0,get:y[f]})}}(),function(){V.o=function(w,y){return Object.prototype.hasOwnProperty.call(w,y)}}();var K={};(function(){V.d(K,{Ct:function(){return f},Vw:function(){return W},hG:function(){return S},Wk:function(){return k}});function w(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function")}var y=V(521),f=function(){"use strict";function a(){w(this,a),this.cache=new Map}var n=a.prototype;return n.install=function(){},n.init=function(t){var o=(0,y.Mf)();this.cache.set(t,o)},n.get=function(t){var o;return(o=this.cache.get(t))===null||o===void 0?void 0:o.promise},n.set=function(t,o){var u=this.cache.get(t);u?u.resolve(o):console.warn("init cache first")},n.dispose=function(){this.cache.forEach(function(t,o){t.reject("stop set cache:".concat(o))}),this.cache.clear()},a}(),T=V(568);function m(a,n){for(var s=0;s<n.length;s++){var t=n[s];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(a,t.key,t)}}function d(a,n,s){return n&&m(a.prototype,n),s&&m(a,s),a}function j(a){if(Array.isArray(a))return a}function _(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 l(a,n){(n==null||n>a.length)&&(n=a.length);for(var s=0,t=new Array(n);s<n;s++)t[s]=a[s];return t}function E(a,n){if(!!a){if(typeof a=="string")return l(a,n);var s=Object.prototype.toString.call(a).slice(8,-1);if(s==="Object"&&a.constructor&&(s=a.constructor.name),s==="Map"||s==="Set")return Array.from(s);if(s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return l(a,n)}}function x(a,n){return j(a)||_(a,n)||E(a,n)||O()}function M(a){if(Array.isArray(a))return l(a)}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 D(a){return M(a)||_(a)||E(a)||A()}var Z=V(666),C=V.n(Z),S=function(){"use strict";function a(s){w(this,a),this.objectNamesToFactories=new Map,this.objects=new Map,this.objects_=s}var n=a.prototype;return n.install=function(t){this.pencil=t,this.initObjectFactories()},n.initObjectFactories=function(){var t=this,o=this.objects_;Object.keys(o).forEach(function(u){var c=function(){function g(){w(this,g)}var L=g.prototype;return L.create=function(){var p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new o[u](p)},g}();t.objectNamesToFactories.set(u,c)})},n.getObject=function(t,o){t.includes("#")&&console.warn("getObject:err:\u4E0D\u652F\u6301 #",t);var u=(o||{}).key,c="".concat(t).concat(u?"#".concat(u):""),g=this.objects.get(c);return g},n.getAllObject=function(t,o){t.includes("#")&&console.warn("getAllObject:err:\u4E0D\u652F\u6301 #",t);var u=(o||{}).key,c="".concat(t).concat(u?"#".concat(u):""),g=[];return this.objects.forEach(function(L,b){(b.startsWith("".concat(c,"#"))||b===c)&&g.push(L)}),g},n.draw=function(t,o,u){var c=this;return(0,T.Z)(C().mark(function g(){var L,b,p,H,R,I,r;return C().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:if(L=c.objectNamesToFactories.get(t),!L){i.next=15;break}return b=(o||{}).key,p="".concat(t).concat(b?"#".concat(b):""),c.objects.has(p)&&(H=crypto.randomUUID(),p+="#".concat(H)),R=(o==null?void 0:o.target)||u,typeof R=="string"?I=c.objects.get(R):(R==null?void 0:R.objecttype__)==="BaseObject"?I=R:I=c.pencil.scene,r=new L().create(o),r.pencil=c.pencil,r.key=p,c.objects.set(p,r),i.next=14,c.addMesh(r,I);case 14:return i.abrupt("return",r);case 15:throw new Error("Unrecognized:".concat(t));case 16:case"end":return i.stop()}},g)}))()},n.addMesh=function(t,o){return(0,T.Z)(C().mark(function u(){return C().wrap(function(g){for(;;)switch(g.prev=g.next){case 0:return g.next=2,t.create();case 2:t.object3d&&(t.object3d.userData.BaseObject_=t,o.add(t.object3d)),t.visible=!0,t.render(),t.pm.resolve();case 6:case"end":return g.stop()}},u)}))()},n.erase=function(){for(var t=arguments.length,o=new Array(t),u=0;u<t;u++)o[u]=arguments[u];var c=this;D(o).forEach(function(g){var L=[];if(typeof g=="string"){var b,p=x(g.split("#"),2),H=p[0],R=p[1];(b=L).push.apply(b,D(c.getAllObject(H,{key:R})))}else L.push(g);L.forEach(function(I){c.removeMesh(I)})})},n.removeMesh=function(t){var o=this,u=t.parent;t.object3d&&u.remove(t.object3d),t.traverse(function(c){c.visible=!1,c.dispose(),o.objects.delete(c.key)})},n.update=function(t,o){this.objects.forEach(function(u){u.update(t,o)})},n.setSize=function(t,o){this.objects.forEach(function(u){u.resize(t,o)})},n.dispose=function(){this.objects.forEach(function(t,o){t.dispose(),t.pm.reject("stop draw:".concat(o))}),this.objects.clear(),this.objectNamesToFactories.clear()},d(a,[{key:"objectsPromise",get:function(){var t=[];return this.objects.forEach(function(o){t.push(o.pm.promise)}),t}}]),a}(),W=function(){"use strict";function a(){w(this,a),this.data={}}var n=a.prototype;return n.install=function(){},n.setData=function(t,o){var u,c;this.data[t]=o,(c=(u=this).cb)===null||c===void 0||c.call(u,t)},n.runAll=function(){var t=this;Object.keys(this.data).forEach(function(o){var u,c;(c=(u=t).cb)===null||c===void 0||c.call(u,o)})},n.dispose=function(){this.data={},this.cb=void 0},a}(),k=function(){"use strict";function a(){w(this,a),this.messageList=[]}var n=a.prototype;return n.install=function(){},n.init=function(t,o){var u=this;this.workerList=Array.from({length:o},function(c,g){var L=typeof t=="string"?new Worker(t):t();return L.onmessage=function(b){var p=b.data,H=p.res,R=p.uuid,I=u.messageList.find(function(r){var e=r.uuid;return R===e});I==null||I.cb(H),u.workerList[g].inUse=!1,u.checkMessage()},{worker:L,inUse:!1}})},n.postMessage=function(t,o){this.messageList.push({req:t,cb:o,uuid:crypto.randomUUID(),inUse:!1}),this.checkMessage()},n.checkMessage=function(){var t=this.workerList.find(function(u){var c=u.inUse;return!c});if(t){var o=this.messageList.find(function(u){var c=u.inUse;return!c});o&&(o.inUse=!0,t.inUse=!0,t.worker.postMessage({req:o.req,uuid:o.uuid}))}},n.dispose=function(){this.workerList.forEach(function(t){var o=t.worker;o.terminate()}),this.workerList=[],this.messageList=[]},a}()})();var Q=K.Ct,q=K.Vw,tt=K.hG,et=K.Wk;export{Q as Cache,q as Data,tt as Draw,et as Wk};