@tresjs/leches 0.3.1 → 0.4.0

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,12 +1,12 @@
1
1
  /**
2
2
  * name: @tresjs/leches
3
- * version: v0.3.1
3
+ * version: v0.4.0
4
4
  * (c) 2023
5
5
  * description: Tasty GUI for Vue controls 🍰
6
6
  * author: Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)
7
7
  */
8
- (function(b,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue"),require("@vueuse/core")):typeof define=="function"&&define.amd?define(["exports","vue","@vueuse/core"],n):(b=typeof globalThis<"u"?globalThis:b||self,n(b.tresleches={},b.Vue,b.VueUseCore))})(this,function(b,n,z){"use strict";const ie="",oe="";function A(r){return n.getCurrentScope()?(n.onScopeDispose(r),!0):!1}function k(r){return typeof r=="function"?r():n.unref(r)}const T=typeof window<"u",D=()=>{},j=U();function U(){var r;return T&&((r=window==null?void 0:window.navigator)==null?void 0:r.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent)}function K(...r){if(r.length!==1)return n.toRef(...r);const t=r[0];return typeof t=="function"?n.readonly(n.customRef(()=>({get:t,set:D}))):n.ref(t)}function G(r){var t;const e=k(r);return(t=e==null?void 0:e.$el)!=null?t:e}const J=T?window:void 0;function O(...r){let t,e,s,i;if(typeof r[0]=="string"||Array.isArray(r[0])?([e,s,i]=r,t=J):[t,e,s,i]=r,!t)return D;Array.isArray(e)||(e=[e]),Array.isArray(s)||(s=[s]);const o=[],h=()=>{o.forEach(l=>l()),o.length=0},c=(l,a,_,u)=>(l.addEventListener(a,_,u),()=>l.removeEventListener(a,_,u)),d=n.watch(()=>[G(t),k(i)],([l,a])=>{h(),l&&o.push(...e.flatMap(_=>s.map(u=>c(l,_,u,a))))},{immediate:!0,flush:"post"}),y=()=>{d(),h()};return A(y),y}var v=Object.defineProperty,tt=Object.defineProperties,et=Object.getOwnPropertyDescriptors,q=Object.getOwnPropertySymbols,st=Object.prototype.hasOwnProperty,nt=Object.prototype.propertyIsEnumerable,P=(r,t,e)=>t in r?v(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,it=(r,t)=>{for(var e in t||(t={}))st.call(t,e)&&P(r,e,t[e]);if(q)for(var e of q(t))nt.call(t,e)&&P(r,e,t[e]);return r},ot=(r,t)=>tt(r,et(t));const rt=n.defineComponent({name:"UseDraggable",props:["storageKey","storageType","initialValue","exact","preventDefault","stopPropagation","pointerTypes","as","handle","axis","onStart","onMove","onEnd"],setup(r,{slots:t}){const e=n.ref(),s=n.computed(()=>{var d;return(d=r.handle)!=null?d:e.value}),i=r.storageKey&&z.useStorage(r.storageKey,k(r.initialValue)||{x:0,y:0},z.isClient?r.storageType==="session"?sessionStorage:localStorage:void 0),o=i||r.initialValue||{x:0,y:0},h=(d,y)=>{var l;(l=r.onEnd)==null||l.call(r,d,y),i&&(i.value.x=d.x,i.value.y=d.y)},c=n.reactive(z.useDraggable(e,ot(it({},r),{handle:s,initialValue:o,onEnd:h})));return()=>{if(t.default)return n.h(r.as||"div",{ref:e,style:`touch-action:none;${c.style}`},t.default(c))}}});function L(r){const t=window.getComputedStyle(r);if(t.overflowX==="scroll"||t.overflowY==="scroll"||t.overflowX==="auto"&&r.clientWidth<r.scrollWidth||t.overflowY==="auto"&&r.clientHeight<r.scrollHeight)return!0;{const e=r.parentNode;return!e||e.tagName==="BODY"?!1:L(e)}}function at(r){const t=r||window.event,e=t.target;return L(e)?!1:t.touches.length>1?!0:(t.preventDefault&&t.preventDefault(),!1)}function lt(r,t=!1){const e=n.ref(t);let s=null,i;n.watch(K(r),c=>{if(c){const d=c;i=d.style.overflow,e.value&&(d.style.overflow="hidden")}},{immediate:!0});const o=()=>{const c=k(r);!c||e.value||(j&&(s=O(c,"touchmove",d=>{at(d)},{passive:!1})),c.style.overflow="hidden",e.value=!0)},h=()=>{const c=k(r);!c||!e.value||(j&&(s==null||s()),c.style.overflow=i,e.value=!1)};return A(h),n.computed({get(){return e.value},set(c){c?o():h()}})}function ht(){let r=!1;const t=n.ref(!1);return(e,s)=>{if(t.value=s.value,r)return;r=!0;const i=lt(e,s.value);n.watch(t,o=>i.value=o)}}ht();/**
8
+ (function(b,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue"),require("@vueuse/core")):typeof define=="function"&&define.amd?define(["exports","vue","@vueuse/core"],n):(b=typeof globalThis<"u"?globalThis:b||self,n(b.tresleches={},b.Vue,b.VueUseCore))})(this,function(b,n,z){"use strict";const ce="";function I(r){return n.getCurrentScope()?(n.onScopeDispose(r),!0):!1}function C(r){return typeof r=="function"?r():n.unref(r)}const A=typeof window<"u",D=()=>{},j=U();function U(){var r;return A&&((r=window==null?void 0:window.navigator)==null?void 0:r.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent)}function K(...r){if(r.length!==1)return n.toRef(...r);const t=r[0];return typeof t=="function"?n.readonly(n.customRef(()=>({get:t,set:D}))):n.ref(t)}function G(r){var t;const e=C(r);return(t=e==null?void 0:e.$el)!=null?t:e}const J=A?window:void 0;function O(...r){let t,e,s,i;if(typeof r[0]=="string"||Array.isArray(r[0])?([e,s,i]=r,t=J):[t,e,s,i]=r,!t)return D;Array.isArray(e)||(e=[e]),Array.isArray(s)||(s=[s]);const o=[],h=()=>{o.forEach(a=>a()),o.length=0},c=(a,l,_,u)=>(a.addEventListener(l,_,u),()=>a.removeEventListener(l,_,u)),p=n.watch(()=>[G(t),C(i)],([a,l])=>{h(),a&&o.push(...e.flatMap(_=>s.map(u=>c(a,_,u,l))))},{immediate:!0,flush:"post"}),y=()=>{p(),h()};return I(y),y}var v=Object.defineProperty,tt=Object.defineProperties,et=Object.getOwnPropertyDescriptors,q=Object.getOwnPropertySymbols,st=Object.prototype.hasOwnProperty,nt=Object.prototype.propertyIsEnumerable,P=(r,t,e)=>t in r?v(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,it=(r,t)=>{for(var e in t||(t={}))st.call(t,e)&&P(r,e,t[e]);if(q)for(var e of q(t))nt.call(t,e)&&P(r,e,t[e]);return r},ot=(r,t)=>tt(r,et(t));const rt=n.defineComponent({name:"UseDraggable",props:["storageKey","storageType","initialValue","exact","preventDefault","stopPropagation","pointerTypes","as","handle","axis","onStart","onMove","onEnd"],setup(r,{slots:t}){const e=n.ref(),s=n.computed(()=>{var p;return(p=r.handle)!=null?p:e.value}),i=r.storageKey&&z.useStorage(r.storageKey,C(r.initialValue)||{x:0,y:0},z.isClient?r.storageType==="session"?sessionStorage:localStorage:void 0),o=i||r.initialValue||{x:0,y:0},h=(p,y)=>{var a;(a=r.onEnd)==null||a.call(r,p,y),i&&(i.value.x=p.x,i.value.y=p.y)},c=n.reactive(z.useDraggable(e,ot(it({},r),{handle:s,initialValue:o,onEnd:h})));return()=>{if(t.default)return n.h(r.as||"div",{ref:e,style:`touch-action:none;${c.style}`},t.default(c))}}});function L(r){const t=window.getComputedStyle(r);if(t.overflowX==="scroll"||t.overflowY==="scroll"||t.overflowX==="auto"&&r.clientWidth<r.scrollWidth||t.overflowY==="auto"&&r.clientHeight<r.scrollHeight)return!0;{const e=r.parentNode;return!e||e.tagName==="BODY"?!1:L(e)}}function lt(r){const t=r||window.event,e=t.target;return L(e)?!1:t.touches.length>1?!0:(t.preventDefault&&t.preventDefault(),!1)}function at(r,t=!1){const e=n.ref(t);let s=null,i;n.watch(K(r),c=>{if(c){const p=c;i=p.style.overflow,e.value&&(p.style.overflow="hidden")}},{immediate:!0});const o=()=>{const c=C(r);!c||e.value||(j&&(s=O(c,"touchmove",p=>{lt(p)},{passive:!1})),c.style.overflow="hidden",e.value=!0)},h=()=>{const c=C(r);!c||!e.value||(j&&(s==null||s()),c.style.overflow=i,e.value=!1)};return I(h),n.computed({get(){return e.value},set(c){c?o():h()}})}function ht(){let r=!1;const t=n.ref(!1);return(e,s)=>{if(t.value=s.value,r)return;r=!0;const i=at(e,s.value);n.watch(t,o=>i.value=o)}}ht();/**
9
9
  * @license
10
10
  * Copyright 2010-2023 Three.js Authors
11
11
  * SPDX-License-Identifier: MIT
12
- */const F="153";function V(r,t,e){return Math.max(t,Math.min(e,r))}class B{constructor(t=0,e=0){B.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,s=this.y,i=t.elements;return this.x=i[0]*e+i[3]*s+i[6],this.y=i[1]*e+i[4]*s+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Math.max(t,Math.min(e,s)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const s=this.dot(t)/e;return Math.acos(V(s,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,s=this.y-t.y;return e*e+s*s}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,s){return this.x=t.x+(e.x-t.x)*s,this.y=t.y+(e.y-t.y)*s,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const s=Math.cos(e),i=Math.sin(e),o=this.x-t.x,h=this.y-t.y;return this.x=o*s-h*i+t.x,this.y=o*i+h*s+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class ct{constructor(t=0,e=0,s=0,i=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=s,this._w=i}static slerpFlat(t,e,s,i,o,h,c){let d=s[i+0],y=s[i+1],l=s[i+2],a=s[i+3];const _=o[h+0],u=o[h+1],p=o[h+2],m=o[h+3];if(c===0){t[e+0]=d,t[e+1]=y,t[e+2]=l,t[e+3]=a;return}if(c===1){t[e+0]=_,t[e+1]=u,t[e+2]=p,t[e+3]=m;return}if(a!==m||d!==_||y!==u||l!==p){let f=1-c;const x=d*_+y*u+l*p+a*m,g=x>=0?1:-1,W=1-x*x;if(W>Number.EPSILON){const w=Math.sqrt(W),Z=Math.atan2(w,x*g);f=Math.sin(f*Z)/w,c=Math.sin(c*Z)/w}const E=c*g;if(d=d*f+_*E,y=y*f+u*E,l=l*f+p*E,a=a*f+m*E,f===1-c){const w=1/Math.sqrt(d*d+y*y+l*l+a*a);d*=w,y*=w,l*=w,a*=w}}t[e]=d,t[e+1]=y,t[e+2]=l,t[e+3]=a}static multiplyQuaternionsFlat(t,e,s,i,o,h){const c=s[i],d=s[i+1],y=s[i+2],l=s[i+3],a=o[h],_=o[h+1],u=o[h+2],p=o[h+3];return t[e]=c*p+l*a+d*u-y*_,t[e+1]=d*p+l*_+y*a-c*u,t[e+2]=y*p+l*u+c*_-d*a,t[e+3]=l*p-c*a-d*_-y*u,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,s,i){return this._x=t,this._y=e,this._z=s,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){const s=t._x,i=t._y,o=t._z,h=t._order,c=Math.cos,d=Math.sin,y=c(s/2),l=c(i/2),a=c(o/2),_=d(s/2),u=d(i/2),p=d(o/2);switch(h){case"XYZ":this._x=_*l*a+y*u*p,this._y=y*u*a-_*l*p,this._z=y*l*p+_*u*a,this._w=y*l*a-_*u*p;break;case"YXZ":this._x=_*l*a+y*u*p,this._y=y*u*a-_*l*p,this._z=y*l*p-_*u*a,this._w=y*l*a+_*u*p;break;case"ZXY":this._x=_*l*a-y*u*p,this._y=y*u*a+_*l*p,this._z=y*l*p+_*u*a,this._w=y*l*a-_*u*p;break;case"ZYX":this._x=_*l*a-y*u*p,this._y=y*u*a+_*l*p,this._z=y*l*p-_*u*a,this._w=y*l*a+_*u*p;break;case"YZX":this._x=_*l*a+y*u*p,this._y=y*u*a+_*l*p,this._z=y*l*p-_*u*a,this._w=y*l*a-_*u*p;break;case"XZY":this._x=_*l*a-y*u*p,this._y=y*u*a-_*l*p,this._z=y*l*p+_*u*a,this._w=y*l*a+_*u*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+h)}return e!==!1&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const s=e/2,i=Math.sin(s);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(s),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,s=e[0],i=e[4],o=e[8],h=e[1],c=e[5],d=e[9],y=e[2],l=e[6],a=e[10],_=s+c+a;if(_>0){const u=.5/Math.sqrt(_+1);this._w=.25/u,this._x=(l-d)*u,this._y=(o-y)*u,this._z=(h-i)*u}else if(s>c&&s>a){const u=2*Math.sqrt(1+s-c-a);this._w=(l-d)/u,this._x=.25*u,this._y=(i+h)/u,this._z=(o+y)/u}else if(c>a){const u=2*Math.sqrt(1+c-s-a);this._w=(o-y)/u,this._x=(i+h)/u,this._y=.25*u,this._z=(d+l)/u}else{const u=2*Math.sqrt(1+a-s-c);this._w=(h-i)/u,this._x=(o+y)/u,this._y=(d+l)/u,this._z=.25*u}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let s=t.dot(e)+1;return s<Number.EPSILON?(s=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=s):(this._x=0,this._y=-t.z,this._z=t.y,this._w=s)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=s),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(V(this.dot(t),-1,1)))}rotateTowards(t,e){const s=this.angleTo(t);if(s===0)return this;const i=Math.min(1,e/s);return this.slerp(t,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const s=t._x,i=t._y,o=t._z,h=t._w,c=e._x,d=e._y,y=e._z,l=e._w;return this._x=s*l+h*c+i*y-o*d,this._y=i*l+h*d+o*c-s*y,this._z=o*l+h*y+s*d-i*c,this._w=h*l-s*c-i*d-o*y,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);const s=this._x,i=this._y,o=this._z,h=this._w;let c=h*t._w+s*t._x+i*t._y+o*t._z;if(c<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,c=-c):this.copy(t),c>=1)return this._w=h,this._x=s,this._y=i,this._z=o,this;const d=1-c*c;if(d<=Number.EPSILON){const u=1-e;return this._w=u*h+e*this._w,this._x=u*s+e*this._x,this._y=u*i+e*this._y,this._z=u*o+e*this._z,this.normalize(),this._onChangeCallback(),this}const y=Math.sqrt(d),l=Math.atan2(y,c),a=Math.sin((1-e)*l)/y,_=Math.sin(e*l)/y;return this._w=h*a+this._w*_,this._x=s*a+this._x*_,this._y=i*a+this._y*_,this._z=o*a+this._z*_,this._onChangeCallback(),this}slerpQuaternions(t,e,s){return this.copy(t).slerp(e,s)}random(){const t=Math.random(),e=Math.sqrt(1-t),s=Math.sqrt(t),i=2*Math.PI*Math.random(),o=2*Math.PI*Math.random();return this.set(e*Math.cos(i),s*Math.sin(o),s*Math.cos(o),e*Math.sin(i))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class M{constructor(t=0,e=0,s=0){M.prototype.isVector3=!0,this.x=t,this.y=e,this.z=s}set(t,e,s){return s===void 0&&(s=this.z),this.x=t,this.y=e,this.z=s,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(R.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(R.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,s=this.y,i=this.z,o=t.elements;return this.x=o[0]*e+o[3]*s+o[6]*i,this.y=o[1]*e+o[4]*s+o[7]*i,this.z=o[2]*e+o[5]*s+o[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,s=this.y,i=this.z,o=t.elements,h=1/(o[3]*e+o[7]*s+o[11]*i+o[15]);return this.x=(o[0]*e+o[4]*s+o[8]*i+o[12])*h,this.y=(o[1]*e+o[5]*s+o[9]*i+o[13])*h,this.z=(o[2]*e+o[6]*s+o[10]*i+o[14])*h,this}applyQuaternion(t){const e=this.x,s=this.y,i=this.z,o=t.x,h=t.y,c=t.z,d=t.w,y=d*e+h*i-c*s,l=d*s+c*e-o*i,a=d*i+o*s-h*e,_=-o*e-h*s-c*i;return this.x=y*d+_*-o+l*-c-a*-h,this.y=l*d+_*-h+a*-o-y*-c,this.z=a*d+_*-c+y*-h-l*-o,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,s=this.y,i=this.z,o=t.elements;return this.x=o[0]*e+o[4]*s+o[8]*i,this.y=o[1]*e+o[5]*s+o[9]*i,this.z=o[2]*e+o[6]*s+o[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Math.max(t,Math.min(e,s)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,s){return this.x=t.x+(e.x-t.x)*s,this.y=t.y+(e.y-t.y)*s,this.z=t.z+(e.z-t.z)*s,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const s=t.x,i=t.y,o=t.z,h=e.x,c=e.y,d=e.z;return this.x=i*d-o*c,this.y=o*h-s*d,this.z=s*c-i*h,this}projectOnVector(t){const e=t.lengthSq();if(e===0)return this.set(0,0,0);const s=t.dot(this)/e;return this.copy(t).multiplyScalar(s)}projectOnPlane(t){return $.copy(this).projectOnVector(t),this.sub($)}reflect(t){return this.sub($.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const s=this.dot(t)/e;return Math.acos(V(s,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,s=this.y-t.y,i=this.z-t.z;return e*e+s*s+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,s){const i=Math.sin(e)*t;return this.x=i*Math.sin(s),this.y=Math.cos(e)*t,this.z=i*Math.cos(s),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,s){return this.x=t*Math.sin(e),this.y=s,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),s=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=s,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=(Math.random()-.5)*2,e=Math.random()*Math.PI*2,s=Math.sqrt(1-t**2);return this.x=s*Math.cos(e),this.y=s*Math.sin(e),this.z=t,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const $=new M,R=new ct;typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:F}})),typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=F);const C=n.reactive({controls:[]});function ut(){return C}function N(r){return Object.entries(r).map(([t,e])=>{let s="string",i;const o=/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$|^0x([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;return!n.isRef(e)&&e.value||n.isRef(e)?(s=typeof e.value,i=e.value):(s=typeof e,i=e),s==="number"&&(e.step||e.max||e.min)&&(s="range"),s==="string"&&o.test(i)&&(s="color"),(i instanceof M||i instanceof M||i instanceof Array)&&(s="vector"),!n.isRef(e)&&e.value?{...e,label:e.label||t,value:e.value,type:s,visible:!0}:{label:e.label||t,value:e,type:s,visible:!0}})}function yt(){C.controls=[]}function dt(r,t,e){let s=[];if(typeof r=="string")r==="fpsgraph"?s.push({label:"fpsgraph",visible:!0,type:"fpsgraph"}):s.push({label:r,visible:!0,type:"folder",controls:N(t)});else if(typeof r=="object"&&typeof t=="string")s.push({...e,label:t,visible:!0,value:r[t],type:typeof r[t],ref:r});else if(n.isReactive(r)){const i=n.toRefs(r);s=N(i)}else s=N(r);return C.controls=[...C.controls,...s],n.onUnmounted(yt),{state:C,controls:s}}const _t={class:"flex px-4 justify-between gap-4 items-center mb-2"},pt={class:"text-gray-500 w-1/3"},xt=["value","min","max","step"],mt=n.defineComponent({__name:"NumberControl",props:{label:{},control:{}},emits:["change"],setup(r,{emit:t}){const e=r;function s(l){const{target:a}=l;t("change",a.valueAsNumber)}const i=z.useMouse(),o=n.ref(0),h=n.ref(!1),c=l=>{o.value=l.clientX,h.value=!0},d=()=>{h.value=!1},y=l=>Math.floor(Math.abs(l)/10);return n.watch(i.x,l=>{if(h.value){const a=l-o.value,_=y(a);a>0?t("change",e.control.value+1+_):a<0&&t("change",e.control.value-1+_),e.control.min!==void 0&&e.control.value<e.control.min&&t("change",e.control.min),e.control.max!==void 0&&e.control.value>e.control.max&&t("change",e.control.max),o.value=l}}),(l,a)=>(n.openBlock(),n.createElementBlock("div",_t,[n.createElementVNode("label",pt,n.toDisplayString(l.label),1),n.createElementVNode("input",{value:l.control.value,class:n.normalizeClass(["p-2 w-1/3 rounded text-right text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans",{"cursor-ew-resize":h.value}]),type:"number",min:l.control.min,max:l.control.max,step:l.control.step,onInput:s,onMousedown:c,onMouseup:d},null,42,xt)]))}}),ft={class:"flex px-4 justify-between gap-4 items-center mb-2 min-h-32px"},gt={class:"text-gray-500 w-1/3"},bt=["value"],zt=n.defineComponent({__name:"TextControl",props:{label:{},control:{}},emits:["change"],setup(r,{emit:t}){function e(s){t("change",s)}return(s,i)=>(n.openBlock(),n.createElementBlock("div",ft,[n.createElementVNode("label",gt,n.toDisplayString(s.label),1),n.createElementVNode("input",{value:s.control.value,type:"string",class:"p-2 w-2/3 rounded text-right text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans",onChange:e},null,40,bt)]))}}),wt={class:"flex px-4 justify-start gap-2 items-center mb-2 min-h-32px"},Mt={class:"text-gray-500 w-1/3"},kt=["id","checked"],Ct=["for"],St={class:"i-ic:baseline-check text-light"},Et=n.defineComponent({__name:"BooleanControl",props:{label:{},control:{}},emits:["change"],setup(r,{emit:t}){function e(s){const{target:i}=s;t("change",i.checked)}return(s,i)=>(n.openBlock(),n.createElementBlock("div",wt,[n.createElementVNode("label",Mt,n.toDisplayString(s.label),1),n.createElementVNode("input",{id:s.control.label,checked:s.control.value,class:"hidden",type:"checkbox",onInput:e},null,40,kt),n.createElementVNode("label",{for:s.control.label,class:"inline-flex items-center cursor-pointer"},[n.createElementVNode("span",{class:n.normalizeClass([{"bg-dark-500":s.control.value,"bg-gray-200":!s.control.value},"w-4 h-4 flex justify-center items-center rounded border border-gray-300 mr-2 transition-colors duration-200"])},[n.withDirectives(n.createElementVNode("i",St,null,512),[[n.vShow,s.control.value]])],2)],8,Ct)]))}}),Vt={class:"px-4 relative flex justify-between gap-4 items-center mb-2"},Bt=["value","min","max","step"],$t=["value","min","max","step"],Nt=n.defineComponent({__name:"SliderControl",props:{label:{},control:{}},emits:["change"],setup(r,{emit:t}){const e=r;function s(a){const{target:_}=a;t("change",_.valueAsNumber)}const i=n.computed(()=>({backgroundImage:`linear-gradient(to right, #333 0% ${100*(e.control.value-(e.control.min||0))/((e.control.max||100)-(e.control.min||0))}%, #e2e2e2 0%)`})),o=z.useMouse(),h=n.ref(0),c=n.ref(!1),d=a=>{h.value=a.clientX,c.value=!0},y=()=>{c.value=!1},l=a=>Math.floor(Math.abs(a)/10);return n.watch(o.x,a=>{if(c.value){const _=a-h.value,u=l(_);_>0?t("change",e.control.value+1+u):_<0&&t("change",e.control.value-1+u),e.control.min!==void 0&&e.control.value<e.control.min&&t("change",e.control.min),e.control.max!==void 0&&e.control.value>e.control.max&&t("change",e.control.max),h.value=a}}),(a,_)=>(n.openBlock(),n.createElementBlock("div",Vt,[n.createElementVNode("label",{class:n.normalizeClass(["text-gray-500 w-1/3",{"flex justify-between items-center":a.control.icon}])},[n.createTextVNode(n.toDisplayString(a.label)+" ",1),n.createElementVNode("i",{class:n.normalizeClass(`i-${a.control.icon}`)},null,2)],2),n.createElementVNode("input",{value:a.control.value,class:"w-1/2 h-0.75 bg-dark-200 rounded-full appearance-none",style:n.normalizeStyle(i.value),type:"range",min:a.control.min,max:a.control.max,step:a.control.step,onInput:s},null,44,Bt),n.createElementVNode("input",{value:a.control.value,class:n.normalizeClass(["p-2 w-1/4 rounded text-right text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans",{"cursor-ew-resize":c.value}]),type:"number",min:a.control.min,max:a.control.max,step:a.control.step,onInput:s,onMousedown:d,onMouseup:y},null,42,$t)]))}}),re="",It=((r,t)=>{const e=r.__vccOpts||r;for(const[s,i]of t)e[s]=i;return e})(Nt,[["__scopeId","data-v-743fd350"]]),At={class:"flex px-4 justify-between gap-4 items-center mb-2"},Tt={class:"text-gray-500 w-1/3"},Dt=["value"],jt=["value"],qt=n.defineComponent({__name:"ColorControl",props:{label:{},control:{}},emits:["change"],setup(r,{emit:t}){function e(s){const{target:i}=s;t("change",i.value)}return(s,i)=>(n.openBlock(),n.createElementBlock("div",At,[n.createElementVNode("label",Tt,n.toDisplayString(s.label),1),n.createElementVNode("input",{value:s.control.value,type:"color",onInput:e},null,40,Dt),n.createElementVNode("input",{value:s.control.value,class:"p-2 w-2/3 rounded text-right text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans",type:"text",onInput:e},null,40,jt)]))}}),le="";function Pt(r){return typeof r=="number"?[r,r,r]:r instanceof M?[r.x,r.y,r.z]:r}const Lt={class:"flex px-4 justify-between gap-2 items-center mb-2"},Ft={class:"text-gray-500 w-1/3"},Rt={class:"w-2/3 flex justify-between gap-1"},Xt={key:0,class:"font-bold px-0.5 py-1 text-0.65rem text-gray-300"},Yt=["value","onInput","onMousedown","onMouseup"],Ht=n.defineComponent({__name:"VectorControl",props:{label:{},control:{}},emits:["change"],setup(r,{emit:t}){const e=r,s=z.useMouse(),i=n.ref(0),o=n.ref(!1),h=n.ref(0),c=(p,m)=>{h.value=m,i.value=p.clientX,o.value=!0},d=(p,m)=>{h.value=m,o.value=!1},y=p=>Math.floor(Math.abs(p)/10),l=n.computed(()=>Pt(e.control.value)),a=n.computed(()=>Object.keys(e.control.value)),_=n.computed(()=>e.control.value instanceof B||e.control.value instanceof M);function u(p,m){const{value:f}=e.control,{target:x}=p;h.value=m,f[_.value?a.value[h.value]:h.value]=parseInt(x.value,10),t("change",f)}return n.watch(s.x,p=>{if(o.value){const m=p-i.value,f=y(m),{value:x}=e.control,g=_.value?a.value[h.value]:h.value;m>0?x[g]+=1+f:m<0&&(x[g]-=1+f),e.control.min!==void 0&&x<e.control.min&&(x[g]=e.control.min),e.control.max!==void 0&&x>e.control.max&&(x[g]=e.control.max),t("change",x),i.value=p}}),(p,m)=>(n.openBlock(),n.createElementBlock("div",Lt,[n.createElementVNode("label",Ft,n.toDisplayString(p.label),1),n.createElementVNode("div",Rt,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,(f,x)=>(n.openBlock(),n.createElementBlock("div",{key:p.label+x,class:"flex items-center w-1/3 bg-gray-100 rounded"},[a.value[x]&&_.value?(n.openBlock(),n.createElementBlock("span",Xt,n.toDisplayString(a.value[x]),1)):n.createCommentVNode("",!0),n.createElementVNode("input",{type:"text",class:n.normalizeClass(["w-full pl-0 p-1 text-right text-0.65rem text-gray-400 bg-transparent focus:border-gray-200 outline-none border-none font-sans",{"cursor-ew-resize":o.value}]),value:l.value[x].toFixed(2),onInput:g=>u(g,x),onMousedown:g=>c(g,x),onMouseup:g=>d(g,x)},null,42,Yt)]))),128))])]))}}),Qt={class:"mb-4"},Wt={class:"bg-white rounded-b pt-4"},Zt=n.defineComponent({__name:"Folder",props:{control:{}},setup(r){function t(i,o){o.value=i}const e=n.ref(!1),s=()=>{e.value=!e.value};return(i,o)=>(n.openBlock(),n.createElementBlock("div",Qt,[n.createElementVNode("button",{class:"flex items-center justify-between w-full p-4 bg-gray-100 border-none text-gray-400 font-bold text-xs focus:outline-none font-sans cursor-pointer",onClick:s},[n.createElementVNode("span",null,n.toDisplayString(i.control.label),1),n.createElementVNode("i",{class:n.normalizeClass(e.value?"i-ic:baseline-keyboard-arrow-up":"i-ic:baseline-keyboard-arrow-down")},null,2)]),n.createVNode(n.Transition,{name:"slide","enter-active-class":" animate-fade-in animate-duration-200 animate-ease-in-out","leave-active-class":" animate-fade-out animate-duration-200 animate-ease-in-out"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("div",Wt,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.control.controls,h=>(n.openBlock(),n.createBlock(Q,{key:h.label,control:h,onChange:c=>t(c,h)},null,8,["control","onChange"]))),128))],512),[[n.vShow,e.value]])]),_:1})]))}}),Ut={class:"flex px-4 justify-between gap-4 items-center mb-2"},Kt={class:"text-gray-500 w-1/3"},Gt={class:"relative w-2/3 p-1 rounded text-right text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans"},Jt={class:"absolute bottom-0.5 right-0.5 font-sans text-xs"},Ot=["points"],X=160,I=40,S=2,Y=100,H=20,vt=n.defineComponent({__name:"FPSGraph",props:{label:{},control:{}},setup(r){const t=z.useFps({every:Y}),e=n.ref(""),s=n.ref([]),i=n.ref(X/S);let o=performance.now();return z.useRafFn(({timestamp:h})=>{h-o>=Y&&(o=h,s.value.push(t.value),s.value.length>i.value&&s.value.shift(),e.value=s.value.map((c,d)=>`${d*S},${I+H-S/2-c*(I+H-S)/120}`).join(" "))}),(h,c)=>(n.openBlock(),n.createElementBlock("div",Ut,[n.createElementVNode("label",Kt,n.toDisplayString(h.label),1),n.createElementVNode("div",Gt,[n.createElementVNode("div",Jt,n.toDisplayString(Math.round(n.unref(t)))+" FPS",1),(n.openBlock(),n.createElementBlock("svg",{width:X,height:I,xmlns:"http://www.w3.org/2000/svg",class:"bg-gray-100"},[n.createElementVNode("polyline",{points:e.value,fill:"none",stroke:"lightgray","stroke-width":S,"stroke-linecap":"round","stroke-linejoin":"round"},null,8,Ot)]))])]))}}),Q=n.defineComponent({__name:"ControlInput",props:{control:{}},emits:["change"],setup(r,{emit:t}){function e(s){t("change",s)}return(s,i)=>s.control.visible?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[s.control.type==="color"?(n.openBlock(),n.createBlock(qt,{key:0,label:s.control.label,control:s.control,onChange:e},null,8,["label","control"])):s.control.type==="vector"?(n.openBlock(),n.createBlock(Ht,{key:1,label:s.control.label,control:s.control,onChange:e},null,8,["label","control"])):s.control.type==="boolean"?(n.openBlock(),n.createBlock(Et,{key:2,label:s.control.label,control:s.control,onChange:e},null,8,["label","control"])):s.control.type==="fpsgraph"?(n.openBlock(),n.createBlock(vt,{key:3,label:s.control.label,control:s.control},null,8,["label","control"])):s.control.type==="folder"?(n.openBlock(),n.createBlock(Zt,{key:4,label:s.control.label,control:s.control},null,8,["label","control"])):s.control.type==="number"?(n.openBlock(),n.createBlock(mt,{key:5,label:s.control.label,control:s.control,onChange:e},null,8,["label","control"])):s.control.type==="range"?(n.openBlock(),n.createBlock(It,{key:6,label:s.control.label,control:s.control,onChange:e},null,8,["label","control"])):(n.openBlock(),n.createBlock(zt,{key:7,label:s.control.label,control:s.control,onChange:e},null,8,["label","control"]))],64)):n.createCommentVNode("",!0)}}),te={class:"bg-white shadow-xl rounded border-4 border-solid border-black"},ee=[n.createElementVNode("i",{class:"h-4 w-4 p-1.5 flex items-center line-height-0 rounded-full bg-gray-100 text-xs"},"🍰",-1),n.createElementVNode("div",null,[n.createElementVNode("i",{class:"i-ic-baseline-drag-indicator"}),n.createElementVNode("i",{class:"i-ic-baseline-drag-indicator"}),n.createElementVNode("i",{class:"i-ic-baseline-drag-indicator"})],-1),n.createElementVNode("div",null,null,-1)],se=280,ne=n.defineComponent({__name:"TresLeches",setup(r){const{width:t}=z.useWindowSize(),e=n.ref(null),s=ut();function i(o,h){h.ref&&(h.ref[h.label]=o),h.value=o}return(o,h)=>(n.openBlock(),n.createBlock(n.unref(rt),{"initial-value":{x:n.unref(t)-se-20,y:10},class:"fixed select-none z-24 w-280px font-sans text-xs",handle:e.value},{default:n.withCtx(()=>[n.createElementVNode("div",te,[n.createElementVNode("header",{ref_key:"handle",ref:e,class:"relative cursor-grabbing p-4 flex justify-between text-gray-200 relative"},ee,512),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(s).controls,c=>(n.openBlock(),n.createBlock(Q,{key:c.label,control:c,onChange:d=>i(d,c)},null,8,["control","onChange"]))),128))])]),_:1},8,["initial-value","handle"]))}});b.TresLeches=ne,b.useControls=dt,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})});
12
+ */const R="153";function B(r,t,e){return Math.max(t,Math.min(e,r))}class V{constructor(t=0,e=0){V.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,s=this.y,i=t.elements;return this.x=i[0]*e+i[3]*s+i[6],this.y=i[1]*e+i[4]*s+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Math.max(t,Math.min(e,s)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const s=this.dot(t)/e;return Math.acos(B(s,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,s=this.y-t.y;return e*e+s*s}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,s){return this.x=t.x+(e.x-t.x)*s,this.y=t.y+(e.y-t.y)*s,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const s=Math.cos(e),i=Math.sin(e),o=this.x-t.x,h=this.y-t.y;return this.x=o*s-h*i+t.x,this.y=o*i+h*s+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class ct{constructor(t=0,e=0,s=0,i=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=s,this._w=i}static slerpFlat(t,e,s,i,o,h,c){let p=s[i+0],y=s[i+1],a=s[i+2],l=s[i+3];const _=o[h+0],u=o[h+1],d=o[h+2],m=o[h+3];if(c===0){t[e+0]=p,t[e+1]=y,t[e+2]=a,t[e+3]=l;return}if(c===1){t[e+0]=_,t[e+1]=u,t[e+2]=d,t[e+3]=m;return}if(l!==m||p!==_||y!==u||a!==d){let f=1-c;const x=p*_+y*u+a*d+l*m,g=x>=0?1:-1,W=1-x*x;if(W>Number.EPSILON){const w=Math.sqrt(W),Z=Math.atan2(w,x*g);f=Math.sin(f*Z)/w,c=Math.sin(c*Z)/w}const E=c*g;if(p=p*f+_*E,y=y*f+u*E,a=a*f+d*E,l=l*f+m*E,f===1-c){const w=1/Math.sqrt(p*p+y*y+a*a+l*l);p*=w,y*=w,a*=w,l*=w}}t[e]=p,t[e+1]=y,t[e+2]=a,t[e+3]=l}static multiplyQuaternionsFlat(t,e,s,i,o,h){const c=s[i],p=s[i+1],y=s[i+2],a=s[i+3],l=o[h],_=o[h+1],u=o[h+2],d=o[h+3];return t[e]=c*d+a*l+p*u-y*_,t[e+1]=p*d+a*_+y*l-c*u,t[e+2]=y*d+a*u+c*_-p*l,t[e+3]=a*d-c*l-p*_-y*u,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,s,i){return this._x=t,this._y=e,this._z=s,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){const s=t._x,i=t._y,o=t._z,h=t._order,c=Math.cos,p=Math.sin,y=c(s/2),a=c(i/2),l=c(o/2),_=p(s/2),u=p(i/2),d=p(o/2);switch(h){case"XYZ":this._x=_*a*l+y*u*d,this._y=y*u*l-_*a*d,this._z=y*a*d+_*u*l,this._w=y*a*l-_*u*d;break;case"YXZ":this._x=_*a*l+y*u*d,this._y=y*u*l-_*a*d,this._z=y*a*d-_*u*l,this._w=y*a*l+_*u*d;break;case"ZXY":this._x=_*a*l-y*u*d,this._y=y*u*l+_*a*d,this._z=y*a*d+_*u*l,this._w=y*a*l-_*u*d;break;case"ZYX":this._x=_*a*l-y*u*d,this._y=y*u*l+_*a*d,this._z=y*a*d-_*u*l,this._w=y*a*l+_*u*d;break;case"YZX":this._x=_*a*l+y*u*d,this._y=y*u*l+_*a*d,this._z=y*a*d-_*u*l,this._w=y*a*l-_*u*d;break;case"XZY":this._x=_*a*l-y*u*d,this._y=y*u*l-_*a*d,this._z=y*a*d+_*u*l,this._w=y*a*l+_*u*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+h)}return e!==!1&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const s=e/2,i=Math.sin(s);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(s),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,s=e[0],i=e[4],o=e[8],h=e[1],c=e[5],p=e[9],y=e[2],a=e[6],l=e[10],_=s+c+l;if(_>0){const u=.5/Math.sqrt(_+1);this._w=.25/u,this._x=(a-p)*u,this._y=(o-y)*u,this._z=(h-i)*u}else if(s>c&&s>l){const u=2*Math.sqrt(1+s-c-l);this._w=(a-p)/u,this._x=.25*u,this._y=(i+h)/u,this._z=(o+y)/u}else if(c>l){const u=2*Math.sqrt(1+c-s-l);this._w=(o-y)/u,this._x=(i+h)/u,this._y=.25*u,this._z=(p+a)/u}else{const u=2*Math.sqrt(1+l-s-c);this._w=(h-i)/u,this._x=(o+y)/u,this._y=(p+a)/u,this._z=.25*u}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let s=t.dot(e)+1;return s<Number.EPSILON?(s=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=s):(this._x=0,this._y=-t.z,this._z=t.y,this._w=s)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=s),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(B(this.dot(t),-1,1)))}rotateTowards(t,e){const s=this.angleTo(t);if(s===0)return this;const i=Math.min(1,e/s);return this.slerp(t,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const s=t._x,i=t._y,o=t._z,h=t._w,c=e._x,p=e._y,y=e._z,a=e._w;return this._x=s*a+h*c+i*y-o*p,this._y=i*a+h*p+o*c-s*y,this._z=o*a+h*y+s*p-i*c,this._w=h*a-s*c-i*p-o*y,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);const s=this._x,i=this._y,o=this._z,h=this._w;let c=h*t._w+s*t._x+i*t._y+o*t._z;if(c<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,c=-c):this.copy(t),c>=1)return this._w=h,this._x=s,this._y=i,this._z=o,this;const p=1-c*c;if(p<=Number.EPSILON){const u=1-e;return this._w=u*h+e*this._w,this._x=u*s+e*this._x,this._y=u*i+e*this._y,this._z=u*o+e*this._z,this.normalize(),this._onChangeCallback(),this}const y=Math.sqrt(p),a=Math.atan2(y,c),l=Math.sin((1-e)*a)/y,_=Math.sin(e*a)/y;return this._w=h*l+this._w*_,this._x=s*l+this._x*_,this._y=i*l+this._y*_,this._z=o*l+this._z*_,this._onChangeCallback(),this}slerpQuaternions(t,e,s){return this.copy(t).slerp(e,s)}random(){const t=Math.random(),e=Math.sqrt(1-t),s=Math.sqrt(t),i=2*Math.PI*Math.random(),o=2*Math.PI*Math.random();return this.set(e*Math.cos(i),s*Math.sin(o),s*Math.cos(o),e*Math.sin(i))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class M{constructor(t=0,e=0,s=0){M.prototype.isVector3=!0,this.x=t,this.y=e,this.z=s}set(t,e,s){return s===void 0&&(s=this.z),this.x=t,this.y=e,this.z=s,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(X.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(X.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,s=this.y,i=this.z,o=t.elements;return this.x=o[0]*e+o[3]*s+o[6]*i,this.y=o[1]*e+o[4]*s+o[7]*i,this.z=o[2]*e+o[5]*s+o[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,s=this.y,i=this.z,o=t.elements,h=1/(o[3]*e+o[7]*s+o[11]*i+o[15]);return this.x=(o[0]*e+o[4]*s+o[8]*i+o[12])*h,this.y=(o[1]*e+o[5]*s+o[9]*i+o[13])*h,this.z=(o[2]*e+o[6]*s+o[10]*i+o[14])*h,this}applyQuaternion(t){const e=this.x,s=this.y,i=this.z,o=t.x,h=t.y,c=t.z,p=t.w,y=p*e+h*i-c*s,a=p*s+c*e-o*i,l=p*i+o*s-h*e,_=-o*e-h*s-c*i;return this.x=y*p+_*-o+a*-c-l*-h,this.y=a*p+_*-h+l*-o-y*-c,this.z=l*p+_*-c+y*-h-a*-o,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,s=this.y,i=this.z,o=t.elements;return this.x=o[0]*e+o[4]*s+o[8]*i,this.y=o[1]*e+o[5]*s+o[9]*i,this.z=o[2]*e+o[6]*s+o[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Math.max(t,Math.min(e,s)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,s){return this.x=t.x+(e.x-t.x)*s,this.y=t.y+(e.y-t.y)*s,this.z=t.z+(e.z-t.z)*s,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const s=t.x,i=t.y,o=t.z,h=e.x,c=e.y,p=e.z;return this.x=i*p-o*c,this.y=o*h-s*p,this.z=s*c-i*h,this}projectOnVector(t){const e=t.lengthSq();if(e===0)return this.set(0,0,0);const s=t.dot(this)/e;return this.copy(t).multiplyScalar(s)}projectOnPlane(t){return $.copy(this).projectOnVector(t),this.sub($)}reflect(t){return this.sub($.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const s=this.dot(t)/e;return Math.acos(B(s,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,s=this.y-t.y,i=this.z-t.z;return e*e+s*s+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,s){const i=Math.sin(e)*t;return this.x=i*Math.sin(s),this.y=Math.cos(e)*t,this.z=i*Math.cos(s),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,s){return this.x=t*Math.sin(e),this.y=s,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),s=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=s,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=(Math.random()-.5)*2,e=Math.random()*Math.PI*2,s=Math.sqrt(1-t**2);return this.x=s*Math.cos(e),this.y=s*Math.sin(e),this.z=t,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const $=new M,X=new ct;typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:R}})),typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=R);const ut=Symbol("CONTROLS_CONTEXT_KEY"),k=n.reactive({controls:[]});function yt(){return n.provide(ut,k),k}function N(r){return Object.entries(r).map(([t,e])=>{let s="string",i;const o=/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$|^0x([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;return!n.isRef(e)&&e.value||n.isRef(e)?(s=typeof e.value,i=e.value):(s=typeof e,i=e),s==="number"&&(e.step||e.max||e.min)&&(s="range"),s==="string"&&o.test(i)&&(s="color"),(i instanceof M||i instanceof M||i instanceof Array)&&(s="vector"),!n.isRef(e)&&e.value?{...e,label:e.label||t,value:e.value,type:s,visible:!0}:{label:e.label||t,value:e,type:s,visible:!0}})}function pt(){k.controls=[]}function _t(r,t,e){let s=[];if(typeof r=="string")r==="fpsgraph"?s.push({label:"fpsgraph",visible:!0,type:"fpsgraph"}):s.push({label:r,visible:!0,type:"folder",controls:N(t)});else if(typeof r=="object"&&r.options)s.push({...e,label:r.label||"Dropdown",visible:!0,value:r.value,type:"select",ref:r,options:r.options});else if(typeof r=="object"&&typeof t=="string")s.push({...e,label:t,visible:!0,value:r[t],type:typeof r[t],ref:r});else if(n.isReactive(r)){const i=n.toRefs(r);s=N(i)}else s=N(r);return k.controls=[...k.controls,...s],n.onUnmounted(pt),{state:k,controls:s}}const dt={class:"flex px-4 justify-between gap-4 items-center mb-2"},xt={class:"text-gray-500 w-1/3"},mt=["value","min","max","step"],ft=n.defineComponent({__name:"NumberControl",props:{label:{},control:{}},emits:["change"],setup(r,{emit:t}){const e=r;function s(a){const{target:l}=a;t("change",l.valueAsNumber)}const i=z.useMouse(),o=n.ref(0),h=n.ref(!1),c=a=>{o.value=a.clientX,h.value=!0},p=()=>{h.value=!1},y=a=>Math.floor(Math.abs(a)/10);return n.watch(i.x,a=>{if(h.value){const l=a-o.value,_=y(l);l>0?t("change",e.control.value+1+_):l<0&&t("change",e.control.value-1+_),e.control.min!==void 0&&e.control.value<e.control.min&&t("change",e.control.min),e.control.max!==void 0&&e.control.value>e.control.max&&t("change",e.control.max),o.value=a}}),(a,l)=>(n.openBlock(),n.createElementBlock("div",dt,[n.createElementVNode("label",xt,n.toDisplayString(a.label),1),n.createElementVNode("input",{value:a.control.value,class:n.normalizeClass(["p-2 w-1/3 rounded text-right text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans",{"cursor-ew-resize":h.value}]),type:"number",min:a.control.min,max:a.control.max,step:a.control.step,onInput:s,onMousedown:c,onMouseup:p},null,42,mt)]))}}),gt={class:"flex px-4 justify-between gap-4 items-center mb-2 min-h-32px"},bt={class:"text-gray-500 w-1/3"},zt=["value"],wt=n.defineComponent({__name:"TextControl",props:{label:{},control:{}},emits:["change"],setup(r,{emit:t}){function e(s){t("change",s)}return(s,i)=>(n.openBlock(),n.createElementBlock("div",gt,[n.createElementVNode("label",bt,n.toDisplayString(s.label),1),n.createElementVNode("input",{value:s.control.value,type:"string",class:"p-2 w-2/3 rounded text-right text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans",onChange:e},null,40,zt)]))}}),Mt={class:"flex px-4 justify-start gap-2 items-center mb-2 min-h-32px"},kt={class:"text-gray-500 w-1/3"},Ct=["id","checked"],St=["for"],Et={class:"i-ic:baseline-check text-light"},Bt=n.defineComponent({__name:"BooleanControl",props:{label:{},control:{}},emits:["change"],setup(r,{emit:t}){function e(s){const{target:i}=s;t("change",i.checked)}return(s,i)=>(n.openBlock(),n.createElementBlock("div",Mt,[n.createElementVNode("label",kt,n.toDisplayString(s.label),1),n.createElementVNode("input",{id:s.control.label,checked:s.control.value,class:"hidden",type:"checkbox",onInput:e},null,40,Ct),n.createElementVNode("label",{for:s.control.label,class:"inline-flex items-center cursor-pointer"},[n.createElementVNode("span",{class:n.normalizeClass([{"bg-dark-500":s.control.value,"bg-gray-200":!s.control.value},"w-4 h-4 flex justify-center items-center rounded border border-gray-300 mr-2 transition-colors duration-200"])},[n.withDirectives(n.createElementVNode("i",Et,null,512),[[n.vShow,s.control.value]])],2)],8,St)]))}}),Vt={class:"px-4 relative flex justify-between gap-4 items-center mb-2"},$t=["value","min","max","step"],Nt=["value","min","max","step"],Tt=n.defineComponent({__name:"SliderControl",props:{label:{},control:{}},emits:["change"],setup(r,{emit:t}){const e=r;function s(l){const{target:_}=l;t("change",_.valueAsNumber)}const i=n.computed(()=>({backgroundImage:`linear-gradient(to right, #333 0% ${100*(e.control.value-(e.control.min||0))/((e.control.max||100)-(e.control.min||0))}%, #e2e2e2 0%)`})),o=z.useMouse(),h=n.ref(0),c=n.ref(!1),p=l=>{h.value=l.clientX,c.value=!0},y=()=>{c.value=!1},a=l=>Math.floor(Math.abs(l)/10);return n.watch(o.x,l=>{if(c.value){const _=l-h.value,u=a(_);_>0?t("change",e.control.value+1+u):_<0&&t("change",e.control.value-1+u),e.control.min!==void 0&&e.control.value<e.control.min&&t("change",e.control.min),e.control.max!==void 0&&e.control.value>e.control.max&&t("change",e.control.max),h.value=l}}),(l,_)=>(n.openBlock(),n.createElementBlock("div",Vt,[n.createElementVNode("label",{class:n.normalizeClass(["text-gray-500 w-1/3",{"flex justify-between items-center":l.control.icon}])},[n.createTextVNode(n.toDisplayString(l.label)+" ",1),n.createElementVNode("i",{class:n.normalizeClass(`i-${l.control.icon}`)},null,2)],2),n.createElementVNode("input",{value:l.control.value,class:"w-1/2 h-0.75 bg-dark-200 rounded-full appearance-none",style:n.normalizeStyle(i.value),type:"range",min:l.control.min,max:l.control.max,step:l.control.step,onInput:s},null,44,$t),n.createElementVNode("input",{value:l.control.value,class:n.normalizeClass(["p-2 w-1/4 rounded text-right text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans",{"cursor-ew-resize":c.value}]),type:"number",min:l.control.min,max:l.control.max,step:l.control.step,onInput:s,onMousedown:p,onMouseup:y},null,42,Nt)]))}}),ue="",It=((r,t)=>{const e=r.__vccOpts||r;for(const[s,i]of t)e[s]=i;return e})(Tt,[["__scopeId","data-v-743fd350"]]),At={class:"flex px-4 justify-between gap-4 items-center mb-2"},Dt={class:"text-gray-500 w-1/3"},jt=["value"],qt=["value"],Pt=n.defineComponent({__name:"ColorControl",props:{label:{},control:{}},emits:["change"],setup(r,{emit:t}){function e(s){const{target:i}=s;t("change",i.value)}return(s,i)=>(n.openBlock(),n.createElementBlock("div",At,[n.createElementVNode("label",Dt,n.toDisplayString(s.label),1),n.createElementVNode("input",{value:s.control.value,type:"color",onInput:e},null,40,jt),n.createElementVNode("input",{value:s.control.value,class:"p-2 w-2/3 rounded text-right text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans",type:"text",onInput:e},null,40,qt)]))}}),pe="";function Lt(r){return typeof r=="number"?[r,r,r]:r instanceof M?[r.x,r.y,r.z]:r}const Rt={class:"flex px-4 justify-between gap-2 items-center mb-2"},Xt={class:"text-gray-500 w-1/3"},Ft={class:"w-2/3 flex justify-between gap-1"},Yt={key:0,class:"font-bold px-0.5 py-1 text-0.65rem text-gray-300"},Ht=["value","onInput","onMousedown","onMouseup"],Qt=n.defineComponent({__name:"VectorControl",props:{label:{},control:{}},emits:["change"],setup(r,{emit:t}){const e=r,s=z.useMouse(),i=n.ref(0),o=n.ref(!1),h=n.ref(0),c=(d,m)=>{h.value=m,i.value=d.clientX,o.value=!0},p=(d,m)=>{h.value=m,o.value=!1},y=d=>Math.floor(Math.abs(d)/10),a=n.computed(()=>Lt(e.control.value)),l=n.computed(()=>Object.keys(e.control.value)),_=n.computed(()=>e.control.value instanceof V||e.control.value instanceof M);function u(d,m){const{value:f}=e.control,{target:x}=d;h.value=m,f[_.value?l.value[h.value]:h.value]=parseInt(x.value,10),t("change",f)}return n.watch(s.x,d=>{if(o.value){const m=d-i.value,f=y(m),{value:x}=e.control,g=_.value?l.value[h.value]:h.value;m>0?x[g]+=1+f:m<0&&(x[g]-=1+f),e.control.min!==void 0&&x<e.control.min&&(x[g]=e.control.min),e.control.max!==void 0&&x>e.control.max&&(x[g]=e.control.max),t("change",x),i.value=d}}),(d,m)=>(n.openBlock(),n.createElementBlock("div",Rt,[n.createElementVNode("label",Xt,n.toDisplayString(d.label),1),n.createElementVNode("div",Ft,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value,(f,x)=>(n.openBlock(),n.createElementBlock("div",{key:d.label+x,class:"flex items-center w-1/3 bg-gray-100 rounded"},[l.value[x]&&_.value?(n.openBlock(),n.createElementBlock("span",Yt,n.toDisplayString(l.value[x]),1)):n.createCommentVNode("",!0),n.createElementVNode("input",{type:"text",class:n.normalizeClass(["w-full pl-0 p-1 text-right text-0.65rem text-gray-400 bg-transparent focus:border-gray-200 outline-none border-none font-sans",{"cursor-ew-resize":o.value}]),value:a.value[x].toFixed(2),onInput:g=>u(g,x),onMousedown:g=>c(g,x),onMouseup:g=>p(g,x)},null,42,Ht)]))),128))])]))}}),Wt={class:"mb-4"},Zt={class:"bg-white rounded-b pt-4"},Ut=n.defineComponent({__name:"Folder",props:{control:{}},setup(r){function t(i,o){o.value=i}const e=n.ref(!1),s=()=>{e.value=!e.value};return(i,o)=>(n.openBlock(),n.createElementBlock("div",Wt,[n.createElementVNode("button",{class:"flex items-center justify-between w-full p-4 bg-gray-100 border-none text-gray-400 font-bold text-xs focus:outline-none font-sans cursor-pointer",onClick:s},[n.createElementVNode("span",null,n.toDisplayString(i.control.label),1),n.createElementVNode("i",{class:n.normalizeClass(e.value?"i-ic:baseline-keyboard-arrow-up":"i-ic:baseline-keyboard-arrow-down")},null,2)]),n.createVNode(n.Transition,{name:"slide","enter-active-class":" animate-fade-in animate-duration-200 animate-ease-in-out","leave-active-class":" animate-fade-out animate-duration-200 animate-ease-in-out"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("div",Zt,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.control.controls,h=>(n.openBlock(),n.createBlock(Q,{key:h.label,control:h,onChange:c=>t(c,h)},null,8,["control","onChange"]))),128))],512),[[n.vShow,e.value]])]),_:1})]))}}),Kt={class:"flex px-4 justify-between gap-4 items-center mb-2"},Gt={class:"text-gray-500 w-1/3"},Jt={class:"relative w-2/3 p-1 rounded text-right text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans"},Ot={class:"absolute bottom-0.5 right-0.5 font-sans text-xs"},vt=["points"],F=160,T=40,S=2,Y=100,H=20,te=n.defineComponent({__name:"FPSGraph",props:{label:{},control:{}},setup(r){const t=z.useFps({every:Y}),e=n.ref(""),s=n.ref([]),i=n.ref(F/S);let o=performance.now();return z.useRafFn(({timestamp:h})=>{h-o>=Y&&(o=h,s.value.push(t.value),s.value.length>i.value&&s.value.shift(),e.value=s.value.map((c,p)=>`${p*S},${T+H-S/2-c*(T+H-S)/120}`).join(" "))}),(h,c)=>(n.openBlock(),n.createElementBlock("div",Kt,[n.createElementVNode("label",Gt,n.toDisplayString(h.label),1),n.createElementVNode("div",Jt,[n.createElementVNode("div",Ot,n.toDisplayString(Math.round(n.unref(t)))+" FPS",1),(n.openBlock(),n.createElementBlock("svg",{width:F,height:T,xmlns:"http://www.w3.org/2000/svg",class:"bg-gray-100"},[n.createElementVNode("polyline",{points:e.value,fill:"none",stroke:"lightgray","stroke-width":S,"stroke-linecap":"round","stroke-linejoin":"round"},null,8,vt)]))])]))}}),ee={class:"flex px-4 justify-between gap-4 items-center mb-2 min-h-32px"},se={class:"text-gray-500 w-1/3"},ne=["value"],ie=["value"],oe=n.defineComponent({__name:"SelectControl",props:{label:{},control:{}},emits:["change"],setup(r,{emit:t}){function e(s){t("change",s.target.value)}return(s,i)=>(n.openBlock(),n.createElementBlock("div",ee,[n.createElementVNode("label",se,n.toDisplayString(s.label),1),n.createElementVNode("select",{value:s.control.value,class:"p-2 w-2/3 rounded text-left text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans",onChange:e},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.control.options,o=>(n.openBlock(),n.createElementBlock("option",{key:o.value,value:o.value},n.toDisplayString(o.text),9,ie))),128))],40,ne)]))}}),Q=n.defineComponent({__name:"ControlInput",props:{control:{}},emits:["change"],setup(r,{emit:t}){function e(s){t("change",s)}return(s,i)=>s.control.visible?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[s.control.type==="color"?(n.openBlock(),n.createBlock(Pt,{key:0,label:s.control.label,control:s.control,onChange:e},null,8,["label","control"])):s.control.type==="vector"?(n.openBlock(),n.createBlock(Qt,{key:1,label:s.control.label,control:s.control,onChange:e},null,8,["label","control"])):s.control.type==="boolean"?(n.openBlock(),n.createBlock(Bt,{key:2,label:s.control.label,control:s.control,onChange:e},null,8,["label","control"])):s.control.type==="fpsgraph"?(n.openBlock(),n.createBlock(te,{key:3,label:s.control.label,control:s.control},null,8,["label","control"])):s.control.type==="folder"?(n.openBlock(),n.createBlock(Ut,{key:4,label:s.control.label,control:s.control},null,8,["label","control"])):s.control.type==="number"?(n.openBlock(),n.createBlock(ft,{key:5,label:s.control.label,control:s.control,onChange:e},null,8,["label","control"])):s.control.type==="range"?(n.openBlock(),n.createBlock(It,{key:6,label:s.control.label,control:s.control,onChange:e},null,8,["label","control"])):s.control.type==="select"?(n.openBlock(),n.createBlock(oe,{key:7,label:s.control.label,control:s.control,onChange:e},null,8,["label","control"])):(n.openBlock(),n.createBlock(wt,{key:8,label:s.control.label,control:s.control,onChange:e},null,8,["label","control"]))],64)):n.createCommentVNode("",!0)}}),re={class:"bg-white shadow-xl rounded border-4 border-solid border-black"},le=[n.createElementVNode("i",{class:"h-4 w-4 p-1.5 flex items-center line-height-0 rounded-full bg-gray-100 text-xs"},"🍰",-1),n.createElementVNode("div",null,[n.createElementVNode("i",{class:"i-ic-baseline-drag-indicator"}),n.createElementVNode("i",{class:"i-ic-baseline-drag-indicator"}),n.createElementVNode("i",{class:"i-ic-baseline-drag-indicator"})],-1),n.createElementVNode("div",null,null,-1)],ae=280,he=n.defineComponent({__name:"TresLeches",setup(r){const{width:t}=z.useWindowSize(),e=n.ref(null),s=yt();function i(o,h){h.ref&&(h.ref[h.label]=o),h.value=o}return(o,h)=>(n.openBlock(),n.createBlock(n.unref(rt),{"initial-value":{x:n.unref(t)-ae-20,y:10},class:"fixed select-none z-24 w-280px font-sans text-xs",handle:e.value},{default:n.withCtx(()=>[n.createElementVNode("div",re,[n.createElementVNode("header",{ref_key:"handle",ref:e,class:"relative cursor-grabbing p-4 flex justify-between text-gray-200 relative"},le,512),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(s).controls,c=>(n.openBlock(),n.createBlock(Q,{key:c.label,control:c,onChange:p=>i(p,c)},null,8,["control","onChange"]))),128))])]),_:1},8,["initial-value","handle"]))}});b.TresLeches=he,b.useControls=_t,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tresjs/leches",
3
3
  "description": "Tasty GUI for Vue controls 🍰",
