UNPKG

@urpflanze/js

Version:

A library for developers who want to approach to creative coding, artists who want to approach coding and for those who find it fun to play with math.

2 lines 138 kB
/*! For license information please see urpflanze-light.min.js.LICENSE.txt */ var t={2894:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.UncontrolledLoop=e.Static=e.Loop=e.Compose=e.Simple=e.resolveSimpleAnimation=void 0;const r=n(4825),i=n(2765);function a(t){const e=i.createAnimation(t);if(e)return t=>{var n;const r="number"==typeof t?t:(null===(n=t.shape.scene)||void 0===n?void 0:n.currentTime)||0;return e.update(r),e.value}}e.resolveSimpleAnimation=a,e.Simple=a,e.Compose=function(t){const e=r.composeAnimations(t);if(e)return t=>{var n;const r="number"==typeof t?t:(null===(n=t.shape.scene)||void 0===n?void 0:n.currentTime)||0;return e(r)}},e.Loop=function(t){const e=t;return void 0===e.interpolator&&(e.interpolator="wave"),e.interpolator&&("string"==typeof e.interpolator?"wave"!==e.interpolator&&(e.direction="alternate"):"object"==typeof e.interpolator&&"wave"!==e.interpolator.type&&(e.direction="alternate")),e.loop=!0,a(e)},e.Static=function(t){const e=t;return e.direction="normal",e.loop=!1,a(e)},e.UncontrolledLoop=function(t){const e=t;return e.direction="normal",e.loop=!0,a(e)}},9727:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Easings=void 0,e.Easings={linear:(t,e,n,r=1)=>n*t/r+e,quadraticIn:(t,e,n,r=1)=>n*(t/=r)*t+e,quadraticOut:(t,e,n,r=1)=>-n*(t/=r)*(t-2)+e,quadraticInOut:(t,e,n,r=1)=>(t/=r/2)<1?n/2*t*t+e:-n/2*(--t*(t-2)-1)+e,cubicIn:(t,e,n,r=1)=>n*(t/=r)*t*t+e,cubicOut:(t,e,n,r=1)=>(t/=r,n*(--t*t*t+1)+e),cubicInOut:(t,e,n,r=1)=>(t/=r/2)<1?n/2*t*t*t+e:n/2*((t-=2)*t*t+2)+e,quarticIn:(t,e,n,r=1)=>n*(t/=r)*t*t*t+e,quarticOut:(t,e,n,r=1)=>(t/=r,-n*(--t*t*t*t-1)+e),quarticInOut:(t,e,n,r=1)=>(t/=r/2)<1?n/2*t*t*t*t+e:-n/2*((t-=2)*t*t*t-2)+e,quinticIn:(t,e,n,r=1)=>n*(t/=r)*t*t*t*t+e,quinticOut:(t,e,n,r=1)=>(t/=r,n*(--t*t*t*t*t+1)+e),quinticInOut:(t,e,n,r=1)=>(t/=r/2)<1?n/2*t*t*t*t*t+e:n/2*((t-=2)*t*t*t*t+2)+e,sinusoidalIn:(t,e,n,r=1)=>-n*Math.cos(t/r*(Math.PI/2))+n+e,sinusoidalOut:(t,e,n,r=1)=>n*Math.sin(t/r*(Math.PI/2))+e,sinusoidalInOut:(t,e,n,r=1)=>-n/2*(Math.cos(Math.PI*t/r)-1)+e,exponentialIn:(t,e,n,r=1)=>n*Math.pow(2,10*(t/r-1))+e,exponentialOut:(t,e,n,r=1)=>n*(1-Math.pow(2,-10*t/r))+e,exponentialInOut:(t,e,n,r=1)=>(t/=r/2)<1?n/2*Math.pow(2,10*(t-1))+e:(t--,n/2*(2-Math.pow(2,-10*t))+e),circularIn:(t,e,n,r=1)=>(t/=r,-n*(Math.sqrt(1-t*t)-1)+e),circularOut:(t,e,n,r=1)=>(t/=r,t--,n*Math.sqrt(1-t*t)+e),circularInOut:(t,e,n,r=1)=>(t/=r/2)<1?-n/2*(Math.sqrt(1-t*t)-1)+e:(t-=2,n/2*(Math.sqrt(1-t*t)+1)+e),elasticIn:(t,e,n,r=1,i=1,a=.5)=>{if(0===t)return e;if(1==(t/=r))return e+n;a*=r;let o=0;return i<Math.abs(n)?(i=n,o=a/4):o=a/(2*Math.PI)*Math.asin(n/i),-i*Math.pow(2,10*(t-=1))*Math.sin((t*r-o)*(2*Math.PI)/a)+e},elasticOut:(t,e,n,r=1,i=1,a=.5)=>{if(0===t)return e;if(1==(t/=r))return e+n;a*=r;let o=0;return i<Math.abs(n)?(i=n,o=a/4):o=a/(2*Math.PI)*Math.asin(n/i),i*Math.pow(2,-10*t)*Math.sin((t*r-o)*(2*Math.PI)/a)+n+e},elasticInOut:(t,e,n,r=1,i=1,a=.5)=>{if(0===t)return e;if(2==(t/=r/2))return e+n;a*=r;let o=0;return i<Math.abs(n)?(i=n,o=a/4):o=a/(2*Math.PI)*Math.asin(n/i),t<1?i*Math.pow(2,10*(t-=1))*Math.sin((t*r-o)*(2*Math.PI)/a)*-.5+e:i*Math.pow(2,-10*(t-=1))*Math.sin((t*r-o)*(2*Math.PI)/a)*.5+n+e},backIn:(t,e,n,r=1,i=1.70158)=>n*(t/=r)*t*((i+1)*t-i)+e,backOut:(t,e,n,r=1,i=1.70158)=>n*((t=t/r-1)*t*((i+1)*t+i)+1)+e,backInOut:(t,e,n,r=1,i=1.70158)=>(t/=r/2)<1?n/2*(t*t*((1+(i*=1.525))*t-i))+e:n/2*((t-=2)*t*((1+(i*=1.525))*t+i)+2)+e,bounceIn:(t,n,r,i=1)=>r-e.Easings.bounceOut(i-t,0,r,i)+n,bounceOut:(t,e,n,r=1)=>(t/=r)<1/2.75?n*(7.5625*t*t)+e:t<2/2.75?n*(7.5625*(t-=1.5/2.75)*t+.75)+e:t<2.5/2.75?n*(7.5625*(t-=2.25/2.75)*t+.9375)+e:n*(7.5625*(t-=2.625/2.75)*t+.984375)+e,bounceInOut:(t,n,r,i=1)=>t<i/2?.5*e.Easings.bounceIn(2*t,0,r,i)+n:.5*e.Easings.bounceOut(2*t-i,0,r,i)+.5*r+n}},4825:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.composeAnimations=void 0;const r=n(9968),i=n(2765),a=n(8782);function o(t,e,n=.5){const i=Array.isArray(t)?t:[t],o=Array.isArray(e)?e:[e],s=[];for(let t=0,e=i.length;t<e;t++){if(typeof i[t]!=typeof o[t])return void console.error("[@urpflanze/animation]: cannot interpolate");if("string"!=typeof i[t]){const e=i[t],r=o[t];s.push(e+n*(r-e))}else{const e=i[t],h=o[t],c=r.parseColorAndConvert(e),u=r.parseColorAndConvert(h);void 0!==c&&void 0!==u&&s.push(a.interpolateColorRGB(c,u,n))}}return 1===s.length?s[0]:s}e.composeAnimations=function(t){const e=t.map(i.createAnimation).filter((t=>void 0!==t)),n=e.length;if(n>0)return t=>{let r;for(let i=0;i<n;i++){const n=e[i];n.update(t),r=void 0===r?n.value:o(r,n.value)}return r}}},2765:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createAnimation=void 0;const r=n(9298);e.createAnimation=function(t){const e=r.createInterpolationCallback(t);if(void 0===e)return;const n=t.delay||0,i=t.afterDelay||0,a=t.direction||"normal",o=t.duration||1e3,s="normal"===a||"reverse"===a?o+n:2*o+n+i,h={delay:n,afterDelay:i,direction:a,duration:o,totalDuration:s,loop:"number"==typeof t.loop?t.loop:!!t.loop},c=r.createInterpolator(t.interpolator),u={loop:0,offset:0,loopDuration:s,direction:"alternate"===a?"normal":a,started:!1,ended:!1,value:void 0};return u.update=function(t,e,n,r){const{loop:i,totalDuration:a,delay:o,afterDelay:s,direction:h,duration:c}=e;return u=>{if("number"==typeof i&&u>=a*i||!1===i&&u>=e.totalDuration)return t.started=!1,t.ended=!0,t.offset=n("normal"===h?c:0,c),void(t.value=r(t.offset));if(t.loop=Math.ceil(u/a),u%=a,(u-=o)<=0)return t.started=!1,t.offset=n(0,c),void(t.value=r(t.offset));if(t.started=!0,"alternate"===h)u<=c?(t.direction="normal",t.offset=n(u,c)):(t.direction="reverse",u-=c,(u-=s)>=0?t.offset=1-n(u>=c?c:u,c):t.offset=1);else{const e=n(u>=c?c:u,c);t.offset="normal"===h?e:1-e}t.value=r(t.offset)}}(u,h,c,e),u}},9298:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createInterpolator=e.createInterpolationCallback=void 0;const r=n(9968),i=n(3431),a=n(9727),o=n(8782);e.createInterpolationCallback=function(t){const e=Array.isArray(t.from)?t.from:[t.from],n=Array.isArray(t.to)?t.to:[t.to],i=t.round,a="hue"===t.colorTransitionMode?o.interpolateColorHSL:o.interpolateColorRGB;if(e.length!==n.length)return;const s=[];for(let t=0,o=e.length;t<o;t++){if(typeof e[t]!=typeof n[t])return void console.warn("[@urpflanze/animation]: `from` and `to` values mismatch");if("string"!=typeof e[t]){const r=e[t],a=n[t];s.push(void 0!==i?t=>1===t?a:0===t?r:Math.round((r+t*(a-r))*i)/i:t=>1===t?a:0===t?r:r+t*(a-r))}else{const i=e[t],o=n[t],h=r.parseColorAndConvert(i),c=r.parseColorAndConvert(o);void 0!==h&&void 0!==c&&s.push((t=>1===t?o:0===t?i:a(h,c,t)))}}return t=>{const e=s.map((e=>e(t)));return 1===e.length?e[0]:e}},e.createInterpolator=function(t){var e,n;switch(typeof t){case"function":return(e,n)=>t(e/n,e);case"string":if("wave"===t)return(t,e)=>.5+.5*Math.sin(t*Math.PI*2/e+1.5*Math.PI);if(t in a.Easings){const e=a.Easings[t];return(t,n)=>e(t,0,1,n)}return(t,e)=>a.Easings.linear(t,0,1,e);case"object":switch(t.type){case"wave":{const n=1.5*Math.PI+((null===(e=t.params)||void 0===e?void 0:e.phase)||0);return(t,e)=>.5+.5*Math.sin(t*Math.PI*2/e+n)}case"elasticIn":case"elasticOut":case"elasticInOut":{const e=a.Easings[t.type],{amplitude:n,period:r}=t.params||{};return(t,i)=>e(t,0,1,i,n,r)}case"backIn":case"backOut":case"backInOut":{const e=a.Easings[t.type],r=(null===(n=t.params)||void 0===n?void 0:n.overshoot)||void 0;return(t,n)=>e(t,0,1,n,r)}case"cubicBezier":{const e=i.default(t.params[0],t.params[1],t.params[2],t.params[3]);return(t,n)=>e(t/n)}}}return(t,e)=>a.Easings.linear(t,0,1,e)}},7518:function(t,e,n){var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(5240),e),i(n(8782),e),i(n(2765),e),i(n(9298),e),i(n(9727),e),i(n(2894),e)},5240:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},8782:(t,e)=>{function n(t,e,n=!0,r="alternate",i=0,a=0){const o="normal"===r||"reverse"===r?e+i:2*e+i+a;return"number"==typeof n&&t>=o*n||!1===n&&t>=o?"normal"===r?e:0:(t%=o,(t-=i)<=0?0:"alternate"===r?t<=e?t:(t-=e,(t-=a)>=0?e-(t>=e?e:t):e):t>=e?e:t)}Object.defineProperty(e,"__esModule",{value:!0}),e.interpolateColorHSL=e.interpolateColorRGB=e.cosp=e.sinp=e.clockOffset=e.clock=void 0,e.clock=n,e.clockOffset=function(t,e,r=!0,i="alternate",a=0,o=0){return n(t,e,r,i,a,o)/e};const r=2*Math.PI;e.sinp=function(t,e,n=0,i=!1){const a=Math.sin(t*r/e+n);return i?.5+.5*a:a},e.cosp=function(t,e,n=0,i=!1){const a=Math.cos(t*r/e+n);return i?.5+.5*a:a},e.interpolateColorRGB=function(t,e,n){const r=t.r+n*(e.r-t.r),i=t.g+n*(e.g-t.g),a=t.b+n*(e.b-t.b),o=t.alpha+n*(e.alpha-t.alpha);return`rgba(${Math.floor(r)},${Math.floor(i)},${Math.floor(a)},${o})`},e.interpolateColorHSL=function(t,e,n){return`hsla(${t.h+n*(e.h-t.h)},${t.s+n*(e.s-t.s)}%,${t.l+n*(e.l-t.l)}%,${t.alpha+n*(e.alpha-t.alpha)})`}},9968:t=>{var e;window,e=function(){return(()=>{var t=[function(t,e,n){var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(1),e),i(n(2),e),i(n(3),e)},(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.rgbToHsl=e.hslToRgb=e.rgbToHex=void 0,e.rgbToHex=function(t,e,n){return`#${((1<<24)+(t<<16)+(e<<8)+n).toString(16).slice(1)}`},e.hslToRgb=function(t,e,n){let r,i,a;if(t/=360,n/=100,0==(e/=100))r=i=a=n;else{const o=(t,e,n)=>(n+=n<0?1:n>1?-1:0)<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t,s=n<.5?n*(1+e):n+e-n*e,h=2*n-s;r=o(h,s,t+1/3),i=o(h,s,t),a=o(h,s,t-1/3)}return[.5+255*r<<0,.5+255*i<<0,.5+255*a<<0]},e.rgbToHsl=function(t,e,n){t/=255,e/=255,n/=255;const r=Math.max(t,e,n),i=Math.min(t,e,n),a=(r+i)/2;let o,s;if(r===i)o=s=0;else{const h=r-i;switch(s=a>.5?h/(2-r-i):h/(r+i),r){case t:o=(e-n)/h+(e<n?6:0);break;case e:o=(n-t)/h+2;break;case n:o=(t-e)/h+4}o/=6}return[.5+360*o<<0,.5+100*s<<0,.5+100*a<<0]}},(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.parseColor=e.parseColorAndConvert=void 0;const r=n(4),i=n(2);function a(t){if("number"==typeof t)return t>16777215?{type:"rgb",a:t>>24&255,b:t>>16&255,c:t>>8&255,alpha:(255&t)/255}:{type:"rgb",a:t>>16&255,b:t>>8&255,c:255&t,alpha:1};t=t.replace(/\s/g,""),r.default[t]&&(t=r.default[t]);let e=/^#([0-9a-f]{3,8})$/i.exec(t);if(e){const t=e[1];return 3===t.length?{type:"rgb",a:parseInt(t[0]+t[0],16),b:parseInt(t[1]+t[1],16),c:parseInt(t[2]+t[2],16),alpha:1}:{type:"rgb",a:parseInt(t[0]+t[1],16),b:parseInt(t[2]+t[3],16),c:parseInt(t[4]+t[5],16),alpha:t.length>6?parseInt(t.substring(6),16)/255:1}}if(e=/^((hsl|rgb)a?)\((\d+),(\d+)%?,(\d+)%?,?(.+)?\)$/i.exec(t),e){const[,,t,n,r,i,a]=e;return{type:t,a:+n,b:+r,c:+i,alpha:a?+a:1}}}e.parseColorAndConvert=function(t){const e=a(t);if(e){if("hsl"===e.type){const[t,n,r]=i.hslToRgb(e.a,e.b,e.c);return{r:t,g:n,b:r,h:e.a,s:e.b,l:e.c,alpha:e.alpha}}{const[t,n,r]=i.rgbToHsl(e.a,e.b,e.c);return{h:t,s:n,l:r,r:e.a,g:e.b,b:e.c,alpha:e.alpha}}}},e.parseColor=a},(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}}],e={},n=function n(r){var i=e[r];if(void 0!==i)return i.exports;var a=e[r]={exports:{}};return t[r].call(a.exports,a,a.exports,n),a.exports}(0);return n})()},t.exports=e()},2513:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Group=void 0;const r=n(1378),i=n(541),a=n(2648),o=n(5511);class s extends i.SceneChild{constructor(t={}){t.type="Group",super(t),this.children=[],["id","name","data","order","type"].forEach((e=>{e in t&&delete t[e]})),this.props=t}isStatic(){const t=this.children;for(let e=0,n=t.length;e<n;e++)if(!t[e].isStatic())return!1;return!0}isStaticIndexed(){const t=this.children;for(let e=0,n=t.length;e<n;e++)if(!t[e].isStaticIndexed())return!1;return!0}add(...t){for(let e=0,n=t.length;e<n;e++){const n=t[e],i=n.getProps();Object.keys(this.props).forEach((t=>{void 0===i[t]&&n.setProp(t,this.props[t])})),n.order=void 0!==n.order?n.order:this.children.length>0?Math.max.apply(this,this.children.map((t=>t.order||0)))+1:0,this.scene&&r.Scene.propagateToChilden(n,this.scene),this.children.push(n)}this.sortChildren()}sortChildren(){this.children.sort(((t,e)=>t.order-e.order)),this.children=this.children.map(((t,e)=>(t.order=e,t))),this.clearBuffer(!0)}getChildren(){return this.children}find(t){if(this.id===t||this.name===t)return this;const e=this.getChildren();for(let n=0,r=e.length;n<r;n++){const r=e[n].find(t);if(null!==r)return r}return null}get(t){return t>=0&&t<this.children.length?this.children[t]:null}remove(t){if(t>=0&&t<this.children.length){const e=this.children.splice(t,1);return this.clearBuffer(!0),e}return!1}removeFromId(t){for(let e=0,n=this.children.length;e<n;e++)if(this.children[e].id==t)return this.children.splice(e,1),this.clearBuffer(!0)}generate(t,e=!1,n){this.generateId=t,this.children.forEach((r=>r.generate(t,e,n)))}getBounding(){const t=[],e=o.Bounding.empty();if(this.children.length>0){this.children.forEach((e=>t.push(e.getBounding())));for(let n=0,r=this.children.length;n<r;n++)e.x=e.x>t[n].x?t[n].x:e.x,e.y=e.y>t[n].y?t[n].y:e.y,e.width=e.width<t[n].width?t[n].width:e.width,e.height=e.height<t[n].height?t[n].height:e.height;e.cx=e.x+e.width/2,e.cy=e.y+e.height/2}return e}clearBuffer(t=!1,e=!0){if(this.children.forEach((e=>e.clearBuffer(t,!1))),this.scene&&e){const n=this.scene.getParentsOfSceneChild(this);n.length>0&&n[n.length-1].clearBuffer(t,e)}}setProp(t,e){"object"==typeof t?Object.keys(t).forEach((e=>this.props[e]=t[e])):this.props[t]=e,this.children.forEach((n=>n.setProp(t,e)))}setPropUnsafe(t,e){super.setPropUnsafe(t,e),this.children.forEach((n=>n.setPropUnsafe(t,e)))}getBufferLength(t){return this.children.map((e=>e.getBufferLength(t))).reduce(((t,e)=>t+e),0)}getBuffer(){const t=this.children.map((t=>t.getBuffer())).filter((t=>void 0!==t)),e=t.reduce(((t,e)=>t+e.length),0);if(e>0){const n=new Float32Array(e);n.set(t[0],0);for(let e=1,r=0,i=t.length;e<i;e++)r+=t[e-1].length,n.set(t[e],r);return n}return a.ShapeBase.EMPTY_BUFFER}getIndexedBuffer(){const t=this.children.map((t=>t.getIndexedBuffer())).filter((t=>void 0!==t));return[].concat.apply([],t)}stream(t){this.children.forEach((e=>e.stream(t)))}}e.Group=s},1378:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Scene=void 0;const r=n(541),i=n(2513),a=n(6448),o=n(313);class s{constructor(t={}){this.width=400,this.height=400,this.background="hsla(0, 0%, 0%, 1)",this.color="hsla(0, 0%, 100%, 1)",this.currentTime=0,void 0!==t.width&&(this.width=t.width),void 0!==t.height&&(this.height=t.height),void 0!==t.background&&(this.background=t.background),void 0!==t.color&&(this.color=t.color),this.children=[],this.anchorSettings=t.anchor,this.setSize(t.width||this.width,t.height||this.height,t.anchor)}setSize(t,e,n){this.width=t,this.height=e,this.center=[this.width/2,this.height/2],this.anchor=n&&Array.isArray(n)?["number"==typeof n[0]?(.5+.5*o.clamp(-1,1,n[0]))*this.width:"left"===n[0]?0:"right"===n[0]?this.width:this.center[0],"number"==typeof n[1]?(.5+.5*o.clamp(-1,1,n[1]))*this.height:"top"===n[1]?0:"bottom"===n[1]?this.height:this.center[1]]:[this.center[0],this.center[1]]}getWidth(t=100){return this.width*t/100}getHeight(t=100){return this.height*t/100}resize(t,e=t){this.setSize(t,e,this.anchorSettings),this.children.forEach((t=>t.clearBuffer(!0,!1)))}update(t=0){this.currentTime=t;for(let t=0,e=this.children.length;t<e;t++)this.children[t].generate(this.currentTime,!0)}stream(t){this.children.forEach((e=>e.stream(t)))}getChildren(){return this.children}add(...t){const e="number"==typeof t[t.length-1]?t[t.length-1]:void 0,n=t.length-(void 0===e?0:1);for(let r=0;r<n;r++){const n=t[r];n.order=void 0!==e?e+r:void 0!==n.order?n.order:this.children.length>0?Math.max.apply(this,this.children.map((t=>t.order||0)))+1:0,s.propagateToChilden(n,this),this.children.push(n),n.clearBuffer(!0,!1),n.generate(0,!0)}this.sortChildren()}sortChildren(){this.children.sort(((t,e)=>t.order-e.order)),this.children=this.children.map(((t,e)=>(t.order=e,t)))}find(t){const e=this.getChildren();for(let n=0,r=e.length;n<r;n++){const r=e[n].find(t);if(null!==r)return r}return null}get(t){return t>=0&&t<this.children.length?this.children[t]:null}remove(t){t>=0&&t<this.children.length&&this.children.splice(t,1)}removeChildren(){this.children=[]}removeFromId(t){for(let e=0,n=this.children.length;e<n;e++)if(this.children[e].id===t||this.children[e].name===t)return void this.children.splice(e,1)}isFirstLevelChild(t){for(let e=0,n=this.children.length;e<n;e++)if(this.children[e].id===t.id)return!0;const e=this.getParentsOfSceneChild(t);return 1===e.length&&e[0]instanceof i.Group}getParentsOfSceneChild(t){const e=s.getParentsOfSceneChild(this,t);return e?(e.splice(0,1),e):[]}static getParentsOfSceneChild(t,e,n=[]){let o;if(t instanceof r.SceneChild){if(t.id==e.id)return n;if(t instanceof a.Shape&&t.shape){const r=n.slice();if(r.push(t),o=s.getParentsOfSceneChild(t.shape,e,r))return o}}if(t instanceof s||t instanceof i.Group){const r=t.getChildren();n.push(t);for(let t=0,i=r.length;t<i;t++){const i=r[t];if(o=s.getParentsOfSceneChild(i,e,n))return o}n.pop()}return null}static walk(t,e){if(e instanceof r.SceneChild){if(!1===t(e))return!1;if(e instanceof a.Shape&&e.shape&&!1===s.walk(t,e.shape))return!1}if(e instanceof s||e instanceof i.Group){const n=e.getChildren();for(let e=0,r=n.length;e<r;e++){const r=n[e];if(!1===s.walk(t,r))return!1}}}static propagateToChilden(t,e){t.scene=e,t instanceof i.Group?t.getChildren().forEach((t=>{s.propagateToChilden(t,e)})):t instanceof a.Shape&&t.shape&&(t.shape.scene=e,s.propagateToChilden(t.shape,e))}}e.Scene=s},541:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SceneChild=void 0;let n=0;e.SceneChild=class{constructor(t){var e;this.generateId=-1,this.id=null!==(e=t.id)&&void 0!==e?e:++n,this.type=t.type||"SceneChild",this.name=t.name||this.type+"_"+this.id,this.data=t.data||{},this.props={}}find(t){return this.id===t||this.name===t?this:null}getProps(){return this.props}getProp(t,e,n){var r;return null!==(r=this.props[t])&&void 0!==r?r:n}hasProp(t){return void 0!==this.props[t]}setPropUnsafe(t,e){"string"==typeof t?this.props[t]=e:Object.keys(t).forEach((e=>this.props[e]=t[e]))}}},313:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.interpolate=e.prepareBufferForInterpolation=e.distributePointsInBuffer=e.distanceFromRepetition=e.angle2FromRepetition=e.angleFromRepetition=e.random=e.noise=e.relativeClamp=e.clamp=e.lerp=e.toRadians=e.toDegrees=e.now=void 0;const r=n(21),i=n(2769),a=n(795),o="undefined"!=typeof performance?performance:Date;function s(t,e,n){return n<=t?t:n>=e?e:n}e.now=function(){return o.now()},e.toDegrees=function(t){return 180*t/Math.PI},e.toRadians=function(t){return t*Math.PI/180},e.lerp=function(t,e,n){return(1-n)*t+n*e},e.clamp=s,e.relativeClamp=function(t,e,n,r,i){return s(r,i,(n-t)/(e-t)*(i-r)+r)};const h={random:new r(Math.random)};e.noise=function(t="random",e=0,n=0,i=0,a=-1,o=1){void 0===h[t]&&(h[t]=new r(t));const s=h[t].noise3D(e,n,i);return-1!==a||1!==o?(.5+.5*s)*(o-a)+a:s};const c={};function u(t,e){const n=t.length,r=n/2,i=2*(r+e),a=r-1;if(a>1){const r=n-2,o=Math.floor(e/a);let s=(i-(n+o*r))/2;const h=Math.round(a/s),c=new Float32Array(i);for(let e=0,n=0,i=0;e<r;e+=2,n++,i+=2){const a=t[e],u=t[e+1],l=t[e+2],f=t[e+3];c[i]=a,c[i+1]=u;const d=s>0&&(n%h==0||e===r-2),p=o+(d?1:0),g=1/(p+1);for(let t=0;t<p;t++,i+=2){const e=g*(t+1);c[i+2]=(1-e)*a+e*l,c[i+3]=(1-e)*u+e*f}d&&s--}return c[i-2]=t[n-2],c[i-1]=t[n-1],c}const o=new Float32Array(i);for(let e=0;e<i;e+=2)o[e]=t[e%n],o[e+1]=t[(e+1)%n];return o}function l(t,e){const n=t.length,r=e.length;if(n===r)return[t,e];const i=Math.abs(n-r),a=n<r?e:t,o=u(n<r?t:e,Math.floor(i/2));return n>r?[a,o]:[o,a]}e.random=function(t,e=0,n=1,r){const i=t+"";if(void 0===c[i]){const t=function(t){let e=0,n=1779033703^t.length;for(;e<t.length;e++)n=Math.imul(n^t.charCodeAt(e),3432918353),n=n<<13|n>>>19;return function(){return n=Math.imul(n^n>>>16,2246822507),n=Math.imul(n^n>>>13,3266489909),(n^=n>>>16)>>>0}}(i);c[i]=(a=t(),o=t(),s=t(),h=t(),function(){let t=(a>>>=0)+(o>>>=0)|0;return a=o^o>>>9,o=(s>>>=0)+(s<<3)|0,t=t+(h=1+(h>>>=0)|0)|0,s=(s=s<<21|s>>>11)+t|0,(t>>>0)/4294967296})}var a,o,s,h;const u=e+c[i]()*(n-e);return void 0!==r?Math.round(u*10**r)/10**r:u},e.angleFromRepetition=function(t,e=[0,0]){if(t.type===i.ERepetitionType.Matrix){const n=[(t.col.count-1)/2,(t.row.count-1)/2];n[0]+=n[0]*e[0],n[1]+=n[1]*e[1];const r=t.col.index-1-n[0],i=t.row.index-1-n[1];return 0===r?0:Math.atan(i/r)}return(t.angle-Math.PI)/2},e.angle2FromRepetition=function(t,e=[0,0]){if(t.type===i.ERepetitionType.Matrix){const n=[(t.col.count-1)/2,(t.row.count-1)/2];n[0]+=n[0]*e[0],n[1]+=n[1]*e[1];const r=t.col.index-1-n[0],i=t.row.index-1-n[1];return 0===r?0:Math.atan2(i,r)}return t.angle-Math.PI},e.distanceFromRepetition=function(t,e=[0,0]){if(t.type===i.ERepetitionType.Matrix){const n=[.5,.5];n[0]+=n[0]*e[0],n[1]+=n[1]*e[1];const r=[t.col.offset,t.row.offset];return a.default.distance(r,n)}return 1},e.distributePointsInBuffer=u,e.prepareBufferForInterpolation=l,e.interpolate=function(t,e,n=.5){const[r,i]=l(t,e),a=Math.max(r.length,i.length),o="number"==typeof n?[n]:n,s=a/2;if(o.length!==s){const t=o.length;for(let e=0;e<s;e++)o[e]=o[e%t]}const h=new Float32Array(a);for(let t=0,e=0;t<a;t+=2,e++)h[t]=(1-o[e])*r[t]+o[e]*i[t],h[t+1]=(1-o[e])*r[t+1]+o[e]*i[t+1];return h}},795:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0});const n=new Array(4),r={from:(t=0,e)=>{const n=new Array(2);return"number"==typeof t?(n[0]=t,n[1]=null!=e?e:t):(n[0]=t[0],n[1]=t[1]),n},normalize:t=>{const e=r.length(t);return 0!==e?[t[0]/e,t[1]/e]:[0,0]},distance:(t,e)=>Math.hypot(t[0]-e[0],t[1]-e[1]),dot:(t,e)=>t[0]*e[0]+t[1]*e[1],length:t=>Math.hypot(t[0],t[1]),angle:(t,e)=>(t=r.normalize(t),e=r.normalize(e),Math.acos(r.dot(t,e))),skewX:(t,e)=>{t[0]+=Math.tan(e)*t[1]},skewY:(t,e)=>{t[1]+=Math.tan(e)*t[0]},squeezeX:(t,e)=>{t[1]+=t[1]*(t[0]*-e)},squeezeY:(t,e)=>{t[0]+=t[0]*(t[1]*e)},rotate:(t,e,n)=>{const r=t[0]-n[0],i=t[1]-n[1];t[0]=r*e[0]+i*e[1]+n[0],t[1]=r*e[2]+i*e[3]+n[1]},rotateX:(t,e,i)=>{n[0]=1,n[1]=0,n[2]=0,n[3]=Math.cos(i),r.rotate(t,n,e)},rotateY:(t,e,i)=>{n[0]=Math.cos(i),n[1]=0,n[2]=0,n[3]=1,r.rotate(t,n,e)},rotateZ:(t,e,i)=>{n[0]=Math.cos(i),n[1]=-Math.sin(i),n[2]=Math.sin(i),n[3]=Math.cos(i),r.rotate(t,n,e)},translate:(t,e)=>{t[0]+=e[0],t[1]+=e[1]},scale:(t,e)=>{t[0]*=e[0],t[1]*=e[1]},divide:(t,e)=>{t[0]/=e[0],t[1]/=e[1]},toString:t=>`x: ${t[0]}, y: ${t[1]}`,ZERO:Array.from([0,0]),ONE:Array.from([1,1])};e.default=r},8721:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.toVec3=e.toVec2=e.fromSkew=e.VEC2_ONE=e.VEC2_ZERO=e.VEC3_ONE=e.VEC3_ZERO=void 0;const r=n(887);e.VEC3_ZERO=[0,0,0],e.VEC3_ONE=[1,1,1],e.VEC2_ZERO=[0,0],e.VEC2_ONE=[1,1],r.glMatrix.setMatrixArrayType(Array),e.fromSkew=function(t,e){return t[0]=1,t[1]=Math.tan(e[1]),t[2]=0,t[3]=0,t[4]=Math.tan(e[0]),t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},e.toVec2=function(t){return Array.isArray(t)?[t[0],t[1]]:[t,t]},e.toVec3=function(t,e=0){return Array.isArray(t)?[t[0],t[1],e]:[t,t,e]}},3792:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.mod=e.PHI=e.PI2=e.log=void 0,e.log=(t,e)=>Math.log(t)/Math.log(e),e.PI2=2*Math.PI,e.PHI=(1+Math.sqrt(5))/2,e.mod=(t,e)=>{const n=t%e;return n<0?n+e:n}},5511:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Adapt=e.Bounding=e.EAdaptMode=void 0;const r=n(9958);var i;!function(t){t[t.None=0]="None",t[t.Scale=2]="Scale",t[t.Center=4]="Center",t[t.Fill=8]="Fill"}(i=e.EAdaptMode||(e.EAdaptMode={})),e.Bounding={empty:()=>({cx:0,cy:0,x:-1,y:-1,width:2,height:2}),clear:t=>{t[0]=void 0,t[1]=void 0,t[2]=void 0,t[3]=void 0},add:(t,e,n)=>{(void 0===t[0]||e<t[0])&&(t[0]=e),(void 0===t[2]||e>t[2])&&(t[2]=e),(void 0===t[1]||n<t[1])&&(t[1]=n),(void 0===t[3]||n>t[3])&&(t[3]=n)},sum:(t,e)=>{void 0!==e[0]&&void 0!==e[1]&&void 0!==e[2]&&void 0!==e[3]?void 0===t[0]||void 0===t[1]||void 0===t[2]||void 0===t[3]?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3]):(t[0]<e[0]&&(t[0]=e[0]),t[2]>e[2]&&(t[2]=e[2]),t[1]<e[1]&&(t[1]=e[1]),t[3]>e[3]&&(t[3]=e[3])):console.warn("[Urplfanze:Bounding] cannot sum bounding")},bind:(t,e)=>{void 0!==e[0]&&void 0!==e[1]&&void 0!==e[2]&&void 0!==e[3]?(t.x=e[0],t.y=e[1],t.width=e[2]-e[0],t.height=e[3]-e[1],t.cx=t.x+t.width/2,t.cy=t.y+t.height/2):console.warn("[Urplfanze:Bounding] cannot bind bounding")}};class a extends r.Modifier{constructor(t){super(),this.mode=t.mode||i.Fill,this.rect=t.rect}apply(t,e){return a.adapt(t,this.mode,this.rect)}static adapt(t,e,n){if(e===i.None)return Float32Array.from(t);const r=new Float32Array(t.length);n||(n=a.getBounding(t));const o=n.width>=2||n.height>=2||e>=i.Fill&&(n.width<2||n.height<2)?2/Math.max(n.width,n.height):1,s=e>=i.Center?n.cx:0,h=e>=i.Center?n.cy:0;for(let e=0,n=t.length;e<n;e+=2)r[e]=(t[e]-s)*o,r[e+1]=(t[e+1]-h)*o;return r}static getBounding(t,n){void 0===n&&(n=e.Bounding.empty());const r=[void 0,void 0,void 0,void 0];for(let n=0,i=t.length;n<i;n+=2)e.Bounding.add(r,t[n],t[n+1]);return e.Bounding.bind(n,r),n}}e.Adapt=a,a.MODES=i},8301:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Close=void 0;const r=n(9958);class i extends r.Modifier{constructor(){super()}apply(t,e,n){return i.call(t)}static call(t){const e=t.length;if(i.isClosed(t))return t;const n=new Float32Array(e+2);return n.set(t,0),n[e]=n[0],n[e+1]=n[1],n}static isClosed(t){const e=t.length;return t[0]===t[e-2]&&t[1]===t[e-1]}}e.Close=i},1740:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Mirror=void 0;const r=n(9958);class i extends r.Modifier{constructor(t={x:!0,y:!0}){super(),this.x=!0===t.x,this.y=!0===t.y}apply(t,e){const n=t.length,r=new Float32Array(n*(this.x?2:1)*(this.y?2:1));if(this.x&&this.y){const e=n+n,i=e+n;for(let a=0;a<n;a+=2)r[a]=t[a]-1,r[a+1]=t[a+1]-1,r[n+a]=-1*t[n-2-a]+1,r[n+a+1]=t[n-2-a+1]-1,r[e+a]=-1*t[a]+1,r[e+a+1]=-1*t[a+1]+1,r[i+a]=t[n-2-a]-1,r[i+a+1]=-1*t[n-2-a+1]+1}else if(this.x)for(let e=0;e<n;e+=2)r[e]=t[e]-1,r[e+1]=t[e+1],r[n+e]=-1*t[n-2-e]+1,r[n+e+1]=t[n-2-e+1];else{if(!this.y)return t;for(let e=0;e<n;e+=2)r[e]=t[e],r[e+1]=t[e+1]-1,r[n+e]=t[n-2-e],r[n+e+1]=-1*t[n-2-e+1]+1}return r}}e.Mirror=i},9958:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Modifier=void 0,e.Modifier=class{}},3315:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Offset=void 0;const r=n(9958);class i extends r.Modifier{constructor(t={from:0,to:void 0}){super(),this.from=t.from,this.to=t.to}apply(t,e){return t.subarray(this.from,this.to?this.to<0?t.length+this.to:this.to:void 0)}}e.Offset=i},4660:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Smooth=void 0;const r=n(313),i=n(8301),a=n(9958);class o extends a.Modifier{constructor(t={}){super(),this.level=t.level||1;const e=Array.isArray(t.tension)?t.tension:[t.tension];this.tension=new Array(this.level).fill(.5).map(((t,n)=>r.clamp(0,1,e[n]||t))),this.level=this.level<1?1:this.level,this.closed=!0===t.closed}apply(t,e){if(e&&!i.Close.isClosed(t)){const e=t.length,n=new Float32Array(e+2);n.set(t,0),n[e]=t[0],n[e+1]=t[1],t=n}let n=t;for(let t=0,r=this.level;t<r;t++)n=o.smooth(n,this.tension[t],e||this.closed);return n}static smooth(t,e=.5,n=!1){const r=t.length,i=new Float32Array(2*(t.length-(n?1:0)));n||(i[0]=t[0],i[1]=t[1]);const a=.05+.4*e,o=1-a;let s=n?0:2;for(let e=0,n=r-2;e<n;e+=2,s+=4)i[s]=o*t[e]+a*t[e+2],i[s+1]=o*t[e+1]+a*t[e+3],i[s+2]=a*t[e]+o*t[e+2],i[s+3]=a*t[e+1]+o*t[e+3];return n?(i[s]=i[0],i[s+1]=i[1]):(i[s]=t[r-2],i[s+1]=t[r-1]),i}}e.Smooth=o},5838:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Solidify=void 0;const r=n(9958);class i extends r.Modifier{constructor(t={}){super(),this.closed=!0===t.closed,this.thickness=t.thickness||.2,this.error=t.error}apply(t,e){return i.solidify(t,this.thickness,this.closed,this.error)}static solidify(t,e,n=!1,r){const a=[],o=(e="number"==typeof e?[e]:e).length;let s,h,c=[[0,0],[0,0]],u=[[0,0],[0,0]];for(let n=0,l=0,f=t.length-2;n<f;n+=2,l++){s=0===n,h=n===f-2;const d={index:n+1,offset:n/f,count:f},p={index:n+2,offset:(n+1)/f,count:f},g="function"==typeof e?e(d):e[l%o],m="function"==typeof e?e(p):e[(l+1)%o],v=i.getOffsets(t[n],t[n+1],t[n+2],t[n+3],g),M=i.getOffsets(t[n],t[n+1],t[n+2],t[n+3],m),b=[t[n]+v[0],t[n+1]+v[1]],y=[t[n+2]+M[0],t[n+3]+M[1]],x=[t[n]-v[0],t[n+1]-v[1]],w=[t[n+2]-M[0],t[n+3]-M[1]];if(!s){const t=i.getIntersection(c[0],c[1],b,y,r);t&&(a.unshift(t[1]),a.unshift(t[0]));const e=i.getIntersection(u[0],u[1],x,w,r);e&&(a.push(e[0]),a.push(e[1]))}s&&(a.unshift(b[1]),a.unshift(b[0]),a.push(x[0]),a.push(x[1])),h&&(a.unshift(y[1]),a.unshift(y[0]),a.push(w[0]),a.push(w[1])),h||(c=[b,y],u=[x,w])}if(n){const e=t.length-2,n=a.length-2,r=.5*a[0]+.5*a[e],i=.5*a[1]+.5*a[e+1],o=.5*a[e+2]+.5*a[n],s=.5*a[e+3]+.5*a[n+1];a[0]=r,a[1]=i,a[e]=r,a[e+1]=i,a[e+2]=o,a[e+3]=s,a[n]=o,a[n+1]=s}return Float32Array.from(a)}static getOffsets(t,e,n,r,i){const a=n-t,o=r-e,s=i/(2*Math.sqrt(a*a+o*o));return[-s*o,s*a]}static getIntersection(t,e,n,r,i=1e-5){const a=(e[1]-t[1])/(e[0]-t[0]),o=(r[1]-n[1])/(r[0]-n[0]);if(Math.abs(a-o)<i)return;const s=t[1]-a*t[0],h=(s-(n[1]-o*n[0]))/(o-a);return[h,a*h+s]}}e.Solidify=i},5588:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Subdivide=void 0;const r=n(9958);class i extends r.Modifier{constructor(t={}){super(),this.level=t.level||1,this.level=this.level<1?1:this.level}apply(t,e){const n=this.level;let r=t;if(r&&r.length>0)for(let t=0;t<n;t++)r=i.subdivide(r,e);return r}static subdivide(t,e=!1){const n=t.length,r=new Float32Array(2*n-(e?0:2));for(let e=0;e<n;e+=2)if(0===e)r[0]=t[0],r[1]=t[1];else{const n=t[e-2],i=t[e-1],a=t[e],o=t[e+1],s=(a+n)/2,h=(o+i)/2;r[2*(e-1)]=s,r[2*(e-1)+1]=h,r[2*e]=a,r[2*e+1]=o}return e&&(r[2*(n-1)]=(t[0]+t[n-2])/2,r[2*(n-1)+1]=(t[1]+t[n-1])/2),r}}e.Subdivide=i},9514:(t,e,n)=>{e.q=void 0;const r=n(5511),i=n(1740),a=n(4660),o=n(5838),s=n(5588),h=n(8301),c=n(3315),u={Adapt:r.Adapt,Mirror:i.Mirror,Smooth:a.Smooth,Solidify:o.Solidify,Subdivide:s.Subdivide,Close:h.Close,Offset:c.Offset};e.q=u},6448:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Shape=void 0;const r=n(1378),i=n(541),a=n(2648);class o extends a.ShapeBase{constructor(t){t.type=t.type||"Shape",super(t),t.shape instanceof i.SceneChild?this.shape=t.shape:console.warn("[Urpflanze:Shape] requires the 'shape' property to be instance of SceneChild,\nYou passed:",t.shape),this.shapeUseParent=!!t.shapeUseParent,this.bStatic=this.isStatic(),this.bStaticIndexed=this.isStaticIndexed()}isStatic(){return super.isStatic()&&(!this.shape||this.shape.isStatic())}isStaticIndexed(){return super.isStaticIndexed()&&(!this.shape||this.shape.isStaticIndexed())}find(t){return this.id===t||this.name===t?this:this.shape?this.shape.find(t):null}getBufferLength(t){return this.bStatic&&this.buffer&&this.buffer.length>0?this.buffer.length:(this.shape?this.shape.getBufferLength(t):0)*this.getRepetitionCount()}generateBuffer(t,e){return this.shape?((this.shapeUseParent||this.shape.generateId!==t)&&(this.shapeUseParent&&this.shape.clearBuffer(!0,!1),this.shape.generate(t,!1,e)),this.shape.getBuffer()):o.EMPTY_BUFFER}getShapeBounding(){return this.shape?this.shape.getBounding():this.bounding}addIndex(t,e,n){if(this.shape){const r=this.shape.getIndexedBuffer()||[],i={shape:this,frameLength:t,singleRepetitionBounding:n,repetition:{type:e.type,angle:e.angle,index:e.index,count:e.count,offset:e.offset,row:{index:e.row.index,count:e.row.count,offset:e.row.offset},col:{index:e.col.index,count:e.col.count,offset:e.col.offset}}};for(let t=0,e=r.length;t<e;t++){const e={...r[t]},n=e.parent?o.setIndexedParent(e.parent,i):i;this.indexedBuffer.push({...e,parent:n})}}}static setIndexedParent(t,e){const n={...t};return n.parent=t.parent?o.setIndexedParent(t.parent,e):e,n}setShape(t){void 0===t?(this.shape=void 0,this.clearBuffer(!0,!0)):(this.scene&&r.Scene.propagateToChilden(t,this.scene),this.shape=t,this.shape.clearBuffer(!0,!0))}}e.Shape=o},2648:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ShapeBase=void 0;const r=n(887),i=n(3757),a=n(8721),o=n(795),s=n(3792),h=n(5511),c=n(313),u=n(541),l=r.mat4.create(),f=r.mat4.create(),d=r.mat4.create(),p=r.mat4.create();class g extends u.SceneChild{constructor(t={}){super(t),this.bIndexed=!1,this.indexedBuffer=[],this.bounding={cx:0,cy:0,x:-1,y:-1,width:2,height:2},this.props={distance:t.distance,repetitions:t.repetitions,rotateX:t.rotateX,rotateY:t.rotateY,rotateZ:t.rotateZ,skewX:t.skewX,skewY:t.skewY,squeezeX:t.squeezeX,squeezeY:t.squeezeY,displace:t.displace,translate:t.translate,scale:t.scale,transformOrigin:t.transformOrigin,perspective:t.perspective,perspectiveOrigin:t.perspectiveOrigin},this.anchor=t.anchor&&Array.isArray(t.anchor)?["number"==typeof t.anchor[0]?-1*c.clamp(-1,1,t.anchor[0]):"left"===t.anchor[0]?1:"right"===t.anchor[0]?-1:0,"number"==typeof t.anchor[1]?-1*c.clamp(-1,1,t.anchor[1]):"top"===t.anchor[1]?1:"bottom"===t.anchor[1]?-1:0]:[0,0],this.boundingType="string"==typeof t.boundingType?"relative"===t.boundingType?i.EBoundingType.Relative:i.EBoundingType.Fixed:t.boundingType||i.EBoundingType.Fixed,this.vertexCallback=t.vertexCallback}isStatic(){const t=this.props;return"function"!=typeof t.repetitions&&"function"!=typeof t.distance&&"function"!=typeof t.displace&&"function"!=typeof t.scale&&"function"!=typeof t.translate&&"function"!=typeof t.skewX&&"function"!=typeof t.skewY&&"function"!=typeof t.squeezeX&&"function"!=typeof t.squeezeY&&"function"!=typeof t.rotateX&&"function"!=typeof t.rotateY&&"function"!=typeof t.rotateZ&&"function"!=typeof t.transformOrigin&&"function"!=typeof t.perspective&&"function"!=typeof t.perspectiveOrigin}isStaticIndexed(){return"function"!=typeof this.props.repetitions}getProp(t,e,n){let r=this.props[t];return"function"==typeof r&&(r=r(e)),void 0===r||Number.isNaN(r)?n:r}setProp(t,e,n=!1){"string"==typeof t?(n=n||"repetitions"==t,this.props[t]=e):(n=n||"repetitions"in t,Object.keys(t).forEach((e=>this.props[e]=t[e]))),this.clearBuffer(n,!0)}clearBuffer(t=!1,e=!0){if(this.buffer=void 0,t&&(this.bIndexed=!1,this.indexedBuffer=[]),this.bStatic=this.isStatic(),this.bStaticIndexed=this.isStaticIndexed(),e&&this.scene&&!this.scene.isFirstLevelChild(this)){const n=this.scene.getParentsOfSceneChild(this);n.length>0&&n[n.length-1].clearBuffer(t,e)}}generate(t=0,e=!1,n){var u,m;if(this.buffer&&this.bStatic)return;this.generateId=t,this.bStaticIndexed&&this.bIndexed||(this.indexedBuffer=[]);const v=g.getEmptyPropArguments(this,n),M=v.repetition,b=this.getProp("repetitions",v,1),y=Array.isArray(b)?i.ERepetitionType.Matrix:i.ERepetitionType.Ring,x=Array.isArray(b)?b[0]*(null!==(u=b[1])&&void 0!==u?u:b[0]):b,w=Array.isArray(b)?b[0]:x,S=Array.isArray(b)?null!==(m=b[1])&&void 0!==m?m:b[0]:1,P=M.row;P.count=w;const I=M.col;I.count=S,M.count=x,M.col.count=S,M.row.count=w,M.type=y;let _=0;const B=[];let O=0;const A=r.vec2.fromValues((S-1)/2,(w-1)/2),C=this.scene?[this.scene.anchor[0],this.scene.anchor[1],0]:[0,0,0],q=[void 0,void 0,void 0,void 0],E=[void 0,void 0,void 0,void 0];for(let n=0;n<w;n++)for(let u=0;u<S;u++,O++){M.index=O+1,M.offset=x>1?O/(x-1):1,M.angle=y===i.ERepetitionType.Ring?s.PI2/x*O:0,I.index=u+1,I.offset=S>1?u/(S-1):1,P.index=n+1,P.offset=w>1?n/(w-1):1;const g=this.generateBuffer(t,v),m=g.length,b=this.getShapeBounding();B[O]=new Float32Array(m),_+=m;{const t=a.toVec2(this.getProp("distance",v,a.VEC2_ZERO)),s=this.getProp("displace",v,0),x=a.toVec3(this.getProp("scale",v,a.VEC2_ONE),1),w=a.toVec3(this.getProp("translate",v,a.VEC2_ZERO),0),S=this.getProp("skewX",v,0),P=this.getProp("skewY",v,0),I=this.getProp("squeezeX",v,0),_=this.getProp("squeezeY",v,0),L=this.getProp("rotateX",v,0),k=this.getProp("rotateY",v,0),F=this.getProp("rotateZ",v,0),R=c.clamp(0,1,this.getProp("perspective",v,0)),T=a.toVec3(this.getProp("perspectiveOrigin",v,a.VEC2_ZERO),0),D=a.toVec3(this.getProp("transformOrigin",v,a.VEC2_ZERO),0);let j;switch(y){case i.ERepetitionType.Ring:j=r.vec3.fromValues(t[0],0,0),r.vec3.rotateZ(j,j,a.VEC3_ZERO,M.angle+s);break;case i.ERepetitionType.Matrix:j=r.vec3.fromValues(t[1]*(u-A[0]),t[0]*(n-A[1]),0)}const z=R>0?Math.max(b.width,b.height)/2:1,U=R>0?z+10*z*(1-R):0,V=this.boundingType!==i.EBoundingType.Relative||0!==b.cx||0!==b.cy||0!==R||0!==D[0]||0!==D[1],Y=0!==T[0]||0!==T[1];V&&(this.boundingType===i.EBoundingType.Relative?(D[0]=D[0]*(b.width/2)+b.cx,D[1]=D[1]*(b.height/2)+b.cy):(D[0]*=b.width/2,D[1]*=b.height/2),D[2]=U);{r.mat4.identity(f),V&&r.mat4.translate(f,f,D),0===w[0]&&0===w[1]||r.mat4.translate(f,f,w),0===S&&0===P||(a.fromSkew(l,[S,P]),r.mat4.multiply(f,f,l)),0!==L&&r.mat4.rotateX(f,f,L),0!==k&&r.mat4.rotateY(f,f,k),0!==F&&r.mat4.rotateZ(f,f,F),1===x[0]&&1===x[1]||r.mat4.scale(f,f,x),V&&r.mat4.translate(f,f,r.vec3.scale(D,D,-1)),U>0&&(Y&&(this.boundingType===i.EBoundingType.Relative?(T[0]=T[0]*(b.width/2)+b.cx,T[1]=T[1]*(b.height/2)+b.cy):(T[0]*=b.width/2,T[1]*=b.height/2),T[2]=0),r.mat4.perspective(d,-Math.PI/2,1,0,1/0)),r.mat4.identity(p),r.mat4.translate(p,p,j),e&&r.mat4.translate(p,p,C);const t=[this.anchor[0]*(b.width/2),this.anchor[1]*(b.height/2),0];r.mat4.translate(p,p,t),y===i.ERepetitionType.Ring&&r.mat4.rotateZ(p,p,M.angle+s)}h.Bounding.clear(E);for(let t=0;t<m;t+=2){const e=[g[t],g[t+1],U];if(0!==I&&o.default.squeezeX(e,I),0!==_&&o.default.squeezeY(e,_),r.vec3.transformMat4(e,e,f),U>0&&(Y&&r.vec3.add(e,e,T),r.vec3.transformMat4(e,e,d),r.vec3.scale(e,e,U),Y&&r.vec3.sub(e,e,T)),r.vec3.transformMat4(e,e,p),void 0!==this.vertexCallback){const n=t/2,r=m/2,i={index:n+1,count:r,offset:r>1?n/(r-1):1};this.vertexCallback(e,i,v)}B[O][t]=e[0],B[O][t+1]=e[1],h.Bounding.add(E,e[0],e[1]),h.Bounding.add(q,e[0],e[1])}}const L={cx:0,cy:0,x:-1,y:-1,width:2,height:2};h.Bounding.bind(L,E),this.bStaticIndexed&&this.bIndexed||this.addIndex(m,M,L)}h.Bounding.bind(this.bounding,q),this.buffer=new Float32Array(_);for(let t=0,e=0,n=B.length;t<n;e+=B[t].length,t++)this.buffer.set(B[t],e);this.bIndexed=!0}getBounding(){return this.bounding}getRepetitionCount(){var t;const e=this.getProp("repetitions",void 0,1);return Array.isArray(e)?e[0]*(null!==(t=e[1])&&void 0!==t?t:e[0]):e}getBuffer(){return this.buffer}getIndexedBuffer(){return this.indexedBuffer}static getIndexParentLevel(t){if(void 0===t.parent)return 0;let e=t.parent,n=1;for(;void 0!==e.parent;)n++,e=e.parent;return n}stream(t){if(this.buffer&&this.indexedBuffer)for(let e=0,n=0,r=this.indexedBuffer.length;e<r;e++){const i=this.indexedBuffer[e];t({buffer:this.buffer,frameLength:i.frameLength,frameBufferIndex:n,currentIndexing:i,currentShapeIndex:e,totalShapes:r}),n+=i.frameLength}}static getEmptyPropArguments(t,e){return{repetition:{type:i.ERepetitionType.Ring,angle:0,index:1,offset:1,count:1,row:{index:1,offset:1,count:1},col:{index:1,offset:1,count:1}},shape:t,parent:e}}}e.ShapeBase=g,g.EMPTY_BUFFER=new Float32Array(0),g.getEmptySimpleRepetition=()=>({index:1,offset:1,count:1}),g.getEmptyRepetition=()=>({type:i.ERepetitionType.Ring,angle:0,...g.getEmptySimpleRepetition(),row:g.getEmptySimpleRepetition(),col:g.getEmptySimpleRepetition()})},7439:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ShapeBuffer=void 0;const r=n(5511),i=n(3674);class a extends i.ShapePrimitive{constructor(t={}){var e,n;t.type=t.type||"ShapeBuffer",t.adaptMode=null!==(e=t.adaptMode)&&void 0!==e?e:r.EAdaptMode.Scale,super(t),this.adaptMode=null!==(n=t.adaptMode)&&void 0!==n?n:r.EAdaptMode.Fill,void 0===t.shape?(console.warn("[Urpflanze:ShapeBuffer] ShapeBuffer require a buffer passed from `shape` property"),this.shape=a.EMPTY_BUFFER):this.shape="function"!=typeof t.shape?r.Adapt.adapt(t.shape,this.adaptMode):t.shape,this.bStatic=this.isStatic(),this.bStaticIndexed=this.isStaticIndexed()}isStatic(){return"function"!=typeof this.shape&&super.isStatic()}isStaticIndexed(){return"function"!=typeof this.shape&&super.isStaticIndexed()}clearBuffer(t=!1,e=!0){super.clearBuffer(t,e),this.shapeBuffer=void 0}bindBuffer(t){const e=this.getRepetitionSideLength(t),n=this.applyModifiers(Float32Array.from("function"==typeof this.shape?this.shape(t):this.shape),t),i=[void 0,void 0,void 0,void 0];for(let t=0,a=n.length;t<a;t+=2)n[t]=n[t]*e[0],n[t+1]=n[t+1]*e[1],r.Bounding.add(i,n[t],n[t+1]);r.Bounding.bind(this.currentGenerationPrimitiveBounding,i),this.shapeBuffer=n}getBufferLength(){return this.buffer&&this.buffer.length>0?this.buffer.length:this.shape.length*this.getRepetitionCount()}generateBuffer(t,e){return void 0!==this.shapeBuffer&&"function"!=typeof this.props.sideLength&&"function"!=typeof this.shape||this.bindBuffer(e),this.shapeBuffer}setShape(t){this.shape=r.Adapt.adapt(t,this.adaptMode),this.clearBuffer(!0)}getAdaptMode(){return this.adaptMode}static getBuffer(t={}){const e=new this({...t,sideLength:t.sideLength||1});return e.generate(),e.getBuffer()||new Float32Array}}e.ShapeBuffer=a},5382:(t,e,n)=>{e.S=void 0;const r=n(6448);class i extends r.Shape{constructor(t){t.type=t.type||"ShapeFollow",super(t),this.follow=t.follow||t.shape,this.bStatic=this.isStatic(),this.bStaticIndexed=this.isStaticIndexed(),this.shapeUseFollow=!!t.shapeUseFollow}clearBuffer(t=!1,e=!0){t&&(this.shapeFollowBuffer=void 0),super.clearBuffer(t,e)}isStatic(){return(!this.follow||this.follow.isStatic())&&super.isStatic()}isStaticIndexed(){return(!this.follow||this.follow.isStaticIndexed())&&super.isStaticIndexed()}generateBuffer(t,e){return this.shape&&this.follow?((void 0===this.shapeFollowBuffer||this.shapeUseParent||this.shape.generateId!==t||this.follow.generateId!==t)&&this.bindBuffer(t,e),this.shapeFollowBuffer):r.Shape.EMPTY_BUFFER}bindBuffer(t,e){const n=this.follow;n.generate(t,!1,e);const r=n.getBuffer(),i={...e,follow:{index:1,offset:1,count:1}},a=this.shape;a.generate(t,!1,i);let o=a.getBuffer();const s=o.length,h=new Float32Array(s*(r.length/2)),c=r.length/2;for(let e=0;e<c;e++){const n={index:e+1,offset:c>1?e/(c-1):1,count:c};this.shapeUseFollow&&(i.follow=n,a.generate(t,!1,i),o=a.getBuffer());const u=e*s,l=2*e,f=r[l],d=r[l+1];for(let t=0,e=o.length;t<e;t+=2)h[u+t]=f+o[t],h[u+t+1]=d+o[t+1]}this.shapeFollowBuffer=h}addIndex(t,e,n){if(this.shape){const i={shape:this,frameLength:t,singleRepetitionBounding:n,repetition:{type:e.type,angle:e.angle,index:e.index,count:e.count,offset:e.offset,row:{index:e.row.index,count:e.row.count,offset:e.row.offset},col:{index:e.col.index,count:e.col.count,offset:e.col.offset}},follow:{index:1,offset:1,count:1}},a=this.shape.getIndexedBuffer()||[];for(let t=0,e=a.length;t<e;t++)for(let t=0,e=this.follow.getBuffer().length/2;t<e;t++){const n=e>1?t/(e-1):1;for(let o=0,s=a.length;o<s;o++){const s={...a[o]},h={...i,follow:{index:t+1,offset:n,count:e}},c=s.parent?r.Shape.setIndexedParent(s.parent,h):h;this.indexedBuffer.push({...s,parent:c})}}}}static summmation(t,e){if(1===t)return 1;let n=1;for(let r=1;r<t;r++)n+=e**r;return n}static getEmptyRecursion(){return{index:1,offset:1,count:1,level:{index:1,offset:1,count:1}}}}e.S=i},6951:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ShapeLoop=void 0;const r=n(3792),i=n(5511),a=n(3674),o=n(2648);class s extends a.ShapePrimitive{constructor(t={},e=!1){t.type=t.type||"ShapeLoop",super(t),this.loopDependencies=(t.loopDependencies||[]).concat("sideLength"),this.props.loop=t.loop,e||(this.loop={start:0,end:r.PI2,inc:r.PI2/10,vertex:()=>[0,0]},this.bStaticLoop=this.isStaticLoop(),this.bStatic=this.isStatic(),this.bStaticIndexed=this.isStaticIndexed())}isStaticLoop(){if(this.loopDependencies.includes("propArguments"))return!1;for(let t=0,e=this.loopDependencies.length;t<e;t++)if("function"==typeof this.props[this.loopDependencies[t]])return!1;return!0}isStatic(){return this.bStaticLoop&&super.isStatic()}isStaticIndexed(){return super.isStaticIndexed()&&(void 0===this.props.loop||"function"!=typeof this.props.loop.start&&"function"!=typeof this.props.loop.end&&"function"!=typeof this.props.loop.inc)}clearBuffer(t=!1,e=!0){this.bStaticLoop=this.isStaticLoop(),t&&(this.currentOrSingleLoopBuffer=void 0),super.clearBuffer(t,e)}setProp(t,e){let n=!1;const r="string"==typeof t?{[t]:e}:t;for(let t=this.loopDependencies.length-1;t>=0;t--)if(this.loopDependencies[t]in r){n=!0;break}"loop"in r&&(r.loop={...this.props.loop,...r.loop},n=!0),super.setProp(r,e,n)}getBufferLength(t){if(this.bStatic&&void 0!==this.buffer)return this.buffer.length;if(this.bStaticLoop&&void 0!==this.currentOrSingleLoopBuffer)return this.currentOrSingleLoopBuffer.length*this.getRepetitionCount();const{count:e}=this.getLoop(t||o.ShapeBase.getEmptyPropArguments(this));return this.getRepetitionCount()*e*2}generateBuffer(t,e){return this.bStaticLoop?("function"!=typeof this.props.sideLength&&void 0!==this.currentOrSingleLoopBuffer||(this.currentOrSingleLoopBuffer=this.generateLoopBuffer(e)),this.currentOrSingleLoopBuffer):this.generateLoopBuffer(e)}generateLoopBuffer(t){const e=this.getLoop(t),{start:n,inc:r,count:a}=e,o=this.getRepetitionSideLength(t),s=this.props.loop&&this.props.loop.vertex?this.props.loop.vertex:this.loop.vertex,h={index:0,offset:0,current:0,count:a},c=h.count,u=new Float32Array(2*c);for(let i=0,a=0;i<c;i++,a+=2){const o=n+r*i,c=h.count>1?i/(h.count-1):1;h.current=o,h.index=i+1,h.offset=c;const l=s(h,t,e);u[a]=l[0],u[a+1]=l[1]}const l=[void 0,void 0,void 0,void 0],f=this.applyModifiers(u,t);for(let t=0,e=f.length;t<e;t+=2)f[t]=f[t]*o[0],f[t+1]=f[t+1]*o[1],i.Bounding.add(l,f[t],f[t+1]);return i.Bounding.bind(this.currentGenerationPrimitiveBounding,l),f}getLoop(t){var e,n,r,i,a,o;let s=null!==(n=null===(e=this.props.loop)||void 0===e?void 0:e.start)&&void 0!==n?n:this.loop.start,h=null!==(i=null===(r=this.props.loop)||void 0===r?void 0:r.end)&&void 0!==i?i:this.loop.end,c=null!==(o=null===(a=this.props.loop)||void 0===a?void 0:a.inc)&&void 0!==o?o:this.loop.inc;s="function"==typeof s?s(t):s,h="function"==typeof h?h(t):h,c="function"==typeof c?c(t):c;const u=Math.ceil((h-s)/c);return{start:s,end:h,inc:c,count:u<=0?0:u}}setShape(t){this.setProp("loop",t)}static getBuffer(t){const e=new this({...t,sideLength:(null==t?void 0:t.sideLength)||1});return e.generate(),e.getBuffer()||new Float32Array}}e.ShapeLoop=s,s.PId2=Math.PI/2},3674:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ShapePrimitive=void 0;const r=n(8721),i=n(2648),a=n(9958),o=n(5511);class s extends i.ShapeBase{constructor(t={}){var e;super(t),this.currentGenerationPrimitiveBounding=o.Bounding.empty(),this.props.sideLength=void 0===t.sideLength?void 0:"function"==typeof t.sideLength?t.sideLength:r.toVec2(t.sideLength),this.drawer=t.drawer||{},this.modifiers=t.modifiers,this.bClosed=null===(e=t.bClosed)||void 0===e||e}isStatic(){return"function"!=typeof this.props.sideLength&&super.isStatic()}getRepetitionSideLength(t){return this.bStatic?(void 0===th