1import{aM as dn,Y as it,bh as pn,aP as Je,bi as qn,bj as Qn,aX as hn,S as Jn,C as _e,aZ as gt,M as _t,O as Zn,B as er,bk as tr,a$ as nr,a_ as rr,z as sr,y as ir,H as or,e as ye,V as ar,bg as cr,aL as lr,j as ur}from"./CoY7a7dj.js";import{u as q,G as S,w as K,ar as yt,ag as vn,ah as mn,o as de,v as ot,at as Ve,am as fr,au as dr,ai as Ee,l as G,W as Ne,al as at,ao as pr,k as Q,f as le,h as Ke,i as bt,a5 as hr,H as wt,aj as vr,av as jt,aw as De,F as mr,ak as gn,af as gr,y as _r,A as yr,an as Et,ax as br,x as It,U as _n,j as wr,ay as Er,C as xr,m as Sr,a9 as Tr,Q as X,O as Pr,D as Mr,aa as Oe}from"./B3GM4kGa.js";function J(t){return vn()?(mn(t),!0):!1}function W(){const t=new Set,e=s=>{t.delete(s)};return{on:s=>{t.add(s);const i=()=>e(s);return J(i),{off:i}},off:e,trigger:(...s)=>Promise.all(Array.from(t).map(i=>i(...s)))}}function j(t){return typeof t=="function"?t():q(t)}const ct=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Cr=t=>t!=null,Or=Object.prototype.toString,Ar=t=>Or.call(t)==="[object Object]",lt=()=>{};function kr(t,e){function n(...r){return new Promise((s,i)=>{Promise.resolve(t(()=>e.apply(this,r),{fn:e,thisArg:this,args:r})).then(s).catch(i)})}return n}function jr(t,e={}){let n,r,s=lt;const i=c=>{clearTimeout(c),s(),s=lt};return c=>{const l=j(t),a=j(e.maxWait);return n&&i(n),l<=0||a!==void 0&&a<=0?(r&&(i(r),r=null),Promise.resolve(c())):new Promise((u,d)=>{s=e.rejectOnCancel?d:u,a&&!r&&(r=setTimeout(()=>{n&&i(n),r=null,u(c())},a)),n=setTimeout(()=>{r&&i(r),r=null,u(c())},l)})}}function Ir(t,e,n=!1){return e.reduce((r,s)=>(s in t&&(!n||t[s]!==void 0)&&(r[s]=t[s]),r),{})}function Dr(t){return Ve()}function Lr(t,e=200,n={}){return kr(jr(e,n),t)}function Dt(t,e=200,n={}){const r=S(t.value),s=Lr(()=>{r.value=t.value},e,n);return K(t,()=>s()),r}function Rr(t,e={}){if(!yt(t))return fr(t);const n=Array.isArray(t.value)?Array.from({length:t.value.length}):{};for(const r in t.value)n[r]=dr(()=>({get(){return t.value[r]},set(s){var i;if((i=j(e.replaceRef))!=null?i:!0)if(Array.isArray(t.value)){const c=[...t.value];c[r]=s,t.value=c}else{const c={...t.value,[r]:s};Object.setPrototypeOf(c,Object.getPrototypeOf(t.value)),t.value=c}else t.value[r]=s}}));return n}function xt(t,e=!0,n){Dr()?de(t,n):e?t():ot(t)}function Br(t,e=1e3,n={}){const{immediate:r=!0,immediateCallback:s=!1}=n;let i=null;const o=S(!1);function c(){i&&(clearInterval(i),i=null)}function l(){o.value=!1,c()}function a(){const u=j(e);u<=0||(o.value=!0,s&&t(),c(),o.value&&(i=setInterval(t,u)))}if(r&&ct&&a(),yt(e)||typeof e=="function"){const u=K(e,()=>{o.value&&ct&&a()});J(u)}return J(l),{isActive:o,pause:l,resume:a}}const ee=ct?window:void 0;function H(t){var e;const n=j(t);return(e=n?.$el)!=null?e:n}function xe(...t){let e,n,r,s;if(typeof t[0]=="string"||Array.isArray(t[0])?([n,r,s]=t,e=ee):[e,n,r,s]=t,!e)return lt;Array.isArray(n)||(n=[n]),Array.isArray(r)||(r=[r]);const i=[],o=()=>{i.forEach(u=>u()),i.length=0},c=(u,d,f,v)=>(u.addEventListener(d,f,v),()=>u.removeEventListener(d,f,v)),l=K(()=>[H(e),j(s)],([u,d])=>{if(o(),!u)return;const f=Ar(d)?{...d}:d;i.push(...n.flatMap(v=>r.map(m=>c(u,v,m,f))))},{immediate:!0,flush:"post"}),a=()=>{l(),o()};return J(a),a}function $r(){const t=S(!1),e=Ve();return e&&de(()=>{t.value=!0},e),t}function Ge(t){const e=$r();return G(()=>(e.value,!!t()))}function Ur(t,e,n={}){const{window:r=ee,...s}=n;let i;const o=Ge(()=>r&&"MutationObserver"in r),c=()=>{i&&(i.disconnect(),i=void 0)},l=G(()=>{const f=j(t),v=(Array.isArray(f)?f:[f]).map(H).filter(Cr);return new Set(v)}),a=K(()=>l.value,f=>{c(),o.value&&f.size&&(i=new MutationObserver(e),f.forEach(v=>i.observe(v,s)))},{immediate:!0,flush:"post"}),u=()=>i?.takeRecords(),d=()=>{a(),c()};return J(d),{isSupported:o,stop:d,takeRecords:u}}function St(t,e={}){const{immediate:n=!0,fpsLimit:r=void 0,window:s=ee}=e,i=S(!1),o=r?1e3/r:null;let c=0,l=null;function a(f){if(!i.value||!s)return;c||(c=f);const v=f-c;if(o&&v<o){l=s.requestAnimationFrame(a);return}c=f,t({delta:v,timestamp:f}),l=s.requestAnimationFrame(a)}function u(){!i.value&&s&&(i.value=!0,c=0,l=s.requestAnimationFrame(a))}function d(){i.value=!1,l!=null&&s&&(s.cancelAnimationFrame(l),l=null)}return n&&u(),J(d),{isActive:Ee(i),pause:d,resume:u}}function Vr(t,e={}){const{window:n=ee}=e,r=Ge(()=>n&&"matchMedia"in n&&typeof n.matchMedia=="function");let s;const i=S(!1),o=a=>{i.value=a.matches},c=()=>{s&&("removeEventListener"in s?s.removeEventListener("change",o):s.removeListener(o))},l=Ne(()=>{r.value&&(c(),s=n.matchMedia(j(t)),"addEventListener"in s?s.addEventListener("change",o):s.addListener(o),i.value=s.matches)});return J(()=>{l(),c(),s=void 0}),i}function Fr(t={}){const{window:e=ee}=t,n=S(1);if(e){let r=function(){n.value=e.devicePixelRatio,s(),i=e.matchMedia(`(resolution: ${n.value}dppx)`),i.addEventListener("change",r,{once:!0})},s=function(){i?.removeEventListener("change",r)},i;r(),J(s)}return{pixelRatio:n}}function yn(t,e,n={}){const{window:r=ee,...s}=n;let i;const o=Ge(()=>r&&"ResizeObserver"in r),c=()=>
1{i&&(i.disconnect(),i=void 0)},l=G(()=>{const d=j(t);return Array.isArray(d)?d.map(f=>H(f)):[H(d)]}),a=K(l,d=>{if(c(),o.value&&r){i=new ResizeObserver(e);for(const f of d)f&&i.observe(f,s)}},{immediate:!0,flush:"post"}),u=()=>{c(),a()};return J(u),{isSupported:o,stop:u}}function zr(t,e={}){const{reset:n=!0,windowResize:r=!0,windowScroll:s=!0,immediate:i=!0,updateTiming:o="sync"}=e,c=S(0),l=S(0),a=S(0),u=S(0),d=S(0),f=S(0),v=S(0),m=S(0);function p(){const T=H(t);if(!T){n&&(c.value=0,l.value=0,a.value=0,u.value=0,d.value=0,f.value=0,v.value=0,m.value=0);return}const g=T.getBoundingClientRect();c.value=g.height,l.value=g.bottom,a.value=g.left,u.value=g.right,d.value=g.top,f.value=g.width,v.value=g.x,m.value=g.y}function h(){o==="sync"?p():o==="next-frame"&&requestAnimationFrame(()=>p())}return yn(t,h),K(()=>H(t),T=>!T&&h()),Ur(t,h,{attributeFilter:["style","class"]}),s&&xe("scroll",h,{capture:!0,passive:!0}),r&&xe("resize",h,{passive:!0}),xt(()=>{i&&h()}),{height:c,bottom:l,left:a,right:u,top:d,width:f,x:v,y:m,update:h}}function Wr(t,e={width:0,height:0},n={}){const{window:r=ee,box:s="content-box"}=n,i=G(()=>{var d,f;return(f=(d=H(t))==null?void 0:d.namespaceURI)==null?void 0:f.includes("svg")}),o=S(e.width),c=S(e.height),{stop:l}=yn(t,([d])=>{const f=s==="border-box"?d.borderBoxSize:s==="content-box"?d.contentBoxSize:d.devicePixelContentBoxSize;if(r&&i.value){const v=H(t);if(v){const m=v.getBoundingClientRect();o.value=m.width,c.value=m.height}}else if(f){const v=Array.isArray(f)?f:[f];o.value=v.reduce((m,{inlineSize:p})=>m+p,0),c.value=v.reduce((m,{blockSize:p})=>m+p,0)}else o.value=d.contentRect.width,c.value=d.contentRect.height},n);xt(()=>{const d=H(t);d&&(o.value="offsetWidth"in d?d.offsetWidth:e.width,c.value="offsetHeight"in d?d.offsetHeight:e.height)});const a=K(()=>H(t),d=>{o.value=d?e.width:0,c.value=d?e.height:0});function u(){l(),a()}return{width:o,height:c,stop:u}}function Nr(t){var e;const n=S(0);if(typeof performance>"u")return n;const r=(e=t?.every)!=null?e:10;let s=performance.now(),i=0;return St(()=>{if(i+=1,i>=r){const o=performance.now(),c=o-s;n.value=Math.round(1e3/(c/i)),s=o,i=0}}),n}function Kr(t={}){const e=S(),n=Ge(()=>typeof performance<"u"&&"memory"in performance);if(n.value){const{interval:r=1e3}=t;Br(()=>{e.value=performance.memory},r,{immediate:t.immediate,immediateCallback:t.immediateCallback})}return{isSupported:n,memory:e}}const bn={x:0,y:0,pointerId:0,pressure:0,tiltX:0,tiltY:0,width:0,height:0,twist:0,pointerType:null},Gr=Object.keys(bn);function Yr(t={}){const{target:e=ee}=t,n=S(!1),r=S(t.initialValue||{});Object.assign(r.value,bn,r.value);const s=i=>{n.value=!0,!(t.pointerTypes&&!t.pointerTypes.includes(i.pointerType))&&(r.value=Ir(i,Gr,!1))};if(e){const i={passive:!0};xe(e,["pointerdown","pointermove","pointerup"],s,i),xe(e,"pointerleave",()=>n.value=!1,i)}return{...Rr(r),isInside:n}}function Hr(t={}){const{window:e=ee,initialWidth:n=Number.POSITIVE_INFINITY,initialHeight:r=Number.POSITIVE_INFINITY,listenOrientation:s=!0,includeScrollbar:i=!0,type:o="inner"}=t,c=S(n),l=S(r),a=()=>{e&&(o==="outer"?(c.value=e.outerWidth,l.value=e.outerHeight):i?(c.value=e.innerWidth,l.value=e.innerHeight):(c.value=e.document.documentElement.clientWidth,l.value=e.document.documentElement.clientHeight))};if(a(),xt(a),xe("resize",a,{passive:!0}),s){const u=Vr("(orientation: portrait)");K(u,()=>a())}return{width:c,height:l}}var Xr=Object.defineProperty,qr=(t,e,n)=>e in t?Xr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Lt=(t,e,n)=>qr(t,typeof e!="symbol"?e+"":e,n);const Qr="@tresjs/core",Jr="module",Zr="4.3.1",es="[email protected]",ts="Declarative ThreeJS using Vue Components",ns="Alvaro Saburido <[email protected]> (https://github.com/alvarosabu/)",rs="MIT",ss={type:"git",url:"git+https://github.com/Tresjs/tres.git"},is=["vue","3d","threejs","three","threejs-vue"],os=!1,as={".":{types:"./dist/index.d.ts",import:"./dist/tres.js",require:"./dist/tres.umd.cjs"},"./components":{types:"./dist/src/components/index.d.ts"},"./composables":{types:"./dist/src/composables/index.d.ts"},"./types":{types:"./dist/src/types/index.d.ts"},"./utils":{types:"./dist/src/utils/index.d.ts"},"./*":"./*"},cs="./dist/tres.js",ls="./dist/tres.js",us="./dist/index.d.ts",fs=["*.d.ts","dist"],ds={access:"public"},ps={dev:"cd playground/vue && npm run dev","dev:nuxt":"cd playground/nuxt && npm run dev",build:"vite build",test:"vitest","test:ci":"vitest run","test:ui":"vitest --ui --coverage.enabled=true",release:"release-it",coverage:"vitest run --coverage",lint:"eslint .","lint:fix":"eslint . --fix","docs:dev":"vitepress dev docs","docs:build":"vitepress build docs","docs:serve":"vitepress serve docs","docs:preview":"vitepress preview docs","docs:contributors":"esno scripts/update-contributors.ts"},hs={three:">=0.133",vue:">=3.4"},vs={"@alvarosabu/utils":"^3.2.0","@vue/devtools-api":"^6.6.3","@vueuse/core":"^11.1.0"},ms={"@release-it/conventional-changelog":"^9.0.0","@stackblitz/sdk":"^1.11.0","@tresjs/cientos":"4.0.3","@tresjs/eslint-config":"^1.4.0","@types/three":"^0.169.0","@typescript-eslint/eslint-plugin":"^8.8.1","@typescript-eslint/parser":"^8.8.1","@vitejs/plugin-vue":"^5.1.4","@vitest/coverage-c8":"^0.33.0","@vitest/coverage-v8":"^2.1.2","@vitest/ui":"^2.1.2","@vue/test-utils":"^2.4.6",eslint:"^9.12.0","eslint-plugin-vue":"^9.29.0",esno:"^4.8.0",gsap:"^3.12.5",husky:"^9.1.6",jsdom:"^25.0.1",kolorist:"^1.8.0",ohmyfetch:"^0.4.21",pathe:"^1.1.2","release-it":"^17.8.2","rollup-plugin-analyzer":"^4.0.0","rollup-plugin-copy":"^3.5.0","rollup-plugin-visualizer":"^5.12.0",sponsorkit:"^0.15.5",three:"^0.169.0",unocss:"^
10.63.4",unplugin:"^1.14.1","unplugin-vue-components":"^0.27.4",vite:"^5.4.8","vite-plugin-banner":"^0.8.0","vite-plugin-dts":"4.2.4","vite-plugin-inspect":"^0.8.7","vite-plugin-require-transform":"^1.0.21","vite-svg-loader":"^5.1.0",vitepress:"1.4.0",vitest:"^2.1.2",vue:"3.5.12","vue-demi":"^0.14.10"},gs={name:Qr,type:Jr,version:Zr,packageManager:es,description:ts,author:ns,license:rs,repository:ss,keywords:is,sideEffects:os,exports:as,main:cs,module:ls,types:us,files:fs,publishConfig:ds,scripts:ps,peerDependencies:hs,dependencies:vs,devDependencies:ms};class _s extends or{constructor(...e){super(...e),Lt(this,"type","HightlightMesh"),Lt(this,"createTime"),this.createTime=Date.now()}onBeforeRender(){const e=(Date.now()-this.createTime)/1e3,n=1+.07*Math.sin(2.5*e);this.scale.set(n,n,n)}}function ut(t){return typeof t>"u"}function Fe(t){return Array.isArray(t)}function ys(t){return typeof t=="number"}function wn(t){return typeof t=="string"}function ce(t){return typeof t=="function"}function te(t){return t===Object(t)&&!Fe(t)&&!ce(t)}function se(t){return te(t)&&"isObject3D"in t&&!!t.isObject3D}function Rt(t){return te(t)&&"isCamera"in t&&!!t.isCamera}function bs(t){return te(t)&&"isBufferGeometry"in t&&!!t.isBufferGeometry}function ws(t){return te(t)&&"isMaterial"in t&&!!t.isMaterial}function Es(t){return te(t)&&"isLight"in t&&!!t.isLight}function xs(t){return te(t)&&"isFog"in t&&!!t.isFog}function Ss(t){return te(t)&&"isScene"in t&&!!t.isScene}function Ae(t){return se(t)||bs(t)||ws(t)||xs(t)}function Ts(t){return te(t)&&!!t.isPrimitive}const En=(t,e)=>{for(const n of Object.keys(e))e[n]instanceof Object&&Object.assign(e[n],En(t[n],e[n]));return Object.assign(t||{},e),t},Ps="html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot",Ms=As(Ps);function Bt(t){return t&&t.nodeType===1}function ke(t){return t.replace(/-([a-z])/g,(e,n)=>n.toUpperCase())}const Cs=/\B([A-Z])/g;function Os(t){return t.replace(Cs,"-$1").toLowerCase()}function As(t,e){const n=Object.create(null),r=t.split(",");for(let s=0;s<r.length;s++)n[r[s]]=!0;return s=>!!n[s]}const $t=(t,e)=>{if(!e)return;const n=Array.isArray(e)?e:e.match(/([^[.\]])+/g);return n?.reduce((r,s)=>r&&r[s],t)},ks=(t,e,n)=>{const r=Array.isArray(e)?e:e.match(/([^[.\]])+/g);r&&r.reduce((s,i,o)=>(s[i]===void 0&&(s[i]={}),o===r.length-1&&(s[i]=n),s[i]),t)};function xn(t,e){if(Bt(t)&&Bt(e)){const s=t.attributes,i=e.attributes;return s.length!==i.length?!1:Array.from(s).every(({name:o,value:c})=>e.getAttribute(o)===c)}if(t===e)return!0;if(t===null||typeof t!="object"||e===null||typeof e!="object")return!1;const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(const s of n)if(!r.includes(s)||!xn(t[s],e[s]))return!1;return!0}function js(t,e){if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!xn(t[n],e[n]))return!1;return!0}function Is(t,e,n,r){const s=l=>{if(l.uuid===e)return l;for(const a of l.children){const u=s(a);if(u)return u}},i=s(t);if(!i){console.warn("Object with UUID not found in the scene.");return}let o=i;for(let l=0;l<n.length-1;l++)if(o[n[l]]!==void 0)o=o[n[l]];else{console.warn(`Property path is not valid: ${n.join(".")}`);return}const c=n[n.length-1];o[c]!==void 0?o[c]=r:console.warn(`Property path is not valid: ${n.join(".")}`)}function Ds(t){const e=new sr({color:11003607,transparent:!0,opacity:.2,depthTest:!1,side:ir});return new _s(t.geometry.clone(),e)}function Ls(t){return"map"in t}function Ut(t){Ls(t)&&t.map&&t.map.dispose(),t.dispose()}function Sn(t){var e,n;if(t.parent&&((e=t.removeFromParent)==null||e.call(t)),delete t.__tres,[...t.children].forEac
1h(r=>Sn(r)),!(t instanceof dn)){const r=t;t&&((n=t.dispose)==null||n.call(t)),r.geometry&&(r.geometry.dispose(),delete r.geometry),Array.isArray(r.material)?(r.material.forEach(s=>Ut(s)),delete r.material):r.material&&(Ut(r.material),delete r.material)}}function Rs(t,e){let n=0;for(let r=0;r<t.length;r++)e(t[r],r)&&(t[n]=t[r],n++);return t.length=n,t}function ft(t,e){let n=t;if(e.includes("-")){const r=e.split("-");let s=r.shift();for(;n&&r.length;)s in n?(n=n[s],s=r.shift()):s=Vt(s,r.shift());return{target:n,key:Vt(s,...r)}}else return{target:n,key:e}}function Vt(...t){return t.map((e,n)=>n===0?e:e.charAt(0).toUpperCase()+e.slice(1)).join("")}const Ft=/-\d+$/;function Bs(t,e,n){if(wn(n)){if(Ft.test(n)){const i=n.replace(Ft,""),{target:o,key:c}=ft(t,i);if(!Array.isArray(o[c])){const l=o[c],a=[];a.__tresDetach=()=>{a.every(u=>ut(u))&&(o[c]=l)},o[c]=a}}const{target:r,key:s}=ft(t,n);e.__tres.previousAttach=r[s],r[s]=fe(e)}else e.__tres.previousAttach=n(t,e)}function $s(t,e,n){var r,s,i;if(wn(n)){const{target:o,key:c}=ft(t,n),l=e.__tres.previousAttach;l===void 0?delete o[c]:o[c]=l,"__tresDetach"in o&&o.__tresDetach()}else(s=(r=e.__tres)==null?void 0:r.previousAttach)==null||s.call(r,t,e);(i=e.__tres)==null||delete i.previousAttach}function ae(t,e,n){const r=t;return r.__tres={type:"unknown",eventCount:0,root:n,handlers:{},memoizedProps:{},objects:[],parent:null,previousAttach:null,...e},r.__tres.attach||(r.isMaterial?r.__tres.attach="material":r.isBufferGeometry?r.__tres.attach="geometry":r.isFog&&(r.__tres.attach="fog")),r}function Tn(t){var e;const n=(e=t?.__tres)==null?void 0:e.root;n&&n.render&&n.render.canBeInvalidated.value&&n.invalidate()}function Us(t,e,n){var r;if(!ce(t.setPixelRatio))return;let s=0;if(Fe(n)&&n.length>=2){const[i,o]=n;s=_t.clamp(e,i,o)}else ys(n)?s=n:s=e;s!==((r=t.getPixelRatio)==null?void 0:r.call(t))&&t.setPixelRatio(s)}function Vs(t,e,n,r,s){const i=[...e.__tres.objects],o=fe(e);if(t=fe(t),o===t)return!0;const c=ae(t,e.__tres??{},s),l=e.parent??e.__tres.parent??null,a={...e.__tres.memoizedProps};delete a.object;
1for(const u of i)Pn(u,s),Mn(u,s);o.__tres.objects=[],r.remove(e);for(const[u,d]of Object.entries(a))r.patchProp(c,u,c[u],d);n(t),r.insert(e,l);for(const u of i)r.insert(u,e);return!0}function fe(t){return Ts(t)?(t.object.__tres=t.__tres,t.object):t}function Pn(t,e){var n,r,s,i;const o=((n=t.__tres)==null?void 0:n.parent)||e.scene.value;t.__tres&&(t.__tres.parent=null),o&&o.__tres&&"objects"in o.__tres&&Rs(o.__tres.objects,c=>c!==t),(r=t.__tres)!=null&&r.attach?$s(o,t,t.__tres.attach):((i=(s=t.parent)==null?void 0:s.remove)==null||i.call(s,fe(t)),t.parent=null)}function Mn(t,e){var n;(n=t.traverse)==null||n.call(t,r=>{var s;e.deregisterCamera(r),(s=e.eventManager)==null||s.deregisterPointerMissedObject(r)}),e.deregisterCamera(t),Tn(t)}const Fs=({sizes:t})=>{const e=S([]),n=G(()=>e.value[0]),r=o=>{const c=o instanceof tr?o:e.value.find(a=>a.uuid===o);if(!c)return;const l=e.value.filter(({uuid:a})=>a!==c.uuid);e.value=[c,...l]},s=(o,c=!1)=>{if(Rt(o)){const l=o;if(e.value.some(({uuid:a})=>a===l.uuid))return;c?r(l):e.value.push(l)}},i=o=>{if(Rt(o)){const c=o;e.value=e.value.filter(({uuid:l})=>l!==c.uuid)}};return Ne(()=>{t.aspectRatio.value&&e.value.forEach(o=>{!o.manual&&(o instanceof it||zs(o))&&(o instanceof it?o.aspect=t.aspectRatio.value:(o.left=t.width.value*-.5,o.right=t.width.value*.5,o.top=t.height.value*.5,o.bottom=t.height.value*-.5),o.updateProjectionMatrix())})}),le(()=>{e.value=[]}),{camera:n,cameras:e,registerCamera:s,deregisterCamera:i,setCameraActive:r}};function zs(t){return t.hasOwnProperty("isOrthographicCamera")&&t.isOrthographicCamera}const ze="[TresJS â² â â] ";function Ws(...t){typeof t[0]=="string"?t[0]=ze+t[0]:t.unshift(ze),console.error(...t)}function Ns(...t){typeof t[0]=="string"?t[0]=ze+t[0]:t.unshift(ze),console.warn(...t)}function Ks(t,e){}function Tt(){return{logError:Ws,logWarning:Ns,logMessage:Ks}}const dt=S({}),pt=t=>Object.assign(dt.value,t);function Ze(){const t=new Map,e=new Set;let n=0,r=!1;const s=()=>{const o=Array.from(t.entries()).sort((c,l)=>{const a=c[1].priority-l[1].priority;return a===0?c[1].addI-l[1].addI:a});e.clear(),o.forEach(c=>e.add(c[0]))},i=o=>{t.delete(o),e.delete(o)};return{on:(o,c=0)=>{t.set(o,{priority:c,addI:n++});const l=()=>i(o);return J(l),r=!0,{off:l}},off:i,trigger:(...o)=>{r&&(s(),r=!1),e.forEach(c=>c(...o))},dispose:()=>{t.clear(),e.clear()},get count(){return t.size}}}function Gs(){let t=!0,e=!0,n=!1;const r=new gt(!1),s=S(r.running),i=S(!1);let o;const c=_t.generateUUID();let l=null;const a=Ze(),u=Ze(),d=Ze();E();let f={};function v(M){f=M}function m(M,O,_=0){switch(O){case"before":return a.on(M,_);case"render":return l||(l=M),u.dispose(),u.on(M);case"after":return d.on(M,_)}}function p(){e&&(e=!1,E(),P())}function h(){e=!0,E(),cancelAnimationFrame(o)}function T(){n=!1,E()}function g(){n=!0,E()}function w(){i.value=!0}function C(){i.value=!1}function P(){if(!t){o=requestAnimationFrame(P);return}const M=r.getDelta(),O=r.getElapsedTime(),_={camera:q(f.camera),scene:q(f.scene),renderer:q(f.renderer),raycaster:q(f.raycaster),controls:q(f.controls),invalidate:f.invalidate,advance:f.advance},x={delta:M,elapsed:O,clock:r,..._};s.value&&a.trigger(x),i.value||(u.count?u.trigger(x):l&&l(x)),s.value&&d.trigger(x),o=requestAnimationFrame(P)}function E(){const M=!e&&!n;r.running!==M&&(r.running?r.stop():r.start()),s.value=r.running}return{loopId:c,register:(M,O,_)=>m(M,O,_),start:p,stop:h,pause:g,resume:T,pauseRender:w,resumeRender:C,isRenderPaused:i,isActive:s,setContext:v,setReady:M=>t=M}}function Pt(t){let e=0;return t.traverse(n=>{if(n.isMesh&&n.geometry&&n.type!=="HightlightMesh"){const r=n.geometry,s=r.attributes.position.count*3*Float32Array.BYTES_PER_ELEMENT,i=r.index?r.index.count*Uint32Array.BYTES_PER_ELEMENT:0,o=r.attributes.normal?r.attributes.normal.count*3*Float32Array.BYTES_PER_ELEMENT:0,c=r.attributes.uv?r.attributes.uv.count*2*Float32Array.BYTES_PER_ELEMENT:0,l=s+i+o+c;e+=l}}),e}function Ys(t){return(t/1024).toFixed(2)}const Hs=Number.parseInt(nr.replace("dev",""));function Xs(t){return t instanceof _e?t:Array.isArray(t)?new _e(...t):new _e(t)}const je={realistic:{shadows:!0,physicallyCorrectLights:!0,outputColorSpace:Jn,toneMapping:hn,toneMappingExposure:3,shadowMap:{enabled:!0,type:Qn}},flat:{toneMapping:qn,toneMappingExposure:1}};function qs({canvas:t,options:e,contextParts:{sizes:n,render:r,invali
1date:s,advance:i}}){const o=G(()=>({alpha:j(e.alpha)??!0,depth:j(e.depth),canvas:H(t),context:j(e.context),stencil:j(e.stencil),antialias:j(e.antialias)??!0,precision:j(e.precision),powerPreference:j(e.powerPreference),premultipliedAlpha:j(e.premultipliedAlpha),preserveDrawingBuffer:j(e.preserveDrawingBuffer),logarithmicDepthBuffer:j(e.logarithmicDepthBuffer),failIfMajorPerformanceCaveat:j(e.failIfMajorPerformanceCaveat)})),c=Q(new Je(o.value));function l(){e.renderMode==="on-demand"&&s()}K(o,()=>{c.value.dispose(),c.value=new Je(o.value),l()}),K([n.width,n.height],()=>{c.value.setSize(n.width.value,n.height.value),l()},{immediate:!0}),K(()=>e.clearColor,l);const{pixelRatio:a}=Fr(),{logError:u}=Tt(),d=(()=>{const v=new Je,m={shadowMap:{enabled:v.shadowMap.enabled,type:v.shadowMap.type},toneMapping:v.toneMapping,toneMappingExposure:v.toneMappingExposure,outputColorSpace:v.outputColorSpace};return v.dispose(),m})(),f=j(e.renderMode);return f==="on-demand"&&s(),f==="manual"&&setTimeout(()=>{i()},100),Ne(()=>{const v=j(e.preset);v&&(v in je||u(`Renderer Preset must be one of these: ${Object.keys(je).join(", ")}`),En(c.value,je[v])),Us(c.value,a.value,j(e.dpr)),f==="always"&&(r.frames.value=Math.max(1,r.frames.value));const m=(T,g)=>{const w=j(T),C=()=>{if(v)return $t(je[v],g)};if(w!==void 0)return w;const P=C();return P!==void 0?P:$t(d,g)},p=(T,g)=>ks(c.value,g,m(T,g));p(e.shadows,"shadowMap.enabled"),p(e.toneMapping??hn,"toneMapping"),p(e.shadowMapType,"shadowMap.type"),Hs<150&&p(!e.useLegacyLights,"physicallyCorrectLights"),p(e.outputColorSpace,"outputColorSpace"),p(e.toneMappingExposure,"toneMappingExposure");const h=m(e.clearColor,"clearColor");h&&c.value.setClearColor(h?Xs(h):new _e(0))}),le(()=>{c.value.dispose(),c.value.forceContextLoss()}),{renderer:c}}function Qs(t,e,n=10){const r=j(t)?Hr():Wr(G(()=>j(e).parentElement)),s=Ee(Dt(r.width,n)),i=Ee(Dt(r.height,n)),o=G(()=>s.value/i.value);return{height:i,width:s,aspectRatio:o}}const Js=(t,e)=>{const n=G(()=>e.renderer.value.domElement),r=Q([]),{x:s,y:i}=Yr({target:n});let o=0;const{width:c,height:l,top:a,left:u}=zr(n),d=({x:y,y:I})=>{if(n.value)return{x:(y-u.value)/c.value*2-1,y:-((I-a.value)/l.value)*2+1}},f=({x:y,y:I})=>{if(e.camera.value)return e.raycaster.value.setFromCamera(new ye(y,I),e.camera.value),r.value=e.raycaster.value.intersectObjects(t.value,!0),r.value},v=y=>{const I=d({x:y?.clientX??s.value,y:y?.clientY??i.value});return I?f(I)||[]:[]},m=W(),p=W(),h=W(),T=W(),g=W(),w=W(),C=W(),P=W();function E(y){const I={};for(const Y in y)typeof Y!="function"&&(I[Y]=y[Y]);return I}const M=(y,I)=>{var Y,ie,Me;const He=E(I),Xe=new ar(I?.clientX,I?.clientY,0).unproject((Y=e.camera)==null?void 0:Y.value);y.trigger({...He,intersections:r.value,unprojectedPoint:Xe,ray:(ie=e.raycaster)==null?void 0:ie.value.ray,camera:(Me=e.camera)==null?void 0:Me.value,sourceEvent:I,delta:o,stopPropagating:!1})};let O;const _=y=>{v(y),M(h,y),O=y},x=()=>{O&&_(O)};let R,U,B;const z=y=>{var I;R=(I=r.value[0])==null?void 0:I.object,o=0,U=new ye(y?.clientX??s.value,y?.clientY??i.value),M(g,y)};let V,Z=!1;const Te=y=>{var I,Y,ie;y instanceof PointerEvent&&(r.value.length===0&&M(w,y),R===((I=r.value[0])==null?void 0:I.object)&&(B=new ye(y?.clientX??s.value,y?.clientY??i.value),o=U?.distanceTo(B),y.button===0?(M(m,y),V===((Y=r.value[0])==null?void 0:Y.object)?Z=!0:(V=(ie=r.value[0])==null?void 0:ie.object,Z=!1)):y.button===2&&M(C,y)),M(T,y))},Pe=y=>{Z&&(M(p,y),V=void 0,Z=!1)},he=y=>M(h,y),ne=y=>M(P,y);return n.value.addEventListener("pointerup",Te),n.value.addEventListener("pointerdown",z),n.value.addEventListener("pointermove",_),n.value.addEventListener("pointerleave",he),n.value.addEventListener("dblclick",Pe),n.value.addEventListener("wheel",ne),le(()=>{n!=null&&n.value&&(n.value.removeEventListener("pointerup",Te),n.value.removeEventListener("pointerdown",z),n.value.removeEventListener("pointermove",_),n.value.removeEventListener("pointerleave",he),n.value.removeEventListener("dblclick",Pe),n.value.removeEventListener("wheel",ne))}),{intersects:r,onClick:y=>m.on(y).off,onDblClick:y=>p.on(y).off,onContextMenu:y=>C.on(y).off,onPointerMove:y=>h.on(y).off,onPointerUp:y=>T.on(y).off,onPointerDown:y=>g.on(y).off,onPointerMissed:y=>w.on(y).off,onWheel:y=>P.on(y).off,forceUpdate:x}};function et(t,e){if(Array.isArray(t))for(const n of t)n(e);typeof t=="function"&&t(e)}function Zs(t,e,n){var r;const s=Q(),i=Q();t&&(s.value=t),e&&(i.value=e);const o=_=>{var x;return((x=_.__tres)==null?void 0:x.eventCount)>0},c=_=>{var x;return((x=_.children)==null?void 0:x.some(R=>c(R)))||o(_)},l=Q(((r=s.value)==null?void 0:r.children).filter(c)||[]);function a(_,x){const R=[],U=()=>x.stopPropagating=!0;x.stopPropagation=U;for(const B of x?.intersections){if(x.stopPropagating)return;x={...x,...B};const{object:z}=B;x.eventObject=z,et(z[_],x),R.push(z);let V=z.parent;for(;V!==null&&!x.stopPropagating&&!R.includes(V);)x.eventObject=V,et(V[_],x),R.push(V),V=V.parent;const Z=Os(_.slice(2));n(Z,{intersection:B,event:x})}}const{onClick:u,onDblClick:d,onContextMenu:f,onPointerMove:v,onPointerDown:m,onPointerUp:p,onPointerMissed:h,onWheel:T,forceUpdate:g}=Js(l,e);p(_=>a("onPointerUp",_)),m(_=>a("onPointerDown",_)),u(_=>a("onClick",_)),d(_=>a("onDoubleClick",_)),f(_=>a("onContextMenu",_)),T(_=>a("onWheel",_));let w=[];v(_=>{const x=_.intersections.map(({object:U})=>U),R=_.intersections;
1w.forEach(({object:U})=>{x.includes(U)||(_.intersections=w,a("onPointerLeave",_),a("onPointerOut",_))}),_.intersections=R,_.intersections.forEach(({object:U})=>{w.includes(U)||(a("onPointerEnter",_),a("onPointerOver",_))}),a("onPointerMove",_),w=_.intersections});const C=[];h(_=>{const x=()=>_.stopPropagating=!0;_.stopPropagation=x,C.forEach(R=>{_.stopPropagating||(_.eventObject=R,et(R.onPointerMissed,_))}),n("pointer-missed",{event:_})});function P(_){Ae(_)&&se(_)&&l.value.push(_)}function E(_){if(Ae(_)&&se(_)){const x=l.value.indexOf(_);x>-1&&l.value.splice(x,1)}}function M(_){Ae(_)&&se(_)&&_.onPointerMissed&&C.push(_)}function O(_){if(Ae(_)&&se(_)){const x=C.indexOf(_);x>-1&&C.splice(x,1)}}return e.eventManager={forceUpdate:g,registerObject:P,deregisterObject:E,registerPointerMissedObject:M,deregisterPointerMissedObject:O},{forceUpdate:g,registerObject:P,deregisterObject:E,registerPointerMissedObject:M,deregisterPointerMissedObject:O}}function ei(t,e,n=100){n=n<=0?100:n;const r=W(),s=new Set;let i=!1,o=!1,c=null;function l(){c&&clearTimeout(c),!o&&!i&&t()?(r.trigger(e),s.forEach(d=>d()),s.clear(),i=!0):!o&&!i&&(c=setTimeout(l,n))}function a(){o=!0,c&&clearTimeout(c)}l();const u=(d,...f)=>{d(...f)};return{on:d=>{if(i)return u(d,e),{off:()=>{}};{const f=r.on(d);return s.add(f.off),r.on(d)}},off:r.off,trigger:r.trigger,cancel:a}}const tt=new WeakMap;function ti(t){if(t=t||ri(),tt.has(t))return tt.get(t);const e=100,n=Date.now(),r=ei(()=>{if(Date.now()-n>=e)return!0;{const s=t.renderer.value,i=s?.domElement||{width:0,height:0};return!!(s&&i.width>0&&i.height>0)}},t);return tt.set(t,r),r}function ni({scene:t,canvas:e,windowSize:n,rendererOptions:r,emit:s}){const i=Q(t),o=Qs(n,e),{camera:c,cameras:l,registerCamera:a,deregisterCamera:u,setCameraActive:d}=Fs({sizes:o}),f={mode:S(r.renderMode||"always"),priority:S(0),frames:S(0),maxFrames:60,canBeInvalidated:G(()=>f.mode.value==="on-demand"&&f.frames.value===0)};function v(B=1){r.renderMode==="on-demand"&&(f.frames.value=Math.min(f.maxFrames,f.frames.value+B))}function m(){r.renderMode==="manual"&&(f.frames.value=1)}const{renderer:p}=qs({canvas:e,options:r,contextParts:{sizes:o,render:f,invalidate:v,advance:m}}),h={sizes:o,scene:i,camera:c,cameras:Ee(l),renderer:p,raycaster:Q(new pn),controls:S(null),perf:{maxFrames:160,fps:{value:0,accumulator:[]},memory:{currentMem:0,allocatedMem:0,accumulator:[]}},render:f,advance:m,extend:pt,invalidate:v,registerCamera:a,setCameraActive:d,deregisterCamera:u,loop:Gs()};De("useTres",h),h.scene.value.__tres={root:h},h.loop.register(()=>{c.value&&f.frames.value>0&&(p.value.render(t,c.value),s("render",h.renderer.value)),f.priority.value=0,f.mode.value==="always"?f.frames.value=1:f.frames.value=Math.max(0,f.frames.value-1)},"render");const{on:T,cancel:g}=ti(h);h.loop.setReady(!1),h.loop.start(),T(()=>{s("ready",h),h.loop.setReady(!0),Zs(t,h,s)}),le(()=>{g(),h.loop.stop()});const w=100,C=Nr({every:w}),{isSupported:P,memory:E}=Kr({interval:w}),M=160;let O=performance.now();const _=({timestamp:B})=>{h.scene.value&&(h.perf.memory.allocatedMem=Pt(h.scene.value)),B-O>=w&&(O=B,h.perf.fps.accumulator.push(C.value),h.perf.fps.accumulator.length>M&&h.perf.fps.accumulator.shift(),h.perf.fps.value=C.value,P.value&&E.value&&(h.perf.memory.accumulator.push(E.value.usedJSHeapSize/1024/1024),h.perf.memory.accumulator.length>M&&h.perf.memory.accumulator.shift(),h.perf.memory.currentMem=h.perf.memory.accumulator.reduce((z,V)=>z+V,0)/h.perf.memory.accumulator.length))};let x=0;const R=1,{pause:U}=St(({delta:B})=>{window.__TRES__DEVTOOLS__&&(_({timestamp:performance.now()}),x+=B,x>=R&&(window.__TRES__DEVTOOLS__.cb(h),x=0))},{immediate:!0});return le(()=>{U()}),h}function ri(){const t=gn("useTres");if(!t)throw new Error("useTresContext must be used together with useTresContextProvider");return t}const si=W(),ii=W(),Cn=W(),be=new gt;let Le=0,Re=0;St(()=>{si.trigger({delta:Le,elapsed:Re,clock:be}),ii.trigger({delta:Le,elapsed:Re,clock:be}),Cn.trigger({delta:Le,elapsed:Re,clock:be})},{immediate:!1});Cn.on(()=>{Le=be.getDelta(),Re=be.getElapsedTime()});function oi(t,e={},n={}){let r=t;const s=c=>{r=c};let i=new Proxy({},{});const o={has(c,l){return l in e||l in r},get(c,l,a){return l in e?e[l](r):r[l]},set(c,l,a){return n[l]?n[l](a,r,i,s):r[l]=a,!0}};return i=new Proxy({},o),i}const{logError:zt}=Tt(),Wt=["onClick","onContextMenu","onPointerMove","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut","onDoubleClick","onPointerDown","onPointerUp","onPointerCancel","onPointerMissed","onLostPointerCapture","onWheel"],ai=t=>{const e=t.scene.value;function n(a,u,d,f){if(f||(f={}),f.args||(f.args=[]),a==="template"||Ms(a))return null;let v=a.replace("Tres",""),m;if(a==="primitive"){(!te(f.object)||yt(f.object))&&zt("Tres primitives need an 'object' prop, whose value is an object or shallowRef<object>"),v=f.object.type;const p={};m=oi(f.object,{object:h=>h,isPrimitive:()=>!0,__tres:()=>p},{object:(h,T,g,w)=>{Vs(h,g,w,{patchProp:i,remove:s,insert:r},t)},__tres:h=>{Object.assign(p,h)}})}else{const p=dt.value[v];p||zt(`${v} is not defined on the THREE namespace. Use extend to add it to the catalog.`),m=new p(...f.args)}return m?(m.isCamera&&(f!=null&&f.position||m.position.set(3,3,3),f!=null&&f.lookAt||m.lookAt(0,0,0)),m=ae(m,{...m.__tres,type:v,memoizedProps:f,eventCount:0,primitive:a==="primitive",attach:f.attach},t),m):null}function r(a,u){var d,f,v;if(!a)return;u=u||e;const m=a.__tres?a:ae(a,{},t),p=u.__tres?u:ae(u,{},t);a=fe(m),u=fe(p),a.__tres&&((d=a.__tres)==null?void 0:d.eventCount)>0&&((f=t.eventManager)==null||f.registerObject(a)),t.registerCamera(a),(v=t.eventManager)==null||v.registerPointerMissedObject(a),m.__tres.attach?Bs(p,m,m.__tres.attach):se(a)&&se(p)&&(p.add(a),a.dispatchEvent({type:"added"})),m.__tres.parent=p,p.__tres.objects&&!p.__tres.objects.includes(m)&&p.__tres.objects.push(m)}function s(a,u){var d,f,v,m;if(!a)return;a!=null&&a.__tres&&((d=a.__tres)==null?void 0:d.eventCount)>0&&((f=t.eventManager)==null||f.deregisterObject(a)),u=ut(u)?"default":u;const p=(v=a.__tres)==null?void 0:v.dispose;ut(p)||(p===null?u=!1:u=p);const h=(m=a.__tres)==null?void 0:m.primitive,T=u==="default"?!h:!!u;
1if(a.__tres&&"objects"in a.__tres&&[...a.__tres.objects].forEach(g=>s(g,u)),T&&a.children&&[...a.children].forEach(g=>s(g,u)),Pn(a,t),Mn(a,t),T&&!Ss(a)){if(ce(u))u(a);else if(ce(a.dispose))try{a.dispose()}catch{}}"__tres"in a&&delete a.__tres}function i(a,u,d,f){var v,m;if(!a)return;let p=a,h=u;if(a.__tres&&(a.__tres.memoizedProps[u]=f),u==="attach"){const C=((v=a.__tres)==null?void 0:v.parent)||a.parent;s(a),ae(a,{attach:f},t),C&&r(a,C);return}if(u==="dispose"){a.__tres||(a=ae(a,{},t)),a.__tres.dispose=f;return}if(se(a)&&h==="blocks-pointer-events"){f||f===""?a[h]=f:delete a[h];return}Wt.includes(u)&&a.__tres&&(a.__tres.eventCount+=1);let T=ke(h),g=p?.[T];if(h==="args"){const C=a,P=d??[],E=f??[],M=((m=a.__tres)==null?void 0:m.type)||a.type;M&&P.length&&!js(P,E)&&(p=Object.assign(C,new dt.value[M](...f)));return}if(p.type==="BufferGeometry"){if(h==="args")return;p.setAttribute(ke(h),new er(...f));return}if(h.includes("-")&&g===void 0){const C=h.split("-");g=C.reduce((P,E)=>P[ke(E)],p),h=C.pop(),T=h,g!=null&&g.set||(p=C.reduce((P,E)=>P[ke(E)],p))}let w=f;if(w===""&&(w=!0),ce(g)){Wt.includes(u)||(Fe(w)?a[T](...w):a[T](w)),T.startsWith("on")&&ce(w)&&(p[T]=w);return}!(g!=null&&g.set)&&!ce(g)?p[T]=w:g.constructor===w.constructor&&g!=null&&g.copy?g?.copy(w):Fe(w)?g.set(...w):!g.isColor&&g.setScalar?g.setScalar(w):g.set(w),Tn(a)}function o(a){var u;return((u=a?.__tres)==null?void 0:u.parent)||null}function c(a){const u=ae(new Zn,{type:"Comment"},t);return u.name=a,u}function l(a){var u;const d=o(a),f=((u=d?.__tres)==null?void 0:u.objects)||[],v=f.indexOf(a);return v<0||v>=f.length-1?null:f[v+1]}return{insert:r,remove:s,createElement:n,patchProp:i,parentNode:o,createText:()=>{},createComment:c,setText:()=>{},setElementText:()=>{},nextSibling:l,querySelector:()=>{},setScopeId:()=>{},cloneNode:()=>{},insertStaticContent:()=>{}}};function ci(){return On().__VUE_DEVTOOLS_GLOBAL_HOOK__}function On(){return typeof navigator<"u"&&typeof window<"u"?window:typeof globalThis<"u"?globalThis:{}}const li=typeof Proxy=="function",ui="devtools-plugin:setup",fi="plugin:settings:set";let me,ht;function di(){var t;return me!==void 0||(typeof window<"u"&&window.performance?(me=!0,ht=window.performance):typeof globalThis<"u"&&!((t=globalThis.perf_hooks)===null||t===void 0)&&t.performance?(me=!0,ht=globalThis.perf_hooks.performance):me=!1),me}function pi(){return di()?ht.now():Date.now()}class hi{constructor(e,n){this.target=null,this.targetQueue=[],this.onQueue=[],this.plugin=e,this.hook=n;const r={};if(e.settings)for(const o in e.settings){const c=e.settings[o];r[o]=c.defaultValue}const s=`__vue-devtools-plugin-settings__${e.id}`;let i=Object.assign({},r);try{const o=localStorage.getItem(s),c=JSON.parse(o);Object.assign(i,c)}catch{}this.fallbacks={getSettings(){return i},setSettings(o){try{localStorage.setItem(s,JSON.stringify(o))}catch{}i=o},now(){return pi()}},n&&n.on(fi,(o,c)=>{o===this.plugin.id&&this.fallbacks.setSettings(c)}),this.proxiedOn=new Proxy({},{get:(o,c)=>this.target?this.target.on[c]:(...l)=>{this.onQueue.push({method:c,args:l})}}),this.proxiedTarget=new Proxy({},{get:(o,c)=>this.target?this.target[c]:c==="on"?this.proxiedOn:Object.keys(this.fallbacks).includes(c)?(...l)=>(this.targetQueue.push({method:c,args:l,resolve:()=>{}}),this.fallbacks[c](...l)):(...l)=>new Promise(a=>{this.targetQueue.push({method:c,args:l,resolve:a})})})}async setRealTarget(e){this.target=e;for(const n of this.onQueue)this.target.on[n.method](...n.args);for(const n of this.targetQueue)n.resolve(await this.target[n.method](...n.args))}}function vi(t,e){const n=t,r=On(),s=ci(),i=li&&n.enableEarlyProxy;if(s&&(r.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__||!i))s.emit(ui,t,e);else{const o=i?new hi(n,s):null;(r.__VUE_DEVTOOLS_PLUGINS__=r.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:n,setupFn:e,proxy:o}),o&&e(o.proxiedTarget)}}function mi(t,e){const n=`â² â â${t}`;typeof Nt=="function"?Nt(n,e):console.log(n)}function Nt(t,e){throw new Error(t+e)}const An=t=>{const e={id:t.uuid,label:t.type,children:[],tags:[]};t.name!==""&&e.tags.push({label:t.name,textColor:5750629,backgroundColor:15793395});const n=Pt(t);return n>0&&e.tags.push({label:`${Ys(n)} KB`,textColor:15707189,backgroundColor:16775644,tooltip:"Memory usage"}),t.type.includes("Light")&&(Es(t)&&e.tags.push({label:`${t.intensity}`,textColor:9738662,backgroundColor:16316922,tooltip:"Intensity"}),e.tags.push({label:`#${new _e(t.color).getHexString()}
1`,textColor:9738662,backgroundColor:16316922,tooltip:"Color"})),t.type.includes("Camera")&&(e.tags.push({label:`${t.fov}°`,textColor:9738662,backgroundColor:16316922,tooltip:"Field of view"}),e.tags.push({label:`x: ${Math.round(t.position.x)} y: ${Math.round(t.position.y)} z: ${Math.round(t.position.z)}`,textColor:9738662,backgroundColor:16316922,tooltip:"Position"})),e};function kn(t,e,n=""){t.children.forEach(r=>{if(r.type==="HightlightMesh"||n&&!r.type.includes(n)&&!r.name.includes(n))return;const s=An(r);e.children.push(s),kn(r,s,n)})}const gi=[],ge="tres:inspector",_i=gr({sceneGraph:null});function yi(t,e){vi({id:"dev.esm.tres",label:"TresJS ðª",logo:"https://raw.githubusercontent.com/Tresjs/tres/main/public/favicon.svg",packageName:"tresjs",homepage:"https://tresjs.org",componentStateTypes:gi,app:t},n=>{typeof n.now!="function"&&mi("You seem to be using an outdated version of Vue Devtools. Are you still using the Beta release instead of the stable one? You can find the links at https://devtools.vuejs.org/guide/installation.html."),n.addInspector({id:ge,label:"TresJS ðª",icon:"account_tree",treeFilterPlaceholder:"Search instances"}),setInterval(()=>{n.sendInspectorTree(ge)},1e3),setInterval(()=>{n.notifyComponentUpdate()},5e3),n.on.getInspectorTree(i=>{if(i.inspectorId===ge){const o=An(e.scene.value);kn(e.scene.value,o,i.filter),_i.sceneGraph=o,i.rootNodes=[o]}});let r=null,s=null;n.on.getInspectorState(i=>{var o;if(i.inspectorId===ge){const[c]=e.scene.value.getObjectsByProperty("uuid",i.nodeId);if(!c)return;if(s&&r&&r.parent&&s.remove(r),c.isMesh){const l=Ds(c);c.add(l),r=l,s=c}i.state={object:Object.entries(c).map(([l,a])=>l==="children"?{key:l,value:a.filter(u=>u.type!=="HightlightMesh")}:{key:l,value:a,editable:!0}).filter(({key:l})=>l!=="parent")},c.isScene&&(i.state.info={objects:c.children.length,memory:Pt(c),calls:e.renderer.value.info.render.calls,triangles:e.renderer.value.info.render.triangles,points:e.renderer.value.info.render.points,lines:e.renderer.value.info.render.lines},i.state.programs=((o=e.renderer.value.info.programs)==null?void 0:o.map(l
1=>({key:l.name,value:{...l,vertexShader:l.vertexShader,attributes:l.getAttributes(),uniforms:l.getUniforms()}})))||[])}}),n.on.editInspectorState(i=>{i.inspectorId===ge&&Is(e.scene.value,i.nodeId,i.path,i.state.value)})})}const bi=["data-scene","data-tres"],wi=at({__name:"TresCanvas",props:{shadows:{type:Boolean,default:void 0},clearColor:{},toneMapping:{},shadowMapType:{},useLegacyLights:{type:Boolean,default:void 0},outputColorSpace:{},toneMappingExposure:{},renderMode:{default:"always"},dpr:{},camera:{},preset:{},windowSize:{type:Boolean,default:void 0},enableProvideBridge:{type:Boolean,default:!0},context:{},alpha:{type:Boolean,default:void 0},premultipliedAlpha:{type:Boolean},antialias:{type:Boolean,default:void 0},stencil:{type:Boolean,default:void 0},preserveDrawingBuffer:{type:Boolean,default:void 0},powerPreference:{},depth:{type:Boolean,default:void 0},failIfMajorPerformanceCaveat:{type:Boolean,default:void 0},precision:{},logarithmicDepthBuffer:{type:Boolean,default:void 0},reverseDepthBuffer:{type:Boolean}},emits:["render","click","double-click","context-menu","pointer-move","pointer-up","pointer-down","pointer-enter","pointer-leave","pointer-over","pointer-out","pointer-missed","wheel","ready"],setup(t,{expose:e,emit:n}){const r=t,s=n,i=pr(),{logWarning:o}=Tt(),c=S(),l=Q(new dn),a=Ve();pt(rr);const u=(p,h=!1)=>at({setup(){var T;const g=(T=Ve())==null?void 0:T.appContext;g&&(g.app=a?.appContext.app);const w={};function C(P){P&&(P.parent&&C(P.parent),P.provides&&Object.assign(w,P.provides))}return a!=null&&a.parent&&r.enableProvideBridge&&(C(a.parent),Reflect.ownKeys(w).forEac
1h(P=>{De(P,w[P])})),De("useTres",p),De("extend",pt),typeof window<"u"&&yi(g?.app,p),()=>jt(mr,null,h?[]:i.default())}}),d=(p,h=!1)=>{const T=u(p,h),{render:g}=vr(ai(p));g(jt(T),l.value)},f=(p,h=!1)=>{Sn(p.scene.value),h&&(p.renderer.value.dispose(),p.renderer.value.renderLists.dispose(),p.renderer.value.forceContextLoss()),l.value.__tres={root:p}},v=Q(null);e({context:v,dispose:()=>f(v.value,!0)});const m=()=>{f(v.value),d(v.value,!0)};return de(()=>{const p=c;v.value=ni({scene:l.value,canvas:p,windowSize:r.windowSize??!1,rendererOptions:r,emit:s});const{registerCamera:h,camera:T,cameras:g,deregisterCamera:w}=v.value;d(v.value);const C=()=>{const P=new it(45,window.innerWidth/window.innerHeight,.1,1e3);P.position.set(3,3,3),P.lookAt(0,0,0),h(P);const E=Ne(()=>{g.value.length>=2&&(P.removeFromParent(),w(P),E?.())})};K(()=>r.camera,(P,E)=>{P&&h(P),E&&(E.removeFromParent(),w(E))},{immediate:!0}),T.value||(o("No camera found. Creating a default perspective camera. To have full control over a camera, please add one to the scene."),C())}),le(m),(p,h)=>(Ke(),bt("canvas",{ref_key:"canvas",ref:c,"data-scene":l.value.uuid,class:wt(p.$attrs.class),"data-tres":`tresjs ${q(gs).version}`,style:hr({display:"block",width:"100%",height:"100%",position:p.windowSize?"fixed":"relative",top:0,left:0,pointerEvents:"auto",touchAction:"none",...p.$attrs.style})},null,14,bi))}}),Ei=at({__name:"TresCanvas.client",setup(t){return(e,n)=>(Ke(),_r(q(wi),null,{default:yr(()=>[Et(e.$slots,"default")]),_:3}))}}),Fo=Object.assign(Ei,{__name:"TresCanvas"});new ye;new ye;function zo(t,e,n){return Math.max(e,Math.min(n,t))}var xi=function(e){return 1/(1+e+.48*e*e+.235*e*e*e)};function Wo(t,e,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:.25,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:.01,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:1/0,o=arguments.length>6&&arguments[6]!==void 0?arguments[6]:xi,c=arguments.length>7&&arguments[7]!==void 0?arguments[7]:.001,l="velocity_"+e;if(t.__damp===void 0&&(t.__damp={}),t.__damp[l]===void 0&&(t.__damp[l]=0),Math.abs(t[e]-n)<=c)return t[e]=n,!1;r=Math.max(1e-4,r);var a=2/r,u=o(a*s),d=t[e]-n,f=n,v=i*r;d=Math.min(Math.max(d,-v),v),n=t[e]-d;var m=(t.__damp[l]+a*d)*s;t.__damp[l]=(t.__damp[l]-a*m)*u;var p=n+(d+m)*u;return f-t[e]>0==p>f&&(p=f,t.__damp[l]=(p-f)/s),t[e]=p,!0}function No(t,e){const n=_t.degToRad(t.fov),r=2*Math.tan(n/2)*e;return{width:r*t.aspect,height:r}}const Kt={map:lr,globe:cr},Ko=t=>{if(!Object.keys(Kt).includes(t))throw new Error(`Cant find ${t} store`);return Kt[t]()};function jn(t){return vn()?(mn(t),!0):!1}function Mt(){const t=new Set,e=i=>{t.delete(i)};return{on:i=>{t.add(i);const o=()=>e(i);return jn(o),{off:o}},off:e,trigger:(...i)=>Promise.all(Array.from(t).map(o=>o(...i))),clear:()=>{t.clear()}}}const Si=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Ti=Si?window:void 0;function Pi(t,e={}){const{immediate:n=!0,fpsLimit:r=void 0,window:s=Ti,once:i=!1}=e,o=Q(!1),c=G(()=>r?1e3/br(r):null);let l=0,a=null;function u(v){if(!o.value||!s)return;l||(l=v);const m=v-l;if(c.value&&m<c.value){a=s.requestAnimationFrame(u);return}if(l=v,t({delta:m,timestamp:v}),i){o.value=!1,a=null;return}a=s.requestAnimationFrame(u)}function d(){!o.value&&s&&(o.value=!0,l=0,a=s.requestAnimationFrame(u))}function f(){o.value=!1,a!=null&&s&&(s.cancelAnimationFrame(a),a=null)}return n&&d(),jn(f),{isActive:Ee(o),pause:f,resume:d}}const Mi=Array.isArray;async function Go(t,e){const n=new ur(e),r=s=>new Promise((i,o)=>{n.load(s,c=>i(c),()=>null,()=>{o(new Error("[useTextures] - Failed to load texture"))})});if(Mi(t)){const s=await Promise.all(t.map(i=>r(i)));return t.length>1?s:s[0]}else{const{map:s,displacementMap:i,normalMap:o,roughnessMap:c,metalnessMap:l,aoMap:a,alphaMap:u,matcap:d}=t;return{map:s?await r(s):null,displacementMap:i?await r(i):null,normalMap:o?await r(o):null,roughnessMap:c?await r(c):null,metalnessMap:l?await r(l):null,aoMap:a?await r(a):null,alphaMap:u?await r(u):null,matcap:d?await r(d):null}}}function Ci(){const t=gn("useTres");if(!t)throw new Error("useTresContext must be used together with useTresContextProvider");return t}function Yo(){const{camera:t,scene:e,renderer:n,loop:r,raycaster:s,controls:i,invalidate:o,advance:c}=Ci();r.setContext({camera:t,scene:e,renderer:n,raycaster:s,controls:i,invalidate:o,advance:c});function l(d,f=0){return r.register(d,"before",f)}function a(d){return r.register(d,"render")}function u(d,f=0){return r.register(d,"after",f)}return{pause:r.pause,resume:r.resume,pauseRender:r.pauseRender,resumeRender:r.resumeRender,isActive:r.isActive,onBeforeRender:l,render:a,onAfterRender:u}}const In=Mt(),Dn=Mt(),Ct=Mt(),we=new gt;let Be=0,$e=0;const{pause:Oi,resume:Gt,isActive:Ai}=Pi(()=>{In.trigger({delta:Be,elapsed:$e,clock:we}),Dn.trigger({delta:Be,elapsed:$e,clock:we}),Ct.trigger({delta:Be,elapsed:$e,clock:we})},{immediate:!1});Ct.on(()=>{Be=we.getDelta(),$e=we.getElapsedTime()});let Yt=!1;const Ho=()=>(Yt||(Yt=!0,Gt()),{onBeforeLoop:In.on,onLoop:Dn.on,onAfterLoop:Ct.on,pause:Oi,resume:Gt,isActive:Ai}),Xo=(t,e,n=0)=>{de(()=>{It.on(t,e,n)}),le(()=>{It.off(t,e)})},ki=["click","pointerEnter","pointerLeave"];class ji extends pn{constructor(){super(),this._activeEl=!1,this._events={click:[],pointerEnter:[],pointerLeave:[]}}onClick(e,n){this.setFromCamera(e,n);const r=this.intersectObjects(this._events.click);r.length>0&&r[0].object.__cr_click()}onPointerMove(e,n){this.setFromCamera(e,n);const r=this.intersectObjects(this._events.pointerEnter),s=!!this._activeEl;if(r.length>0){const i=r[0].object,o=i.uuid===this._activeEl?.uuid;s&&!o?(this._activeEl?.__cr_pointerLeave(),i?.__cr_pointerEnter(),this._activeEl=i):s||(i?.__cr_pointerEnter(),this._activeEl=i)}else s&&(this._activeEl?.__cr_pointerLeave(),this._activeEl=!1)}
vendor: 26,771 bytes, line 1
1addEvent(e,n,r){if(!ki.includes(e))throw new Error(`Raycast doesn't support ${e} yet`);this._events[e].push(n),n[`__cr_${e}`]=r}removeEvent(e,n,r){this._events[e]=this._events[e].filter(({uuid:s})=>s===n.uuid),n[`__cr_${e}`]=!1}}const Ht=new ji,qo=(t,e,n)=>{de(()=>{Ht.addEvent(t,e.value,n)}),_n(()=>{Ht.removeEvent(t,e.value,n)})};function Ii(t,e,n){return Math.max(e,Math.min(t,n))}const L={toVector(t,e){return t===void 0&&(t=e),Array.isArray(t)?t:[t,t]},add(t,e){return[t[0]+e[0],t[1]+e[1]]},sub(t,e){return[t[0]-e[0],t[1]-e[1]]},addTo(t,e){t[0]+=e[0],t[1]+=e[1]},subTo(t,e){t[0]-=e[0],t[1]-=e[1]}};function Xt(t,e,n){return e===0||Math.abs(e)===1/0?Math.pow(t,n*5):t*e*n/(e+n*t)}function qt(t,e,n,r=.15){return r===0?Ii(t,e,n):t<e?-Xt(e-t,n-e,r)+e:t>n?+Xt(t-n,n-e,r)+n:t}function Di(t,[e,n],[r,s]){const[[i,o],[c,l]]=t;return[qt(e,i,o,r),qt(n,c,l,s)]}function Li(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ri(t){var e=Li(t,"string");return typeof e=="symbol"?e:String(e)}function $(t,e,n){return e=Ri(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Qt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function D(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Qt(Object(n),!0).forEach(function(r){$(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Qt(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}const Ln={pointer:{start:"down",change:"move",end:"up"},mouse:{start:"down",change:"move",end:"up"},touch:{start:"start",change:"move",end:"end"},gesture:{start:"start",change:"change",end:"end"}};function Jt(t){return t?t[0].toUpperCase()+t.slice(1):""}const Bi=["enter","leave"];function $i(t=!1,e){return t&&!Bi.includes(e)}function Ui(t,e="",n=!1){const r=Ln[t],s=r&&r[e]||e;return"on"+Jt(t)+Jt(s)+($i(n,s)?"Capture":"")}const Vi=["gotpointercapture","lostpointercapture"];function Fi(t){let e=t.substring(2).toLowerCase();const n=!!~e.indexOf("passive");n&&(e=e.replace("passive",""));const r=Vi.includes(e)?"capturecapture":"capture",s=!!~e.indexOf(r);return s&&(e=e.replace("capture","")),{device:e,capture:s,passive:n}}function zi(t,e=""){const n=Ln[t],r=n&&n[e]||e;return t+r}function Ye(t){return"touches"in t}function Rn(t){return Ye(t)?"touch":"pointerType"in t?t.pointerType:"mouse"}function Wi(t){return Array.from(t.touches).filter(e=>{var n,r;return e.target===t.currentTarget||((n=t.currentTarget)===null||n===void 0||(r=n.contains)===null||r===void 0?void 0:r.call(n,e.target))})}function Ni(t){return t.type==="touchend"||t.type==="touchcancel"?t.changedTouches:t.targetTouches}function Bn(t){return Ye(t)?Ni(t)[0]:t}function vt(t,e){try{const n=e.clientX-t.clientX,r=e.clientY-t.clientY,s=(e.clientX+t.clientX)/2,i=(e.clientY+t.clientY)/2,o=Math.hypot(n,r);return{angle:-(Math.atan2(n,r)*180)/Math.PI,distance:o,origin:[s,i]}}catch{}return null}function Ki(t){return Wi(t).map(e=>e.identifier)}function Zt(t,e){const[n,r]=Array.from(t.touches).filter(s=>e.includes(s.identifier));return vt(n,r)}function nt(t){const e=Bn(t);return Ye(t)?e.identifier:e.pointerId}function en(t){const e=Bn(t);return[e.clientX,e.clientY]}const tn=40,nn=800;function $n(t){let{deltaX:e,deltaY:n,deltaMode:r}=t;return r===1?(e*=tn,n*=tn):r===2&&(e*=nn,n*=nn),[e,n]}function Gi(t){const e={};if("buttons"in t&&(e.buttons=t.buttons),"shiftKey"in t){const{shiftKey:n,altKey:r,metaKey:s,ctrlKey:i}=t;Object.assign(e,{shiftKey:n,altKey:r,metaKey:s,ctrlKey:i})}return e}function We(t,...e){return typeof t=="function"?t(...e):t}function Yi(){}function Hi(...t){return t.length===0?Yi:t.length===1?t[0]:function(){let e;for(const n of t)e=n.apply(this,arguments)||e;return e}}function rn(t,e){return Object.assign({},e,t||{})}const Xi=32;class Un{constructor(e,n,r){this.ctrl=e,this.args=n,this.key=r,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:e,shared:n,ingKey:r,args:s}=this;n[r]=e._active=e.active=e._blocked=e._force=!1,e._step=[!1,!1],e.intentional=!1,e._movement=[0,0],e._distance=[0,0],e._direction=[0,0],e._delta=[0,0],e._bounds=[[-1/0,1/0],[-1/0,1/0]],e.args=s,e.axis=void 0,e.memo=void 0,e.elapsedTime=e.timeDelta=0,e.direction=[0,0],e.distance=[0,0],e.overflow=[0,0],e._movementBound=[!1,!1],e.velocity=[0,0],e.movement=[0,0],e.delta=[0,0],e.timeStamp=0}start(e){const n=this.state,r=this.config;n._active||(this.reset(),this.computeInitial(),n._active=!0,n.target=e.target,n.currentTarget=e.currentTarget,n.lastOffset=r.from?We(r.from,n):n.offset,n.offset=n.lastOffset,n.startTime=n.timeStamp=e.timeStamp)}computeValues(e){const n=this.state;n._values=e,n.values=this.config.transform(e)}computeInitial(){const e=this.state;e._initial=e._values,e.initial=e.values}compute(e){const{state:n,config:r,shared:s}=this;n.args=this.args;let i=0;if(e&&(n.event=e,r.preventDefault&&e.cancelable&&n.event.preventDefault(),n.type=e.type,s.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,s.locked=!!document.pointerLockElement,Object.assign(s,Gi(e)),s.down=s.pressed=s.buttons%2===1||s.touches>0,i=e.timeStamp-n.timeStamp,n.timeStamp=e.timeStamp,n.elapsedTime=n.timeStamp-n.startTime),n._active){const E=n._delta.map(Math.abs);L.addTo(n._distance,E)}this.axisIntent&&this.axisIntent(e);const[o,c]=n._movement,[l,a]=r.threshold,{_step:u,values:d}=n;if(r.hasCustomTransform?(u[0]===!1&&(u[0]=Math.abs(o)>=l&&d[0]),u[1]===!1&&(u[1]=Math.abs(c)>=a&&d[1])):(u[0]===!1&&(u[0]=Math.abs(o)>=l&&Math.sign(o)*l),u[1]===!1&&(u[1]=Math.abs(c)>=a&&Math.sign(c)*a)),n.intentional=u[0]!==!1||u[1]!==!1,!n.intentional)return;const f=[0,0];if(r.hasCustomTransform){const[E,M]=d;f[0]=u[0]!==!1?E-u[0]:0,f[1]=u[1]!==!1?M-u[1]:0}else f[0]=u[0]!==!1?o-u[0]:0,f[1]=u[1]!==!1?c-u[1]:0;this.restrictToAxis&&!n._blocked&&this.restrictToAxis(f);const v=n.offset,m=n._active&&!n._blocked||n.active;m&&(n.first=n._active&&!n.active,n.last=!n._active&&n.active,n.active=s[this.ingKey]=n._active,e&&(n.first&&("bounds"in r&&(n._bounds=We(r.bounds,n)),this.setup&&this.setup()),n.movement=f,this.computeOffset()));const[p,h]=n.offset,[[T,g],[w,C]]=n._bounds;n.overflow=[p<T?-1:p>g?1:0,h<w?-1:h>C?1:0],n._movementBound[0]=n.overflow[0]?n._movementBound[0]===!1?n._movement[0]:n._movementBound[0]:!1,n._movementBound[1]=n.overflow[1]?n._movementBound[1]===!1?n._movement[1]:n._movementBound[1]:!1;const P=n._active?r.rubberband||[0,0]:[0,0];if(n.offset=Di(n._bounds,n.offset,P),n.delta=L.sub(n.offset,v),this.computeMovement(),m&&(!n.last||i>Xi)){n.delta=L.sub(n.offset,v);const E=n.delta.map(Math.abs);L.addTo(n.distance,E),n.direction=n.delta.map(Math.sign),n._direction=n._delta.map(Math.sign),!n.first&&i>0&&(n.velocity=[E[0]/i,E[1]/i],n.timeDelta=i)}}emit(){const e=this.state,n=this.shared,r=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!r.triggerAllEvents)return;const s=this.handler(D(D(D({},n),e),{},{[this.aliasKey]:e.values}));s!==void 0&&(e.memo=s)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function qi([t,e],n){const r=Math.abs(t),s=Math.abs(e);if(r>s&&r>n)return"x";if(s>r&&s>n)return"y"}class Vn extends Un{constructor(...e){super(...e),$(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=L.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=L.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){const n=this.state,r=this.config;if(!n.axis&&e){const s=typeof r.axisThreshold=="object"?r.axisThreshold[Rn(e)]:r.axisThreshold;n.axis=qi(n._movement,s)}n._blocked=(r.lockDirection||!!r.axis)&&!n.axis||!!r.axis&&r.axis!==n.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":e[1]=0;break;case"y":e[0]=0;break}}}const Qi=t=>t,sn=.15,Fn={enabled(t=!0){return t},eventOptions(t,e,n){return D(D({},n.shared.eventOptions),t)},preventDefault(t=!1){return t},triggerAllEvents(t=!1){return t},rubberband(t=0){switch(t){case!0:return[sn,sn];case!1:return[0,0];default:return L.toVector(t)}},from(t){if(typeof t=="function")return t;if(t!=null)return L.toVector(t)},transform(t,e,n){const r=t||n.shared.transform;return this.hasCustomTransform=!!r,r||Qi},threshold(t){return L.toVector(t,0)}},Ji=0,pe=D(D({},Fn),{},{axis(t,e,{axis:n}){if(this.lockDirection=n==="lock",!this.lockDirection)return n},axisThreshold(t=Ji){return t},bounds(t={}){if(typeof t=="function")return i=>pe.bounds(t(i));if("current"in t)return()=>t.current;if(typeof HTMLElement=="function"&&t instanceof HTMLElement)return t;const{left:e=-1/0,right:n=1/0,top:r=-1/0,bottom:s=1/0}=t;return[[e,n],[r,s]]}}),on={ArrowRight:(t,e=1)=>[t*e,0],ArrowLeft:(t,e=1)=>[-1*t*e,0],ArrowUp:(t,e=1)=>[0,-1*t*e],ArrowDown:(t,e=1)=>[0,t*e]};class Zi extends Vn{constructor(...e){super(...e),$(this,"ingKey","dragging")}reset(){super.reset();const e=this.state;e._pointerId=void 0,e._pointerActive=!1,e._keyboardActive=!1,e._preventScroll=!1,e._delayed=!1,e.swipe=[0,0],e.tap=!1,e.canceled=!1,e.cancel=this.cancel.bind(this)}setup(){const e=this.state;if(e._bounds instanceof HTMLElement){const n=e._bounds.getBoundingClientRect(),r=e.currentTarget.getBoundingClientRect(),s={left:n.left-r.left+e.offset[0],right:n.right-r.right+e.offset[0],top:n.top-r.top+e.offset[1],bottom:n.bottom-r.bottom+e.offset[1]};e._bounds=pe.bounds(s)}}cancel(){const e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){const n=this.config,r=this.state;if(e.buttons!=null&&(Array.isArray(n.pointerButtons)?!n.pointerButtons.includes(e.buttons):n.pointerButtons!==-1&&n.pointerButtons!==e.buttons))return;const s=this.ctrl.setEventIds(e);n.pointerCapture&&e.target.setPointerCapture(e.pointerId),!(s&&s.size>1&&r._pointerActive)&&(this.start(e),this.setupPointer(e),r._pointerId=nt(e),r._pointerActive=!0,this.computeValues(en(e)),this.computeInitial(),n.preventScrollAxis&&Rn(e)!=="mouse"?(r._active=!1,this.setupScrollPrevention(e)):n.delay>0?(this.setupDelayTrigger(e),n.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){const n=this.state;n._active=!0,n._preventScroll=!0,n._delayed=!1,this.compute(e),this.emit()}pointerMove(e){const n=this.state,r=this.config;if(!n._pointerActive)return;const s=nt(e);if(n._pointerId!==void 0&&s!==n._pointerId)return;const i=en(e);if(document.pointerLockElement===e.target?n._delta=[e.movementX,e.movementY]:(n._delta=L.sub(i,n._values),this.computeValues(i)),L.addTo(n._movement,n._delta),this.compute(e),n._delayed&&n.intentional){this.timeoutStore.remove("dragDelay"),n.active=!1,this.startPointerDrag(e);return}if(r.preventScrollAxis&&!n._preventScroll)if(n.axis)if(n.axis===r.preventScrollAxis||r.preventScrollAxis==="xy"){n._active=!1,this.clean();return}else{this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(e);return}else return;this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch{}const n=this.state,r=this.config;if(!n._active||!n._pointerActive)return;const s=nt(e);if(n._pointerId!==void 0&&s!==n._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);const[i,o]=n._distance;if(n.tap=i<=r.tapsThreshold&&o<=r.tapsThreshold,n.tap&&r.filterTaps)n._force=!0;else{const[c,l]=n._delta,[a,u]=n._movement,[d,f]=r.swipe.velocity,[v,m]=r.swipe.distance,p=r.swipe.duration;if(n.elapsedTime<p){const h=Math.abs(c/n.timeDelta),T=Math.abs(l/n.timeDelta);h>d&&Math.abs(a)>v&&(n.swipe[0]=Math.sign(c)),T>f&&Math.abs(u)>m&&(n.swipe[1]=Math.sign(l))}}this.emit()}pointerClick(e){!this.state.tap&&e.detail>0&&(e.preventDefault(),e.stopPropagation())}setupPointer(e){const n=this.config,r=n.device;n.pointerLock&&e.currentTarget.requestPointerLock(),n.pointerCapture||(this.eventStore.add(this.sharedConfig.window,r,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,eo(e);const n=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",n),this.eventStore.add(this.sharedConfig.window,"touch","cancel",n),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,e)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(e)},this.config.delay)}keyDown(e){const n=on[e.key];if(n){const r=this.state,s=e.shiftKey?10:e.altKey?.1:1;this.start(e),r._delta=n(this.config.keyboardDisplacement,s),r._keyboardActive=!0,L.addTo(r._movement,r._delta),this.compute(e),this.emit()}}keyUp(e){e.key in on&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){const n=this.config.device;e(n,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(e(n,"change",this.pointerMove.bind(this)),e(n,"end",this.pointerUp.bind(this)),e(n,"cancel",this.pointerUp.bind(this)),e("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(e("key","down",this.keyDown.bind(this)),e("key","up",this.keyUp.bind(this))),this.config.filterTaps&&e("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}}function eo(t){"persist"in t&&typeof t.persist=="function"&&t.persist()}const Se=typeof window<"u"&&window.document&&window.document.createElement;function zn(){return Se&&"ontouchstart"in window}function to(){return zn()||Se&&window.navigator.maxTouchPoints>1}function no(){return Se&&"onpointerdown"in window}function ro(){return Se&&"exitPointerLock"in window.document}function so(){try{return"constructor"in GestureEvent}catch{return!1}}const N={isBrowser:Se,gesture:so(),touch:zn(),touchscreen:to(),pointer:no(),pointerLock:ro()},io=250,oo=180,ao=.5,co=50,lo=250,uo=10,an={mouse:0,touch:0,pen:8},fo=D(D({},pe),{},{device(t,e,{pointer:{touch:n=!1,lock:r=!1,mouse:s=!1}={}}){return this.pointerLock=r&&N.pointerLock,N.touch&&n?"touch":this.pointerLock?"mouse":N.pointer&&!s?"pointer":N.touch?"touch":"mouse"},preventScrollAxis(t,e,{preventScroll:n}){if(this.preventScrollDelay=typeof n=="number"?n:n||n===void 0&&t?io:void 0,!(!N.touchscreen||n===!1))return t||(n!==void 0?"y":void 0)},pointerCapture(t,e,{pointer:{capture:n=!0,buttons:r=1,keys:s=!0}={}}){return this.pointerButtons=r,this.keys=s,!this.pointerLock&&this.device==="pointer"&&n},threshold(t,e,{filterTaps:n=!1,tapsThreshold:r=3,axis:s=void 0}){const i=L.toVector(t,n?r:s?1:0);return this.filterTaps=n,this.tapsThreshold=r,i},swipe({velocity:t=ao,distance:e=co,duration:n=lo}={}){return{velocity:this.transform(L.toVector(t)),distance:this.transform(L.toVector(e)),duration:n}},delay(t=0){switch(t){case!0:return oo;case!1:return 0;default:return t}},axisThreshold(t){return t?D(D({},an),t):an},keyboardDisplacement(t=uo){return t}});function Wn(t){const[e,n]=t.overflow,[r,s]=t._delta,[i,o]=t._direction;(e<0&&r>0&&i<0||e>0&&r<0&&i>0)&&(t._movement[0]=t._movementBound[0]),(n<0&&s>0&&o<0||n>0&&s<0&&o>0)&&(t._movement[1]=t._movementBound[1])}const po=30,ho=100;class vo extends Un{constructor(...e){super(...e),$(this,"ingKey","pinching"),$(this,"aliasKey","da")}init(){this.state.offset=[1,0],this.state.lastOffset=[1,0],this.state._pointerEvents=new Map}reset(){super.reset();const e=this.state;e._touchIds=[],e.canceled=!1,e.cancel=this.cancel.bind(this),e.turns=0}computeOffset(){const{type:e,movement:n,lastOffset:r}=this.state;e==="wheel"?this.state.offset=L.add(n,r):this.state.offset=[(1+n[0])*r[0],n[1]+r[1]]}computeMovement(){const{offset:e,lastOffset:n}=this.state;this.state.movement=[e[0]/n[0],e[1]-n[1]]}axisIntent(){const e=this.state,[n,r]=e._movement;if(!e.axis){const s=Math.abs(n)*po-Math.abs(r);s<0?e.axis="angle":s>0&&(e.axis="scale")}}restrictToAxis(e){this.config.lockDirection&&(this.state.axis==="scale"?e[1]=0:this.state.axis==="angle"&&(e[0]=0))}cancel(){const e=this.state;e.canceled||setTimeout(()=>{e.canceled=!0,e._active=!1,this.compute(),this.emit()},0)}touchStart(e){this.ctrl.setEventIds(e);const n=this.state,r=this.ctrl.touchIds;if(n._active&&n._touchIds.every(i=>r.has(i))||r.size<2)return;this.start(e),n._touchIds=Array.from(r).slice(0,2);const s=Zt(e,n._touchIds);s&&this.pinchStart(e,s)}pointerStart(e){if(e.buttons!=null&&e.buttons%2!==1)return;this.ctrl.setEventIds(e),e.target.setPointerCapture(e.pointerId);const n=this.state,r=n._pointerEvents,s=this.ctrl.pointerIds;if(n._active&&Array.from(r.keys()).every(o=>s.has(o))||(r.size<2&&r.set(e.pointerId,e),n._pointerEvents.size<2))return;this.start(e);const i=vt(...Array.from(r.values()));i&&this.pinchStart(e,i)}pinchStart(e,n){const r=this.state;r.origin=n.origin,this.computeValues([n.distance,n.angle]),this.computeInitial(),this.compute(e),this.emit()}touchMove(e){if(!this.state._active)return;const n=Zt(e,this.state._touchIds);n&&this.pinchMove(e,n)}pointerMove(e){const n=this.state._pointerEvents;if(n.has(e.pointerId)&&n.set(e.pointerId,e),!this.state._active)return;const r=vt(...Array.from(n.values()));r&&this.pinchMove(e,r)}pinchMove(e,n){const r=this.state,s=r._values[1],i=n.angle-s;let o=0;Math.abs(i)>270&&(o+=Math.sign(i)),this.computeValues([n.distance,n.angle-360*o]),r.origin=n.origin,r.turns=o,r._movement=[r._values[0]/r._initial[0]-1,r._values[1]-r._initial[1]],this.compute(e),this.emit()}touchEnd(e){this.ctrl.setEventIds(e),this.state._active&&this.state._touchIds.some(n=>!this.ctrl.touchIds.has(n))&&(this.state._active=!1,this.compute(e),this.emit())}pointerEnd(e){const n=this.state;this.ctrl.setEventIds(e);try{e.target.releasePointerCapture(e.pointerId)}catch{}n._pointerEvents.has(e.pointerId)&&n._pointerEvents.delete(e.pointerId),n._active&&n._pointerEvents.size<2&&(n._active=!1,this.compute(e),this.emit())}gestureStart(e){e.cancelable&&e.preventDefault();const n=this.state;n._active||(this.start(e),this.computeValues([e.scale,e.rotation]),n.origin=[e.clientX,e.clientY],this.compute(e),this.emit())}gestureMove(e){if(e.cancelable&&e.preventDefault(),!this.state._active)return;const n=this.state;this.computeValues([e.scale,e.rotation]),n.origin=[e.clientX,e.clientY];const r=n._movement;n._movement=[e.scale-1,e.rotation],n._delta=L.sub(n._movement,r),this.compute(e),this.emit()}gestureEnd(e){this.state._active&&(this.state._active=!1,this.compute(e),this.emit())}wheel(e){const n=this.config.modifierKey;n&&(Array.isArray(n)?!n.find(r=>e[r]):!e[n])||(this.state._active?this.wheelChange(e):this.wheelStart(e),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this)))}wheelStart(e){this.start(e),this.wheelChange(e)}wheelChange(e){"uv"in e||e.cancelable&&e.preventDefault();const r=this.state;r._delta=[-$n(e)[1]/ho*r.offset[0],0],L.addTo(r._movement,r._delta),Wn(r),this.state.origin=[e.clientX,e.clientY],this.compute(e),this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){const n=this.config.device;n&&(e(n,"start",this[n+"Start"].bind(this)),e(n,"change",this[n+"Move"].bind(this)),e(n,"end",this[n+"End"].bind(this)),e(n,"cancel",this[n+"End"].bind(this)),e("lostPointerCapture","",this[n+"End"].bind(this))),this.config.pinchOnWheel&&e("wheel","",this.wheel.bind(this),{passive:!1})}}const mo=D(D({},Fn),{},{device(t,e,{shared:n,pointer:{touch:r=!1}={}}){if(n.target&&!N.touch&&N.gesture)return"gesture";if(N.touch&&r)return"touch";if(N.touchscreen){if(N.pointer)return"pointer";if(N.touch)return"touch"}},bounds(t,e,{scaleBounds:n={},angleBounds:r={}}){const s=o=>{const c=rn(We(n,o),{min:-1/0,max:1/0});return[c.min,c.max]},i=o=>{const c=rn(We(r,o),{min:-1/0,max:1/0});return[c.min,c.max]};return typeof n!="function"&&typeof r!="function"?[s(),i()]:o=>[s(o),i(o)]},threshold(t,e,n){return this.lockDirection=n.axis==="lock",L.toVector(t,this.lockDirection?[.1,3]:0)},modifierKey(t){return t===void 0?"ctrlKey":t},pinchOnWheel(t=!0){return t}});D(D({},pe),{},{mouseOnly:(t=!0)=>t});class go extends Vn{constructor(...e){super(...e),$(this,"ingKey","wheeling")}wheel(e){this.state._active||this.start(e),this.wheelChange(e),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this))}wheelChange(e){const n=this.state;n._delta=$n(e),L.addTo(n._movement,n._delta),Wn(n),this.compute(e),this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){e("wheel","",this.wheel.bind(this))}}const _o=pe;D(D({},pe),{},{mouseOnly:(t=!0)=>t});const Nn=new Map,mt=new Map;function Ot(t){Nn.set(t.key,t.engine),mt.set(t.key,t.resolver)}const yo={key:"drag",engine:Zi,resolver:fo},bo={key:"pinch",engine:vo,resolver:mo},wo={key:"wheel",engine:go,resolver:_o};function Eo(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}function xo(t,e){if(t==null)return{};var n=Eo(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}const So={target(t){if(t)return()=>"current"in t?t.current:t},enabled(t=!0){return t},window(t=N.isBrowser?window:void 0){return t},eventOptions({passive:t=!0,capture:e=!1}={}){return{passive:t,capture:e}},transform(t){return t}},To=["target","eventOptions","window","enabled","transform"];function Ue(t={},e){const n={};for(const[r,s]of Object.entries(e))switch(typeof s){case"function":n[r]=s.call(n,t[r],r,t);break;case"object":n[r]=Ue(t[r],s);break;case"boolean":s&&(n[r]=t[r]);break}return n}function Po(t,e,n={}){const r=t,{target:s,eventOptions:i,window:o,enabled:c,transform:l}=r,a=xo(r,To);if(n.shared=Ue({target:s,eventOptions:i,window:o,enabled:c,transform:l},So),e){const u=mt.get(e);n[e]=Ue(D({shared:n.shared},a),u)}else for(const u in a){const d=mt.get(u);d&&(n[u]=Ue(D({shared:n.shared},a[u]),d))}return n}class Kn{constructor(e,n){$(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=n}add(e,n,r,s,i){const o=this._listeners,c=zi(n,r),l=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},a=D(D({},l),i);e.addEventListener(c,s,a);const u=()=>{e.removeEventListener(c,s,a),o.delete(u)};return o.add(u),u}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}}class Mo{constructor(){$(this,"_timeouts",new Map)}add(e,n,r=140,...s){this.remove(e),this._timeouts.set(e,window.setTimeout(n,r,...s))}remove(e){const n=this._timeouts.get(e);n&&window.clearTimeout(n)}clean(){this._timeouts.forEach(e=>{window.clearTimeout(e)}),this._timeouts.clear()}}class Co{constructor(e){$(this,"gestures",new Set),$(this,"_targetEventStore",new Kn(this)),$(this,"gestureEventStores",{}),$(this,"gestureTimeoutStores",{}),$(this,"handlers",{}),$(this,"config",{}),$(this,"pointerIds",new Set),$(this,"touchIds",new Set),$(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),Oo(this,e)}setEventIds(e){if(Ye(e))return this.touchIds=new Set(Ki(e)),this.touchIds;if("pointerId"in e)return e.type==="pointerup"||e.type==="pointercancel"?this.pointerIds.delete(e.pointerId):e.type==="pointerdown"&&this.pointerIds.add(e.pointerId),this.pointerIds}applyHandlers(e,n){this.handlers=e,this.nativeHandlers=n}applyConfig(e,n){this.config=Po(e,n,this.config)}clean(){this._targetEventStore.clean();for(const e of this.gestures)this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){const n=this.config.shared,r={};let s;if(!(n.target&&(s=n.target(),!s))){if(n.enabled){for(const o of this.gestures){const c=this.config[o],l=cn(r,c.eventOptions,!!s);if(c.enabled){const a=Nn.get(o);new a(this,e,o).bind(l)}}const i=cn(r,n.eventOptions,!!s);for(const o in this.nativeHandlers)i(o,"",c=>this.nativeHandlers[o](D(D({},this.state.shared),{},{event:c,args:e})),void 0,!0)}for(const i in r)r[i]=Hi(...r[i]);if(!s)return r;for(const i in r){const{device:o,capture:c,passive:l}=Fi(i);this._targetEventStore.add(s,o,"",r[i],{capture:c,passive:l})}}}}function ue(t,e){t.gestures.add(e),t.gestureEventStores[e]=new Kn(t,e),t.gestureTimeoutStores[e]=new Mo}function Oo(t,e){e.drag&&ue(t,"drag"),e.wheel&&ue(t,"wheel"),e.scroll&&ue(t,"scroll"),e.move&&ue(t,"move"),e.pinch&&ue(t,"pinch"),e.hover&&ue(t,"hover")}const cn=(t,e,n)=>(r,s,i,o={},c=!1)=>{var l,a;const u=(l=o.capture)!==null&&l!==void 0?l:e.capture,d=(a=o.passive)!==null&&a!==void 0?a:e.passive;let f=c?r:Ui(r,s,u);n&&d&&(f+="Passive"),t[f]=t[f]||[],t[f].push(i)};function Ao(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ko(t){var e=Ao(t,"string");return typeof e=="symbol"?e:String(e)}function jo(t,e,n){return e=ko(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ln(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Ie(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};
1e%2?ln(Object(n),!0).forEach(function(r){jo(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ln(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}class At{constructor(e,n,r,s,i){this._target=e,this._gestureKey=s,this._ctrl=new Co(n),this._ctrl.applyHandlers(n,i),this._ctrl.applyConfig(Ie(Ie({},r),{},{target:e}),s),this._ctrl.effect()}destroy(){this._ctrl.clean()}setConfig(e){this._ctrl.clean(),this._ctrl.applyConfig(Ie(Ie({},e),{},{target:this._target}),this._gestureKey),this._ctrl.effect()}}const Qo=function(e,n,r){return Ot(yo),new At(e,{drag:n},r||{},"drag")},Jo=function(e,n,r){return Ot(bo),new At(e,{pinch:n},r||{},"pinch")},Zo=function(e,n,r){return Ot(wo),new At(e,{wheel:n},r||{},"wheel")},Io={class:"media"},Do=["src","alt"],ea={__name:"LazySimple",props:{image:{type:String,required:!0},altText:{type:String,default:""}},setup(t){const e=S(!1);return(n,r)=>(Ke(),bt("figure",Io,[Et(n.$slots,"default"),wr("img",{src:t.image,alt:t.altText,onLoad:r[0]||(r[0]=s=>e.value=!0),class:wt(["media__image",{"is-loaded":q(e)}]),draggable:"false"},null,42,Do)]))}};var rt,un;function Lo(){if(un)return rt;un=1;function t(e,n,r){return e*(1-r)+n*r}return rt=t,rt}var st,fn;function Ro(){if(fn)return st;fn=1;const t=Lo();function e(n,r,s,i,o=60){if(typeof i>"u")return t(n,r,s);const c=i/(1/o),l=1-s;return t(n,r,1-Math.pow(l,c))}return st=e,st}var Bo=Ro();const $o=Er(Bo),ta={__name:"Carousel",props:{toggle:{type:Boolean,default:!1}},setup(t,{expose:e}){const n=t,r=xr(),s=Sr(),{$resize:i,$event:o}=r,c=G(()=>!i.mouse),l=S(null),a=S(2),u=S(0),d=S(0),f=S(0),v=S(0),m=S(0),p=S(0),h=S(0),T=S(0),g=S(0),w=S(!1),C=S(!1),P=S(!1),E=S(null),M=S({});let O,_,x;const R=()=>{C.value=!0;const b=Pr(".js-slide",l.value);if(!b.length)return;const A=Mr(".js-slides",l.value),k=Oe(A);x=Oe(l.value);const oe=b.length-1,re=k.left-x.left,{small:Yn}=i;a.value=Yn?3.5:2,O=[],E.value?E.value.forEach((F,qe)=>{F.xSet(0);const{left:ve,right:Ce,width:Qe}=Oe(F.el);F.start=ve-x.left,F.end=Ce-x.left,F.width=Qe,F.out=!0,O.push(ve-k.left),qe===oe&&U(F.el,F.end,re)}):E.value=b.map((F,qe)=>{const ve=X.quickSetter(F,"x","px");ve(0);const{left:Ce,right:Qe,width:Hn}=Oe(F),Xn=Ce-x.left,kt=Qe-x.left;return O.push(Ce-k.left),qe===oe&&U(F,kt,re),{el:F,xSet:ve,start:Xn,end:kt,width:Hn,out:!0}}),I(),ot(()=>C.value=!1)},U=(b,A,k)=>{T.value=parseInt(getComputedStyle(b).getPropertyValue("margin-right")),h.value=Math.max(0,A+T.value-k)},B=b=>{const A=b.changedTouches?b.changedTouches[0].clientX:b.clientX,k=b.changedTouches?b.changedTouches[0].clientY:b.clientY;return{x:A,y:k}},z=b=>{const{x:A,y:k}=B(b);w.value=!0,d.value=A,f.value=k,v.value=A,u.value=m.value+A*a.value},V=b=>{if(!w.value)return;const{x:A,y:k}=B(b);Math.abs(A-d.value)>Math.abs(k-f.value)&&b.cancelable&&(b.preventDefault(),b.stopPropagation()),m.value=u.value-A*a.value},Z=b=>{if(!w.value)return;w.value=!1;const{x:A}=B(b);if(Math.abs(A-v.value)<10){const k=b.target.closest("[data-key], [data-modal]");if(!k||!l.value.contains(k))return;k.dataset.key?o.emit("slide:click",k.dataset.key):k.dataset.modal&&s.setModal(!0)}else Te()},Te=()=>{if(!ne()){m.value=X.utils.snap(O,X.utils.clamp(0,y(),m.value)),g.value=Math.max(0,O.indexOf(m.value)),o.emit("carousel:snap",g.value);return}const b=X.utils.wrap(0,h.value,m.value),A=X.utils.snap(O,b),k=A-b;m.value+=k,g.value=O.indexOf(A),o.emit("carousel:snap",g.value)},Pe=(b=0)=>{if(!ne()){m.value=O[b]??0,g.value=b;return}const A=O[b]-X.utils.wrap(0,h.value,m.value);m.value+=A,g.value=b},he=({ratio:b})=>{n.toggle&&!P.value||(p.value=$o(p.value,m.value,.1*b),p.value=Math.round(p.value*100)/100,I())},ne=()=>(E.value?.length??0)>2,y=()=>O?.length?O[O.length-1]:0,I=()=>{if(!ne()){const b=X.utils.clamp(0,y(),p.value);E.value?.forEach(A=>A.xSet(-b));return}E.value?.forEach(b=>{const{start:A,end:k,xSet:oe}=b,re=X.utils.wrap(-(h.value-k),k,p.value);Y(A,k,re)||C.value?(b.out&&(b.out=!1),oe(-re)):b.out||(b.out=!0,oe(-re))})},Y=(b,A,k)=>{const oe=b-k,re=A-k;return oe<x.width&&re>0},ie=()=>{M.value={move:c.value?"touchmove":"mousemove",down:c.value?"touchstart":"mousedown",up:c.value?"touchend":"mou
1seup"}},Me=()=>{if(console.log("CAROUSEL: NEXT"),!E.value)return;const b=E.value[g.value];if(!b)return;if(!ne()){g.value=Math.min(g.value+1,E.value.length-1),m.value=O[g.value];return}const A=b.width;m.value+=A+T.value,g.value=X.utils.wrap(0,E.value.length,g.value+1)},He=()=>{if(console.log("CAROUSEL: PREVIOUS"),!E.value)return;const b=E.value[g.value];if(!b)return;if(!ne()){g.value=Math.max(g.value-1,0),m.value=O[g.value];return}const A=b.width;m.value-=A+T.value,g.value=X.utils.wrap(0,E.value.length,g.value-1)},Xe=()=>{ie(),l.value?.addEventListener(M.value.down,z),l.value?.addEventListener(M.value.move,V),window.addEventListener(M.value.up,Z),i.add(R),o.on("tick",he),console.log("draggable: bindEvents")},Gn=()=>{l.value?.removeEventListener(M.value.down,z),l.value?.removeEventListener(M.value.move,V),window.removeEventListener(M.value.up,Z),i.remove(R),o.off("tick",he),console.log("draggable: unbindEvents")};return de(async()=>{await ot(),n.toggle&&(_=Tr.create({trigger:l.value,onToggle:({isActive:b})=>P.value=b})),Xe()}),_n(()=>{Gn(),_?.kill()}),e({next:Me,previous:He,goto:Pe,idx:g}),(b,A)=>(Ke(),bt("div",{ref_key:"el",ref:l,class:wt(["select-none cursor-grab",q(w)&&"is-active"])},[Et(b.$slots,"default")],2))}};export{Qo as D,Jo as P,Zo as W,Fo as _,Xo as a,qo as b,zo as c,Wo as d,xi as e,ea as f,No as g,ta as h,Yo as i,Ho as j,Go as k,$o as l,Ci as p,Ht as r,Ko as u};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.