4
- "version": "0.3.1",
4
+ "version": "0.4.0",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@8.3.1",
7
7
  "author": "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)",
@@ -46,39 +46,44 @@
46
46
  "story:build": "histoire build",
47
47
  "story:preview": "histoire preview"
48
48
  },
49
+ "peerDependencies": {
50
+ "three": ">=0.133",
51
+ "vue": ">=3.3"
52
+ },
49
53
  "dependencies": {
50
- "@types/three": "^0.152.1",
51
- "@vueuse/components": "^10.2.0",
52
- "three": "^0.153.0",
53
- "vue": "^3.3.4"
54
+ "@vueuse/components": "^10.2.0"
54
55
  },
55
56
  "devDependencies": {
56
- "@vueuse/shared": "^10.2.0",
57
- "kolorist": "^1.8.0",
58
- "pathe": "^1.1.1",
59
- "rollup-plugin-analyzer": "^4.0.0",
60
- "rollup-plugin-visualizer": "^5.9.2",
61
- "vite-plugin-banner": "^0.7.0",
62
- "vite-plugin-dts": "^2.3.0",
63
57
  "@alvarosabu/prettier-config": "^1.3.0",
64
58
  "@histoire/plugin-vue": "^0.16.1",
65
59
  "@iconify-json/ic": "^1.1.13",
66
60
  "@release-it/conventional-changelog": "^5.1.1",
61
+ "@types/three": "^0.152.1",
67
62
  "@typescript-eslint/eslint-plugin": "^5.60.0",
63
+ "@typescript-eslint/parser": "^5.61.0",
68
64
  "@vitejs/plugin-vue": "^4.2.3",
69
65
  "@vitest/ui": "^0.32.2",
70
66
  "@vueuse/core": "^10.2.0",
67
+ "@vueuse/shared": "^10.2.0",
71
68
  "eslint": "^8.43.0",
72
69
  "eslint-config-prettier": "^8.8.0",
73
70
  "eslint-plugin-vitest-globals": "^1.3.1",
74
71
  "eslint-plugin-vue": "^9.15.0",
75
72
  "histoire": "^0.16.2",
73
+ "kolorist": "^1.8.0",
74
+ "pathe": "^1.1.1",
76
75
  "prettier": "^2.8.8",
77
76
  "release-it": "^15.11.0",
77
+ "rollup-plugin-analyzer": "^4.0.0",
78
+ "rollup-plugin-visualizer": "^5.9.2",
79
+ "three": "^0.153.0",
78
80
  "typescript": "^5.1.3",
79
81
  "unocss": "^0.53.1",
80
82
  "vite": "^4.3.9",
83
+ "vite-plugin-banner": "^0.7.0",
84
+ "vite-plugin-dts": "^2.3.0",
81
85
  "vitest": "^0.32.2",
86
+ "vue": "^3.3.4",
82
87
  "vue-tsc": "^1.8.1"
83
88
  }
84
89
  }