gl-draw 0.0.20 → 0.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (function(){var Ae={666:function(A){var P=function(y){"use strict";var R=Object.prototype,S=R.hasOwnProperty,j,_=typeof Symbol=="function"?Symbol:{},E=_.iterator||"@@iterator",F=_.asyncIterator||"@@asyncIterator",L=_.toStringTag||"@@toStringTag";function k(s,o,l){return Object.defineProperty(s,o,{value:l,enumerable:!0,configurable:!0,writable:!0}),s[o]}try{k({},"")}catch(s){k=function(o,l,m){return o[l]=m}}function $(s,o,l,m){var v=o&&o.prototype instanceof M?o:M,T=Object.create(v.prototype),N=new ce(m||[]);return T._invoke=J(s,l,N),T}y.wrap=$;function H(s,o,l){try{return{type:"normal",arg:s.call(o,l)}}catch(m){return{type:"throw",arg:m}}}var B="suspendedStart",c="suspendedYield",ie="executing",V="completed",W={};function M(){}function D(){}function z(){}var ee={};k(ee,E,function(){return this});var te=Object.getPrototypeOf,re=te&&te(te(ae([])));re&&re!==R&&S.call(re,E)&&(ee=re);var q=z.prototype=M.prototype=Object.create(ee);D.prototype=z,k(q,"constructor",z),k(z,"constructor",D),D.displayName=k(z,L,"GeneratorFunction");function ne(s){["next","throw","return"].forEach(function(o){k(s,o,function(l){return this._invoke(o,l)})})}y.isGeneratorFunction=function(s){var o=typeof s=="function"&&s.constructor;return o?o===D||(o.displayName||o.name)==="GeneratorFunction":!1},y.mark=function(s){return Object.setPrototypeOf?Object.setPrototypeOf(s,z):(s.__proto__=z,k(s,L,"GeneratorFunction")),s.prototype=Object.create(q),s},y.awrap=function(s){return{__await:s}};function oe(s,o){function l(T,N,Y,Q){var K=H(s[T],s,N);if(K.type==="throw")Q(K.arg);else{var he=K.arg,ue=he.value;return ue&&typeof ue=="object"&&S.call(ue,"__await")?o.resolve(ue.__await).then(function(I){l("next",I,Y,Q)},function(I){l("throw",I,Y,Q)}):o.resolve(ue).then(function(I){he.value=I,Y(he)},function(I){return l("throw",I,Y,Q)})}}var m;function v(T,N){function Y(){return new o(function(Q,K){l(T,N,Q,K)})}return m=m?m.then(Y,Y):Y()}this._invoke=v}ne(oe.prototype),k(oe.prototype,F,function(){return this}),y.AsyncIterator=oe,y.async=function(s,o,l,m,v){v===void 0&&(v=Promise);var T=new oe($(s,o,l,m),v);return y.isGeneratorFunction(o)?T:T.next().then(function(N){return N.done?N.value:T.next()})};function J(s,o,l){var m=B;return function(T,N){if(m===ie)throw new Error("Generator is already running");if(m===V){if(T==="throw")throw N;return pe()}for(l.method=T,l.arg=N;;){var Y=l.delegate;if(Y){var Q=se(Y,l);if(Q){if(Q===W)continue;return Q}}if(l.method==="next")l.sent=l._sent=l.arg;else if(l.method==="throw"){if(m===B)throw m=V,l.arg;l.dispatchException(l.arg)}else l.method==="return"&&l.abrupt("return",l.arg);m=ie;var K=H(s,o,l);if(K.type==="normal"){if(m=l.done?V:c,K.arg===W)continue;return{value:K.arg,done:l.done}}else K.type==="throw"&&(m=V,l.method="throw",l.arg=K.arg)}}}function se(s,o){var l=s.iterator[o.method];if(l===j){if(o.delegate=null,o.method==="throw"){if(s.iterator.return&&(o.method="return",o.arg=j,se(s,o),o.method==="throw"))return W;o.method="throw",o.arg=new TypeError("The iterator does not provide a 'throw' method")}return W}var m=H(l,s.iterator,o.arg);if(m.type==="throw")return o.method="throw",o.arg=m.arg,o.delegate=null,W;var v=m.arg;if(!v)return o.method="throw",o.arg=new TypeError("iterator result is not an object"),o.delegate=null,W;if(v.done)o[s.resultName]=v.value,o.next=s.nextLoc,o.method!=="return"&&(o.method="next",o.arg=j);else return v;return o.delegate=null,W}ne(q),k(q,L,"Generator"),k(q,E,function(){return this}),k(q,"toString",function(){return"[object Generator]"});function fe(s){var o={tryLoc:s[0]};1 in s&&(o.catchLoc=s[1]),2 in s&&(o.finallyLoc=s[2],o.afterLoc=s[3]),this.tryEntries.push(o)}function le(s){var o=s.completion||{};o.type="normal",delete o.arg,s.completion=o}function ce(s){this.tryEntries=[{tryLoc:"root"}],s.forEach(fe,this),this.reset(!0)}y.keys=function(s){var o=[];for(var l in s)o.push(l);return o.reverse(),function m(){for(;o.length;){var v=o.pop();if(v in s)return m.value=v,m.done=!1,m}return m.done=!0,m}};function ae(s){if(s){var o=s[E];if(o)return o.call(s);if(typeof s.next=="function")return s;if(!isNaN(s.length)){var l=-1,m=function v(){for(;++l<s.length;)if(S.call(s,l))return v.value=s[l],v.done=!1,v;return v.value=j,v.done=!0,v};return m.next=m}}return{next:pe}}y.values=ae;function pe(){return{value:j,done:!0}}return ce.prototype={constructor:ce,reset:function(s){if(this.prev=0,this.next=0,this.sent=this._sent=j,this.done=!1,this.delegate=null,this.method="next",this.arg=j,this.tryEntries.forEach(le),!s)for(var o in this)o.charAt(0)==="t"&&S.call(this,o)&&!isNaN(+o.slice(1))&&(this[o]=j)},stop:function(){this.done=!0;var s=this.tryEntries[0],o=s.completion;if(o.type==="throw")throw o.arg;return this.rval},dispatchException:function(s){if(this.done)throw s;var o=this;function l(Q,K){return T.type="throw",T.arg=s,o.next=Q,K&&(o.method="next",o.arg=j),!!K}for(var m=this.tryEntries.length-1;m>=0;--m){var v=this.tryEntries[m],T=v.completion;if(v.tryLoc==="root")return l("end");if(v.tryLoc<=this.prev){var N=S.call(v,"catchLoc"),Y=S.call(v,"finallyLoc");if(N&&Y){if(this.prev<v.catchLoc)return l(v.catchLoc,!0);if(this.prev<v.finallyLoc)return l(v.finallyLoc)}else if(N){if(this.prev<v.catchLoc)return l(v.catchLoc,!0)}else if(Y){if(this.prev<v.finallyLoc)return l(v.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(s,o){for(var l=this.tryEntries.length-1;l>=0;--l){var m=this.tryEntries[l];if(m.tryLoc<=this.prev&&S.call(m,"finallyLoc")&&this.prev<m.finallyLoc){var v=m;break}}v&&(s==="break"||s==="continue")&&v.tryLoc<=o&&o<=v.finallyLoc&&(v=null);var T=v?v.completion:{};return T.type=s,T.arg=o,v?(this.method="next",this.next=v.finallyLoc,W):this.complete(T)},complete:function(s,o){if(s.type==="throw")throw s.arg;return s.type==="break"||s.type==="continue"?this.next=s.arg:s.type==="return"?(this.rval=this.arg=s.arg,this.method="return",this.next="end"):s.type==="normal"&&o&&(this.next=o),W},finish:function(s){for(var o=this.tryEntries.length-1;o>=0;--o){var l=this.tryEntries[o];if(l.finallyLoc===s)return this.complete(l.completion,l.afterLoc),le(l),W}},catch:function(s){for(var o=this.tryEntries.length-1;o>=0;--o){var l=this.tryEntries[o];if(l.tryLoc===s){var m=l.completion;if(m.type==="throw"){var v=m.arg;le(l)}return v}}throw new Error("illegal catch attempt")},delegateYield:function(s,o,l){return this.delegate={iterator:ae(s),resultName:o,nextLoc:l},this.method==="next"&&(this.arg=j),W}},y}(A.exports);try{regeneratorRuntime=P}catch(y){typeof globalThis=="object"?globalThis.regeneratorRuntime=P:Function("r","regeneratorRuntime = r")(P)}},695:function(A,P,y){"use strict";y.d(P,{Z:function(){return R}});function R(S){if(S.geometry&&S.geometry.dispose(),S.material){var j=Array.isArray(S.material)?S.material:[S.material];j.forEach(function(_){var E,F,L,k,$,H,B,c,ie,V,W,M,D;(E=_.map)===null||E===void 0||E.dispose(),(F=_.lightMap)===null||F===void 0||F.dispose(),(L=_.bumpMap)===null||L===void 0||L.dispose(),(k=_.normalMap)===null||k===void 0||k.dispose(),($=_.specularMap)===null||$===void 0||$.dispose(),(H=_.envMap)===null||H===void 0||H.dispose(),(B=_.alphaMap)===null||B===void 0||B.dispose(),(c=_.aoMap)===null||c===void 0||c.dispose(),(ie=_.displacementMap)===null||ie===void 0||ie.dispose(),(V=_.emissiveMap)===null||V===void 0||V.dispose(),(W=_.gradientMap)===null||W===void 0||W.dispose(),(M=_.metalnessMap)===null||M===void 0||M.dispose(),(D=_.roughnessMap)===null||D===void 0||D.dispose(),_.dispose()})}}},519:function(A,P,y){"use strict";y.d(P,{disposeMesh:function(){return _.Z}});var R=y(666),S=y.n(R),j=null,_=y(695),E=y(644);function F(V){if(V.material){var W=Array.isArray(V.material)?V.material:[V.material];W.forEach(function(M){var D,z;(D=M.color)===null||D===void 0||D.convertSRGBToLinear(),(z=M.emissive)===null||z===void 0||z.convertSRGBToLinear(),M.map&&(M.map.encoding=THREE.sRGBEncoding),M.emissiveMap&&(M.emissiveMap.encoding=THREE.sRGBEncoding)})}}var L=y(568),k=y(924),$=require("idb-keyval"),H=y(484),B=null,c=null,ie=function(){var V=(0,L.Z)(S().mark(function W(M,D){var z,ee,te,re,q,ne;return S().wrap(function(J){for(;;)switch(J.prev=J.next){case 0:return z=D.version,J.next=4,(0,$.get)(M);case 4:if(te=J.sent,!(te&&te[z])){J.next=9;break}ee=te[z],J.next=15;break;case 9:return J.next=11,(0,H.Z)(fetch(M).then(function(se){if(se.ok)return se.blob();throw new Error}));case 11:re=J.sent,q=re.res,ne=re.err,ne||(ee=q,(0,$.set)(M,(0,k.Z)({},z,q)));case 15:return J.abrupt("return",ee?{url:URL.createObjectURL(ee)}:{url:M});case 16:case"end":return J.stop()}},W)}));return function(M,D){return V.apply(this,arguments)}}()},484:function(A,P,y){"use strict";y.d(P,{Z:function(){return S}});var R=y(42);function S(j){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return j.then(function(E){return(0,R.Z)({err:null,res:E},_)}).catch(function(E){return(0,R.Z)({err:E,res:void 0},_)})}},644:function(A){"use strict";A.exports=require("three")},568:function(A,P,y){"use strict";y.d(P,{Z:function(){return S}});function R(j,_,E,F,L,k,$){try{var H=j[k]($),B=H.value}catch(c){E(c);return}H.done?_(B):Promise.resolve(B).then(F,L)}function S(j){return function(){var _=this,E=arguments;return new Promise(function(F,L){var k=j.apply(_,E);function $(B){R(k,F,L,$,H,"next",B)}function H(B){R(k,F,L,$,H,"throw",B)}$(void 0)})}}},924:function(A,P,y){"use strict";y.d(P,{Z:function(){return R}});function R(S,j,_){return j in S?Object.defineProperty(S,j,{value:_,enumerable:!0,configurable:!0,writable:!0}):S[j]=_,S}},42:function(A,P,y){"use strict";y.d(P,{Z:function(){return S}});var R=y(924);function S(j){for(var _=1;_<arguments.length;_++){var E=arguments[_]!=null?arguments[_]:{},F=Object.keys(E);typeof Object.getOwnPropertySymbols=="function"&&(F=F.concat(Object.getOwnPropertySymbols(E).filter(function(L){return Object.getOwnPropertyDescriptor(E,L).enumerable}))),F.forEach(function(L){(0,R.Z)(j,L,E[L])})}return j}}},ge={};function Z(A){var P=ge[A];if(P!==void 0)return P.exports;var y=ge[A]={exports:{}};return Ae[A](y,y.exports,Z),y.exports}(function(){Z.n=function(A){var P=A&&A.__esModule?function(){return A.default}:function(){return A};return Z.d(P,{a:P}),P}})(),function(){Z.d=function(A,P){for(var y in P)Z.o(P,y)&&!Z.o(A,y)&&Object.defineProperty(A,y,{enumerable:!0,get:P[y]})}}(),function(){Z.o=function(A,P){return Object.prototype.hasOwnProperty.call(A,P)}}(),function(){Z.r=function(A){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(A,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(A,"__esModule",{value:!0})}}();var ve={};(function(){"use strict";Z.r(ve),Z.d(ve,{Image:function(){return m},Line:function(){return Ce},MeshLine:function(){return I},MeshLineMaterial:function(){return me},MeshLineRaycast:function(){return be},Node:function(){return K},Text:function(){return pe},Video:function(){return Y}});function A(e,i){if(!(e instanceof i))throw new TypeError("Cannot call a class as a function")}function P(e,i){return P=Object.setPrototypeOf||function(n,a){return n.__proto__=a,n},P(e,i)}function y(e,i){return P(e,i)}function R(e,i){if(typeof i!="function"&&i!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),i&&y(e,i)}var S=Z(42);function j(e,i){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);i&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function _(e,i){return i=i!=null?i:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):j(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))}),e}function E(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function F(e){return F=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},F(e)}function L(e){return F(e)}function k(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $(e){return e&&e.constructor===Symbol?"symbol":typeof e}function H(e,i){return i&&($(i)==="object"||typeof i=="function")?i:k(e)}function B(e){var i=E();return function(){var n=L(e),a;if(i){var t=L(this).constructor;a=Reflect.construct(n,arguments,t)}else a=n.apply(this,arguments);return H(this,a)}}var c=Z(644);function ie(){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 V(e,i,r){return ie()?V=Reflect.construct:V=function(a,t,u){var h=[null];h.push.apply(h,t);var p=Function.bind.apply(a,h),d=new p;return u&&y(d,u.prototype),d},V.apply(null,arguments)}function W(e,i,r){return V.apply(null,arguments)}function M(e,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(e,n.key,n)}}function D(e,i,r){return i&&M(e.prototype,i),r&&M(e,r),e}function z(e,i){(i==null||i>e.length)&&(i=e.length);for(var r=0,n=new Array(i);r<i;r++)n[r]=e[r];return n}function ee(e){if(Array.isArray(e))return z(e)}function te(e){if(typeof Symbol!="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function re(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function q(e,i){if(!!e){if(typeof e=="string")return z(e,i);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 z(e,i)}}function ne(e){return ee(e)||te(e)||q(e)||re()}var oe=Z(484);function J(){var e=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}),e&&(r.promise=(0,oe.Z)(r.promise,i)),r}var se=require("three/examples/jsm/renderers/CSS2DRenderer"),fe=require("three/examples/jsm/renderers/CSS3DRenderer"),le=Z(519),ce=function(e){e&&((0,le.disposeMesh)(e),e.children.forEach(function(i){i.userData.BaseObject_||ce(i)}))},ae=function(){"use strict";function e(){A(this,e),this.objecttype__="BaseObject",this.userData={},this.pm=J(),this.visible=!1}var i=e.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),t=0;t<n;t++)a[t]=arguments[t];return this.object3d=W(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),t=0;t<n;t++)a[t]=arguments[t];return this.object3d=W(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 fe.CSS3DObject(n),this},i.createCSS3DSprite=function(n){return this.object3d=new fe.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),t=0;t<n;t++)a[t]=arguments[t];var u;return(u=this.object3d).add.apply(u,ne(a)),this},i.remove=function(){for(var n=arguments.length,a=new Array(n),t=0;t<n;t++)a[t]=arguments[t];var u;return(u=this.object3d).remove.apply(u,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(){ce(this.object3d)},D(e,[{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})}}]),e}(),pe=function(e){"use strict";R(r,e);var i=B(r);function r(a){A(this,r);var t;return t=i.call(this),t.width=0,t.options=(0,S.Z)({},{scale:.5,fontSize:28,fontFamily:"system-ui,-apple-system,BlinkMacSystemFont,sans-serif",fontWeight:"normal",flipX:!1,sprite:!1,sizeAttenuation:!0},a),t}var n=r.prototype;return n.init=function(){var t=document.createElement("canvas");this.canvas=t},n.create=function(){var t=this.options,u=t.position,h=t.lookAt,p=t.sprite,d=t.text,g=t.sizeAttenuation;if(p){var b=new c.Sprite(new c.SpriteMaterial({transparent:!0,sizeAttenuation:g}));this.object3d=b}else{var w=new c.MeshBasicMaterial({side:c.DoubleSide,transparent:!0}),O=new c.PlaneGeometry(1,1,1,1);this.createMesh(O,w)}this.object3d.position.copy(u),h&&this.object3d.lookAt(h),this.setText(d)},n.setText=function(t,u){var h=(0,S.Z)(_((0,S.Z)({},this.options),{text:t}),u||{}),p=h.text,d=h.fontSize,g=h.fontFamily,b=h.fontWeight,w=h.flipX,O=h.scale,x=this.canvas;x.width=d*p.length*2,x.height=d;var C=x.getContext("2d");C.font="".concat(b," ").concat(d,"px/1 ").concat(g);var f=C.measureText(p).width;x.width=f,this.width=f,C=x.getContext("2d"),C.clearRect(0,0,x.width,x.height),w&&C.scale(-1,1),C.font="".concat(b," ").concat(d,"px/1 ").concat(g),C.textBaseline="middle",C.fillStyle="#ffffff",C.fillText(p,w?f*-1:0,x.height/2),C.restore();var U=new c.Texture(x);U.anisotropy=16,U.needsUpdate=!0;var G=this.object3d;G.material.map&&G.material.map.dispose(),G.material.map=U,G.material.needsUpdate=!0,G.scale.set(U.image.width*O,U.image.height*O,1)},r}(ae),s=Z(568),o=Z(666),l=Z.n(o),m=function(e){"use strict";R(r,e);var i=B(r);function r(a){A(this,r);var t;return t=i.call(this),t.options=a,t}var n=r.prototype;return n.getMaterial=function(){var t=this;return(0,s.Z)(l().mark(function u(){var h,p,d,g,b,w,O,x,C,f;return l().wrap(function(G){for(;;)switch(G.prev=G.next){case 0:return h=t.options,p=h.transparent,d=h.blending,g=h.src,b=h.depthWrite,w=h.alphaTest,O=h.sprite,x=h.sizeAttenuation,G.next=3,new c.TextureLoader().loadAsync(g);case 3:return C=G.sent,f=O?new c.SpriteMaterial({map:C,transparent:p!=null?p:!1,blending:d!=null?d:c.NormalBlending,depthWrite:b!=null?b:!0,alphaTest:w!=null?w:0,sizeAttenuation:x!=null?x:!0}):new c.MeshBasicMaterial({map:C,transparent:p!=null?p:!1,blending:d!=null?d:c.NormalBlending,depthWrite:b!=null?b:!0,alphaTest:w!=null?w:0}),G.abrupt("return",f);case 6:case"end":return G.stop()}},u)}))()},n.create=function(){var t=this;return(0,s.Z)(l().mark(function u(){var h,p,d,g,b,w,O,x;return l().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:if(h=t.options,p=h.scale,d=h.position,g=h.src,b=h.cache,w=h.sprite,!(b&&!b.get(g))){f.next=7;break}return b.init(g),f.next=5,t.getMaterial();case 5:O=f.sent,b.set(g,O);case 7:if(!b){f.next=13;break}return f.next=10,b.get(g);case 10:f.t0=f.sent,f.next=16;break;case 13:return f.next=15,t.getMaterial();case 15:f.t0=f.sent;case 16:x=f.t0,t.texture=x.map,w?t.createSprite(x):t.createMesh(new c.PlaneBufferGeometry(1,1),x),p&&t.object3d.scale.set(x.map.image.width*p,x.map.image.height*p,1),d&&t.object3d.position.copy(d);case 21:case"end":return f.stop()}},u)}))()},r}(ae);function v(e,i){for(;!Object.prototype.hasOwnProperty.call(e,i)&&(e=L(e),e!==null););return e}function T(e,i,r){return typeof Reflect!="undefined"&&Reflect.get?T=Reflect.get:T=function(a,t,u){var h=v(a,t);if(!!h){var p=Object.getOwnPropertyDescriptor(h,t);return p.get?p.get.call(u||a):p.value}},T(e,i,r)}function N(e,i,r){return T(e,i,r)}var Y=function(e){"use strict";R(r,e);var i=B(r);function r(a){A(this,r);var t;return t=i.call(this),t.options=(0,S.Z)({},{autoPlay:!0,loop:!0},a),t}var n=r.prototype;return n.getMaterial=function(){var t=this.options,u=t.src,h=t.transparent,p=t.blending,d=t.depthWrite,g=t.format,b=t.autoPlay,w=t.loop,O=t.alphaTest,x=t.sprite,C=J(),f=document.createElement("video");return f.addEventListener("loadedmetadata",function(){var U=new c.VideoTexture(f);U.format=g!=null?g:c.RGBAFormat,U.needsUpdate=!0;var G=x?new c.SpriteMaterial({map:U,transparent:h!=null?h:!1,blending:p!=null?p:c.NormalBlending,depthWrite:d!=null?d:!0,alphaTest:O!=null?O:0}):new c.MeshBasicMaterial({map:U,transparent:h!=null?h:!1,blending:p!=null?p:c.NormalBlending,depthWrite:d!=null?d:!0,alphaTest:O!=null?O:0});C.resolve(G)},!1),f.src=u,f.muted=!0,f.autoplay=b,f.loop=w,f.preload="auto",C.promise},n.create=function(){var t=this;return(0,s.Z)(l().mark(function u(){var h,p,d,g,b,w,O,x;return l().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:if(h=t.options,p=h.scale,d=h.position,g=h.src,b=h.cache,w=h.sprite,!(b&&!b.get(g))){f.next=7;break}return b.init(g),f.next=5,t.getMaterial();case 5:O=f.sent,b.set(g,O);case 7:if(!b){f.next=13;break}return f.next=10,b.get(g);case 10:f.t0=f.sent,f.next=16;break;case 13:return f.next=15,t.getMaterial();case 15:f.t0=f.sent;case 16:x=f.t0,t.video=x.map.image,w?t.createSprite(x):t.createMesh(new c.PlaneBufferGeometry(1,1),x),p&&t.object3d.scale.set(t.video.videoWidth*p,t.video.videoHeight*p,1),d&&t.object3d.position.copy(d);case 21:case"end":return f.stop()}},u)}))()},n.render=function(){var t=this.options.autoPlay;t&&this.video.play()},n.dispose=function(){this.video.pause(),this.video.src="",this.video.load(),N(L(r.prototype),"dispose",this).call(this)},r}(ae),Q=function(e){"use strict";R(r,e);var i=B(r);function r(a){A(this,r);var t;return t=i.call(this),t.options=(0,S.Z)({},a),t}var n=r.prototype;return n.create=function(){var t=this.options,u=t.position,h=t.children,p=t.onClick,d=t.zIndexFix,g=document.createElement("div");g.appendChild(h),this.createCSS2DObject(g),u&&this.object3d.position.copy(u),p&&g.addEventListener("click",p),d&&(this.object3d.userData.zIndexFix=d)},n.getMaterial=function(t){return(0,s.Z)(l().mark(function u(){var h,p,d,g;return l().wrap(function(w){for(;;)switch(w.prev=w.next){case 0:return h=document.createElement("canvas"),h.width=256,h.height=256,p=h.getContext("2d"),p.fillStyle="#ff0000",p.fillRect(0,0,256,256),d=new c.CanvasTexture(h),g=new c.SpriteMaterial({map:d,opacity:t?1:0,transparent:!0,alphaTest:.1,sizeAttenuation:!1}),w.abrupt("return",g);case 9:case"end":return w.stop()}},u)}))()},n.createPickObject=function(t){var u=t.show,h=u===void 0?!1:u,p=t.scale,d=p===void 0?new c.Vector3(1,1,1):p,g=t.position,b=g===void 0?new c.Vector3(0,0,0):g,w=t.cache,O=this;return(0,s.Z)(l().mark(function x(){var C,f,U,G;return l().wrap(function(X){for(;;)switch(X.prev=X.next){case 0:if(C="node-create-pick-object",!(w&&!w.get(C))){X.next=7;break}return w.init(C),X.next=5,O.getMaterial(h);case 5:f=X.sent,w.set(C,f);case 7:if(!w){X.next=13;break}return X.next=10,w.get(C);case 10:X.t0=X.sent,X.next=16;break;case 13:return X.next=15,O.getMaterial(h);case 15:X.t0=X.sent;case 16:U=X.t0,G=new c.Sprite(U),G.scale.set(U.map.image.width*d.x,U.map.image.height*d.y,1),G.position.copy(b),O.add(G),O.pickObject=G;case 22:case"end":return X.stop()}},x)}))()},n.dispose=function(){var t=this.options.onClick;if(t){var u;(u=this.object3d.element)===null||u===void 0||u.removeEventListener("click",t)}N(L(r.prototype),"dispose",this).call(this)},r}(ae),K=Q,he=`
1
+ (function(){var Ae={666:function(A){var P=function(y){"use strict";var R=Object.prototype,S=R.hasOwnProperty,j,_=typeof Symbol=="function"?Symbol:{},E=_.iterator||"@@iterator",F=_.asyncIterator||"@@asyncIterator",L=_.toStringTag||"@@toStringTag";function k(s,o,l){return Object.defineProperty(s,o,{value:l,enumerable:!0,configurable:!0,writable:!0}),s[o]}try{k({},"")}catch(s){k=function(o,l,m){return o[l]=m}}function $(s,o,l,m){var v=o&&o.prototype instanceof M?o:M,T=Object.create(v.prototype),N=new ce(m||[]);return T._invoke=J(s,l,N),T}y.wrap=$;function H(s,o,l){try{return{type:"normal",arg:s.call(o,l)}}catch(m){return{type:"throw",arg:m}}}var B="suspendedStart",c="suspendedYield",ie="executing",V="completed",W={};function M(){}function D(){}function z(){}var ee={};k(ee,E,function(){return this});var te=Object.getPrototypeOf,re=te&&te(te(ae([])));re&&re!==R&&S.call(re,E)&&(ee=re);var q=z.prototype=M.prototype=Object.create(ee);D.prototype=z,k(q,"constructor",z),k(z,"constructor",D),D.displayName=k(z,L,"GeneratorFunction");function ne(s){["next","throw","return"].forEach(function(o){k(s,o,function(l){return this._invoke(o,l)})})}y.isGeneratorFunction=function(s){var o=typeof s=="function"&&s.constructor;return o?o===D||(o.displayName||o.name)==="GeneratorFunction":!1},y.mark=function(s){return Object.setPrototypeOf?Object.setPrototypeOf(s,z):(s.__proto__=z,k(s,L,"GeneratorFunction")),s.prototype=Object.create(q),s},y.awrap=function(s){return{__await:s}};function oe(s,o){function l(T,N,Y,Q){var K=H(s[T],s,N);if(K.type==="throw")Q(K.arg);else{var he=K.arg,ue=he.value;return ue&&typeof ue=="object"&&S.call(ue,"__await")?o.resolve(ue.__await).then(function(I){l("next",I,Y,Q)},function(I){l("throw",I,Y,Q)}):o.resolve(ue).then(function(I){he.value=I,Y(he)},function(I){return l("throw",I,Y,Q)})}}var m;function v(T,N){function Y(){return new o(function(Q,K){l(T,N,Q,K)})}return m=m?m.then(Y,Y):Y()}this._invoke=v}ne(oe.prototype),k(oe.prototype,F,function(){return this}),y.AsyncIterator=oe,y.async=function(s,o,l,m,v){v===void 0&&(v=Promise);var T=new oe($(s,o,l,m),v);return y.isGeneratorFunction(o)?T:T.next().then(function(N){return N.done?N.value:T.next()})};function J(s,o,l){var m=B;return function(T,N){if(m===ie)throw new Error("Generator is already running");if(m===V){if(T==="throw")throw N;return pe()}for(l.method=T,l.arg=N;;){var Y=l.delegate;if(Y){var Q=se(Y,l);if(Q){if(Q===W)continue;return Q}}if(l.method==="next")l.sent=l._sent=l.arg;else if(l.method==="throw"){if(m===B)throw m=V,l.arg;l.dispatchException(l.arg)}else l.method==="return"&&l.abrupt("return",l.arg);m=ie;var K=H(s,o,l);if(K.type==="normal"){if(m=l.done?V:c,K.arg===W)continue;return{value:K.arg,done:l.done}}else K.type==="throw"&&(m=V,l.method="throw",l.arg=K.arg)}}}function se(s,o){var l=s.iterator[o.method];if(l===j){if(o.delegate=null,o.method==="throw"){if(s.iterator.return&&(o.method="return",o.arg=j,se(s,o),o.method==="throw"))return W;o.method="throw",o.arg=new TypeError("The iterator does not provide a 'throw' method")}return W}var m=H(l,s.iterator,o.arg);if(m.type==="throw")return o.method="throw",o.arg=m.arg,o.delegate=null,W;var v=m.arg;if(!v)return o.method="throw",o.arg=new TypeError("iterator result is not an object"),o.delegate=null,W;if(v.done)o[s.resultName]=v.value,o.next=s.nextLoc,o.method!=="return"&&(o.method="next",o.arg=j);else return v;return o.delegate=null,W}ne(q),k(q,L,"Generator"),k(q,E,function(){return this}),k(q,"toString",function(){return"[object Generator]"});function fe(s){var o={tryLoc:s[0]};1 in s&&(o.catchLoc=s[1]),2 in s&&(o.finallyLoc=s[2],o.afterLoc=s[3]),this.tryEntries.push(o)}function le(s){var o=s.completion||{};o.type="normal",delete o.arg,s.completion=o}function ce(s){this.tryEntries=[{tryLoc:"root"}],s.forEach(fe,this),this.reset(!0)}y.keys=function(s){var o=[];for(var l in s)o.push(l);return o.reverse(),function m(){for(;o.length;){var v=o.pop();if(v in s)return m.value=v,m.done=!1,m}return m.done=!0,m}};function ae(s){if(s){var o=s[E];if(o)return o.call(s);if(typeof s.next=="function")return s;if(!isNaN(s.length)){var l=-1,m=function v(){for(;++l<s.length;)if(S.call(s,l))return v.value=s[l],v.done=!1,v;return v.value=j,v.done=!0,v};return m.next=m}}return{next:pe}}y.values=ae;function pe(){return{value:j,done:!0}}return ce.prototype={constructor:ce,reset:function(s){if(this.prev=0,this.next=0,this.sent=this._sent=j,this.done=!1,this.delegate=null,this.method="next",this.arg=j,this.tryEntries.forEach(le),!s)for(var o in this)o.charAt(0)==="t"&&S.call(this,o)&&!isNaN(+o.slice(1))&&(this[o]=j)},stop:function(){this.done=!0;var s=this.tryEntries[0],o=s.completion;if(o.type==="throw")throw o.arg;return this.rval},dispatchException:function(s){if(this.done)throw s;var o=this;function l(Q,K){return T.type="throw",T.arg=s,o.next=Q,K&&(o.method="next",o.arg=j),!!K}for(var m=this.tryEntries.length-1;m>=0;--m){var v=this.tryEntries[m],T=v.completion;if(v.tryLoc==="root")return l("end");if(v.tryLoc<=this.prev){var N=S.call(v,"catchLoc"),Y=S.call(v,"finallyLoc");if(N&&Y){if(this.prev<v.catchLoc)return l(v.catchLoc,!0);if(this.prev<v.finallyLoc)return l(v.finallyLoc)}else if(N){if(this.prev<v.catchLoc)return l(v.catchLoc,!0)}else if(Y){if(this.prev<v.finallyLoc)return l(v.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(s,o){for(var l=this.tryEntries.length-1;l>=0;--l){var m=this.tryEntries[l];if(m.tryLoc<=this.prev&&S.call(m,"finallyLoc")&&this.prev<m.finallyLoc){var v=m;break}}v&&(s==="break"||s==="continue")&&v.tryLoc<=o&&o<=v.finallyLoc&&(v=null);var T=v?v.completion:{};return T.type=s,T.arg=o,v?(this.method="next",this.next=v.finallyLoc,W):this.complete(T)},complete:function(s,o){if(s.type==="throw")throw s.arg;return s.type==="break"||s.type==="continue"?this.next=s.arg:s.type==="return"?(this.rval=this.arg=s.arg,this.method="return",this.next="end"):s.type==="normal"&&o&&(this.next=o),W},finish:function(s){for(var o=this.tryEntries.length-1;o>=0;--o){var l=this.tryEntries[o];if(l.finallyLoc===s)return this.complete(l.completion,l.afterLoc),le(l),W}},catch:function(s){for(var o=this.tryEntries.length-1;o>=0;--o){var l=this.tryEntries[o];if(l.tryLoc===s){var m=l.completion;if(m.type==="throw"){var v=m.arg;le(l)}return v}}throw new Error("illegal catch attempt")},delegateYield:function(s,o,l){return this.delegate={iterator:ae(s),resultName:o,nextLoc:l},this.method==="next"&&(this.arg=j),W}},y}(A.exports);try{regeneratorRuntime=P}catch(y){typeof globalThis=="object"?globalThis.regeneratorRuntime=P:Function("r","regeneratorRuntime = r")(P)}},695:function(A,P,y){"use strict";y.d(P,{Z:function(){return R}});function R(S){if(S.geometry&&S.geometry.dispose(),S.material){var j=Array.isArray(S.material)?S.material:[S.material];j.forEach(function(_){var E,F,L,k,$,H,B,c,ie,V,W,M,D;(E=_.map)===null||E===void 0||E.dispose(),(F=_.lightMap)===null||F===void 0||F.dispose(),(L=_.bumpMap)===null||L===void 0||L.dispose(),(k=_.normalMap)===null||k===void 0||k.dispose(),($=_.specularMap)===null||$===void 0||$.dispose(),(H=_.envMap)===null||H===void 0||H.dispose(),(B=_.alphaMap)===null||B===void 0||B.dispose(),(c=_.aoMap)===null||c===void 0||c.dispose(),(ie=_.displacementMap)===null||ie===void 0||ie.dispose(),(V=_.emissiveMap)===null||V===void 0||V.dispose(),(W=_.gradientMap)===null||W===void 0||W.dispose(),(M=_.metalnessMap)===null||M===void 0||M.dispose(),(D=_.roughnessMap)===null||D===void 0||D.dispose(),_.dispose()})}}},519:function(A,P,y){"use strict";y.d(P,{disposeMesh:function(){return _.Z}});var R=y(666),S=y.n(R),j=null,_=y(695),E=y(644);function F(V){if(V.material){var W=Array.isArray(V.material)?V.material:[V.material];W.forEach(function(M){var D,z;(D=M.color)===null||D===void 0||D.convertSRGBToLinear(),(z=M.emissive)===null||z===void 0||z.convertSRGBToLinear(),M.map&&(M.map.encoding=THREE.sRGBEncoding),M.emissiveMap&&(M.emissiveMap.encoding=THREE.sRGBEncoding)})}}var L=y(568),k=y(924),$=require("idb-keyval"),H=y(484),B=null,c=null,ie=function(){var V=(0,L.Z)(S().mark(function W(M,D){var z,ee,te,re,q,ne;return S().wrap(function(J){for(;;)switch(J.prev=J.next){case 0:return z=D.version,J.next=4,(0,$.get)(M);case 4:if(te=J.sent,!(te&&te[z])){J.next=9;break}ee=te[z],J.next=15;break;case 9:return J.next=11,(0,H.Z)(fetch(M).then(function(se){if(se.ok)return se.blob();throw new Error}));case 11:re=J.sent,q=re.res,ne=re.err,ne||(ee=q,(0,$.set)(M,(0,k.Z)({},z,q)));case 15:return J.abrupt("return",ee?{url:URL.createObjectURL(ee)}:{url:M});case 16:case"end":return J.stop()}},W)}));return function(M,D){return V.apply(this,arguments)}}()},484:function(A,P,y){"use strict";y.d(P,{Z:function(){return S}});var R=y(42);function S(j){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return j.then(function(E){return(0,R.Z)({err:null,res:E},_)}).catch(function(E){return(0,R.Z)({err:E,res:void 0},_)})}},644:function(A){"use strict";A.exports=require("three")},568:function(A,P,y){"use strict";y.d(P,{Z:function(){return S}});function R(j,_,E,F,L,k,$){try{var H=j[k]($),B=H.value}catch(c){E(c);return}H.done?_(B):Promise.resolve(B).then(F,L)}function S(j){return function(){var _=this,E=arguments;return new Promise(function(F,L){var k=j.apply(_,E);function $(B){R(k,F,L,$,H,"next",B)}function H(B){R(k,F,L,$,H,"throw",B)}$(void 0)})}}},924:function(A,P,y){"use strict";y.d(P,{Z:function(){return R}});function R(S,j,_){return j in S?Object.defineProperty(S,j,{value:_,enumerable:!0,configurable:!0,writable:!0}):S[j]=_,S}},42:function(A,P,y){"use strict";y.d(P,{Z:function(){return S}});var R=y(924);function S(j){for(var _=1;_<arguments.length;_++){var E=arguments[_]!=null?arguments[_]:{},F=Object.keys(E);typeof Object.getOwnPropertySymbols=="function"&&(F=F.concat(Object.getOwnPropertySymbols(E).filter(function(L){return Object.getOwnPropertyDescriptor(E,L).enumerable}))),F.forEach(function(L){(0,R.Z)(j,L,E[L])})}return j}}},ge={};function Z(A){var P=ge[A];if(P!==void 0)return P.exports;var y=ge[A]={exports:{}};return Ae[A](y,y.exports,Z),y.exports}(function(){Z.n=function(A){var P=A&&A.__esModule?function(){return A.default}:function(){return A};return Z.d(P,{a:P}),P}})(),function(){Z.d=function(A,P){for(var y in P)Z.o(P,y)&&!Z.o(A,y)&&Object.defineProperty(A,y,{enumerable:!0,get:P[y]})}}(),function(){Z.o=function(A,P){return Object.prototype.hasOwnProperty.call(A,P)}}(),function(){Z.r=function(A){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(A,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(A,"__esModule",{value:!0})}}();var ve={};(function(){"use strict";Z.r(ve),Z.d(ve,{Image:function(){return m},Line:function(){return Ce},MeshLine:function(){return I},MeshLineMaterial:function(){return me},MeshLineRaycast:function(){return be},Node:function(){return K},Text:function(){return pe},Video:function(){return Y}});function A(e,i){if(!(e instanceof i))throw new TypeError("Cannot call a class as a function")}function P(e,i){return P=Object.setPrototypeOf||function(n,a){return n.__proto__=a,n},P(e,i)}function y(e,i){return P(e,i)}function R(e,i){if(typeof i!="function"&&i!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),i&&y(e,i)}var S=Z(42);function j(e,i){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);i&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function _(e,i){return i=i!=null?i:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):j(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))}),e}function E(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function F(e){return F=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},F(e)}function L(e){return F(e)}function k(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $(e){return e&&e.constructor===Symbol?"symbol":typeof e}function H(e,i){return i&&($(i)==="object"||typeof i=="function")?i:k(e)}function B(e){var i=E();return function(){var n=L(e),a;if(i){var t=L(this).constructor;a=Reflect.construct(n,arguments,t)}else a=n.apply(this,arguments);return H(this,a)}}var c=Z(644);function ie(){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 V(e,i,r){return ie()?V=Reflect.construct:V=function(a,t,u){var h=[null];h.push.apply(h,t);var p=Function.bind.apply(a,h),d=new p;return u&&y(d,u.prototype),d},V.apply(null,arguments)}function W(e,i,r){return V.apply(null,arguments)}function M(e,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(e,n.key,n)}}function D(e,i,r){return i&&M(e.prototype,i),r&&M(e,r),e}function z(e,i){(i==null||i>e.length)&&(i=e.length);for(var r=0,n=new Array(i);r<i;r++)n[r]=e[r];return n}function ee(e){if(Array.isArray(e))return z(e)}function te(e){if(typeof Symbol!="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function re(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function q(e,i){if(!!e){if(typeof e=="string")return z(e,i);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 z(e,i)}}function ne(e){return ee(e)||te(e)||q(e)||re()}var oe=Z(484);function J(){var e=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}),e&&(r.promise=(0,oe.Z)(r.promise,i)),r}var se=require("three/examples/jsm/renderers/CSS2DRenderer"),fe=require("three/examples/jsm/renderers/CSS3DRenderer"),le=Z(519),ce=function(e){e&&((0,le.disposeMesh)(e),e.children.forEach(function(i){i.userData.BaseObject_||ce(i)}))},ae=function(){"use strict";function e(){A(this,e),this.objecttype__="BaseObject",this.userData={},this.pm=J(),this.visible=!1}var i=e.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),t=0;t<n;t++)a[t]=arguments[t];return this.object3d=W(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),t=0;t<n;t++)a[t]=arguments[t];return this.object3d=W(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 fe.CSS3DObject(n),this},i.createCSS3DSprite=function(n){return this.object3d=new fe.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),t=0;t<n;t++)a[t]=arguments[t];var u;return(u=this.object3d).add.apply(u,ne(a)),this},i.remove=function(){for(var n=arguments.length,a=new Array(n),t=0;t<n;t++)a[t]=arguments[t];var u;return(u=this.object3d).remove.apply(u,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(){ce(this.object3d)},D(e,[{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})}}]),e}(),pe=function(e){"use strict";R(r,e);var i=B(r);function r(a){A(this,r);var t;return t=i.call(this),t.width=0,t.canvas=document.createElement("canvas"),t.options=(0,S.Z)({},{scale:.5,fontSize:28,fontFamily:"system-ui,-apple-system,BlinkMacSystemFont,sans-serif",fontWeight:"normal",flipX:!1,sprite:!1,sizeAttenuation:!0},a),t}var n=r.prototype;return n.create=function(){var t=this.options,u=t.position,h=t.lookAt,p=t.sprite,d=t.text,g=t.sizeAttenuation;if(p){var b=new c.Sprite(new c.SpriteMaterial({transparent:!0,sizeAttenuation:g}));this.object3d=b}else{var w=new c.MeshBasicMaterial({side:c.DoubleSide,transparent:!0}),O=new c.PlaneGeometry(1,1,1,1);this.createMesh(O,w)}this.object3d.position.copy(u),h&&this.object3d.lookAt(h),this.setText(d)},n.setText=function(t,u){var h=(0,S.Z)(_((0,S.Z)({},this.options),{text:t}),u||{}),p=h.text,d=h.fontSize,g=h.fontFamily,b=h.fontWeight,w=h.flipX,O=h.scale,x=this.canvas;x.width=d*p.length*2,x.height=d;var C=x.getContext("2d");C.font="".concat(b," ").concat(d,"px/1 ").concat(g);var f=C.measureText(p).width;x.width=f,this.width=f,C=x.getContext("2d"),C.clearRect(0,0,x.width,x.height),w&&C.scale(-1,1),C.font="".concat(b," ").concat(d,"px/1 ").concat(g),C.textBaseline="middle",C.fillStyle="#ffffff",C.fillText(p,w?f*-1:0,x.height/2),C.restore();var U=new c.Texture(x);U.anisotropy=16,U.needsUpdate=!0;var G=this.object3d;G.material.map&&G.material.map.dispose(),G.material.map=U,G.material.needsUpdate=!0,G.scale.set(U.image.width*O,U.image.height*O,1)},r}(ae),s=Z(568),o=Z(666),l=Z.n(o),m=function(e){"use strict";R(r,e);var i=B(r);function r(a){A(this,r);var t;return t=i.call(this),t.options=a,t}var n=r.prototype;return n.getMaterial=function(){var t=this;return(0,s.Z)(l().mark(function u(){var h,p,d,g,b,w,O,x,C,f;return l().wrap(function(G){for(;;)switch(G.prev=G.next){case 0:return h=t.options,p=h.transparent,d=h.blending,g=h.src,b=h.depthWrite,w=h.alphaTest,O=h.sprite,x=h.sizeAttenuation,G.next=3,new c.TextureLoader().loadAsync(g);case 3:return C=G.sent,f=O?new c.SpriteMaterial({map:C,transparent:p!=null?p:!1,blending:d!=null?d:c.NormalBlending,depthWrite:b!=null?b:!0,alphaTest:w!=null?w:0,sizeAttenuation:x!=null?x:!0}):new c.MeshBasicMaterial({map:C,transparent:p!=null?p:!1,blending:d!=null?d:c.NormalBlending,depthWrite:b!=null?b:!0,alphaTest:w!=null?w:0}),G.abrupt("return",f);case 6:case"end":return G.stop()}},u)}))()},n.create=function(){var t=this;return(0,s.Z)(l().mark(function u(){var h,p,d,g,b,w,O,x;return l().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:if(h=t.options,p=h.scale,d=h.position,g=h.src,b=h.cache,w=h.sprite,!(b&&!b.get(g))){f.next=7;break}return b.init(g),f.next=5,t.getMaterial();case 5:O=f.sent,b.set(g,O);case 7:if(!b){f.next=13;break}return f.next=10,b.get(g);case 10:f.t0=f.sent,f.next=16;break;case 13:return f.next=15,t.getMaterial();case 15:f.t0=f.sent;case 16:x=f.t0,t.texture=x.map,w?t.createSprite(x):t.createMesh(new c.PlaneBufferGeometry(1,1),x),p&&t.object3d.scale.set(x.map.image.width*p,x.map.image.height*p,1),d&&t.object3d.position.copy(d);case 21:case"end":return f.stop()}},u)}))()},r}(ae);function v(e,i){for(;!Object.prototype.hasOwnProperty.call(e,i)&&(e=L(e),e!==null););return e}function T(e,i,r){return typeof Reflect!="undefined"&&Reflect.get?T=Reflect.get:T=function(a,t,u){var h=v(a,t);if(!!h){var p=Object.getOwnPropertyDescriptor(h,t);return p.get?p.get.call(u||a):p.value}},T(e,i,r)}function N(e,i,r){return T(e,i,r)}var Y=function(e){"use strict";R(r,e);var i=B(r);function r(a){A(this,r);var t;return t=i.call(this),t.options=(0,S.Z)({},{autoPlay:!0,loop:!0},a),t}var n=r.prototype;return n.getMaterial=function(){var t=this.options,u=t.src,h=t.transparent,p=t.blending,d=t.depthWrite,g=t.format,b=t.autoPlay,w=t.loop,O=t.alphaTest,x=t.sprite,C=J(),f=document.createElement("video");return f.addEventListener("loadedmetadata",function(){var U=new c.VideoTexture(f);U.format=g!=null?g:c.RGBAFormat,U.needsUpdate=!0;var G=x?new c.SpriteMaterial({map:U,transparent:h!=null?h:!1,blending:p!=null?p:c.NormalBlending,depthWrite:d!=null?d:!0,alphaTest:O!=null?O:0}):new c.MeshBasicMaterial({map:U,transparent:h!=null?h:!1,blending:p!=null?p:c.NormalBlending,depthWrite:d!=null?d:!0,alphaTest:O!=null?O:0});C.resolve(G)},!1),f.src=u,f.muted=!0,f.autoplay=b,f.loop=w,f.preload="auto",C.promise},n.create=function(){var t=this;return(0,s.Z)(l().mark(function u(){var h,p,d,g,b,w,O,x;return l().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:if(h=t.options,p=h.scale,d=h.position,g=h.src,b=h.cache,w=h.sprite,!(b&&!b.get(g))){f.next=7;break}return b.init(g),f.next=5,t.getMaterial();case 5:O=f.sent,b.set(g,O);case 7:if(!b){f.next=13;break}return f.next=10,b.get(g);case 10:f.t0=f.sent,f.next=16;break;case 13:return f.next=15,t.getMaterial();case 15:f.t0=f.sent;case 16:x=f.t0,t.video=x.map.image,w?t.createSprite(x):t.createMesh(new c.PlaneBufferGeometry(1,1),x),p&&t.object3d.scale.set(t.video.videoWidth*p,t.video.videoHeight*p,1),d&&t.object3d.position.copy(d);case 21:case"end":return f.stop()}},u)}))()},n.render=function(){var t=this.options.autoPlay;t&&this.video.play()},n.dispose=function(){this.video.pause(),this.video.src="",this.video.load(),N(L(r.prototype),"dispose",this).call(this)},r}(ae),Q=function(e){"use strict";R(r,e);var i=B(r);function r(a){A(this,r);var t;return t=i.call(this),t.options=(0,S.Z)({},a),t}var n=r.prototype;return n.create=function(){var t=this.options,u=t.position,h=t.children,p=t.onClick,d=t.zIndexFix,g=document.createElement("div");g.appendChild(h),this.createCSS2DObject(g),u&&this.object3d.position.copy(u),p&&g.addEventListener("click",p),d&&(this.object3d.userData.zIndexFix=d)},n.getMaterial=function(t){return(0,s.Z)(l().mark(function u(){var h,p,d,g;return l().wrap(function(w){for(;;)switch(w.prev=w.next){case 0:return h=document.createElement("canvas"),h.width=256,h.height=256,p=h.getContext("2d"),p.fillStyle="#ff0000",p.fillRect(0,0,256,256),d=new c.CanvasTexture(h),g=new c.SpriteMaterial({map:d,opacity:t?1:0,transparent:!0,alphaTest:.1,sizeAttenuation:!1}),w.abrupt("return",g);case 9:case"end":return w.stop()}},u)}))()},n.createPickObject=function(t){var u=t.show,h=u===void 0?!1:u,p=t.scale,d=p===void 0?new c.Vector3(1,1,1):p,g=t.position,b=g===void 0?new c.Vector3(0,0,0):g,w=t.cache,O=this;return(0,s.Z)(l().mark(function x(){var C,f,U,G;return l().wrap(function(X){for(;;)switch(X.prev=X.next){case 0:if(C="node-create-pick-object",!(w&&!w.get(C))){X.next=7;break}return w.init(C),X.next=5,O.getMaterial(h);case 5:f=X.sent,w.set(C,f);case 7:if(!w){X.next=13;break}return X.next=10,w.get(C);case 10:X.t0=X.sent,X.next=16;break;case 13:return X.next=15,O.getMaterial(h);case 15:X.t0=X.sent;case 16:U=X.t0,G=new c.Sprite(U),G.scale.set(U.map.image.width*d.x,U.map.image.height*d.y,1),G.position.copy(b),O.add(G),O.pickObject=G;case 22:case"end":return X.stop()}},x)}))()},n.dispose=function(){var t=this.options.onClick;if(t){var u;(u=this.object3d.element)===null||u===void 0||u.removeEventListener("click",t)}N(L(r.prototype),"dispose",this).call(this)},r}(ae),K=Q,he=`
2
2
  `.concat(c.ShaderChunk.logdepthbuf_pars_vertex,`
3
3
  `).concat(c.ShaderChunk.fog_pars_vertex,`
4
4
  attribute vec3 previous;
@@ -17,7 +17,6 @@ export default class extends BaseObject {
17
17
  width: number;
18
18
  canvas: HTMLCanvasElement;
19
19
  constructor(options: Options);
20
- init(): void;
21
20
  create(): void;
22
21
  setText(t: string, options?: Pick<Options, 'fontSize' | 'fontFamily' | 'flipX'>): void;
23
22
  }
@@ -1 +1 @@
1
- (function(){var J={666:function(v){var d=function(s){"use strict";var O=Object.prototype,g=O.hasOwnProperty,_,b=typeof Symbol=="function"?Symbol:{},y=b.iterator||"@@iterator",T=b.asyncIterator||"@@asyncIterator",j=b.toStringTag||"@@toStringTag";function w(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{w({},"")}catch(e){w=function(t,n,f){return t[n]=f}}function R(e,t,n,f){var c=t&&t.prototype instanceof m?t:m,E=Object.create(c.prototype),M=new x(f||[]);return E._invoke=l(e,n,M),E}s.wrap=R;function I(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(f){return{type:"throw",arg:f}}}var Z="suspendedStart",W="suspendedYield",z="executing",A="completed",P={};function m(){}function k(){}function i(){}var o={};w(o,y,function(){return this});var a=Object.getPrototypeOf,r=a&&a(a(N([])));r&&r!==O&&g.call(r,y)&&(o=r);var u=i.prototype=m.prototype=Object.create(o);k.prototype=i,w(u,"constructor",i),w(i,"constructor",k),k.displayName=w(i,j,"GeneratorFunction");function h(e){["next","throw","return"].forEach(function(t){w(e,t,function(n){return this._invoke(t,n)})})}s.isGeneratorFunction=function(e){var t=typeof e=="function"&&e.constructor;return t?t===k||(t.displayName||t.name)==="GeneratorFunction":!1},s.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,i):(e.__proto__=i,w(e,j,"GeneratorFunction")),e.prototype=Object.create(u),e},s.awrap=function(e){return{__await:e}};function p(e,t){function n(E,M,G,B){var D=I(e[E],e,M);if(D.type==="throw")B(D.arg);else{var Y=D.arg,H=Y.value;return H&&typeof H=="object"&&g.call(H,"__await")?t.resolve(H.__await).then(function($){n("next",$,G,B)},function($){n("throw",$,G,B)}):t.resolve(H).then(function($){Y.value=$,G(Y)},function($){return n("throw",$,G,B)})}}var f;function c(E,M){function G(){return new t(function(B,D){n(E,M,B,D)})}return f=f?f.then(G,G):G()}this._invoke=c}h(p.prototype),w(p.prototype,T,function(){return this}),s.AsyncIterator=p,s.async=function(e,t,n,f,c){c===void 0&&(c=Promise);var E=new p(R(e,t,n,f),c);return s.isGeneratorFunction(t)?E:E.next().then(function(M){return M.done?M.value:E.next()})};function l(e,t,n){var f=Z;return function(E,M){if(f===z)throw new Error("Generator is already running");if(f===A){if(E==="throw")throw M;return F()}for(n.method=E,n.arg=M;;){var G=n.delegate;if(G){var B=L(G,n);if(B){if(B===P)continue;return B}}if(n.method==="next")n.sent=n._sent=n.arg;else if(n.method==="throw"){if(f===Z)throw f=A,n.arg;n.dispatchException(n.arg)}else n.method==="return"&&n.abrupt("return",n.arg);f=z;var D=I(e,t,n);if(D.type==="normal"){if(f=n.done?A:W,D.arg===P)continue;return{value:D.arg,done:n.done}}else D.type==="throw"&&(f=A,n.method="throw",n.arg=D.arg)}}}function L(e,t){var n=e.iterator[t.method];if(n===_){if(t.delegate=null,t.method==="throw"){if(e.iterator.return&&(t.method="return",t.arg=_,L(e,t),t.method==="throw"))return P;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return P}var f=I(n,e.iterator,t.arg);if(f.type==="throw")return t.method="throw",t.arg=f.arg,t.delegate=null,P;var c=f.arg;if(!c)return t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,P;if(c.done)t[e.resultName]=c.value,t.next=e.nextLoc,t.method!=="return"&&(t.method="next",t.arg=_);else return c;return t.delegate=null,P}h(u),w(u,j,"Generator"),w(u,y,function(){return this}),w(u,"toString",function(){return"[object Generator]"});function U(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(U,this),this.reset(!0)}s.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function f(){for(;t.length;){var c=t.pop();if(c in e)return f.value=c,f.done=!1,f}return f.done=!0,f}};function N(e){if(e){var t=e[y];if(t)return t.call(e);if(typeof e.next=="function")return e;if(!isNaN(e.length)){var n=-1,f=function c(){for(;++n<e.length;)if(g.call(e,n))return c.value=e[n],c.done=!1,c;return c.value=_,c.done=!0,c};return f.next=f}}return{next:F}}s.values=N;function F(){return{value:_,done:!0}}return x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=_,this.done=!1,this.delegate=null,this.method="next",this.arg=_,this.tryEntries.forEach(C),!e)for(var t in this)t.charAt(0)==="t"&&g.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=_)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if(t.type==="throw")throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(B,D){return E.type="throw",E.arg=e,t.next=B,D&&(t.method="next",t.arg=_),!!D}for(var f=this.tryEntries.length-1;f>=0;--f){var c=this.tryEntries[f],E=c.completion;if(c.tryLoc==="root")return n("end");if(c.tryLoc<=this.prev){var M=g.call(c,"catchLoc"),G=g.call(c,"finallyLoc");if(M&&G){if(this.prev<c.catchLoc)return n(c.catchLoc,!0);if(this.prev<c.finallyLoc)return n(c.finallyLoc)}else if(M){if(this.prev<c.catchLoc)return n(c.catchLoc,!0)}else if(G){if(this.prev<c.finallyLoc)return n(c.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var f=this.tryEntries[n];if(f.tryLoc<=this.prev&&g.call(f,"finallyLoc")&&this.prev<f.finallyLoc){var c=f;break}}c&&(e==="break"||e==="continue")&&c.tryLoc<=t&&t<=c.finallyLoc&&(c=null);var E=c?c.completion:{};return E.type=e,E.arg=t,c?(this.method="next",this.next=c.finallyLoc,P):this.complete(E)},complete:function(e,t){if(e.type==="throw")throw e.arg;return e.type==="break"||e.type==="continue"?this.next=e.arg:e.type==="return"?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):e.type==="normal"&&t&&(this.next=t),P},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),C(n),P}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var f=n.completion;if(f.type==="throw"){var c=f.arg;C(n)}return c}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:N(e),resultName:t,nextLoc:n},this.method==="next"&&(this.arg=_),P}},s}(v.exports);try{regeneratorRuntime=d}catch(s){typeof globalThis=="object"?globalThis.regeneratorRuntime=d:Function("r","regeneratorRuntime = r")(d)}},519:function(v,d,s){"use strict";s.d(d,{makePromiseCreator:function(){return O.Z}});var O=s(282),g=s(666),_=s.n(g),b=null,y=s(644);function T(A){if(A.material){var P=Array.isArray(A.material)?A.material:[A.material];P.forEach(function(m){var k,i;(k=m.color)===null||k===void 0||k.convertSRGBToLinear(),(i=m.emissive)===null||i===void 0||i.convertSRGBToLinear(),m.map&&(m.map.encoding=THREE.sRGBEncoding),m.emissiveMap&&(m.emissiveMap.encoding=THREE.sRGBEncoding)})}}var j=s(568),w=s(924),R=require("idb-keyval"),I=s(484),Z=null,W=null,z=function(){var A=(0,j.Z)(_().mark(function P(m,k){var i,o,a,r,u,h;return _().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return i=k.version,l.next=4,(0,R.get)(m);case 4:if(a=l.sent,!(a&&a[i])){l.next=9;break}o=a[i],l.next=15;break;case 9:return l.next=11,(0,I.Z)(fetch(m).then(function(L){if(L.ok)return L.blob();throw new Error}));case 11:r=l.sent,u=r.res,h=r.err,h||(o=u,(0,R.set)(m,(0,w.Z)({},i,u)));case 15:return l.abrupt("return",o?{url:URL.createObjectURL(o)}:{url:m});case 16:case"end":return l.stop()}},P)}));return function(m,k){return A.apply(this,arguments)}}()},282:function(v,d,s){"use strict";s.d(d,{Z:function(){return g}});var O=s(484);function g(){var _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},y={};return y.promise=new Promise(function(T,j){y.resolve=T,y.reject=j}),_&&(y.promise=(0,O.Z)(y.promise,b)),y}},484:function(v,d,s){"use strict";s.d(d,{Z:function(){return g}});var O=s(42);function g(_){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return _.then(function(y){return(0,O.Z)({err:null,res:y},b)}).catch(function(y){return(0,O.Z)({err:y,res:void 0},b)})}},644:function(v){"use strict";v.exports=require("three")},568:function(v,d,s){"use strict";s.d(d,{Z:function(){return g}});function O(_,b,y,T,j,w,R){try{var I=_[w](R),Z=I.value}catch(W){y(W);return}I.done?b(Z):Promise.resolve(Z).then(T,j)}function g(_){return function(){var b=this,y=arguments;return new Promise(function(T,j){var w=_.apply(b,y);function R(Z){O(w,T,j,R,I,"next",Z)}function I(Z){O(w,T,j,R,I,"throw",Z)}R(void 0)})}}},924:function(v,d,s){"use strict";s.d(d,{Z:function(){return O}});function O(g,_,b){return _ in g?Object.defineProperty(g,_,{value:b,enumerable:!0,configurable:!0,writable:!0}):g[_]=b,g}},42:function(v,d,s){"use strict";s.d(d,{Z:function(){return g}});var O=s(924);function g(_){for(var b=1;b<arguments.length;b++){var y=arguments[b]!=null?arguments[b]:{},T=Object.keys(y);typeof Object.getOwnPropertySymbols=="function"&&(T=T.concat(Object.getOwnPropertySymbols(y).filter(function(j){return Object.getOwnPropertyDescriptor(y,j).enumerable}))),T.forEach(function(j){(0,O.Z)(_,j,y[j])})}return _}}},X={};function S(v){var d=X[v];if(d!==void 0)return d.exports;var s=X[v]={exports:{}};return J[v](s,s.exports,S),s.exports}(function(){S.n=function(v){var d=v&&v.__esModule?function(){return v.default}:function(){return v};return S.d(d,{a:d}),d}})(),function(){S.d=function(v,d){for(var s in d)S.o(d,s)&&!S.o(v,s)&&Object.defineProperty(v,s,{enumerable:!0,get:d[s]})}}(),function(){S.o=function(v,d){return Object.prototype.hasOwnProperty.call(v,d)}}(),function(){S.r=function(v){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(v,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(v,"__esModule",{value:!0})}}();var K={};(function(){"use strict";S.r(K),S.d(K,{Cache:function(){return s},Data:function(){return k},Draw:function(){return m}});function v(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")}var d=S(519),s=function(){"use strict";function i(){v(this,i),this.cache=new Map}var o=i.prototype;return o.install=function(){},o.init=function(r){var u=(0,d.makePromiseCreator)();this.cache.set(r,u)},o.get=function(r){var u;return(u=this.cache.get(r))===null||u===void 0?void 0:u.promise},o.set=function(r,u){var h=this.cache.get(r);h?h.resolve(u):console.warn("init cache first")},o.dispose=function(){this.cache.forEach(function(r,u){r.reject("stop set cache:".concat(u))}),this.cache.clear()},i}(),O=S(568);function g(i,o){for(var a=0;a<o.length;a++){var r=o[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,r.key,r)}}function _(i,o,a){return o&&g(i.prototype,o),a&&g(i,a),i}function b(i){if(Array.isArray(i))return i}function y(i){if(typeof Symbol!="undefined"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function T(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function j(i,o){(o==null||o>i.length)&&(o=i.length);for(var a=0,r=new Array(o);a<o;a++)r[a]=i[a];return r}function w(i,o){if(!!i){if(typeof i=="string")return j(i,o);var a=Object.prototype.toString.call(i).slice(8,-1);if(a==="Object"&&i.constructor&&(a=i.constructor.name),a==="Map"||a==="Set")return Array.from(a);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return j(i,o)}}function R(i,o){return b(i)||y(i,o)||w(i,o)||T()}function I(i){if(Array.isArray(i))return j(i)}function Z(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function W(i){return I(i)||y(i)||w(i)||Z()}var z=S(666),A=S.n(z),P=S(644),m=function(){"use strict";function i(a){v(this,i),this.objectNamesToFactories=new Map,this.objects=new Map,this.objects_=a}var o=i.prototype;return o.install=function(r){this.pencil=r,this.initObjectFactories()},o.initObjectFactories=function(){var r=this,u=this.objects_;Object.keys(u).forEach(function(h){var p=function(){function l(){v(this,l)}var L=l.prototype;return L.create=function(){var C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new u[h](C)},l}();r.objectNamesToFactories.set(h,p)})},o.getObject=function(r,u){r.includes("#")&&console.warn("getObject:err:\u4E0D\u652F\u6301 #",r);var h=(u||{}).key,p="".concat(r).concat(h?"#".concat(h):""),l=this.objects.get(p);return l},o.getAllObject=function(r,u){r.includes("#")&&console.warn("getAllObject:err:\u4E0D\u652F\u6301 #",r);var h=(u||{}).key,p="".concat(r).concat(h?"#".concat(h):""),l=[];return this.objects.forEach(function(L,U){(U.startsWith("".concat(p,"#"))||U===p)&&l.push(L)}),l},o.draw=function(r,u,h){var p=this;return(0,O.Z)(A().mark(function l(){var L,U,C,x,N,F,e;return A().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if(L=p.objectNamesToFactories.get(r),!L){n.next=15;break}return U=(u||{}).key,C="".concat(r).concat(U?"#".concat(U):""),p.objects.has(C)&&(x=P.MathUtils.generateUUID(),C+="#".concat(x)),N=(u==null?void 0:u.target)||h,typeof N=="string"?F=p.objects.get(N):(N==null?void 0:N.objecttype__)==="BaseObject"?F=N:F=p.pencil.scene,e=new L().create(u),e.pencil=p.pencil,e.key=C,p.objects.set(C,e),n.next=14,p.addMesh(e,F);case 14:return n.abrupt("return",e);case 15:throw new Error("Unrecognized:".concat(r));case 16:case"end":return n.stop()}},l)}))()},o.addMesh=function(r,u){return(0,O.Z)(A().mark(function h(){return A().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.next=2,r.init();case 2:return l.next=4,r.create();case 4:r.object3d&&(r.object3d.userData.BaseObject_=r,u.add(r.object3d)),r.visible=!0,r.render(),r.pm.resolve();case 8:case"end":return l.stop()}},h)}))()},o.erase=function(){for(var r=arguments.length,u=new Array(r),h=0;h<r;h++)u[h]=arguments[h];var p=this;W(u).forEach(function(l){var L=[];if(typeof l=="string"){var U,C=R(l.split("#"),2),x=C[0],N=C[1];(U=L).push.apply(U,W(p.getAllObject(x,{key:N})))}else L.push(l);L.forEach(function(F){p.removeMesh(F)})})},o.removeMesh=function(r){var u=this,h=r.parent;r.object3d&&h.remove(r.object3d),r.traverse(function(p){p.visible=!1,p.dispose(),u.objects.delete(p.key)})},o.update=function(r,u){this.objects.forEach(function(h){h.update(r,u)})},o.setSize=function(r,u){this.objects.forEach(function(h){h.resize(r,u)})},o.dispose=function(){this.objects.forEach(function(r,u){r.dispose(),r.pm.reject("stop draw:".concat(u))}),this.objects.clear(),this.objectNamesToFactories.clear()},_(i,[{key:"objectsPromise",get:function(){var r=[];return this.objects.forEach(function(u){r.push(u.pm.promise)}),r}}]),i}(),k=function(){"use strict";function i(){v(this,i),this.data={}}var o=i.prototype;return o.install=function(){},o.setData=function(r,u){var h,p;this.data[r]=u,(p=(h=this).cb)===null||p===void 0||p.call(h,r)},o.dispose=function(){this.data={},this.cb=void 0},i}()})(),module.exports=K})();
1
+ (function(){var J={666:function(v){var d=function(s){"use strict";var O=Object.prototype,g=O.hasOwnProperty,_,b=typeof Symbol=="function"?Symbol:{},y=b.iterator||"@@iterator",T=b.asyncIterator||"@@asyncIterator",j=b.toStringTag||"@@toStringTag";function w(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{w({},"")}catch(e){w=function(t,n,f){return t[n]=f}}function R(e,t,n,f){var c=t&&t.prototype instanceof m?t:m,E=Object.create(c.prototype),M=new x(f||[]);return E._invoke=p(e,n,M),E}s.wrap=R;function I(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(f){return{type:"throw",arg:f}}}var Z="suspendedStart",W="suspendedYield",z="executing",A="completed",P={};function m(){}function k(){}function i(){}var o={};w(o,y,function(){return this});var a=Object.getPrototypeOf,r=a&&a(a(N([])));r&&r!==O&&g.call(r,y)&&(o=r);var u=i.prototype=m.prototype=Object.create(o);k.prototype=i,w(u,"constructor",i),w(i,"constructor",k),k.displayName=w(i,j,"GeneratorFunction");function h(e){["next","throw","return"].forEach(function(t){w(e,t,function(n){return this._invoke(t,n)})})}s.isGeneratorFunction=function(e){var t=typeof e=="function"&&e.constructor;return t?t===k||(t.displayName||t.name)==="GeneratorFunction":!1},s.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,i):(e.__proto__=i,w(e,j,"GeneratorFunction")),e.prototype=Object.create(u),e},s.awrap=function(e){return{__await:e}};function l(e,t){function n(E,M,G,B){var D=I(e[E],e,M);if(D.type==="throw")B(D.arg);else{var Y=D.arg,H=Y.value;return H&&typeof H=="object"&&g.call(H,"__await")?t.resolve(H.__await).then(function($){n("next",$,G,B)},function($){n("throw",$,G,B)}):t.resolve(H).then(function($){Y.value=$,G(Y)},function($){return n("throw",$,G,B)})}}var f;function c(E,M){function G(){return new t(function(B,D){n(E,M,B,D)})}return f=f?f.then(G,G):G()}this._invoke=c}h(l.prototype),w(l.prototype,T,function(){return this}),s.AsyncIterator=l,s.async=function(e,t,n,f,c){c===void 0&&(c=Promise);var E=new l(R(e,t,n,f),c);return s.isGeneratorFunction(t)?E:E.next().then(function(M){return M.done?M.value:E.next()})};function p(e,t,n){var f=Z;return function(E,M){if(f===z)throw new Error("Generator is already running");if(f===A){if(E==="throw")throw M;return F()}for(n.method=E,n.arg=M;;){var G=n.delegate;if(G){var B=L(G,n);if(B){if(B===P)continue;return B}}if(n.method==="next")n.sent=n._sent=n.arg;else if(n.method==="throw"){if(f===Z)throw f=A,n.arg;n.dispatchException(n.arg)}else n.method==="return"&&n.abrupt("return",n.arg);f=z;var D=I(e,t,n);if(D.type==="normal"){if(f=n.done?A:W,D.arg===P)continue;return{value:D.arg,done:n.done}}else D.type==="throw"&&(f=A,n.method="throw",n.arg=D.arg)}}}function L(e,t){var n=e.iterator[t.method];if(n===_){if(t.delegate=null,t.method==="throw"){if(e.iterator.return&&(t.method="return",t.arg=_,L(e,t),t.method==="throw"))return P;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return P}var f=I(n,e.iterator,t.arg);if(f.type==="throw")return t.method="throw",t.arg=f.arg,t.delegate=null,P;var c=f.arg;if(!c)return t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,P;if(c.done)t[e.resultName]=c.value,t.next=e.nextLoc,t.method!=="return"&&(t.method="next",t.arg=_);else return c;return t.delegate=null,P}h(u),w(u,j,"Generator"),w(u,y,function(){return this}),w(u,"toString",function(){return"[object Generator]"});function U(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(U,this),this.reset(!0)}s.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function f(){for(;t.length;){var c=t.pop();if(c in e)return f.value=c,f.done=!1,f}return f.done=!0,f}};function N(e){if(e){var t=e[y];if(t)return t.call(e);if(typeof e.next=="function")return e;if(!isNaN(e.length)){var n=-1,f=function c(){for(;++n<e.length;)if(g.call(e,n))return c.value=e[n],c.done=!1,c;return c.value=_,c.done=!0,c};return f.next=f}}return{next:F}}s.values=N;function F(){return{value:_,done:!0}}return x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=_,this.done=!1,this.delegate=null,this.method="next",this.arg=_,this.tryEntries.forEach(C),!e)for(var t in this)t.charAt(0)==="t"&&g.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=_)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if(t.type==="throw")throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(B,D){return E.type="throw",E.arg=e,t.next=B,D&&(t.method="next",t.arg=_),!!D}for(var f=this.tryEntries.length-1;f>=0;--f){var c=this.tryEntries[f],E=c.completion;if(c.tryLoc==="root")return n("end");if(c.tryLoc<=this.prev){var M=g.call(c,"catchLoc"),G=g.call(c,"finallyLoc");if(M&&G){if(this.prev<c.catchLoc)return n(c.catchLoc,!0);if(this.prev<c.finallyLoc)return n(c.finallyLoc)}else if(M){if(this.prev<c.catchLoc)return n(c.catchLoc,!0)}else if(G){if(this.prev<c.finallyLoc)return n(c.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var f=this.tryEntries[n];if(f.tryLoc<=this.prev&&g.call(f,"finallyLoc")&&this.prev<f.finallyLoc){var c=f;break}}c&&(e==="break"||e==="continue")&&c.tryLoc<=t&&t<=c.finallyLoc&&(c=null);var E=c?c.completion:{};return E.type=e,E.arg=t,c?(this.method="next",this.next=c.finallyLoc,P):this.complete(E)},complete:function(e,t){if(e.type==="throw")throw e.arg;return e.type==="break"||e.type==="continue"?this.next=e.arg:e.type==="return"?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):e.type==="normal"&&t&&(this.next=t),P},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),C(n),P}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var f=n.completion;if(f.type==="throw"){var c=f.arg;C(n)}return c}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:N(e),resultName:t,nextLoc:n},this.method==="next"&&(this.arg=_),P}},s}(v.exports);try{regeneratorRuntime=d}catch(s){typeof globalThis=="object"?globalThis.regeneratorRuntime=d:Function("r","regeneratorRuntime = r")(d)}},519:function(v,d,s){"use strict";s.d(d,{makePromiseCreator:function(){return O.Z}});var O=s(282),g=s(666),_=s.n(g),b=null,y=s(644);function T(A){if(A.material){var P=Array.isArray(A.material)?A.material:[A.material];P.forEach(function(m){var k,i;(k=m.color)===null||k===void 0||k.convertSRGBToLinear(),(i=m.emissive)===null||i===void 0||i.convertSRGBToLinear(),m.map&&(m.map.encoding=THREE.sRGBEncoding),m.emissiveMap&&(m.emissiveMap.encoding=THREE.sRGBEncoding)})}}var j=s(568),w=s(924),R=require("idb-keyval"),I=s(484),Z=null,W=null,z=function(){var A=(0,j.Z)(_().mark(function P(m,k){var i,o,a,r,u,h;return _().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return i=k.version,p.next=4,(0,R.get)(m);case 4:if(a=p.sent,!(a&&a[i])){p.next=9;break}o=a[i],p.next=15;break;case 9:return p.next=11,(0,I.Z)(fetch(m).then(function(L){if(L.ok)return L.blob();throw new Error}));case 11:r=p.sent,u=r.res,h=r.err,h||(o=u,(0,R.set)(m,(0,w.Z)({},i,u)));case 15:return p.abrupt("return",o?{url:URL.createObjectURL(o)}:{url:m});case 16:case"end":return p.stop()}},P)}));return function(m,k){return A.apply(this,arguments)}}()},282:function(v,d,s){"use strict";s.d(d,{Z:function(){return g}});var O=s(484);function g(){var _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},y={};return y.promise=new Promise(function(T,j){y.resolve=T,y.reject=j}),_&&(y.promise=(0,O.Z)(y.promise,b)),y}},484:function(v,d,s){"use strict";s.d(d,{Z:function(){return g}});var O=s(42);function g(_){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return _.then(function(y){return(0,O.Z)({err:null,res:y},b)}).catch(function(y){return(0,O.Z)({err:y,res:void 0},b)})}},644:function(v){"use strict";v.exports=require("three")},568:function(v,d,s){"use strict";s.d(d,{Z:function(){return g}});function O(_,b,y,T,j,w,R){try{var I=_[w](R),Z=I.value}catch(W){y(W);return}I.done?b(Z):Promise.resolve(Z).then(T,j)}function g(_){return function(){var b=this,y=arguments;return new Promise(function(T,j){var w=_.apply(b,y);function R(Z){O(w,T,j,R,I,"next",Z)}function I(Z){O(w,T,j,R,I,"throw",Z)}R(void 0)})}}},924:function(v,d,s){"use strict";s.d(d,{Z:function(){return O}});function O(g,_,b){return _ in g?Object.defineProperty(g,_,{value:b,enumerable:!0,configurable:!0,writable:!0}):g[_]=b,g}},42:function(v,d,s){"use strict";s.d(d,{Z:function(){return g}});var O=s(924);function g(_){for(var b=1;b<arguments.length;b++){var y=arguments[b]!=null?arguments[b]:{},T=Object.keys(y);typeof Object.getOwnPropertySymbols=="function"&&(T=T.concat(Object.getOwnPropertySymbols(y).filter(function(j){return Object.getOwnPropertyDescriptor(y,j).enumerable}))),T.forEach(function(j){(0,O.Z)(_,j,y[j])})}return _}}},X={};function S(v){var d=X[v];if(d!==void 0)return d.exports;var s=X[v]={exports:{}};return J[v](s,s.exports,S),s.exports}(function(){S.n=function(v){var d=v&&v.__esModule?function(){return v.default}:function(){return v};return S.d(d,{a:d}),d}})(),function(){S.d=function(v,d){for(var s in d)S.o(d,s)&&!S.o(v,s)&&Object.defineProperty(v,s,{enumerable:!0,get:d[s]})}}(),function(){S.o=function(v,d){return Object.prototype.hasOwnProperty.call(v,d)}}(),function(){S.r=function(v){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(v,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(v,"__esModule",{value:!0})}}();var K={};(function(){"use strict";S.r(K),S.d(K,{Cache:function(){return s},Data:function(){return k},Draw:function(){return m}});function v(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")}var d=S(519),s=function(){"use strict";function i(){v(this,i),this.cache=new Map}var o=i.prototype;return o.install=function(){},o.init=function(r){var u=(0,d.makePromiseCreator)();this.cache.set(r,u)},o.get=function(r){var u;return(u=this.cache.get(r))===null||u===void 0?void 0:u.promise},o.set=function(r,u){var h=this.cache.get(r);h?h.resolve(u):console.warn("init cache first")},o.dispose=function(){this.cache.forEach(function(r,u){r.reject("stop set cache:".concat(u))}),this.cache.clear()},i}(),O=S(568);function g(i,o){for(var a=0;a<o.length;a++){var r=o[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,r.key,r)}}function _(i,o,a){return o&&g(i.prototype,o),a&&g(i,a),i}function b(i){if(Array.isArray(i))return i}function y(i){if(typeof Symbol!="undefined"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function T(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function j(i,o){(o==null||o>i.length)&&(o=i.length);for(var a=0,r=new Array(o);a<o;a++)r[a]=i[a];return r}function w(i,o){if(!!i){if(typeof i=="string")return j(i,o);var a=Object.prototype.toString.call(i).slice(8,-1);if(a==="Object"&&i.constructor&&(a=i.constructor.name),a==="Map"||a==="Set")return Array.from(a);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return j(i,o)}}function R(i,o){return b(i)||y(i,o)||w(i,o)||T()}function I(i){if(Array.isArray(i))return j(i)}function Z(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function W(i){return I(i)||y(i)||w(i)||Z()}var z=S(666),A=S.n(z),P=S(644),m=function(){"use strict";function i(a){v(this,i),this.objectNamesToFactories=new Map,this.objects=new Map,this.objects_=a}var o=i.prototype;return o.install=function(r){this.pencil=r,this.initObjectFactories()},o.initObjectFactories=function(){var r=this,u=this.objects_;Object.keys(u).forEach(function(h){var l=function(){function p(){v(this,p)}var L=p.prototype;return L.create=function(){var C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new u[h](C)},p}();r.objectNamesToFactories.set(h,l)})},o.getObject=function(r,u){r.includes("#")&&console.warn("getObject:err:\u4E0D\u652F\u6301 #",r);var h=(u||{}).key,l="".concat(r).concat(h?"#".concat(h):""),p=this.objects.get(l);return p},o.getAllObject=function(r,u){r.includes("#")&&console.warn("getAllObject:err:\u4E0D\u652F\u6301 #",r);var h=(u||{}).key,l="".concat(r).concat(h?"#".concat(h):""),p=[];return this.objects.forEach(function(L,U){(U.startsWith("".concat(l,"#"))||U===l)&&p.push(L)}),p},o.draw=function(r,u,h){var l=this;return(0,O.Z)(A().mark(function p(){var L,U,C,x,N,F,e;return A().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if(L=l.objectNamesToFactories.get(r),!L){n.next=15;break}return U=(u||{}).key,C="".concat(r).concat(U?"#".concat(U):""),l.objects.has(C)&&(x=P.MathUtils.generateUUID(),C+="#".concat(x)),N=(u==null?void 0:u.target)||h,typeof N=="string"?F=l.objects.get(N):(N==null?void 0:N.objecttype__)==="BaseObject"?F=N:F=l.pencil.scene,e=new L().create(u),e.pencil=l.pencil,e.key=C,l.objects.set(C,e),n.next=14,l.addMesh(e,F);case 14:return n.abrupt("return",e);case 15:throw new Error("Unrecognized:".concat(r));case 16:case"end":return n.stop()}},p)}))()},o.addMesh=function(r,u){return(0,O.Z)(A().mark(function h(){return A().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return p.next=2,r.create();case 2:r.object3d&&(r.object3d.userData.BaseObject_=r,u.add(r.object3d)),r.visible=!0,r.render(),r.pm.resolve();case 6:case"end":return p.stop()}},h)}))()},o.erase=function(){for(var r=arguments.length,u=new Array(r),h=0;h<r;h++)u[h]=arguments[h];var l=this;W(u).forEach(function(p){var L=[];if(typeof p=="string"){var U,C=R(p.split("#"),2),x=C[0],N=C[1];(U=L).push.apply(U,W(l.getAllObject(x,{key:N})))}else L.push(p);L.forEach(function(F){l.removeMesh(F)})})},o.removeMesh=function(r){var u=this,h=r.parent;r.object3d&&h.remove(r.object3d),r.traverse(function(l){l.visible=!1,l.dispose(),u.objects.delete(l.key)})},o.update=function(r,u){this.objects.forEach(function(h){h.update(r,u)})},o.setSize=function(r,u){this.objects.forEach(function(h){h.resize(r,u)})},o.dispose=function(){this.objects.forEach(function(r,u){r.dispose(),r.pm.reject("stop draw:".concat(u))}),this.objects.clear(),this.objectNamesToFactories.clear()},_(i,[{key:"objectsPromise",get:function(){var r=[];return this.objects.forEach(function(u){r.push(u.pm.promise)}),r}}]),i}(),k=function(){"use strict";function i(){v(this,i),this.data={}}var o=i.prototype;return o.install=function(){},o.setData=function(r,u){var h,l;this.data[r]=u,(l=(h=this).cb)===null||l===void 0||l.call(h,r)},o.dispose=function(){this.data={},this.cb=void 0},i}()})(),module.exports=K})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gl-draw",
3
- "version": "0.0.20",
3
+ "version": "0.0.21",
4
4
  "author": "gitplus <hstits@gmail.com>",
5
5
  "scripts": {
6
6
  "start": "PORT=3002 bundler-dev",