gl-draw 0.0.32 → 0.1.2

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 Qe from"idb-keyval";import*as k from"three";import*as Vt from"three/examples/jsm/renderers/CSS2DRenderer";import*as qe from"three/examples/jsm/renderers/CSS3DRenderer";import*as Wt from"@tweenjs/tween.js";import*as Ie from"d3-array";import*as Gt from"earcut";import*as zt from"@turf/boolean-clockwise";import*as Ut from"delaunator";import*as Nt from"@turf/boolean-point-in-polygon";import*as Be from"d3-geo";import*as Ft from"d3-geo-voronoi";import*as It from"d3-scale";var Zt={666:function(O){var E=function(x){"use strict";var T=Object.prototype,S=T.hasOwnProperty,j,A=typeof Symbol=="function"?Symbol:{},z=A.iterator||"@@iterator",Z=A.asyncIterator||"@@asyncIterator",V=A.toStringTag||"@@toStringTag";function B(f,u,p){return Object.defineProperty(f,u,{value:p,enumerable:!0,configurable:!0,writable:!0}),f[u]}try{B({},"")}catch(f){B=function(u,p,M){return u[p]=M}}function J(f,u,p,M){var y=u&&u.prototype instanceof U?u:U,N=Object.create(y.prototype),G=new Ce(M||[]);return N._invoke=ye(f,p,G),N}x.wrap=J;function Q(f,u,p){try{return{type:"normal",arg:f.call(u,p)}}catch(M){return{type:"throw",arg:M}}}var D="suspendedStart",s="suspendedYield",pe="executing",te="completed",X={};function U(){}function H(){}function L(){}var $={};B($,z,function(){return this});var K=Object.getPrototypeOf,ne=K&&K(K(Te([])));ne&&ne!==T&&S.call(ne,z)&&($=ne);var q=L.prototype=U.prototype=Object.create($);H.prototype=L,B(q,"constructor",L),B(L,"constructor",H),H.displayName=B(L,V,"GeneratorFunction");function I(f){["next","throw","return"].forEach(function(u){B(f,u,function(p){return this._invoke(u,p)})})}x.isGeneratorFunction=function(f){var u=typeof f=="function"&&f.constructor;return u?u===H||(u.displayName||u.name)==="GeneratorFunction":!1},x.mark=function(f){return Object.setPrototypeOf?Object.setPrototypeOf(f,L):(f.__proto__=L,B(f,V,"GeneratorFunction")),f.prototype=Object.create(q),f},x.awrap=function(f){return{__await:f}};function se(f,u){function p(N,G,ee,re){var Y=Q(f[N],f,G);if(Y.type==="throw")re(Y.arg);else{var be=Y.arg,we=be.value;return we&&typeof we=="object"&&S.call(we,"__await")?u.resolve(we.__await).then(function(ve){p("next",ve,ee,re)},function(ve){p("throw",ve,ee,re)}):u.resolve(we).then(function(ve){be.value=ve,ee(be)},function(ve){return p("throw",ve,ee,re)})}}var M;function y(N,G){function ee(){return new u(function(re,Y){p(N,G,re,Y)})}return M=M?M.then(ee,ee):ee()}this._invoke=y}I(se.prototype),B(se.prototype,Z,function(){return this}),x.AsyncIterator=se,x.async=function(f,u,p,M,y){y===void 0&&(y=Promise);var N=new se(J(f,u,p,M),y);return x.isGeneratorFunction(u)?N:N.next().then(function(G){return G.done?G.value:N.next()})};function ye(f,u,p){var M=D;return function(N,G){if(M===pe)throw new Error("Generator is already running");if(M===te){if(N==="throw")throw G;return Le()}for(p.method=N,p.arg=G;;){var ee=p.delegate;if(ee){var re=Oe(ee,p);if(re){if(re===X)continue;return re}}if(p.method==="next")p.sent=p._sent=p.arg;else if(p.method==="throw"){if(M===D)throw M=te,p.arg;p.dispatchException(p.arg)}else p.method==="return"&&p.abrupt("return",p.arg);M=pe;var Y=Q(f,u,p);if(Y.type==="normal"){if(M=p.done?te:s,Y.arg===X)continue;return{value:Y.arg,done:p.done}}else Y.type==="throw"&&(M=te,p.method="throw",p.arg=Y.arg)}}}function Oe(f,u){var p=f.iterator[u.method];if(p===j){if(u.delegate=null,u.method==="throw"){if(f.iterator.return&&(u.method="return",u.arg=j,Oe(f,u),u.method==="throw"))return X;u.method="throw",u.arg=new TypeError("The iterator does not provide a 'throw' method")}return X}var M=Q(p,f.iterator,u.arg);if(M.type==="throw")return u.method="throw",u.arg=M.arg,u.delegate=null,X;var y=M.arg;if(!y)return u.method="throw",u.arg=new TypeError("iterator result is not an object"),u.delegate=null,X;if(y.done)u[f.resultName]=y.value,u.next=f.nextLoc,u.method!=="return"&&(u.method="next",u.arg=j);else return y;return u.delegate=null,X}I(q),B(q,V,"Generator"),B(q,z,function(){return this}),B(q,"toString",function(){return"[object Generator]"});function ie(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 me(f){var u=f.completion||{};u.type="normal",delete u.arg,f.completion=u}function Ce(f){this.tryEntries=[{tryLoc:"root"}],f.forEach(ie,this),this.reset(!0)}x.keys=function(f){var u=[];for(var p in f)u.push(p);return u.reverse(),function M(){for(;u.length;){var y=u.pop();if(y in f)return M.value=y,M.done=!1,M}return M.done=!0,M}};function Te(f){if(f){var u=f[z];if(u)return u.call(f);if(typeof f.next=="function")return f;if(!isNaN(f.length)){var p=-1,M=function y(){for(;++p<f.length;)if(S.call(f,p))return y.value=f[p],y.done=!1,y;return y.value=j,y.done=!0,y};return M.next=M}}return{next:Le}}x.values=Te;function Le(){return{value:j,done:!0}}return Ce.prototype={constructor:Ce,reset:function(f){if(this.prev=0,this.next=0,this.sent=this._sent=j,this.done=!1,this.delegate=null,this.method="next",this.arg=j,this.tryEntries.forEach(me),!f)for(var u in this)u.charAt(0)==="t"&&S.call(this,u)&&!isNaN(+u.slice(1))&&(this[u]=j)},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(re,Y){return N.type="throw",N.arg=f,u.next=re,Y&&(u.method="next",u.arg=j),!!Y}for(var M=this.tryEntries.length-1;M>=0;--M){var y=this.tryEntries[M],N=y.completion;if(y.tryLoc==="root")return p("end");if(y.tryLoc<=this.prev){var G=S.call(y,"catchLoc"),ee=S.call(y,"finallyLoc");if(G&&ee){if(this.prev<y.catchLoc)return p(y.catchLoc,!0);if(this.prev<y.finallyLoc)return p(y.finallyLoc)}else if(G){if(this.prev<y.catchLoc)return p(y.catchLoc,!0)}else if(ee){if(this.prev<y.finallyLoc)return p(y.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 M=this.tryEntries[p];if(M.tryLoc<=this.prev&&S.call(M,"finallyLoc")&&this.prev<M.finallyLoc){var y=M;break}}y&&(f==="break"||f==="continue")&&y.tryLoc<=u&&u<=y.finallyLoc&&(y=null);var N=y?y.completion:{};return N.type=f,N.arg=u,y?(this.method="next",this.next=y.finallyLoc,X):this.complete(N)},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),X},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),me(p),X}},catch:function(f){for(var u=this.tryEntries.length-1;u>=0;--u){var p=this.tryEntries[u];if(p.tryLoc===f){var M=p.completion;if(M.type==="throw"){var y=M.arg;me(p)}return y}}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=j),X}},x}(O.exports);try{regeneratorRuntime=E}catch(x){typeof globalThis=="object"?globalThis.regeneratorRuntime=E:Function("r","regeneratorRuntime = r")(E)}},182:function(O,E,x){x.d(E,{Z:function(){return T}});function T(S){if(S.geometry&&S.geometry.dispose(),S.material){var j=Array.isArray(S.material)?S.material:[S.material];j.forEach(function(A){var z,Z,V,B,J,Q,D,s,pe,te,X,U,H;(z=A.map)===null||z===void 0||z.dispose(),(Z=A.lightMap)===null||Z===void 0||Z.dispose(),(V=A.bumpMap)===null||V===void 0||V.dispose(),(B=A.normalMap)===null||B===void 0||B.dispose(),(J=A.specularMap)===null||J===void 0||J.dispose(),(Q=A.envMap)===null||Q===void 0||Q.dispose(),(D=A.alphaMap)===null||D===void 0||D.dispose(),(s=A.aoMap)===null||s===void 0||s.dispose(),(pe=A.displacementMap)===null||pe===void 0||pe.dispose(),(te=A.emissiveMap)===null||te===void 0||te.dispose(),(X=A.gradientMap)===null||X===void 0||X.dispose(),(U=A.metalnessMap)===null||U===void 0||U.dispose(),(H=A.roughnessMap)===null||H===void 0||H.dispose(),A.dispose()})}}},175:function(O,E,x){x.d(E,{wf:function(){return A.Z}});var T=x(666),S=x.n(T),j=null,A=x(182),z=x(949);function Z(U){if(U.material){var H=Array.isArray(U.material)?U.material:[U.material];H.forEach(function(L){var $,K;($=L.color)===null||$===void 0||$.convertSRGBToLinear(),(K=L.emissive)===null||K===void 0||K.convertSRGBToLinear(),L.map&&(L.map.encoding=THREE.sRGBEncoding),L.emissiveMap&&(L.emissiveMap.encoding=THREE.sRGBEncoding)})}}var V=x(568),B=x(924),J=U=>{var H={};return x.d(H,U),H},Q=U=>()=>U,D=J({get:()=>Qe.get,set:()=>Qe.set}),s=x(620),pe=null,te=null,X=function(){var U=(0,V.Z)(S().mark(function H(L,$){var K,ne,q,I,se,ye;return S().wrap(function(ie){for(;;)switch(ie.prev=ie.next){case 0:return K=$.version,ie.next=4,(0,D.get)(L);case 4:if(q=ie.sent,!(q&&q[K])){ie.next=9;break}ne=q[K],ie.next=15;break;case 9:return ie.next=11,(0,s.Z)(fetch(L).then(function(me){if(me.ok)return me.blob();throw new Error}));case 11:I=ie.sent,se=I.res,ye=I.err,ye||(ne=se,(0,D.set)(L,(0,B.Z)({},K,se)));case 15:return ie.abrupt("return",ne?{url:URL.createObjectURL(ne)}:{url:L});case 16:case"end":return ie.stop()}},H)}));return function(L,$){return U.apply(this,arguments)}}()},620:function(O,E,x){x.d(E,{Z:function(){return S}});var T=x(42);function S(j){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return j.then(function(z){return(0,T.Z)({err:null,res:z},A)}).catch(function(z){return(0,T.Z)({err:z,res:void 0},A)})}},949:function(O,E,x){var T=j=>{var A={};return x.d(A,j),A},S=j=>()=>j;O.exports=T({Box3:()=>k.Box3,BufferAttribute:()=>k.BufferAttribute,BufferGeometry:()=>k.BufferGeometry,CanvasTexture:()=>k.CanvasTexture,Color:()=>k.Color,DoubleSide:()=>k.DoubleSide,ExtrudeBufferGeometry:()=>k.ExtrudeBufferGeometry,Float32BufferAttribute:()=>k.Float32BufferAttribute,Group:()=>k.Group,LineSegments:()=>k.LineSegments,Matrix4:()=>k.Matrix4,Mesh:()=>k.Mesh,MeshBasicMaterial:()=>k.MeshBasicMaterial,NormalBlending:()=>k.NormalBlending,PlaneBufferGeometry:()=>k.PlaneBufferGeometry,PlaneGeometry:()=>k.PlaneGeometry,Points:()=>k.Points,RGBAFormat:()=>k.RGBAFormat,Ray:()=>k.Ray,ShaderChunk:()=>k.ShaderChunk,ShaderMaterial:()=>k.ShaderMaterial,Shape:()=>k.Shape,Sphere:()=>k.Sphere,Sprite:()=>k.Sprite,SpriteMaterial:()=>k.SpriteMaterial,Texture:()=>k.Texture,TextureLoader:()=>k.TextureLoader,UniformsLib:()=>k.UniformsLib,Vector2:()=>k.Vector2,Vector3:()=>k.Vector3,VideoTexture:()=>k.VideoTexture})},568:function(O,E,x){x.d(E,{Z:function(){return S}});function T(j,A,z,Z,V,B,J){try{var Q=j[B](J),D=Q.value}catch(s){z(s);return}Q.done?A(D):Promise.resolve(D).then(Z,V)}function S(j){return function(){var A=this,z=arguments;return new Promise(function(Z,V){var B=j.apply(A,z);function J(D){T(B,Z,V,J,Q,"next",D)}function Q(D){T(B,Z,V,J,Q,"throw",D)}J(void 0)})}}},924:function(O,E,x){x.d(E,{Z:function(){return T}});function T(S,j,A){return j in S?Object.defineProperty(S,j,{value:A,enumerable:!0,configurable:!0,writable:!0}):S[j]=A,S}},42:function(O,E,x){x.d(E,{Z:function(){return S}});var T=x(924);function S(j){for(var A=1;A<arguments.length;A++){var z=arguments[A]!=null?arguments[A]:{},Z=Object.keys(z);typeof Object.getOwnPropertySymbols=="function"&&(Z=Z.concat(Object.getOwnPropertySymbols(z).filter(function(V){return Object.getOwnPropertyDescriptor(z,V).enumerable}))),Z.forEach(function(V){(0,T.Z)(j,V,z[V])})}return j}}},et={};function W(O){var E=et[O];if(E!==void 0)return E.exports;var x=et[O]={exports:{}};return Zt[O](x,x.exports,W),x.exports}(function(){W.n=function(O){var E=O&&O.__esModule?function(){return O.default}:function(){return O};return W.d(E,{a:E}),E}})(),function(){W.d=function(O,E){for(var x in E)W.o(E,x)&&!W.o(O,x)&&Object.defineProperty(O,x,{enumerable:!0,get:E[x]})}}(),function(){W.o=function(O,E){return Object.prototype.hasOwnProperty.call(O,E)}}();var ue={};(function(){W.d(ue,{Ei:function(){return Et},Yo:function(){return Rt},Ee:function(){return ee},x1:function(){return ut},VJ:function(){return ce},r7:function(){return Ve},XA:function(){return Ze},NB:function(){return tt},xv:function(){return M},nk:function(){return we}});function O(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function E(e,n){return E=Object.setPrototypeOf||function(i,a){return i.__proto__=a,i},E(e,n)}function x(e,n){return E(e,n)}function T(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&&x(e,n)}var S=W(42);function j(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 A(e,n){return n=n!=null?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}),e}function z(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function Z(e){return Z=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Z(e)}function V(e){return Z(e)}function B(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function J(e){return e&&e.constructor===Symbol?"symbol":typeof e}function Q(e,n){return n&&(J(n)==="object"||typeof n=="function")?n:B(e)}function D(e){var n=z();return function(){var i=V(e),a;if(n){var t=V(this).constructor;a=Reflect.construct(i,arguments,t)}else a=i.apply(this,arguments);return Q(this,a)}}var s=W(949);function pe(){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 pe()?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&&x(v,o.prototype),v},te.apply(null,arguments)}function X(e,n,r){return te.apply(null,arguments)}function U(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 H(e,n,r){return n&&U(e.prototype,n),r&&U(e,r),e}function L(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 $(e){if(Array.isArray(e))return L(e)}function K(e){if(typeof Symbol!="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function ne(){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 q(e,n){if(!!e){if(typeof e=="string")return L(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 L(e,n)}}function I(e){return $(e)||K(e)||q(e)||ne()}var se=W(620);function ye(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r={};return r.promise=new Promise(function(i,a){r.resolve=i,r.reject=a}),e&&(r.promise=(0,se.Z)(r.promise,n)),r}var Oe=e=>{var n={};return W.d(n,e),n},ie=e=>()=>e,me=Oe({CSS2DObject:()=>Vt.CSS2DObject}),Ce=e=>{var n={};return W.d(n,e),n},Te=e=>()=>e,Le=Ce({CSS3DObject:()=>qe.CSS3DObject,CSS3DSprite:()=>qe.CSS3DSprite}),f=W(175),u=function(e){e&&((0,f.wf)(e),e.children.forEach(function(n){n.userData.BaseObject_||u(n)}))},p=function(){"use strict";function e(){O(this,e),this.objecttype__="BaseObject",this.userData={},this.pm=ye(),this.visible=!1}var n=e.prototype;return n.init=function(){},n.create=function(){},n.render=function(){},n.update=function(i,a){},n.resize=function(i,a){},n.show=function(){return this.object3d&&(this.object3d.visible=!0),this.visible=!0,this},n.hide=function(){return this.object3d&&(this.object3d.visible=!1),this.visible=!1,this},n.isVisible=function(){return this.visible},n.createMesh=function(){for(var i=arguments.length,a=new Array(i),t=0;t<i;t++)a[t]=arguments[t];return this.object3d=X(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=X(s.Points,I(a)),this},n.createCSS2DObject=function(i){return this.object3d=new me.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)},H(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}(),M=function(e){"use strict";T(r,e);var n=D(r);function r(a){O(this,r);var t;return t=n.call(this),t.width=0,t.canvas=document.createElement("canvas"),t.options=(0,S.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,m=t.sizeAttenuation;if(h){var d=new s.Sprite(new s.SpriteMaterial({transparent:!0,sizeAttenuation:m}));this.object3d=d}else{var g=new s.MeshBasicMaterial({side:s.DoubleSide,transparent:!0}),b=new s.PlaneGeometry(1,1,1,1);this.createMesh(b,g)}this.object3d.position.copy(o),c&&this.object3d.lookAt(c),this.setText(v)},i.setText=function(t,o){var c=(0,S.Z)(A((0,S.Z)({},this.options),{text:t}),o||{}),h=c.text,v=c.fontSize,m=c.fontFamily,d=c.fontWeight,g=c.flipX,b=c.scale,_=this.canvas;_.width=v*h.length*2,_.height=v;var w=_.getContext("2d");w.font="".concat(d," ").concat(v,"px/1 ").concat(m);var l=w.measureText(h).width;_.width=l,this.width=l,w=_.getContext("2d"),w.clearRect(0,0,_.width,_.height),g&&w.scale(-1,1),w.font="".concat(d," ").concat(v,"px/1 ").concat(m),w.textBaseline="middle",w.fillStyle="#ffffff",w.fillText(h,g?l*-1:0,_.height/2),w.restore();var P=new s.Texture(_);P.anisotropy=16,P.needsUpdate=!0;var C=this.object3d;C.material.map&&C.material.map.dispose(),C.material.map=P,C.material.needsUpdate=!0,C.scale.set(P.image.width*b,P.image.height*b,1)},r}(p),y=W(568),N=W(666),G=W.n(N),ee=function(e){"use strict";T(r,e);var n=D(r);function r(a){O(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,y.Z)(G().mark(function o(){var c,h,v,m,d,g,b,_,w,l;return G().wrap(function(C){for(;;)switch(C.prev=C.next){case 0:return c=t.options,h=c.transparent,v=c.blending,m=c.src,d=c.depthWrite,g=c.alphaTest,b=c.sprite,_=c.sizeAttenuation,C.next=3,new s.TextureLoader().loadAsync(m);case 3:return w=C.sent,l=b?new s.SpriteMaterial({map:w,transparent:h!=null?h:!1,blending:v!=null?v:s.NormalBlending,depthWrite:d!=null?d:!0,alphaTest:g!=null?g:0,sizeAttenuation:_!=null?_:!0}):new s.MeshBasicMaterial({map:w,transparent:h!=null?h:!1,blending:v!=null?v:s.NormalBlending,depthWrite:d!=null?d:!0,alphaTest:g!=null?g:0}),C.abrupt("return",l);case 6:case"end":return C.stop()}},o)}))()},i.create=function(){var t=this;return(0,y.Z)(G().mark(function o(){var c,h,v,m,d,g,b,_;return G().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if(c=t.options,h=c.scale,v=c.position,m=c.src,d=c.cache,g=c.sprite,!(d&&!d.get(m))){l.next=7;break}return d.init(m),l.next=5,t.getMaterial();case 5:b=l.sent,d.set(m,b);case 7:if(!d){l.next=13;break}return l.next=10,d.get(m);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:_=l.t0,t.texture=_.map,g?t.createSprite(_):t.createMesh(new s.PlaneBufferGeometry(1,1),_),h&&t.object3d.scale.set(_.map.image.width*h,_.map.image.height*h,1),v&&t.object3d.position.copy(v);case 21:case"end":return l.stop()}},o)}))()},r}(p);function re(e,n){for(;!Object.prototype.hasOwnProperty.call(e,n)&&(e=V(e),e!==null););return e}function Y(e,n,r){return typeof Reflect!="undefined"&&Reflect.get?Y=Reflect.get:Y=function(a,t,o){var c=re(a,t);if(!!c){var h=Object.getOwnPropertyDescriptor(c,t);return h.get?h.get.call(o||a):h.value}},Y(e,n,r)}function be(e,n,r){return Y(e,n,r)}var we=function(e){"use strict";T(r,e);var n=D(r);function r(a){O(this,r);var t;return t=n.call(this),t.options=(0,S.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,m=t.format,d=t.autoPlay,g=t.loop,b=t.alphaTest,_=t.sprite,w=ye(),l=document.createElement("video");return l.addEventListener("loadedmetadata",function(){var P=new s.VideoTexture(l);P.format=m!=null?m:s.RGBAFormat,P.needsUpdate=!0;var C=_?new s.SpriteMaterial({map:P,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:P,transparent:c!=null?c:!1,blending:h!=null?h:s.NormalBlending,depthWrite:v!=null?v:!0,alphaTest:b!=null?b:0});w.resolve(C)},!1),l.src=o,l.muted=!0,l.autoplay=d,l.loop=g,l.preload="auto",w.promise},i.create=function(){var t=this;return(0,y.Z)(G().mark(function o(){var c,h,v,m,d,g,b,_;return G().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if(c=t.options,h=c.scale,v=c.position,m=c.src,d=c.cache,g=c.sprite,!(d&&!d.get(m))){l.next=7;break}return d.init(m),l.next=5,t.getMaterial();case 5:b=l.sent,d.set(m,b);case 7:if(!d){l.next=13;break}return l.next=10,d.get(m);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:_=l.t0,t.video=_.map.image,g?t.createSprite(_):t.createMesh(new s.PlaneBufferGeometry(1,1),_),h&&t.object3d.scale.set(t.video.videoWidth*h,t.video.videoHeight*h,1),v&&t.object3d.position.copy(v);case 21:case"end":return l.stop()}},o)}))()},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(V(r.prototype),"dispose",this).call(this)},r}(p),ve=function(e){"use strict";T(r,e);var n=D(r);function r(a){O(this,r);var t;return t=n.call(this),t.options=(0,S.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,m=document.createElement("div");m.appendChild(c),this.createCSS2DObject(m),o&&this.object3d.position.copy(o),h&&m.addEventListener("click",h),v&&(this.object3d.userData.zIndexFix=v)},i.getMaterial=function(t){return(0,y.Z)(G().mark(function o(){var c,h,v,m;return G().wrap(function(g){for(;;)switch(g.prev=g.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),m=new s.SpriteMaterial({map:v,opacity:t?1:0,transparent:!0,alphaTest:.1,sizeAttenuation:!1}),g.abrupt("return",m);case 9:case"end":return g.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,m=t.position,d=m===void 0?new s.Vector3(0,0,0):m,g=t.cache,b=this;return(0,y.Z)(G().mark(function _(){var w,l,P,C;return G().wrap(function(R){for(;;)switch(R.prev=R.next){case 0:if(w="node-create-pick-object",!(g&&!g.get(w))){R.next=7;break}return g.init(w),R.next=5,b.getMaterial(c);case 5:l=R.sent,g.set(w,l);case 7:if(!g){R.next=13;break}return R.next=10,g.get(w);case 10:R.t0=R.sent,R.next=16;break;case 13:return R.next=15,b.getMaterial(c);case 15:R.t0=R.sent;case 16:P=R.t0,C=new s.Sprite(P),C.scale.set(P.map.image.width*v.x,P.map.image.height*v.y,1),C.position.copy(d),b.add(C),b.pickObject=C;case 22:case"end":return R.stop()}},_)}))()},i.dispose=function(){var t=this.options.onClick;if(t){var o;(o=this.object3d.element)===null||o===void 0||o.removeEventListener("click",t)}be(V(r.prototype),"dispose",this).call(this)},r}(p),tt=ve,rt=`
1
+ import*as Je from"idb-keyval";import*as k from"three";import*as Vt from"three/examples/jsm/renderers/CSS2DRenderer";import*as Qe from"three/examples/jsm/renderers/CSS3DRenderer";import*as Wt from"popmotion";import*as Ie from"d3-array";import*as Gt from"earcut";import*as zt from"@turf/boolean-clockwise";import*as Ut from"delaunator";import*as Nt from"@turf/boolean-point-in-polygon";import*as Be from"d3-geo";import*as Ft from"d3-geo-voronoi";import*as It from"d3-scale";var Zt={666:function(O){var E=function(x){"use strict";var T=Object.prototype,A=T.hasOwnProperty,j,S=typeof Symbol=="function"?Symbol:{},z=S.iterator||"@@iterator",Z=S.asyncIterator||"@@asyncIterator",V=S.toStringTag||"@@toStringTag";function B(f,u,p){return Object.defineProperty(f,u,{value:p,enumerable:!0,configurable:!0,writable:!0}),f[u]}try{B({},"")}catch(f){B=function(u,p,M){return u[p]=M}}function J(f,u,p,M){var y=u&&u.prototype instanceof U?u:U,N=Object.create(y.prototype),G=new Ce(M||[]);return N._invoke=ye(f,p,G),N}x.wrap=J;function Q(f,u,p){try{return{type:"normal",arg:f.call(u,p)}}catch(M){return{type:"throw",arg:M}}}var D="suspendedStart",s="suspendedYield",pe="executing",te="completed",X={};function U(){}function H(){}function L(){}var $={};B($,z,function(){return this});var K=Object.getPrototypeOf,ne=K&&K(K(Te([])));ne&&ne!==T&&A.call(ne,z)&&($=ne);var q=L.prototype=U.prototype=Object.create($);H.prototype=L,B(q,"constructor",L),B(L,"constructor",H),H.displayName=B(L,V,"GeneratorFunction");function I(f){["next","throw","return"].forEach(function(u){B(f,u,function(p){return this._invoke(u,p)})})}x.isGeneratorFunction=function(f){var u=typeof f=="function"&&f.constructor;return u?u===H||(u.displayName||u.name)==="GeneratorFunction":!1},x.mark=function(f){return Object.setPrototypeOf?Object.setPrototypeOf(f,L):(f.__proto__=L,B(f,V,"GeneratorFunction")),f.prototype=Object.create(q),f},x.awrap=function(f){return{__await:f}};function se(f,u){function p(N,G,ee,re){var Y=Q(f[N],f,G);if(Y.type==="throw")re(Y.arg);else{var be=Y.arg,we=be.value;return we&&typeof we=="object"&&A.call(we,"__await")?u.resolve(we.__await).then(function(ve){p("next",ve,ee,re)},function(ve){p("throw",ve,ee,re)}):u.resolve(we).then(function(ve){be.value=ve,ee(be)},function(ve){return p("throw",ve,ee,re)})}}var M;function y(N,G){function ee(){return new u(function(re,Y){p(N,G,re,Y)})}return M=M?M.then(ee,ee):ee()}this._invoke=y}I(se.prototype),B(se.prototype,Z,function(){return this}),x.AsyncIterator=se,x.async=function(f,u,p,M,y){y===void 0&&(y=Promise);var N=new se(J(f,u,p,M),y);return x.isGeneratorFunction(u)?N:N.next().then(function(G){return G.done?G.value:N.next()})};function ye(f,u,p){var M=D;return function(N,G){if(M===pe)throw new Error("Generator is already running");if(M===te){if(N==="throw")throw G;return Le()}for(p.method=N,p.arg=G;;){var ee=p.delegate;if(ee){var re=Oe(ee,p);if(re){if(re===X)continue;return re}}if(p.method==="next")p.sent=p._sent=p.arg;else if(p.method==="throw"){if(M===D)throw M=te,p.arg;p.dispatchException(p.arg)}else p.method==="return"&&p.abrupt("return",p.arg);M=pe;var Y=Q(f,u,p);if(Y.type==="normal"){if(M=p.done?te:s,Y.arg===X)continue;return{value:Y.arg,done:p.done}}else Y.type==="throw"&&(M=te,p.method="throw",p.arg=Y.arg)}}}function Oe(f,u){var p=f.iterator[u.method];if(p===j){if(u.delegate=null,u.method==="throw"){if(f.iterator.return&&(u.method="return",u.arg=j,Oe(f,u),u.method==="throw"))return X;u.method="throw",u.arg=new TypeError("The iterator does not provide a 'throw' method")}return X}var M=Q(p,f.iterator,u.arg);if(M.type==="throw")return u.method="throw",u.arg=M.arg,u.delegate=null,X;var y=M.arg;if(!y)return u.method="throw",u.arg=new TypeError("iterator result is not an object"),u.delegate=null,X;if(y.done)u[f.resultName]=y.value,u.next=f.nextLoc,u.method!=="return"&&(u.method="next",u.arg=j);else return y;return u.delegate=null,X}I(q),B(q,V,"Generator"),B(q,z,function(){return this}),B(q,"toString",function(){return"[object Generator]"});function ie(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 me(f){var u=f.completion||{};u.type="normal",delete u.arg,f.completion=u}function Ce(f){this.tryEntries=[{tryLoc:"root"}],f.forEach(ie,this),this.reset(!0)}x.keys=function(f){var u=[];for(var p in f)u.push(p);return u.reverse(),function M(){for(;u.length;){var y=u.pop();if(y in f)return M.value=y,M.done=!1,M}return M.done=!0,M}};function Te(f){if(f){var u=f[z];if(u)return u.call(f);if(typeof f.next=="function")return f;if(!isNaN(f.length)){var p=-1,M=function y(){for(;++p<f.length;)if(A.call(f,p))return y.value=f[p],y.done=!1,y;return y.value=j,y.done=!0,y};return M.next=M}}return{next:Le}}x.values=Te;function Le(){return{value:j,done:!0}}return Ce.prototype={constructor:Ce,reset:function(f){if(this.prev=0,this.next=0,this.sent=this._sent=j,this.done=!1,this.delegate=null,this.method="next",this.arg=j,this.tryEntries.forEach(me),!f)for(var u in this)u.charAt(0)==="t"&&A.call(this,u)&&!isNaN(+u.slice(1))&&(this[u]=j)},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(re,Y){return N.type="throw",N.arg=f,u.next=re,Y&&(u.method="next",u.arg=j),!!Y}for(var M=this.tryEntries.length-1;M>=0;--M){var y=this.tryEntries[M],N=y.completion;if(y.tryLoc==="root")return p("end");if(y.tryLoc<=this.prev){var G=A.call(y,"catchLoc"),ee=A.call(y,"finallyLoc");if(G&&ee){if(this.prev<y.catchLoc)return p(y.catchLoc,!0);if(this.prev<y.finallyLoc)return p(y.finallyLoc)}else if(G){if(this.prev<y.catchLoc)return p(y.catchLoc,!0)}else if(ee){if(this.prev<y.finallyLoc)return p(y.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 M=this.tryEntries[p];if(M.tryLoc<=this.prev&&A.call(M,"finallyLoc")&&this.prev<M.finallyLoc){var y=M;break}}y&&(f==="break"||f==="continue")&&y.tryLoc<=u&&u<=y.finallyLoc&&(y=null);var N=y?y.completion:{};return N.type=f,N.arg=u,y?(this.method="next",this.next=y.finallyLoc,X):this.complete(N)},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),X},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),me(p),X}},catch:function(f){for(var u=this.tryEntries.length-1;u>=0;--u){var p=this.tryEntries[u];if(p.tryLoc===f){var M=p.completion;if(M.type==="throw"){var y=M.arg;me(p)}return y}}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=j),X}},x}(O.exports);try{regeneratorRuntime=E}catch(x){typeof globalThis=="object"?globalThis.regeneratorRuntime=E:Function("r","regeneratorRuntime = r")(E)}},182:function(O,E,x){x.d(E,{Z:function(){return T}});function T(A){if(A.geometry&&A.geometry.dispose(),A.material){var j=Array.isArray(A.material)?A.material:[A.material];j.forEach(function(S){var z,Z,V,B,J,Q,D,s,pe,te,X,U,H;(z=S.map)===null||z===void 0||z.dispose(),(Z=S.lightMap)===null||Z===void 0||Z.dispose(),(V=S.bumpMap)===null||V===void 0||V.dispose(),(B=S.normalMap)===null||B===void 0||B.dispose(),(J=S.specularMap)===null||J===void 0||J.dispose(),(Q=S.envMap)===null||Q===void 0||Q.dispose(),(D=S.alphaMap)===null||D===void 0||D.dispose(),(s=S.aoMap)===null||s===void 0||s.dispose(),(pe=S.displacementMap)===null||pe===void 0||pe.dispose(),(te=S.emissiveMap)===null||te===void 0||te.dispose(),(X=S.gradientMap)===null||X===void 0||X.dispose(),(U=S.metalnessMap)===null||U===void 0||U.dispose(),(H=S.roughnessMap)===null||H===void 0||H.dispose(),S.dispose()})}}},175:function(O,E,x){x.d(E,{wf:function(){return S.Z}});var T=x(666),A=x.n(T),j=null,S=x(182),z=x(949);function Z(U){if(U.material){var H=Array.isArray(U.material)?U.material:[U.material];H.forEach(function(L){var $,K;($=L.color)===null||$===void 0||$.convertSRGBToLinear(),(K=L.emissive)===null||K===void 0||K.convertSRGBToLinear(),L.map&&(L.map.encoding=THREE.sRGBEncoding),L.emissiveMap&&(L.emissiveMap.encoding=THREE.sRGBEncoding)})}}var V=x(568),B=x(924),J=U=>{var H={};return x.d(H,U),H},Q=U=>()=>U,D=J({get:()=>Je.get,set:()=>Je.set}),s=x(620),pe=null,te=null,X=function(){var U=(0,V.Z)(A().mark(function H(L,$){var K,ne,q,I,se,ye;return A().wrap(function(ie){for(;;)switch(ie.prev=ie.next){case 0:return K=$.version,ie.next=4,(0,D.get)(L);case 4:if(q=ie.sent,!(q&&q[K])){ie.next=9;break}ne=q[K],ie.next=15;break;case 9:return ie.next=11,(0,s.Z)(fetch(L).then(function(me){if(me.ok)return me.blob();throw new Error}));case 11:I=ie.sent,se=I.res,ye=I.err,ye||(ne=se,(0,D.set)(L,(0,B.Z)({},K,se)));case 15:return ie.abrupt("return",ne?{url:URL.createObjectURL(ne)}:{url:L});case 16:case"end":return ie.stop()}},H)}));return function(L,$){return U.apply(this,arguments)}}()},620:function(O,E,x){x.d(E,{Z:function(){return A}});var T=x(42);function A(j){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return j.then(function(z){return(0,T.Z)({err:null,res:z},S)}).catch(function(z){return(0,T.Z)({err:z,res:void 0},S)})}},949:function(O,E,x){var T=j=>{var S={};return x.d(S,j),S},A=j=>()=>j;O.exports=T({Box3:()=>k.Box3,BufferAttribute:()=>k.BufferAttribute,BufferGeometry:()=>k.BufferGeometry,CanvasTexture:()=>k.CanvasTexture,Color:()=>k.Color,DoubleSide:()=>k.DoubleSide,ExtrudeBufferGeometry:()=>k.ExtrudeBufferGeometry,Float32BufferAttribute:()=>k.Float32BufferAttribute,Group:()=>k.Group,LineSegments:()=>k.LineSegments,Matrix4:()=>k.Matrix4,Mesh:()=>k.Mesh,MeshBasicMaterial:()=>k.MeshBasicMaterial,NormalBlending:()=>k.NormalBlending,PlaneBufferGeometry:()=>k.PlaneBufferGeometry,PlaneGeometry:()=>k.PlaneGeometry,Points:()=>k.Points,RGBAFormat:()=>k.RGBAFormat,Ray:()=>k.Ray,ShaderChunk:()=>k.ShaderChunk,ShaderMaterial:()=>k.ShaderMaterial,Shape:()=>k.Shape,Sphere:()=>k.Sphere,Sprite:()=>k.Sprite,SpriteMaterial:()=>k.SpriteMaterial,Texture:()=>k.Texture,TextureLoader:()=>k.TextureLoader,UniformsLib:()=>k.UniformsLib,Vector2:()=>k.Vector2,Vector3:()=>k.Vector3,VideoTexture:()=>k.VideoTexture})},568:function(O,E,x){x.d(E,{Z:function(){return A}});function T(j,S,z,Z,V,B,J){try{var Q=j[B](J),D=Q.value}catch(s){z(s);return}Q.done?S(D):Promise.resolve(D).then(Z,V)}function A(j){return function(){var S=this,z=arguments;return new Promise(function(Z,V){var B=j.apply(S,z);function J(D){T(B,Z,V,J,Q,"next",D)}function Q(D){T(B,Z,V,J,Q,"throw",D)}J(void 0)})}}},924:function(O,E,x){x.d(E,{Z:function(){return T}});function T(A,j,S){return j in A?Object.defineProperty(A,j,{value:S,enumerable:!0,configurable:!0,writable:!0}):A[j]=S,A}},42:function(O,E,x){x.d(E,{Z:function(){return A}});var T=x(924);function A(j){for(var S=1;S<arguments.length;S++){var z=arguments[S]!=null?arguments[S]:{},Z=Object.keys(z);typeof Object.getOwnPropertySymbols=="function"&&(Z=Z.concat(Object.getOwnPropertySymbols(z).filter(function(V){return Object.getOwnPropertyDescriptor(z,V).enumerable}))),Z.forEach(function(V){(0,T.Z)(j,V,z[V])})}return j}}},qe={};function W(O){var E=qe[O];if(E!==void 0)return E.exports;var x=qe[O]={exports:{}};return Zt[O](x,x.exports,W),x.exports}(function(){W.n=function(O){var E=O&&O.__esModule?function(){return O.default}:function(){return O};return W.d(E,{a:E}),E}})(),function(){W.d=function(O,E){for(var x in E)W.o(E,x)&&!W.o(O,x)&&Object.defineProperty(O,x,{enumerable:!0,get:E[x]})}}(),function(){W.o=function(O,E){return Object.prototype.hasOwnProperty.call(O,E)}}();var ue={};(function(){W.d(ue,{Ei:function(){return Et},Yo:function(){return Rt},Ee:function(){return ee},x1:function(){return ut},VJ:function(){return ce},r7:function(){return Ve},XA:function(){return Ze},NB:function(){return et},xv:function(){return M},nk:function(){return we}});function O(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function E(e,n){return E=Object.setPrototypeOf||function(i,a){return i.__proto__=a,i},E(e,n)}function x(e,n){return E(e,n)}function T(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&&x(e,n)}var A=W(42);function j(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 S(e,n){return n=n!=null?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}),e}function z(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function Z(e){return Z=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Z(e)}function V(e){return Z(e)}function B(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function J(e){return e&&e.constructor===Symbol?"symbol":typeof e}function Q(e,n){return n&&(J(n)==="object"||typeof n=="function")?n:B(e)}function D(e){var n=z();return function(){var i=V(e),a;if(n){var t=V(this).constructor;a=Reflect.construct(i,arguments,t)}else a=i.apply(this,arguments);return Q(this,a)}}var s=W(949);function pe(){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 pe()?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&&x(v,o.prototype),v},te.apply(null,arguments)}function X(e,n,r){return te.apply(null,arguments)}function U(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 H(e,n,r){return n&&U(e.prototype,n),r&&U(e,r),e}function L(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 $(e){if(Array.isArray(e))return L(e)}function K(e){if(typeof Symbol!="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function ne(){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 q(e,n){if(!!e){if(typeof e=="string")return L(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 L(e,n)}}function I(e){return $(e)||K(e)||q(e)||ne()}var se=W(620);function ye(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r={};return r.promise=new Promise(function(i,a){r.resolve=i,r.reject=a}),e&&(r.promise=(0,se.Z)(r.promise,n)),r}var Oe=e=>{var n={};return W.d(n,e),n},ie=e=>()=>e,me=Oe({CSS2DObject:()=>Vt.CSS2DObject}),Ce=e=>{var n={};return W.d(n,e),n},Te=e=>()=>e,Le=Ce({CSS3DObject:()=>Qe.CSS3DObject,CSS3DSprite:()=>Qe.CSS3DSprite}),f=W(175),u=function(e){e&&((0,f.wf)(e),e.children.forEach(function(n){n.userData.BaseObject_||u(n)}))},p=function(){"use strict";function e(){O(this,e),this.objecttype__="BaseObject",this.userData={},this.pm=ye(),this.visible=!1}var n=e.prototype;return n.init=function(){},n.create=function(){},n.render=function(){},n.update=function(i,a){},n.resize=function(i,a){},n.show=function(){return this.object3d&&(this.object3d.visible=!0),this.visible=!0,this},n.hide=function(){return this.object3d&&(this.object3d.visible=!1),this.visible=!1,this},n.isVisible=function(){return this.visible},n.createMesh=function(){for(var i=arguments.length,a=new Array(i),t=0;t<i;t++)a[t]=arguments[t];return this.object3d=X(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=X(s.Points,I(a)),this},n.createCSS2DObject=function(i){return this.object3d=new me.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)},H(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}(),M=function(e){"use strict";T(r,e);var n=D(r);function r(a){O(this,r);var t;return t=n.call(this),t.width=0,t.canvas=document.createElement("canvas"),t.options=(0,A.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,m=t.sizeAttenuation;if(h){var d=new s.Sprite(new s.SpriteMaterial({transparent:!0,sizeAttenuation:m}));this.object3d=d}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,A.Z)(S((0,A.Z)({},this.options),{text:t}),o||{}),h=c.text,v=c.fontSize,m=c.fontFamily,d=c.fontWeight,_=c.flipX,b=c.scale,g=this.canvas;g.width=v*h.length*2,g.height=v;var w=g.getContext("2d");w.font="".concat(d," ").concat(v,"px/1 ").concat(m);var l=w.measureText(h).width;g.width=l,this.width=l,w=g.getContext("2d"),w.clearRect(0,0,g.width,g.height),_&&w.scale(-1,1),w.font="".concat(d," ").concat(v,"px/1 ").concat(m),w.textBaseline="middle",w.fillStyle="#ffffff",w.fillText(h,_?l*-1:0,g.height/2),w.restore();var P=new s.Texture(g);P.anisotropy=16,P.needsUpdate=!0;var C=this.object3d;C.material.map&&C.material.map.dispose(),C.material.map=P,C.material.needsUpdate=!0,C.scale.set(P.image.width*b,P.image.height*b,1)},r}(p),y=W(568),N=W(666),G=W.n(N),ee=function(e){"use strict";T(r,e);var n=D(r);function r(a){O(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,y.Z)(G().mark(function o(){var c,h,v,m,d,_,b,g,w,l;return G().wrap(function(C){for(;;)switch(C.prev=C.next){case 0:return c=t.options,h=c.transparent,v=c.blending,m=c.src,d=c.depthWrite,_=c.alphaTest,b=c.sprite,g=c.sizeAttenuation,C.next=3,new s.TextureLoader().loadAsync(m);case 3:return w=C.sent,l=b?new s.SpriteMaterial({map:w,transparent:h!=null?h:!1,blending:v!=null?v:s.NormalBlending,depthWrite:d!=null?d:!0,alphaTest:_!=null?_:0,sizeAttenuation:g!=null?g:!0}):new s.MeshBasicMaterial({map:w,transparent:h!=null?h:!1,blending:v!=null?v:s.NormalBlending,depthWrite:d!=null?d:!0,alphaTest:_!=null?_:0}),C.abrupt("return",l);case 6:case"end":return C.stop()}},o)}))()},i.create=function(){var t=this;return(0,y.Z)(G().mark(function o(){var c,h,v,m,d,_,b,g;return G().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if(c=t.options,h=c.scale,v=c.position,m=c.src,d=c.cache,_=c.sprite,!(d&&!d.get(m))){l.next=7;break}return d.init(m),l.next=5,t.getMaterial();case 5:b=l.sent,d.set(m,b);case 7:if(!d){l.next=13;break}return l.next=10,d.get(m);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:g=l.t0,t.texture=g.map,_?t.createSprite(g):t.createMesh(new s.PlaneBufferGeometry(1,1),g),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 re(e,n){for(;!Object.prototype.hasOwnProperty.call(e,n)&&(e=V(e),e!==null););return e}function Y(e,n,r){return typeof Reflect!="undefined"&&Reflect.get?Y=Reflect.get:Y=function(a,t,o){var c=re(a,t);if(!!c){var h=Object.getOwnPropertyDescriptor(c,t);return h.get?h.get.call(o||a):h.value}},Y(e,n,r)}function be(e,n,r){return Y(e,n,r)}var we=function(e){"use strict";T(r,e);var n=D(r);function r(a){O(this,r);var t;return t=n.call(this),t.options=(0,A.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,m=t.format,d=t.autoPlay,_=t.loop,b=t.alphaTest,g=t.sprite,w=ye(),l=document.createElement("video");return l.addEventListener("loadedmetadata",function(){var P=new s.VideoTexture(l);P.format=m!=null?m:s.RGBAFormat,P.needsUpdate=!0;var C=g?new s.SpriteMaterial({map:P,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:P,transparent:c!=null?c:!1,blending:h!=null?h:s.NormalBlending,depthWrite:v!=null?v:!0,alphaTest:b!=null?b:0});w.resolve(C)},!1),l.src=o,l.muted=!0,l.autoplay=d,l.loop=_,l.preload="auto",w.promise},i.create=function(){var t=this;return(0,y.Z)(G().mark(function o(){var c,h,v,m,d,_,b,g;return G().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if(c=t.options,h=c.scale,v=c.position,m=c.src,d=c.cache,_=c.sprite,!(d&&!d.get(m))){l.next=7;break}return d.init(m),l.next=5,t.getMaterial();case 5:b=l.sent,d.set(m,b);case 7:if(!d){l.next=13;break}return l.next=10,d.get(m);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:g=l.t0,t.video=g.map.image,_?t.createSprite(g):t.createMesh(new s.PlaneBufferGeometry(1,1),g),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(V(r.prototype),"dispose",this).call(this)},r}(p),ve=function(e){"use strict";T(r,e);var n=D(r);function r(a){O(this,r);var t;return t=n.call(this),t.options=(0,A.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,m=document.createElement("div");m.appendChild(c),this.createCSS2DObject(m),o&&this.object3d.position.copy(o),h&&m.addEventListener("click",h),v&&(this.object3d.userData.zIndexFix=v)},i.getMaterial=function(t){return(0,y.Z)(G().mark(function o(){var c,h,v,m;return G().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),m=new s.SpriteMaterial({map:v,opacity:t?1:0,transparent:!0,alphaTest:.1,sizeAttenuation:!1}),_.abrupt("return",m);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,m=t.position,d=m===void 0?new s.Vector3(0,0,0):m,_=t.cache,b=this;return(0,y.Z)(G().mark(function g(){var w,l,P,C;return G().wrap(function(R){for(;;)switch(R.prev=R.next){case 0:if(w="node-create-pick-object",!(_&&!_.get(w))){R.next=7;break}return _.init(w),R.next=5,b.getMaterial(c);case 5:l=R.sent,_.set(w,l);case 7:if(!_){R.next=13;break}return R.next=10,_.get(w);case 10:R.t0=R.sent,R.next=16;break;case 13:return R.next=15,b.getMaterial(c);case 15:R.t0=R.sent;case 16:P=R.t0,C=new s.Sprite(P),C.scale.set(P.map.image.width*v.x,P.map.image.height*v.y,1),C.position.copy(d),b.add(C),b.pickObject=C;case 22:case"end":return R.stop()}},g)}))()},i.dispose=function(){var t=this.options.onClick;if(t){var o;(o=this.object3d.element)===null||o===void 0||o.removeEventListener("click",t)}be(V(r.prototype),"dispose",this).call(this)},r}(p),et=ve,tt=`
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 Qe from"idb-keyval";import*as k from"three";import*as Vt from"three/ex
95
95
  vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
96
96
  `).concat(s.ShaderChunk.fog_vertex,`
97
97
  }
98
- `),nt=`
98
+ `),rt=`
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
- `),ce=function(e){"use strict";T(r,e);var n=D(r);function r(){O(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(B(i),{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(t){this.setGeometry(t,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(t){this.setPoints(t,this.widthCallback)}}}),i}return r}(s.BufferGeometry);ce.prototype.setMatrixWorld=function(e){this.matrixWorld=e},ce.prototype.setGeometry=function(e,n){this._geometry=e,this.setPoints(e.getAttribute("position").array,n)},ce.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 Ze(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,m=this instanceof s.LineSegments?2:1,d=o.index,g=o.attributes;if(d!==null)for(var b=d.array,_=g.position.array,w=g.width.array,l=0,P=b.length-1;l<P;l+=m){var C=b[l],F=b[l+1];c.fromArray(_,C*3),h.fromArray(_,F*3);var R=w[Math.floor(l/3)]!==void 0?w[Math.floor(l/3)]:1,fe=e.params.Line.threshold+this.material.lineWidth*R/2,Se=fe*fe,xe=i.distanceSqToSegment(c,h,t,v);if(!(xe>Se)){t.applyMatrix4(this.matrixWorld);var _e=e.ray.origin.distanceTo(t);_e<e.near||_e>e.far||(n.push({distance:_e,point:v.clone().applyMatrix4(this.matrixWorld),index:l,face:null,faceIndex:null,object:this}),l=P)}}}}ce.prototype.raycast=Ze,ce.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]},ce.prototype.copyV3=function(e){var n=e*6;return[this.positions[n],this.positions[n+1],this.positions[n+2]]},ce.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 De(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}ce.prototype.advance=function(e){var n=this._attributes.position.array,r=this._attributes.previous.array,i=this._attributes.next.array,a=n.length;De(n,0,r,0,a),De(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,De(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=rt,s.ShaderChunk.meshline_frag=nt;var Ve=function(e){"use strict";T(r,e);var n=D(r);function r(i){O(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(B(a),{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(o){this.uniforms.lineWidth.value=o}},lineLightAnimation:{enumerable:!0,get:function(){return this.uniforms.lineLightAnimation.value},set:function(o){this.uniforms.lineLightAnimation.value=o}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(o){this.uniforms.map.value=o}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(o){this.uniforms.useMap.value=o}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(o){this.uniforms.alphaMap.value=o}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(o){this.uniforms.useAlphaMap.value=o}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(o){this.uniforms.color.value=o}},lightColor:{enumerable:!0,get:function(){return this.uniforms.lightColor.value},set:function(o){this.uniforms.lightColor.value=o}},time:{enumerable:!0,get:function(){return this.uniforms.time.value},set:function(o){this.uniforms.time.value=o}},uCenter:{enumerable:!0,get:function(){return this.uniforms.uCenter.value},set:function(o){this.uniforms.uCenter.value=o}},size:{enumerable:!0,get:function(){return this.uniforms.size.value},set:function(o){this.uniforms.size.value=o}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(o){this.uniforms.opacity.value=o}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(o){this.uniforms.resolution.value.copy(o)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(o){this.uniforms.sizeAttenuation.value=o}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(o){this.uniforms.dashArray.value=o,this.useDash=o!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(o){this.uniforms.dashOffset.value=o}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(o){this.uniforms.dashRatio.value=o}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(o){this.uniforms.useDash.value=o}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(o){this.uniforms.visibility.value=o}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(o){this.uniforms.alphaTest.value=o}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(o){this.uniforms.repeat.value.copy(o)}}}),a.setValues(i),a}return r}(s.ShaderMaterial);Ve.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 it(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 at(e,n){if(e==null)return{};var r=it(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 ot=e=>{var n={};return W.d(n,e),n},rr=e=>()=>e,Xe=ot({default:()=>Wt.default}),st={nodes:[],color:new s.Color("red"),lineWidth:3,sizeAttenuation:0},ut=function(e){"use strict";T(r,e);var n=D(r);function r(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};O(this,r);var t;return t=n.call(this),t.geometry=new s.BufferGeometry,t.meshline=new ce,t.options=(0,S.Z)({},st,a),t}var i=r.prototype;return i.create=function(){var t=this.options,o=t.nodes,c=t.duration,h=t.delay,v=t.onComplete,m=t.setPointWidth,d=at(t,["nodes","duration","delay","onComplete","setPointWidth"]),g=this.pencil.getSize(),b=g.width,_=g.height;delete d.key,this.geometry.setFromPoints(o),this.meshline.setGeometry(this.geometry,m);var w=new Ve(A((0,S.Z)({},d),{resolution:new s.Vector2(b,_)}));this.material=w,this.createMesh(this.meshline,w)},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,m=new Xe.default.Tween(v.value).to({x:0},o!=null?o:1e3).delay(c!=null?c:0).repeat(1/0);h&&m.onComplete(h),m.start(),this.tween=m},i.dispose=function(){be(V(r.prototype),"dispose",this).call(this),this.tween&&Xe.default.remove(this.tween)},r}(p);function ct(e){if(Array.isArray(e))return e}function lt(){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 le(e,n){return ct(e)||K(e,n)||q(e,n)||lt()}var ft=e=>{var n={};return W.d(n,e),n},nr=e=>()=>e,Ae=ft({extent:()=>Ie.extent,mean:()=>Ie.mean,merge:()=>Ie.merge}),ht=e=>{var n={};return W.d(n,e),n},ir=e=>()=>e,We=ht({default:()=>Gt.default}),pt=e=>{var n={};return W.d(n,e),n},ar=e=>()=>e,vt=pt({default:()=>zt.default});function dt(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 mt=e=>{var n={};return W.d(n,e),n},or=e=>()=>e,_t=mt({default:()=>Ut.default}),gt=e=>{var n={};return W.d(n,e),n},sr=e=>()=>e,yt=gt({default:()=>Nt.default}),bt=e=>{var n={};return W.d(n,e),n},ur=e=>()=>e,Ee=bt({geoBounds:()=>Be.geoBounds,geoContains:()=>Be.geoContains,geoDistance:()=>Be.geoDistance,geoInterpolate:()=>Be.geoInterpolate}),wt=e=>{var n={};return W.d(n,e),n},cr=e=>()=>e,xt=wt({geoVoronoi:()=>Ft.geoVoronoi}),Mt=e=>{var n={};return W.d(n,e),n},lr=e=>()=>e,He=Mt({scaleLinear:()=>It.scaleLinear});function At(e,n){return e.map(function(r){var i=[],a;return r.forEach(function(t){if(a){var o=(0,Ee.geoDistance)(t,a)*180/Math.PI;if(o>n)for(var c=(0,Ee.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 St(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},m=function(l){return o*(Math.cos((l+90)*Math.PI/180)+1)/2},d=[t!==void 0?Math.ceil(m(t)):0,a!==void 0?Math.floor(m(a)):o-1],g=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=[],_=d[0];_<=d[1];_++){var w=h(_);g(w)&&b.push([w,v(_)])}return b}function Ge(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return r?(0,Ee.geoContains)(n,e):(0,yt.default)(e,n)}function Pt(e,n){var r={type:"Polygon",coordinates:e},i=le((0,Ee.geoBounds)(r),2),a=le(i[0],2),t=a[0],o=a[1],c=le(i[1],2),h=c[0],v=c[1];if(Math.min(Math.abs(h-t),Math.abs(v-o))<n)return[];var m=t>h||v>=89||o<=-89;return St(n,{minLng:t,maxLng:h,minLat:o,maxLat:v}).filter(function(d){return Ge(d,r,m)})}function Ot(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.resolution,i=r===void 0?1/0:r,a=At(e,i),t=(0,Ae.merge)(a),o=Pt(e,i),c=I(t).concat(I(o)),h={type:"Polygon",coordinates:e},v=le((0,Ee.geoBounds)(h),2),m=le(v[0],2),d=m[0],g=m[1],b=le(v[1],2),_=b[0],w=b[1],l=d>_||w>=89||g<=-89,P=[];if(l){var C=(0,xt.geoVoronoi)(c).triangles(),F=new Map(c.map(function(ae,ge){var de=le(ae,2),oe=de[0],Re=de[1];return["".concat(oe,"-").concat(Re),ge]}));C.features.forEach(function(ae){var ge,de=ae.geometry.coordinates[0].slice(0,3).reverse(),oe=[];if(de.forEach(function(ke){var he=le(ke,2),Fe=he[0],Dt=he[1],Je="".concat(Fe,"-").concat(Dt);F.has(Je)&&oe.push(F.get(Je))}),oe.length===3){if(oe.some(function(ke){return ke<t.length})){var Re=ae.properties.circumcenter;if(!Ge(Re,h,l))return}(ge=P).push.apply(ge,I(oe))}})}else if(o.length)for(var _e=function(ae,ge){var de,oe=[2,1,0].map(function(he){return Me.triangles[ae+he]}),Re=oe.map(function(he){return c[he]});if(oe.some(function(he){return he<t.length})){var ke=[0,1].map(function(he){return(0,Ae.mean)(Re,function(Fe){return Fe[he]})});if(!Ge(ke,h,l))return"continue"}(de=P).push.apply(de,I(oe))},Me=_t.default.from(c),Pe=0,je=Me.triangles.length;Pe<je;Pe+=3)_e(Pe,je);else{var R=We.default.flatten(a),fe=R.vertices,Se=R.holes,xe=Se===void 0?[]:Se;P=(0,We.default)(fe,xe,2)}var Ne=(0,He.scaleLinear)((0,Ae.extent)(c,function(ae){return ae[0]}),[0,1]),kt=(0,He.scaleLinear)((0,Ae.extent)(c,function(ae){return ae[1]}),[0,1]),Tt=c.map(function(ae){var ge=le(ae,2),de=ge[0],oe=ge[1];return[Ne(de),kt(oe)]}),Bt={points:c,indices:P,uvs:Tt};return{contour:a,triangles:Bt}}var Ct=Ot,Ke=new s.BufferGeometry().setAttribute?"setAttribute":"addAttribute";function ze(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=e.map(function(a){return a.map(function(t){var o=le(t,2),c=o[0],h=o[1];return r?dt(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=ze(e,n,i),t=a.vertices,o=a.holes,c=ze(e,r,i),h=c.vertices,v=(0,Ae.merge)([h,t]),m=Math.round(h.length/3),d=new Set(o),g=0,b=[],_=0;_<m;_++){var w=_+1;if(w===m)w=g;else if(d.has(w)){var l=w;w=g,g=l}b.push(_,_+m,w+m),b.push(w+m,w,_)}for(var P=[],C=1;C>=0;C--)for(var F=0;F<m;F+=1)P.push(F/(m-1),C);return{indices:b,vertices:v,uvs:P,topVerts:h}}function $e(e,n,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return{indices:i?e.indices:e.indices.slice().reverse(),vertices:ze([e.points],n,a).vertices,uvs:r}}var Lt=function(e){"use strict";T(r,e);var n=D(r);function r(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};O(this,r);var t;t=n.call(this),t.type="PolygonBufferGeometry",t.parameters=(0,S.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,m=o.closedTop,d=o.includeSides,g=o.curvatureResolution,b=o.cartesian,_=o.userDataRsoOffset;(0,vt.default)(i[0])||i[0].reverse();var w=Ct(i,{resolution:g}),l=w.contour,P=w.triangles,C=(0,Ae.merge)(P.uvs),F=[],R=[],fe=[],Se=0,xe=function(Me){var Pe=Math.round(F.length/3),je=fe.length;F=F.concat(Me.vertices),R=R.concat(Me.uvs),fe=fe.concat(Pe?Me.indices.map(function(Ne){return Ne+Pe}):Me.indices),t.addGroup(je,fe.length-je,Se++)};if(d){var _e=Ye(l,c,h,b);xe(_e),t.userData.rso=_?Ye(l,c,h+_,b):_e}return v&&xe($e(P,c,C,!1,b)),m&&xe($e(P,h,C,!0,b)),t.setIndex(fe),t[Ke]("position",new s.Float32BufferAttribute(F,3)),t[Ke]("uv",new s.Float32BufferAttribute(R,2)),t.computeVertexNormals(),t}return r}(s.BufferGeometry),Et=function(e){"use strict";T(r,e);var n=D(r);function r(a){O(this,r);var t;return t=n.call(this),t.options=(0,S.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,m=t.curvatureResolution,d=t.userDataRsoOffset,g=t.cartesian,b=new Lt(this.options.geojson,{startHeight:o,endHeight:o+c,closedBottom:h,closedTop:v,curvatureResolution:m,cartesian:g,userDataRsoOffset:d});this.createMesh(b,this.options.material)},r}(p),Ue=new Map,jt={generateTopUV:function(e,n,r,i,a){var t=n[r*3],o=n[r*3+1],c=n[i*3],h=n[i*3+1],v=n[a*3],m=n[a*3+1],d;if(Ue.has(e))d=Ue.get(e);else{var g,b,_,w,l=e.parameters.shapes.getPoints();d={minX:(g=Math).min.apply(g,I(l.map(function(F){var R=F.x;return R}))),maxX:(b=Math).max.apply(b,I(l.map(function(F){var R=F.x;return R}))),minY:(_=Math).min.apply(_,I(l.map(function(F){var R=F.y;return R}))),maxY:(w=Math).max.apply(w,I(l.map(function(F){var R=F.y;return R})))},Ue.set(e,d)}var P=d.maxX-d.minX,C=d.maxY-d.minY;return[new s.Vector2((t-d.minX)/P,1-(o-d.minY)/C),new s.Vector2((c-d.minX)/P,1-(h-d.minY)/C),new s.Vector2((v-d.minX)/P,1-(m-d.minY)/C)]},generateSideWallUV:function(e,n,r,i,a,t){var o=n[r*3],c=n[r*3+1],h=n[r*3+2],v=n[i*3],m=n[i*3+1],d=n[i*3+2],g=n[a*3],b=n[a*3+1],_=n[a*3+2],w=n[t*3],l=n[t*3+1],P=n[t*3+2];return Math.abs(c-m)<.01?[new s.Vector2(o,1-h),new s.Vector2(v,1-d),new s.Vector2(g,1-_),new s.Vector2(w,1-P)]:[new s.Vector2(c,1-h),new s.Vector2(m,1-d),new s.Vector2(b,1-_),new s.Vector2(l,1-P)]}},Rt=function(e){"use strict";T(r,e);var n=D(r);function r(a){O(this,r);var t;return t=n.call(this),t.options=(0,S.Z)({},a),t}var i=r.prototype;return i.create=function(){var t=this.options,o=t.points,c=t.depth,h=t.material,v=new s.ExtrudeBufferGeometry(new s.Shape(o),{depth:c,bevelEnabled:!1,UVGenerator:jt});this.createMesh(v,h)},r}(p)})();var Xt=ue.Ei,Ht=ue.Yo,Kt=ue.Ee,Yt=ue.x1,$t=ue.VJ,Jt=ue.r7,Qt=ue.XA,qt=ue.NB,er=ue.xv,tr=ue.nk;export{Xt as ConicPolygon,Ht as ExtrudePolygon,Kt as Image,Yt as Line,$t as MeshLine,Jt as MeshLineMaterial,Qt as MeshLineRaycast,qt as Node,er as Text,tr as Video};
132
+ `),ce=function(e){"use strict";T(r,e);var n=D(r);function r(){O(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(B(i),{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(t){this.setGeometry(t,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(t){this.setPoints(t,this.widthCallback)}}}),i}return r}(s.BufferGeometry);ce.prototype.setMatrixWorld=function(e){this.matrixWorld=e},ce.prototype.setGeometry=function(e,n){this._geometry=e,this.setPoints(e.getAttribute("position").array,n)},ce.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 Ze(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,m=this instanceof s.LineSegments?2:1,d=o.index,_=o.attributes;if(d!==null)for(var b=d.array,g=_.position.array,w=_.width.array,l=0,P=b.length-1;l<P;l+=m){var C=b[l],F=b[l+1];c.fromArray(g,C*3),h.fromArray(g,F*3);var R=w[Math.floor(l/3)]!==void 0?w[Math.floor(l/3)]:1,fe=e.params.Line.threshold+this.material.lineWidth*R/2,Ae=fe*fe,xe=i.distanceSqToSegment(c,h,t,v);if(!(xe>Ae)){t.applyMatrix4(this.matrixWorld);var _e=e.ray.origin.distanceTo(t);_e<e.near||_e>e.far||(n.push({distance:_e,point:v.clone().applyMatrix4(this.matrixWorld),index:l,face:null,faceIndex:null,object:this}),l=P)}}}}ce.prototype.raycast=Ze,ce.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]},ce.prototype.copyV3=function(e){var n=e*6;return[this.positions[n],this.positions[n+1],this.positions[n+2]]},ce.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 De(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}ce.prototype.advance=function(e){var n=this._attributes.position.array,r=this._attributes.previous.array,i=this._attributes.next.array,a=n.length;De(n,0,r,0,a),De(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,De(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=tt,s.ShaderChunk.meshline_frag=rt;var Ve=function(e){"use strict";T(r,e);var n=D(r);function r(i){O(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(B(a),{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(o){this.uniforms.lineWidth.value=o}},lineLightAnimation:{enumerable:!0,get:function(){return this.uniforms.lineLightAnimation.value},set:function(o){this.uniforms.lineLightAnimation.value=o}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(o){this.uniforms.map.value=o}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(o){this.uniforms.useMap.value=o}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(o){this.uniforms.alphaMap.value=o}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(o){this.uniforms.useAlphaMap.value=o}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(o){this.uniforms.color.value=o}},lightColor:{enumerable:!0,get:function(){return this.uniforms.lightColor.value},set:function(o){this.uniforms.lightColor.value=o}},time:{enumerable:!0,get:function(){return this.uniforms.time.value},set:function(o){this.uniforms.time.value=o}},uCenter:{enumerable:!0,get:function(){return this.uniforms.uCenter.value},set:function(o){this.uniforms.uCenter.value=o}},size:{enumerable:!0,get:function(){return this.uniforms.size.value},set:function(o){this.uniforms.size.value=o}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(o){this.uniforms.opacity.value=o}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(o){this.uniforms.resolution.value.copy(o)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(o){this.uniforms.sizeAttenuation.value=o}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(o){this.uniforms.dashArray.value=o,this.useDash=o!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(o){this.uniforms.dashOffset.value=o}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(o){this.uniforms.dashRatio.value=o}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(o){this.uniforms.useDash.value=o}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(o){this.uniforms.visibility.value=o}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(o){this.uniforms.alphaTest.value=o}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(o){this.uniforms.repeat.value.copy(o)}}}),a.setValues(i),a}return r}(s.ShaderMaterial);Ve.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 nt(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 it(e,n){if(e==null)return{};var r=nt(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 at=e=>{var n={};return W.d(n,e),n},rr=e=>()=>e,ot=at({animate:()=>Wt.animate}),st={nodes:[],color:new s.Color("red"),lineWidth:3,sizeAttenuation:0},ut=function(e){"use strict";T(r,e);var n=D(r);function r(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};O(this,r);var t;return t=n.call(this),t.geometry=new s.BufferGeometry,t.meshline=new ce,t.options=(0,A.Z)({},st,a),t}var i=r.prototype;return i.create=function(){var t=this.options,o=t.nodes,c=t.duration,h=t.delay,v=t.onComplete,m=t.setPointWidth,d=it(t,["nodes","duration","delay","onComplete","setPointWidth"]),_=this.pencil.getSize(),b=_.width,g=_.height;delete d.key,this.geometry.setFromPoints(o),this.meshline.setGeometry(this.geometry,m);var w=new Ve(S((0,A.Z)({},d),{resolution:new s.Vector2(b,g)}));this.material=w,this.createMesh(this.meshline,w)},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,m=c!=null?c:0,d=(0,ot.animate)({from:v.value,to:{x:0},duration:o!=null?o:1e3,elapsed:-m,repeat:1/0,onComplete:h,onUpdate:function(_){v.value=_}});this.tween=d},i.dispose=function(){be(V(r.prototype),"dispose",this).call(this),this.tween.stop()},r}(p);function ct(e){if(Array.isArray(e))return e}function lt(){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 le(e,n){return ct(e)||K(e,n)||q(e,n)||lt()}var ft=e=>{var n={};return W.d(n,e),n},nr=e=>()=>e,Se=ft({extent:()=>Ie.extent,mean:()=>Ie.mean,merge:()=>Ie.merge}),ht=e=>{var n={};return W.d(n,e),n},ir=e=>()=>e,We=ht({default:()=>Gt.default}),pt=e=>{var n={};return W.d(n,e),n},ar=e=>()=>e,vt=pt({default:()=>zt.default});function dt(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 mt=e=>{var n={};return W.d(n,e),n},or=e=>()=>e,_t=mt({default:()=>Ut.default}),gt=e=>{var n={};return W.d(n,e),n},sr=e=>()=>e,yt=gt({default:()=>Nt.default}),bt=e=>{var n={};return W.d(n,e),n},ur=e=>()=>e,Ee=bt({geoBounds:()=>Be.geoBounds,geoContains:()=>Be.geoContains,geoDistance:()=>Be.geoDistance,geoInterpolate:()=>Be.geoInterpolate}),wt=e=>{var n={};return W.d(n,e),n},cr=e=>()=>e,xt=wt({geoVoronoi:()=>Ft.geoVoronoi}),Mt=e=>{var n={};return W.d(n,e),n},lr=e=>()=>e,Xe=Mt({scaleLinear:()=>It.scaleLinear});function St(e,n){return e.map(function(r){var i=[],a;return r.forEach(function(t){if(a){var o=(0,Ee.geoDistance)(t,a)*180/Math.PI;if(o>n)for(var c=(0,Ee.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 At(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},m=function(l){return o*(Math.cos((l+90)*Math.PI/180)+1)/2},d=[t!==void 0?Math.ceil(m(t)):0,a!==void 0?Math.floor(m(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=[],g=d[0];g<=d[1];g++){var w=h(g);_(w)&&b.push([w,v(g)])}return b}function Ge(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return r?(0,Ee.geoContains)(n,e):(0,yt.default)(e,n)}function Pt(e,n){var r={type:"Polygon",coordinates:e},i=le((0,Ee.geoBounds)(r),2),a=le(i[0],2),t=a[0],o=a[1],c=le(i[1],2),h=c[0],v=c[1];if(Math.min(Math.abs(h-t),Math.abs(v-o))<n)return[];var m=t>h||v>=89||o<=-89;return At(n,{minLng:t,maxLng:h,minLat:o,maxLat:v}).filter(function(d){return Ge(d,r,m)})}function Ot(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.resolution,i=r===void 0?1/0:r,a=St(e,i),t=(0,Se.merge)(a),o=Pt(e,i),c=I(t).concat(I(o)),h={type:"Polygon",coordinates:e},v=le((0,Ee.geoBounds)(h),2),m=le(v[0],2),d=m[0],_=m[1],b=le(v[1],2),g=b[0],w=b[1],l=d>g||w>=89||_<=-89,P=[];if(l){var C=(0,xt.geoVoronoi)(c).triangles(),F=new Map(c.map(function(ae,ge){var de=le(ae,2),oe=de[0],Re=de[1];return["".concat(oe,"-").concat(Re),ge]}));C.features.forEach(function(ae){var ge,de=ae.geometry.coordinates[0].slice(0,3).reverse(),oe=[];if(de.forEach(function(ke){var he=le(ke,2),Fe=he[0],Dt=he[1],$e="".concat(Fe,"-").concat(Dt);F.has($e)&&oe.push(F.get($e))}),oe.length===3){if(oe.some(function(ke){return ke<t.length})){var Re=ae.properties.circumcenter;if(!Ge(Re,h,l))return}(ge=P).push.apply(ge,I(oe))}})}else if(o.length)for(var _e=function(ae,ge){var de,oe=[2,1,0].map(function(he){return Me.triangles[ae+he]}),Re=oe.map(function(he){return c[he]});if(oe.some(function(he){return he<t.length})){var ke=[0,1].map(function(he){return(0,Se.mean)(Re,function(Fe){return Fe[he]})});if(!Ge(ke,h,l))return"continue"}(de=P).push.apply(de,I(oe))},Me=_t.default.from(c),Pe=0,je=Me.triangles.length;Pe<je;Pe+=3)_e(Pe,je);else{var R=We.default.flatten(a),fe=R.vertices,Ae=R.holes,xe=Ae===void 0?[]:Ae;P=(0,We.default)(fe,xe,2)}var Ne=(0,Xe.scaleLinear)((0,Se.extent)(c,function(ae){return ae[0]}),[0,1]),kt=(0,Xe.scaleLinear)((0,Se.extent)(c,function(ae){return ae[1]}),[0,1]),Tt=c.map(function(ae){var ge=le(ae,2),de=ge[0],oe=ge[1];return[Ne(de),kt(oe)]}),Bt={points:c,indices:P,uvs:Tt};return{contour:a,triangles:Bt}}var Ct=Ot,He=new s.BufferGeometry().setAttribute?"setAttribute":"addAttribute";function ze(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=e.map(function(a){return a.map(function(t){var o=le(t,2),c=o[0],h=o[1];return r?dt(c,h,n):[c,h,n]})});return We.default.flatten(i)}function Ke(e,n,r){for(var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=ze(e,n,i),t=a.vertices,o=a.holes,c=ze(e,r,i),h=c.vertices,v=(0,Se.merge)([h,t]),m=Math.round(h.length/3),d=new Set(o),_=0,b=[],g=0;g<m;g++){var w=g+1;if(w===m)w=_;else if(d.has(w)){var l=w;w=_,_=l}b.push(g,g+m,w+m),b.push(w+m,w,g)}for(var P=[],C=1;C>=0;C--)for(var F=0;F<m;F+=1)P.push(F/(m-1),C);return{indices:b,vertices:v,uvs:P,topVerts:h}}function Ye(e,n,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return{indices:i?e.indices:e.indices.slice().reverse(),vertices:ze([e.points],n,a).vertices,uvs:r}}var Lt=function(e){"use strict";T(r,e);var n=D(r);function r(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};O(this,r);var t;t=n.call(this),t.type="PolygonBufferGeometry",t.parameters=(0,A.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,m=o.closedTop,d=o.includeSides,_=o.curvatureResolution,b=o.cartesian,g=o.userDataRsoOffset;(0,vt.default)(i[0])||i[0].reverse();var w=Ct(i,{resolution:_}),l=w.contour,P=w.triangles,C=(0,Se.merge)(P.uvs),F=[],R=[],fe=[],Ae=0,xe=function(Me){var Pe=Math.round(F.length/3),je=fe.length;F=F.concat(Me.vertices),R=R.concat(Me.uvs),fe=fe.concat(Pe?Me.indices.map(function(Ne){return Ne+Pe}):Me.indices),t.addGroup(je,fe.length-je,Ae++)};if(d){var _e=Ke(l,c,h,b);xe(_e),t.userData.rso=g?Ke(l,c,h+g,b):_e}return v&&xe(Ye(P,c,C,!1,b)),m&&xe(Ye(P,h,C,!0,b)),t.setIndex(fe),t[He]("position",new s.Float32BufferAttribute(F,3)),t[He]("uv",new s.Float32BufferAttribute(R,2)),t.computeVertexNormals(),t}return r}(s.BufferGeometry),Et=function(e){"use strict";T(r,e);var n=D(r);function r(a){O(this,r);var t;return t=n.call(this),t.options=(0,A.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,m=t.curvatureResolution,d=t.userDataRsoOffset,_=t.cartesian,b=new Lt(this.options.geojson,{startHeight:o,endHeight:o+c,closedBottom:h,closedTop:v,curvatureResolution:m,cartesian:_,userDataRsoOffset:d});this.createMesh(b,this.options.material)},r}(p),Ue=new Map,jt={generateTopUV:function(e,n,r,i,a){var t=n[r*3],o=n[r*3+1],c=n[i*3],h=n[i*3+1],v=n[a*3],m=n[a*3+1],d;if(Ue.has(e))d=Ue.get(e);else{var _,b,g,w,l=e.parameters.shapes.getPoints();d={minX:(_=Math).min.apply(_,I(l.map(function(F){var R=F.x;return R}))),maxX:(b=Math).max.apply(b,I(l.map(function(F){var R=F.x;return R}))),minY:(g=Math).min.apply(g,I(l.map(function(F){var R=F.y;return R}))),maxY:(w=Math).max.apply(w,I(l.map(function(F){var R=F.y;return R})))},Ue.set(e,d)}var P=d.maxX-d.minX,C=d.maxY-d.minY;return[new s.Vector2((t-d.minX)/P,1-(o-d.minY)/C),new s.Vector2((c-d.minX)/P,1-(h-d.minY)/C),new s.Vector2((v-d.minX)/P,1-(m-d.minY)/C)]},generateSideWallUV:function(e,n,r,i,a,t){var o=n[r*3],c=n[r*3+1],h=n[r*3+2],v=n[i*3],m=n[i*3+1],d=n[i*3+2],_=n[a*3],b=n[a*3+1],g=n[a*3+2],w=n[t*3],l=n[t*3+1],P=n[t*3+2];return Math.abs(c-m)<.01?[new s.Vector2(o,1-h),new s.Vector2(v,1-d),new s.Vector2(_,1-g),new s.Vector2(w,1-P)]:[new s.Vector2(c,1-h),new s.Vector2(m,1-d),new s.Vector2(b,1-g),new s.Vector2(l,1-P)]}},Rt=function(e){"use strict";T(r,e);var n=D(r);function r(a){O(this,r);var t;return t=n.call(this),t.options=(0,A.Z)({},a),t}var i=r.prototype;return i.create=function(){var t=this.options,o=t.points,c=t.depth,h=t.material,v=new s.ExtrudeBufferGeometry(new s.Shape(o),{depth:c,bevelEnabled:!1,UVGenerator:jt});this.createMesh(v,h)},r}(p)})();var Xt=ue.Ei,Ht=ue.Yo,Kt=ue.Ee,Yt=ue.x1,$t=ue.VJ,Jt=ue.r7,Qt=ue.XA,qt=ue.NB,er=ue.xv,tr=ue.nk;export{Xt as ConicPolygon,Ht as ExtrudePolygon,Kt as Image,Yt as Line,$t as MeshLine,Jt as MeshLineMaterial,Qt as MeshLineRaycast,qt as Node,er as Text,tr as Video};
@@ -1,5 +1,5 @@
1
1
  import * as THREE from 'three';
2
- import { Tween } from '@tweenjs/tween.js';
2
+ import { PlaybackControls } from 'popmotion';
3
3
  import BaseObject from '../../core/BaseObject';
4
4
  import { MeshLine, MeshLineMaterial } from './meshLine';
5
5
  interface Options {
@@ -28,7 +28,7 @@ interface Options {
28
28
  }
29
29
  export default class Line extends BaseObject {
30
30
  options: Options;
31
- tween: Tween<any>;
31
+ tween: PlaybackControls;
32
32
  constructor(options?: Partial<Options>);
33
33
  material: MeshLineMaterial;
34
34
  geometry: THREE.BufferGeometry;
@@ -24,6 +24,7 @@ export default class extends BaseObject {
24
24
  constructor(options: Options);
25
25
  getMaterial(): Promise<any>;
26
26
  create(): Promise<void>;
27
+ setScale(n: number): void;
27
28
  render(): void;
28
29
  dispose(): void;
29
30
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gl-draw",
3
- "version": "0.0.32",
3
+ "version": "0.1.2",
4
4
  "author": "gitplus <hstits@gmail.com>",
5
5
  "scripts": {
6
6
  "start": "PORT=3002 bundler-dev",
@@ -11,24 +11,24 @@
11
11
  "main": "dist/index.js",
12
12
  "module": "dist/index.module.js",
13
13
  "exports": {
14
- ".": {
15
- "import": "./dist/index.module.js",
16
- "require": "./dist/index.js"
17
- },
18
- "./dist/objects": {
19
- "import": "./dist/objects/index.module.js",
20
- "require": "./dist/objects/index.js"
21
- },
14
+ ".": {
15
+ "import": "./dist/index.module.js",
16
+ "require": "./dist/index.js"
17
+ },
18
+ "./dist/objects": {
19
+ "import": "./dist/objects/index.module.js",
20
+ "require": "./dist/objects/index.js"
21
+ },
22
22
  "./dist/plugins": {
23
- "import": "./dist/plugins/index.module.js",
24
- "require": "./dist/plugins/index.js"
25
- },
23
+ "import": "./dist/plugins/index.module.js",
24
+ "require": "./dist/plugins/index.js"
25
+ },
26
26
  "./dist/utils": {
27
- "import": "./dist/utils/index.module.js",
28
- "require": "./dist/utils/index.js"
29
- },
30
- "./dist/geojson/":"./dist/geojson/"
31
- },
27
+ "import": "./dist/utils/index.module.js",
28
+ "require": "./dist/utils/index.js"
29
+ },
30
+ "./dist/geojson/": "./dist/geojson/"
31
+ },
32
32
  "files": [
33
33
  "dist"
34
34
  ],
@@ -45,7 +45,6 @@
45
45
  ]
46
46
  },
47
47
  "peerDependencies": {
48
- "@tweenjs/tween.js": "^18.6.4",
49
48
  "three": ">=0.136.0"
50
49
  },
51
50
  "devDependencies": {
@@ -71,7 +70,6 @@
71
70
  "dependencies": {
72
71
  "@turf/boolean-clockwise": "^6.5.0",
73
72
  "@turf/boolean-point-in-polygon": "^6.5",
74
- "@tweenjs/tween.js": "^18.6.4",
75
73
  "d3-array": "3",
76
74
  "d3-geo": "3",
77
75
  "d3-geo-voronoi": "^2.0",
@@ -80,7 +78,8 @@
80
78
  "delaunator": "5",
81
79
  "earcut": "2",
82
80
  "idb-keyval": "^6.1.0",
83
- "lil-gui": "^0.16.1",
81
+ "lil-gui": "^0.17.0",
82
+ "popmotion": "^11.0.5",
84
83
  "three": "^0.136.0"
85
84
  },
86
85
  "msw": {