gl-draw 0.8.33 → 0.8.34

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.
@@ -7,5 +7,6 @@ export { MeshLine, MeshLineMaterial, MeshLineRaycast } from './line/meshLine';
7
7
  export { default as Line } from './line';
8
8
  export { default as getLineGeometry } from './line/getWorkerGeometry';
9
9
  export { default as ConicPolygon } from './conicPolygon';
10
+ export { default as ConicPolygonGeometry } from './conicPolygon/geometry';
10
11
  export { default as ExtrudePolygon } from './extrudePolygon';
11
12
  export { default as getExtrudePolygonGeometry } from './extrudePolygon/getWorkerGeometry';
@@ -1,4 +1,4 @@
1
- (function(){var nt={666:function(T){var z=function(x){"use strict";var C=Object.prototype,j=C.hasOwnProperty,G,k=typeof Symbol=="function"?Symbol:{},Z=k.iterator||"@@iterator",I=k.asyncIterator||"@@asyncIterator",D=k.toStringTag||"@@toStringTag";function _(p,l,d){return Object.defineProperty(p,l,{value:d,enumerable:!0,configurable:!0,writable:!0}),p[l]}try{_({},"")}catch(p){_=function(l,d,P){return l[d]=P}}function F(p,l,d,P){var A=l&&l.prototype instanceof c?l:c,X=Object.create(A.prototype),se=new B(P||[]);return X._invoke=le(p,d,se),X}x.wrap=F;function H(p,l,d){try{return{type:"normal",arg:p.call(l,d)}}catch(P){return{type:"throw",arg:P}}}var $="suspendedStart",ae="suspendedYield",he="executing",ue="completed",E={};function c(){}function O(){}function W(){}var R={};_(R,Z,function(){return this});var ce=Object.getPrototypeOf,ee=ce&&ce(ce(Se([])));ee&&ee!==C&&j.call(ee,Z)&&(R=ee);var N=W.prototype=c.prototype=Object.create(R);O.prototype=W,_(N,"constructor",W),_(W,"constructor",O),O.displayName=_(W,D,"GeneratorFunction");function te(p){["next","throw","return"].forEach(function(l){_(p,l,function(d){return this._invoke(l,d)})})}x.isGeneratorFunction=function(p){var l=typeof p=="function"&&p.constructor;return l?l===O||(l.displayName||l.name)==="GeneratorFunction":!1},x.mark=function(p){return Object.setPrototypeOf?Object.setPrototypeOf(p,W):(p.__proto__=W,_(p,D,"GeneratorFunction")),p.prototype=Object.create(N),p},x.awrap=function(p){return{__await:p}};function re(p,l){function d(X,se,fe,pe){var ie=H(p[X],p,se);if(ie.type==="throw")pe(ie.arg);else{var Oe=ie.arg,Ce=Oe.value;return Ce&&typeof Ce=="object"&&j.call(Ce,"__await")?l.resolve(Ce.__await).then(function(Ae){d("next",Ae,fe,pe)},function(Ae){d("throw",Ae,fe,pe)}):l.resolve(Ce).then(function(Ae){Oe.value=Ae,fe(Oe)},function(Ae){return d("throw",Ae,fe,pe)})}}var P;function A(X,se){function fe(){return new l(function(pe,ie){d(X,se,pe,ie)})}return P=P?P.then(fe,fe):fe()}this._invoke=A}te(re.prototype),_(re.prototype,I,function(){return this}),x.AsyncIterator=re,x.async=function(p,l,d,P,A){A===void 0&&(A=Promise);var X=new re(F(p,l,d,P),A);return x.isGeneratorFunction(l)?X:X.next().then(function(se){return se.done?se.value:X.next()})};function le(p,l,d){var P=$;return function(X,se){if(P===he)throw new Error("Generator is already running");if(P===ue){if(X==="throw")throw se;return Te()}for(d.method=X,d.arg=se;;){var fe=d.delegate;if(fe){var pe=me(fe,d);if(pe){if(pe===E)continue;return pe}}if(d.method==="next")d.sent=d._sent=d.arg;else if(d.method==="throw"){if(P===$)throw P=ue,d.arg;d.dispatchException(d.arg)}else d.method==="return"&&d.abrupt("return",d.arg);P=he;var ie=H(p,l,d);if(ie.type==="normal"){if(P=d.done?ue:ae,ie.arg===E)continue;return{value:ie.arg,done:d.done}}else ie.type==="throw"&&(P=ue,d.method="throw",d.arg=ie.arg)}}}function me(p,l){var d=p.iterator[l.method];if(d===G){if(l.delegate=null,l.method==="throw"){if(p.iterator.return&&(l.method="return",l.arg=G,me(p,l),l.method==="throw"))return E;l.method="throw",l.arg=new TypeError("The iterator does not provide a 'throw' method")}return E}var P=H(d,p.iterator,l.arg);if(P.type==="throw")return l.method="throw",l.arg=P.arg,l.delegate=null,E;var A=P.arg;if(!A)return l.method="throw",l.arg=new TypeError("iterator result is not an object"),l.delegate=null,E;if(A.done)l[p.resultName]=A.value,l.next=p.nextLoc,l.method!=="return"&&(l.method="next",l.arg=G);else return A;return l.delegate=null,E}te(N),_(N,D,"Generator"),_(N,Z,function(){return this}),_(N,"toString",function(){return"[object Generator]"});function ne(p){var l={tryLoc:p[0]};1 in p&&(l.catchLoc=p[1]),2 in p&&(l.finallyLoc=p[2],l.afterLoc=p[3]),this.tryEntries.push(l)}function q(p){var l=p.completion||{};l.type="normal",delete l.arg,p.completion=l}function B(p){this.tryEntries=[{tryLoc:"root"}],p.forEach(ne,this),this.reset(!0)}x.keys=function(p){var l=[];for(var d in p)l.push(d);return l.reverse(),function P(){for(;l.length;){var A=l.pop();if(A in p)return P.value=A,P.done=!1,P}return P.done=!0,P}};function Se(p){if(p){var l=p[Z];if(l)return l.call(p);if(typeof p.next=="function")return p;if(!isNaN(p.length)){var d=-1,P=function A(){for(;++d<p.length;)if(j.call(p,d))return A.value=p[d],A.done=!1,A;return A.value=G,A.done=!0,A};return P.next=P}}return{next:Te}}x.values=Se;function Te(){return{value:G,done:!0}}return B.prototype={constructor:B,reset:function(p){if(this.prev=0,this.next=0,this.sent=this._sent=G,this.done=!1,this.delegate=null,this.method="next",this.arg=G,this.tryEntries.forEach(q),!p)for(var l in this)l.charAt(0)==="t"&&j.call(this,l)&&!isNaN(+l.slice(1))&&(this[l]=G)},stop:function(){this.done=!0;var p=this.tryEntries[0],l=p.completion;if(l.type==="throw")throw l.arg;return this.rval},dispatchException:function(p){if(this.done)throw p;var l=this;function d(pe,ie){return X.type="throw",X.arg=p,l.next=pe,ie&&(l.method="next",l.arg=G),!!ie}for(var P=this.tryEntries.length-1;P>=0;--P){var A=this.tryEntries[P],X=A.completion;if(A.tryLoc==="root")return d("end");if(A.tryLoc<=this.prev){var se=j.call(A,"catchLoc"),fe=j.call(A,"finallyLoc");if(se&&fe){if(this.prev<A.catchLoc)return d(A.catchLoc,!0);if(this.prev<A.finallyLoc)return d(A.finallyLoc)}else if(se){if(this.prev<A.catchLoc)return d(A.catchLoc,!0)}else if(fe){if(this.prev<A.finallyLoc)return d(A.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(p,l){for(var d=this.tryEntries.length-1;d>=0;--d){var P=this.tryEntries[d];if(P.tryLoc<=this.prev&&j.call(P,"finallyLoc")&&this.prev<P.finallyLoc){var A=P;break}}A&&(p==="break"||p==="continue")&&A.tryLoc<=l&&l<=A.finallyLoc&&(A=null);var X=A?A.completion:{};return X.type=p,X.arg=l,A?(this.method="next",this.next=A.finallyLoc,E):this.complete(X)},complete:function(p,l){if(p.type==="throw")throw p.arg;return p.type==="break"||p.type==="continue"?this.next=p.arg:p.type==="return"?(this.rval=this.arg=p.arg,this.method="return",this.next="end"):p.type==="normal"&&l&&(this.next=l),E},finish:function(p){for(var l=this.tryEntries.length-1;l>=0;--l){var d=this.tryEntries[l];if(d.finallyLoc===p)return this.complete(d.completion,d.afterLoc),q(d),E}},catch:function(p){for(var l=this.tryEntries.length-1;l>=0;--l){var d=this.tryEntries[l];if(d.tryLoc===p){var P=d.completion;if(P.type==="throw"){var A=P.arg;q(d)}return A}}throw new Error("illegal catch attempt")},delegateYield:function(p,l,d){return this.delegate={iterator:Se(p),resultName:l,nextLoc:d},this.method==="next"&&(this.arg=G),E}},x}(T.exports);try{regeneratorRuntime=z}catch(x){typeof globalThis=="object"?globalThis.regeneratorRuntime=z:Function("r","regeneratorRuntime = r")(z)}},695:function(T,z,x){"use strict";x.d(z,{Z:function(){return C}});function C(j){if(j.geometry&&j.geometry.dispose(),j.material){var G=Array.isArray(j.material)?j.material:[j.material];G.forEach(function(k){var Z,I,D,_,F,H,$,ae,he,ue,E,c,O;(Z=k.map)===null||Z===void 0||Z.dispose(),(I=k.lightMap)===null||I===void 0||I.dispose(),(D=k.bumpMap)===null||D===void 0||D.dispose(),(_=k.normalMap)===null||_===void 0||_.dispose(),(F=k.specularMap)===null||F===void 0||F.dispose(),(H=k.envMap)===null||H===void 0||H.dispose(),($=k.alphaMap)===null||$===void 0||$.dispose(),(ae=k.aoMap)===null||ae===void 0||ae.dispose(),(he=k.displacementMap)===null||he===void 0||he.dispose(),(ue=k.emissiveMap)===null||ue===void 0||ue.dispose(),(E=k.gradientMap)===null||E===void 0||E.dispose(),(c=k.metalnessMap)===null||c===void 0||c.dispose(),(O=k.roughnessMap)===null||O===void 0||O.dispose(),k.dispose()})}}},584:function(T,z,x){"use strict";x.d(z,{disposeMesh:function(){return k.Z}});var C=x(666),j=x.n(C),G=null,k=x(695),Z=x(644);function I(E){if(E.material){var c=Array.isArray(E.material)?E.material:[E.material];c.forEach(function(O){var W,R;(W=O.color)===null||W===void 0||W.convertSRGBToLinear(),(R=O.emissive)===null||R===void 0||R.convertSRGBToLinear(),O.map&&(O.map.encoding=THREE.sRGBEncoding),O.emissiveMap&&(O.emissiveMap.encoding=THREE.sRGBEncoding)})}}var D=x(568),_=x(924),F=x(360),H=x(484),$=null,ae=null,he=function(){var E=(0,D.Z)(j().mark(function c(O,W){var R,ce,ee,N,te,re,le,me,ne;return j().wrap(function(B){for(;;)switch(B.prev=B.next){case 0:return R=W.type,ce=R===void 0?"blob":R,ee=W.version,N=ee===void 0?"1":ee,B.next=4,(0,F.get)(O);case 4:if(re=B.sent,!(re&&re[N])){B.next=9;break}te=re[N],B.next=15;break;case 9:return B.next=11,(0,H.Z)(fetch(O).then(function(Se){if(Se.ok)return Se[ce]();throw new Error}));case 11:le=B.sent,me=le.res,ne=le.err,ne||(te=me,(0,F.set)(O,(0,_.Z)({},N,me)));case 15:return B.abrupt("return",te?{url:ce==="json"?O:URL.createObjectURL(te),store:te}:{url:O});case 16:case"end":return B.stop()}},c)}));return function(O,W){return E.apply(this,arguments)}}(),ue=x(705)},484:function(T,z,x){"use strict";x.d(z,{Z:function(){return j}});var C=x(42);function j(G){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return G.then(function(Z){return(0,C.Z)({err:null,res:Z},k)}).catch(function(Z){return(0,C.Z)({err:Z,res:void 0},k)})}},705:function(T,z,x){"use strict";x.d(z,{C:function(){return Z},y:function(){return k}});var C=x(644),j=x.n(C),G=new Map,k=function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{generateTopUV:function(D,_,F,H,$){var ae=_[F*3],he=_[F*3+1],ue=_[H*3],E=_[H*3+1],c=_[$*3],O=_[$*3+1],W;if(G.has(D))W=G.get(D);else{var R=I.box3||new C.Box3;if(!I.box3){var ce=D.parameters.shapes.getPoints();R.setFromArray(ce.map(function(le){return[le.x,le.y,0]}).flat())}var ee=R.getSize(new C.Vector3);I.split&&(ee.y/=I.split),W={box:R,size:ee},G.set(D,W)}var N=W.box,te=W.size,re=I.split?1-I.split:0;return[new C.Vector2((ae-N.min.x)/te.x,(he-N.min.y)/te.y+re),new C.Vector2((ue-N.min.x)/te.x,(E-N.min.y)/te.y+re),new C.Vector2((c-N.min.x)/te.x,(O-N.min.y)/te.y+re)]},generateSideWallUV:function(D,_,F,H,$,ae){var he=_[F*3],ue=_[F*3+1],E=_[F*3+2],c=_[H*3],O=_[H*3+1],W=_[H*3+2],R=_[$*3],ce=_[$*3+1],ee=_[$*3+2],N=_[ae*3],te=_[ae*3+1],re=_[ae*3+2],le;if(G.has(_))le=G.get(_);else{var me=new C.Box3;me.setFromArray(_);var ne=me.getSize(new C.Vector3);I.split&&(ne.z/=1-I.split),le={box:me,size:ne},G.set(_,le)}var q=le.box,B=le.size;return Math.abs(ue-O)<Math.abs(he-c)?[new C.Vector2((he-q.min.x)/B.x,(E-q.min.z)/B.z),new C.Vector2((c-q.min.x)/B.x,(W-q.min.z)/B.z),new C.Vector2((R-q.min.x)/B.x,(ee-q.min.z)/B.z),new C.Vector2((N-q.min.x)/B.x,(re-q.min.z)/B.z)]:[new C.Vector2((ue-q.min.y)/B.y,(E-q.min.z)/B.z),new C.Vector2((O-q.min.y)/B.y,(W-q.min.z)/B.z),new C.Vector2((ce-q.min.y)/B.y,(ee-q.min.z)/B.z),new C.Vector2((te-q.min.y)/B.y,(re-q.min.z)/B.z)]}}},Z=function(){G.clear()}},360:function(T){"use strict";T.exports=require("idb-keyval")},644:function(T){"use strict";T.exports=require("three")},568:function(T,z,x){"use strict";x.d(z,{Z:function(){return j}});function C(G,k,Z,I,D,_,F){try{var H=G[_](F),$=H.value}catch(ae){Z(ae);return}H.done?k($):Promise.resolve($).then(I,D)}function j(G){return function(){var k=this,Z=arguments;return new Promise(function(I,D){var _=G.apply(k,Z);function F($){C(_,I,D,F,H,"next",$)}function H($){C(_,I,D,F,H,"throw",$)}F(void 0)})}}},924:function(T,z,x){"use strict";x.d(z,{Z:function(){return C}});function C(j,G,k){return G in j?Object.defineProperty(j,G,{value:k,enumerable:!0,configurable:!0,writable:!0}):j[G]=k,j}},42:function(T,z,x){"use strict";x.d(z,{Z:function(){return j}});var C=x(924);function j(G){for(var k=1;k<arguments.length;k++){var Z=arguments[k]!=null?arguments[k]:{},I=Object.keys(Z);typeof Object.getOwnPropertySymbols=="function"&&(I=I.concat(Object.getOwnPropertySymbols(Z).filter(function(D){return Object.getOwnPropertyDescriptor(Z,D).enumerable}))),I.forEach(function(D){(0,C.Z)(G,D,Z[D])})}return G}}},Fe={};function Y(T){var z=Fe[T];if(z!==void 0)return z.exports;var x=Fe[T]={exports:{}};return nt[T](x,x.exports,Y),x.exports}(function(){Y.n=function(T){var z=T&&T.__esModule?function(){return T.default}:function(){return T};return Y.d(z,{a:z}),z}})(),function(){Y.d=function(T,z){for(var x in z)Y.o(z,x)&&!Y.o(T,x)&&Object.defineProperty(T,x,{enumerable:!0,get:z[x]})}}(),function(){Y.o=function(T,z){return Object.prototype.hasOwnProperty.call(T,z)}}(),function(){Y.r=function(T){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(T,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(T,"__esModule",{value:!0})}}();var Be={};(function(){"use strict";Y.r(Be),Y.d(Be,{ConicPolygon:function(){return Tt},ExtrudePolygon:function(){return kt},Group:function(){return at},Image:function(){return se},Line:function(){return vt},MeshLine:function(){return we},MeshLineMaterial:function(){return We},MeshLineRaycast:function(){return Ne},Node:function(){return it},Text:function(){return fe},Video:function(){return Ce},getExtrudePolygonGeometry:function(){return Et},getLineGeometry:function(){return dt}});function T(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")}function z(t,i){return z=Object.setPrototypeOf||function(n,a){return n.__proto__=a,n},z(t,i)}function x(t,i){return z(t,i)}function C(t,i){if(typeof i!="function"&&i!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(i&&i.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),i&&x(t,i)}var j=Y(42);function G(){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(t){return!1}}function k(t,i,r){return G()?k=Reflect.construct:k=function(a,e,o){var s=[null];s.push.apply(s,e);var f=Function.bind.apply(a,s),h=new f;return o&&x(h,o.prototype),h},k.apply(null,arguments)}function Z(t,i,r){return k.apply(null,arguments)}function I(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function D(t){return D=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},D(t)}function _(t){return D(t)}function F(t){var i=typeof Map=="function"?new Map:void 0;return F=function(n){if(n===null||!I(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof i!="undefined"){if(i.has(n))return i.get(n);i.set(n,a)}function a(){return Z(n,arguments,_(this).constructor)}return a.prototype=Object.create(n.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),x(a,n)},F(t)}function H(t){return F(t)}function $(){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(t){return!1}}function ae(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function he(t){return t&&t.constructor===Symbol?"symbol":typeof t}function ue(t,i){return i&&(he(i)==="object"||typeof i=="function")?i:ae(t)}function E(t){var i=$();return function(){var n=_(t),a;if(i){var e=_(this).constructor;a=Reflect.construct(n,arguments,e)}else a=n.apply(this,arguments);return ue(this,a)}}var c=Y(644),O=Y(568),W=Y(666),R=Y.n(W);function ce(t,i){for(var r=0;r<i.length;r++){var n=i[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function ee(t,i,r){return i&&ce(t.prototype,i),r&&ce(t,r),t}function N(t,i){(i==null||i>t.length)&&(i=t.length);for(var r=0,n=new Array(i);r<i;r++)n[r]=t[r];return n}function te(t){if(Array.isArray(t))return N(t)}function re(t){if(typeof Symbol!="undefined"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function le(){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 me(t,i){if(!!t){if(typeof t=="string")return N(t,i);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return N(t,i)}}function ne(t){return te(t)||re(t)||me(t)||le()}var q=Y(484);function B(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r={};return r.promise=new Promise(function(n,a){r.resolve=n,r.reject=a}),t&&(r.promise=(0,q.Z)(r.promise,i)),r}var Se=require("three/examples/jsm/renderers/CSS2DRenderer"),Te=require("three/examples/jsm/renderers/CSS3DRenderer"),p=Y(584),l=function(t){t&&((0,p.disposeMesh)(t),t.children.forEach(function(i){i.userData.BaseObject_||l(i)}))},d=function(){"use strict";function t(){T(this,t),this.objecttype__="BaseObject",this.userData={},this.pm=B(),this.visible=!1}var i=t.prototype;return i.init=function(){},i.create=function(){},i.render=function(){},i.update=function(n,a){},i.resize=function(n,a){},i.show=function(){return this.object3d&&(this.object3d.visible=!0),this.visible=!0,this},i.hide=function(){return this.object3d&&(this.object3d.visible=!1),this.visible=!1,this},i.isVisible=function(){return this.visible},i.createMesh=function(){for(var n=arguments.length,a=new Array(n),e=0;e<n;e++)a[e]=arguments[e];return this.object3d=Z(c.Mesh,ne(a)),this},i.createGroup=function(){return this.object3d=new c.Group,this},i.createPoints=function(){for(var n=arguments.length,a=new Array(n),e=0;e<n;e++)a[e]=arguments[e];return this.object3d=Z(c.Points,ne(a)),this},i.createCSS2DObject=function(n){return this.object3d=new Se.CSS2DObject(n),this},i.createCSS3DObject=function(n){return this.object3d=new Te.CSS3DObject(n),this},i.createCSS3DSprite=function(n){return this.object3d=new Te.CSS3DSprite(n),this},i.createSprite=function(n){return this.object3d=new c.Sprite(n),this},i.add=function(){for(var n=arguments.length,a=new Array(n),e=0;e<n;e++)a[e]=arguments[e];var o;return(o=this.object3d).add.apply(o,ne(a)),this},i.remove=function(){for(var n=arguments.length,a=new Array(n),e=0;e<n;e++)a[e]=arguments[e];var o;return(o=this.object3d).remove.apply(o,ne(a)),this},i.getSize=function(){var n=new c.Box3().setFromObject(this.object3d);return{min:n.min,max:n.max,size:n.getSize(new c.Vector3)}},i.traverse=function(n){n(this),this.children.forEach(function(a){a.traverse(n)})},i.dispose=function(){l(this.object3d)},ee(t,[{key:"parent",get:function(){var n=this.object3d.parent;return(n==null?void 0:n.userData.BaseObject_)||this.pencil.scene}},{key:"children",get:function(){return this.object3d.children.map(function(n){return n.userData.BaseObject_}).filter(function(n){return!!n})}}]),t}(),P=+c.REVISION<144,A=P?"ExtrudeBufferGeometry":"ExtrudeGeometry",X=P?"PlaneBufferGeometry":"PlaneGeometry",se=function(t){"use strict";C(r,t);var i=E(r);function r(a){T(this,r);var e;return e=i.call(this),e.scale=1,e.options=(0,j.Z)({},{scale:1},a),e}var n=r.prototype;return n.getMaterial=function(){var e=this;return(0,O.Z)(R().mark(function o(){var s,f,h,v,m,y,b,w,g,u;return R().wrap(function(S){for(;;)switch(S.prev=S.next){case 0:return s=e.options,f=s.transparent,h=s.blending,v=s.depthWrite,m=s.depthTest,y=s.alphaTest,b=s.sprite,w=s.sizeAttenuation,S.next=3,e.getTexture();case 3:return g=S.sent,u=b?new c.SpriteMaterial({map:g,transparent:f!=null?f:!1,blending:h!=null?h:c.NormalBlending,depthWrite:v!=null?v:!0,depthTest:m!=null?m:!0,alphaTest:y!=null?y:0,sizeAttenuation:w!=null?w:!0}):new c.MeshBasicMaterial({map:g,transparent:f!=null?f:!1,blending:h!=null?h:c.NormalBlending,depthWrite:v!=null?v:!0,depthTest:m!=null?m:!0,alphaTest:y!=null?y:0}),S.abrupt("return",u);case 6:case"end":return S.stop()}},o)}))()},n.create=function(){var e=this;return(0,O.Z)(R().mark(function o(){var s,f,h,v,m,y,b,w;return R().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(s=e.options,f=s.scale,h=s.position,v=s.src,m=s.cache,y=s.sprite,b=v,!m){u.next=8;break}return u.next=5,m.get(b,function(){return e.getMaterial()});case 5:u.t0=u.sent,u.next=11;break;case 8:return u.next=10,e.getMaterial();case 10:u.t0=u.sent;case 11:w=u.t0,e.texture=w.map,y?e.createSprite(w):e.createMesh(new c[X](1,1),w),e.setScale(f),h&&e.object3d.position.copy(h);case 16:case"end":return u.stop()}},o)}))()},n.setScale=function(e){this.scale=e,this.object3d.scale.set(this.texture.image.width*e,this.texture.image.height*e,1)},n.setTexture=function(e){var o=this.object3d;o.material.map&&o.material.map.dispose(),o.material.map=e,o.material.needsUpdate=!0,this.texture=e,this.setScale(this.scale)},n.getTexture=function(){var e=this.options.src;return new c.TextureLoader().loadAsync(e)},r}(d),fe=function(t){"use strict";C(r,t);var i=E(r);function r(a){T(this,r);var e;return e=i.call(this,a),e.canvas=document.createElement("canvas"),e}var n=r.prototype;return n.getTexture=function(){var e=this.options,o=e.text,s=e.textOptions,f=(0,j.Z)({},{fontSize:28,fontFamily:"system-ui,-apple-system,BlinkMacSystemFont,sans-serif",fontWeight:"normal",flipX:!1,color:"#ffffff",setCtx:function(L){}},s||{}),h=f.fontSize,v=f.fontFamily,m=f.fontWeight,y=f.flipX,b=f.color,w=f.setCtx,g=this.canvas;g.width=h*o.length*2,g.height=h;var u=g.getContext("2d");u.font="".concat(m," ").concat(h,"px/1 ").concat(v);var M=u.measureText(o).width;g.width=M,u=g.getContext("2d"),u.clearRect(0,0,g.width,g.height),y&&u.scale(-1,1),u.font="".concat(m," ").concat(h,"px/1 ").concat(v),u.textBaseline="middle",u.fillStyle=b,w&&w(u),u.fillText(o,y?M*-1:0,g.height/2),u.restore();var S=new c.Texture(g);return S.anisotropy=this.pencil.renderer.capabilities.getMaxAnisotropy(),S.needsUpdate=!0,Promise.resolve(S)},r}(H(se));function pe(t,i){for(;!Object.prototype.hasOwnProperty.call(t,i)&&(t=_(t),t!==null););return t}function ie(t,i,r){return typeof Reflect!="undefined"&&Reflect.get?ie=Reflect.get:ie=function(a,e,o){var s=pe(a,e);if(!!s){var f=Object.getOwnPropertyDescriptor(s,e);return f.get?f.get.call(o||a):f.value}},ie(t,i,r)}function Oe(t,i,r){return ie(t,i,r)}var Ce=function(t){"use strict";C(r,t);var i=E(r);function r(a){T(this,r);var e;return e=i.call(this),e.scale=1,e.options=(0,j.Z)({},{scale:1,autoPlay:!0,loop:!0},a),e}var n=r.prototype;return n.getMaterial=function(){var e=this.options,o=e.src,s=e.transparent,f=e.blending,h=e.depthWrite,v=e.depthTest,m=e.format,y=e.autoPlay,b=e.loop,w=e.alphaTest,g=e.sprite,u=B(),M=document.createElement("video");return M.addEventListener("loadedmetadata",function(){var S=new c.VideoTexture(M);S.format=m!=null?m:c.RGBAFormat,S.needsUpdate=!0;var L=g?new c.SpriteMaterial({map:S,transparent:s!=null?s:!1,blending:f!=null?f:c.NormalBlending,depthWrite:h!=null?h:!0,depthTest:v!=null?v:!0,alphaTest:w!=null?w:0}):new c.MeshBasicMaterial({map:S,transparent:s!=null?s:!1,blending:f!=null?f:c.NormalBlending,depthWrite:h!=null?h:!0,depthTest:v!=null?v:!0,alphaTest:w!=null?w:0});u.resolve(L)},!1),M.src=o,M.muted=!0,M.autoplay=y,M.loop=b,M.preload="auto",u.promise},n.create=function(){var e=this;return(0,O.Z)(R().mark(function o(){var s,f,h,v,m,y,b;return R().wrap(function(g){for(;;)switch(g.prev=g.next){case 0:if(s=e.options,f=s.scale,h=s.position,v=s.src,m=s.cache,y=s.sprite,!m){g.next=7;break}return g.next=4,m.get(v,function(){return e.getMaterial()});case 4:g.t0=g.sent,g.next=10;break;case 7:return g.next=9,e.getMaterial();case 9:g.t0=g.sent;case 10:b=g.t0,e.video=b.map.image,y?e.createSprite(b):e.createMesh(new c[X](1,1),b),e.setScale(f),h&&e.object3d.position.copy(h);case 15:case"end":return g.stop()}},o)}))()},n.setScale=function(e){this.scale=e,this.object3d.scale.set(this.video.videoWidth*e,this.video.videoHeight*e,1)},n.render=function(){var e=this.options.autoPlay;e&&this.video.play()},n.dispose=function(){this.video.pause(),this.video.src="",this.video.load(),Oe(_(r.prototype),"dispose",this).call(this)},r}(d),Ae=function(t){"use strict";C(r,t);var i=E(r);function r(a){T(this,r);var e;return e=i.call(this),e.type_="node",e.options=(0,j.Z)({},{event:"click"},a),e}var n=r.prototype;return n.create=function(){var e=this.options,o=e.position,s=e.children,f=e.handler,h=e.event,v=document.createElement("div");this.element=v,v.appendChild(s),this.createCSS2DObject(v),o&&this.object3d.position.copy(o),f&&h&&this.clickTarge.forEach(function(m){var y=Array.isArray(h)?h:[h],b=Array.isArray(f)?f:[f];y.forEach(function(w,g){var u=b[g];u&&m.addEventListener(w,u)})})},n.getMaterial=function(e){return(0,O.Z)(R().mark(function o(){var s,f,h,v;return R().wrap(function(y){for(;;)switch(y.prev=y.next){case 0:return s=document.createElement("canvas"),s.width=256,s.height=256,f=s.getContext("2d"),f.fillStyle="#ff0000",f.fillRect(0,0,256,256),h=new c.CanvasTexture(s),v=new c.SpriteMaterial({map:h,opacity:e?1:0,transparent:!0,alphaTest:.1,sizeAttenuation:!1}),y.abrupt("return",v);case 9:case"end":return y.stop()}},o)}))()},n.createPickObject=function(e){var o=e.show,s=o===void 0?!1:o,f=e.scale,h=f===void 0?new c.Vector3(1,1,1):f,v=e.position,m=v===void 0?new c.Vector3(0,0,0):v,y=e.cache,b=this;return(0,O.Z)(R().mark(function w(){var g,u,M;return R().wrap(function(L){for(;;)switch(L.prev=L.next){case 0:if(g="node-create-pick-object",!y){L.next=7;break}return L.next=4,y.get(g,function(){return b.getMaterial(s)});case 4:L.t0=L.sent,L.next=10;break;case 7:return L.next=9,b.getMaterial(s);case 9:L.t0=L.sent;case 10:u=L.t0,M=new c.Sprite(u),M.scale.set(u.map.image.width*h.x,u.map.image.height*h.y,1),M.position.copy(m),b.add(M),b.pickObject=M;case 16:case"end":return L.stop()}},w)}))()},n.dispose=function(){var e=this.options,o=e.handler,s=e.event;o&&s&&this.clickTarge.forEach(function(f){var h=Array.isArray(s)?s:[s],v=Array.isArray(o)?o:[o];h.forEach(function(m,y){var b=v[y];b&&f.removeEventListener(m,b)})}),Oe(_(r.prototype),"dispose",this).call(this)},ee(r,[{key:"clickTarge",get:function(){var e=this,o=this.options.eventTarge;if(o){var s=o.map(function(f){return ne(e.element.querySelectorAll(f))}).flat();return s}return[this.element]}}]),r}(d),it=Ae,at=function(t){"use strict";C(r,t);var i=E(r);function r(){return T(this,r),i.apply(this,arguments)}var n=r.prototype;return n.create=function(){this.createGroup()},r}(d),ot=`
1
+ (function(){var it={666:function(T){var z=function(x){"use strict";var C=Object.prototype,j=C.hasOwnProperty,G,k=typeof Symbol=="function"?Symbol:{},Z=k.iterator||"@@iterator",I=k.asyncIterator||"@@asyncIterator",D=k.toStringTag||"@@toStringTag";function _(p,l,d){return Object.defineProperty(p,l,{value:d,enumerable:!0,configurable:!0,writable:!0}),p[l]}try{_({},"")}catch(p){_=function(l,d,P){return l[d]=P}}function F(p,l,d,P){var A=l&&l.prototype instanceof c?l:c,X=Object.create(A.prototype),se=new B(P||[]);return X._invoke=le(p,d,se),X}x.wrap=F;function H(p,l,d){try{return{type:"normal",arg:p.call(l,d)}}catch(P){return{type:"throw",arg:P}}}var $="suspendedStart",ae="suspendedYield",he="executing",ue="completed",E={};function c(){}function O(){}function W(){}var R={};_(R,Z,function(){return this});var ce=Object.getPrototypeOf,ee=ce&&ce(ce(Se([])));ee&&ee!==C&&j.call(ee,Z)&&(R=ee);var N=W.prototype=c.prototype=Object.create(R);O.prototype=W,_(N,"constructor",W),_(W,"constructor",O),O.displayName=_(W,D,"GeneratorFunction");function te(p){["next","throw","return"].forEach(function(l){_(p,l,function(d){return this._invoke(l,d)})})}x.isGeneratorFunction=function(p){var l=typeof p=="function"&&p.constructor;return l?l===O||(l.displayName||l.name)==="GeneratorFunction":!1},x.mark=function(p){return Object.setPrototypeOf?Object.setPrototypeOf(p,W):(p.__proto__=W,_(p,D,"GeneratorFunction")),p.prototype=Object.create(N),p},x.awrap=function(p){return{__await:p}};function re(p,l){function d(X,se,fe,pe){var ie=H(p[X],p,se);if(ie.type==="throw")pe(ie.arg);else{var Oe=ie.arg,Ce=Oe.value;return Ce&&typeof Ce=="object"&&j.call(Ce,"__await")?l.resolve(Ce.__await).then(function(Ae){d("next",Ae,fe,pe)},function(Ae){d("throw",Ae,fe,pe)}):l.resolve(Ce).then(function(Ae){Oe.value=Ae,fe(Oe)},function(Ae){return d("throw",Ae,fe,pe)})}}var P;function A(X,se){function fe(){return new l(function(pe,ie){d(X,se,pe,ie)})}return P=P?P.then(fe,fe):fe()}this._invoke=A}te(re.prototype),_(re.prototype,I,function(){return this}),x.AsyncIterator=re,x.async=function(p,l,d,P,A){A===void 0&&(A=Promise);var X=new re(F(p,l,d,P),A);return x.isGeneratorFunction(l)?X:X.next().then(function(se){return se.done?se.value:X.next()})};function le(p,l,d){var P=$;return function(X,se){if(P===he)throw new Error("Generator is already running");if(P===ue){if(X==="throw")throw se;return Te()}for(d.method=X,d.arg=se;;){var fe=d.delegate;if(fe){var pe=me(fe,d);if(pe){if(pe===E)continue;return pe}}if(d.method==="next")d.sent=d._sent=d.arg;else if(d.method==="throw"){if(P===$)throw P=ue,d.arg;d.dispatchException(d.arg)}else d.method==="return"&&d.abrupt("return",d.arg);P=he;var ie=H(p,l,d);if(ie.type==="normal"){if(P=d.done?ue:ae,ie.arg===E)continue;return{value:ie.arg,done:d.done}}else ie.type==="throw"&&(P=ue,d.method="throw",d.arg=ie.arg)}}}function me(p,l){var d=p.iterator[l.method];if(d===G){if(l.delegate=null,l.method==="throw"){if(p.iterator.return&&(l.method="return",l.arg=G,me(p,l),l.method==="throw"))return E;l.method="throw",l.arg=new TypeError("The iterator does not provide a 'throw' method")}return E}var P=H(d,p.iterator,l.arg);if(P.type==="throw")return l.method="throw",l.arg=P.arg,l.delegate=null,E;var A=P.arg;if(!A)return l.method="throw",l.arg=new TypeError("iterator result is not an object"),l.delegate=null,E;if(A.done)l[p.resultName]=A.value,l.next=p.nextLoc,l.method!=="return"&&(l.method="next",l.arg=G);else return A;return l.delegate=null,E}te(N),_(N,D,"Generator"),_(N,Z,function(){return this}),_(N,"toString",function(){return"[object Generator]"});function ne(p){var l={tryLoc:p[0]};1 in p&&(l.catchLoc=p[1]),2 in p&&(l.finallyLoc=p[2],l.afterLoc=p[3]),this.tryEntries.push(l)}function q(p){var l=p.completion||{};l.type="normal",delete l.arg,p.completion=l}function B(p){this.tryEntries=[{tryLoc:"root"}],p.forEach(ne,this),this.reset(!0)}x.keys=function(p){var l=[];for(var d in p)l.push(d);return l.reverse(),function P(){for(;l.length;){var A=l.pop();if(A in p)return P.value=A,P.done=!1,P}return P.done=!0,P}};function Se(p){if(p){var l=p[Z];if(l)return l.call(p);if(typeof p.next=="function")return p;if(!isNaN(p.length)){var d=-1,P=function A(){for(;++d<p.length;)if(j.call(p,d))return A.value=p[d],A.done=!1,A;return A.value=G,A.done=!0,A};return P.next=P}}return{next:Te}}x.values=Se;function Te(){return{value:G,done:!0}}return B.prototype={constructor:B,reset:function(p){if(this.prev=0,this.next=0,this.sent=this._sent=G,this.done=!1,this.delegate=null,this.method="next",this.arg=G,this.tryEntries.forEach(q),!p)for(var l in this)l.charAt(0)==="t"&&j.call(this,l)&&!isNaN(+l.slice(1))&&(this[l]=G)},stop:function(){this.done=!0;var p=this.tryEntries[0],l=p.completion;if(l.type==="throw")throw l.arg;return this.rval},dispatchException:function(p){if(this.done)throw p;var l=this;function d(pe,ie){return X.type="throw",X.arg=p,l.next=pe,ie&&(l.method="next",l.arg=G),!!ie}for(var P=this.tryEntries.length-1;P>=0;--P){var A=this.tryEntries[P],X=A.completion;if(A.tryLoc==="root")return d("end");if(A.tryLoc<=this.prev){var se=j.call(A,"catchLoc"),fe=j.call(A,"finallyLoc");if(se&&fe){if(this.prev<A.catchLoc)return d(A.catchLoc,!0);if(this.prev<A.finallyLoc)return d(A.finallyLoc)}else if(se){if(this.prev<A.catchLoc)return d(A.catchLoc,!0)}else if(fe){if(this.prev<A.finallyLoc)return d(A.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(p,l){for(var d=this.tryEntries.length-1;d>=0;--d){var P=this.tryEntries[d];if(P.tryLoc<=this.prev&&j.call(P,"finallyLoc")&&this.prev<P.finallyLoc){var A=P;break}}A&&(p==="break"||p==="continue")&&A.tryLoc<=l&&l<=A.finallyLoc&&(A=null);var X=A?A.completion:{};return X.type=p,X.arg=l,A?(this.method="next",this.next=A.finallyLoc,E):this.complete(X)},complete:function(p,l){if(p.type==="throw")throw p.arg;return p.type==="break"||p.type==="continue"?this.next=p.arg:p.type==="return"?(this.rval=this.arg=p.arg,this.method="return",this.next="end"):p.type==="normal"&&l&&(this.next=l),E},finish:function(p){for(var l=this.tryEntries.length-1;l>=0;--l){var d=this.tryEntries[l];if(d.finallyLoc===p)return this.complete(d.completion,d.afterLoc),q(d),E}},catch:function(p){for(var l=this.tryEntries.length-1;l>=0;--l){var d=this.tryEntries[l];if(d.tryLoc===p){var P=d.completion;if(P.type==="throw"){var A=P.arg;q(d)}return A}}throw new Error("illegal catch attempt")},delegateYield:function(p,l,d){return this.delegate={iterator:Se(p),resultName:l,nextLoc:d},this.method==="next"&&(this.arg=G),E}},x}(T.exports);try{regeneratorRuntime=z}catch(x){typeof globalThis=="object"?globalThis.regeneratorRuntime=z:Function("r","regeneratorRuntime = r")(z)}},695:function(T,z,x){"use strict";x.d(z,{Z:function(){return C}});function C(j){if(j.geometry&&j.geometry.dispose(),j.material){var G=Array.isArray(j.material)?j.material:[j.material];G.forEach(function(k){var Z,I,D,_,F,H,$,ae,he,ue,E,c,O;(Z=k.map)===null||Z===void 0||Z.dispose(),(I=k.lightMap)===null||I===void 0||I.dispose(),(D=k.bumpMap)===null||D===void 0||D.dispose(),(_=k.normalMap)===null||_===void 0||_.dispose(),(F=k.specularMap)===null||F===void 0||F.dispose(),(H=k.envMap)===null||H===void 0||H.dispose(),($=k.alphaMap)===null||$===void 0||$.dispose(),(ae=k.aoMap)===null||ae===void 0||ae.dispose(),(he=k.displacementMap)===null||he===void 0||he.dispose(),(ue=k.emissiveMap)===null||ue===void 0||ue.dispose(),(E=k.gradientMap)===null||E===void 0||E.dispose(),(c=k.metalnessMap)===null||c===void 0||c.dispose(),(O=k.roughnessMap)===null||O===void 0||O.dispose(),k.dispose()})}}},584:function(T,z,x){"use strict";x.d(z,{disposeMesh:function(){return k.Z}});var C=x(666),j=x.n(C),G=null,k=x(695),Z=x(644);function I(E){if(E.material){var c=Array.isArray(E.material)?E.material:[E.material];c.forEach(function(O){var W,R;(W=O.color)===null||W===void 0||W.convertSRGBToLinear(),(R=O.emissive)===null||R===void 0||R.convertSRGBToLinear(),O.map&&(O.map.encoding=THREE.sRGBEncoding),O.emissiveMap&&(O.emissiveMap.encoding=THREE.sRGBEncoding)})}}var D=x(568),_=x(924),F=x(360),H=x(484),$=null,ae=null,he=function(){var E=(0,D.Z)(j().mark(function c(O,W){var R,ce,ee,N,te,re,le,me,ne;return j().wrap(function(B){for(;;)switch(B.prev=B.next){case 0:return R=W.type,ce=R===void 0?"blob":R,ee=W.version,N=ee===void 0?"1":ee,B.next=4,(0,F.get)(O);case 4:if(re=B.sent,!(re&&re[N])){B.next=9;break}te=re[N],B.next=15;break;case 9:return B.next=11,(0,H.Z)(fetch(O).then(function(Se){if(Se.ok)return Se[ce]();throw new Error}));case 11:le=B.sent,me=le.res,ne=le.err,ne||(te=me,(0,F.set)(O,(0,_.Z)({},N,me)));case 15:return B.abrupt("return",te?{url:ce==="json"?O:URL.createObjectURL(te),store:te}:{url:O});case 16:case"end":return B.stop()}},c)}));return function(O,W){return E.apply(this,arguments)}}(),ue=x(705)},484:function(T,z,x){"use strict";x.d(z,{Z:function(){return j}});var C=x(42);function j(G){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return G.then(function(Z){return(0,C.Z)({err:null,res:Z},k)}).catch(function(Z){return(0,C.Z)({err:Z,res:void 0},k)})}},705:function(T,z,x){"use strict";x.d(z,{C:function(){return Z},y:function(){return k}});var C=x(644),j=x.n(C),G=new Map,k=function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{generateTopUV:function(D,_,F,H,$){var ae=_[F*3],he=_[F*3+1],ue=_[H*3],E=_[H*3+1],c=_[$*3],O=_[$*3+1],W;if(G.has(D))W=G.get(D);else{var R=I.box3||new C.Box3;if(!I.box3){var ce=D.parameters.shapes.getPoints();R.setFromArray(ce.map(function(le){return[le.x,le.y,0]}).flat())}var ee=R.getSize(new C.Vector3);I.split&&(ee.y/=I.split),W={box:R,size:ee},G.set(D,W)}var N=W.box,te=W.size,re=I.split?1-I.split:0;return[new C.Vector2((ae-N.min.x)/te.x,(he-N.min.y)/te.y+re),new C.Vector2((ue-N.min.x)/te.x,(E-N.min.y)/te.y+re),new C.Vector2((c-N.min.x)/te.x,(O-N.min.y)/te.y+re)]},generateSideWallUV:function(D,_,F,H,$,ae){var he=_[F*3],ue=_[F*3+1],E=_[F*3+2],c=_[H*3],O=_[H*3+1],W=_[H*3+2],R=_[$*3],ce=_[$*3+1],ee=_[$*3+2],N=_[ae*3],te=_[ae*3+1],re=_[ae*3+2],le;if(G.has(_))le=G.get(_);else{var me=new C.Box3;me.setFromArray(_);var ne=me.getSize(new C.Vector3);I.split&&(ne.z/=1-I.split),le={box:me,size:ne},G.set(_,le)}var q=le.box,B=le.size;return Math.abs(ue-O)<Math.abs(he-c)?[new C.Vector2((he-q.min.x)/B.x,(E-q.min.z)/B.z),new C.Vector2((c-q.min.x)/B.x,(W-q.min.z)/B.z),new C.Vector2((R-q.min.x)/B.x,(ee-q.min.z)/B.z),new C.Vector2((N-q.min.x)/B.x,(re-q.min.z)/B.z)]:[new C.Vector2((ue-q.min.y)/B.y,(E-q.min.z)/B.z),new C.Vector2((O-q.min.y)/B.y,(W-q.min.z)/B.z),new C.Vector2((ce-q.min.y)/B.y,(ee-q.min.z)/B.z),new C.Vector2((te-q.min.y)/B.y,(re-q.min.z)/B.z)]}}},Z=function(){G.clear()}},360:function(T){"use strict";T.exports=require("idb-keyval")},644:function(T){"use strict";T.exports=require("three")},568:function(T,z,x){"use strict";x.d(z,{Z:function(){return j}});function C(G,k,Z,I,D,_,F){try{var H=G[_](F),$=H.value}catch(ae){Z(ae);return}H.done?k($):Promise.resolve($).then(I,D)}function j(G){return function(){var k=this,Z=arguments;return new Promise(function(I,D){var _=G.apply(k,Z);function F($){C(_,I,D,F,H,"next",$)}function H($){C(_,I,D,F,H,"throw",$)}F(void 0)})}}},924:function(T,z,x){"use strict";x.d(z,{Z:function(){return C}});function C(j,G,k){return G in j?Object.defineProperty(j,G,{value:k,enumerable:!0,configurable:!0,writable:!0}):j[G]=k,j}},42:function(T,z,x){"use strict";x.d(z,{Z:function(){return j}});var C=x(924);function j(G){for(var k=1;k<arguments.length;k++){var Z=arguments[k]!=null?arguments[k]:{},I=Object.keys(Z);typeof Object.getOwnPropertySymbols=="function"&&(I=I.concat(Object.getOwnPropertySymbols(Z).filter(function(D){return Object.getOwnPropertyDescriptor(Z,D).enumerable}))),I.forEach(function(D){(0,C.Z)(G,D,Z[D])})}return G}}},Fe={};function Y(T){var z=Fe[T];if(z!==void 0)return z.exports;var x=Fe[T]={exports:{}};return it[T](x,x.exports,Y),x.exports}(function(){Y.n=function(T){var z=T&&T.__esModule?function(){return T.default}:function(){return T};return Y.d(z,{a:z}),z}})(),function(){Y.d=function(T,z){for(var x in z)Y.o(z,x)&&!Y.o(T,x)&&Object.defineProperty(T,x,{enumerable:!0,get:z[x]})}}(),function(){Y.o=function(T,z){return Object.prototype.hasOwnProperty.call(T,z)}}(),function(){Y.r=function(T){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(T,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(T,"__esModule",{value:!0})}}();var Be={};(function(){"use strict";Y.r(Be),Y.d(Be,{ConicPolygon:function(){return Tt},ConicPolygonGeometry:function(){return Je},ExtrudePolygon:function(){return kt},Group:function(){return ot},Image:function(){return se},Line:function(){return dt},MeshLine:function(){return we},MeshLineMaterial:function(){return We},MeshLineRaycast:function(){return Ne},Node:function(){return at},Text:function(){return fe},Video:function(){return Ce},getExtrudePolygonGeometry:function(){return Et},getLineGeometry:function(){return mt}});function T(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")}function z(t,i){return z=Object.setPrototypeOf||function(n,a){return n.__proto__=a,n},z(t,i)}function x(t,i){return z(t,i)}function C(t,i){if(typeof i!="function"&&i!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(i&&i.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),i&&x(t,i)}var j=Y(42);function G(){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(t){return!1}}function k(t,i,r){return G()?k=Reflect.construct:k=function(a,e,o){var s=[null];s.push.apply(s,e);var f=Function.bind.apply(a,s),h=new f;return o&&x(h,o.prototype),h},k.apply(null,arguments)}function Z(t,i,r){return k.apply(null,arguments)}function I(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function D(t){return D=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},D(t)}function _(t){return D(t)}function F(t){var i=typeof Map=="function"?new Map:void 0;return F=function(n){if(n===null||!I(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof i!="undefined"){if(i.has(n))return i.get(n);i.set(n,a)}function a(){return Z(n,arguments,_(this).constructor)}return a.prototype=Object.create(n.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),x(a,n)},F(t)}function H(t){return F(t)}function $(){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(t){return!1}}function ae(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function he(t){return t&&t.constructor===Symbol?"symbol":typeof t}function ue(t,i){return i&&(he(i)==="object"||typeof i=="function")?i:ae(t)}function E(t){var i=$();return function(){var n=_(t),a;if(i){var e=_(this).constructor;a=Reflect.construct(n,arguments,e)}else a=n.apply(this,arguments);return ue(this,a)}}var c=Y(644),O=Y(568),W=Y(666),R=Y.n(W);function ce(t,i){for(var r=0;r<i.length;r++){var n=i[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function ee(t,i,r){return i&&ce(t.prototype,i),r&&ce(t,r),t}function N(t,i){(i==null||i>t.length)&&(i=t.length);for(var r=0,n=new Array(i);r<i;r++)n[r]=t[r];return n}function te(t){if(Array.isArray(t))return N(t)}function re(t){if(typeof Symbol!="undefined"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function le(){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 me(t,i){if(!!t){if(typeof t=="string")return N(t,i);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return N(t,i)}}function ne(t){return te(t)||re(t)||me(t)||le()}var q=Y(484);function B(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r={};return r.promise=new Promise(function(n,a){r.resolve=n,r.reject=a}),t&&(r.promise=(0,q.Z)(r.promise,i)),r}var Se=require("three/examples/jsm/renderers/CSS2DRenderer"),Te=require("three/examples/jsm/renderers/CSS3DRenderer"),p=Y(584),l=function(t){t&&((0,p.disposeMesh)(t),t.children.forEach(function(i){i.userData.BaseObject_||l(i)}))},d=function(){"use strict";function t(){T(this,t),this.objecttype__="BaseObject",this.userData={},this.pm=B(),this.visible=!1}var i=t.prototype;return i.init=function(){},i.create=function(){},i.render=function(){},i.update=function(n,a){},i.resize=function(n,a){},i.show=function(){return this.object3d&&(this.object3d.visible=!0),this.visible=!0,this},i.hide=function(){return this.object3d&&(this.object3d.visible=!1),this.visible=!1,this},i.isVisible=function(){return this.visible},i.createMesh=function(){for(var n=arguments.length,a=new Array(n),e=0;e<n;e++)a[e]=arguments[e];return this.object3d=Z(c.Mesh,ne(a)),this},i.createGroup=function(){return this.object3d=new c.Group,this},i.createPoints=function(){for(var n=arguments.length,a=new Array(n),e=0;e<n;e++)a[e]=arguments[e];return this.object3d=Z(c.Points,ne(a)),this},i.createCSS2DObject=function(n){return this.object3d=new Se.CSS2DObject(n),this},i.createCSS3DObject=function(n){return this.object3d=new Te.CSS3DObject(n),this},i.createCSS3DSprite=function(n){return this.object3d=new Te.CSS3DSprite(n),this},i.createSprite=function(n){return this.object3d=new c.Sprite(n),this},i.add=function(){for(var n=arguments.length,a=new Array(n),e=0;e<n;e++)a[e]=arguments[e];var o;return(o=this.object3d).add.apply(o,ne(a)),this},i.remove=function(){for(var n=arguments.length,a=new Array(n),e=0;e<n;e++)a[e]=arguments[e];var o;return(o=this.object3d).remove.apply(o,ne(a)),this},i.getSize=function(){var n=new c.Box3().setFromObject(this.object3d);return{min:n.min,max:n.max,size:n.getSize(new c.Vector3)}},i.traverse=function(n){n(this),this.children.forEach(function(a){a.traverse(n)})},i.dispose=function(){l(this.object3d)},ee(t,[{key:"parent",get:function(){var n=this.object3d.parent;return(n==null?void 0:n.userData.BaseObject_)||this.pencil.scene}},{key:"children",get:function(){return this.object3d.children.map(function(n){return n.userData.BaseObject_}).filter(function(n){return!!n})}}]),t}(),P=+c.REVISION<144,A=P?"ExtrudeBufferGeometry":"ExtrudeGeometry",X=P?"PlaneBufferGeometry":"PlaneGeometry",se=function(t){"use strict";C(r,t);var i=E(r);function r(a){T(this,r);var e;return e=i.call(this),e.scale=1,e.options=(0,j.Z)({},{scale:1},a),e}var n=r.prototype;return n.getMaterial=function(){var e=this;return(0,O.Z)(R().mark(function o(){var s,f,h,v,m,y,b,w,g,u;return R().wrap(function(S){for(;;)switch(S.prev=S.next){case 0:return s=e.options,f=s.transparent,h=s.blending,v=s.depthWrite,m=s.depthTest,y=s.alphaTest,b=s.sprite,w=s.sizeAttenuation,S.next=3,e.getTexture();case 3:return g=S.sent,u=b?new c.SpriteMaterial({map:g,transparent:f!=null?f:!1,blending:h!=null?h:c.NormalBlending,depthWrite:v!=null?v:!0,depthTest:m!=null?m:!0,alphaTest:y!=null?y:0,sizeAttenuation:w!=null?w:!0}):new c.MeshBasicMaterial({map:g,transparent:f!=null?f:!1,blending:h!=null?h:c.NormalBlending,depthWrite:v!=null?v:!0,depthTest:m!=null?m:!0,alphaTest:y!=null?y:0}),S.abrupt("return",u);case 6:case"end":return S.stop()}},o)}))()},n.create=function(){var e=this;return(0,O.Z)(R().mark(function o(){var s,f,h,v,m,y,b,w;return R().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(s=e.options,f=s.scale,h=s.position,v=s.src,m=s.cache,y=s.sprite,b=v,!m){u.next=8;break}return u.next=5,m.get(b,function(){return e.getMaterial()});case 5:u.t0=u.sent,u.next=11;break;case 8:return u.next=10,e.getMaterial();case 10:u.t0=u.sent;case 11:w=u.t0,e.texture=w.map,y?e.createSprite(w):e.createMesh(new c[X](1,1),w),e.setScale(f),h&&e.object3d.position.copy(h);case 16:case"end":return u.stop()}},o)}))()},n.setScale=function(e){this.scale=e,this.object3d.scale.set(this.texture.image.width*e,this.texture.image.height*e,1)},n.setTexture=function(e){var o=this.object3d;o.material.map&&o.material.map.dispose(),o.material.map=e,o.material.needsUpdate=!0,this.texture=e,this.setScale(this.scale)},n.getTexture=function(){var e=this.options.src;return new c.TextureLoader().loadAsync(e)},r}(d),fe=function(t){"use strict";C(r,t);var i=E(r);function r(a){T(this,r);var e;return e=i.call(this,a),e.canvas=document.createElement("canvas"),e}var n=r.prototype;return n.getTexture=function(){var e=this.options,o=e.text,s=e.textOptions,f=(0,j.Z)({},{fontSize:28,fontFamily:"system-ui,-apple-system,BlinkMacSystemFont,sans-serif",fontWeight:"normal",flipX:!1,color:"#ffffff",setCtx:function(L){}},s||{}),h=f.fontSize,v=f.fontFamily,m=f.fontWeight,y=f.flipX,b=f.color,w=f.setCtx,g=this.canvas;g.width=h*o.length*2,g.height=h;var u=g.getContext("2d");u.font="".concat(m," ").concat(h,"px/1 ").concat(v);var M=u.measureText(o).width;g.width=M,u=g.getContext("2d"),u.clearRect(0,0,g.width,g.height),y&&u.scale(-1,1),u.font="".concat(m," ").concat(h,"px/1 ").concat(v),u.textBaseline="middle",u.fillStyle=b,w&&w(u),u.fillText(o,y?M*-1:0,g.height/2),u.restore();var S=new c.Texture(g);return S.anisotropy=this.pencil.renderer.capabilities.getMaxAnisotropy(),S.needsUpdate=!0,Promise.resolve(S)},r}(H(se));function pe(t,i){for(;!Object.prototype.hasOwnProperty.call(t,i)&&(t=_(t),t!==null););return t}function ie(t,i,r){return typeof Reflect!="undefined"&&Reflect.get?ie=Reflect.get:ie=function(a,e,o){var s=pe(a,e);if(!!s){var f=Object.getOwnPropertyDescriptor(s,e);return f.get?f.get.call(o||a):f.value}},ie(t,i,r)}function Oe(t,i,r){return ie(t,i,r)}var Ce=function(t){"use strict";C(r,t);var i=E(r);function r(a){T(this,r);var e;return e=i.call(this),e.scale=1,e.options=(0,j.Z)({},{scale:1,autoPlay:!0,loop:!0},a),e}var n=r.prototype;return n.getMaterial=function(){var e=this.options,o=e.src,s=e.transparent,f=e.blending,h=e.depthWrite,v=e.depthTest,m=e.format,y=e.autoPlay,b=e.loop,w=e.alphaTest,g=e.sprite,u=B(),M=document.createElement("video");return M.addEventListener("loadedmetadata",function(){var S=new c.VideoTexture(M);S.format=m!=null?m:c.RGBAFormat,S.needsUpdate=!0;var L=g?new c.SpriteMaterial({map:S,transparent:s!=null?s:!1,blending:f!=null?f:c.NormalBlending,depthWrite:h!=null?h:!0,depthTest:v!=null?v:!0,alphaTest:w!=null?w:0}):new c.MeshBasicMaterial({map:S,transparent:s!=null?s:!1,blending:f!=null?f:c.NormalBlending,depthWrite:h!=null?h:!0,depthTest:v!=null?v:!0,alphaTest:w!=null?w:0});u.resolve(L)},!1),M.src=o,M.muted=!0,M.autoplay=y,M.loop=b,M.preload="auto",u.promise},n.create=function(){var e=this;return(0,O.Z)(R().mark(function o(){var s,f,h,v,m,y,b;return R().wrap(function(g){for(;;)switch(g.prev=g.next){case 0:if(s=e.options,f=s.scale,h=s.position,v=s.src,m=s.cache,y=s.sprite,!m){g.next=7;break}return g.next=4,m.get(v,function(){return e.getMaterial()});case 4:g.t0=g.sent,g.next=10;break;case 7:return g.next=9,e.getMaterial();case 9:g.t0=g.sent;case 10:b=g.t0,e.video=b.map.image,y?e.createSprite(b):e.createMesh(new c[X](1,1),b),e.setScale(f),h&&e.object3d.position.copy(h);case 15:case"end":return g.stop()}},o)}))()},n.setScale=function(e){this.scale=e,this.object3d.scale.set(this.video.videoWidth*e,this.video.videoHeight*e,1)},n.render=function(){var e=this.options.autoPlay;e&&this.video.play()},n.dispose=function(){this.video.pause(),this.video.src="",this.video.load(),Oe(_(r.prototype),"dispose",this).call(this)},r}(d),Ae=function(t){"use strict";C(r,t);var i=E(r);function r(a){T(this,r);var e;return e=i.call(this),e.type_="node",e.options=(0,j.Z)({},{event:"click"},a),e}var n=r.prototype;return n.create=function(){var e=this.options,o=e.position,s=e.children,f=e.handler,h=e.event,v=document.createElement("div");this.element=v,v.appendChild(s),this.createCSS2DObject(v),o&&this.object3d.position.copy(o),f&&h&&this.clickTarge.forEach(function(m){var y=Array.isArray(h)?h:[h],b=Array.isArray(f)?f:[f];y.forEach(function(w,g){var u=b[g];u&&m.addEventListener(w,u)})})},n.getMaterial=function(e){return(0,O.Z)(R().mark(function o(){var s,f,h,v;return R().wrap(function(y){for(;;)switch(y.prev=y.next){case 0:return s=document.createElement("canvas"),s.width=256,s.height=256,f=s.getContext("2d"),f.fillStyle="#ff0000",f.fillRect(0,0,256,256),h=new c.CanvasTexture(s),v=new c.SpriteMaterial({map:h,opacity:e?1:0,transparent:!0,alphaTest:.1,sizeAttenuation:!1}),y.abrupt("return",v);case 9:case"end":return y.stop()}},o)}))()},n.createPickObject=function(e){var o=e.show,s=o===void 0?!1:o,f=e.scale,h=f===void 0?new c.Vector3(1,1,1):f,v=e.position,m=v===void 0?new c.Vector3(0,0,0):v,y=e.cache,b=this;return(0,O.Z)(R().mark(function w(){var g,u,M;return R().wrap(function(L){for(;;)switch(L.prev=L.next){case 0:if(g="node-create-pick-object",!y){L.next=7;break}return L.next=4,y.get(g,function(){return b.getMaterial(s)});case 4:L.t0=L.sent,L.next=10;break;case 7:return L.next=9,b.getMaterial(s);case 9:L.t0=L.sent;case 10:u=L.t0,M=new c.Sprite(u),M.scale.set(u.map.image.width*h.x,u.map.image.height*h.y,1),M.position.copy(m),b.add(M),b.pickObject=M;case 16:case"end":return L.stop()}},w)}))()},n.dispose=function(){var e=this.options,o=e.handler,s=e.event;o&&s&&this.clickTarge.forEach(function(f){var h=Array.isArray(s)?s:[s],v=Array.isArray(o)?o:[o];h.forEach(function(m,y){var b=v[y];b&&f.removeEventListener(m,b)})}),Oe(_(r.prototype),"dispose",this).call(this)},ee(r,[{key:"clickTarge",get:function(){var e=this,o=this.options.eventTarge;if(o){var s=o.map(function(f){return ne(e.element.querySelectorAll(f))}).flat();return s}return[this.element]}}]),r}(d),at=Ae,ot=function(t){"use strict";C(r,t);var i=E(r);function r(){return T(this,r),i.apply(this,arguments)}var n=r.prototype;return n.create=function(){this.createGroup()},r}(d),st=`
2
2
  `.concat(c.ShaderChunk.logdepthbuf_pars_vertex,`
3
3
  `).concat(c.ShaderChunk.fog_pars_vertex,`
4
4
  attribute vec3 previous;
@@ -95,7 +95,7 @@
95
95
  vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
96
96
  `).concat(c.ShaderChunk.fog_vertex,`
97
97
  }
98
- `),st=`
98
+ `),ut=`
99
99
  `.concat(c.ShaderChunk.fog_pars_fragment,`
100
100
  `).concat(c.ShaderChunk.logdepthbuf_pars_fragment,`
101
101
 
@@ -129,4 +129,4 @@ void main() {
129
129
  gl_FragColor.a *= step(vCounters, visibility);
130
130
  `).concat(c.ShaderChunk.fog_fragment,`
131
131
  }
132
- `),we=function(t){"use strict";C(r,t);var i=E(r);function r(){T(this,r);var n;return n=i.call(this),n.isMeshLine=!0,n.type="MeshLine",n.positions=[],n.previous=[],n.next=[],n.side=[],n.width=[],n.indices_array=[],n.uvs=[],n.counters=[],n._points=[],n._geom=null,n.widthCallback=null,n.matrixWorld=new c.Matrix4,Object.defineProperties(ae(n),{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(e){this.setGeometry(e,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(e){this.setPoints(e,this.widthCallback)}}}),n}return r}(c.BufferGeometry);we.prototype.setMatrixWorld=function(t){this.matrixWorld=t},we.prototype.setGeometry=function(t,i){this._geometry=t,this.setPoints(t.getAttribute("position").array,i)},we.prototype.setPoints=function(t,i){if(!(t instanceof Float32Array)&&!(t instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=t,this.widthCallback=i,this.positions=[],this.counters=[],t.length&&t[0]instanceof c.Vector3)for(var r=0;r<t.length;r++){var n=t[r],a=r/t.length;this.positions.push(n.x,n.y,n.z),this.positions.push(n.x,n.y,n.z),this.counters.push(a),this.counters.push(a)}else for(var r=0;r<t.length;r+=3){var a=r/t.length;this.positions.push(t[r],t[r+1],t[r+2]),this.positions.push(t[r],t[r+1],t[r+2]),this.counters.push(a),this.counters.push(a)}this.process()};function Ne(t,i){var r=new c.Matrix4,n=new c.Ray,a=new c.Sphere,e=new c.Vector3,o=this.geometry;if(o.boundingSphere||o.computeBoundingSphere(),a.copy(o.boundingSphere),a.applyMatrix4(this.matrixWorld),t.ray.intersectSphere(a,e)!==!1){r.copy(this.matrixWorld).invert(),n.copy(t.ray).applyMatrix4(r);var s=new c.Vector3,f=new c.Vector3,h=new c.Vector3,v=this instanceof c.LineSegments?2:1,m=o.index,y=o.attributes;if(m!==null)for(var b=m.array,w=y.position.array,g=y.width.array,u=0,M=b.length-1;u<M;u+=v){var S=b[u],L=b[u+1];s.fromArray(w,S*3),f.fromArray(w,L*3);var V=g[Math.floor(u/3)]!==void 0?g[Math.floor(u/3)]:1,J=t.params.Line.threshold+this.material.lineWidth*V/2,oe=J*J,U=n.distanceSqToSegment(s,f,e,h);if(!(U>oe)){e.applyMatrix4(this.matrixWorld);var ve=t.ray.origin.distanceTo(e);ve<t.near||ve>t.far||(i.push({distance:ve,point:h.clone().applyMatrix4(this.matrixWorld),index:u,face:null,faceIndex:null,object:this}),u=M)}}}}we.prototype.raycast=Ne,we.prototype.compareV3=function(t,i){var r=t*6,n=i*6;return this.positions[r]===this.positions[n]&&this.positions[r+1]===this.positions[n+1]&&this.positions[r+2]===this.positions[n+2]},we.prototype.copyV3=function(t){var i=t*6;return[this.positions[i],this.positions[i+1],this.positions[i+2]]},we.prototype.process=function(){var t=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var i,r;this.compareV3(0,t-1)?r=this.copyV3(t-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 n=0;n<t;n++){if(this.side.push(1),this.side.push(-1),this.widthCallback?i=this.widthCallback(n/(t-1)):i=1,this.width.push(i),this.width.push(i),this.uvs.push(n/(t-1),0),this.uvs.push(n/(t-1),1),n<t-1){r=this.copyV3(n),this.previous.push(r[0],r[1],r[2]),this.previous.push(r[0],r[1],r[2]);var a=n*2;this.indices_array.push(a,a+1,a+2),this.indices_array.push(a+2,a+1,a+3)}n>0&&(r=this.copyV3(n),this.next.push(r[0],r[1],r[2]),this.next.push(r[0],r[1],r[2]))}this.compareV3(t-1,0)?r=this.copyV3(1):r=this.copyV3(t-1),this.next.push(r[0],r[1],r[2]),this.next.push(r[0],r[1],r[2]),!this._attributes||this._attributes.position.count!==this.positions.length?this._attributes={position:new c.BufferAttribute(new Float32Array(this.positions),3),previous:new c.BufferAttribute(new Float32Array(this.previous),3),next:new c.BufferAttribute(new Float32Array(this.next),3),side:new c.BufferAttribute(new Float32Array(this.side),1),width:new c.BufferAttribute(new Float32Array(this.width),1),uv:new c.BufferAttribute(new Float32Array(this.uvs),2),index:new c.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new c.BufferAttribute(new Float32Array(this.counters),1)}:(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()};function Ve(t,i,r,n,a){var e;if(t=t.subarray||t.slice?t:t.buffer,r=r.subarray||r.slice?r:r.buffer,t=i?t.subarray?t.subarray(i,a&&i+a):t.slice(i,a&&i+a):t,r.set)r.set(t,n);else for(e=0;e<t.length;e++)r[e+n]=t[e];return r}we.prototype.advance=function(t){var i=this._attributes.position.array,r=this._attributes.previous.array,n=this._attributes.next.array,a=i.length;Ve(i,0,r,0,a),Ve(i,6,i,0,a-6),i[a-6]=t.x,i[a-5]=t.y,i[a-4]=t.z,i[a-3]=t.x,i[a-2]=t.y,i[a-1]=t.z,Ve(i,6,n,0,a-6),n[a-6]=t.x,n[a-5]=t.y,n[a-4]=t.z,n[a-3]=t.x,n[a-2]=t.y,n[a-1]=t.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0},c.ShaderChunk.meshline_vert=ot,c.ShaderChunk.meshline_frag=st;var We=function(t){"use strict";C(r,t);var i=E(r);function r(n){T(this,r);var a;return a=i.call(this,{uniforms:Object.assign({},c.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new c.Color(16777215)},opacity:{value:1},resolution:{value:new c.Vector2(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new c.Vector2(1,1)},offset:{value:new c.Vector2(1,1)},lineLightAnimation:{value:1},time:{value:0},size:{value:300},speed:{value:.3},lightWidth:{value:.1},uCenter:{value:new c.Vector2(0,0)},lightColor:{value:new c.Color(16777215)}}),vertexShader:c.ShaderChunk.meshline_vert,fragmentShader:c.ShaderChunk.meshline_frag}),a.isMeshLineMaterial=!0,a.type="MeshLineMaterial",Object.defineProperties(ae(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(n),a}return r}(c.ShaderMaterial);We.prototype.copy=function(t){return c.ShaderMaterial.prototype.copy.call(this,t),this.lineWidth=t.lineWidth,this.map=t.map,this.useMap=t.useMap,this.alphaMap=t.alphaMap,this.useAlphaMap=t.useAlphaMap,this.color.copy(t.color),this.opacity=t.opacity,this.resolution.copy(t.resolution),this.sizeAttenuation=t.sizeAttenuation,this.dashArray.copy(t.dashArray),this.dashOffset.copy(t.dashOffset),this.dashRatio.copy(t.dashRatio),this.useDash=t.useDash,this.visibility=t.visibility,this.alphaTest=t.alphaTest,this.repeat.copy(t.repeat),this};function ut(t,i){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);i&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function Ke(t,i){return i=i!=null?i:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):ut(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))}),t}function ct(t,i){if(t==null)return{};var r={},n=Object.keys(t),a,e;for(e=0;e<n.length;e++)a=n[e],!(i.indexOf(a)>=0)&&(r[a]=t[a]);return r}function lt(t,i){if(t==null)return{};var r=ct(t,i),n,a;if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);for(a=0;a<e.length;a++)n=e[a],!(i.indexOf(n)>=0)&&(!Object.prototype.propertyIsEnumerable.call(t,n)||(r[n]=t[n]))}return r}function ft(t){if(Array.isArray(t))return t}function ht(){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 ge(t,i){return ft(t)||re(t,i)||me(t,i)||ht()}var He=require("popmotion"),je=require("three/examples/jsm//utils/BufferGeometryUtils");function $e(t){var i=t.setPointWidth,r=t.nodes,n=new c.BufferGeometry,a=new we;return n.setFromPoints(r),a.setGeometry(n,i),a}var pt={color:new c.Color("#ffffff"),lineWidth:1},vt=function(t){"use strict";C(r,t);var i=E(r);function r(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r);var e;return e=i.call(this),e.options=(0,j.Z)({},pt,a),e}var n=r.prototype;return n.create=function(){var e=this;return(0,O.Z)(R().mark(function o(){var s,f,h,v,m,y,b,w,g,u,M,S,L,V,J,oe,U,ve,de;return R().wrap(function(Q){for(;;)switch(Q.prev=Q.next){case 0:if(s=e.options,f=s.duration,h=s.delay,v=s.onComplete,m=s.setPointWidth,y=s.key,b=s.nodes,w=s.nodesArr,g=s.geometry,u=s.geometryArr,M=s.useGroups,S=s.material,L=s.cache,V=s.cacheKey,J=lt(s,["duration","delay","onComplete","setPointWidth","key","nodes","nodesArr","geometry","geometryArr","useGroups","material","cache","cacheKey"]),oe=S,U=g,oe){Q.next=15;break}if(ve="LineMaterial:".concat(V),!L){Q.next=11;break}return Q.next=8,L.get(ve,function(){return e.getMaterial((0,j.Z)({},J))});case 8:Q.t0=Q.sent,Q.next=14;break;case 11:return Q.next=13,e.getMaterial((0,j.Z)({},J));case 13:Q.t0=Q.sent;case 14:oe=Q.t0;case 15:!U&&b?U=$e({nodes:b,setPointWidth:m}):!U&&w?U=je.mergeBufferGeometries(w.map(function(Pe){return $e({nodes:Pe,setPointWidth:m})}),M!=null?M:!1):!U&&u&&u.length>1?U=je.mergeBufferGeometries(u,M!=null?M:!1):!U&&u&&u.length===1&&(de=ge(u,1),U=de[0]),e.createMesh(U,oe);case 17:case"end":return Q.stop()}},o)}))()},n.getMaterial=function(e){var o=this.pencil.getSize(),s=o.width,f=o.height,h=new We(Ke((0,j.Z)({},e),{resolution:new c.Vector2(s,f)}));return h},n.addGeometries=function(e){var o=this.object3d,s=je.mergeBufferGeometries([o.geometry].concat(ne(e)),!1);o.geometry=s},n.resize=function(e,o){this.material.uniforms.resolution.value.set(e,o)},n.animate=function(){var e=this.options,o=e.duration,s=e.delay,f=e.onComplete,h=this.material.uniforms.offset,v=s!=null?s:0,m=(0,He.animate)({from:h.value,to:{x:0},duration:o!=null?o:1e3,elapsed:-v,repeat:1/0,onComplete:f,ease:He.linear,onUpdate:function(y){h.value.x=y.x}});this.tween=m},n.dispose=function(){var e;Oe(_(r.prototype),"dispose",this).call(this),(e=this.tween)===null||e===void 0||e.stop()},ee(r,[{key:"material",get:function(){return this.object3d.material}}]),r}(d);function dt(t){var i=t.worker,r=t.workerKey,n=t.coordinatesArr,a=t.lineWidth,e=t.projection,o=t.cacheVersion;return new Promise(function(s,f){i.postMessage({coordinatesArr:n,lineWidth:a,projection:e,workerKey:r},{cb:function(h){try{var v=new c.BufferGeometry;Object.keys(h).forEach(function(m){m==="index"?v.setIndex(new c.BufferAttribute(h[m].array,h[m].itemSize)):v.setAttribute(m,new c.BufferAttribute(h[m].array,h[m].itemSize))}),s(v)}catch(m){i.postMessage({delCache:!0,workerKey:r},{cb:f,cacheVersion:o})}},cacheVersion:o})})}var Le=require("d3-array"),mt=require("earcut"),De=Y.n(mt),gt=require("@turf/boolean-clockwise"),yt=Y.n(gt);function bt(t,i){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=(90-i)*Math.PI/180,a=(90-t)*Math.PI/180;return[r*Math.sin(n)*Math.cos(a),r*Math.cos(n),r*Math.sin(n)*Math.sin(a)]}var wt=require("delaunator"),_t=Y.n(wt),Mt=require("@turf/boolean-point-in-polygon"),xt=Y.n(Mt),ke=require("d3-geo"),At=require("d3-geo-voronoi"),qe=require("d3-scale");function Pt(t,i){return t.map(function(r){var n=[],a;return r.forEach(function(e){if(a){var o=(0,ke.geoDistance)(e,a)*180/Math.PI;if(o>i)for(var s=(0,ke.geoInterpolate)(a,e),f=1/Math.ceil(o/i),h=f;h<1;)n.push(s(h)),h+=f}n.push(a=e)}),n})}function St(t){for(var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=i.minLng,n=i.maxLng,a=i.minLat,e=i.maxLat,o=Math.round(Math.pow(360/t,2)/Math.PI),s=(1+Math.sqrt(5))/2,f=function(u){return u/s*360%360-180},h=function(u){return Math.acos(2*u/o-1)/Math.PI*180-90},v=function(u){return o*(Math.cos((u+90)*Math.PI/180)+1)/2},m=[e!==void 0?Math.ceil(v(e)):0,a!==void 0?Math.floor(v(a)):o-1],y=r===void 0&&n===void 0?function(){return!0}:r===void 0?function(u){return u<=n}:n===void 0?function(u){return u>=r}:n>=r?function(u){return u>=r&&u<=n}:function(u){return u>=r||u<=n},b=[],w=m[0];w<=m[1];w++){var g=f(w);y(g)&&b.push([g,h(w)])}return b}function Ue(t,i){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return r?(0,ke.geoContains)(i,t):xt()(t,i)}function Ot(t,i){var r={type:"Polygon",coordinates:t},n=ge((0,ke.geoBounds)(r),2),a=ge(n[0],2),e=a[0],o=a[1],s=ge(n[1],2),f=s[0],h=s[1];if(Math.min(Math.abs(f-e),Math.abs(h-o))<i)return[];var v=e>f||h>=89||o<=-89;return St(i,{minLng:e,maxLng:f,minLat:o,maxLat:h}).filter(function(m){return Ue(m,r,v)})}function Ct(t){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=i.resolution,n=r===void 0?1/0:r,a=Pt(t,n),e=(0,Le.merge)(a),o=Ot(t,n),s=ne(e).concat(ne(o)),f={type:"Polygon",coordinates:t},h=ge((0,ke.geoBounds)(f),2),v=ge(h[0],2),m=v[0],y=v[1],b=ge(h[1],2),w=b[0],g=b[1],u=m>w||g>=89||y<=-89,M=[];if(u){var S=(0,At.geoVoronoi)(s).triangles(),L=new Map(s.map(function(K,Me){var ye=ge(K,2),be=ye[0],Ge=ye[1];return["".concat(be,"-").concat(Ge),Me]}));S.features.forEach(function(K){var Me,ye=K.geometry.coordinates[0].slice(0,3).reverse(),be=[];if(ye.forEach(function(ze){var xe=ge(ze,2),Ie=xe[0],Rt=xe[1],rt="".concat(Ie,"-").concat(Rt);L.has(rt)&&be.push(L.get(rt))}),be.length===3){if(be.some(function(ze){return ze<e.length})){var Ge=K.properties.circumcenter;if(!Ue(Ge,f,u))return}(Me=M).push.apply(Me,ne(be))}})}else if(o.length)for(var ve=function(K,Me){var ye,be=[2,1,0].map(function(xe){return de.triangles[K+xe]}),Ge=be.map(function(xe){return s[xe]});if(be.some(function(xe){return xe<e.length})){var ze=[0,1].map(function(xe){return(0,Le.mean)(Ge,function(Ie){return Ie[xe]})});if(!Ue(ze,f,u))return"continue"}(ye=M).push.apply(ye,ne(be))},de=_t().from(s),_e=0,Q=de.triangles.length;_e<Q;_e+=3)ve(_e,Q);else{var V=De().flatten(a),J=V.vertices,oe=V.holes,U=oe===void 0?[]:oe;M=De()(J,U,2)}var Pe=(0,qe.scaleLinear)((0,Le.extent)(s,function(K){return K[0]}),[0,1]),Ee=(0,qe.scaleLinear)((0,Le.extent)(s,function(K){return K[1]}),[0,1]),Re=s.map(function(K){var Me=ge(K,2),ye=Me[0],be=Me[1];return[Pe(ye),Ee(be)]}),tt={points:s,indices:M,uvs:Re};return{contour:a,triangles:tt}}var jt=Ct,Xe=new c.BufferGeometry().setAttribute?"setAttribute":"addAttribute";function Ze(t,i){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,n=t.map(function(a){return a.map(function(e){var o=ge(e,2),s=o[0],f=o[1];return r?bt(s,f,i):[s,f,i]})});return De().flatten(n)}function Ye(t,i,r){for(var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=Ze(t,i,n),e=a.vertices,o=a.holes,s=Ze(t,r,n),f=s.vertices,h=(0,Le.merge)([f,e]),v=Math.round(f.length/3),m=new Set(o),y=0,b=[],w=0;w<v;w++){var g=w+1;if(g===v)g=y;else if(m.has(g)){var u=g;g=y,y=u}b.push(w,w+v,g+v),b.push(g+v,g,w)}for(var M=[],S=1;S>=0;S--)for(var L=0;L<v;L+=1)M.push(L/(v-1),S);return{indices:b,vertices:h,uvs:M,topVerts:f}}function Qe(t,i,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return{indices:n?t.indices:t.indices.slice().reverse(),vertices:Ze([t.points],i,a).vertices,uvs:r}}var Lt=function(t){"use strict";C(r,t);var i=E(r);function r(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};T(this,r);var e;e=i.call(this),e.type="PolygonBufferGeometry",e.parameters=(0,j.Z)({},{polygonGeoJson:n,startHeight:0,endHeight:1,closedBottom:!0,closedTop:!0,includeSides:!0,curvatureResolution:5,cartesian:!0,userDataRsoOffset:0},a);var o=e.parameters,s=o.startHeight,f=o.endHeight,h=o.closedBottom,v=o.closedTop,m=o.includeSides,y=o.curvatureResolution,b=o.cartesian,w=o.userDataRsoOffset;yt()(n[0])||n[0].reverse();var g=jt(n,{resolution:y}),u=g.contour,M=g.triangles,S=(0,Le.merge)(M.uvs),L=[],V=[],J=[],oe=0,U=function(de){var _e=Math.round(L.length/3),Q=J.length;L=L.concat(de.vertices),V=V.concat(de.uvs),J=J.concat(_e?de.indices.map(function(Pe){return Pe+_e}):de.indices),e.addGroup(Q,J.length-Q,oe++)};if(m){var ve=Ye(u,s,f,b);U(ve),e.userData.rso=w?Ye(u,s,f+w,b):ve}return h&&U(Qe(M,s,S,!1,b)),v&&U(Qe(M,f,S,!0,b)),e.setIndex(J),e[Xe]("position",new c.Float32BufferAttribute(L,3)),e[Xe]("uv",new c.Float32BufferAttribute(V,2)),e.computeVertexNormals(),e}return r}(c.BufferGeometry),Tt=function(t){"use strict";C(r,t);var i=E(r);function r(a){T(this,r);var e;return e=i.call(this),e.options=(0,j.Z)({},{geojson:[[[]]],startHeight:0,height:5,closedBottom:!0,closedTop:!0,curvatureResolution:1,cartesian:!0,userDataRsoOffset:0},a),e}var n=r.prototype;return n.create=function(){var e=this.options,o=e.startHeight,s=e.height,f=e.closedBottom,h=e.closedTop,v=e.curvatureResolution,m=e.userDataRsoOffset,y=e.cartesian,b=new Lt(this.options.geojson,{startHeight:o,endHeight:o+s,closedBottom:f,closedTop:h,curvatureResolution:v,cartesian:y,userDataRsoOffset:m});this.createMesh(b,this.options.material)},r}(d),Je=Y(705);function et(t){var i=t.split,r=t.depth,n=t.points,a=t.box3,e=new c[A](new c.Shape(n),{depth:r,bevelEnabled:!1,UVGenerator:(0,Je.y)({split:i,box3:a})});return(0,Je.C)(),e}var kt=function(t){"use strict";C(r,t);var i=E(r);function r(a){T(this,r);var e;return e=i.call(this),e.options=Ke((0,j.Z)({depth:1},a),{materialOptions:(0,j.Z)({},{split:.1},a.materialOptions||{})}),e}var n=r.prototype;return n.create=function(){var e=this;return(0,O.Z)(R().mark(function o(){var s,f,h,v,m,y,b,w,g,u,M,S,L,V,J,oe,U,ve,de,_e,Q,Pe,Ee,Re;return R().wrap(function(K){for(;;)switch(K.prev=K.next){case 0:if(s=e.options,f=s.points,h=s.pointsArr,v=s.useGroups,m=s.depth,y=s.geometry,b=s.geometryArr,w=s.material,g=s.materialOptions,u=s.cache,M=s.cacheKey,S=s.box3,L=0,V=Array.isArray(m)?m:[m],J=Array.isArray(S)?S:[S],oe=w,U=y,!(!oe&&g)){K.next=20;break}if(L=g.split,ve=g.topColor,de=g.sideColor,_e=g.sideMap,Q="ExtrudePolygonMaterial:".concat(M||"".concat(de||_e||"").concat(ve||"")),!u){K.next=16;break}return K.next=13,u.get(Q,function(){return e.getMaterial(g)});case 13:K.t0=K.sent,K.next=19;break;case 16:return K.next=18,e.getMaterial(g);case 18:K.t0=K.sent;case 19:oe=K.t0;case 20:!U&&f?U=et({points:f,depth:V[0],split:L,box3:J[0]}):!U&&h?U=je.mergeBufferGeometries(h.map(function(Me,ye){return et({points:Me,depth:(Pe=V[ye])!==null&&Pe!==void 0?Pe:V[0],split:L,box3:(Ee=J[ye])!==null&&Ee!==void 0?Ee:J[0]})}),v!=null?v:!1):!U&&b&&b.length>1?U=je.mergeBufferGeometries(b,v!=null?v:!1):!U&&b&&b.length===1&&(Re=ge(b,1),U=Re[0]),e.createMesh(U,oe);case 22:case"end":return K.stop()}},o)}))()},n.addGeometries=function(e){var o=this.object3d,s=je.mergeBufferGeometries([o.geometry].concat(ne(e)),!1);o.geometry=s},n.getMaterial=function(e){var o=this,s=e.topColor,f=e.sideColor,h=e.sideMap,v=e.type,m=e.parameters,y=e.createCanvasObjectURL,b=e.split,w=e.maxAnisotropy;return new Promise(function(g){var u=h?document.createElement("img"):{src:"",onload:function(){},width:1024,height:1024};u.onload=function(){var M=b,S=document.createElement("canvas"),L=S.getContext("2d");S.height=u.height/(1-M),S.width=u.width,M&&s&&(L.fillStyle=s,L.fillRect(0,0,u.width,S.height*M)),h&&u instanceof HTMLImageElement?L.drawImage(u,0,S.height*M,u.width,u.height):f&&(L.fillStyle=f,L.fillRect(0,S.height*M,u.width,u.height)),y&&S.toBlob(function(oe){console.log(URL.createObjectURL(oe))});var V=new c.CanvasTexture(S);V.anisotropy=w||o.pencil.renderer.capabilities.getMaxAnisotropy();var J=new c[v||"MeshBasicMaterial"]((0,j.Z)({map:V},m||{}));g(J)},h?u.src=h:u instanceof HTMLImageElement||u.onload()})},n.setMaterialColor=function(e){var o=this;return(0,O.Z)(R().mark(function s(){var f,h,v,m,y,b,w,g,u,M,S;return R().wrap(function(V){for(;;)switch(V.prev=V.next){case 0:if(f=o.options,h=f.materialOptions,v=f.cache,m=h.sideColor,y=h.sideMap,b=h.topColor,w=h.cacheKey,g=e.sideColor,u=e.topColor,!(u||g)){V.next=16;break}if(M="ExtrudePolygonMaterial:".concat(w||"".concat(g||m||y||"").concat(u||b||"")),!v){V.next=11;break}return V.next=8,v.get(M,function(){return o.getMaterial((0,j.Z)({},h,e))});case 8:V.t0=V.sent,V.next=14;break;case 11:return V.next=13,o.getMaterial((0,j.Z)({},h,e));case 13:V.t0=V.sent;case 14:S=V.t0,o.object3d.material=S;case 16:case"end":return V.stop()}},s)}))()},r}(d);function Et(t){var i=t.worker,r=t.workerKey,n=t.coordinatesArr,a=t.depth,e=t.split,o=t.projection,s=t.cacheVersion;return new Promise(function(f,h){i.postMessage({coordinatesArr:n,depth:a,split:e!=null?e:.1,projection:o,workerKey:r},{cb:function(v){try{var m=new c.BufferGeometry;Object.keys(v).forEach(function(y){m.setAttribute(y,new c.BufferAttribute(v[y].array,v[y].itemSize))}),f(m)}catch(y){i.postMessage({delCache:!0,workerKey:r},{cb:h,cacheVersion:s})}},cacheVersion:s})})}})(),module.exports=Be})();
132
+ `),we=function(t){"use strict";C(r,t);var i=E(r);function r(){T(this,r);var n;return n=i.call(this),n.isMeshLine=!0,n.type="MeshLine",n.positions=[],n.previous=[],n.next=[],n.side=[],n.width=[],n.indices_array=[],n.uvs=[],n.counters=[],n._points=[],n._geom=null,n.widthCallback=null,n.matrixWorld=new c.Matrix4,Object.defineProperties(ae(n),{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(e){this.setGeometry(e,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(e){this.setPoints(e,this.widthCallback)}}}),n}return r}(c.BufferGeometry);we.prototype.setMatrixWorld=function(t){this.matrixWorld=t},we.prototype.setGeometry=function(t,i){this._geometry=t,this.setPoints(t.getAttribute("position").array,i)},we.prototype.setPoints=function(t,i){if(!(t instanceof Float32Array)&&!(t instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=t,this.widthCallback=i,this.positions=[],this.counters=[],t.length&&t[0]instanceof c.Vector3)for(var r=0;r<t.length;r++){var n=t[r],a=r/t.length;this.positions.push(n.x,n.y,n.z),this.positions.push(n.x,n.y,n.z),this.counters.push(a),this.counters.push(a)}else for(var r=0;r<t.length;r+=3){var a=r/t.length;this.positions.push(t[r],t[r+1],t[r+2]),this.positions.push(t[r],t[r+1],t[r+2]),this.counters.push(a),this.counters.push(a)}this.process()};function Ne(t,i){var r=new c.Matrix4,n=new c.Ray,a=new c.Sphere,e=new c.Vector3,o=this.geometry;if(o.boundingSphere||o.computeBoundingSphere(),a.copy(o.boundingSphere),a.applyMatrix4(this.matrixWorld),t.ray.intersectSphere(a,e)!==!1){r.copy(this.matrixWorld).invert(),n.copy(t.ray).applyMatrix4(r);var s=new c.Vector3,f=new c.Vector3,h=new c.Vector3,v=this instanceof c.LineSegments?2:1,m=o.index,y=o.attributes;if(m!==null)for(var b=m.array,w=y.position.array,g=y.width.array,u=0,M=b.length-1;u<M;u+=v){var S=b[u],L=b[u+1];s.fromArray(w,S*3),f.fromArray(w,L*3);var V=g[Math.floor(u/3)]!==void 0?g[Math.floor(u/3)]:1,J=t.params.Line.threshold+this.material.lineWidth*V/2,oe=J*J,U=n.distanceSqToSegment(s,f,e,h);if(!(U>oe)){e.applyMatrix4(this.matrixWorld);var ve=t.ray.origin.distanceTo(e);ve<t.near||ve>t.far||(i.push({distance:ve,point:h.clone().applyMatrix4(this.matrixWorld),index:u,face:null,faceIndex:null,object:this}),u=M)}}}}we.prototype.raycast=Ne,we.prototype.compareV3=function(t,i){var r=t*6,n=i*6;return this.positions[r]===this.positions[n]&&this.positions[r+1]===this.positions[n+1]&&this.positions[r+2]===this.positions[n+2]},we.prototype.copyV3=function(t){var i=t*6;return[this.positions[i],this.positions[i+1],this.positions[i+2]]},we.prototype.process=function(){var t=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var i,r;this.compareV3(0,t-1)?r=this.copyV3(t-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 n=0;n<t;n++){if(this.side.push(1),this.side.push(-1),this.widthCallback?i=this.widthCallback(n/(t-1)):i=1,this.width.push(i),this.width.push(i),this.uvs.push(n/(t-1),0),this.uvs.push(n/(t-1),1),n<t-1){r=this.copyV3(n),this.previous.push(r[0],r[1],r[2]),this.previous.push(r[0],r[1],r[2]);var a=n*2;this.indices_array.push(a,a+1,a+2),this.indices_array.push(a+2,a+1,a+3)}n>0&&(r=this.copyV3(n),this.next.push(r[0],r[1],r[2]),this.next.push(r[0],r[1],r[2]))}this.compareV3(t-1,0)?r=this.copyV3(1):r=this.copyV3(t-1),this.next.push(r[0],r[1],r[2]),this.next.push(r[0],r[1],r[2]),!this._attributes||this._attributes.position.count!==this.positions.length?this._attributes={position:new c.BufferAttribute(new Float32Array(this.positions),3),previous:new c.BufferAttribute(new Float32Array(this.previous),3),next:new c.BufferAttribute(new Float32Array(this.next),3),side:new c.BufferAttribute(new Float32Array(this.side),1),width:new c.BufferAttribute(new Float32Array(this.width),1),uv:new c.BufferAttribute(new Float32Array(this.uvs),2),index:new c.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new c.BufferAttribute(new Float32Array(this.counters),1)}:(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()};function Ve(t,i,r,n,a){var e;if(t=t.subarray||t.slice?t:t.buffer,r=r.subarray||r.slice?r:r.buffer,t=i?t.subarray?t.subarray(i,a&&i+a):t.slice(i,a&&i+a):t,r.set)r.set(t,n);else for(e=0;e<t.length;e++)r[e+n]=t[e];return r}we.prototype.advance=function(t){var i=this._attributes.position.array,r=this._attributes.previous.array,n=this._attributes.next.array,a=i.length;Ve(i,0,r,0,a),Ve(i,6,i,0,a-6),i[a-6]=t.x,i[a-5]=t.y,i[a-4]=t.z,i[a-3]=t.x,i[a-2]=t.y,i[a-1]=t.z,Ve(i,6,n,0,a-6),n[a-6]=t.x,n[a-5]=t.y,n[a-4]=t.z,n[a-3]=t.x,n[a-2]=t.y,n[a-1]=t.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0},c.ShaderChunk.meshline_vert=st,c.ShaderChunk.meshline_frag=ut;var We=function(t){"use strict";C(r,t);var i=E(r);function r(n){T(this,r);var a;return a=i.call(this,{uniforms:Object.assign({},c.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new c.Color(16777215)},opacity:{value:1},resolution:{value:new c.Vector2(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new c.Vector2(1,1)},offset:{value:new c.Vector2(1,1)},lineLightAnimation:{value:1},time:{value:0},size:{value:300},speed:{value:.3},lightWidth:{value:.1},uCenter:{value:new c.Vector2(0,0)},lightColor:{value:new c.Color(16777215)}}),vertexShader:c.ShaderChunk.meshline_vert,fragmentShader:c.ShaderChunk.meshline_frag}),a.isMeshLineMaterial=!0,a.type="MeshLineMaterial",Object.defineProperties(ae(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(n),a}return r}(c.ShaderMaterial);We.prototype.copy=function(t){return c.ShaderMaterial.prototype.copy.call(this,t),this.lineWidth=t.lineWidth,this.map=t.map,this.useMap=t.useMap,this.alphaMap=t.alphaMap,this.useAlphaMap=t.useAlphaMap,this.color.copy(t.color),this.opacity=t.opacity,this.resolution.copy(t.resolution),this.sizeAttenuation=t.sizeAttenuation,this.dashArray.copy(t.dashArray),this.dashOffset.copy(t.dashOffset),this.dashRatio.copy(t.dashRatio),this.useDash=t.useDash,this.visibility=t.visibility,this.alphaTest=t.alphaTest,this.repeat.copy(t.repeat),this};function ct(t,i){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);i&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function Ke(t,i){return i=i!=null?i:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):ct(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))}),t}function lt(t,i){if(t==null)return{};var r={},n=Object.keys(t),a,e;for(e=0;e<n.length;e++)a=n[e],!(i.indexOf(a)>=0)&&(r[a]=t[a]);return r}function ft(t,i){if(t==null)return{};var r=lt(t,i),n,a;if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);for(a=0;a<e.length;a++)n=e[a],!(i.indexOf(n)>=0)&&(!Object.prototype.propertyIsEnumerable.call(t,n)||(r[n]=t[n]))}return r}function ht(t){if(Array.isArray(t))return t}function pt(){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 ge(t,i){return ht(t)||re(t,i)||me(t,i)||pt()}var He=require("popmotion"),je=require("three/examples/jsm//utils/BufferGeometryUtils");function $e(t){var i=t.setPointWidth,r=t.nodes,n=new c.BufferGeometry,a=new we;return n.setFromPoints(r),a.setGeometry(n,i),a}var vt={color:new c.Color("#ffffff"),lineWidth:1},dt=function(t){"use strict";C(r,t);var i=E(r);function r(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r);var e;return e=i.call(this),e.options=(0,j.Z)({},vt,a),e}var n=r.prototype;return n.create=function(){var e=this;return(0,O.Z)(R().mark(function o(){var s,f,h,v,m,y,b,w,g,u,M,S,L,V,J,oe,U,ve,de;return R().wrap(function(Q){for(;;)switch(Q.prev=Q.next){case 0:if(s=e.options,f=s.duration,h=s.delay,v=s.onComplete,m=s.setPointWidth,y=s.key,b=s.nodes,w=s.nodesArr,g=s.geometry,u=s.geometryArr,M=s.useGroups,S=s.material,L=s.cache,V=s.cacheKey,J=ft(s,["duration","delay","onComplete","setPointWidth","key","nodes","nodesArr","geometry","geometryArr","useGroups","material","cache","cacheKey"]),oe=S,U=g,oe){Q.next=15;break}if(ve="LineMaterial:".concat(V),!L){Q.next=11;break}return Q.next=8,L.get(ve,function(){return e.getMaterial((0,j.Z)({},J))});case 8:Q.t0=Q.sent,Q.next=14;break;case 11:return Q.next=13,e.getMaterial((0,j.Z)({},J));case 13:Q.t0=Q.sent;case 14:oe=Q.t0;case 15:!U&&b?U=$e({nodes:b,setPointWidth:m}):!U&&w?U=je.mergeBufferGeometries(w.map(function(Pe){return $e({nodes:Pe,setPointWidth:m})}),M!=null?M:!1):!U&&u&&u.length>1?U=je.mergeBufferGeometries(u,M!=null?M:!1):!U&&u&&u.length===1&&(de=ge(u,1),U=de[0]),e.createMesh(U,oe);case 17:case"end":return Q.stop()}},o)}))()},n.getMaterial=function(e){var o=this.pencil.getSize(),s=o.width,f=o.height,h=new We(Ke((0,j.Z)({},e),{resolution:new c.Vector2(s,f)}));return h},n.addGeometries=function(e){var o=this.object3d,s=je.mergeBufferGeometries([o.geometry].concat(ne(e)),!1);o.geometry=s},n.resize=function(e,o){this.material.uniforms.resolution.value.set(e,o)},n.animate=function(){var e=this.options,o=e.duration,s=e.delay,f=e.onComplete,h=this.material.uniforms.offset,v=s!=null?s:0,m=(0,He.animate)({from:h.value,to:{x:0},duration:o!=null?o:1e3,elapsed:-v,repeat:1/0,onComplete:f,ease:He.linear,onUpdate:function(y){h.value.x=y.x}});this.tween=m},n.dispose=function(){var e;Oe(_(r.prototype),"dispose",this).call(this),(e=this.tween)===null||e===void 0||e.stop()},ee(r,[{key:"material",get:function(){return this.object3d.material}}]),r}(d);function mt(t){var i=t.worker,r=t.workerKey,n=t.coordinatesArr,a=t.lineWidth,e=t.projection,o=t.cacheVersion;return new Promise(function(s,f){i.postMessage({coordinatesArr:n,lineWidth:a,projection:e,workerKey:r},{cb:function(h){try{var v=new c.BufferGeometry;Object.keys(h).forEach(function(m){m==="index"?v.setIndex(new c.BufferAttribute(h[m].array,h[m].itemSize)):v.setAttribute(m,new c.BufferAttribute(h[m].array,h[m].itemSize))}),s(v)}catch(m){i.postMessage({delCache:!0,workerKey:r},{cb:f,cacheVersion:o})}},cacheVersion:o})})}var Le=require("d3-array"),gt=require("earcut"),De=Y.n(gt),yt=require("@turf/boolean-clockwise"),bt=Y.n(yt);function wt(t,i){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=(90-i)*Math.PI/180,a=(90-t)*Math.PI/180;return[r*Math.sin(n)*Math.cos(a),r*Math.cos(n),r*Math.sin(n)*Math.sin(a)]}var _t=require("delaunator"),Mt=Y.n(_t),xt=require("@turf/boolean-point-in-polygon"),At=Y.n(xt),ke=require("d3-geo"),Pt=require("d3-geo-voronoi"),qe=require("d3-scale");function St(t,i){return t.map(function(r){var n=[],a;return r.forEach(function(e){if(a){var o=(0,ke.geoDistance)(e,a)*180/Math.PI;if(o>i)for(var s=(0,ke.geoInterpolate)(a,e),f=1/Math.ceil(o/i),h=f;h<1;)n.push(s(h)),h+=f}n.push(a=e)}),n})}function Ot(t){for(var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=i.minLng,n=i.maxLng,a=i.minLat,e=i.maxLat,o=Math.round(Math.pow(360/t,2)/Math.PI),s=(1+Math.sqrt(5))/2,f=function(u){return u/s*360%360-180},h=function(u){return Math.acos(2*u/o-1)/Math.PI*180-90},v=function(u){return o*(Math.cos((u+90)*Math.PI/180)+1)/2},m=[e!==void 0?Math.ceil(v(e)):0,a!==void 0?Math.floor(v(a)):o-1],y=r===void 0&&n===void 0?function(){return!0}:r===void 0?function(u){return u<=n}:n===void 0?function(u){return u>=r}:n>=r?function(u){return u>=r&&u<=n}:function(u){return u>=r||u<=n},b=[],w=m[0];w<=m[1];w++){var g=f(w);y(g)&&b.push([g,h(w)])}return b}function Ue(t,i){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return r?(0,ke.geoContains)(i,t):At()(t,i)}function Ct(t,i){var r={type:"Polygon",coordinates:t},n=ge((0,ke.geoBounds)(r),2),a=ge(n[0],2),e=a[0],o=a[1],s=ge(n[1],2),f=s[0],h=s[1];if(Math.min(Math.abs(f-e),Math.abs(h-o))<i)return[];var v=e>f||h>=89||o<=-89;return Ot(i,{minLng:e,maxLng:f,minLat:o,maxLat:h}).filter(function(m){return Ue(m,r,v)})}function jt(t){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=i.resolution,n=r===void 0?1/0:r,a=St(t,n),e=(0,Le.merge)(a),o=Ct(t,n),s=ne(e).concat(ne(o)),f={type:"Polygon",coordinates:t},h=ge((0,ke.geoBounds)(f),2),v=ge(h[0],2),m=v[0],y=v[1],b=ge(h[1],2),w=b[0],g=b[1],u=m>w||g>=89||y<=-89,M=[];if(u){var S=(0,Pt.geoVoronoi)(s).triangles(),L=new Map(s.map(function(K,Me){var ye=ge(K,2),be=ye[0],Ge=ye[1];return["".concat(be,"-").concat(Ge),Me]}));S.features.forEach(function(K){var Me,ye=K.geometry.coordinates[0].slice(0,3).reverse(),be=[];if(ye.forEach(function(ze){var xe=ge(ze,2),Ie=xe[0],Rt=xe[1],nt="".concat(Ie,"-").concat(Rt);L.has(nt)&&be.push(L.get(nt))}),be.length===3){if(be.some(function(ze){return ze<e.length})){var Ge=K.properties.circumcenter;if(!Ue(Ge,f,u))return}(Me=M).push.apply(Me,ne(be))}})}else if(o.length)for(var ve=function(K,Me){var ye,be=[2,1,0].map(function(xe){return de.triangles[K+xe]}),Ge=be.map(function(xe){return s[xe]});if(be.some(function(xe){return xe<e.length})){var ze=[0,1].map(function(xe){return(0,Le.mean)(Ge,function(Ie){return Ie[xe]})});if(!Ue(ze,f,u))return"continue"}(ye=M).push.apply(ye,ne(be))},de=Mt().from(s),_e=0,Q=de.triangles.length;_e<Q;_e+=3)ve(_e,Q);else{var V=De().flatten(a),J=V.vertices,oe=V.holes,U=oe===void 0?[]:oe;M=De()(J,U,2)}var Pe=(0,qe.scaleLinear)((0,Le.extent)(s,function(K){return K[0]}),[0,1]),Ee=(0,qe.scaleLinear)((0,Le.extent)(s,function(K){return K[1]}),[0,1]),Re=s.map(function(K){var Me=ge(K,2),ye=Me[0],be=Me[1];return[Pe(ye),Ee(be)]}),rt={points:s,indices:M,uvs:Re};return{contour:a,triangles:rt}}var Lt=jt,Xe=new c.BufferGeometry().setAttribute?"setAttribute":"addAttribute";function Ze(t,i){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,n=t.map(function(a){return a.map(function(e){var o=ge(e,2),s=o[0],f=o[1];return r?wt(s,f,i):[s,f,i]})});return De().flatten(n)}function Ye(t,i,r){for(var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=Ze(t,i,n),e=a.vertices,o=a.holes,s=Ze(t,r,n),f=s.vertices,h=(0,Le.merge)([f,e]),v=Math.round(f.length/3),m=new Set(o),y=0,b=[],w=0;w<v;w++){var g=w+1;if(g===v)g=y;else if(m.has(g)){var u=g;g=y,y=u}b.push(w,w+v,g+v),b.push(g+v,g,w)}for(var M=[],S=1;S>=0;S--)for(var L=0;L<v;L+=1)M.push(L/(v-1),S);return{indices:b,vertices:h,uvs:M,topVerts:f}}function Qe(t,i,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return{indices:n?t.indices:t.indices.slice().reverse(),vertices:Ze([t.points],i,a).vertices,uvs:r}}var Je=function(t){"use strict";C(r,t);var i=E(r);function r(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};T(this,r);var e;e=i.call(this),e.type="PolygonBufferGeometry",e.parameters=(0,j.Z)({},{polygonGeoJson:n,startHeight:0,endHeight:1,closedBottom:!0,closedTop:!0,includeSides:!0,curvatureResolution:5,cartesian:!0,userDataRsoOffset:0},a);var o=e.parameters,s=o.startHeight,f=o.endHeight,h=o.closedBottom,v=o.closedTop,m=o.includeSides,y=o.curvatureResolution,b=o.cartesian,w=o.userDataRsoOffset;bt()(n[0])||n[0].reverse();var g=Lt(n,{resolution:y}),u=g.contour,M=g.triangles,S=(0,Le.merge)(M.uvs),L=[],V=[],J=[],oe=0,U=function(de){var _e=Math.round(L.length/3),Q=J.length;L=L.concat(de.vertices),V=V.concat(de.uvs),J=J.concat(_e?de.indices.map(function(Pe){return Pe+_e}):de.indices),e.addGroup(Q,J.length-Q,oe++)};if(m){var ve=Ye(u,s,f,b);U(ve),e.userData.rso=w?Ye(u,s,f+w,b):ve}return h&&U(Qe(M,s,S,!1,b)),v&&U(Qe(M,f,S,!0,b)),e.setIndex(J),e[Xe]("position",new c.Float32BufferAttribute(L,3)),e[Xe]("uv",new c.Float32BufferAttribute(V,2)),e.computeVertexNormals(),e}return r}(c.BufferGeometry),Tt=function(t){"use strict";C(r,t);var i=E(r);function r(a){T(this,r);var e;return e=i.call(this),e.options=(0,j.Z)({},{geojson:[[[]]],startHeight:0,height:5,closedBottom:!0,closedTop:!0,curvatureResolution:1,cartesian:!0,userDataRsoOffset:0},a),e}var n=r.prototype;return n.create=function(){var e=this.options,o=e.startHeight,s=e.height,f=e.closedBottom,h=e.closedTop,v=e.curvatureResolution,m=e.userDataRsoOffset,y=e.cartesian,b=new Je(this.options.geojson,{startHeight:o,endHeight:o+s,closedBottom:f,closedTop:h,curvatureResolution:v,cartesian:y,userDataRsoOffset:m});this.createMesh(b,this.options.material)},r}(d),et=Y(705);function tt(t){var i=t.split,r=t.depth,n=t.points,a=t.box3,e=new c[A](new c.Shape(n),{depth:r,bevelEnabled:!1,UVGenerator:(0,et.y)({split:i,box3:a})});return(0,et.C)(),e}var kt=function(t){"use strict";C(r,t);var i=E(r);function r(a){T(this,r);var e;return e=i.call(this),e.options=Ke((0,j.Z)({depth:1},a),{materialOptions:(0,j.Z)({},{split:.1},a.materialOptions||{})}),e}var n=r.prototype;return n.create=function(){var e=this;return(0,O.Z)(R().mark(function o(){var s,f,h,v,m,y,b,w,g,u,M,S,L,V,J,oe,U,ve,de,_e,Q,Pe,Ee,Re;return R().wrap(function(K){for(;;)switch(K.prev=K.next){case 0:if(s=e.options,f=s.points,h=s.pointsArr,v=s.useGroups,m=s.depth,y=s.geometry,b=s.geometryArr,w=s.material,g=s.materialOptions,u=s.cache,M=s.cacheKey,S=s.box3,L=0,V=Array.isArray(m)?m:[m],J=Array.isArray(S)?S:[S],oe=w,U=y,!(!oe&&g)){K.next=20;break}if(L=g.split,ve=g.topColor,de=g.sideColor,_e=g.sideMap,Q="ExtrudePolygonMaterial:".concat(M||"".concat(de||_e||"").concat(ve||"")),!u){K.next=16;break}return K.next=13,u.get(Q,function(){return e.getMaterial(g)});case 13:K.t0=K.sent,K.next=19;break;case 16:return K.next=18,e.getMaterial(g);case 18:K.t0=K.sent;case 19:oe=K.t0;case 20:!U&&f?U=tt({points:f,depth:V[0],split:L,box3:J[0]}):!U&&h?U=je.mergeBufferGeometries(h.map(function(Me,ye){return tt({points:Me,depth:(Pe=V[ye])!==null&&Pe!==void 0?Pe:V[0],split:L,box3:(Ee=J[ye])!==null&&Ee!==void 0?Ee:J[0]})}),v!=null?v:!1):!U&&b&&b.length>1?U=je.mergeBufferGeometries(b,v!=null?v:!1):!U&&b&&b.length===1&&(Re=ge(b,1),U=Re[0]),e.createMesh(U,oe);case 22:case"end":return K.stop()}},o)}))()},n.addGeometries=function(e){var o=this.object3d,s=je.mergeBufferGeometries([o.geometry].concat(ne(e)),!1);o.geometry=s},n.getMaterial=function(e){var o=this,s=e.topColor,f=e.sideColor,h=e.sideMap,v=e.type,m=e.parameters,y=e.createCanvasObjectURL,b=e.split,w=e.maxAnisotropy;return new Promise(function(g){var u=h?document.createElement("img"):{src:"",onload:function(){},width:1024,height:1024};u.onload=function(){var M=b,S=document.createElement("canvas"),L=S.getContext("2d");S.height=u.height/(1-M),S.width=u.width,M&&s&&(L.fillStyle=s,L.fillRect(0,0,u.width,S.height*M)),h&&u instanceof HTMLImageElement?L.drawImage(u,0,S.height*M,u.width,u.height):f&&(L.fillStyle=f,L.fillRect(0,S.height*M,u.width,u.height)),y&&S.toBlob(function(oe){console.log(URL.createObjectURL(oe))});var V=new c.CanvasTexture(S);V.anisotropy=w||o.pencil.renderer.capabilities.getMaxAnisotropy();var J=new c[v||"MeshBasicMaterial"]((0,j.Z)({map:V},m||{}));g(J)},h?u.src=h:u instanceof HTMLImageElement||u.onload()})},n.setMaterialColor=function(e){var o=this;return(0,O.Z)(R().mark(function s(){var f,h,v,m,y,b,w,g,u,M,S;return R().wrap(function(V){for(;;)switch(V.prev=V.next){case 0:if(f=o.options,h=f.materialOptions,v=f.cache,m=h.sideColor,y=h.sideMap,b=h.topColor,w=h.cacheKey,g=e.sideColor,u=e.topColor,!(u||g)){V.next=16;break}if(M="ExtrudePolygonMaterial:".concat(w||"".concat(g||m||y||"").concat(u||b||"")),!v){V.next=11;break}return V.next=8,v.get(M,function(){return o.getMaterial((0,j.Z)({},h,e))});case 8:V.t0=V.sent,V.next=14;break;case 11:return V.next=13,o.getMaterial((0,j.Z)({},h,e));case 13:V.t0=V.sent;case 14:S=V.t0,o.object3d.material=S;case 16:case"end":return V.stop()}},s)}))()},r}(d);function Et(t){var i=t.worker,r=t.workerKey,n=t.coordinatesArr,a=t.depth,e=t.split,o=t.projection,s=t.cacheVersion;return new Promise(function(f,h){i.postMessage({coordinatesArr:n,depth:a,split:e!=null?e:.1,projection:o,workerKey:r},{cb:function(v){try{var m=new c.BufferGeometry;Object.keys(v).forEach(function(y){m.setAttribute(y,new c.BufferAttribute(v[y].array,v[y].itemSize))}),f(m)}catch(y){i.postMessage({delCache:!0,workerKey:r},{cb:h,cacheVersion:s})}},cacheVersion:s})})}})(),module.exports=Be})();
@@ -1,4 +1,4 @@
1
- import*as ot from"idb-keyval";import*as $t from"three";import*as Yt from"three/examples/jsm/renderers/CSS2DRenderer";import*as st from"three/examples/jsm/renderers/CSS3DRenderer";import*as ut from"popmotion";import*as Jt from"three/examples/jsm//utils/BufferGeometryUtils";import*as Xe from"d3-array";import*as Qt from"earcut";import*as qt from"@turf/boolean-clockwise";import*as er from"delaunator";import*as tr from"@turf/boolean-point-in-polygon";import*as Ve from"d3-geo";import*as rr from"d3-geo-voronoi";import*as nr from"d3-scale";var ir={666:function(T){var B=function(x){"use strict";var M=Object.prototype,b=M.hasOwnProperty,V,L=typeof Symbol=="function"?Symbol:{},W=L.iterator||"@@iterator",H=L.asyncIterator||"@@asyncIterator",O=L.toStringTag||"@@toStringTag";function R(p,f,g){return Object.defineProperty(p,f,{value:g,enumerable:!0,configurable:!0,writable:!0}),p[f]}try{R({},"")}catch(p){R=function(f,g,C){return f[g]=C}}function I(p,f,g,C){var S=f&&f.prototype instanceof c?f:c,J=Object.create(S.prototype),q=new se(C||[]);return J._invoke=be(p,g,q),J}x.wrap=I;function X(p,f,g){try{return{type:"normal",arg:p.call(f,g)}}catch(C){return{type:"throw",arg:C}}}var Q="suspendedStart",oe="suspendedYield",fe="executing",le="completed",k={};function c(){}function P(){}function U(){}var G={};R(G,W,function(){return this});var ne=Object.getPrototypeOf,$=ne&&ne(ne(Oe([])));$&&$!==M&&b.call($,W)&&(G=$);var K=U.prototype=c.prototype=Object.create(G);P.prototype=U,R(K,"constructor",U),R(U,"constructor",P),P.displayName=R(U,O,"GeneratorFunction");function ie(p){["next","throw","return"].forEach(function(f){R(p,f,function(g){return this._invoke(f,g)})})}x.isGeneratorFunction=function(p){var f=typeof p=="function"&&p.constructor;return f?f===P||(f.displayName||f.name)==="GeneratorFunction":!1},x.mark=function(p){return Object.setPrototypeOf?Object.setPrototypeOf(p,U):(p.__proto__=U,R(p,O,"GeneratorFunction")),p.prototype=Object.create(K),p},x.awrap=function(p){return{__await:p}};function te(p,f){function g(J,q,ue,he){var ce=X(p[J],p,q);if(ce.type==="throw")he(ce.arg);else{var Ee=ce.arg,Ce=Ee.value;return Ce&&typeof Ce=="object"&&b.call(Ce,"__await")?f.resolve(Ce.__await).then(function(Pe){g("next",Pe,ue,he)},function(Pe){g("throw",Pe,ue,he)}):f.resolve(Ce).then(function(Pe){Ee.value=Pe,ue(Ee)},function(Pe){return g("throw",Pe,ue,he)})}}var C;function S(J,q){function ue(){return new f(function(he,ce){g(J,q,he,ce)})}return C=C?C.then(ue,ue):ue()}this._invoke=S}ie(te.prototype),R(te.prototype,H,function(){return this}),x.AsyncIterator=te,x.async=function(p,f,g,C,S){S===void 0&&(S=Promise);var J=new te(I(p,f,g,C),S);return x.isGeneratorFunction(f)?J:J.next().then(function(q){return q.done?q.value:J.next()})};function be(p,f,g){var C=Q;return function(J,q){if(C===fe)throw new Error("Generator is already running");if(C===le){if(J==="throw")throw q;return ze()}for(g.method=J,g.arg=q;;){var ue=g.delegate;if(ue){var he=me(ue,g);if(he){if(he===k)continue;return he}}if(g.method==="next")g.sent=g._sent=g.arg;else if(g.method==="throw"){if(C===Q)throw C=le,g.arg;g.dispatchException(g.arg)}else g.method==="return"&&g.abrupt("return",g.arg);C=fe;var ce=X(p,f,g);if(ce.type==="normal"){if(C=g.done?le:oe,ce.arg===k)continue;return{value:ce.arg,done:g.done}}else ce.type==="throw"&&(C=le,g.method="throw",g.arg=ce.arg)}}}function me(p,f){var g=p.iterator[f.method];if(g===V){if(f.delegate=null,f.method==="throw"){if(p.iterator.return&&(f.method="return",f.arg=V,me(p,f),f.method==="throw"))return k;f.method="throw",f.arg=new TypeError("The iterator does not provide a 'throw' method")}return k}var C=X(g,p.iterator,f.arg);if(C.type==="throw")return f.method="throw",f.arg=C.arg,f.delegate=null,k;var S=C.arg;if(!S)return f.method="throw",f.arg=new TypeError("iterator result is not an object"),f.delegate=null,k;if(S.done)f[p.resultName]=S.value,f.next=p.nextLoc,f.method!=="return"&&(f.method="next",f.arg=V);else return S;return f.delegate=null,k}ie(K),R(K,O,"Generator"),R(K,W,function(){return this}),R(K,"toString",function(){return"[object Generator]"});function z(p){var f={tryLoc:p[0]};1 in p&&(f.catchLoc=p[1]),2 in p&&(f.finallyLoc=p[2],f.afterLoc=p[3]),this.tryEntries.push(f)}function Y(p){var f=p.completion||{};f.type="normal",delete f.arg,p.completion=f}function se(p){this.tryEntries=[{tryLoc:"root"}],p.forEach(z,this),this.reset(!0)}x.keys=function(p){var f=[];for(var g in p)f.push(g);return f.reverse(),function C(){for(;f.length;){var S=f.pop();if(S in p)return C.value=S,C.done=!1,C}return C.done=!0,C}};function Oe(p){if(p){var f=p[W];if(f)return f.call(p);if(typeof p.next=="function")return p;if(!isNaN(p.length)){var g=-1,C=function S(){for(;++g<p.length;)if(b.call(p,g))return S.value=p[g],S.done=!1,S;return S.value=V,S.done=!0,S};return C.next=C}}return{next:ze}}x.values=Oe;function ze(){return{value:V,done:!0}}return se.prototype={constructor:se,reset:function(p){if(this.prev=0,this.next=0,this.sent=this._sent=V,this.done=!1,this.delegate=null,this.method="next",this.arg=V,this.tryEntries.forEach(Y),!p)for(var f in this)f.charAt(0)==="t"&&b.call(this,f)&&!isNaN(+f.slice(1))&&(this[f]=V)},stop:function(){this.done=!0;var p=this.tryEntries[0],f=p.completion;if(f.type==="throw")throw f.arg;return this.rval},dispatchException:function(p){if(this.done)throw p;var f=this;function g(he,ce){return J.type="throw",J.arg=p,f.next=he,ce&&(f.method="next",f.arg=V),!!ce}for(var C=this.tryEntries.length-1;C>=0;--C){var S=this.tryEntries[C],J=S.completion;if(S.tryLoc==="root")return g("end");if(S.tryLoc<=this.prev){var q=b.call(S,"catchLoc"),ue=b.call(S,"finallyLoc");if(q&&ue){if(this.prev<S.catchLoc)return g(S.catchLoc,!0);if(this.prev<S.finallyLoc)return g(S.finallyLoc)}else if(q){if(this.prev<S.catchLoc)return g(S.catchLoc,!0)}else if(ue){if(this.prev<S.finallyLoc)return g(S.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(p,f){for(var g=this.tryEntries.length-1;g>=0;--g){var C=this.tryEntries[g];if(C.tryLoc<=this.prev&&b.call(C,"finallyLoc")&&this.prev<C.finallyLoc){var S=C;break}}S&&(p==="break"||p==="continue")&&S.tryLoc<=f&&f<=S.finallyLoc&&(S=null);var J=S?S.completion:{};return J.type=p,J.arg=f,S?(this.method="next",this.next=S.finallyLoc,k):this.complete(J)},complete:function(p,f){if(p.type==="throw")throw p.arg;return p.type==="break"||p.type==="continue"?this.next=p.arg:p.type==="return"?(this.rval=this.arg=p.arg,this.method="return",this.next="end"):p.type==="normal"&&f&&(this.next=f),k},finish:function(p){for(var f=this.tryEntries.length-1;f>=0;--f){var g=this.tryEntries[f];if(g.finallyLoc===p)return this.complete(g.completion,g.afterLoc),Y(g),k}},catch:function(p){for(var f=this.tryEntries.length-1;f>=0;--f){var g=this.tryEntries[f];if(g.tryLoc===p){var C=g.completion;if(C.type==="throw"){var S=C.arg;Y(g)}return S}}throw new Error("illegal catch attempt")},delegateYield:function(p,f,g){return this.delegate={iterator:Oe(p),resultName:f,nextLoc:g},this.method==="next"&&(this.arg=V),k}},x}(T.exports);try{regeneratorRuntime=B}catch(x){typeof globalThis=="object"?globalThis.regeneratorRuntime=B:Function("r","regeneratorRuntime = r")(B)}},695:function(T,B,x){x.d(B,{Z:function(){return M}});function M(b){if(b.geometry&&b.geometry.dispose(),b.material){var V=Array.isArray(b.material)?b.material:[b.material];V.forEach(function(L){var W,H,O,R,I,X,Q,oe,fe,le,k,c,P;(W=L.map)===null||W===void 0||W.dispose(),(H=L.lightMap)===null||H===void 0||H.dispose(),(O=L.bumpMap)===null||O===void 0||O.dispose(),(R=L.normalMap)===null||R===void 0||R.dispose(),(I=L.specularMap)===null||I===void 0||I.dispose(),(X=L.envMap)===null||X===void 0||X.dispose(),(Q=L.alphaMap)===null||Q===void 0||Q.dispose(),(oe=L.aoMap)===null||oe===void 0||oe.dispose(),(fe=L.displacementMap)===null||fe===void 0||fe.dispose(),(le=L.emissiveMap)===null||le===void 0||le.dispose(),(k=L.gradientMap)===null||k===void 0||k.dispose(),(c=L.metalnessMap)===null||c===void 0||c.dispose(),(P=L.roughnessMap)===null||P===void 0||P.dispose(),L.dispose()})}}},584:function(T,B,x){x.d(B,{wf:function(){return L.Z}});var M=x(666),b=x.n(M),V=null,L=x(695),W=x(949);function H(k){if(k.material){var c=Array.isArray(k.material)?k.material:[k.material];c.forEach(function(P){var U,G;(U=P.color)===null||U===void 0||U.convertSRGBToLinear(),(G=P.emissive)===null||G===void 0||G.convertSRGBToLinear(),P.map&&(P.map.encoding=THREE.sRGBEncoding),P.emissiveMap&&(P.emissiveMap.encoding=THREE.sRGBEncoding)})}}var O=x(568),R=x(924),I=x(77),X=x(484),Q=null,oe=null,fe=function(){var k=(0,O.Z)(b().mark(function c(P,U){var G,ne,$,K,ie,te,be,me,z;return b().wrap(function(se){for(;;)switch(se.prev=se.next){case 0:return G=U.type,ne=G===void 0?"blob":G,$=U.version,K=$===void 0?"1":$,se.next=4,(0,I.get)(P);case 4:if(te=se.sent,!(te&&te[K])){se.next=9;break}ie=te[K],se.next=15;break;case 9:return se.next=11,(0,X.Z)(fetch(P).then(function(Oe){if(Oe.ok)return Oe[ne]();throw new Error}));case 11:be=se.sent,me=be.res,z=be.err,z||(ie=me,(0,I.set)(P,(0,R.Z)({},K,me)));case 15:return se.abrupt("return",ie?{url:ne==="json"?P:URL.createObjectURL(ie),store:ie}:{url:P});case 16:case"end":return se.stop()}},c)}));return function(P,U){return k.apply(this,arguments)}}(),le=x(705)},484:function(T,B,x){x.d(B,{Z:function(){return b}});var M=x(42);function b(V){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return V.then(function(W){return(0,M.Z)({err:null,res:W},L)}).catch(function(W){return(0,M.Z)({err:W,res:void 0},L)})}},705:function(T,B,x){x.d(B,{C:function(){return L},y:function(){return V}});var M=x(949),b=new Map,V=function(){var W=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{generateTopUV:function(H,O,R,I,X){var Q=O[R*3],oe=O[R*3+1],fe=O[I*3],le=O[I*3+1],k=O[X*3],c=O[X*3+1],P;if(b.has(H))P=b.get(H);else{var U=W.box3||new M.Box3;if(!W.box3){var G=H.parameters.shapes.getPoints();U.setFromArray(G.map(function(te){return[te.x,te.y,0]}).flat())}var ne=U.getSize(new M.Vector3);W.split&&(ne.y/=W.split),P={box:U,size:ne},b.set(H,P)}var $=P.box,K=P.size,ie=W.split?1-W.split:0;return[new M.Vector2((Q-$.min.x)/K.x,(oe-$.min.y)/K.y+ie),new M.Vector2((fe-$.min.x)/K.x,(le-$.min.y)/K.y+ie),new M.Vector2((k-$.min.x)/K.x,(c-$.min.y)/K.y+ie)]},generateSideWallUV:function(H,O,R,I,X,Q){var oe=O[R*3],fe=O[R*3+1],le=O[R*3+2],k=O[I*3],c=O[I*3+1],P=O[I*3+2],U=O[X*3],G=O[X*3+1],ne=O[X*3+2],$=O[Q*3],K=O[Q*3+1],ie=O[Q*3+2],te;if(b.has(O))te=b.get(O);else{var be=new M.Box3;be.setFromArray(O);var me=be.getSize(new M.Vector3);W.split&&(me.z/=1-W.split),te={box:be,size:me},b.set(O,te)}var z=te.box,Y=te.size;return Math.abs(fe-c)<Math.abs(oe-k)?[new M.Vector2((oe-z.min.x)/Y.x,(le-z.min.z)/Y.z),new M.Vector2((k-z.min.x)/Y.x,(P-z.min.z)/Y.z),new M.Vector2((U-z.min.x)/Y.x,(ne-z.min.z)/Y.z),new M.Vector2(($-z.min.x)/Y.x,(ie-z.min.z)/Y.z)]:[new M.Vector2((fe-z.min.y)/Y.y,(le-z.min.z)/Y.z),new M.Vector2((c-z.min.y)/Y.y,(P-z.min.z)/Y.z),new M.Vector2((G-z.min.y)/Y.y,(ne-z.min.z)/Y.z),new M.Vector2((K-z.min.y)/Y.y,(ie-z.min.z)/Y.z)]}}},L=function(){b.clear()}},77:function(T,B,x){var M=V=>{var L={};return x.d(L,V),L},b=V=>()=>V;T.exports=M({get:()=>ot.get,set:()=>ot.set})},949:function(T){var B=M=>{var b={};return Z.d(b,M),b},x=M=>()=>M;T.exports=$t},568:function(T,B,x){x.d(B,{Z:function(){return b}});function M(V,L,W,H,O,R,I){try{var X=V[R](I),Q=X.value}catch(oe){W(oe);return}X.done?L(Q):Promise.resolve(Q).then(H,O)}function b(V){return function(){var L=this,W=arguments;return new Promise(function(H,O){var R=V.apply(L,W);function I(Q){M(R,H,O,I,X,"next",Q)}function X(Q){M(R,H,O,I,X,"throw",Q)}I(void 0)})}}},924:function(T,B,x){x.d(B,{Z:function(){return M}});function M(b,V,L){return V in b?Object.defineProperty(b,V,{value:L,enumerable:!0,configurable:!0,writable:!0}):b[V]=L,b}},42:function(T,B,x){x.d(B,{Z:function(){return b}});var M=x(924);function b(V){for(var L=1;L<arguments.length;L++){var W=arguments[L]!=null?arguments[L]:{},H=Object.keys(W);typeof Object.getOwnPropertySymbols=="function"&&(H=H.concat(Object.getOwnPropertySymbols(W).filter(function(O){return Object.getOwnPropertyDescriptor(W,O).enumerable}))),H.forEach(function(O){(0,M.Z)(V,O,W[O])})}return V}}},ct={};function Z(T){var B=ct[T];if(B!==void 0)return B.exports;var x=ct[T]={exports:{}};return ir[T](x,x.exports,Z),x.exports}(function(){Z.n=function(T){var B=T&&T.__esModule?function(){return T.default}:function(){return T};return Z.d(B,{a:B}),B}})(),function(){Z.d=function(T,B){for(var x in B)Z.o(B,x)&&!Z.o(T,x)&&Object.defineProperty(T,x,{enumerable:!0,get:B[x]})}}(),function(){Z.o=function(T,B){return Object.prototype.hasOwnProperty.call(T,B)}}();var de={};(function(){Z.d(de,{Ei:function(){return Kt},Yo:function(){return Ft},ZA:function(){return pt},Ee:function(){return Ee},x1:function(){return Mt},VJ:function(){return we},r7:function(){return Ne},XA:function(){return He},NB:function(){return ht},xv:function(){return Ce},nk:function(){return lt},JX:function(){return Xt},TQ:function(){return Pt}});function T(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function B(e,n){return B=Object.setPrototypeOf||function(i,a){return i.__proto__=a,i},B(e,n)}function x(e,n){return B(e,n)}function M(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 b=Z(42);function V(){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 L(e,n,r){return V()?L=Reflect.construct:L=function(a,t,o){var s=[null];s.push.apply(s,t);var l=Function.bind.apply(a,s),h=new l;return o&&x(h,o.prototype),h},L.apply(null,arguments)}function W(e,n,r){return L.apply(null,arguments)}function H(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function O(e){return O=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},O(e)}function R(e){return O(e)}function I(e){var n=typeof Map=="function"?new Map:void 0;return I=function(i){if(i===null||!H(i))return i;if(typeof i!="function")throw new TypeError("Super expression must either be null or a function");if(typeof n!="undefined"){if(n.has(i))return n.get(i);n.set(i,a)}function a(){return W(i,arguments,R(this).constructor)}return a.prototype=Object.create(i.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),x(a,i)},I(e)}function X(e){return I(e)}function Q(){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 oe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function fe(e){return e&&e.constructor===Symbol?"symbol":typeof e}function le(e,n){return n&&(fe(n)==="object"||typeof n=="function")?n:oe(e)}function k(e){var n=Q();return function(){var i=R(e),a;if(n){var t=R(this).constructor;a=Reflect.construct(i,arguments,t)}else a=i.apply(this,arguments);return le(this,a)}}var c=Z(949),P=Z(568),U=Z(666),G=Z.n(U);function ne(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 $(e,n,r){return n&&ne(e.prototype,n),r&&ne(e,r),e}function K(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 ie(e){if(Array.isArray(e))return K(e)}function te(e){if(typeof Symbol!="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function be(){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 me(e,n){if(!!e){if(typeof e=="string")return K(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 K(e,n)}}function z(e){return ie(e)||te(e)||me(e)||be()}var Y=Z(484);function se(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r={};return r.promise=new Promise(function(i,a){r.resolve=i,r.reject=a}),e&&(r.promise=(0,Y.Z)(r.promise,n)),r}var Oe=e=>{var n={};return Z.d(n,e),n},ze=e=>()=>e,p=Oe({CSS2DObject:()=>Yt.CSS2DObject}),f=e=>{var n={};return Z.d(n,e),n},g=e=>()=>e,C=f({CSS3DObject:()=>st.CSS3DObject,CSS3DSprite:()=>st.CSS3DSprite}),S=Z(584),J=function(e){e&&((0,S.wf)(e),e.children.forEach(function(n){n.userData.BaseObject_||J(n)}))},q=function(){"use strict";function e(){T(this,e),this.objecttype__="BaseObject",this.userData={},this.pm=se(),this.visible=!1}var n=e.prototype;return n.init=function(){},n.create=function(){},n.render=function(){},n.update=function(i,a){},n.resize=function(i,a){},n.show=function(){return this.object3d&&(this.object3d.visible=!0),this.visible=!0,this},n.hide=function(){return this.object3d&&(this.object3d.visible=!1),this.visible=!1,this},n.isVisible=function(){return this.visible},n.createMesh=function(){for(var i=arguments.length,a=new Array(i),t=0;t<i;t++)a[t]=arguments[t];return this.object3d=W(c.Mesh,z(a)),this},n.createGroup=function(){return this.object3d=new c.Group,this},n.createPoints=function(){for(var i=arguments.length,a=new Array(i),t=0;t<i;t++)a[t]=arguments[t];return this.object3d=W(c.Points,z(a)),this},n.createCSS2DObject=function(i){return this.object3d=new p.CSS2DObject(i),this},n.createCSS3DObject=function(i){return this.object3d=new C.CSS3DObject(i),this},n.createCSS3DSprite=function(i){return this.object3d=new C.CSS3DSprite(i),this},n.createSprite=function(i){return this.object3d=new c.Sprite(i),this},n.add=function(){for(var i=arguments.length,a=new Array(i),t=0;t<i;t++)a[t]=arguments[t];var o;return(o=this.object3d).add.apply(o,z(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,z(a)),this},n.getSize=function(){var i=new c.Box3().setFromObject(this.object3d);return{min:i.min,max:i.max,size:i.getSize(new c.Vector3)}},n.traverse=function(i){i(this),this.children.forEach(function(a){a.traverse(i)})},n.dispose=function(){J(this.object3d)},$(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}(),ue=+c.REVISION<144,he=ue?"ExtrudeBufferGeometry":"ExtrudeGeometry",ce=ue?"PlaneBufferGeometry":"PlaneGeometry",Ee=function(e){"use strict";M(r,e);var n=k(r);function r(a){T(this,r);var t;return t=n.call(this),t.scale=1,t.options=(0,b.Z)({},{scale:1},a),t}var i=r.prototype;return i.getMaterial=function(){var t=this;return(0,P.Z)(G().mark(function o(){var s,l,h,v,d,y,_,w,m,u;return G().wrap(function(E){for(;;)switch(E.prev=E.next){case 0:return s=t.options,l=s.transparent,h=s.blending,v=s.depthWrite,d=s.depthTest,y=s.alphaTest,_=s.sprite,w=s.sizeAttenuation,E.next=3,t.getTexture();case 3:return m=E.sent,u=_?new c.SpriteMaterial({map:m,transparent:l!=null?l:!1,blending:h!=null?h:c.NormalBlending,depthWrite:v!=null?v:!0,depthTest:d!=null?d:!0,alphaTest:y!=null?y:0,sizeAttenuation:w!=null?w:!0}):new c.MeshBasicMaterial({map:m,transparent:l!=null?l:!1,blending:h!=null?h:c.NormalBlending,depthWrite:v!=null?v:!0,depthTest:d!=null?d:!0,alphaTest:y!=null?y:0}),E.abrupt("return",u);case 6:case"end":return E.stop()}},o)}))()},i.create=function(){var t=this;return(0,P.Z)(G().mark(function o(){var s,l,h,v,d,y,_,w;return G().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(s=t.options,l=s.scale,h=s.position,v=s.src,d=s.cache,y=s.sprite,_=v,!d){u.next=8;break}return u.next=5,d.get(_,function(){return t.getMaterial()});case 5:u.t0=u.sent,u.next=11;break;case 8:return u.next=10,t.getMaterial();case 10:u.t0=u.sent;case 11:w=u.t0,t.texture=w.map,y?t.createSprite(w):t.createMesh(new c[ce](1,1),w),t.setScale(l),h&&t.object3d.position.copy(h);case 16:case"end":return u.stop()}},o)}))()},i.setScale=function(t){this.scale=t,this.object3d.scale.set(this.texture.image.width*t,this.texture.image.height*t,1)},i.setTexture=function(t){var o=this.object3d;o.material.map&&o.material.map.dispose(),o.material.map=t,o.material.needsUpdate=!0,this.texture=t,this.setScale(this.scale)},i.getTexture=function(){var t=this.options.src;return new c.TextureLoader().loadAsync(t)},r}(q),Ce=function(e){"use strict";M(r,e);var n=k(r);function r(a){T(this,r);var t;return t=n.call(this,a),t.canvas=document.createElement("canvas"),t}var i=r.prototype;return i.getTexture=function(){var t=this.options,o=t.text,s=t.textOptions,l=(0,b.Z)({},{fontSize:28,fontFamily:"system-ui,-apple-system,BlinkMacSystemFont,sans-serif",fontWeight:"normal",flipX:!1,color:"#ffffff",setCtx:function(j){}},s||{}),h=l.fontSize,v=l.fontFamily,d=l.fontWeight,y=l.flipX,_=l.color,w=l.setCtx,m=this.canvas;m.width=h*o.length*2,m.height=h;var u=m.getContext("2d");u.font="".concat(d," ").concat(h,"px/1 ").concat(v);var A=u.measureText(o).width;m.width=A,u=m.getContext("2d"),u.clearRect(0,0,m.width,m.height),y&&u.scale(-1,1),u.font="".concat(d," ").concat(h,"px/1 ").concat(v),u.textBaseline="middle",u.fillStyle=_,w&&w(u),u.fillText(o,y?A*-1:0,m.height/2),u.restore();var E=new c.Texture(m);return E.anisotropy=this.pencil.renderer.capabilities.getMaxAnisotropy(),E.needsUpdate=!0,Promise.resolve(E)},r}(X(Ee));function Pe(e,n){for(;!Object.prototype.hasOwnProperty.call(e,n)&&(e=R(e),e!==null););return e}function We(e,n,r){return typeof Reflect!="undefined"&&Reflect.get?We=Reflect.get:We=function(a,t,o){var s=Pe(a,t);if(!!s){var l=Object.getOwnPropertyDescriptor(s,t);return l.get?l.get.call(o||a):l.value}},We(e,n,r)}function De(e,n,r){return We(e,n,r)}var lt=function(e){"use strict";M(r,e);var n=k(r);function r(a){T(this,r);var t;return t=n.call(this),t.scale=1,t.options=(0,b.Z)({},{scale:1,autoPlay:!0,loop:!0},a),t}var i=r.prototype;return i.getMaterial=function(){var t=this.options,o=t.src,s=t.transparent,l=t.blending,h=t.depthWrite,v=t.depthTest,d=t.format,y=t.autoPlay,_=t.loop,w=t.alphaTest,m=t.sprite,u=se(),A=document.createElement("video");return A.addEventListener("loadedmetadata",function(){var E=new c.VideoTexture(A);E.format=d!=null?d:c.RGBAFormat,E.needsUpdate=!0;var j=m?new c.SpriteMaterial({map:E,transparent:s!=null?s:!1,blending:l!=null?l:c.NormalBlending,depthWrite:h!=null?h:!0,depthTest:v!=null?v:!0,alphaTest:w!=null?w:0}):new c.MeshBasicMaterial({map:E,transparent:s!=null?s:!1,blending:l!=null?l:c.NormalBlending,depthWrite:h!=null?h:!0,depthTest:v!=null?v:!0,alphaTest:w!=null?w:0});u.resolve(j)},!1),A.src=o,A.muted=!0,A.autoplay=y,A.loop=_,A.preload="auto",u.promise},i.create=function(){var t=this;return(0,P.Z)(G().mark(function o(){var s,l,h,v,d,y,_;return G().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:if(s=t.options,l=s.scale,h=s.position,v=s.src,d=s.cache,y=s.sprite,!d){m.next=7;break}return m.next=4,d.get(v,function(){return t.getMaterial()});case 4:m.t0=m.sent,m.next=10;break;case 7:return m.next=9,t.getMaterial();case 9:m.t0=m.sent;case 10:_=m.t0,t.video=_.map.image,y?t.createSprite(_):t.createMesh(new c[ce](1,1),_),t.setScale(l),h&&t.object3d.position.copy(h);case 15:case"end":return m.stop()}},o)}))()},i.setScale=function(t){this.scale=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(),De(R(r.prototype),"dispose",this).call(this)},r}(q),ft=function(e){"use strict";M(r,e);var n=k(r);function r(a){T(this,r);var t;return t=n.call(this),t.type_="node",t.options=(0,b.Z)({},{event:"click"},a),t}var i=r.prototype;return i.create=function(){var t=this.options,o=t.position,s=t.children,l=t.handler,h=t.event,v=document.createElement("div");this.element=v,v.appendChild(s),this.createCSS2DObject(v),o&&this.object3d.position.copy(o),l&&h&&this.clickTarge.forEach(function(d){var y=Array.isArray(h)?h:[h],_=Array.isArray(l)?l:[l];y.forEach(function(w,m){var u=_[m];u&&d.addEventListener(w,u)})})},i.getMaterial=function(t){return(0,P.Z)(G().mark(function o(){var s,l,h,v;return G().wrap(function(y){for(;;)switch(y.prev=y.next){case 0:return s=document.createElement("canvas"),s.width=256,s.height=256,l=s.getContext("2d"),l.fillStyle="#ff0000",l.fillRect(0,0,256,256),h=new c.CanvasTexture(s),v=new c.SpriteMaterial({map:h,opacity:t?1:0,transparent:!0,alphaTest:.1,sizeAttenuation:!1}),y.abrupt("return",v);case 9:case"end":return y.stop()}},o)}))()},i.createPickObject=function(t){var o=t.show,s=o===void 0?!1:o,l=t.scale,h=l===void 0?new c.Vector3(1,1,1):l,v=t.position,d=v===void 0?new c.Vector3(0,0,0):v,y=t.cache,_=this;return(0,P.Z)(G().mark(function w(){var m,u,A;return G().wrap(function(j){for(;;)switch(j.prev=j.next){case 0:if(m="node-create-pick-object",!y){j.next=7;break}return j.next=4,y.get(m,function(){return _.getMaterial(s)});case 4:j.t0=j.sent,j.next=10;break;case 7:return j.next=9,_.getMaterial(s);case 9:j.t0=j.sent;case 10:u=j.t0,A=new c.Sprite(u),A.scale.set(u.map.image.width*h.x,u.map.image.height*h.y,1),A.position.copy(d),_.add(A),_.pickObject=A;case 16:case"end":return j.stop()}},w)}))()},i.dispose=function(){var t=this.options,o=t.handler,s=t.event;o&&s&&this.clickTarge.forEach(function(l){var h=Array.isArray(s)?s:[s],v=Array.isArray(o)?o:[o];h.forEach(function(d,y){var _=v[y];_&&l.removeEventListener(d,_)})}),De(R(r.prototype),"dispose",this).call(this)},$(r,[{key:"clickTarge",get:function(){var t=this,o=this.options.eventTarge;if(o){var s=o.map(function(l){return z(t.element.querySelectorAll(l))}).flat();return s}return[this.element]}}]),r}(q),ht=ft,pt=function(e){"use strict";M(r,e);var n=k(r);function r(){return T(this,r),n.apply(this,arguments)}var i=r.prototype;return i.create=function(){this.createGroup()},r}(q),vt=`
1
+ import*as st from"idb-keyval";import*as $t from"three";import*as Yt from"three/examples/jsm/renderers/CSS2DRenderer";import*as ut from"three/examples/jsm/renderers/CSS3DRenderer";import*as ct from"popmotion";import*as Jt from"three/examples/jsm//utils/BufferGeometryUtils";import*as Xe from"d3-array";import*as Qt from"earcut";import*as qt from"@turf/boolean-clockwise";import*as er from"delaunator";import*as tr from"@turf/boolean-point-in-polygon";import*as De from"d3-geo";import*as rr from"d3-geo-voronoi";import*as nr from"d3-scale";var ir={666:function(T){var B=function(x){"use strict";var M=Object.prototype,b=M.hasOwnProperty,D,L=typeof Symbol=="function"?Symbol:{},W=L.iterator||"@@iterator",H=L.asyncIterator||"@@asyncIterator",O=L.toStringTag||"@@toStringTag";function R(p,f,g){return Object.defineProperty(p,f,{value:g,enumerable:!0,configurable:!0,writable:!0}),p[f]}try{R({},"")}catch(p){R=function(f,g,C){return f[g]=C}}function I(p,f,g,C){var S=f&&f.prototype instanceof c?f:c,J=Object.create(S.prototype),q=new se(C||[]);return J._invoke=be(p,g,q),J}x.wrap=I;function X(p,f,g){try{return{type:"normal",arg:p.call(f,g)}}catch(C){return{type:"throw",arg:C}}}var Q="suspendedStart",oe="suspendedYield",he="executing",le="completed",k={};function c(){}function P(){}function U(){}var G={};R(G,W,function(){return this});var ne=Object.getPrototypeOf,$=ne&&ne(ne(Oe([])));$&&$!==M&&b.call($,W)&&(G=$);var K=U.prototype=c.prototype=Object.create(G);P.prototype=U,R(K,"constructor",U),R(U,"constructor",P),P.displayName=R(U,O,"GeneratorFunction");function ie(p){["next","throw","return"].forEach(function(f){R(p,f,function(g){return this._invoke(f,g)})})}x.isGeneratorFunction=function(p){var f=typeof p=="function"&&p.constructor;return f?f===P||(f.displayName||f.name)==="GeneratorFunction":!1},x.mark=function(p){return Object.setPrototypeOf?Object.setPrototypeOf(p,U):(p.__proto__=U,R(p,O,"GeneratorFunction")),p.prototype=Object.create(K),p},x.awrap=function(p){return{__await:p}};function te(p,f){function g(J,q,ue,pe){var ce=X(p[J],p,q);if(ce.type==="throw")pe(ce.arg);else{var Ee=ce.arg,Ce=Ee.value;return Ce&&typeof Ce=="object"&&b.call(Ce,"__await")?f.resolve(Ce.__await).then(function(Pe){g("next",Pe,ue,pe)},function(Pe){g("throw",Pe,ue,pe)}):f.resolve(Ce).then(function(Pe){Ee.value=Pe,ue(Ee)},function(Pe){return g("throw",Pe,ue,pe)})}}var C;function S(J,q){function ue(){return new f(function(pe,ce){g(J,q,pe,ce)})}return C=C?C.then(ue,ue):ue()}this._invoke=S}ie(te.prototype),R(te.prototype,H,function(){return this}),x.AsyncIterator=te,x.async=function(p,f,g,C,S){S===void 0&&(S=Promise);var J=new te(I(p,f,g,C),S);return x.isGeneratorFunction(f)?J:J.next().then(function(q){return q.done?q.value:J.next()})};function be(p,f,g){var C=Q;return function(J,q){if(C===he)throw new Error("Generator is already running");if(C===le){if(J==="throw")throw q;return Ve()}for(g.method=J,g.arg=q;;){var ue=g.delegate;if(ue){var pe=me(ue,g);if(pe){if(pe===k)continue;return pe}}if(g.method==="next")g.sent=g._sent=g.arg;else if(g.method==="throw"){if(C===Q)throw C=le,g.arg;g.dispatchException(g.arg)}else g.method==="return"&&g.abrupt("return",g.arg);C=he;var ce=X(p,f,g);if(ce.type==="normal"){if(C=g.done?le:oe,ce.arg===k)continue;return{value:ce.arg,done:g.done}}else ce.type==="throw"&&(C=le,g.method="throw",g.arg=ce.arg)}}}function me(p,f){var g=p.iterator[f.method];if(g===D){if(f.delegate=null,f.method==="throw"){if(p.iterator.return&&(f.method="return",f.arg=D,me(p,f),f.method==="throw"))return k;f.method="throw",f.arg=new TypeError("The iterator does not provide a 'throw' method")}return k}var C=X(g,p.iterator,f.arg);if(C.type==="throw")return f.method="throw",f.arg=C.arg,f.delegate=null,k;var S=C.arg;if(!S)return f.method="throw",f.arg=new TypeError("iterator result is not an object"),f.delegate=null,k;if(S.done)f[p.resultName]=S.value,f.next=p.nextLoc,f.method!=="return"&&(f.method="next",f.arg=D);else return S;return f.delegate=null,k}ie(K),R(K,O,"Generator"),R(K,W,function(){return this}),R(K,"toString",function(){return"[object Generator]"});function V(p){var f={tryLoc:p[0]};1 in p&&(f.catchLoc=p[1]),2 in p&&(f.finallyLoc=p[2],f.afterLoc=p[3]),this.tryEntries.push(f)}function Y(p){var f=p.completion||{};f.type="normal",delete f.arg,p.completion=f}function se(p){this.tryEntries=[{tryLoc:"root"}],p.forEach(V,this),this.reset(!0)}x.keys=function(p){var f=[];for(var g in p)f.push(g);return f.reverse(),function C(){for(;f.length;){var S=f.pop();if(S in p)return C.value=S,C.done=!1,C}return C.done=!0,C}};function Oe(p){if(p){var f=p[W];if(f)return f.call(p);if(typeof p.next=="function")return p;if(!isNaN(p.length)){var g=-1,C=function S(){for(;++g<p.length;)if(b.call(p,g))return S.value=p[g],S.done=!1,S;return S.value=D,S.done=!0,S};return C.next=C}}return{next:Ve}}x.values=Oe;function Ve(){return{value:D,done:!0}}return se.prototype={constructor:se,reset:function(p){if(this.prev=0,this.next=0,this.sent=this._sent=D,this.done=!1,this.delegate=null,this.method="next",this.arg=D,this.tryEntries.forEach(Y),!p)for(var f in this)f.charAt(0)==="t"&&b.call(this,f)&&!isNaN(+f.slice(1))&&(this[f]=D)},stop:function(){this.done=!0;var p=this.tryEntries[0],f=p.completion;if(f.type==="throw")throw f.arg;return this.rval},dispatchException:function(p){if(this.done)throw p;var f=this;function g(pe,ce){return J.type="throw",J.arg=p,f.next=pe,ce&&(f.method="next",f.arg=D),!!ce}for(var C=this.tryEntries.length-1;C>=0;--C){var S=this.tryEntries[C],J=S.completion;if(S.tryLoc==="root")return g("end");if(S.tryLoc<=this.prev){var q=b.call(S,"catchLoc"),ue=b.call(S,"finallyLoc");if(q&&ue){if(this.prev<S.catchLoc)return g(S.catchLoc,!0);if(this.prev<S.finallyLoc)return g(S.finallyLoc)}else if(q){if(this.prev<S.catchLoc)return g(S.catchLoc,!0)}else if(ue){if(this.prev<S.finallyLoc)return g(S.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(p,f){for(var g=this.tryEntries.length-1;g>=0;--g){var C=this.tryEntries[g];if(C.tryLoc<=this.prev&&b.call(C,"finallyLoc")&&this.prev<C.finallyLoc){var S=C;break}}S&&(p==="break"||p==="continue")&&S.tryLoc<=f&&f<=S.finallyLoc&&(S=null);var J=S?S.completion:{};return J.type=p,J.arg=f,S?(this.method="next",this.next=S.finallyLoc,k):this.complete(J)},complete:function(p,f){if(p.type==="throw")throw p.arg;return p.type==="break"||p.type==="continue"?this.next=p.arg:p.type==="return"?(this.rval=this.arg=p.arg,this.method="return",this.next="end"):p.type==="normal"&&f&&(this.next=f),k},finish:function(p){for(var f=this.tryEntries.length-1;f>=0;--f){var g=this.tryEntries[f];if(g.finallyLoc===p)return this.complete(g.completion,g.afterLoc),Y(g),k}},catch:function(p){for(var f=this.tryEntries.length-1;f>=0;--f){var g=this.tryEntries[f];if(g.tryLoc===p){var C=g.completion;if(C.type==="throw"){var S=C.arg;Y(g)}return S}}throw new Error("illegal catch attempt")},delegateYield:function(p,f,g){return this.delegate={iterator:Oe(p),resultName:f,nextLoc:g},this.method==="next"&&(this.arg=D),k}},x}(T.exports);try{regeneratorRuntime=B}catch(x){typeof globalThis=="object"?globalThis.regeneratorRuntime=B:Function("r","regeneratorRuntime = r")(B)}},695:function(T,B,x){x.d(B,{Z:function(){return M}});function M(b){if(b.geometry&&b.geometry.dispose(),b.material){var D=Array.isArray(b.material)?b.material:[b.material];D.forEach(function(L){var W,H,O,R,I,X,Q,oe,he,le,k,c,P;(W=L.map)===null||W===void 0||W.dispose(),(H=L.lightMap)===null||H===void 0||H.dispose(),(O=L.bumpMap)===null||O===void 0||O.dispose(),(R=L.normalMap)===null||R===void 0||R.dispose(),(I=L.specularMap)===null||I===void 0||I.dispose(),(X=L.envMap)===null||X===void 0||X.dispose(),(Q=L.alphaMap)===null||Q===void 0||Q.dispose(),(oe=L.aoMap)===null||oe===void 0||oe.dispose(),(he=L.displacementMap)===null||he===void 0||he.dispose(),(le=L.emissiveMap)===null||le===void 0||le.dispose(),(k=L.gradientMap)===null||k===void 0||k.dispose(),(c=L.metalnessMap)===null||c===void 0||c.dispose(),(P=L.roughnessMap)===null||P===void 0||P.dispose(),L.dispose()})}}},584:function(T,B,x){x.d(B,{wf:function(){return L.Z}});var M=x(666),b=x.n(M),D=null,L=x(695),W=x(949);function H(k){if(k.material){var c=Array.isArray(k.material)?k.material:[k.material];c.forEach(function(P){var U,G;(U=P.color)===null||U===void 0||U.convertSRGBToLinear(),(G=P.emissive)===null||G===void 0||G.convertSRGBToLinear(),P.map&&(P.map.encoding=THREE.sRGBEncoding),P.emissiveMap&&(P.emissiveMap.encoding=THREE.sRGBEncoding)})}}var O=x(568),R=x(924),I=x(77),X=x(484),Q=null,oe=null,he=function(){var k=(0,O.Z)(b().mark(function c(P,U){var G,ne,$,K,ie,te,be,me,V;return b().wrap(function(se){for(;;)switch(se.prev=se.next){case 0:return G=U.type,ne=G===void 0?"blob":G,$=U.version,K=$===void 0?"1":$,se.next=4,(0,I.get)(P);case 4:if(te=se.sent,!(te&&te[K])){se.next=9;break}ie=te[K],se.next=15;break;case 9:return se.next=11,(0,X.Z)(fetch(P).then(function(Oe){if(Oe.ok)return Oe[ne]();throw new Error}));case 11:be=se.sent,me=be.res,V=be.err,V||(ie=me,(0,I.set)(P,(0,R.Z)({},K,me)));case 15:return se.abrupt("return",ie?{url:ne==="json"?P:URL.createObjectURL(ie),store:ie}:{url:P});case 16:case"end":return se.stop()}},c)}));return function(P,U){return k.apply(this,arguments)}}(),le=x(705)},484:function(T,B,x){x.d(B,{Z:function(){return b}});var M=x(42);function b(D){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return D.then(function(W){return(0,M.Z)({err:null,res:W},L)}).catch(function(W){return(0,M.Z)({err:W,res:void 0},L)})}},705:function(T,B,x){x.d(B,{C:function(){return L},y:function(){return D}});var M=x(949),b=new Map,D=function(){var W=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{generateTopUV:function(H,O,R,I,X){var Q=O[R*3],oe=O[R*3+1],he=O[I*3],le=O[I*3+1],k=O[X*3],c=O[X*3+1],P;if(b.has(H))P=b.get(H);else{var U=W.box3||new M.Box3;if(!W.box3){var G=H.parameters.shapes.getPoints();U.setFromArray(G.map(function(te){return[te.x,te.y,0]}).flat())}var ne=U.getSize(new M.Vector3);W.split&&(ne.y/=W.split),P={box:U,size:ne},b.set(H,P)}var $=P.box,K=P.size,ie=W.split?1-W.split:0;return[new M.Vector2((Q-$.min.x)/K.x,(oe-$.min.y)/K.y+ie),new M.Vector2((he-$.min.x)/K.x,(le-$.min.y)/K.y+ie),new M.Vector2((k-$.min.x)/K.x,(c-$.min.y)/K.y+ie)]},generateSideWallUV:function(H,O,R,I,X,Q){var oe=O[R*3],he=O[R*3+1],le=O[R*3+2],k=O[I*3],c=O[I*3+1],P=O[I*3+2],U=O[X*3],G=O[X*3+1],ne=O[X*3+2],$=O[Q*3],K=O[Q*3+1],ie=O[Q*3+2],te;if(b.has(O))te=b.get(O);else{var be=new M.Box3;be.setFromArray(O);var me=be.getSize(new M.Vector3);W.split&&(me.z/=1-W.split),te={box:be,size:me},b.set(O,te)}var V=te.box,Y=te.size;return Math.abs(he-c)<Math.abs(oe-k)?[new M.Vector2((oe-V.min.x)/Y.x,(le-V.min.z)/Y.z),new M.Vector2((k-V.min.x)/Y.x,(P-V.min.z)/Y.z),new M.Vector2((U-V.min.x)/Y.x,(ne-V.min.z)/Y.z),new M.Vector2(($-V.min.x)/Y.x,(ie-V.min.z)/Y.z)]:[new M.Vector2((he-V.min.y)/Y.y,(le-V.min.z)/Y.z),new M.Vector2((c-V.min.y)/Y.y,(P-V.min.z)/Y.z),new M.Vector2((G-V.min.y)/Y.y,(ne-V.min.z)/Y.z),new M.Vector2((K-V.min.y)/Y.y,(ie-V.min.z)/Y.z)]}}},L=function(){b.clear()}},77:function(T,B,x){var M=D=>{var L={};return x.d(L,D),L},b=D=>()=>D;T.exports=M({get:()=>st.get,set:()=>st.set})},949:function(T){var B=M=>{var b={};return Z.d(b,M),b},x=M=>()=>M;T.exports=$t},568:function(T,B,x){x.d(B,{Z:function(){return b}});function M(D,L,W,H,O,R,I){try{var X=D[R](I),Q=X.value}catch(oe){W(oe);return}X.done?L(Q):Promise.resolve(Q).then(H,O)}function b(D){return function(){var L=this,W=arguments;return new Promise(function(H,O){var R=D.apply(L,W);function I(Q){M(R,H,O,I,X,"next",Q)}function X(Q){M(R,H,O,I,X,"throw",Q)}I(void 0)})}}},924:function(T,B,x){x.d(B,{Z:function(){return M}});function M(b,D,L){return D in b?Object.defineProperty(b,D,{value:L,enumerable:!0,configurable:!0,writable:!0}):b[D]=L,b}},42:function(T,B,x){x.d(B,{Z:function(){return b}});var M=x(924);function b(D){for(var L=1;L<arguments.length;L++){var W=arguments[L]!=null?arguments[L]:{},H=Object.keys(W);typeof Object.getOwnPropertySymbols=="function"&&(H=H.concat(Object.getOwnPropertySymbols(W).filter(function(O){return Object.getOwnPropertyDescriptor(W,O).enumerable}))),H.forEach(function(O){(0,M.Z)(D,O,W[O])})}return D}}},lt={};function Z(T){var B=lt[T];if(B!==void 0)return B.exports;var x=lt[T]={exports:{}};return ir[T](x,x.exports,Z),x.exports}(function(){Z.n=function(T){var B=T&&T.__esModule?function(){return T.default}:function(){return T};return Z.d(B,{a:B}),B}})(),function(){Z.d=function(T,B){for(var x in B)Z.o(B,x)&&!Z.o(T,x)&&Object.defineProperty(T,x,{enumerable:!0,get:B[x]})}}(),function(){Z.o=function(T,B){return Object.prototype.hasOwnProperty.call(T,B)}}();var fe={};(function(){Z.d(fe,{Ei:function(){return Kt},ED:function(){return rt},Yo:function(){return Ft},ZA:function(){return vt},Ee:function(){return Ee},x1:function(){return Pt},VJ:function(){return we},r7:function(){return Ne},XA:function(){return He},NB:function(){return pt},xv:function(){return Ce},nk:function(){return ft},JX:function(){return Xt},TQ:function(){return St}});function T(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function B(e,n){return B=Object.setPrototypeOf||function(i,a){return i.__proto__=a,i},B(e,n)}function x(e,n){return B(e,n)}function M(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 b=Z(42);function D(){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 L(e,n,r){return D()?L=Reflect.construct:L=function(a,t,o){var s=[null];s.push.apply(s,t);var l=Function.bind.apply(a,s),h=new l;return o&&x(h,o.prototype),h},L.apply(null,arguments)}function W(e,n,r){return L.apply(null,arguments)}function H(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function O(e){return O=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},O(e)}function R(e){return O(e)}function I(e){var n=typeof Map=="function"?new Map:void 0;return I=function(i){if(i===null||!H(i))return i;if(typeof i!="function")throw new TypeError("Super expression must either be null or a function");if(typeof n!="undefined"){if(n.has(i))return n.get(i);n.set(i,a)}function a(){return W(i,arguments,R(this).constructor)}return a.prototype=Object.create(i.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),x(a,i)},I(e)}function X(e){return I(e)}function Q(){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 oe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function he(e){return e&&e.constructor===Symbol?"symbol":typeof e}function le(e,n){return n&&(he(n)==="object"||typeof n=="function")?n:oe(e)}function k(e){var n=Q();return function(){var i=R(e),a;if(n){var t=R(this).constructor;a=Reflect.construct(i,arguments,t)}else a=i.apply(this,arguments);return le(this,a)}}var c=Z(949),P=Z(568),U=Z(666),G=Z.n(U);function ne(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 $(e,n,r){return n&&ne(e.prototype,n),r&&ne(e,r),e}function K(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 ie(e){if(Array.isArray(e))return K(e)}function te(e){if(typeof Symbol!="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function be(){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 me(e,n){if(!!e){if(typeof e=="string")return K(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 K(e,n)}}function V(e){return ie(e)||te(e)||me(e)||be()}var Y=Z(484);function se(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r={};return r.promise=new Promise(function(i,a){r.resolve=i,r.reject=a}),e&&(r.promise=(0,Y.Z)(r.promise,n)),r}var Oe=e=>{var n={};return Z.d(n,e),n},Ve=e=>()=>e,p=Oe({CSS2DObject:()=>Yt.CSS2DObject}),f=e=>{var n={};return Z.d(n,e),n},g=e=>()=>e,C=f({CSS3DObject:()=>ut.CSS3DObject,CSS3DSprite:()=>ut.CSS3DSprite}),S=Z(584),J=function(e){e&&((0,S.wf)(e),e.children.forEach(function(n){n.userData.BaseObject_||J(n)}))},q=function(){"use strict";function e(){T(this,e),this.objecttype__="BaseObject",this.userData={},this.pm=se(),this.visible=!1}var n=e.prototype;return n.init=function(){},n.create=function(){},n.render=function(){},n.update=function(i,a){},n.resize=function(i,a){},n.show=function(){return this.object3d&&(this.object3d.visible=!0),this.visible=!0,this},n.hide=function(){return this.object3d&&(this.object3d.visible=!1),this.visible=!1,this},n.isVisible=function(){return this.visible},n.createMesh=function(){for(var i=arguments.length,a=new Array(i),t=0;t<i;t++)a[t]=arguments[t];return this.object3d=W(c.Mesh,V(a)),this},n.createGroup=function(){return this.object3d=new c.Group,this},n.createPoints=function(){for(var i=arguments.length,a=new Array(i),t=0;t<i;t++)a[t]=arguments[t];return this.object3d=W(c.Points,V(a)),this},n.createCSS2DObject=function(i){return this.object3d=new p.CSS2DObject(i),this},n.createCSS3DObject=function(i){return this.object3d=new C.CSS3DObject(i),this},n.createCSS3DSprite=function(i){return this.object3d=new C.CSS3DSprite(i),this},n.createSprite=function(i){return this.object3d=new c.Sprite(i),this},n.add=function(){for(var i=arguments.length,a=new Array(i),t=0;t<i;t++)a[t]=arguments[t];var o;return(o=this.object3d).add.apply(o,V(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,V(a)),this},n.getSize=function(){var i=new c.Box3().setFromObject(this.object3d);return{min:i.min,max:i.max,size:i.getSize(new c.Vector3)}},n.traverse=function(i){i(this),this.children.forEach(function(a){a.traverse(i)})},n.dispose=function(){J(this.object3d)},$(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}(),ue=+c.REVISION<144,pe=ue?"ExtrudeBufferGeometry":"ExtrudeGeometry",ce=ue?"PlaneBufferGeometry":"PlaneGeometry",Ee=function(e){"use strict";M(r,e);var n=k(r);function r(a){T(this,r);var t;return t=n.call(this),t.scale=1,t.options=(0,b.Z)({},{scale:1},a),t}var i=r.prototype;return i.getMaterial=function(){var t=this;return(0,P.Z)(G().mark(function o(){var s,l,h,v,d,y,_,w,m,u;return G().wrap(function(E){for(;;)switch(E.prev=E.next){case 0:return s=t.options,l=s.transparent,h=s.blending,v=s.depthWrite,d=s.depthTest,y=s.alphaTest,_=s.sprite,w=s.sizeAttenuation,E.next=3,t.getTexture();case 3:return m=E.sent,u=_?new c.SpriteMaterial({map:m,transparent:l!=null?l:!1,blending:h!=null?h:c.NormalBlending,depthWrite:v!=null?v:!0,depthTest:d!=null?d:!0,alphaTest:y!=null?y:0,sizeAttenuation:w!=null?w:!0}):new c.MeshBasicMaterial({map:m,transparent:l!=null?l:!1,blending:h!=null?h:c.NormalBlending,depthWrite:v!=null?v:!0,depthTest:d!=null?d:!0,alphaTest:y!=null?y:0}),E.abrupt("return",u);case 6:case"end":return E.stop()}},o)}))()},i.create=function(){var t=this;return(0,P.Z)(G().mark(function o(){var s,l,h,v,d,y,_,w;return G().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(s=t.options,l=s.scale,h=s.position,v=s.src,d=s.cache,y=s.sprite,_=v,!d){u.next=8;break}return u.next=5,d.get(_,function(){return t.getMaterial()});case 5:u.t0=u.sent,u.next=11;break;case 8:return u.next=10,t.getMaterial();case 10:u.t0=u.sent;case 11:w=u.t0,t.texture=w.map,y?t.createSprite(w):t.createMesh(new c[ce](1,1),w),t.setScale(l),h&&t.object3d.position.copy(h);case 16:case"end":return u.stop()}},o)}))()},i.setScale=function(t){this.scale=t,this.object3d.scale.set(this.texture.image.width*t,this.texture.image.height*t,1)},i.setTexture=function(t){var o=this.object3d;o.material.map&&o.material.map.dispose(),o.material.map=t,o.material.needsUpdate=!0,this.texture=t,this.setScale(this.scale)},i.getTexture=function(){var t=this.options.src;return new c.TextureLoader().loadAsync(t)},r}(q),Ce=function(e){"use strict";M(r,e);var n=k(r);function r(a){T(this,r);var t;return t=n.call(this,a),t.canvas=document.createElement("canvas"),t}var i=r.prototype;return i.getTexture=function(){var t=this.options,o=t.text,s=t.textOptions,l=(0,b.Z)({},{fontSize:28,fontFamily:"system-ui,-apple-system,BlinkMacSystemFont,sans-serif",fontWeight:"normal",flipX:!1,color:"#ffffff",setCtx:function(j){}},s||{}),h=l.fontSize,v=l.fontFamily,d=l.fontWeight,y=l.flipX,_=l.color,w=l.setCtx,m=this.canvas;m.width=h*o.length*2,m.height=h;var u=m.getContext("2d");u.font="".concat(d," ").concat(h,"px/1 ").concat(v);var A=u.measureText(o).width;m.width=A,u=m.getContext("2d"),u.clearRect(0,0,m.width,m.height),y&&u.scale(-1,1),u.font="".concat(d," ").concat(h,"px/1 ").concat(v),u.textBaseline="middle",u.fillStyle=_,w&&w(u),u.fillText(o,y?A*-1:0,m.height/2),u.restore();var E=new c.Texture(m);return E.anisotropy=this.pencil.renderer.capabilities.getMaxAnisotropy(),E.needsUpdate=!0,Promise.resolve(E)},r}(X(Ee));function Pe(e,n){for(;!Object.prototype.hasOwnProperty.call(e,n)&&(e=R(e),e!==null););return e}function We(e,n,r){return typeof Reflect!="undefined"&&Reflect.get?We=Reflect.get:We=function(a,t,o){var s=Pe(a,t);if(!!s){var l=Object.getOwnPropertyDescriptor(s,t);return l.get?l.get.call(o||a):l.value}},We(e,n,r)}function ze(e,n,r){return We(e,n,r)}var ft=function(e){"use strict";M(r,e);var n=k(r);function r(a){T(this,r);var t;return t=n.call(this),t.scale=1,t.options=(0,b.Z)({},{scale:1,autoPlay:!0,loop:!0},a),t}var i=r.prototype;return i.getMaterial=function(){var t=this.options,o=t.src,s=t.transparent,l=t.blending,h=t.depthWrite,v=t.depthTest,d=t.format,y=t.autoPlay,_=t.loop,w=t.alphaTest,m=t.sprite,u=se(),A=document.createElement("video");return A.addEventListener("loadedmetadata",function(){var E=new c.VideoTexture(A);E.format=d!=null?d:c.RGBAFormat,E.needsUpdate=!0;var j=m?new c.SpriteMaterial({map:E,transparent:s!=null?s:!1,blending:l!=null?l:c.NormalBlending,depthWrite:h!=null?h:!0,depthTest:v!=null?v:!0,alphaTest:w!=null?w:0}):new c.MeshBasicMaterial({map:E,transparent:s!=null?s:!1,blending:l!=null?l:c.NormalBlending,depthWrite:h!=null?h:!0,depthTest:v!=null?v:!0,alphaTest:w!=null?w:0});u.resolve(j)},!1),A.src=o,A.muted=!0,A.autoplay=y,A.loop=_,A.preload="auto",u.promise},i.create=function(){var t=this;return(0,P.Z)(G().mark(function o(){var s,l,h,v,d,y,_;return G().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:if(s=t.options,l=s.scale,h=s.position,v=s.src,d=s.cache,y=s.sprite,!d){m.next=7;break}return m.next=4,d.get(v,function(){return t.getMaterial()});case 4:m.t0=m.sent,m.next=10;break;case 7:return m.next=9,t.getMaterial();case 9:m.t0=m.sent;case 10:_=m.t0,t.video=_.map.image,y?t.createSprite(_):t.createMesh(new c[ce](1,1),_),t.setScale(l),h&&t.object3d.position.copy(h);case 15:case"end":return m.stop()}},o)}))()},i.setScale=function(t){this.scale=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(),ze(R(r.prototype),"dispose",this).call(this)},r}(q),ht=function(e){"use strict";M(r,e);var n=k(r);function r(a){T(this,r);var t;return t=n.call(this),t.type_="node",t.options=(0,b.Z)({},{event:"click"},a),t}var i=r.prototype;return i.create=function(){var t=this.options,o=t.position,s=t.children,l=t.handler,h=t.event,v=document.createElement("div");this.element=v,v.appendChild(s),this.createCSS2DObject(v),o&&this.object3d.position.copy(o),l&&h&&this.clickTarge.forEach(function(d){var y=Array.isArray(h)?h:[h],_=Array.isArray(l)?l:[l];y.forEach(function(w,m){var u=_[m];u&&d.addEventListener(w,u)})})},i.getMaterial=function(t){return(0,P.Z)(G().mark(function o(){var s,l,h,v;return G().wrap(function(y){for(;;)switch(y.prev=y.next){case 0:return s=document.createElement("canvas"),s.width=256,s.height=256,l=s.getContext("2d"),l.fillStyle="#ff0000",l.fillRect(0,0,256,256),h=new c.CanvasTexture(s),v=new c.SpriteMaterial({map:h,opacity:t?1:0,transparent:!0,alphaTest:.1,sizeAttenuation:!1}),y.abrupt("return",v);case 9:case"end":return y.stop()}},o)}))()},i.createPickObject=function(t){var o=t.show,s=o===void 0?!1:o,l=t.scale,h=l===void 0?new c.Vector3(1,1,1):l,v=t.position,d=v===void 0?new c.Vector3(0,0,0):v,y=t.cache,_=this;return(0,P.Z)(G().mark(function w(){var m,u,A;return G().wrap(function(j){for(;;)switch(j.prev=j.next){case 0:if(m="node-create-pick-object",!y){j.next=7;break}return j.next=4,y.get(m,function(){return _.getMaterial(s)});case 4:j.t0=j.sent,j.next=10;break;case 7:return j.next=9,_.getMaterial(s);case 9:j.t0=j.sent;case 10:u=j.t0,A=new c.Sprite(u),A.scale.set(u.map.image.width*h.x,u.map.image.height*h.y,1),A.position.copy(d),_.add(A),_.pickObject=A;case 16:case"end":return j.stop()}},w)}))()},i.dispose=function(){var t=this.options,o=t.handler,s=t.event;o&&s&&this.clickTarge.forEach(function(l){var h=Array.isArray(s)?s:[s],v=Array.isArray(o)?o:[o];h.forEach(function(d,y){var _=v[y];_&&l.removeEventListener(d,_)})}),ze(R(r.prototype),"dispose",this).call(this)},$(r,[{key:"clickTarge",get:function(){var t=this,o=this.options.eventTarge;if(o){var s=o.map(function(l){return V(t.element.querySelectorAll(l))}).flat();return s}return[this.element]}}]),r}(q),pt=ht,vt=function(e){"use strict";M(r,e);var n=k(r);function r(){return T(this,r),n.apply(this,arguments)}var i=r.prototype;return i.create=function(){this.createGroup()},r}(q),dt=`
2
2
  `.concat(c.ShaderChunk.logdepthbuf_pars_vertex,`
3
3
  `).concat(c.ShaderChunk.fog_pars_vertex,`
4
4
  attribute vec3 previous;
@@ -95,7 +95,7 @@ import*as ot from"idb-keyval";import*as $t from"three";import*as Yt from"three/e
95
95
  vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
96
96
  `).concat(c.ShaderChunk.fog_vertex,`
97
97
  }
98
- `),dt=`
98
+ `),mt=`
99
99
  `.concat(c.ShaderChunk.fog_pars_fragment,`
100
100
  `).concat(c.ShaderChunk.logdepthbuf_pars_fragment,`
101
101
 
@@ -129,4 +129,4 @@ void main() {
129
129
  gl_FragColor.a *= step(vCounters, visibility);
130
130
  `).concat(c.ShaderChunk.fog_fragment,`
131
131
  }
132
- `),we=function(e){"use strict";M(r,e);var n=k(r);function r(){T(this,r);var i;return i=n.call(this),i.isMeshLine=!0,i.type="MeshLine",i.positions=[],i.previous=[],i.next=[],i.side=[],i.width=[],i.indices_array=[],i.uvs=[],i.counters=[],i._points=[],i._geom=null,i.widthCallback=null,i.matrixWorld=new c.Matrix4,Object.defineProperties(oe(i),{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(t){this.setGeometry(t,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(t){this.setPoints(t,this.widthCallback)}}}),i}return r}(c.BufferGeometry);we.prototype.setMatrixWorld=function(e){this.matrixWorld=e},we.prototype.setGeometry=function(e,n){this._geometry=e,this.setPoints(e.getAttribute("position").array,n)},we.prototype.setPoints=function(e,n){if(!(e instanceof Float32Array)&&!(e instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=e,this.widthCallback=n,this.positions=[],this.counters=[],e.length&&e[0]instanceof c.Vector3)for(var r=0;r<e.length;r++){var i=e[r],a=r/e.length;this.positions.push(i.x,i.y,i.z),this.positions.push(i.x,i.y,i.z),this.counters.push(a),this.counters.push(a)}else for(var r=0;r<e.length;r+=3){var a=r/e.length;this.positions.push(e[r],e[r+1],e[r+2]),this.positions.push(e[r],e[r+1],e[r+2]),this.counters.push(a),this.counters.push(a)}this.process()};function He(e,n){var r=new c.Matrix4,i=new c.Ray,a=new c.Sphere,t=new c.Vector3,o=this.geometry;if(o.boundingSphere||o.computeBoundingSphere(),a.copy(o.boundingSphere),a.applyMatrix4(this.matrixWorld),e.ray.intersectSphere(a,t)!==!1){r.copy(this.matrixWorld).invert(),i.copy(e.ray).applyMatrix4(r);var s=new c.Vector3,l=new c.Vector3,h=new c.Vector3,v=this instanceof c.LineSegments?2:1,d=o.index,y=o.attributes;if(d!==null)for(var _=d.array,w=y.position.array,m=y.width.array,u=0,A=_.length-1;u<A;u+=v){var E=_[u],j=_[u+1];s.fromArray(w,E*3),l.fromArray(w,j*3);var D=m[Math.floor(u/3)]!==void 0?m[Math.floor(u/3)]:1,re=e.params.Line.threshold+this.material.lineWidth*D/2,ae=re*re,N=i.distanceSqToSegment(s,l,t,h);if(!(N>ae)){t.applyMatrix4(this.matrixWorld);var pe=e.ray.origin.distanceTo(t);pe<e.near||pe>e.far||(n.push({distance:pe,point:h.clone().applyMatrix4(this.matrixWorld),index:u,face:null,faceIndex:null,object:this}),u=A)}}}}we.prototype.raycast=He,we.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]},we.prototype.copyV3=function(e){var n=e*6;return[this.positions[n],this.positions[n+1],this.positions[n+2]]},we.prototype.process=function(){var e=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var n,r;this.compareV3(0,e-1)?r=this.copyV3(e-2):r=this.copyV3(0),this.previous.push(r[0],r[1],r[2]),this.previous.push(r[0],r[1],r[2]);for(var i=0;i<e;i++){if(this.side.push(1),this.side.push(-1),this.widthCallback?n=this.widthCallback(i/(e-1)):n=1,this.width.push(n),this.width.push(n),this.uvs.push(i/(e-1),0),this.uvs.push(i/(e-1),1),i<e-1){r=this.copyV3(i),this.previous.push(r[0],r[1],r[2]),this.previous.push(r[0],r[1],r[2]);var a=i*2;this.indices_array.push(a,a+1,a+2),this.indices_array.push(a+2,a+1,a+3)}i>0&&(r=this.copyV3(i),this.next.push(r[0],r[1],r[2]),this.next.push(r[0],r[1],r[2]))}this.compareV3(e-1,0)?r=this.copyV3(1):r=this.copyV3(e-1),this.next.push(r[0],r[1],r[2]),this.next.push(r[0],r[1],r[2]),!this._attributes||this._attributes.position.count!==this.positions.length?this._attributes={position:new c.BufferAttribute(new Float32Array(this.positions),3),previous:new c.BufferAttribute(new Float32Array(this.previous),3),next:new c.BufferAttribute(new Float32Array(this.next),3),side:new c.BufferAttribute(new Float32Array(this.side),1),width:new c.BufferAttribute(new Float32Array(this.width),1),uv:new c.BufferAttribute(new Float32Array(this.uvs),2),index:new c.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new c.BufferAttribute(new Float32Array(this.counters),1)}:(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()};function Ue(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}we.prototype.advance=function(e){var n=this._attributes.position.array,r=this._attributes.previous.array,i=this._attributes.next.array,a=n.length;Ue(n,0,r,0,a),Ue(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,Ue(n,6,i,0,a-6),i[a-6]=e.x,i[a-5]=e.y,i[a-4]=e.z,i[a-3]=e.x,i[a-2]=e.y,i[a-1]=e.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0},c.ShaderChunk.meshline_vert=vt,c.ShaderChunk.meshline_frag=dt;var Ne=function(e){"use strict";M(r,e);var n=k(r);function r(i){T(this,r);var a;return a=n.call(this,{uniforms:Object.assign({},c.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new c.Color(16777215)},opacity:{value:1},resolution:{value:new c.Vector2(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new c.Vector2(1,1)},offset:{value:new c.Vector2(1,1)},lineLightAnimation:{value:1},time:{value:0},size:{value:300},speed:{value:.3},lightWidth:{value:.1},uCenter:{value:new c.Vector2(0,0)},lightColor:{value:new c.Color(16777215)}}),vertexShader:c.ShaderChunk.meshline_vert,fragmentShader:c.ShaderChunk.meshline_frag}),a.isMeshLineMaterial=!0,a.type="MeshLineMaterial",Object.defineProperties(oe(a),{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(o){this.uniforms.lineWidth.value=o}},lineLightAnimation:{enumerable:!0,get:function(){return this.uniforms.lineLightAnimation.value},set:function(o){this.uniforms.lineLightAnimation.value=o}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(o){this.uniforms.map.value=o}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(o){this.uniforms.useMap.value=o}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(o){this.uniforms.alphaMap.value=o}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(o){this.uniforms.useAlphaMap.value=o}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(o){this.uniforms.color.value=o}},lightColor:{enumerable:!0,get:function(){return this.uniforms.lightColor.value},set:function(o){this.uniforms.lightColor.value=o}},time:{enumerable:!0,get:function(){return this.uniforms.time.value},set:function(o){this.uniforms.time.value=o}},uCenter:{enumerable:!0,get:function(){return this.uniforms.uCenter.value},set:function(o){this.uniforms.uCenter.value=o}},size:{enumerable:!0,get:function(){return this.uniforms.size.value},set:function(o){this.uniforms.size.value=o}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(o){this.uniforms.opacity.value=o}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(o){this.uniforms.resolution.value.copy(o)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(o){this.uniforms.sizeAttenuation.value=o}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(o){this.uniforms.dashArray.value=o,this.useDash=o!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(o){this.uniforms.dashOffset.value=o}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(o){this.uniforms.dashRatio.value=o}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(o){this.uniforms.useDash.value=o}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(o){this.uniforms.visibility.value=o}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(o){this.uniforms.alphaTest.value=o}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(o){this.uniforms.repeat.value.copy(o)}}}),a.setValues(i),a}return r}(c.ShaderMaterial);Ne.prototype.copy=function(e){return c.ShaderMaterial.prototype.copy.call(this,e),this.lineWidth=e.lineWidth,this.map=e.map,this.useMap=e.useMap,this.alphaMap=e.alphaMap,this.useAlphaMap=e.useAlphaMap,this.color.copy(e.color),this.opacity=e.opacity,this.resolution.copy(e.resolution),this.sizeAttenuation=e.sizeAttenuation,this.dashArray.copy(e.dashArray),this.dashOffset.copy(e.dashOffset),this.dashRatio.copy(e.dashRatio),this.useDash=e.useDash,this.visibility=e.visibility,this.alphaTest=e.alphaTest,this.repeat.copy(e.repeat),this};function mt(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 $e(e,n){return n=n!=null?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mt(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}),e}function gt(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 yt(e,n){if(e==null)return{};var r=gt(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}function _t(e){if(Array.isArray(e))return e}function bt(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ge(e,n){return _t(e)||te(e,n)||me(e,n)||bt()}var wt=e=>{var n={};return Z.d(n,e),n},yr=e=>()=>e,Ye=wt({animate:()=>ut.animate,linear:()=>ut.linear}),xt=e=>{var n={};return Z.d(n,e),n},_r=e=>()=>e,Le=xt({mergeBufferGeometries:()=>Jt.mergeBufferGeometries});function Je(e){var n=e.setPointWidth,r=e.nodes,i=new c.BufferGeometry,a=new we;return i.setFromPoints(r),a.setGeometry(i,n),a}var At={color:new c.Color("#ffffff"),lineWidth:1},Mt=function(e){"use strict";M(r,e);var n=k(r);function r(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r);var t;return t=n.call(this),t.options=(0,b.Z)({},At,a),t}var i=r.prototype;return i.create=function(){var t=this;return(0,P.Z)(G().mark(function o(){var s,l,h,v,d,y,_,w,m,u,A,E,j,D,re,ae,N,pe,ve;return G().wrap(function(ee){for(;;)switch(ee.prev=ee.next){case 0:if(s=t.options,l=s.duration,h=s.delay,v=s.onComplete,d=s.setPointWidth,y=s.key,_=s.nodes,w=s.nodesArr,m=s.geometry,u=s.geometryArr,A=s.useGroups,E=s.material,j=s.cache,D=s.cacheKey,re=yt(s,["duration","delay","onComplete","setPointWidth","key","nodes","nodesArr","geometry","geometryArr","useGroups","material","cache","cacheKey"]),ae=E,N=m,ae){ee.next=15;break}if(pe="LineMaterial:".concat(D),!j){ee.next=11;break}return ee.next=8,j.get(pe,function(){return t.getMaterial((0,b.Z)({},re))});case 8:ee.t0=ee.sent,ee.next=14;break;case 11:return ee.next=13,t.getMaterial((0,b.Z)({},re));case 13:ee.t0=ee.sent;case 14:ae=ee.t0;case 15:!N&&_?N=Je({nodes:_,setPointWidth:d}):!N&&w?N=Le.mergeBufferGeometries(w.map(function(Se){return Je({nodes:Se,setPointWidth:d})}),A!=null?A:!1):!N&&u&&u.length>1?N=Le.mergeBufferGeometries(u,A!=null?A:!1):!N&&u&&u.length===1&&(ve=ge(u,1),N=ve[0]),t.createMesh(N,ae);case 17:case"end":return ee.stop()}},o)}))()},i.getMaterial=function(t){var o=this.pencil.getSize(),s=o.width,l=o.height,h=new Ne($e((0,b.Z)({},t),{resolution:new c.Vector2(s,l)}));return h},i.addGeometries=function(t){var o=this.object3d,s=Le.mergeBufferGeometries([o.geometry].concat(z(t)),!1);o.geometry=s},i.resize=function(t,o){this.material.uniforms.resolution.value.set(t,o)},i.animate=function(){var t=this.options,o=t.duration,s=t.delay,l=t.onComplete,h=this.material.uniforms.offset,v=s!=null?s:0,d=(0,Ye.animate)({from:h.value,to:{x:0},duration:o!=null?o:1e3,elapsed:-v,repeat:1/0,onComplete:l,ease:Ye.linear,onUpdate:function(y){h.value.x=y.x}});this.tween=d},i.dispose=function(){var t;De(R(r.prototype),"dispose",this).call(this),(t=this.tween)===null||t===void 0||t.stop()},$(r,[{key:"material",get:function(){return this.object3d.material}}]),r}(q);function Pt(e){var n=e.worker,r=e.workerKey,i=e.coordinatesArr,a=e.lineWidth,t=e.projection,o=e.cacheVersion;return new Promise(function(s,l){n.postMessage({coordinatesArr:i,lineWidth:a,projection:t,workerKey:r},{cb:function(h){try{var v=new c.BufferGeometry;Object.keys(h).forEach(function(d){d==="index"?v.setIndex(new c.BufferAttribute(h[d].array,h[d].itemSize)):v.setAttribute(d,new c.BufferAttribute(h[d].array,h[d].itemSize))}),s(v)}catch(d){n.postMessage({delCache:!0,workerKey:r},{cb:l,cacheVersion:o})}},cacheVersion:o})})}var St=e=>{var n={};return Z.d(n,e),n},br=e=>()=>e,je=St({extent:()=>Xe.extent,mean:()=>Xe.mean,merge:()=>Xe.merge}),Ot=e=>{var n={};return Z.d(n,e),n},wr=e=>()=>e,Ze=Ot({default:()=>Qt.default}),Ct=e=>{var n={};return Z.d(n,e),n},xr=e=>()=>e,Et=Ct({default:()=>qt.default});function Lt(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 jt=e=>{var n={};return Z.d(n,e),n},Ar=e=>()=>e,kt=jt({default:()=>er.default}),Tt=e=>{var n={};return Z.d(n,e),n},Mr=e=>()=>e,Rt=Tt({default:()=>tr.default}),Bt=e=>{var n={};return Z.d(n,e),n},Pr=e=>()=>e,ke=Bt({geoBounds:()=>Ve.geoBounds,geoContains:()=>Ve.geoContains,geoDistance:()=>Ve.geoDistance,geoInterpolate:()=>Ve.geoInterpolate}),Gt=e=>{var n={};return Z.d(n,e),n},Sr=e=>()=>e,Wt=Gt({geoVoronoi:()=>rr.geoVoronoi}),Vt=e=>{var n={};return Z.d(n,e),n},Or=e=>()=>e,Qe=Vt({scaleLinear:()=>nr.scaleLinear});function zt(e,n){return e.map(function(r){var i=[],a;return r.forEach(function(t){if(a){var o=(0,ke.geoDistance)(t,a)*180/Math.PI;if(o>n)for(var s=(0,ke.geoInterpolate)(a,t),l=1/Math.ceil(o/n),h=l;h<1;)i.push(s(h)),h+=l}i.push(a=t)}),i})}function Dt(e){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.minLng,i=n.maxLng,a=n.minLat,t=n.maxLat,o=Math.round(Math.pow(360/e,2)/Math.PI),s=(1+Math.sqrt(5))/2,l=function(u){return u/s*360%360-180},h=function(u){return Math.acos(2*u/o-1)/Math.PI*180-90},v=function(u){return o*(Math.cos((u+90)*Math.PI/180)+1)/2},d=[t!==void 0?Math.ceil(v(t)):0,a!==void 0?Math.floor(v(a)):o-1],y=r===void 0&&i===void 0?function(){return!0}:r===void 0?function(u){return u<=i}:i===void 0?function(u){return u>=r}:i>=r?function(u){return u>=r&&u<=i}:function(u){return u>=r||u<=i},_=[],w=d[0];w<=d[1];w++){var m=l(w);y(m)&&_.push([m,h(w)])}return _}function Ie(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return r?(0,ke.geoContains)(n,e):(0,Rt.default)(e,n)}function Ut(e,n){var r={type:"Polygon",coordinates:e},i=ge((0,ke.geoBounds)(r),2),a=ge(i[0],2),t=a[0],o=a[1],s=ge(i[1],2),l=s[0],h=s[1];if(Math.min(Math.abs(l-t),Math.abs(h-o))<n)return[];var v=t>l||h>=89||o<=-89;return Dt(n,{minLng:t,maxLng:l,minLat:o,maxLat:h}).filter(function(d){return Ie(d,r,v)})}function Nt(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.resolution,i=r===void 0?1/0:r,a=zt(e,i),t=(0,je.merge)(a),o=Ut(e,i),s=z(t).concat(z(o)),l={type:"Polygon",coordinates:e},h=ge((0,ke.geoBounds)(l),2),v=ge(h[0],2),d=v[0],y=v[1],_=ge(h[1],2),w=_[0],m=_[1],u=d>w||m>=89||y<=-89,A=[];if(u){var E=(0,Wt.geoVoronoi)(s).triangles(),j=new Map(s.map(function(F,Ae){var ye=ge(F,2),_e=ye[0],Be=ye[1];return["".concat(_e,"-").concat(Be),Ae]}));E.features.forEach(function(F){var Ae,ye=F.geometry.coordinates[0].slice(0,3).reverse(),_e=[];if(ye.forEach(function(Ge){var Me=ge(Ge,2),Fe=Me[0],Ht=Me[1],at="".concat(Fe,"-").concat(Ht);j.has(at)&&_e.push(j.get(at))}),_e.length===3){if(_e.some(function(Ge){return Ge<t.length})){var Be=F.properties.circumcenter;if(!Ie(Be,l,u))return}(Ae=A).push.apply(Ae,z(_e))}})}else if(o.length)for(var pe=function(F,Ae){var ye,_e=[2,1,0].map(function(Me){return ve.triangles[F+Me]}),Be=_e.map(function(Me){return s[Me]});if(_e.some(function(Me){return Me<t.length})){var Ge=[0,1].map(function(Me){return(0,je.mean)(Be,function(Fe){return Fe[Me]})});if(!Ie(Ge,l,u))return"continue"}(ye=A).push.apply(ye,z(_e))},ve=kt.default.from(s),xe=0,ee=ve.triangles.length;xe<ee;xe+=3)pe(xe,ee);else{var D=Ze.default.flatten(a),re=D.vertices,ae=D.holes,N=ae===void 0?[]:ae;A=(0,Ze.default)(re,N,2)}var Se=(0,Qe.scaleLinear)((0,je.extent)(s,function(F){return F[0]}),[0,1]),Te=(0,Qe.scaleLinear)((0,je.extent)(s,function(F){return F[1]}),[0,1]),Re=s.map(function(F){var Ae=ge(F,2),ye=Ae[0],_e=Ae[1];return[Se(ye),Te(_e)]}),it={points:s,indices:A,uvs:Re};return{contour:a,triangles:it}}var Zt=Nt,qe=new c.BufferGeometry().setAttribute?"setAttribute":"addAttribute";function Ke(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=ge(t,2),s=o[0],l=o[1];return r?Lt(s,l,n):[s,l,n]})});return Ze.default.flatten(i)}function et(e,n,r){for(var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=Ke(e,n,i),t=a.vertices,o=a.holes,s=Ke(e,r,i),l=s.vertices,h=(0,je.merge)([l,t]),v=Math.round(l.length/3),d=new Set(o),y=0,_=[],w=0;w<v;w++){var m=w+1;if(m===v)m=y;else if(d.has(m)){var u=m;m=y,y=u}_.push(w,w+v,m+v),_.push(m+v,m,w)}for(var A=[],E=1;E>=0;E--)for(var j=0;j<v;j+=1)A.push(j/(v-1),E);return{indices:_,vertices:h,uvs:A,topVerts:l}}function tt(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:Ke([e.points],n,a).vertices,uvs:r}}var It=function(e){"use strict";M(r,e);var n=k(r);function r(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};T(this,r);var t;t=n.call(this),t.type="PolygonBufferGeometry",t.parameters=(0,b.Z)({},{polygonGeoJson:i,startHeight:0,endHeight:1,closedBottom:!0,closedTop:!0,includeSides:!0,curvatureResolution:5,cartesian:!0,userDataRsoOffset:0},a);var o=t.parameters,s=o.startHeight,l=o.endHeight,h=o.closedBottom,v=o.closedTop,d=o.includeSides,y=o.curvatureResolution,_=o.cartesian,w=o.userDataRsoOffset;(0,Et.default)(i[0])||i[0].reverse();var m=Zt(i,{resolution:y}),u=m.contour,A=m.triangles,E=(0,je.merge)(A.uvs),j=[],D=[],re=[],ae=0,N=function(ve){var xe=Math.round(j.length/3),ee=re.length;j=j.concat(ve.vertices),D=D.concat(ve.uvs),re=re.concat(xe?ve.indices.map(function(Se){return Se+xe}):ve.indices),t.addGroup(ee,re.length-ee,ae++)};if(d){var pe=et(u,s,l,_);N(pe),t.userData.rso=w?et(u,s,l+w,_):pe}return h&&N(tt(A,s,E,!1,_)),v&&N(tt(A,l,E,!0,_)),t.setIndex(re),t[qe]("position",new c.Float32BufferAttribute(j,3)),t[qe]("uv",new c.Float32BufferAttribute(D,2)),t.computeVertexNormals(),t}return r}(c.BufferGeometry),Kt=function(e){"use strict";M(r,e);var n=k(r);function r(a){T(this,r);var t;return t=n.call(this),t.options=(0,b.Z)({},{geojson:[[[]]],startHeight:0,height:5,closedBottom:!0,closedTop:!0,curvatureResolution:1,cartesian:!0,userDataRsoOffset:0},a),t}var i=r.prototype;return i.create=function(){var t=this.options,o=t.startHeight,s=t.height,l=t.closedBottom,h=t.closedTop,v=t.curvatureResolution,d=t.userDataRsoOffset,y=t.cartesian,_=new It(this.options.geojson,{startHeight:o,endHeight:o+s,closedBottom:l,closedTop:h,curvatureResolution:v,cartesian:y,userDataRsoOffset:d});this.createMesh(_,this.options.material)},r}(q),rt=Z(705);function nt(e){var n=e.split,r=e.depth,i=e.points,a=e.box3,t=new c[he](new c.Shape(i),{depth:r,bevelEnabled:!1,UVGenerator:(0,rt.y)({split:n,box3:a})});return(0,rt.C)(),t}var Ft=function(e){"use strict";M(r,e);var n=k(r);function r(a){T(this,r);var t;return t=n.call(this),t.options=$e((0,b.Z)({depth:1},a),{materialOptions:(0,b.Z)({},{split:.1},a.materialOptions||{})}),t}var i=r.prototype;return i.create=function(){var t=this;return(0,P.Z)(G().mark(function o(){var s,l,h,v,d,y,_,w,m,u,A,E,j,D,re,ae,N,pe,ve,xe,ee,Se,Te,Re;return G().wrap(function(F){for(;;)switch(F.prev=F.next){case 0:if(s=t.options,l=s.points,h=s.pointsArr,v=s.useGroups,d=s.depth,y=s.geometry,_=s.geometryArr,w=s.material,m=s.materialOptions,u=s.cache,A=s.cacheKey,E=s.box3,j=0,D=Array.isArray(d)?d:[d],re=Array.isArray(E)?E:[E],ae=w,N=y,!(!ae&&m)){F.next=20;break}if(j=m.split,pe=m.topColor,ve=m.sideColor,xe=m.sideMap,ee="ExtrudePolygonMaterial:".concat(A||"".concat(ve||xe||"").concat(pe||"")),!u){F.next=16;break}return F.next=13,u.get(ee,function(){return t.getMaterial(m)});case 13:F.t0=F.sent,F.next=19;break;case 16:return F.next=18,t.getMaterial(m);case 18:F.t0=F.sent;case 19:ae=F.t0;case 20:!N&&l?N=nt({points:l,depth:D[0],split:j,box3:re[0]}):!N&&h?N=Le.mergeBufferGeometries(h.map(function(Ae,ye){return nt({points:Ae,depth:(Se=D[ye])!==null&&Se!==void 0?Se:D[0],split:j,box3:(Te=re[ye])!==null&&Te!==void 0?Te:re[0]})}),v!=null?v:!1):!N&&_&&_.length>1?N=Le.mergeBufferGeometries(_,v!=null?v:!1):!N&&_&&_.length===1&&(Re=ge(_,1),N=Re[0]),t.createMesh(N,ae);case 22:case"end":return F.stop()}},o)}))()},i.addGeometries=function(t){var o=this.object3d,s=Le.mergeBufferGeometries([o.geometry].concat(z(t)),!1);o.geometry=s},i.getMaterial=function(t){var o=this,s=t.topColor,l=t.sideColor,h=t.sideMap,v=t.type,d=t.parameters,y=t.createCanvasObjectURL,_=t.split,w=t.maxAnisotropy;return new Promise(function(m){var u=h?document.createElement("img"):{src:"",onload:function(){},width:1024,height:1024};u.onload=function(){var A=_,E=document.createElement("canvas"),j=E.getContext("2d");E.height=u.height/(1-A),E.width=u.width,A&&s&&(j.fillStyle=s,j.fillRect(0,0,u.width,E.height*A)),h&&u instanceof HTMLImageElement?j.drawImage(u,0,E.height*A,u.width,u.height):l&&(j.fillStyle=l,j.fillRect(0,E.height*A,u.width,u.height)),y&&E.toBlob(function(ae){console.log(URL.createObjectURL(ae))});var D=new c.CanvasTexture(E);D.anisotropy=w||o.pencil.renderer.capabilities.getMaxAnisotropy();var re=new c[v||"MeshBasicMaterial"]((0,b.Z)({map:D},d||{}));m(re)},h?u.src=h:u instanceof HTMLImageElement||u.onload()})},i.setMaterialColor=function(t){var o=this;return(0,P.Z)(G().mark(function s(){var l,h,v,d,y,_,w,m,u,A,E;return G().wrap(function(D){for(;;)switch(D.prev=D.next){case 0:if(l=o.options,h=l.materialOptions,v=l.cache,d=h.sideColor,y=h.sideMap,_=h.topColor,w=h.cacheKey,m=t.sideColor,u=t.topColor,!(u||m)){D.next=16;break}if(A="ExtrudePolygonMaterial:".concat(w||"".concat(m||d||y||"").concat(u||_||"")),!v){D.next=11;break}return D.next=8,v.get(A,function(){return o.getMaterial((0,b.Z)({},h,t))});case 8:D.t0=D.sent,D.next=14;break;case 11:return D.next=13,o.getMaterial((0,b.Z)({},h,t));case 13:D.t0=D.sent;case 14:E=D.t0,o.object3d.material=E;case 16:case"end":return D.stop()}},s)}))()},r}(q);function Xt(e){var n=e.worker,r=e.workerKey,i=e.coordinatesArr,a=e.depth,t=e.split,o=e.projection,s=e.cacheVersion;return new Promise(function(l,h){n.postMessage({coordinatesArr:i,depth:a,split:t!=null?t:.1,projection:o,workerKey:r},{cb:function(v){try{var d=new c.BufferGeometry;Object.keys(v).forEach(function(y){d.setAttribute(y,new c.BufferAttribute(v[y].array,v[y].itemSize))}),l(d)}catch(y){n.postMessage({delCache:!0,workerKey:r},{cb:h,cacheVersion:s})}},cacheVersion:s})})}})();var ar=de.Ei,or=de.Yo,sr=de.ZA,ur=de.Ee,cr=de.x1,lr=de.VJ,fr=de.r7,hr=de.XA,pr=de.NB,vr=de.xv,dr=de.nk,mr=de.JX,gr=de.TQ;export{ar as ConicPolygon,or as ExtrudePolygon,sr as Group,ur as Image,cr as Line,lr as MeshLine,fr as MeshLineMaterial,hr as MeshLineRaycast,pr as Node,vr as Text,dr as Video,mr as getExtrudePolygonGeometry,gr as getLineGeometry};
132
+ `),we=function(e){"use strict";M(r,e);var n=k(r);function r(){T(this,r);var i;return i=n.call(this),i.isMeshLine=!0,i.type="MeshLine",i.positions=[],i.previous=[],i.next=[],i.side=[],i.width=[],i.indices_array=[],i.uvs=[],i.counters=[],i._points=[],i._geom=null,i.widthCallback=null,i.matrixWorld=new c.Matrix4,Object.defineProperties(oe(i),{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(t){this.setGeometry(t,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(t){this.setPoints(t,this.widthCallback)}}}),i}return r}(c.BufferGeometry);we.prototype.setMatrixWorld=function(e){this.matrixWorld=e},we.prototype.setGeometry=function(e,n){this._geometry=e,this.setPoints(e.getAttribute("position").array,n)},we.prototype.setPoints=function(e,n){if(!(e instanceof Float32Array)&&!(e instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=e,this.widthCallback=n,this.positions=[],this.counters=[],e.length&&e[0]instanceof c.Vector3)for(var r=0;r<e.length;r++){var i=e[r],a=r/e.length;this.positions.push(i.x,i.y,i.z),this.positions.push(i.x,i.y,i.z),this.counters.push(a),this.counters.push(a)}else for(var r=0;r<e.length;r+=3){var a=r/e.length;this.positions.push(e[r],e[r+1],e[r+2]),this.positions.push(e[r],e[r+1],e[r+2]),this.counters.push(a),this.counters.push(a)}this.process()};function He(e,n){var r=new c.Matrix4,i=new c.Ray,a=new c.Sphere,t=new c.Vector3,o=this.geometry;if(o.boundingSphere||o.computeBoundingSphere(),a.copy(o.boundingSphere),a.applyMatrix4(this.matrixWorld),e.ray.intersectSphere(a,t)!==!1){r.copy(this.matrixWorld).invert(),i.copy(e.ray).applyMatrix4(r);var s=new c.Vector3,l=new c.Vector3,h=new c.Vector3,v=this instanceof c.LineSegments?2:1,d=o.index,y=o.attributes;if(d!==null)for(var _=d.array,w=y.position.array,m=y.width.array,u=0,A=_.length-1;u<A;u+=v){var E=_[u],j=_[u+1];s.fromArray(w,E*3),l.fromArray(w,j*3);var z=m[Math.floor(u/3)]!==void 0?m[Math.floor(u/3)]:1,re=e.params.Line.threshold+this.material.lineWidth*z/2,ae=re*re,N=i.distanceSqToSegment(s,l,t,h);if(!(N>ae)){t.applyMatrix4(this.matrixWorld);var ve=e.ray.origin.distanceTo(t);ve<e.near||ve>e.far||(n.push({distance:ve,point:h.clone().applyMatrix4(this.matrixWorld),index:u,face:null,faceIndex:null,object:this}),u=A)}}}}we.prototype.raycast=He,we.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]},we.prototype.copyV3=function(e){var n=e*6;return[this.positions[n],this.positions[n+1],this.positions[n+2]]},we.prototype.process=function(){var e=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var n,r;this.compareV3(0,e-1)?r=this.copyV3(e-2):r=this.copyV3(0),this.previous.push(r[0],r[1],r[2]),this.previous.push(r[0],r[1],r[2]);for(var i=0;i<e;i++){if(this.side.push(1),this.side.push(-1),this.widthCallback?n=this.widthCallback(i/(e-1)):n=1,this.width.push(n),this.width.push(n),this.uvs.push(i/(e-1),0),this.uvs.push(i/(e-1),1),i<e-1){r=this.copyV3(i),this.previous.push(r[0],r[1],r[2]),this.previous.push(r[0],r[1],r[2]);var a=i*2;this.indices_array.push(a,a+1,a+2),this.indices_array.push(a+2,a+1,a+3)}i>0&&(r=this.copyV3(i),this.next.push(r[0],r[1],r[2]),this.next.push(r[0],r[1],r[2]))}this.compareV3(e-1,0)?r=this.copyV3(1):r=this.copyV3(e-1),this.next.push(r[0],r[1],r[2]),this.next.push(r[0],r[1],r[2]),!this._attributes||this._attributes.position.count!==this.positions.length?this._attributes={position:new c.BufferAttribute(new Float32Array(this.positions),3),previous:new c.BufferAttribute(new Float32Array(this.previous),3),next:new c.BufferAttribute(new Float32Array(this.next),3),side:new c.BufferAttribute(new Float32Array(this.side),1),width:new c.BufferAttribute(new Float32Array(this.width),1),uv:new c.BufferAttribute(new Float32Array(this.uvs),2),index:new c.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new c.BufferAttribute(new Float32Array(this.counters),1)}:(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()};function Ue(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}we.prototype.advance=function(e){var n=this._attributes.position.array,r=this._attributes.previous.array,i=this._attributes.next.array,a=n.length;Ue(n,0,r,0,a),Ue(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,Ue(n,6,i,0,a-6),i[a-6]=e.x,i[a-5]=e.y,i[a-4]=e.z,i[a-3]=e.x,i[a-2]=e.y,i[a-1]=e.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0},c.ShaderChunk.meshline_vert=dt,c.ShaderChunk.meshline_frag=mt;var Ne=function(e){"use strict";M(r,e);var n=k(r);function r(i){T(this,r);var a;return a=n.call(this,{uniforms:Object.assign({},c.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new c.Color(16777215)},opacity:{value:1},resolution:{value:new c.Vector2(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new c.Vector2(1,1)},offset:{value:new c.Vector2(1,1)},lineLightAnimation:{value:1},time:{value:0},size:{value:300},speed:{value:.3},lightWidth:{value:.1},uCenter:{value:new c.Vector2(0,0)},lightColor:{value:new c.Color(16777215)}}),vertexShader:c.ShaderChunk.meshline_vert,fragmentShader:c.ShaderChunk.meshline_frag}),a.isMeshLineMaterial=!0,a.type="MeshLineMaterial",Object.defineProperties(oe(a),{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(o){this.uniforms.lineWidth.value=o}},lineLightAnimation:{enumerable:!0,get:function(){return this.uniforms.lineLightAnimation.value},set:function(o){this.uniforms.lineLightAnimation.value=o}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(o){this.uniforms.map.value=o}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(o){this.uniforms.useMap.value=o}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(o){this.uniforms.alphaMap.value=o}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(o){this.uniforms.useAlphaMap.value=o}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(o){this.uniforms.color.value=o}},lightColor:{enumerable:!0,get:function(){return this.uniforms.lightColor.value},set:function(o){this.uniforms.lightColor.value=o}},time:{enumerable:!0,get:function(){return this.uniforms.time.value},set:function(o){this.uniforms.time.value=o}},uCenter:{enumerable:!0,get:function(){return this.uniforms.uCenter.value},set:function(o){this.uniforms.uCenter.value=o}},size:{enumerable:!0,get:function(){return this.uniforms.size.value},set:function(o){this.uniforms.size.value=o}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(o){this.uniforms.opacity.value=o}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(o){this.uniforms.resolution.value.copy(o)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(o){this.uniforms.sizeAttenuation.value=o}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(o){this.uniforms.dashArray.value=o,this.useDash=o!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(o){this.uniforms.dashOffset.value=o}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(o){this.uniforms.dashRatio.value=o}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(o){this.uniforms.useDash.value=o}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(o){this.uniforms.visibility.value=o}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(o){this.uniforms.alphaTest.value=o}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(o){this.uniforms.repeat.value.copy(o)}}}),a.setValues(i),a}return r}(c.ShaderMaterial);Ne.prototype.copy=function(e){return c.ShaderMaterial.prototype.copy.call(this,e),this.lineWidth=e.lineWidth,this.map=e.map,this.useMap=e.useMap,this.alphaMap=e.alphaMap,this.useAlphaMap=e.useAlphaMap,this.color.copy(e.color),this.opacity=e.opacity,this.resolution.copy(e.resolution),this.sizeAttenuation=e.sizeAttenuation,this.dashArray.copy(e.dashArray),this.dashOffset.copy(e.dashOffset),this.dashRatio.copy(e.dashRatio),this.useDash=e.useDash,this.visibility=e.visibility,this.alphaTest=e.alphaTest,this.repeat.copy(e.repeat),this};function gt(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 $e(e,n){return n=n!=null?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gt(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}),e}function yt(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 _t(e,n){if(e==null)return{};var r=yt(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}function bt(e){if(Array.isArray(e))return e}function wt(){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 ge(e,n){return bt(e)||te(e,n)||me(e,n)||wt()}var xt=e=>{var n={};return Z.d(n,e),n},_r=e=>()=>e,Ye=xt({animate:()=>ct.animate,linear:()=>ct.linear}),At=e=>{var n={};return Z.d(n,e),n},br=e=>()=>e,Le=At({mergeBufferGeometries:()=>Jt.mergeBufferGeometries});function Je(e){var n=e.setPointWidth,r=e.nodes,i=new c.BufferGeometry,a=new we;return i.setFromPoints(r),a.setGeometry(i,n),a}var Mt={color:new c.Color("#ffffff"),lineWidth:1},Pt=function(e){"use strict";M(r,e);var n=k(r);function r(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r);var t;return t=n.call(this),t.options=(0,b.Z)({},Mt,a),t}var i=r.prototype;return i.create=function(){var t=this;return(0,P.Z)(G().mark(function o(){var s,l,h,v,d,y,_,w,m,u,A,E,j,z,re,ae,N,ve,de;return G().wrap(function(ee){for(;;)switch(ee.prev=ee.next){case 0:if(s=t.options,l=s.duration,h=s.delay,v=s.onComplete,d=s.setPointWidth,y=s.key,_=s.nodes,w=s.nodesArr,m=s.geometry,u=s.geometryArr,A=s.useGroups,E=s.material,j=s.cache,z=s.cacheKey,re=_t(s,["duration","delay","onComplete","setPointWidth","key","nodes","nodesArr","geometry","geometryArr","useGroups","material","cache","cacheKey"]),ae=E,N=m,ae){ee.next=15;break}if(ve="LineMaterial:".concat(z),!j){ee.next=11;break}return ee.next=8,j.get(ve,function(){return t.getMaterial((0,b.Z)({},re))});case 8:ee.t0=ee.sent,ee.next=14;break;case 11:return ee.next=13,t.getMaterial((0,b.Z)({},re));case 13:ee.t0=ee.sent;case 14:ae=ee.t0;case 15:!N&&_?N=Je({nodes:_,setPointWidth:d}):!N&&w?N=Le.mergeBufferGeometries(w.map(function(Se){return Je({nodes:Se,setPointWidth:d})}),A!=null?A:!1):!N&&u&&u.length>1?N=Le.mergeBufferGeometries(u,A!=null?A:!1):!N&&u&&u.length===1&&(de=ge(u,1),N=de[0]),t.createMesh(N,ae);case 17:case"end":return ee.stop()}},o)}))()},i.getMaterial=function(t){var o=this.pencil.getSize(),s=o.width,l=o.height,h=new Ne($e((0,b.Z)({},t),{resolution:new c.Vector2(s,l)}));return h},i.addGeometries=function(t){var o=this.object3d,s=Le.mergeBufferGeometries([o.geometry].concat(V(t)),!1);o.geometry=s},i.resize=function(t,o){this.material.uniforms.resolution.value.set(t,o)},i.animate=function(){var t=this.options,o=t.duration,s=t.delay,l=t.onComplete,h=this.material.uniforms.offset,v=s!=null?s:0,d=(0,Ye.animate)({from:h.value,to:{x:0},duration:o!=null?o:1e3,elapsed:-v,repeat:1/0,onComplete:l,ease:Ye.linear,onUpdate:function(y){h.value.x=y.x}});this.tween=d},i.dispose=function(){var t;ze(R(r.prototype),"dispose",this).call(this),(t=this.tween)===null||t===void 0||t.stop()},$(r,[{key:"material",get:function(){return this.object3d.material}}]),r}(q);function St(e){var n=e.worker,r=e.workerKey,i=e.coordinatesArr,a=e.lineWidth,t=e.projection,o=e.cacheVersion;return new Promise(function(s,l){n.postMessage({coordinatesArr:i,lineWidth:a,projection:t,workerKey:r},{cb:function(h){try{var v=new c.BufferGeometry;Object.keys(h).forEach(function(d){d==="index"?v.setIndex(new c.BufferAttribute(h[d].array,h[d].itemSize)):v.setAttribute(d,new c.BufferAttribute(h[d].array,h[d].itemSize))}),s(v)}catch(d){n.postMessage({delCache:!0,workerKey:r},{cb:l,cacheVersion:o})}},cacheVersion:o})})}var Ot=e=>{var n={};return Z.d(n,e),n},wr=e=>()=>e,je=Ot({extent:()=>Xe.extent,mean:()=>Xe.mean,merge:()=>Xe.merge}),Ct=e=>{var n={};return Z.d(n,e),n},xr=e=>()=>e,Ze=Ct({default:()=>Qt.default}),Et=e=>{var n={};return Z.d(n,e),n},Ar=e=>()=>e,Lt=Et({default:()=>qt.default});function jt(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 kt=e=>{var n={};return Z.d(n,e),n},Mr=e=>()=>e,Tt=kt({default:()=>er.default}),Rt=e=>{var n={};return Z.d(n,e),n},Pr=e=>()=>e,Bt=Rt({default:()=>tr.default}),Gt=e=>{var n={};return Z.d(n,e),n},Sr=e=>()=>e,ke=Gt({geoBounds:()=>De.geoBounds,geoContains:()=>De.geoContains,geoDistance:()=>De.geoDistance,geoInterpolate:()=>De.geoInterpolate}),Wt=e=>{var n={};return Z.d(n,e),n},Or=e=>()=>e,Dt=Wt({geoVoronoi:()=>rr.geoVoronoi}),Vt=e=>{var n={};return Z.d(n,e),n},Cr=e=>()=>e,Qe=Vt({scaleLinear:()=>nr.scaleLinear});function zt(e,n){return e.map(function(r){var i=[],a;return r.forEach(function(t){if(a){var o=(0,ke.geoDistance)(t,a)*180/Math.PI;if(o>n)for(var s=(0,ke.geoInterpolate)(a,t),l=1/Math.ceil(o/n),h=l;h<1;)i.push(s(h)),h+=l}i.push(a=t)}),i})}function Ut(e){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.minLng,i=n.maxLng,a=n.minLat,t=n.maxLat,o=Math.round(Math.pow(360/e,2)/Math.PI),s=(1+Math.sqrt(5))/2,l=function(u){return u/s*360%360-180},h=function(u){return Math.acos(2*u/o-1)/Math.PI*180-90},v=function(u){return o*(Math.cos((u+90)*Math.PI/180)+1)/2},d=[t!==void 0?Math.ceil(v(t)):0,a!==void 0?Math.floor(v(a)):o-1],y=r===void 0&&i===void 0?function(){return!0}:r===void 0?function(u){return u<=i}:i===void 0?function(u){return u>=r}:i>=r?function(u){return u>=r&&u<=i}:function(u){return u>=r||u<=i},_=[],w=d[0];w<=d[1];w++){var m=l(w);y(m)&&_.push([m,h(w)])}return _}function Ie(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return r?(0,ke.geoContains)(n,e):(0,Bt.default)(e,n)}function Nt(e,n){var r={type:"Polygon",coordinates:e},i=ge((0,ke.geoBounds)(r),2),a=ge(i[0],2),t=a[0],o=a[1],s=ge(i[1],2),l=s[0],h=s[1];if(Math.min(Math.abs(l-t),Math.abs(h-o))<n)return[];var v=t>l||h>=89||o<=-89;return Ut(n,{minLng:t,maxLng:l,minLat:o,maxLat:h}).filter(function(d){return Ie(d,r,v)})}function Zt(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.resolution,i=r===void 0?1/0:r,a=zt(e,i),t=(0,je.merge)(a),o=Nt(e,i),s=V(t).concat(V(o)),l={type:"Polygon",coordinates:e},h=ge((0,ke.geoBounds)(l),2),v=ge(h[0],2),d=v[0],y=v[1],_=ge(h[1],2),w=_[0],m=_[1],u=d>w||m>=89||y<=-89,A=[];if(u){var E=(0,Dt.geoVoronoi)(s).triangles(),j=new Map(s.map(function(F,Ae){var ye=ge(F,2),_e=ye[0],Be=ye[1];return["".concat(_e,"-").concat(Be),Ae]}));E.features.forEach(function(F){var Ae,ye=F.geometry.coordinates[0].slice(0,3).reverse(),_e=[];if(ye.forEach(function(Ge){var Me=ge(Ge,2),Fe=Me[0],Ht=Me[1],ot="".concat(Fe,"-").concat(Ht);j.has(ot)&&_e.push(j.get(ot))}),_e.length===3){if(_e.some(function(Ge){return Ge<t.length})){var Be=F.properties.circumcenter;if(!Ie(Be,l,u))return}(Ae=A).push.apply(Ae,V(_e))}})}else if(o.length)for(var ve=function(F,Ae){var ye,_e=[2,1,0].map(function(Me){return de.triangles[F+Me]}),Be=_e.map(function(Me){return s[Me]});if(_e.some(function(Me){return Me<t.length})){var Ge=[0,1].map(function(Me){return(0,je.mean)(Be,function(Fe){return Fe[Me]})});if(!Ie(Ge,l,u))return"continue"}(ye=A).push.apply(ye,V(_e))},de=Tt.default.from(s),xe=0,ee=de.triangles.length;xe<ee;xe+=3)ve(xe,ee);else{var z=Ze.default.flatten(a),re=z.vertices,ae=z.holes,N=ae===void 0?[]:ae;A=(0,Ze.default)(re,N,2)}var Se=(0,Qe.scaleLinear)((0,je.extent)(s,function(F){return F[0]}),[0,1]),Te=(0,Qe.scaleLinear)((0,je.extent)(s,function(F){return F[1]}),[0,1]),Re=s.map(function(F){var Ae=ge(F,2),ye=Ae[0],_e=Ae[1];return[Se(ye),Te(_e)]}),at={points:s,indices:A,uvs:Re};return{contour:a,triangles:at}}var It=Zt,qe=new c.BufferGeometry().setAttribute?"setAttribute":"addAttribute";function Ke(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=ge(t,2),s=o[0],l=o[1];return r?jt(s,l,n):[s,l,n]})});return Ze.default.flatten(i)}function et(e,n,r){for(var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=Ke(e,n,i),t=a.vertices,o=a.holes,s=Ke(e,r,i),l=s.vertices,h=(0,je.merge)([l,t]),v=Math.round(l.length/3),d=new Set(o),y=0,_=[],w=0;w<v;w++){var m=w+1;if(m===v)m=y;else if(d.has(m)){var u=m;m=y,y=u}_.push(w,w+v,m+v),_.push(m+v,m,w)}for(var A=[],E=1;E>=0;E--)for(var j=0;j<v;j+=1)A.push(j/(v-1),E);return{indices:_,vertices:h,uvs:A,topVerts:l}}function tt(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:Ke([e.points],n,a).vertices,uvs:r}}var rt=function(e){"use strict";M(r,e);var n=k(r);function r(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};T(this,r);var t;t=n.call(this),t.type="PolygonBufferGeometry",t.parameters=(0,b.Z)({},{polygonGeoJson:i,startHeight:0,endHeight:1,closedBottom:!0,closedTop:!0,includeSides:!0,curvatureResolution:5,cartesian:!0,userDataRsoOffset:0},a);var o=t.parameters,s=o.startHeight,l=o.endHeight,h=o.closedBottom,v=o.closedTop,d=o.includeSides,y=o.curvatureResolution,_=o.cartesian,w=o.userDataRsoOffset;(0,Lt.default)(i[0])||i[0].reverse();var m=It(i,{resolution:y}),u=m.contour,A=m.triangles,E=(0,je.merge)(A.uvs),j=[],z=[],re=[],ae=0,N=function(de){var xe=Math.round(j.length/3),ee=re.length;j=j.concat(de.vertices),z=z.concat(de.uvs),re=re.concat(xe?de.indices.map(function(Se){return Se+xe}):de.indices),t.addGroup(ee,re.length-ee,ae++)};if(d){var ve=et(u,s,l,_);N(ve),t.userData.rso=w?et(u,s,l+w,_):ve}return h&&N(tt(A,s,E,!1,_)),v&&N(tt(A,l,E,!0,_)),t.setIndex(re),t[qe]("position",new c.Float32BufferAttribute(j,3)),t[qe]("uv",new c.Float32BufferAttribute(z,2)),t.computeVertexNormals(),t}return r}(c.BufferGeometry),Kt=function(e){"use strict";M(r,e);var n=k(r);function r(a){T(this,r);var t;return t=n.call(this),t.options=(0,b.Z)({},{geojson:[[[]]],startHeight:0,height:5,closedBottom:!0,closedTop:!0,curvatureResolution:1,cartesian:!0,userDataRsoOffset:0},a),t}var i=r.prototype;return i.create=function(){var t=this.options,o=t.startHeight,s=t.height,l=t.closedBottom,h=t.closedTop,v=t.curvatureResolution,d=t.userDataRsoOffset,y=t.cartesian,_=new rt(this.options.geojson,{startHeight:o,endHeight:o+s,closedBottom:l,closedTop:h,curvatureResolution:v,cartesian:y,userDataRsoOffset:d});this.createMesh(_,this.options.material)},r}(q),nt=Z(705);function it(e){var n=e.split,r=e.depth,i=e.points,a=e.box3,t=new c[pe](new c.Shape(i),{depth:r,bevelEnabled:!1,UVGenerator:(0,nt.y)({split:n,box3:a})});return(0,nt.C)(),t}var Ft=function(e){"use strict";M(r,e);var n=k(r);function r(a){T(this,r);var t;return t=n.call(this),t.options=$e((0,b.Z)({depth:1},a),{materialOptions:(0,b.Z)({},{split:.1},a.materialOptions||{})}),t}var i=r.prototype;return i.create=function(){var t=this;return(0,P.Z)(G().mark(function o(){var s,l,h,v,d,y,_,w,m,u,A,E,j,z,re,ae,N,ve,de,xe,ee,Se,Te,Re;return G().wrap(function(F){for(;;)switch(F.prev=F.next){case 0:if(s=t.options,l=s.points,h=s.pointsArr,v=s.useGroups,d=s.depth,y=s.geometry,_=s.geometryArr,w=s.material,m=s.materialOptions,u=s.cache,A=s.cacheKey,E=s.box3,j=0,z=Array.isArray(d)?d:[d],re=Array.isArray(E)?E:[E],ae=w,N=y,!(!ae&&m)){F.next=20;break}if(j=m.split,ve=m.topColor,de=m.sideColor,xe=m.sideMap,ee="ExtrudePolygonMaterial:".concat(A||"".concat(de||xe||"").concat(ve||"")),!u){F.next=16;break}return F.next=13,u.get(ee,function(){return t.getMaterial(m)});case 13:F.t0=F.sent,F.next=19;break;case 16:return F.next=18,t.getMaterial(m);case 18:F.t0=F.sent;case 19:ae=F.t0;case 20:!N&&l?N=it({points:l,depth:z[0],split:j,box3:re[0]}):!N&&h?N=Le.mergeBufferGeometries(h.map(function(Ae,ye){return it({points:Ae,depth:(Se=z[ye])!==null&&Se!==void 0?Se:z[0],split:j,box3:(Te=re[ye])!==null&&Te!==void 0?Te:re[0]})}),v!=null?v:!1):!N&&_&&_.length>1?N=Le.mergeBufferGeometries(_,v!=null?v:!1):!N&&_&&_.length===1&&(Re=ge(_,1),N=Re[0]),t.createMesh(N,ae);case 22:case"end":return F.stop()}},o)}))()},i.addGeometries=function(t){var o=this.object3d,s=Le.mergeBufferGeometries([o.geometry].concat(V(t)),!1);o.geometry=s},i.getMaterial=function(t){var o=this,s=t.topColor,l=t.sideColor,h=t.sideMap,v=t.type,d=t.parameters,y=t.createCanvasObjectURL,_=t.split,w=t.maxAnisotropy;return new Promise(function(m){var u=h?document.createElement("img"):{src:"",onload:function(){},width:1024,height:1024};u.onload=function(){var A=_,E=document.createElement("canvas"),j=E.getContext("2d");E.height=u.height/(1-A),E.width=u.width,A&&s&&(j.fillStyle=s,j.fillRect(0,0,u.width,E.height*A)),h&&u instanceof HTMLImageElement?j.drawImage(u,0,E.height*A,u.width,u.height):l&&(j.fillStyle=l,j.fillRect(0,E.height*A,u.width,u.height)),y&&E.toBlob(function(ae){console.log(URL.createObjectURL(ae))});var z=new c.CanvasTexture(E);z.anisotropy=w||o.pencil.renderer.capabilities.getMaxAnisotropy();var re=new c[v||"MeshBasicMaterial"]((0,b.Z)({map:z},d||{}));m(re)},h?u.src=h:u instanceof HTMLImageElement||u.onload()})},i.setMaterialColor=function(t){var o=this;return(0,P.Z)(G().mark(function s(){var l,h,v,d,y,_,w,m,u,A,E;return G().wrap(function(z){for(;;)switch(z.prev=z.next){case 0:if(l=o.options,h=l.materialOptions,v=l.cache,d=h.sideColor,y=h.sideMap,_=h.topColor,w=h.cacheKey,m=t.sideColor,u=t.topColor,!(u||m)){z.next=16;break}if(A="ExtrudePolygonMaterial:".concat(w||"".concat(m||d||y||"").concat(u||_||"")),!v){z.next=11;break}return z.next=8,v.get(A,function(){return o.getMaterial((0,b.Z)({},h,t))});case 8:z.t0=z.sent,z.next=14;break;case 11:return z.next=13,o.getMaterial((0,b.Z)({},h,t));case 13:z.t0=z.sent;case 14:E=z.t0,o.object3d.material=E;case 16:case"end":return z.stop()}},s)}))()},r}(q);function Xt(e){var n=e.worker,r=e.workerKey,i=e.coordinatesArr,a=e.depth,t=e.split,o=e.projection,s=e.cacheVersion;return new Promise(function(l,h){n.postMessage({coordinatesArr:i,depth:a,split:t!=null?t:.1,projection:o,workerKey:r},{cb:function(v){try{var d=new c.BufferGeometry;Object.keys(v).forEach(function(y){d.setAttribute(y,new c.BufferAttribute(v[y].array,v[y].itemSize))}),l(d)}catch(y){n.postMessage({delCache:!0,workerKey:r},{cb:h,cacheVersion:s})}},cacheVersion:s})})}})();var ar=fe.Ei,or=fe.ED,sr=fe.Yo,ur=fe.ZA,cr=fe.Ee,lr=fe.x1,fr=fe.VJ,hr=fe.r7,pr=fe.XA,vr=fe.NB,dr=fe.xv,mr=fe.nk,gr=fe.JX,yr=fe.TQ;export{ar as ConicPolygon,or as ConicPolygonGeometry,sr as ExtrudePolygon,ur as Group,cr as Image,lr as Line,fr as MeshLine,hr as MeshLineMaterial,pr as MeshLineRaycast,vr as Node,dr as Text,mr as Video,gr as getExtrudePolygonGeometry,yr as getLineGeometry};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gl-draw",
3
- "version": "0.8.33",
3
+ "version": "0.8.34",
4
4
  "author": "gitplus <hstits@gmail.com>",
5
5
  "scripts": {
6
6
  "start": "PORT=3003 bundler-dev",