const jp=function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const r of o.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&i(r)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerpolicy&&(o.referrerPolicy=s.referrerpolicy),s.crossorigin==="use-credentials"?o.credentials="include":s.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}};jp();function Uc(t,e){const n=Object.create(null),i=t.split(",");for(let s=0;s!!n[s.toLowerCase()]:s=>!!n[s]}const Yp="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",qp=Uc(Yp);function Vh(t){return!!t||t===""}function uo(t){if(He(t)){const e={};for(let n=0;n{if(n){const i=n.split(Kp);i.length>1&&(e[i[0].trim()]=i[1].trim())}}),e}function je(t){let e="";if(zt(t))e=t;else if(He(t))for(let n=0;nlr(n,e))}const ze=t=>zt(t)?t:t==null?"":He(t)||Lt(t)&&(t.toString===Gh||!nt(t.toString))?JSON.stringify(t,Hh,2):String(t),Hh=(t,e)=>e&&e.__v_isRef?Hh(t,e.value):Ys(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((n,[i,s])=>(n[`${i} =>`]=s,n),{})}:ho(e)?{[`Set(${e.size})`]:[...e.values()]}:Lt(e)&&!He(e)&&!Wh(e)?String(e):e,Mt={},js=[],kn=()=>{},tm=()=>!1,nm=/^on[^a-z]/,va=t=>nm.test(t),Oc=t=>t.startsWith("onUpdate:"),jt=Object.assign,Nc=(t,e)=>{const n=t.indexOf(e);n>-1&&t.splice(n,1)},im=Object.prototype.hasOwnProperty,dt=(t,e)=>im.call(t,e),He=Array.isArray,Ys=t=>cr(t)==="[object Map]",ho=t=>cr(t)==="[object Set]",Ad=t=>cr(t)==="[object Date]",nt=t=>typeof t=="function",zt=t=>typeof t=="string",Yo=t=>typeof t=="symbol",Lt=t=>t!==null&&typeof t=="object",$h=t=>Lt(t)&&nt(t.then)&&nt(t.catch),Gh=Object.prototype.toString,cr=t=>Gh.call(t),sm=t=>cr(t).slice(8,-1),Wh=t=>cr(t)==="[object Object]",zc=t=>zt(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,Yr=Uc(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),ba=t=>{const e=Object.create(null);return n=>e[n]||(e[n]=t(n))},om=/-(\w)/g,Qn=ba(t=>t.replace(om,(e,n)=>n?n.toUpperCase():"")),rm=/\B([A-Z])/g,bs=ba(t=>t.replace(rm,"-$1").toLowerCase()),ya=ba(t=>t.charAt(0).toUpperCase()+t.slice(1)),Ba=ba(t=>t?`on${ya(t)}`:""),qo=(t,e)=>!Object.is(t,e),qr=(t,e)=>{for(let n=0;n{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:n})},Zo=t=>{const e=parseFloat(t);return isNaN(e)?t:e};let Pd;const am=()=>Pd||(Pd=typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{});let Wn;class lm{constructor(e=!1){this.active=!0,this.effects=[],this.cleanups=[],!e&&Wn&&(this.parent=Wn,this.index=(Wn.scopes||(Wn.scopes=[])).push(this)-1)}run(e){if(this.active){const n=Wn;try{return Wn=this,e()}finally{Wn=n}}}on(){Wn=this}off(){Wn=this.parent}stop(e){if(this.active){let n,i;for(n=0,i=this.effects.length;n{const e=new Set(t);return e.w=0,e.n=0,e},Xh=t=>(t.w&ki)>0,jh=t=>(t.n&ki)>0,dm=({deps:t})=>{if(t.length)for(let e=0;e{const{deps:e}=t;if(e.length){let n=0;for(let i=0;i{(d==="length"||d>=i)&&a.push(l)});else switch(n!==void 0&&a.push(r.get(n)),e){case"add":He(t)?zc(n)&&a.push(r.get("length")):(a.push(r.get(ps)),Ys(t)&&a.push(r.get(Rl)));break;case"delete":He(t)||(a.push(r.get(ps)),Ys(t)&&a.push(r.get(Rl)));break;case"set":Ys(t)&&a.push(r.get(ps));break}if(a.length===1)a[0]&&Dl(a[0]);else{const l=[];for(const d of a)d&&l.push(...d);Dl(kc(l))}}function Dl(t,e){const n=He(t)?t:[...t];for(const i of n)i.computed&&Dd(i);for(const i of n)i.computed||Dd(i)}function Dd(t,e){(t!==Ln||t.allowRecurse)&&(t.scheduler?t.scheduler():t.run())}const hm=Uc("__proto__,__v_isRef,__isVue"),Zh=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(Yo)),fm=Vc(),pm=Vc(!1,!0),mm=Vc(!0),Id=_m();function _m(){const t={};return["includes","indexOf","lastIndexOf"].forEach(e=>{t[e]=function(...n){const i=pt(this);for(let o=0,r=this.length;o{t[e]=function(...n){fo();const i=pt(this)[e].apply(this,n);return po(),i}}),t}function Vc(t=!1,e=!1){return function(i,s,o){if(s==="__v_isReactive")return!t;if(s==="__v_isReadonly")return t;if(s==="__v_isShallow")return e;if(s==="__v_raw"&&o===(t?e?Im:tf:e?ef:Qh).get(i))return i;const r=He(i);if(!t&&r&&dt(Id,s))return Reflect.get(Id,s,o);const a=Reflect.get(i,s,o);return(Yo(s)?Zh.has(s):hm(s))||(t||vn(i,"get",s),e)?a:Qt(a)?r&&zc(s)?a:a.value:Lt(a)?t?nf(a):dr(a):a}}const gm=Kh(),vm=Kh(!0);function Kh(t=!1){return function(n,i,s,o){let r=n[i];if(Ko(r)&&Qt(r)&&!Qt(s))return!1;if(!t&&!Ko(s)&&(Il(s)||(s=pt(s),r=pt(r)),!He(n)&&Qt(r)&&!Qt(s)))return r.value=s,!0;const a=He(n)&&zc(i)?Number(i)t,xa=t=>Reflect.getPrototypeOf(t);function _r(t,e,n=!1,i=!1){t=t.__v_raw;const s=pt(t),o=pt(e);n||(e!==o&&vn(s,"get",e),vn(s,"get",o));const{has:r}=xa(s),a=i?Hc:n?Wc:Jo;if(r.call(s,e))return a(t.get(e));if(r.call(s,o))return a(t.get(o));t!==s&&t.get(e)}function gr(t,e=!1){const n=this.__v_raw,i=pt(n),s=pt(t);return e||(t!==s&&vn(i,"has",t),vn(i,"has",s)),t===s?n.has(t):n.has(t)||n.has(s)}function vr(t,e=!1){return t=t.__v_raw,!e&&vn(pt(t),"iterate",ps),Reflect.get(t,"size",t)}function Ld(t){t=pt(t);const e=pt(this);return xa(e).has.call(e,t)||(e.add(t),pi(e,"add",t,t)),this}function Ud(t,e){e=pt(e);const n=pt(this),{has:i,get:s}=xa(n);let o=i.call(n,t);o||(t=pt(t),o=i.call(n,t));const r=s.call(n,t);return n.set(t,e),o?qo(e,r)&&pi(n,"set",t,e):pi(n,"add",t,e),this}function Fd(t){const e=pt(this),{has:n,get:i}=xa(e);let s=n.call(e,t);s||(t=pt(t),s=n.call(e,t)),i&&i.call(e,t);const o=e.delete(t);return s&&pi(e,"delete",t,void 0),o}function Od(){const t=pt(this),e=t.size!==0,n=t.clear();return e&&pi(t,"clear",void 0,void 0),n}function br(t,e){return function(i,s){const o=this,r=o.__v_raw,a=pt(r),l=e?Hc:t?Wc:Jo;return!t&&vn(a,"iterate",ps),r.forEach((d,u)=>i.call(s,l(d),l(u),o))}}function yr(t,e,n){return function(...i){const s=this.__v_raw,o=pt(s),r=Ys(o),a=t==="entries"||t===Symbol.iterator&&r,l=t==="keys"&&r,d=s[t](...i),u=n?Hc:e?Wc:Jo;return!e&&vn(o,"iterate",l?Rl:ps),{next(){const{value:f,done:h}=d.next();return h?{value:f,done:h}:{value:a?[u(f[0]),u(f[1])]:u(f),done:h}},[Symbol.iterator](){return this}}}}function _i(t){return function(...e){return t==="delete"?!1:this}}function Em(){const t={get(o){return _r(this,o)},get size(){return vr(this)},has:gr,add:Ld,set:Ud,delete:Fd,clear:Od,forEach:br(!1,!1)},e={get(o){return _r(this,o,!1,!0)},get size(){return vr(this)},has:gr,add:Ld,set:Ud,delete:Fd,clear:Od,forEach:br(!1,!0)},n={get(o){return _r(this,o,!0)},get size(){return vr(this,!0)},has(o){return gr.call(this,o,!0)},add:_i("add"),set:_i("set"),delete:_i("delete"),clear:_i("clear"),forEach:br(!0,!1)},i={get(o){return _r(this,o,!0,!0)},get size(){return vr(this,!0)},has(o){return gr.call(this,o,!0)},add:_i("add"),set:_i("set"),delete:_i("delete"),clear:_i("clear"),forEach:br(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(o=>{t[o]=yr(o,!1,!1),n[o]=yr(o,!0,!1),e[o]=yr(o,!1,!0),i[o]=yr(o,!0,!0)}),[t,n,e,i]}const[wm,Tm,Cm,Am]=Em();function $c(t,e){const n=e?t?Am:Cm:t?Tm:wm;return(i,s,o)=>s==="__v_isReactive"?!t:s==="__v_isReadonly"?t:s==="__v_raw"?i:Reflect.get(dt(n,s)&&s in i?n:i,s,o)}const Pm={get:$c(!1,!1)},Rm={get:$c(!1,!0)},Dm={get:$c(!0,!1)},Qh=new WeakMap,ef=new WeakMap,tf=new WeakMap,Im=new WeakMap;function Lm(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Um(t){return t.__v_skip||!Object.isExtensible(t)?0:Lm(sm(t))}function dr(t){return Ko(t)?t:Gc(t,!1,Jh,Pm,Qh)}function Fm(t){return Gc(t,!1,Mm,Rm,ef)}function nf(t){return Gc(t,!0,Sm,Dm,tf)}function Gc(t,e,n,i,s){if(!Lt(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const o=s.get(t);if(o)return o;const r=Um(t);if(r===0)return t;const a=new Proxy(t,r===2?i:n);return s.set(t,a),a}function qs(t){return Ko(t)?qs(t.__v_raw):!!(t&&t.__v_isReactive)}function Ko(t){return!!(t&&t.__v_isReadonly)}function Il(t){return!!(t&&t.__v_isShallow)}function sf(t){return qs(t)||Ko(t)}function pt(t){const e=t&&t.__v_raw;return e?pt(e):t}function of(t){return ra(t,"__v_skip",!0),t}const Jo=t=>Lt(t)?dr(t):t,Wc=t=>Lt(t)?nf(t):t;function rf(t){Ui&&Ln&&(t=pt(t),qh(t.dep||(t.dep=kc())))}function af(t,e){t=pt(t),t.dep&&Dl(t.dep)}function Qt(t){return!!(t&&t.__v_isRef===!0)}function lf(t){return df(t,!1)}function cf(t){return df(t,!0)}function df(t,e){return Qt(t)?t:new Om(t,e)}class Om{constructor(e,n){this.__v_isShallow=n,this.dep=void 0,this.__v_isRef=!0,this._rawValue=n?e:pt(e),this._value=n?e:Jo(e)}get value(){return rf(this),this._value}set value(e){e=this.__v_isShallow?e:pt(e),qo(e,this._rawValue)&&(this._rawValue=e,this._value=this.__v_isShallow?e:Jo(e),af(this))}}function zo(t){return Qt(t)?t.value:t}const Nm={get:(t,e,n)=>zo(Reflect.get(t,e,n)),set:(t,e,n,i)=>{const s=t[e];return Qt(s)&&!Qt(n)?(s.value=n,!0):Reflect.set(t,e,n,i)}};function uf(t){return qs(t)?t:new Proxy(t,Nm)}class zm{constructor(e,n,i,s){this._setter=n,this.dep=void 0,this.__v_isRef=!0,this._dirty=!0,this.effect=new Bc(e,()=>{this._dirty||(this._dirty=!0,af(this))}),this.effect.computed=this,this.effect.active=this._cacheable=!s,this.__v_isReadonly=i}get value(){const e=pt(this);return rf(e),(e._dirty||!e._cacheable)&&(e._dirty=!1,e._value=e.effect.run()),e._value}set value(e){this._setter(e)}}function km(t,e,n=!1){let i,s;const o=nt(t);return o?(i=t,s=kn):(i=t.get,s=t.set),new zm(i,s,o||!s,n)}function Fi(t,e,n,i){let s;try{s=i?t(...i):t()}catch(o){Sa(o,e,n)}return s}function wn(t,e,n,i){if(nt(t)){const o=Fi(t,e,n,i);return o&&$h(o)&&o.catch(r=>{Sa(r,e,n)}),o}const s=[];for(let o=0;o>>1;Qo(gn[i])di&&gn.splice(e,1)}function _f(t,e,n,i){He(t)?n.push(...t):(!e||!e.includes(t,t.allowRecurse?i+1:i))&&n.push(t),mf()}function $m(t){_f(t,Lo,ko,Bs)}function Gm(t){_f(t,Ai,Bo,Vs)}function Ma(t,e=null){if(ko.length){for(Ul=e,Lo=[...new Set(ko)],ko.length=0,Bs=0;BsQo(n)-Qo(i)),Vs=0;Vst.id==null?1/0:t.id;function vf(t){Ll=!1,aa=!0,Ma(t),gn.sort((n,i)=>Qo(n)-Qo(i));const e=kn;try{for(di=0;dim.trim())),f&&(s=n.map(Zo))}let a,l=i[a=Ba(e)]||i[a=Ba(Qn(e))];!l&&o&&(l=i[a=Ba(bs(e))]),l&&wn(l,t,6,s);const d=i[a+"Once"];if(d){if(!t.emitted)t.emitted={};else if(t.emitted[a])return;t.emitted[a]=!0,wn(d,t,6,s)}}function bf(t,e,n=!1){const i=e.emitsCache,s=i.get(t);if(s!==void 0)return s;const o=t.emits;let r={},a=!1;if(!nt(t)){const l=d=>{const u=bf(d,e,!0);u&&(a=!0,jt(r,u))};!n&&e.mixins.length&&e.mixins.forEach(l),t.extends&&l(t.extends),t.mixins&&t.mixins.forEach(l)}return!o&&!a?(i.set(t,null),null):(He(o)?o.forEach(l=>r[l]=null):jt(r,o),i.set(t,r),r)}function Ea(t,e){return!t||!va(e)?!1:(e=e.slice(2).replace(/Once$/,""),dt(t,e[0].toLowerCase()+e.slice(1))||dt(t,bs(e))||dt(t,e))}let en=null,wa=null;function la(t){const e=en;return en=t,wa=t&&t.type.__scopeId||null,e}function Xm(t){wa=t}function jm(){wa=null}function Ct(t,e=en,n){if(!e||t._n)return t;const i=(...s)=>{i._d&&jd(-1);const o=la(e),r=t(...s);return la(o),i._d&&jd(1),r};return i._n=!0,i._c=!0,i._d=!0,i}function Va(t){const{type:e,vnode:n,proxy:i,withProxy:s,props:o,propsOptions:[r],slots:a,attrs:l,emit:d,render:u,renderCache:f,data:h,setupState:m,ctx:b,inheritAttrs:y}=t;let _,p;const T=la(t);try{if(n.shapeFlag&4){const S=s||i;_=Xn(u.call(S,S,f,o,m,h,b)),p=l}else{const S=e;_=Xn(S.length>1?S(o,{attrs:l,slots:a,emit:d}):S(o,null)),p=e.props?l:Ym(l)}}catch(S){$o.length=0,Sa(S,t,1),_=ke(Tn)}let w=_;if(p&&y!==!1){const S=Object.keys(p),{shapeFlag:I}=w;S.length&&I&7&&(r&&S.some(Oc)&&(p=qm(p,r)),w=Bi(w,p))}return n.dirs&&(w=Bi(w),w.dirs=w.dirs?w.dirs.concat(n.dirs):n.dirs),n.transition&&(w.transition=n.transition),_=w,la(T),_}const Ym=t=>{let e;for(const n in t)(n==="class"||n==="style"||va(n))&&((e||(e={}))[n]=t[n]);return e},qm=(t,e)=>{const n={};for(const i in t)(!Oc(i)||!(i.slice(9)in e))&&(n[i]=t[i]);return n};function Zm(t,e,n){const{props:i,children:s,component:o}=t,{props:r,children:a,patchFlag:l}=e,d=o.emitsOptions;if(e.dirs||e.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return i?Nd(i,r,d):!!r;if(l&8){const u=e.dynamicProps;for(let f=0;ft.__isSuspense;function Qm(t,e){e&&e.pendingBranch?He(t)?e.effects.push(...t):e.effects.push(t):Gm(t)}function Zr(t,e){if($t){let n=$t.provides;const i=$t.parent&&$t.parent.provides;i===n&&(n=$t.provides=Object.create(i)),n[t]=e}}function Oi(t,e,n=!1){const i=$t||en;if(i){const s=i.parent==null?i.vnode.appContext&&i.vnode.appContext.provides:i.parent.provides;if(s&&t in s)return s[t];if(arguments.length>1)return n&&nt(e)?e.call(i.proxy):e}}const zd={};function Vo(t,e,n){return yf(t,e,n)}function yf(t,e,{immediate:n,deep:i,flush:s,onTrack:o,onTrigger:r}=Mt){const a=$t;let l,d=!1,u=!1;if(Qt(t)?(l=()=>t.value,d=Il(t)):qs(t)?(l=()=>t,i=!0):He(t)?(u=!0,d=t.some(p=>qs(p)||Il(p)),l=()=>t.map(p=>{if(Qt(p))return p.value;if(qs(p))return us(p);if(nt(p))return Fi(p,a,2)})):nt(t)?e?l=()=>Fi(t,a,2):l=()=>{if(!(a&&a.isUnmounted))return f&&f(),wn(t,a,3,[h])}:l=kn,e&&i){const p=l;l=()=>us(p())}let f,h=p=>{f=_.onStop=()=>{Fi(p,a,4)}};if(tr)return h=kn,e?n&&wn(e,a,3,[l(),u?[]:void 0,h]):l(),kn;let m=u?[]:zd;const b=()=>{if(!!_.active)if(e){const p=_.run();(i||d||(u?p.some((T,w)=>qo(T,m[w])):qo(p,m)))&&(f&&f(),wn(e,a,3,[p,m===zd?void 0:m,h]),m=p)}else _.run()};b.allowRecurse=!!e;let y;s==="sync"?y=b:s==="post"?y=()=>dn(b,a&&a.suspense):y=()=>$m(b);const _=new Bc(l,y);return e?n?b():m=_.run():s==="post"?dn(_.run.bind(_),a&&a.suspense):_.run(),()=>{_.stop(),a&&a.scope&&Nc(a.scope.effects,_)}}function e_(t,e,n){const i=this.proxy,s=zt(t)?t.includes(".")?xf(i,t):()=>i[t]:t.bind(i,i);let o;nt(e)?o=e:(o=e.handler,n=e);const r=$t;eo(this);const a=yf(s,o.bind(i),n);return r?eo(r):ms(),a}function xf(t,e){const n=e.split(".");return()=>{let i=t;for(let s=0;s{us(n,e)});else if(Wh(t))for(const n in t)us(t[n],e);return t}function t_(){const t={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Tf(()=>{t.isMounted=!0}),Cf(()=>{t.isUnmounting=!0}),t}const xn=[Function,Array],n_={name:"BaseTransition",props:{mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:xn,onEnter:xn,onAfterEnter:xn,onEnterCancelled:xn,onBeforeLeave:xn,onLeave:xn,onAfterLeave:xn,onLeaveCancelled:xn,onBeforeAppear:xn,onAppear:xn,onAfterAppear:xn,onAppearCancelled:xn},setup(t,{slots:e}){const n=O_(),i=t_();let s;return()=>{const o=e.default&&Ef(e.default(),!0);if(!o||!o.length)return;let r=o[0];if(o.length>1){for(const y of o)if(y.type!==Tn){r=y;break}}const a=pt(t),{mode:l}=a;if(i.isLeaving)return Ha(r);const d=kd(r);if(!d)return Ha(r);const u=Fl(d,a,i,n);Ol(d,u);const f=n.subTree,h=f&&kd(f);let m=!1;const{getTransitionKey:b}=d.type;if(b){const y=b();s===void 0?s=y:y!==s&&(s=y,m=!0)}if(h&&h.type!==Tn&&(!rs(d,h)||m)){const y=Fl(h,a,i,n);if(Ol(h,y),l==="out-in")return i.isLeaving=!0,y.afterLeave=()=>{i.isLeaving=!1,n.update()},Ha(r);l==="in-out"&&d.type!==Tn&&(y.delayLeave=(_,p,T)=>{const w=Mf(i,h);w[String(h.key)]=h,_._leaveCb=()=>{p(),_._leaveCb=void 0,delete u.delayedLeave},u.delayedLeave=T})}return r}}},Sf=n_;function Mf(t,e){const{leavingVNodes:n}=t;let i=n.get(e.type);return i||(i=Object.create(null),n.set(e.type,i)),i}function Fl(t,e,n,i){const{appear:s,mode:o,persisted:r=!1,onBeforeEnter:a,onEnter:l,onAfterEnter:d,onEnterCancelled:u,onBeforeLeave:f,onLeave:h,onAfterLeave:m,onLeaveCancelled:b,onBeforeAppear:y,onAppear:_,onAfterAppear:p,onAppearCancelled:T}=e,w=String(t.key),S=Mf(n,t),I=(R,E)=>{R&&wn(R,i,9,E)},P=(R,E)=>{const g=E[1];I(R,E),He(R)?R.every(L=>L.length<=1)&&g():R.length<=1&&g()},D={mode:o,persisted:r,beforeEnter(R){let E=a;if(!n.isMounted)if(s)E=y||a;else return;R._leaveCb&&R._leaveCb(!0);const g=S[w];g&&rs(t,g)&&g.el._leaveCb&&g.el._leaveCb(),I(E,[R])},enter(R){let E=l,g=d,L=u;if(!n.isMounted)if(s)E=_||l,g=p||d,L=T||u;else return;let O=!1;const H=R._enterCb=j=>{O||(O=!0,j?I(L,[R]):I(g,[R]),D.delayedLeave&&D.delayedLeave(),R._enterCb=void 0)};E?P(E,[R,H]):H()},leave(R,E){const g=String(t.key);if(R._enterCb&&R._enterCb(!0),n.isUnmounting)return E();I(f,[R]);let L=!1;const O=R._leaveCb=H=>{L||(L=!0,E(),H?I(b,[R]):I(m,[R]),R._leaveCb=void 0,S[g]===t&&delete S[g])};S[g]=t,h?P(h,[R,O]):O()},clone(R){return Fl(R,e,n,i)}};return D}function Ha(t){if(Ta(t))return t=Bi(t),t.children=null,t}function kd(t){return Ta(t)?t.children?t.children[0]:void 0:t}function Ol(t,e){t.shapeFlag&6&&t.component?Ol(t.component.subTree,e):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}function Ef(t,e=!1,n){let i=[],s=0;for(let o=0;o1)for(let o=0;o!!t.type.__asyncLoader,Ta=t=>t.type.__isKeepAlive;function i_(t,e){wf(t,"a",e)}function s_(t,e){wf(t,"da",e)}function wf(t,e,n=$t){const i=t.__wdc||(t.__wdc=()=>{let s=n;for(;s;){if(s.isDeactivated)return;s=s.parent}return t()});if(Ca(e,i,n),n){let s=n.parent;for(;s&&s.parent;)Ta(s.parent.vnode)&&o_(i,e,n,s),s=s.parent}}function o_(t,e,n,i){const s=Ca(e,t,i,!0);Af(()=>{Nc(i[e],s)},n)}function Ca(t,e,n=$t,i=!1){if(n){const s=n[t]||(n[t]=[]),o=e.__weh||(e.__weh=(...r)=>{if(n.isUnmounted)return;fo(),eo(n);const a=wn(e,n,t,r);return ms(),po(),a});return i?s.unshift(o):s.push(o),o}}const mi=t=>(e,n=$t)=>(!tr||t==="sp")&&Ca(t,e,n),r_=mi("bm"),Tf=mi("m"),a_=mi("bu"),l_=mi("u"),Cf=mi("bum"),Af=mi("um"),c_=mi("sp"),d_=mi("rtg"),u_=mi("rtc");function h_(t,e=$t){Ca("ec",t,e)}function se(t,e){const n=en;if(n===null)return t;const i=Pa(n)||n.proxy,s=t.dirs||(t.dirs=[]);for(let o=0;oe(r,a,void 0,o&&o[a]));else{const r=Object.keys(t);s=new Array(r.length);for(let a=0,l=r.length;aua(e)?!(e.type===Tn||e.type===rt&&!Df(e.children)):!0)?t:null}const Nl=t=>t?Wf(t)?Pa(t)||t.proxy:Nl(t.parent):null,ca=jt(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>Nl(t.parent),$root:t=>Nl(t.root),$emit:t=>t.emit,$options:t=>Lf(t),$forceUpdate:t=>t.f||(t.f=()=>pf(t.update)),$nextTick:t=>t.n||(t.n=ff.bind(t.proxy)),$watch:t=>e_.bind(t)}),p_={get({_:t},e){const{ctx:n,setupState:i,data:s,props:o,accessCache:r,type:a,appContext:l}=t;let d;if(e[0]!=="$"){const m=r[e];if(m!==void 0)switch(m){case 1:return i[e];case 2:return s[e];case 4:return n[e];case 3:return o[e]}else{if(i!==Mt&&dt(i,e))return r[e]=1,i[e];if(s!==Mt&&dt(s,e))return r[e]=2,s[e];if((d=t.propsOptions[0])&&dt(d,e))return r[e]=3,o[e];if(n!==Mt&&dt(n,e))return r[e]=4,n[e];zl&&(r[e]=0)}}const u=ca[e];let f,h;if(u)return e==="$attrs"&&vn(t,"get",e),u(t);if((f=a.__cssModules)&&(f=f[e]))return f;if(n!==Mt&&dt(n,e))return r[e]=4,n[e];if(h=l.config.globalProperties,dt(h,e))return h[e]},set({_:t},e,n){const{data:i,setupState:s,ctx:o}=t;return s!==Mt&&dt(s,e)?(s[e]=n,!0):i!==Mt&&dt(i,e)?(i[e]=n,!0):dt(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(o[e]=n,!0)},has({_:{data:t,setupState:e,accessCache:n,ctx:i,appContext:s,propsOptions:o}},r){let a;return!!n[r]||t!==Mt&&dt(t,r)||e!==Mt&&dt(e,r)||(a=o[0])&&dt(a,r)||dt(i,r)||dt(ca,r)||dt(s.config.globalProperties,r)},defineProperty(t,e,n){return n.get!=null?t._.accessCache[e]=0:dt(n,"value")&&this.set(t,e,n.value,null),Reflect.defineProperty(t,e,n)}};let zl=!0;function m_(t){const e=Lf(t),n=t.proxy,i=t.ctx;zl=!1,e.beforeCreate&&Vd(e.beforeCreate,t,"bc");const{data:s,computed:o,methods:r,watch:a,provide:l,inject:d,created:u,beforeMount:f,mounted:h,beforeUpdate:m,updated:b,activated:y,deactivated:_,beforeDestroy:p,beforeUnmount:T,destroyed:w,unmounted:S,render:I,renderTracked:P,renderTriggered:D,errorCaptured:R,serverPrefetch:E,expose:g,inheritAttrs:L,components:O,directives:H,filters:j}=e;if(d&&__(d,i,null,t.appContext.config.unwrapInjectedRef),r)for(const ae in r){const G=r[ae];nt(G)&&(i[ae]=G.bind(n))}if(s){const ae=s.call(n,n);Lt(ae)&&(t.data=dr(ae))}if(zl=!0,o)for(const ae in o){const G=o[ae],fe=nt(G)?G.bind(n,n):nt(G.get)?G.get.bind(n,n):kn,ye=!nt(G)&&nt(G.set)?G.set.bind(n):kn,Re=Yn({get:fe,set:ye});Object.defineProperty(i,ae,{enumerable:!0,configurable:!0,get:()=>Re.value,set:Be=>Re.value=Be})}if(a)for(const ae in a)If(a[ae],i,n,ae);if(l){const ae=nt(l)?l.call(n):l;Reflect.ownKeys(ae).forEach(G=>{Zr(G,ae[G])})}u&&Vd(u,t,"c");function q(ae,G){He(G)?G.forEach(fe=>ae(fe.bind(n))):G&&ae(G.bind(n))}if(q(r_,f),q(Tf,h),q(a_,m),q(l_,b),q(i_,y),q(s_,_),q(h_,R),q(u_,P),q(d_,D),q(Cf,T),q(Af,S),q(c_,E),He(g))if(g.length){const ae=t.exposed||(t.exposed={});g.forEach(G=>{Object.defineProperty(ae,G,{get:()=>n[G],set:fe=>n[G]=fe})})}else t.exposed||(t.exposed={});I&&t.render===kn&&(t.render=I),L!=null&&(t.inheritAttrs=L),O&&(t.components=O),H&&(t.directives=H)}function __(t,e,n=kn,i=!1){He(t)&&(t=kl(t));for(const s in t){const o=t[s];let r;Lt(o)?"default"in o?r=Oi(o.from||s,o.default,!0):r=Oi(o.from||s):r=Oi(o),Qt(r)&&i?Object.defineProperty(e,s,{enumerable:!0,configurable:!0,get:()=>r.value,set:a=>r.value=a}):e[s]=r}}function Vd(t,e,n){wn(He(t)?t.map(i=>i.bind(e.proxy)):t.bind(e.proxy),e,n)}function If(t,e,n,i){const s=i.includes(".")?xf(n,i):()=>n[i];if(zt(t)){const o=e[t];nt(o)&&Vo(s,o)}else if(nt(t))Vo(s,t.bind(n));else if(Lt(t))if(He(t))t.forEach(o=>If(o,e,n,i));else{const o=nt(t.handler)?t.handler.bind(n):e[t.handler];nt(o)&&Vo(s,o,t)}}function Lf(t){const e=t.type,{mixins:n,extends:i}=e,{mixins:s,optionsCache:o,config:{optionMergeStrategies:r}}=t.appContext,a=o.get(e);let l;return a?l=a:!s.length&&!n&&!i?l=e:(l={},s.length&&s.forEach(d=>da(l,d,r,!0)),da(l,e,r)),o.set(e,l),l}function da(t,e,n,i=!1){const{mixins:s,extends:o}=e;o&&da(t,o,n,!0),s&&s.forEach(r=>da(t,r,n,!0));for(const r in e)if(!(i&&r==="expose")){const a=g_[r]||n&&n[r];t[r]=a?a(t[r],e[r]):e[r]}return t}const g_={data:Hd,props:is,emits:is,methods:is,computed:is,beforeCreate:sn,created:sn,beforeMount:sn,mounted:sn,beforeUpdate:sn,updated:sn,beforeDestroy:sn,beforeUnmount:sn,destroyed:sn,unmounted:sn,activated:sn,deactivated:sn,errorCaptured:sn,serverPrefetch:sn,components:is,directives:is,watch:b_,provide:Hd,inject:v_};function Hd(t,e){return e?t?function(){return jt(nt(t)?t.call(this,this):t,nt(e)?e.call(this,this):e)}:e:t}function v_(t,e){return is(kl(t),kl(e))}function kl(t){if(He(t)){const e={};for(let n=0;n0)&&!(r&16)){if(r&8){const u=t.vnode.dynamicProps;for(let f=0;f{l=!0;const[h,m]=Ff(f,e,!0);jt(r,h),m&&a.push(...m)};!n&&e.mixins.length&&e.mixins.forEach(u),t.extends&&u(t.extends),t.mixins&&t.mixins.forEach(u)}if(!o&&!l)return i.set(t,js),js;if(He(o))for(let u=0;u-1,m[1]=y<0||b-1||dt(m,"default"))&&a.push(f)}}}const d=[r,a];return i.set(t,d),d}function $d(t){return t[0]!=="$"}function Gd(t){const e=t&&t.toString().match(/^\s*function (\w+)/);return e?e[1]:t===null?"null":""}function Wd(t,e){return Gd(t)===Gd(e)}function Xd(t,e){return He(e)?e.findIndex(n=>Wd(n,t)):nt(e)&&Wd(e,t)?0:-1}const Of=t=>t[0]==="_"||t==="$stable",Yc=t=>He(t)?t.map(Xn):[Xn(t)],S_=(t,e,n)=>{if(e._n)return e;const i=Ct((...s)=>Yc(e(...s)),n);return i._c=!1,i},Nf=(t,e,n)=>{const i=t._ctx;for(const s in t){if(Of(s))continue;const o=t[s];if(nt(o))e[s]=S_(s,o,i);else if(o!=null){const r=Yc(o);e[s]=()=>r}}},zf=(t,e)=>{const n=Yc(e);t.slots.default=()=>n},M_=(t,e)=>{if(t.vnode.shapeFlag&32){const n=e._;n?(t.slots=pt(e),ra(e,"_",n)):Nf(e,t.slots={})}else t.slots={},e&&zf(t,e);ra(t.slots,Aa,1)},E_=(t,e,n)=>{const{vnode:i,slots:s}=t;let o=!0,r=Mt;if(i.shapeFlag&32){const a=e._;a?n&&a===1?o=!1:(jt(s,e),!n&&a===1&&delete s._):(o=!e.$stable,Nf(e,s)),r=e}else e&&(zf(t,e),r={default:1});if(o)for(const a in s)!Of(a)&&!(a in r)&&delete s[a]};function kf(){return{app:null,config:{isNativeTag:tm,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let w_=0;function T_(t,e){return function(i,s=null){nt(i)||(i=Object.assign({},i)),s!=null&&!Lt(s)&&(s=null);const o=kf(),r=new Set;let a=!1;const l=o.app={_uid:w_++,_component:i,_props:s,_container:null,_context:o,_instance:null,version:$_,get config(){return o.config},set config(d){},use(d,...u){return r.has(d)||(d&&nt(d.install)?(r.add(d),d.install(l,...u)):nt(d)&&(r.add(d),d(l,...u))),l},mixin(d){return o.mixins.includes(d)||o.mixins.push(d),l},component(d,u){return u?(o.components[d]=u,l):o.components[d]},directive(d,u){return u?(o.directives[d]=u,l):o.directives[d]},mount(d,u,f){if(!a){const h=ke(i,s);return h.appContext=o,u&&e?e(h,d):t(h,d,f),a=!0,l._container=d,d.__vue_app__=l,Pa(h.component)||h.component.proxy}},unmount(){a&&(t(null,l._container),delete l._container.__vue_app__)},provide(d,u){return o.provides[d]=u,l}};return l}}function Vl(t,e,n,i,s=!1){if(He(t)){t.forEach((h,m)=>Vl(h,e&&(He(e)?e[m]:e),n,i,s));return}if(Ho(i)&&!s)return;const o=i.shapeFlag&4?Pa(i.component)||i.component.proxy:i.el,r=s?null:o,{i:a,r:l}=t,d=e&&e.r,u=a.refs===Mt?a.refs={}:a.refs,f=a.setupState;if(d!=null&&d!==l&&(zt(d)?(u[d]=null,dt(f,d)&&(f[d]=null)):Qt(d)&&(d.value=null)),nt(l))Fi(l,a,12,[r,u]);else{const h=zt(l),m=Qt(l);if(h||m){const b=()=>{if(t.f){const y=h?u[l]:l.value;s?He(y)&&Nc(y,o):He(y)?y.includes(o)||y.push(o):h?(u[l]=[o],dt(f,l)&&(f[l]=u[l])):(l.value=[o],t.k&&(u[t.k]=l.value))}else h?(u[l]=r,dt(f,l)&&(f[l]=r)):m&&(l.value=r,t.k&&(u[t.k]=r))};r?(b.id=-1,dn(b,n)):b()}}}const dn=Qm;function C_(t){return A_(t)}function A_(t,e){const n=am();n.__VUE__=!0;const{insert:i,remove:s,patchProp:o,createElement:r,createText:a,createComment:l,setText:d,setElementText:u,parentNode:f,nextSibling:h,setScopeId:m=kn,cloneNode:b,insertStaticContent:y}=t,_=(A,x,Z,ie=null,te=null,ne=null,me=!1,Q=null,M=!!x.dynamicChildren)=>{if(A===x)return;A&&!rs(A,x)&&(ie=ue(A),Je(A,te,ne,!0),A=null),x.patchFlag===-2&&(M=!1,x.dynamicChildren=null);const{type:v,ref:F,shapeFlag:B}=x;switch(v){case qc:p(A,x,Z,ie);break;case Tn:T(A,x,Z,ie);break;case $a:A==null&&w(x,Z,ie,me);break;case rt:H(A,x,Z,ie,te,ne,me,Q,M);break;default:B&1?P(A,x,Z,ie,te,ne,me,Q,M):B&6?j(A,x,Z,ie,te,ne,me,Q,M):(B&64||B&128)&&v.process(A,x,Z,ie,te,ne,me,Q,M,Se)}F!=null&&te&&Vl(F,A&&A.ref,ne,x||A,!x)},p=(A,x,Z,ie)=>{if(A==null)i(x.el=a(x.children),Z,ie);else{const te=x.el=A.el;x.children!==A.children&&d(te,x.children)}},T=(A,x,Z,ie)=>{A==null?i(x.el=l(x.children||""),Z,ie):x.el=A.el},w=(A,x,Z,ie)=>{[A.el,A.anchor]=y(A.children,x,Z,ie,A.el,A.anchor)},S=({el:A,anchor:x},Z,ie)=>{let te;for(;A&&A!==x;)te=h(A),i(A,Z,ie),A=te;i(x,Z,ie)},I=({el:A,anchor:x})=>{let Z;for(;A&&A!==x;)Z=h(A),s(A),A=Z;s(x)},P=(A,x,Z,ie,te,ne,me,Q,M)=>{me=me||x.type==="svg",A==null?D(x,Z,ie,te,ne,me,Q,M):g(A,x,te,ne,me,Q,M)},D=(A,x,Z,ie,te,ne,me,Q)=>{let M,v;const{type:F,props:B,shapeFlag:X,transition:$,patchFlag:ge,dirs:pe}=A;if(A.el&&b!==void 0&&ge===-1)M=A.el=b(A.el);else{if(M=A.el=r(A.type,ne,B&&B.is,B),X&8?u(M,A.children):X&16&&E(A.children,M,null,ie,te,ne&&F!=="foreignObject",me,Q),pe&&Wi(A,null,ie,"created"),B){for(const Me in B)Me!=="value"&&!Yr(Me)&&o(M,Me,null,B[Me],ne,A.children,ie,te,Y);"value"in B&&o(M,"value",null,B.value),(v=B.onVnodeBeforeMount)&&$n(v,ie,A)}R(M,A,A.scopeId,me,ie)}pe&&Wi(A,null,ie,"beforeMount");const be=(!te||te&&!te.pendingBranch)&&$&&!$.persisted;be&&$.beforeEnter(M),i(M,x,Z),((v=B&&B.onVnodeMounted)||be||pe)&&dn(()=>{v&&$n(v,ie,A),be&&$.enter(M),pe&&Wi(A,null,ie,"mounted")},te)},R=(A,x,Z,ie,te)=>{if(Z&&m(A,Z),ie)for(let ne=0;ne{for(let v=M;v{const Q=x.el=A.el;let{patchFlag:M,dynamicChildren:v,dirs:F}=x;M|=A.patchFlag&16;const B=A.props||Mt,X=x.props||Mt;let $;Z&&Xi(Z,!1),($=X.onVnodeBeforeUpdate)&&$n($,Z,x,A),F&&Wi(x,A,Z,"beforeUpdate"),Z&&Xi(Z,!0);const ge=te&&x.type!=="foreignObject";if(v?L(A.dynamicChildren,v,Q,Z,ie,ge,ne):me||fe(A,x,Q,null,Z,ie,ge,ne,!1),M>0){if(M&16)O(Q,x,B,X,Z,ie,te);else if(M&2&&B.class!==X.class&&o(Q,"class",null,X.class,te),M&4&&o(Q,"style",B.style,X.style,te),M&8){const pe=x.dynamicProps;for(let be=0;be{$&&$n($,Z,x,A),F&&Wi(x,A,Z,"updated")},ie)},L=(A,x,Z,ie,te,ne,me)=>{for(let Q=0;Q{if(Z!==ie){for(const Q in ie){if(Yr(Q))continue;const M=ie[Q],v=Z[Q];M!==v&&Q!=="value"&&o(A,Q,v,M,me,x.children,te,ne,Y)}if(Z!==Mt)for(const Q in Z)!Yr(Q)&&!(Q in ie)&&o(A,Q,Z[Q],null,me,x.children,te,ne,Y);"value"in ie&&o(A,"value",Z.value,ie.value)}},H=(A,x,Z,ie,te,ne,me,Q,M)=>{const v=x.el=A?A.el:a(""),F=x.anchor=A?A.anchor:a("");let{patchFlag:B,dynamicChildren:X,slotScopeIds:$}=x;$&&(Q=Q?Q.concat($):$),A==null?(i(v,Z,ie),i(F,Z,ie),E(x.children,Z,F,te,ne,me,Q,M)):B>0&&B&64&&X&&A.dynamicChildren?(L(A.dynamicChildren,X,Z,te,ne,me,Q),(x.key!=null||te&&x===te.subTree)&&Bf(A,x,!0)):fe(A,x,Z,F,te,ne,me,Q,M)},j=(A,x,Z,ie,te,ne,me,Q,M)=>{x.slotScopeIds=Q,A==null?x.shapeFlag&512?te.ctx.activate(x,Z,ie,me,M):re(x,Z,ie,te,ne,me,M):q(A,x,M)},re=(A,x,Z,ie,te,ne,me)=>{const Q=A.component=F_(A,ie,te);if(Ta(A)&&(Q.ctx.renderer=Se),N_(Q),Q.asyncDep){if(te&&te.registerDep(Q,ae),!A.el){const M=Q.subTree=ke(Tn);T(null,M,x,Z)}return}ae(Q,A,x,Z,te,ne,me)},q=(A,x,Z)=>{const ie=x.component=A.component;if(Zm(A,x,Z))if(ie.asyncDep&&!ie.asyncResolved){G(ie,x,Z);return}else ie.next=x,Hm(ie.update),ie.update();else x.el=A.el,ie.vnode=x},ae=(A,x,Z,ie,te,ne,me)=>{const Q=()=>{if(A.isMounted){let{next:F,bu:B,u:X,parent:$,vnode:ge}=A,pe=F,be;Xi(A,!1),F?(F.el=ge.el,G(A,F,me)):F=ge,B&&qr(B),(be=F.props&&F.props.onVnodeBeforeUpdate)&&$n(be,$,F,ge),Xi(A,!0);const Me=Va(A),he=A.subTree;A.subTree=Me,_(he,Me,f(he.el),ue(he),A,te,ne),F.el=Me.el,pe===null&&Km(A,Me.el),X&&dn(X,te),(be=F.props&&F.props.onVnodeUpdated)&&dn(()=>$n(be,$,F,ge),te)}else{let F;const{el:B,props:X}=x,{bm:$,m:ge,parent:pe}=A,be=Ho(x);if(Xi(A,!1),$&&qr($),!be&&(F=X&&X.onVnodeBeforeMount)&&$n(F,pe,x),Xi(A,!0),B&&Ue){const Me=()=>{A.subTree=Va(A),Ue(B,A.subTree,A,te,null)};be?x.type.__asyncLoader().then(()=>!A.isUnmounted&&Me()):Me()}else{const Me=A.subTree=Va(A);_(null,Me,Z,ie,A,te,ne),x.el=Me.el}if(ge&&dn(ge,te),!be&&(F=X&&X.onVnodeMounted)){const Me=x;dn(()=>$n(F,pe,Me),te)}(x.shapeFlag&256||pe&&Ho(pe.vnode)&&pe.vnode.shapeFlag&256)&&A.a&&dn(A.a,te),A.isMounted=!0,x=Z=ie=null}},M=A.effect=new Bc(Q,()=>pf(v),A.scope),v=A.update=()=>M.run();v.id=A.uid,Xi(A,!0),v()},G=(A,x,Z)=>{x.component=A;const ie=A.vnode.props;A.vnode=x,A.next=null,x_(A,x.props,ie,Z),E_(A,x.children,Z),fo(),Ma(void 0,A.update),po()},fe=(A,x,Z,ie,te,ne,me,Q,M=!1)=>{const v=A&&A.children,F=A?A.shapeFlag:0,B=x.children,{patchFlag:X,shapeFlag:$}=x;if(X>0){if(X&128){Re(v,B,Z,ie,te,ne,me,Q,M);return}else if(X&256){ye(v,B,Z,ie,te,ne,me,Q,M);return}}$&8?(F&16&&Y(v,te,ne),B!==v&&u(Z,B)):F&16?$&16?Re(v,B,Z,ie,te,ne,me,Q,M):Y(v,te,ne,!0):(F&8&&u(Z,""),$&16&&E(B,Z,ie,te,ne,me,Q,M))},ye=(A,x,Z,ie,te,ne,me,Q,M)=>{A=A||js,x=x||js;const v=A.length,F=x.length,B=Math.min(v,F);let X;for(X=0;XF?Y(A,te,ne,!0,!1,B):E(x,Z,ie,te,ne,me,Q,M,B)},Re=(A,x,Z,ie,te,ne,me,Q,M)=>{let v=0;const F=x.length;let B=A.length-1,X=F-1;for(;v<=B&&v<=X;){const $=A[v],ge=x[v]=M?Pi(x[v]):Xn(x[v]);if(rs($,ge))_($,ge,Z,null,te,ne,me,Q,M);else break;v++}for(;v<=B&&v<=X;){const $=A[B],ge=x[X]=M?Pi(x[X]):Xn(x[X]);if(rs($,ge))_($,ge,Z,null,te,ne,me,Q,M);else break;B--,X--}if(v>B){if(v<=X){const $=X+1,ge=$X)for(;v<=B;)Je(A[v],te,ne,!0),v++;else{const $=v,ge=v,pe=new Map;for(v=ge;v<=X;v++){const Ye=x[v]=M?Pi(x[v]):Xn(x[v]);Ye.key!=null&&pe.set(Ye.key,v)}let be,Me=0;const he=X-ge+1;let Ce=!1,Xe=0;const $e=new Array(he);for(v=0;v=he){Je(Ye,te,ne,!0);continue}let Ge;if(Ye.key!=null)Ge=pe.get(Ye.key);else for(be=ge;be<=X;be++)if($e[be-ge]===0&&rs(Ye,x[be])){Ge=be;break}Ge===void 0?Je(Ye,te,ne,!0):($e[Ge-ge]=v+1,Ge>=Xe?Xe=Ge:Ce=!0,_(Ye,x[Ge],Z,null,te,ne,me,Q,M),Me++)}const De=Ce?P_($e):js;for(be=De.length-1,v=he-1;v>=0;v--){const Ye=ge+v,Ge=x[Ye],gt=Ye+1{const{el:ne,type:me,transition:Q,children:M,shapeFlag:v}=A;if(v&6){Be(A.component.subTree,x,Z,ie);return}if(v&128){A.suspense.move(x,Z,ie);return}if(v&64){me.move(A,x,Z,Se);return}if(me===rt){i(ne,x,Z);for(let B=0;BQ.enter(ne),te);else{const{leave:B,delayLeave:X,afterLeave:$}=Q,ge=()=>i(ne,x,Z),pe=()=>{B(ne,()=>{ge(),$&&$()})};X?X(ne,ge,pe):pe()}else i(ne,x,Z)},Je=(A,x,Z,ie=!1,te=!1)=>{const{type:ne,props:me,ref:Q,children:M,dynamicChildren:v,shapeFlag:F,patchFlag:B,dirs:X}=A;if(Q!=null&&Vl(Q,null,Z,A,!0),F&256){x.ctx.deactivate(A);return}const $=F&1&&X,ge=!Ho(A);let pe;if(ge&&(pe=me&&me.onVnodeBeforeUnmount)&&$n(pe,x,A),F&6)le(A.component,Z,ie);else{if(F&128){A.suspense.unmount(Z,ie);return}$&&Wi(A,null,x,"beforeUnmount"),F&64?A.type.remove(A,x,Z,te,Se,ie):v&&(ne!==rt||B>0&&B&64)?Y(v,x,Z,!1,!0):(ne===rt&&B&384||!te&&F&16)&&Y(M,x,Z),ie&&ce(A)}(ge&&(pe=me&&me.onVnodeUnmounted)||$)&&dn(()=>{pe&&$n(pe,x,A),$&&Wi(A,null,x,"unmounted")},Z)},ce=A=>{const{type:x,el:Z,anchor:ie,transition:te}=A;if(x===rt){N(Z,ie);return}if(x===$a){I(A);return}const ne=()=>{s(Z),te&&!te.persisted&&te.afterLeave&&te.afterLeave()};if(A.shapeFlag&1&&te&&!te.persisted){const{leave:me,delayLeave:Q}=te,M=()=>me(Z,ne);Q?Q(A.el,ne,M):M()}else ne()},N=(A,x)=>{let Z;for(;A!==x;)Z=h(A),s(A),A=Z;s(x)},le=(A,x,Z)=>{const{bum:ie,scope:te,update:ne,subTree:me,um:Q}=A;ie&&qr(ie),te.stop(),ne&&(ne.active=!1,Je(me,A,x,Z)),Q&&dn(Q,x),dn(()=>{A.isUnmounted=!0},x),x&&x.pendingBranch&&!x.isUnmounted&&A.asyncDep&&!A.asyncResolved&&A.suspenseId===x.pendingId&&(x.deps--,x.deps===0&&x.resolve())},Y=(A,x,Z,ie=!1,te=!1,ne=0)=>{for(let me=ne;meA.shapeFlag&6?ue(A.component.subTree):A.shapeFlag&128?A.suspense.next():h(A.anchor||A.el),Oe=(A,x,Z)=>{A==null?x._vnode&&Je(x._vnode,null,null,!0):_(x._vnode||null,A,x,null,null,null,Z),gf(),x._vnode=A},Se={p:_,um:Je,m:Be,r:ce,mt:re,mc:E,pc:fe,pbc:L,n:ue,o:t};let Ne,Ue;return e&&([Ne,Ue]=e(Se)),{render:Oe,hydrate:Ne,createApp:T_(Oe,Ne)}}function Xi({effect:t,update:e},n){t.allowRecurse=e.allowRecurse=n}function Bf(t,e,n=!1){const i=t.children,s=e.children;if(He(i)&&He(s))for(let o=0;o>1,t[n[a]]0&&(e[i]=n[o-1]),n[o]=i)}}for(o=n.length,r=n[o-1];o-- >0;)n[o]=r,r=e[r];return n}const R_=t=>t.__isTeleport,rt=Symbol(void 0),qc=Symbol(void 0),Tn=Symbol(void 0),$a=Symbol(void 0),$o=[];let Nn=null;function W(t=!1){$o.push(Nn=t?null:[])}function D_(){$o.pop(),Nn=$o[$o.length-1]||null}let er=1;function jd(t){er+=t}function Vf(t){return t.dynamicChildren=er>0?Nn||js:null,D_(),er>0&&Nn&&Nn.push(t),t}function ee(t,e,n,i,s,o){return Vf(c(t,e,n,i,s,o,!0))}function Jt(t,e,n,i,s){return Vf(ke(t,e,n,i,s,!0))}function ua(t){return t?t.__v_isVNode===!0:!1}function rs(t,e){return t.type===e.type&&t.key===e.key}const Aa="__vInternal",Hf=({key:t})=>t!=null?t:null,Kr=({ref:t,ref_key:e,ref_for:n})=>t!=null?zt(t)||Qt(t)||nt(t)?{i:en,r:t,k:e,f:!!n}:t:null;function c(t,e=null,n=null,i=0,s=null,o=t===rt?0:1,r=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&Hf(e),ref:e&&Kr(e),scopeId:wa,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:o,patchFlag:i,dynamicProps:s,dynamicChildren:null,appContext:null};return a?(Zc(l,n),o&128&&t.normalize(l)):n&&(l.shapeFlag|=zt(n)?8:16),er>0&&!r&&Nn&&(l.patchFlag>0||o&6)&&l.patchFlag!==32&&Nn.push(l),l}const ke=I_;function I_(t,e=null,n=null,i=0,s=null,o=!1){if((!t||t===Pf)&&(t=Tn),ua(t)){const a=Bi(t,e,!0);return n&&Zc(a,n),er>0&&!o&&Nn&&(a.shapeFlag&6?Nn[Nn.indexOf(t)]=a:Nn.push(a)),a.patchFlag|=-2,a}if(H_(t)&&(t=t.__vccOpts),e){e=$f(e);let{class:a,style:l}=e;a&&!zt(a)&&(e.class=je(a)),Lt(l)&&(sf(l)&&!He(l)&&(l=jt({},l)),e.style=uo(l))}const r=zt(t)?1:Jm(t)?128:R_(t)?64:Lt(t)?4:nt(t)?2:0;return c(t,e,n,i,s,r,o,!0)}function $f(t){return t?sf(t)||Aa in t?jt({},t):t:null}function Bi(t,e,n=!1){const{props:i,ref:s,patchFlag:o,children:r}=t,a=e?Gf(i||{},e):i;return{__v_isVNode:!0,__v_skip:!0,type:t.type,props:a,key:a&&Hf(a),ref:e&&e.ref?n&&s?He(s)?s.concat(Kr(e)):[s,Kr(e)]:Kr(e):s,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:r,target:t.target,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==rt?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:t.transition,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&Bi(t.ssContent),ssFallback:t.ssFallback&&Bi(t.ssFallback),el:t.el,anchor:t.anchor}}function Ie(t=" ",e=0){return ke(qc,null,t,e)}function st(t="",e=!1){return e?(W(),Jt(Tn,null,t)):ke(Tn,null,t)}function Xn(t){return t==null||typeof t=="boolean"?ke(Tn):He(t)?ke(rt,null,t.slice()):typeof t=="object"?Pi(t):ke(qc,null,String(t))}function Pi(t){return t.el===null||t.memo?t:Bi(t)}function Zc(t,e){let n=0;const{shapeFlag:i}=t;if(e==null)e=null;else if(He(e))n=16;else if(typeof e=="object")if(i&65){const s=e.default;s&&(s._c&&(s._d=!1),Zc(t,s()),s._c&&(s._d=!0));return}else{n=32;const s=e._;!s&&!(Aa in e)?e._ctx=en:s===3&&en&&(en.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else nt(e)?(e={default:e,_ctx:en},n=32):(e=String(e),i&64?(n=16,e=[Ie(e)]):n=8);t.children=e,t.shapeFlag|=n}function Gf(...t){const e={};for(let n=0;n$t||en,eo=t=>{$t=t,t.scope.on()},ms=()=>{$t&&$t.scope.off(),$t=null};function Wf(t){return t.vnode.shapeFlag&4}let tr=!1;function N_(t,e=!1){tr=e;const{props:n,children:i}=t.vnode,s=Wf(t);y_(t,n,s,e),M_(t,i);const o=s?z_(t,e):void 0;return tr=!1,o}function z_(t,e){const n=t.type;t.accessCache=Object.create(null),t.proxy=of(new Proxy(t.ctx,p_));const{setup:i}=n;if(i){const s=t.setupContext=i.length>1?B_(t):null;eo(t),fo();const o=Fi(i,t,0,[t.props,s]);if(po(),ms(),$h(o)){if(o.then(ms,ms),e)return o.then(r=>{Yd(t,r,e)}).catch(r=>{Sa(r,t,0)});t.asyncDep=o}else Yd(t,o,e)}else Xf(t,e)}function Yd(t,e,n){nt(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:Lt(e)&&(t.setupState=uf(e)),Xf(t,n)}let qd;function Xf(t,e,n){const i=t.type;if(!t.render){if(!e&&qd&&!i.render){const s=i.template;if(s){const{isCustomElement:o,compilerOptions:r}=t.appContext.config,{delimiters:a,compilerOptions:l}=i,d=jt(jt({isCustomElement:o,delimiters:a},r),l);i.render=qd(s,d)}}t.render=i.render||kn}eo(t),fo(),m_(t),po(),ms()}function k_(t){return new Proxy(t.attrs,{get(e,n){return vn(t,"get","$attrs"),e[n]}})}function B_(t){const e=i=>{t.exposed=i||{}};let n;return{get attrs(){return n||(n=k_(t))},slots:t.slots,emit:t.emit,expose:e}}function Pa(t){if(t.exposed)return t.exposeProxy||(t.exposeProxy=new Proxy(uf(of(t.exposed)),{get(e,n){if(n in e)return e[n];if(n in ca)return ca[n](t)}}))}function V_(t,e=!0){return nt(t)?t.displayName||t.name:t.name||e&&t.__name}function H_(t){return nt(t)&&"__vccOpts"in t}const Yn=(t,e)=>km(t,e,tr);function Kc(t,e,n){const i=arguments.length;return i===2?Lt(e)&&!He(e)?ua(e)?ke(t,null,[e]):ke(t,e):ke(t,null,e):(i>3?n=Array.prototype.slice.call(arguments,2):i===3&&ua(n)&&(n=[n]),ke(t,e,n))}const $_="3.2.37",G_="http://www.w3.org/2000/svg",as=typeof document!="undefined"?document:null,Zd=as&&as.createElement("template"),W_={insert:(t,e,n)=>{e.insertBefore(t,n||null)},remove:t=>{const e=t.parentNode;e&&e.removeChild(t)},createElement:(t,e,n,i)=>{const s=e?as.createElementNS(G_,t):as.createElement(t,n?{is:n}:void 0);return t==="select"&&i&&i.multiple!=null&&s.setAttribute("multiple",i.multiple),s},createText:t=>as.createTextNode(t),createComment:t=>as.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>as.querySelector(t),setScopeId(t,e){t.setAttribute(e,"")},cloneNode(t){const e=t.cloneNode(!0);return"_value"in t&&(e._value=t._value),e},insertStaticContent(t,e,n,i,s,o){const r=n?n.previousSibling:e.lastChild;if(s&&(s===o||s.nextSibling))for(;e.insertBefore(s.cloneNode(!0),n),!(s===o||!(s=s.nextSibling)););else{Zd.innerHTML=i?`${t}`:t;const a=Zd.content;if(i){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}e.insertBefore(a,n)}return[r?r.nextSibling:e.firstChild,n?n.previousSibling:e.lastChild]}};function X_(t,e,n){const i=t._vtc;i&&(e=(e?[e,...i]:[...i]).join(" ")),e==null?t.removeAttribute("class"):n?t.setAttribute("class",e):t.className=e}function j_(t,e,n){const i=t.style,s=zt(n);if(n&&!s){for(const o in n)Hl(i,o,n[o]);if(e&&!zt(e))for(const o in e)n[o]==null&&Hl(i,o,"")}else{const o=i.display;s?e!==n&&(i.cssText=n):e&&t.removeAttribute("style"),"_vod"in t&&(i.display=o)}}const Kd=/\s*!important$/;function Hl(t,e,n){if(He(n))n.forEach(i=>Hl(t,e,i));else if(n==null&&(n=""),e.startsWith("--"))t.setProperty(e,n);else{const i=Y_(t,e);Kd.test(n)?t.setProperty(bs(i),n.replace(Kd,""),"important"):t[i]=n}}const Jd=["Webkit","Moz","ms"],Ga={};function Y_(t,e){const n=Ga[e];if(n)return n;let i=Qn(e);if(i!=="filter"&&i in t)return Ga[e]=i;i=ya(i);for(let s=0;s{let t=Date.now,e=!1;if(typeof window!="undefined"){Date.now()>document.createEvent("Event").timeStamp&&(t=performance.now.bind(performance));const n=navigator.userAgent.match(/firefox\/(\d+)/i);e=!!(n&&Number(n[1])<=53)}return[t,e]})();let $l=0;const J_=Promise.resolve(),Q_=()=>{$l=0},eg=()=>$l||(J_.then(Q_),$l=jf());function Ii(t,e,n,i){t.addEventListener(e,n,i)}function tg(t,e,n,i){t.removeEventListener(e,n,i)}function ng(t,e,n,i,s=null){const o=t._vei||(t._vei={}),r=o[e];if(i&&r)r.value=i;else{const[a,l]=ig(e);if(i){const d=o[e]=sg(i,s);Ii(t,a,d,l)}else r&&(tg(t,a,r,l),o[e]=void 0)}}const eu=/(?:Once|Passive|Capture)$/;function ig(t){let e;if(eu.test(t)){e={};let n;for(;n=t.match(eu);)t=t.slice(0,t.length-n[0].length),e[n[0].toLowerCase()]=!0}return[bs(t.slice(2)),e]}function sg(t,e){const n=i=>{const s=i.timeStamp||jf();(K_||s>=n.attached-1)&&wn(og(i,n.value),e,5,[i])};return n.value=t,n.attached=eg(),n}function og(t,e){if(He(e)){const n=t.stopImmediatePropagation;return t.stopImmediatePropagation=()=>{n.call(t),t._stopped=!0},e.map(i=>s=>!s._stopped&&i&&i(s))}else return e}const tu=/^on[a-z]/,rg=(t,e,n,i,s=!1,o,r,a,l)=>{e==="class"?X_(t,i,s):e==="style"?j_(t,n,i):va(e)?Oc(e)||ng(t,e,n,i,r):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):ag(t,e,i,s))?Z_(t,e,i,o,r,a,l):(e==="true-value"?t._trueValue=i:e==="false-value"&&(t._falseValue=i),q_(t,e,i,s))};function ag(t,e,n,i){return i?!!(e==="innerHTML"||e==="textContent"||e in t&&tu.test(e)&&nt(n)):e==="spellcheck"||e==="draggable"||e==="translate"||e==="form"||e==="list"&&t.tagName==="INPUT"||e==="type"&&t.tagName==="TEXTAREA"||tu.test(e)&&zt(n)?!1:e in t}const gi="transition",So="animation",Jc=(t,{slots:e})=>Kc(Sf,lg(t),e);Jc.displayName="Transition";const Yf={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String};Jc.props=jt({},Sf.props,Yf);const ji=(t,e=[])=>{He(t)?t.forEach(n=>n(...e)):t&&t(...e)},nu=t=>t?He(t)?t.some(e=>e.length>1):t.length>1:!1;function lg(t){const e={};for(const O in t)O in Yf||(e[O]=t[O]);if(t.css===!1)return e;const{name:n="v",type:i,duration:s,enterFromClass:o=`${n}-enter-from`,enterActiveClass:r=`${n}-enter-active`,enterToClass:a=`${n}-enter-to`,appearFromClass:l=o,appearActiveClass:d=r,appearToClass:u=a,leaveFromClass:f=`${n}-leave-from`,leaveActiveClass:h=`${n}-leave-active`,leaveToClass:m=`${n}-leave-to`}=t,b=cg(s),y=b&&b[0],_=b&&b[1],{onBeforeEnter:p,onEnter:T,onEnterCancelled:w,onLeave:S,onLeaveCancelled:I,onBeforeAppear:P=p,onAppear:D=T,onAppearCancelled:R=w}=e,E=(O,H,j)=>{Yi(O,H?u:a),Yi(O,H?d:r),j&&j()},g=(O,H)=>{O._isLeaving=!1,Yi(O,f),Yi(O,m),Yi(O,h),H&&H()},L=O=>(H,j)=>{const re=O?D:T,q=()=>E(H,O,j);ji(re,[H,q]),iu(()=>{Yi(H,O?l:o),vi(H,O?u:a),nu(re)||su(H,i,y,q)})};return jt(e,{onBeforeEnter(O){ji(p,[O]),vi(O,o),vi(O,r)},onBeforeAppear(O){ji(P,[O]),vi(O,l),vi(O,d)},onEnter:L(!1),onAppear:L(!0),onLeave(O,H){O._isLeaving=!0;const j=()=>g(O,H);vi(O,f),hg(),vi(O,h),iu(()=>{!O._isLeaving||(Yi(O,f),vi(O,m),nu(S)||su(O,i,_,j))}),ji(S,[O,j])},onEnterCancelled(O){E(O,!1),ji(w,[O])},onAppearCancelled(O){E(O,!0),ji(R,[O])},onLeaveCancelled(O){g(O),ji(I,[O])}})}function cg(t){if(t==null)return null;if(Lt(t))return[Wa(t.enter),Wa(t.leave)];{const e=Wa(t);return[e,e]}}function Wa(t){return Zo(t)}function vi(t,e){e.split(/\s+/).forEach(n=>n&&t.classList.add(n)),(t._vtc||(t._vtc=new Set)).add(e)}function Yi(t,e){e.split(/\s+/).forEach(i=>i&&t.classList.remove(i));const{_vtc:n}=t;n&&(n.delete(e),n.size||(t._vtc=void 0))}function iu(t){requestAnimationFrame(()=>{requestAnimationFrame(t)})}let dg=0;function su(t,e,n,i){const s=t._endId=++dg,o=()=>{s===t._endId&&i()};if(n)return setTimeout(o,n);const{type:r,timeout:a,propCount:l}=ug(t,e);if(!r)return i();const d=r+"end";let u=0;const f=()=>{t.removeEventListener(d,h),o()},h=m=>{m.target===t&&++u>=l&&f()};setTimeout(()=>{u(n[b]||"").split(", "),s=i(gi+"Delay"),o=i(gi+"Duration"),r=ou(s,o),a=i(So+"Delay"),l=i(So+"Duration"),d=ou(a,l);let u=null,f=0,h=0;e===gi?r>0&&(u=gi,f=r,h=o.length):e===So?d>0&&(u=So,f=d,h=l.length):(f=Math.max(r,d),u=f>0?r>d?gi:So:null,h=u?u===gi?o.length:l.length:0);const m=u===gi&&/\b(transform|all)(,|$)/.test(n[gi+"Property"]);return{type:u,timeout:f,propCount:h,hasTransform:m}}function ou(t,e){for(;t.lengthru(n)+ru(t[i])))}function ru(t){return Number(t.slice(0,-1).replace(",","."))*1e3}function hg(){return document.body.offsetHeight}const to=t=>{const e=t.props["onUpdate:modelValue"]||!1;return He(e)?n=>qr(e,n):e};function fg(t){t.target.composing=!0}function au(t){const e=t.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const _e={created(t,{modifiers:{lazy:e,trim:n,number:i}},s){t._assign=to(s);const o=i||s.props&&s.props.type==="number";Ii(t,e?"change":"input",r=>{if(r.target.composing)return;let a=t.value;n&&(a=a.trim()),o&&(a=Zo(a)),t._assign(a)}),n&&Ii(t,"change",()=>{t.value=t.value.trim()}),e||(Ii(t,"compositionstart",fg),Ii(t,"compositionend",au),Ii(t,"change",au))},mounted(t,{value:e}){t.value=e==null?"":e},beforeUpdate(t,{value:e,modifiers:{lazy:n,trim:i,number:s}},o){if(t._assign=to(o),t.composing||document.activeElement===t&&t.type!=="range"&&(n||i&&t.value.trim()===e||(s||t.type==="number")&&Zo(t.value)===e))return;const r=e==null?"":e;t.value!==r&&(t.value=r)}},Zn={deep:!0,created(t,e,n){t._assign=to(n),Ii(t,"change",()=>{const i=t._modelValue,s=nr(t),o=t.checked,r=t._assign;if(He(i)){const a=Fc(i,s),l=a!==-1;if(o&&!l)r(i.concat(s));else if(!o&&l){const d=[...i];d.splice(a,1),r(d)}}else if(ho(i)){const a=new Set(i);o?a.add(s):a.delete(s),r(a)}else r(qf(t,o))})},mounted:lu,beforeUpdate(t,e,n){t._assign=to(n),lu(t,e,n)}};function lu(t,{value:e,oldValue:n},i){t._modelValue=e,He(e)?t.checked=Fc(e,i.props.value)>-1:ho(e)?t.checked=e.has(i.props.value):e!==n&&(t.checked=lr(e,qf(t,!0)))}const Kn={deep:!0,created(t,{value:e,modifiers:{number:n}},i){const s=ho(e);Ii(t,"change",()=>{const o=Array.prototype.filter.call(t.options,r=>r.selected).map(r=>n?Zo(nr(r)):nr(r));t._assign(t.multiple?s?new Set(o):o:o[0])}),t._assign=to(i)},mounted(t,{value:e}){cu(t,e)},beforeUpdate(t,e,n){t._assign=to(n)},updated(t,{value:e}){cu(t,e)}};function cu(t,e){const n=t.multiple;if(!(n&&!He(e)&&!ho(e))){for(let i=0,s=t.options.length;i-1:o.selected=e.has(r);else if(lr(nr(o),e)){t.selectedIndex!==i&&(t.selectedIndex=i);return}}!n&&t.selectedIndex!==-1&&(t.selectedIndex=-1)}}function nr(t){return"_value"in t?t._value:t.value}function qf(t,e){const n=e?"_trueValue":"_falseValue";return n in t?t[n]:e}const pg={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Zf=(t,e)=>n=>{if(!("key"in n))return;const i=bs(n.key);if(e.some(s=>s===i||pg[s]===i))return t(n)},an={beforeMount(t,{value:e},{transition:n}){t._vod=t.style.display==="none"?"":t.style.display,n&&e?n.beforeEnter(t):Mo(t,e)},mounted(t,{value:e},{transition:n}){n&&e&&n.enter(t)},updated(t,{value:e,oldValue:n},{transition:i}){!e!=!n&&(i?e?(i.beforeEnter(t),Mo(t,!0),i.enter(t)):i.leave(t,()=>{Mo(t,!1)}):Mo(t,e))},beforeUnmount(t,{value:e}){Mo(t,e)}};function Mo(t,e){t.style.display=e?t._vod:"none"}const mg=jt({patchProp:rg},W_);let du;function _g(){return du||(du=C_(mg))}const gg=(...t)=>{const e=_g().createApp(...t),{mount:n}=e;return e.mount=i=>{const s=vg(i);if(!s)return;const o=e._component;!nt(o)&&!o.render&&!o.template&&(o.template=s.innerHTML),s.innerHTML="";const r=n(s,!1,s instanceof SVGElement);return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),r},e};function vg(t){return zt(t)?document.querySelector(t):t}/*! * vue-router v4.0.16 * (c) 2022 Eduardo San Martin Morote * @license MIT */const Kf=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",_o=t=>Kf?Symbol(t):"_vr_"+t,bg=_o("rvlm"),uu=_o("rvd"),Qc=_o("r"),Jf=_o("rl"),Gl=_o("rvl"),Hs=typeof window!="undefined";function yg(t){return t.__esModule||Kf&&t[Symbol.toStringTag]==="Module"}const St=Object.assign;function Xa(t,e){const n={};for(const i in e){const s=e[i];n[i]=Array.isArray(s)?s.map(t):t(s)}return n}const Go=()=>{},xg=/\/$/,Sg=t=>t.replace(xg,"");function ja(t,e,n="/"){let i,s={},o="",r="";const a=e.indexOf("?"),l=e.indexOf("#",a>-1?a:0);return a>-1&&(i=e.slice(0,a),o=e.slice(a+1,l>-1?l:e.length),s=t(o)),l>-1&&(i=i||e.slice(0,l),r=e.slice(l,e.length)),i=Tg(i!=null?i:e,n),{fullPath:i+(o&&"?")+o+r,path:i,query:s,hash:r}}function Mg(t,e){const n=e.query?t(e.query):"";return e.path+(n&&"?")+n+(e.hash||"")}function hu(t,e){return!e||!t.toLowerCase().startsWith(e.toLowerCase())?t:t.slice(e.length)||"/"}function Eg(t,e,n){const i=e.matched.length-1,s=n.matched.length-1;return i>-1&&i===s&&no(e.matched[i],n.matched[s])&&Qf(e.params,n.params)&&t(e.query)===t(n.query)&&e.hash===n.hash}function no(t,e){return(t.aliasOf||t)===(e.aliasOf||e)}function Qf(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(!wg(t[n],e[n]))return!1;return!0}function wg(t,e){return Array.isArray(t)?fu(t,e):Array.isArray(e)?fu(e,t):t===e}function fu(t,e){return Array.isArray(e)?t.length===e.length&&t.every((n,i)=>n===e[i]):t.length===1&&t[0]===e}function Tg(t,e){if(t.startsWith("/"))return t;if(!t)return e;const n=e.split("/"),i=t.split("/");let s=n.length-1,o,r;for(o=0;o({left:window.pageXOffset,top:window.pageYOffset});function Dg(t){let e;if("el"in t){const n=t.el,i=typeof n=="string"&&n.startsWith("#"),s=typeof n=="string"?i?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!s)return;e=Rg(s,t)}else e=t;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.pageXOffset,e.top!=null?e.top:window.pageYOffset)}function pu(t,e){return(history.state?history.state.position-e:-1)+t}const Wl=new Map;function Ig(t,e){Wl.set(t,e)}function Lg(t){const e=Wl.get(t);return Wl.delete(t),e}let Ug=()=>location.protocol+"//"+location.host;function ep(t,e){const{pathname:n,search:i,hash:s}=e,o=t.indexOf("#");if(o>-1){let a=s.includes(t.slice(o))?t.slice(o).length:1,l=s.slice(a);return l[0]!=="/"&&(l="/"+l),hu(l,"")}return hu(n,t)+i+s}function Fg(t,e,n,i){let s=[],o=[],r=null;const a=({state:h})=>{const m=ep(t,location),b=n.value,y=e.value;let _=0;if(h){if(n.value=m,e.value=h,r&&r===b){r=null;return}_=y?h.position-y.position:0}else i(m);s.forEach(p=>{p(n.value,b,{delta:_,type:ir.pop,direction:_?_>0?Wo.forward:Wo.back:Wo.unknown})})};function l(){r=n.value}function d(h){s.push(h);const m=()=>{const b=s.indexOf(h);b>-1&&s.splice(b,1)};return o.push(m),m}function u(){const{history:h}=window;!h.state||h.replaceState(St({},h.state,{scroll:Ra()}),"")}function f(){for(const h of o)h();o=[],window.removeEventListener("popstate",a),window.removeEventListener("beforeunload",u)}return window.addEventListener("popstate",a),window.addEventListener("beforeunload",u),{pauseListeners:l,listen:d,destroy:f}}function mu(t,e,n,i=!1,s=!1){return{back:t,current:e,forward:n,replaced:i,position:window.history.length,scroll:s?Ra():null}}function Og(t){const{history:e,location:n}=window,i={value:ep(t,n)},s={value:e.state};s.value||o(i.value,{back:null,current:i.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0);function o(l,d,u){const f=t.indexOf("#"),h=f>-1?(n.host&&document.querySelector("base")?t:t.slice(f))+l:Ug()+t+l;try{e[u?"replaceState":"pushState"](d,"",h),s.value=d}catch(m){console.error(m),n[u?"replace":"assign"](h)}}function r(l,d){const u=St({},e.state,mu(s.value.back,l,s.value.forward,!0),d,{position:s.value.position});o(l,u,!0),i.value=l}function a(l,d){const u=St({},s.value,e.state,{forward:l,scroll:Ra()});o(u.current,u,!0);const f=St({},mu(i.value,l,null),{position:u.position+1},d);o(l,f,!1),i.value=l}return{location:i,state:s,push:a,replace:r}}function Ng(t){t=Cg(t);const e=Og(t),n=Fg(t,e.state,e.location,e.replace);function i(o,r=!0){r||n.pauseListeners(),history.go(o)}const s=St({location:"",base:t,go:i,createHref:Pg.bind(null,t)},e,n);return Object.defineProperty(s,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(s,"state",{enumerable:!0,get:()=>e.state.value}),s}function zg(t){return t=location.host?t||location.pathname+location.search:"",t.includes("#")||(t+="#"),Ng(t)}function kg(t){return typeof t=="string"||t&&typeof t=="object"}function tp(t){return typeof t=="string"||typeof t=="symbol"}const bi={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0},np=_o("nf");var _u;(function(t){t[t.aborted=4]="aborted",t[t.cancelled=8]="cancelled",t[t.duplicated=16]="duplicated"})(_u||(_u={}));function io(t,e){return St(new Error,{type:t,[np]:!0},e)}function yi(t,e){return t instanceof Error&&np in t&&(e==null||!!(t.type&e))}const gu="[^/]+?",Bg={sensitive:!1,strict:!1,start:!0,end:!0},Vg=/[.+*?^${}()[\]/\\]/g;function Hg(t,e){const n=St({},Bg,e),i=[];let s=n.start?"^":"";const o=[];for(const d of t){const u=d.length?[]:[90];n.strict&&!d.length&&(s+="/");for(let f=0;f1&&(u.endsWith("/")?u=u.slice(0,-1):f=!0);else throw new Error(`Missing required param "${b}"`);u+=T}}return u}return{re:r,score:i,keys:o,parse:a,stringify:l}}function $g(t,e){let n=0;for(;ne.length?e.length===1&&e[0]===40+40?1:-1:0}function Gg(t,e){let n=0;const i=t.score,s=e.score;for(;n0&&e[e.length-1]<0}const Wg={type:0,value:""},Xg=/[a-zA-Z0-9_]/;function jg(t){if(!t)return[[]];if(t==="/")return[[Wg]];if(!t.startsWith("/"))throw new Error(`Invalid path "${t}"`);function e(m){throw new Error(`ERR (${n})/"${d}": ${m}`)}let n=0,i=n;const s=[];let o;function r(){o&&s.push(o),o=[]}let a=0,l,d="",u="";function f(){!d||(n===0?o.push({type:0,value:d}):n===1||n===2||n===3?(o.length>1&&(l==="*"||l==="+")&&e(`A repeatable param (${d}) must be alone in its segment. eg: '/:ids+.`),o.push({type:1,value:d,regexp:u,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):e("Invalid state to consume buffer"),d="")}function h(){d+=l}for(;a{r(T)}:Go}function r(u){if(tp(u)){const f=i.get(u);f&&(i.delete(u),n.splice(n.indexOf(f),1),f.children.forEach(r),f.alias.forEach(r))}else{const f=n.indexOf(u);f>-1&&(n.splice(f,1),u.record.name&&i.delete(u.record.name),u.children.forEach(r),u.alias.forEach(r))}}function a(){return n}function l(u){let f=0;for(;f=0&&(u.record.path!==n[f].record.path||!ip(u,n[f]));)f++;n.splice(f,0,u),u.record.name&&!bu(u)&&i.set(u.record.name,u)}function d(u,f){let h,m={},b,y;if("name"in u&&u.name){if(h=i.get(u.name),!h)throw io(1,{location:u});y=h.record.name,m=St(Zg(f.params,h.keys.filter(T=>!T.optional).map(T=>T.name)),u.params),b=h.stringify(m)}else if("path"in u)b=u.path,h=n.find(T=>T.re.test(b)),h&&(m=h.parse(b),y=h.record.name);else{if(h=f.name?i.get(f.name):n.find(T=>T.re.test(f.path)),!h)throw io(1,{location:u,currentLocation:f});y=h.record.name,m=St({},f.params,u.params),b=h.stringify(m)}const _=[];let p=h;for(;p;)_.unshift(p.record),p=p.parent;return{name:y,path:b,params:m,matched:_,meta:Qg(_)}}return t.forEach(u=>o(u)),{addRoute:o,resolve:d,removeRoute:r,getRoutes:a,getRecordMatcher:s}}function Zg(t,e){const n={};for(const i of e)i in t&&(n[i]=t[i]);return n}function Kg(t){return{path:t.path,redirect:t.redirect,name:t.name,meta:t.meta||{},aliasOf:void 0,beforeEnter:t.beforeEnter,props:Jg(t),children:t.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in t?t.components||{}:{default:t.component}}}function Jg(t){const e={},n=t.props||!1;if("component"in t)e.default=n;else for(const i in t.components)e[i]=typeof n=="boolean"?n:n[i];return e}function bu(t){for(;t;){if(t.record.aliasOf)return!0;t=t.parent}return!1}function Qg(t){return t.reduce((e,n)=>St(e,n.meta),{})}function yu(t,e){const n={};for(const i in t)n[i]=i in e?e[i]:t[i];return n}function ip(t,e){return e.children.some(n=>n===t||ip(t,n))}const sp=/#/g,e0=/&/g,t0=/\//g,n0=/=/g,i0=/\?/g,op=/\+/g,s0=/%5B/g,o0=/%5D/g,rp=/%5E/g,r0=/%60/g,ap=/%7B/g,a0=/%7C/g,lp=/%7D/g,l0=/%20/g;function ed(t){return encodeURI(""+t).replace(a0,"|").replace(s0,"[").replace(o0,"]")}function c0(t){return ed(t).replace(ap,"{").replace(lp,"}").replace(rp,"^")}function Xl(t){return ed(t).replace(op,"%2B").replace(l0,"+").replace(sp,"%23").replace(e0,"%26").replace(r0,"`").replace(ap,"{").replace(lp,"}").replace(rp,"^")}function d0(t){return Xl(t).replace(n0,"%3D")}function u0(t){return ed(t).replace(sp,"%23").replace(i0,"%3F")}function h0(t){return t==null?"":u0(t).replace(t0,"%2F")}function ha(t){try{return decodeURIComponent(""+t)}catch{}return""+t}function f0(t){const e={};if(t===""||t==="?")return e;const i=(t[0]==="?"?t.slice(1):t).split("&");for(let s=0;so&&Xl(o)):[i&&Xl(i)]).forEach(o=>{o!==void 0&&(e+=(e.length?"&":"")+n,o!=null&&(e+="="+o))})}return e}function p0(t){const e={};for(const n in t){const i=t[n];i!==void 0&&(e[n]=Array.isArray(i)?i.map(s=>s==null?null:""+s):i==null?i:""+i)}return e}function Eo(){let t=[];function e(i){return t.push(i),()=>{const s=t.indexOf(i);s>-1&&t.splice(s,1)}}function n(){t=[]}return{add:e,list:()=>t,reset:n}}function Ri(t,e,n,i,s){const o=i&&(i.enterCallbacks[s]=i.enterCallbacks[s]||[]);return()=>new Promise((r,a)=>{const l=f=>{f===!1?a(io(4,{from:n,to:e})):f instanceof Error?a(f):kg(f)?a(io(2,{from:e,to:f})):(o&&i.enterCallbacks[s]===o&&typeof f=="function"&&o.push(f),r())},d=t.call(i&&i.instances[s],e,n,l);let u=Promise.resolve(d);t.length<3&&(u=u.then(l)),u.catch(f=>a(f))})}function Ya(t,e,n,i){const s=[];for(const o of t)for(const r in o.components){let a=o.components[r];if(!(e!=="beforeRouteEnter"&&!o.instances[r]))if(m0(a)){const d=(a.__vccOpts||a)[e];d&&s.push(Ri(d,n,i,o,r))}else{let l=a();s.push(()=>l.then(d=>{if(!d)return Promise.reject(new Error(`Couldn't resolve component "${r}" at "${o.path}"`));const u=yg(d)?d.default:d;o.components[r]=u;const h=(u.__vccOpts||u)[e];return h&&Ri(h,n,i,o,r)()}))}}return s}function m0(t){return typeof t=="object"||"displayName"in t||"props"in t||"__vccOpts"in t}function Su(t){const e=Oi(Qc),n=Oi(Jf),i=Yn(()=>e.resolve(zo(t.to))),s=Yn(()=>{const{matched:l}=i.value,{length:d}=l,u=l[d-1],f=n.matched;if(!u||!f.length)return-1;const h=f.findIndex(no.bind(null,u));if(h>-1)return h;const m=Mu(l[d-2]);return d>1&&Mu(u)===m&&f[f.length-1].path!==m?f.findIndex(no.bind(null,l[d-2])):h}),o=Yn(()=>s.value>-1&&b0(n.params,i.value.params)),r=Yn(()=>s.value>-1&&s.value===n.matched.length-1&&Qf(n.params,i.value.params));function a(l={}){return v0(l)?e[zo(t.replace)?"replace":"push"](zo(t.to)).catch(Go):Promise.resolve()}return{route:i,href:Yn(()=>i.value.href),isActive:o,isExactActive:r,navigate:a}}const _0=mo({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"}},useLink:Su,setup(t,{slots:e}){const n=dr(Su(t)),{options:i}=Oi(Qc),s=Yn(()=>({[Eu(t.activeClass,i.linkActiveClass,"router-link-active")]:n.isActive,[Eu(t.exactActiveClass,i.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const o=e.default&&e.default(n);return t.custom?o:Kc("a",{"aria-current":n.isExactActive?t.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:s.value},o)}}}),g0=_0;function v0(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)&&!t.defaultPrevented&&!(t.button!==void 0&&t.button!==0)){if(t.currentTarget&&t.currentTarget.getAttribute){const e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function b0(t,e){for(const n in e){const i=e[n],s=t[n];if(typeof i=="string"){if(i!==s)return!1}else if(!Array.isArray(s)||s.length!==i.length||i.some((o,r)=>o!==s[r]))return!1}return!0}function Mu(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}const Eu=(t,e,n)=>t!=null?t:e!=null?e:n,y0=mo({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(t,{attrs:e,slots:n}){const i=Oi(Gl),s=Yn(()=>t.route||i.value),o=Oi(uu,0),r=Yn(()=>s.value.matched[o]);Zr(uu,o+1),Zr(bg,r),Zr(Gl,s);const a=lf();return Vo(()=>[a.value,r.value,t.name],([l,d,u],[f,h,m])=>{d&&(d.instances[u]=l,h&&h!==d&&l&&l===f&&(d.leaveGuards.size||(d.leaveGuards=h.leaveGuards),d.updateGuards.size||(d.updateGuards=h.updateGuards))),l&&d&&(!h||!no(d,h)||!f)&&(d.enterCallbacks[u]||[]).forEach(b=>b(l))},{flush:"post"}),()=>{const l=s.value,d=r.value,u=d&&d.components[t.name],f=t.name;if(!u)return wu(n.default,{Component:u,route:l});const h=d.props[t.name],m=h?h===!0?l.params:typeof h=="function"?h(l):h:null,y=Kc(u,St({},m,e,{onVnodeUnmounted:_=>{_.component.isUnmounted&&(d.instances[f]=null)},ref:a}));return wu(n.default,{Component:y,route:l})||y}}});function wu(t,e){if(!t)return null;const n=t(e);return n.length===1?n[0]:n}const x0=y0;function S0(t){const e=qg(t.routes,t),n=t.parseQuery||f0,i=t.stringifyQuery||xu,s=t.history,o=Eo(),r=Eo(),a=Eo(),l=cf(bi);let d=bi;Hs&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=Xa.bind(null,N=>""+N),f=Xa.bind(null,h0),h=Xa.bind(null,ha);function m(N,le){let Y,ue;return tp(N)?(Y=e.getRecordMatcher(N),ue=le):ue=N,e.addRoute(ue,Y)}function b(N){const le=e.getRecordMatcher(N);le&&e.removeRoute(le)}function y(){return e.getRoutes().map(N=>N.record)}function _(N){return!!e.getRecordMatcher(N)}function p(N,le){if(le=St({},le||l.value),typeof N=="string"){const Ue=ja(n,N,le.path),A=e.resolve({path:Ue.path},le),x=s.createHref(Ue.fullPath);return St(Ue,A,{params:h(A.params),hash:ha(Ue.hash),redirectedFrom:void 0,href:x})}let Y;if("path"in N)Y=St({},N,{path:ja(n,N.path,le.path).path});else{const Ue=St({},N.params);for(const A in Ue)Ue[A]==null&&delete Ue[A];Y=St({},N,{params:f(N.params)}),le.params=f(le.params)}const ue=e.resolve(Y,le),Oe=N.hash||"";ue.params=u(h(ue.params));const Se=Mg(i,St({},N,{hash:c0(Oe),path:ue.path})),Ne=s.createHref(Se);return St({fullPath:Se,hash:Oe,query:i===xu?p0(N.query):N.query||{}},ue,{redirectedFrom:void 0,href:Ne})}function T(N){return typeof N=="string"?ja(n,N,l.value.path):St({},N)}function w(N,le){if(d!==N)return io(8,{from:le,to:N})}function S(N){return D(N)}function I(N){return S(St(T(N),{replace:!0}))}function P(N){const le=N.matched[N.matched.length-1];if(le&&le.redirect){const{redirect:Y}=le;let ue=typeof Y=="function"?Y(N):Y;return typeof ue=="string"&&(ue=ue.includes("?")||ue.includes("#")?ue=T(ue):{path:ue},ue.params={}),St({query:N.query,hash:N.hash,params:N.params},ue)}}function D(N,le){const Y=d=p(N),ue=l.value,Oe=N.state,Se=N.force,Ne=N.replace===!0,Ue=P(Y);if(Ue)return D(St(T(Ue),{state:Oe,force:Se,replace:Ne}),le||Y);const A=Y;A.redirectedFrom=le;let x;return!Se&&Eg(i,ue,Y)&&(x=io(16,{to:A,from:ue}),ye(ue,ue,!0,!1)),(x?Promise.resolve(x):E(A,ue)).catch(Z=>yi(Z)?yi(Z,2)?Z:fe(Z):ae(Z,A,ue)).then(Z=>{if(Z){if(yi(Z,2))return D(St(T(Z.to),{state:Oe,force:Se,replace:Ne}),le||A)}else Z=L(A,ue,!0,Ne,Oe);return g(A,ue,Z),Z})}function R(N,le){const Y=w(N,le);return Y?Promise.reject(Y):Promise.resolve()}function E(N,le){let Y;const[ue,Oe,Se]=M0(N,le);Y=Ya(ue.reverse(),"beforeRouteLeave",N,le);for(const Ue of ue)Ue.leaveGuards.forEach(A=>{Y.push(Ri(A,N,le))});const Ne=R.bind(null,N,le);return Y.push(Ne),ws(Y).then(()=>{Y=[];for(const Ue of o.list())Y.push(Ri(Ue,N,le));return Y.push(Ne),ws(Y)}).then(()=>{Y=Ya(Oe,"beforeRouteUpdate",N,le);for(const Ue of Oe)Ue.updateGuards.forEach(A=>{Y.push(Ri(A,N,le))});return Y.push(Ne),ws(Y)}).then(()=>{Y=[];for(const Ue of N.matched)if(Ue.beforeEnter&&!le.matched.includes(Ue))if(Array.isArray(Ue.beforeEnter))for(const A of Ue.beforeEnter)Y.push(Ri(A,N,le));else Y.push(Ri(Ue.beforeEnter,N,le));return Y.push(Ne),ws(Y)}).then(()=>(N.matched.forEach(Ue=>Ue.enterCallbacks={}),Y=Ya(Se,"beforeRouteEnter",N,le),Y.push(Ne),ws(Y))).then(()=>{Y=[];for(const Ue of r.list())Y.push(Ri(Ue,N,le));return Y.push(Ne),ws(Y)}).catch(Ue=>yi(Ue,8)?Ue:Promise.reject(Ue))}function g(N,le,Y){for(const ue of a.list())ue(N,le,Y)}function L(N,le,Y,ue,Oe){const Se=w(N,le);if(Se)return Se;const Ne=le===bi,Ue=Hs?history.state:{};Y&&(ue||Ne?s.replace(N.fullPath,St({scroll:Ne&&Ue&&Ue.scroll},Oe)):s.push(N.fullPath,Oe)),l.value=N,ye(N,le,Y,Ne),fe()}let O;function H(){O||(O=s.listen((N,le,Y)=>{const ue=p(N),Oe=P(ue);if(Oe){D(St(Oe,{replace:!0}),ue).catch(Go);return}d=ue;const Se=l.value;Hs&&Ig(pu(Se.fullPath,Y.delta),Ra()),E(ue,Se).catch(Ne=>yi(Ne,12)?Ne:yi(Ne,2)?(D(Ne.to,ue).then(Ue=>{yi(Ue,20)&&!Y.delta&&Y.type===ir.pop&&s.go(-1,!1)}).catch(Go),Promise.reject()):(Y.delta&&s.go(-Y.delta,!1),ae(Ne,ue,Se))).then(Ne=>{Ne=Ne||L(ue,Se,!1),Ne&&(Y.delta?s.go(-Y.delta,!1):Y.type===ir.pop&&yi(Ne,20)&&s.go(-1,!1)),g(ue,Se,Ne)}).catch(Go)}))}let j=Eo(),re=Eo(),q;function ae(N,le,Y){fe(N);const ue=re.list();return ue.length?ue.forEach(Oe=>Oe(N,le,Y)):console.error(N),Promise.reject(N)}function G(){return q&&l.value!==bi?Promise.resolve():new Promise((N,le)=>{j.add([N,le])})}function fe(N){return q||(q=!N,H(),j.list().forEach(([le,Y])=>N?Y(N):le()),j.reset()),N}function ye(N,le,Y,ue){const{scrollBehavior:Oe}=t;if(!Hs||!Oe)return Promise.resolve();const Se=!Y&&Lg(pu(N.fullPath,0))||(ue||!Y)&&history.state&&history.state.scroll||null;return ff().then(()=>Oe(N,le,Se)).then(Ne=>Ne&&Dg(Ne)).catch(Ne=>ae(Ne,N,le))}const Re=N=>s.go(N);let Be;const Je=new Set;return{currentRoute:l,addRoute:m,removeRoute:b,hasRoute:_,getRoutes:y,resolve:p,options:t,push:S,replace:I,go:Re,back:()=>Re(-1),forward:()=>Re(1),beforeEach:o.add,beforeResolve:r.add,afterEach:a.add,onError:re.add,isReady:G,install(N){const le=this;N.component("RouterLink",g0),N.component("RouterView",x0),N.config.globalProperties.$router=le,Object.defineProperty(N.config.globalProperties,"$route",{enumerable:!0,get:()=>zo(l)}),Hs&&!Be&&l.value===bi&&(Be=!0,S(s.location).catch(Oe=>{}));const Y={};for(const Oe in bi)Y[Oe]=Yn(()=>l.value[Oe]);N.provide(Qc,le),N.provide(Jf,dr(Y)),N.provide(Gl,l);const ue=N.unmount;Je.add(N),N.unmount=function(){Je.delete(N),Je.size<1&&(d=bi,O&&O(),O=null,l.value=bi,Be=!1,q=!1),ue()}}}}function ws(t){return t.reduce((e,n)=>e.then(()=>n()),Promise.resolve())}function M0(t,e){const n=[],i=[],s=[],o=Math.max(e.matched.length,t.matched.length);for(let r=0;rno(d,a))?i.push(a):n.push(a));const l=t.matched[r];l&&(e.matched.find(d=>no(d,l))||s.push(l))}return[n,i,s]}class E0{constructor(e,n,i){this.onConnect=n,this.onDisconnect=i,this.options=e,this.port=null,this.isOpened=!1,this.setupListeners()}async open(){try{const e=await navigator.serial.requestPort();return await e.open(this.options),this.port=e,this.isOpened=!0,this.port.getInfo()}catch(e){throw console.error(e),e}}async close(){await this.port.close(),this.isOpened=!1}async write(e){if(this.port.writable){let n=this.port.writable.getWriter();await n.write(e),n.releaseLock()}}async read(){let e=new TextDecoder;for(;this.port.readable;){if(this.port.readable.locked==!0)return new Uint8Array(0);let n=this.port.readable.getReader(),i,s=0;try{for(;;){let{value:o,done:r}=await n.read();s=s+o.length,typeof i=="undefined"?i=o:i=new Uint8Array([...i,...o]);let a=e.decode(i);if(a.includes("ok")||a.includes("error")||a.includes("ALARM")||r){n.releaseLock();break}}return i.length>2048?i.slice(i.length-2048):i}catch(o){throw console.error(o),o}finally{n.releaseLock()}}}setupListeners(){navigator.serial.addEventListener("connect",this.onConnect),navigator.serial.addEventListener("disconnect",this.onDisconnect)}}var ct=(t,e)=>{const n=t.__vccOpts||t;for(const[i,s]of e)n[i]=s;return n};const w0={data(){return{serialPortHandler:this.serialPortHandler,lastMessage:""}},computed:{isOpened(){return this.serialPortHandler?this.serialPortHandler.isOpened==!0:!1}},methods:{async connect(){try{if(this.serialPortHandler.isOpened)return;const t=await this.serialPortHandler.open();this.lastMessage=""}catch(t){console.log(t),this.lastMessage="Failed to open serial port"}},disconnect(){if(this.serialPortHandler.isOpened){let t=0;for(;(this.serialPortHandler.port.readable.locked||this.serialPortHandler.port.writable.locked)&&(console.log("waiting..."),setTimeout(10),t++,!(t>10)););this.serialPortHandler.close()}}},mounted(){if(!("serial"in navigator)){this.lastMessage="Web Serial API is not supported in your browser",console.error(this.lastMessage);return}this.serialPortHandler=new E0({baudRate:115200},()=>{console.log("Device connected")},()=>{this.serialPortHandler.isOpened=!1,console.log("Device disconnected")})}},T0={class:"container"},C0={class:"navbar navbar-expand-lg navbar-light bg-light"},A0={class:"container-fluid"},P0=c("div",null,null,-1),R0={class:"text-danger p-1 m-0",role:"alert"},D0={key:0},I0={class:"row"},L0=c("div",{class:"col"},null,-1),U0={class:"col-auto text-center"},F0=["title"],O0={class:"col-auto"};function N0(t,e,n,i,s,o){const r=et("RouterView");return W(),ee("div",T0,[c("header",null,[c("nav",C0,[c("div",A0,[P0,c("div",R0,[s.lastMessage!=""?(W(),ee("span",D0,"\u26A0 "+ze(s.lastMessage),1)):st("",!0)]),c("div",null,[c("form",null,[c("div",I0,[L0,c("div",U0,[c("span",{class:je(o.isOpened==!0?"fs-4 text-success":"fs-4 text-secondary"),title:o.isOpened==!0?"Connected":"Disconnected"},"\u25CF \u2699",10,F0)]),c("div",O0,[o.isOpened==!1?(W(),ee("button",{key:0,type:"button",onClick:e[0]||(e[0]=a=>o.connect()),class:"btn btn-dark btn-sm"},"Connect")):st("",!0),o.isOpened==!0?(W(),ee("button",{key:1,type:"button",onClick:e[1]||(e[1]=a=>o.disconnect()),class:"btn btn-dark btn-sm"},"Disconnect")):st("",!0)])])])])])])]),ke(r)])}var z0=ct(w0,[["render",N0]]);const k0="modulepreload",Tu={},B0="/",V0=function(e,n){return!n||n.length===0?e():Promise.all(n.map(i=>{if(i=`${B0}${i}`,i in Tu)return;Tu[i]=!0;const s=i.endsWith(".css"),o=s?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${i}"]${o}`))return;const r=document.createElement("link");if(r.rel=s?"stylesheet":k0,s||(r.as="script",r.crossOrigin=""),r.href=i,document.head.appendChild(r),s)return new Promise((a,l)=>{r.addEventListener("load",a),r.addEventListener("error",()=>l(new Error(`Unable to preload CSS for ${i}`)))})})).then(()=>e())},H0={props:{state:Boolean}},$0={key:0,class:"badge bg-success"},G0={key:1,class:"badge bg-danger"};function W0(t,e,n,i,s,o){return W(),ee("span",null,[n.state==!0?(W(),ee("span",$0," On ")):(W(),ee("span",G0," Off "))])}var X0=ct(H0,[["render",W0]]);const j0={components:{OnOff:X0},props:{state:Object,pnpProcessing:Object,valvesState:Object,pumpState:Boolean},computed:{statusString(){return this.pnpProcessing.runFlag==!0?this.pnpProcessing.pauseFlag==!0?"Paused":"Job":this.state.status}}},Y0={class:"card"},q0=c("div",{class:"card-header"},"Controller state",-1),Z0={class:"card-body"},K0={class:"row"},J0={class:"col text-center"},Q0={class:"row"},ev=c("div",{class:"col-auto"},"X",-1),tv={class:"col text-end"},nv={class:"row"},iv=c("div",{class:"col-auto"},"Y",-1),sv={class:"col text-end"},ov={class:"row"},rv=c("div",{class:"col-auto"},"Z",-1),av={class:"col text-end"},lv={class:"row"},cv=c("div",{class:"col-auto"},"A",-1),dv={class:"col text-end"},uv={class:"row"},hv=c("div",{class:"col-auto"},"Pump",-1),fv={class:"col text-end"},pv={class:"row"},mv={class:"col-auto"},_v={class:"col text-end"};function gv(t,e,n,i,s,o){const r=et("OnOff");return W(),ee("div",Y0,[q0,c("div",Z0,[c("div",K0,[c("div",J0,[c("h3",{class:je("Status "+o.statusString)},ze(o.statusString),3)])]),c("div",Q0,[ev,c("div",tv,ze(n.state.pos.x),1)]),c("div",nv,[iv,c("div",sv,ze(n.state.pos.y),1)]),c("div",ov,[rv,c("div",av,ze(n.state.pos.z),1)]),c("div",lv,[cv,c("div",dv,ze(n.state.pos.a),1)]),c("div",uv,[hv,c("div",fv,[ke(r,{state:n.pumpState},null,8,["state"])])]),(W(!0),ee(rt,null,wt(n.valvesState,(a,l)=>(W(),ee("div",pv,[c("div",mv,"Valve "+ze(l+1),1),c("div",_v,[ke(r,{state:a},null,8,["state"])])]))),256))])])}var vv=ct(j0,[["render",gv]]);const bv={props:{disabled:Boolean,enabledUnderAlaram:Boolean,settings:Object,valvesState:Object,pumpState:Boolean,movingOptions:Object},data:function(){return{tab:0,valves:[!1,!1],pump:!1}},methods:{command(t){this.$emit("command",t)},togglePump(){this.$emit("togglePump")},toggleValve(t){this.$emit("toggleValve",t)},togglePosition(){this.$emit("toggleCamNozzlePosition")}},watch:{valvesState:{handler(t,e){this.valves=this.valvesState},deep:!0},pumpState:{handler(t,e){this.pump=this.pumpState},deep:!0}}},yv={class:"border p-3 mt-1"},xv={class:"nav nav-tabs"},Sv={class:"nav-item"},Mv={class:"nav-item"},Ev={key:0,class:"p-2"},wv={class:"row"},Tv={class:"col p-1"},Cv=["disabled"],Av={class:"col p-1"},Pv=["disabled"],Rv={class:"col p-1"},Dv=["disabled"],Iv={class:"col p-1"},Lv=["disabled"],Uv={class:"row"},Fv={class:"col p-1"},Ov=["disabled"],Nv={class:"col p-1 text-nowrap"},zv={class:"row p-0 m-0"},kv={class:"col p-0 m-0"},Bv=["disabled"],Vv=c("div",{class:"col-auto p-1 m-0"},null,-1),Hv={class:"col p-0 m-0"},$v=["disabled"],Gv={class:"col p-1"},Wv=["disabled"],Xv={class:"col p-1"},jv=["disabled"],Yv={class:"row"},qv={class:"col p-1"},Zv=["disabled"],Kv={class:"col p-1"},Jv=["disabled"],Qv={class:"col p-1"},eb=["disabled"],tb={class:"col p-1"},nb=["disabled"],ib={class:"row"},sb={class:"col p-1"},ob=Ie(" Step size XYZ (mm): "),rb={class:"row"},ab={class:"col p-1"},lb=Ie(" Feed rate XYZ: "),cb=c("hr",null,null,-1),db={class:"row"},ub={class:"col p-1"},hb=Ie(" Steps A (1.0 setep = 1 turn): "),fb={class:"row"},pb={class:"col p-1"},mb=Ie(" Feed rate A: "),_b={key:0,class:"row mt-4"},gb={class:"col p-1"},vb={class:"form-check form-switch"},bb=["disabled"],yb=c("label",{class:"form-check-label",for:"pump"},"Pump",-1),xb={key:1,class:"row mt-4"},Sb={class:"col p-1"},Mb={class:"form-check form-switch"},Eb=["onUpdate:modelValue","onClick","disabled","id"],wb=["for"],Tb={key:1},Cb={class:"row"},Ab={class:"col p-1"},Pb=["disabled"],Rb={class:"col p-1"},Db=["disabled"],Ib={class:"col p-1"},Lb=["disabled"],Ub={class:"row"},Fb={class:"col p-1"},Ob=["disabled"],Nb={class:"col p-1"},zb=["disabled"],kb={class:"row"},Bb={class:"col p-1"},Vb=["disabled"],Hb={class:"row"},$b={class:"col p-1"},Gb=["disabled"],Wb={class:"col p-1"},Xb=["disabled"],jb={class:"row"},Yb={class:"col p-1"},qb=["disabled"],Zb={key:0},Kb=Ie(" Camera \u21D2 Nozzle"),Jb=c("br",null,null,-1),Qb=Ie("Toggle Position "),ey=[Kb,Jb,Qb],ty={key:1},ny=Ie(" Nozzle \u21D2 Camera"),iy=c("br",null,null,-1),sy=Ie("Toggle Position "),oy=[ny,iy,sy];function ry(t,e,n,i,s,o){return W(),ee("div",yv,[c("ul",xv,[c("li",Sv,[c("a",{class:je("nav-link"+(t.tab==0?" active":"")),onClick:e[0]||(e[0]=r=>t.tab=0)},"Jog Controller",2)]),c("li",Mv,[c("a",{class:je("nav-link"+(t.tab==1?" active":"")),onClick:e[1]||(e[1]=r=>t.tab=1)},"Toolbox",2)])]),t.tab==0?(W(),ee("div",Ev,[c("div",wv,[c("div",Tv,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[2]||(e[2]=r=>o.command("X-Y+"))},"\u{1F884}",8,Cv)]),c("div",Av,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[3]||(e[3]=r=>o.command("Y+"))},"\u{1F881}Y+",8,Pv)]),c("div",Rv,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[4]||(e[4]=r=>o.command("X+Y+"))},"\u{1F885}",8,Dv)]),c("div",Iv,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[5]||(e[5]=r=>o.command("Z+"))},"Z+",8,Lv)])]),c("div",Uv,[c("div",Fv,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[6]||(e[6]=r=>o.command("X-"))},"\u{1F878}X-",8,Ov)]),c("div",Nv,[c("div",zv,[c("div",kv,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[7]||(e[7]=r=>o.command("RR"))},"\u2B6E",8,Bv)]),Vv,c("div",Hv,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[8]||(e[8]=r=>o.command("RL"))},"\u2B6F",8,$v)])])]),c("div",Gv,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[9]||(e[9]=r=>o.command("X+"))},"X+\u{1F87A}",8,Wv)]),c("div",Xv,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[10]||(e[10]=r=>o.command("Parking")),title:"Parking"},"P",8,jv)])]),c("div",Yv,[c("div",qv,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[11]||(e[11]=r=>o.command("X-Y-"))},"\u{1F887}",8,Zv)]),c("div",Kv,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[12]||(e[12]=r=>o.command("Y-"))},"\u{1F883}Y-",8,Jv)]),c("div",Qv,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[13]||(e[13]=r=>o.command("X+Y-"))},"\u{1F886}",8,eb)]),c("div",tb,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[14]||(e[14]=r=>o.command("Z-"))},"Z-",8,nb)])]),c("div",ib,[c("div",sb,[ob,se(c("input",{"onUpdate:modelValue":e[15]||(e[15]=r=>n.movingOptions.stepSize=r),type:"number",step:"1.0",class:"form-control form-control-sm"},null,512),[[_e,n.movingOptions.stepSize]])])]),c("div",rb,[c("div",ab,[lb,se(c("input",{"onUpdate:modelValue":e[16]||(e[16]=r=>n.movingOptions.feedRateXYZ=r),type:"number",step:"1.0",class:"form-control form-control-sm"},null,512),[[_e,n.movingOptions.feedRateXYZ]])])]),cb,c("div",db,[c("div",ub,[hb,se(c("input",{"onUpdate:modelValue":e[17]||(e[17]=r=>n.movingOptions.rotateStep=r),type:"number",step:"0.1",class:"form-control form-control-sm"},null,512),[[_e,n.movingOptions.rotateStep]])])]),c("div",fb,[c("div",pb,[mb,se(c("input",{"onUpdate:modelValue":e[18]||(e[18]=r=>n.movingOptions.feedRateA=r),type:"number",step:"1.0",class:"form-control form-control-sm"},null,512),[[_e,n.movingOptions.feedRateA]])])]),n.settings.pump?(W(),ee("div",_b,[c("div",gb,[c("div",vb,[se(c("input",{"onUpdate:modelValue":e[19]||(e[19]=r=>t.pump=r),onClick:e[20]||(e[20]=r=>o.togglePump()),disabled:n.disabled,class:"form-check-input",type:"checkbox",role:"switch",id:"pump"},null,8,bb),[[Zn,t.pump]]),yb])])])):st("",!0),n.settings.heads?(W(),ee("div",xb,[(W(!0),ee(rt,null,wt(n.settings.heads,(r,a)=>(W(),ee("div",Sb,[c("div",Mb,[se(c("input",{"onUpdate:modelValue":l=>t.valves[a]=l,onClick:l=>o.toggleValve(a),disabled:n.disabled,class:"form-check-input",type:"checkbox",role:"switch",id:"valve"+a},null,8,Eb),[[Zn,t.valves[a]]]),c("label",{class:"form-check-label",for:"valve"+a},"Valve "+ze(a+1),9,wb)])]))),256))])):st("",!0)])):st("",!0),t.tab==1?(W(),ee("div",Tb,[c("div",Cb,[c("div",Ab,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[21]||(e[21]=r=>o.command("HomeResetZero"))},"Home Machine & Reset Zero",8,Pb)]),c("div",Rb,[c("button",{disabled:!n.enabledUnderAlaram,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[22]||(e[22]=r=>o.command("Home"))},"Home Machine",8,Db)]),c("div",Ib,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[23]||(e[23]=r=>o.command("ResetZero"))},"Reset Zero",8,Lb)])]),c("div",Ub,[c("div",Fb,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[24]||(e[24]=r=>o.command("Return"))},"Return to Zero XY",8,Ob)]),c("div",Nb,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[25]||(e[25]=r=>o.command("ReturnZ"))},"Return to Zero Z",8,zb)])]),c("div",kb,[c("div",Bb,[c("button",{disabled:!n.enabledUnderAlaram,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[26]||(e[26]=r=>o.command("Unlock"))},"Unlock",8,Vb)])]),c("div",Hb,[c("div",$b,[c("button",{disabled:!n.enabledUnderAlaram,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[27]||(e[27]=r=>o.command("State"))},"Get State",8,Gb)]),c("div",Wb,[c("button",{disabled:!n.enabledUnderAlaram,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[28]||(e[28]=r=>o.command("Pos"))},"Get Position",8,Xb)])]),c("div",jb,[c("div",Yb,[c("button",{disabled:n.disabled,class:je("btn btn-sm btn-outline-secondary jog-100"+(n.movingOptions.topCamNozzlePos==0?"":" active")),onClick:e[29]||(e[29]=r=>o.togglePosition())},[n.movingOptions.topCamNozzlePos==0?(W(),ee("span",Zb,ey)):(W(),ee("span",ty,oy))],10,qb)])])])):st("",!0)])}var ay=ct(bv,[["render",ry]]);const ly={props:{consoleLog:"",disabled:Boolean},data:function(){return{command:this.command,history:[],historyIndex:0}},methods:{sendCommand(){this.$emit("sendCommand",this.command),this.history.push(this.command),this.historyIndex=this.history.length,this.command=""},keyUp(t){t.key=="ArrowUp"&&this.historyIndex>0&&(this.historyIndex--,this.command=this.history[this.historyIndex]),t.key=="ArrowDown"&&this.historyIndex{let t=this.$refs.console;t.scrollTop=t.scrollHeight},100)}}},cy={class:"card mt-1"},dy=c("div",{class:"card-header"},"Console",-1),uy={class:"card-body"},hy={class:"row"},fy={class:"col"},py={class:"row"},my={class:"col mt-1"},_y=["disabled"];function gy(t,e,n,i,s,o){return W(),ee("div",cy,[dy,c("div",uy,[c("div",hy,[c("div",fy,[c("textarea",{readonly:"",rows:"10",ref:"console",class:"form-control form-control-sm"},ze(n.consoleLog),513)])]),c("div",py,[c("div",my,[se(c("input",{"onUpdate:modelValue":e[0]||(e[0]=r=>t.command=r),disabled:n.disabled,onKeyup:[e[1]||(e[1]=Zf(r=>o.sendCommand(this.command),["enter"])),e[2]||(e[2]=(...r)=>o.keyUp&&o.keyUp(...r))],type:"text",class:"form-control form-control-sm"},null,40,_y),[[_e,t.command]])])])])])}var vy=ct(ly,[["render",gy]]);const _s=cf();function Da(t){t===void 0&&(t=_s.value.comp.returnValue()),_s.value.resolve(t),_s.value=null}function td(t,e,n="default"){return new Promise(i=>{_s.value={dialog:t,props:e,wrapper:n,resolve:i}})}const by={install:(t,e)=>{t.config.globalProperties.$close=(n,i)=>{Da(i)}}};var yy=(t,e)=>{const n=t.__vccOpts||t;for(const[i,s]of e)n[i]=s;return n};const xy=mo({name:"DialogWrapper",components:{},props:{name:{type:String,default:"default"},transitionAttrs:Object},setup(){const t=lf();return Vo(t,()=>{_s.value&&(_s.value.comp=t.value)}),{dialogRef:_s,dialogInstance:t}}});function Sy(t,e,n,i,s,o){return W(),Jt(Jc,Qp($f(t.transitionAttrs)),{default:Ct(()=>[t.dialogRef&&t.dialogRef.wrapper===t.name?(W(),Jt(f_(t.dialogRef.dialog),Gf({key:0},t.dialogRef.props,{ref:"dialogInstance"}),null,16)):st("",!0)]),_:1},16)}var My=yy(xy,[["render",Sy]]);const Ey=mo({props:{text:String,title:String},mounted:function(){window.addEventListener("keydown",this.onkey),this.$refs.btn_yes.focus()},beforeUnmount:function(){window.removeEventListener("keydown",this.onkey)},methods:{onkey(t){if(t.keyCode==37){let e=this.$refs.btn_yes;e&&e.focus()}if(t.keyCode==39){let e=this.$refs.btn_no;e&&e.focus()}t.keyCode==27&&this.closeDialog(!1)}},setup(){function t(){return!0}return{returnValue:t,closeDialog:Da}}}),wy={class:"dialog"},Ty={class:"center"},Cy={class:"title"},Ay={class:"text"},Py={class:"p-3 text-center"};function Ry(t,e,n,i,s,o){return W(),ee("div",wy,[c("div",Ty,[c("div",Cy,ze(t.title),1),c("div",Ay,ze(t.text),1),c("div",Py,[c("button",{onClick:e[0]||(e[0]=r=>t.closeDialog()),ref:"btn_yes",class:"btn bt-sm btn-dark mb-1"},"YES",512),c("button",{onClick:e[1]||(e[1]=r=>t.closeDialog(!1)),ref:"btn_no",class:"btn bt-sm btn-dark mb-1"},"NO",512)])])])}var Dy=ct(Ey,[["render",Ry],["__scopeId","data-v-cd0635e6"]]);const Iy=mo({props:{text:String,title:String,type:String},mounted:function(){window.addEventListener("keydown",this.onkey),this.$refs.btn_yes.focus()},beforeUnmount:function(){window.removeEventListener("keydown",this.onkey)},methods:{onkey(t){t.keyCode==27&&this.closeDialog(!1)}},setup(){function t(){return!0}return{returnValue:t,closeDialog:Da}}}),Ly={class:"dialog"},Uy={class:"center"},Fy={class:"text"},Oy={class:"p-3 text-center"};function Ny(t,e,n,i,s,o){return W(),ee("div",Ly,[c("div",Uy,[c("div",{class:je("title "+t.type)},ze(t.title),3),c("div",Fy,ze(t.text),1),c("div",Oy,[c("button",{onClick:e[0]||(e[0]=r=>t.closeDialog()),ref:"btn_yes",class:"btn bt-sm btn-dark mb-1"},"OK",512)])])])}var zy=ct(Iy,[["render",Ny],["__scopeId","data-v-7fc707e0"]]);const ky=mo({props:{text:String,title:String,value:String},data(){return{inputValue:this.inputValue}},mounted:function(){window.addEventListener("keydown",this.onkey),this.$refs.btn_yes.focus(),this.inputValue=this.value},beforeUnmount:function(){window.removeEventListener("keydown",this.onkey)},methods:{onkey(t){t.keyCode==13&&this.closeDialog(),t.keyCode==27&&this.closeDialog(!1)}},setup(){function t(){return this.inputValue}return{returnValue:t,closeDialog:Da}}}),By={class:"dialog"},Vy={class:"center"},Hy={class:"title"},$y={class:"text"},Gy={class:"p-3 text-center"};function Wy(t,e,n,i,s,o){return W(),ee("div",By,[c("div",Vy,[c("div",Hy,ze(t.title),1),c("div",$y,[Ie(ze(t.text)+" ",1),se(c("input",{"onUpdate:modelValue":e[0]||(e[0]=r=>t.inputValue=r),class:"form-control"},null,512),[[_e,t.inputValue]])]),c("div",Gy,[c("button",{onClick:e[1]||(e[1]=r=>t.closeDialog()),ref:"btn_yes",class:"btn bt-sm btn-dark mb-1"},"YES",512),c("button",{onClick:e[2]||(e[2]=r=>t.closeDialog(!1)),ref:"btn_no",class:"btn bt-sm btn-dark mb-1"},"NO",512)])])])}var Xy=ct(ky,[["render",Wy],["__scopeId","data-v-8751a8c8"]]);async function Un(t,e=""){return await td(Dy,{text:t,title:e})}async function lt(t,e="",n=""){return await td(zy,{text:t,title:e,type:n})}async function jy(t,e="",n=""){return await td(Xy,{text:t,title:e,value:n})}const Yy={props:{machineState:Object,gCodeProcess:Object,disabled:Boolean},data:function(){return{gCode:""}},computed:{enabledControls(){let t={openFile:!0,run:!1,stop:!1,pause:!1,gCode:!this.disabled};return t.run=this.machineState.status=="Idle"&&this.gCodeProcess.stopFlag==!1&&this.gCodeProcess.pauseFlag==!1&&this.gCode.length>0,t.stop=this.machineState.status=="Jog"||this.gCodeProcess.pauseFlag==!0,t.pause=this.machineState.status=="Jog"||this.gCodeProcess.pauseFlag==!0,t}},methods:{openFile(){let t=this.$refs.openFile.files[0];if(t){let e=new FileReader;e.readAsText(t,"UTF-8"),e.onload=n=>{this.gCode=n.target.result},e.onerror=n=>{console.log(n),lt("Can't read file '"+t.name+"'","Error","error")}}},run(){let t=this.gCode.split(` `);this.$emit("run",t)},stop(){this.$emit("stop")},pause(){this.$emit("pause")}}},qy={class:"card"},Zy=c("div",{class:"card-header"},"G Code",-1),Ky={class:"card-body"},Jy={class:"row"},Qy={class:"col"},ex=["disabled"],tx=Ie(" | "),nx=["disabled"],ix=["disabled"],sx=["disabled"],ox={class:"row"},rx={class:"col"};function ax(t,e,n,i,s,o){return W(),ee("div",qy,[Zy,c("div",Ky,[c("div",Jy,[c("div",Qy,[c("input",{type:"file",ref:"openFile",accept:".txt, .gcode",style:{display:"none"},onChange:e[0]||(e[0]=r=>o.openFile())},null,544),c("button",{disabled:!o.enabledControls.openFile,class:"btn btn-sm btn-outline-secondary",onClick:e[1]||(e[1]=r=>t.$refs.openFile.click())},"Open\u2026",8,ex),tx,c("button",{disabled:!o.enabledControls.run,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[2]||(e[2]=r=>o.run())},"Run",8,nx),c("button",{disabled:!o.enabledControls.stop,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[3]||(e[3]=r=>o.stop())},"Stop",8,ix),c("button",{disabled:!o.enabledControls.pause,class:je("btn btn-sm btn-outline-secondary m-1"+(this.gCodeProcess.pauseFlag==!0?" active":"")),onClick:e[4]||(e[4]=r=>o.pause())},"Pause",10,sx)])]),c("div",ox,[c("div",rx,[se(c("textarea",{"onUpdate:modelValue":e[5]||(e[5]=r=>t.gCode=r),rows:"15",class:"form-control form-control-sm"},null,512),[[_e,t.gCode]])])])])])}var lx=ct(Yy,[["render",ax]]);const cx={props:{settings:Object,disabled:!1},data:function(){return{values:{},description:{0:"Step pulse time, microseconds",1:"Step idle delay, milliseconds",2:"Step pulse invert, mask",3:"Step direction invert, mask",4:"Invert step enable pin, boolean",5:"Invert limit pins, boolean/mask",6:"Invert probe pin, boolean",7:"Disable spindle with 0 speed, boolean",8:"Ganged axes direction invert as bitfield",10:"Status report options, mask",11:"Junction deviation, millimeters",12:"Arc tolerance, millimeters",13:"Report in inches, boolean",14:"Limit pins invert, mask",15:"Coolant pins invert, mask",16:"Spindle pins invert, mask",17:"Control pins pullup disable, mask",18:"Limit pins pullup disable, mask",19:"Probe pin pullup disable, boolean",20:"Soft limits enable, boolean",21:"Hard limits enable, boolean",22:"Homing cycle enable, boolean (Grbl) / mask (GrblHAL)",23:"Homing direction invert, mask",24:"Homing locate feed rate, mm/min",25:"Homing search seek rate, mm/min",26:"Homing switch debounce delay, milliseconds",27:"Homing switch pull-off distance, millimeters",28:"G73 retract distance, in mm",29:"Step pulse delay (ms)",30:"Maximum spindle speed, RPM",31:"Minimum spindle speed, RPM",32:"Laser-mode enable, boolean",33:"Spindle PWM frequency",34:"Spindle off Value",35:"Spindle min value",36:"Spindle max value",37:"Stepper deenergize mask",39:"Enable printable realtime command characters, boolean",40:"Apply soft limits for jog commands, boolean",43:"Homing passes",44:"Homing cycle 1",45:"Homing cycle 2",46:"Homing cycle 3",47:"Homing cycle 4",62:"Sleep Enable",63:"Feed Hold Actions",64:"Force Init Alarm",65:"Require homing sequence to be executed at startup",70:"Network Services",73:"Wifi Mode",74:"",75:"",100:"X-axis steps per millimeter",101:"Y-axis steps per millimeter",102:"Z-axis steps per millimeter",103:"A-axis steps per millimeter",110:"X-axis maximum rate, mm/min",111:"Y-axis maximum rate, mm/min",112:"Z-axis maximum rate, mm/min",113:"A-axis maximum rate, mm/min",120:"X-axis acceleration, mm/sec^2",121:"Y-axis acceleration, mm/sec^2",122:"Z-axis acceleration, mm/sec^2",123:"A-axis acceleration, mm/sec^2",130:"X-axis maximum travel, millimeters",131:"Y-axis maximum travel, millimeters",132:"Z-axis maximum travel, millimeters",133:"A-axis maximum travel, millimeters",300:"Hostname",302:"IP Address",303:"Gateway",304:"Netmask",305:"Telnet Port",306:"HTTP Port",307:"Websocket Port",341:"Tool Change Mode",342:"Tool Change probing distance",343:"Tool Change Locate Feed rate",344:"Tool Change Search Seek rate",345:"Tool Change Probe Pull Off rate",370:"Invert I/O Port Inputs (mask)",384:"Disable G92 Persistence",346:"ToolChangeOptions",372:"Io Port Invert Out",376:"Rotary Axes",394:"Spindle On Delay",398:"Planner Blocks",481:"Auto Report Interval",484:"Unlock After EStop",486:"Offset Lock",538:"Rotary Wrap",539:"Spindle Off Delay",673:"Coolant On Delay",676:"Reset Actions",680:"Stepper Enable Delay"}}},computed:{settingsList(){for(let t in this.settings)typeof this.values[t]=="undefined"&&(this.values[t]=this.settings[t]);return this.values}},methods:{saveSetting(t){let e=["$"+t+"="+this.values[t],"$"+t];this.$emit("sendCommand",e)}}},dx={class:"card"},ux=c("div",{class:"card-header"},"Controller Settings",-1),hx={class:"card-body"},fx={class:"row mb-1"},px={class:"col-1"},mx={class:"col-auto"},_x=["onUpdate:modelValue"],gx={class:"col-auto"},vx={key:0},bx=["disabled","onClick"],yx={class:"col"};function xx(t,e,n,i,s,o){return W(),ee("div",dx,[ux,c("div",hx,[(W(!0),ee(rt,null,wt(o.settingsList,(r,a)=>(W(),ee("div",fx,[c("div",px,ze(a),1),c("div",mx,[se(c("input",{"onUpdate:modelValue":l=>t.values[a]=l,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,_x),[[_e,t.values[a]]])]),c("div",gx,[t.values[a]!==n.settings[a]?(W(),ee("span",vx,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary",onClick:l=>o.saveSetting(a)},"Save",8,bx)])):st("",!0)]),c("div",yx,ze(t.description[a]),1)]))),256))])])}var Sx=ct(cx,[["render",xx]]),Hn={methods:{machineStateIsOK(){if(this.machineState){if(this.machineState.status=="Idle")return!0;lt("Controller status is wrong","Error","error")}else lt("Controller state is wrong","Error","error");return!1}}};const Mx={mixins:[Hn],props:{cams:Object,machineState:Object,machinePos:Object,settings:Object,showWindow:Object,disabled:Boolean,loading:Boolean},data:function(){return{tab:0,calibrationShow:[!1,!1],currentPos:{x:0,y:0}}},methods:{calibrate(t){this.$emit("calibrate",t)},rememberPos(){this.machineStateIsOK()==!0&&(this.currentPos.x=this.machinePos.x,this.currentPos.y=this.machinePos.y)},calculateOffset(t){if(this.machineStateIsOK()==!0){let e=Math.round((this.currentPos.x-this.machinePos.x)*1e3)/1e3,n=Math.round((this.currentPos.y-this.machinePos.y)*1e3)/1e3;this.cams[t].offset.x=e,this.cams[t].offset.y=n}},setPosition(t){this.machineStateIsOK()==!0&&(this.cams[t].pos.x=this.machinePos.x,this.cams[t].pos.y=this.machinePos.y,this.cams[t].pos.z=this.machinePos.z)},jogBottomCamPos(){let t=[],e=parseFloat(this.cams[1].pos.x),n=parseFloat(this.cams[1].pos.y),i=parseFloat(this.cams[1].pos.z),s=this.settings.heads[0].safePosZ;t.push(`$J=G21G90Z${s}F2000`),t.push(`$J=G21G90X${e}Y${n}F2000`),t.push(`$J=G21G90Z${i}F2000`),this.$emit("sendCommands",t)},toggleCamParamRaw(t){this.$emit("toggleCam",{number:t,raw:1,cv:0,ppmm:this.cams[t].ppmm,grid:0,marker:0})},toggleCamParam(t){this.$emit("toggleCam",{number:t,raw:0,cv:0,ppmm:this.cams[t].ppmm,grid:1,marker:1})},changeCamParam(t){this.$emit("changeCamParam",{number:t,raw:0,cv:0,ppmm:this.cams[t].ppmm,grid:1,marker:1})},applaySettings(){this.$emit("applaySettings")}}},Ex={class:"card"},wx=c("div",{class:"card-header"},"Cameras Settings",-1),Tx={class:"card-body"},Cx={class:"row"},Ax={class:"card"},Px={class:"card-header"},Rx={class:"card-body"},Dx={class:"row"},Ix={class:"col"},Lx={class:"mb-3"},Ux=c("label",{class:"form-label"},"ID",-1),Fx=["onClick"],Ox=["onUpdate:modelValue"],Nx=c("div",{class:"form-text"},`ID of camera. Use command 'ls /dev/v4l/by-id/' to view USB cameras list. After changing pleas press "Applay settings"`,-1),zx=c("div",{class:"form-text"},[Ie("Use command '"),c("b",null,"ls /dev/v4l/by-id/"),Ie("' to view USB cameras list")],-1),kx={class:"mb-3"},Bx=c("label",{class:"form-label"},"Capture frame size",-1),Vx={class:"row mb-2"},Hx={class:"col"},$x={class:"row"},Gx=c("div",{class:"col-auto pt-1"},"Width:",-1),Wx={class:"col"},Xx=["onUpdate:modelValue"],jx={class:"col"},Yx={class:"row"},qx=c("div",{class:"col-auto pt-1"},"Height:",-1),Zx={class:"col"},Kx=["onUpdate:modelValue"],Jx={class:"mb-3"},Qx=c("label",{class:"form-label"},"Undistorting method",-1),eS={class:"row mb-2"},tS={class:"col"},nS=["onUpdate:modelValue"],iS=c("option",{value:0},"Distortion factor",-1),sS=c("option",{value:1},"Calibration data",-1),oS=[iS,sS],rS={key:0,class:"mb-3"},aS=c("label",{class:"form-label"},"Distortion factor",-1),lS={class:"row mb-2"},cS={class:"col"},dS=["onUpdate:modelValue"],uS=c("div",{class:"form-text"},'Positive and negative value available. After changing pleas press "Applay settings"',-1),hS={key:1,class:"mb-3"},fS=c("label",{class:"form-label"},"Calibration data",-1),pS={key:0,class:"row"},mS=c("div",{class:"col-auto"},"matrix:",-1),_S={class:"col-auto"},gS=c("div",{class:"col-auto"},"distortion:",-1),vS={class:"col-auto"},bS={class:"col text-end"},yS=["onClick"],xS={key:1,class:"row"},SS={class:"col"},MS=Ie("[Hiden] "),ES=["onClick"],wS=c("div",{class:"form-text"},[Ie("Please print "),c("a",{href:"images/calibration.svg",target:"_blank"},"this"),Ie(" picture, put it under cams focus then press button 'Calibration'")],-1),TS=["onClick"],CS={key:2,class:"mb-3"},AS=c("label",{class:"form-label"},"Offset from nozzle of head #1",-1),PS={class:"pb-2"},RS=["disabled"],DS=Ie(" Then move camera to Nozzle position and press "),IS=["disabled","onClick"],LS={class:"row mb-2"},US={class:"col"},FS={class:"row"},OS=c("div",{class:"col-auto pt-1"},"X:",-1),NS={class:"col"},zS=["onUpdate:modelValue"],kS={class:"col"},BS={class:"row"},VS=c("div",{class:"col-auto pt-1"},"Y:",-1),HS={class:"col"},$S=["onUpdate:modelValue"],GS=c("div",{class:"col-auto"},null,-1),WS=c("div",{class:"form-text"},"Top camera offset from nozzle of first head",-1),XS={key:3,class:"mb-3"},jS=c("label",{class:"form-label"},"Position",-1),YS={class:"row mb-2"},qS={class:"col"},ZS={class:"row"},KS=c("div",{class:"col-auto pt-1"},"X:",-1),JS={class:"col"},QS=["onUpdate:modelValue"],e1={class:"col"},t1={class:"row"},n1=c("div",{class:"col-auto pt-1"},"Y:",-1),i1={class:"col"},s1=["onUpdate:modelValue"],o1={class:"col"},r1={class:"row"},a1=c("div",{class:"col-auto pt-1"},"Z:",-1),l1={class:"col"},c1=["onUpdate:modelValue"],d1={class:"col-auto"},u1=["disabled","onClick"],h1=c("div",{class:"form-text"},"Nozzle position over Bottom camera",-1),f1=["disabled"],p1={class:"card mt-1"},m1=c("div",{class:"card-header"},"Image Transform",-1),_1={class:"card-body"},g1={class:"mb-3"},v1=c("label",{class:"form-label"},"Rotation",-1),b1={class:"row mb-2"},y1={class:"col"},x1=["onUpdate:modelValue"],S1=c("option",{value:0},"No",-1),M1=c("option",{value:90},"90",-1),E1=c("option",{value:180},"180",-1),w1=c("option",{value:-90},"-90",-1),T1=[S1,M1,E1,w1],C1={class:"mb-3"},A1=c("label",{class:"form-label"},"Scale",-1),P1={class:"row mb-2"},R1={class:"col"},D1={class:"row"},I1=c("div",{class:"col-auto pt-1"},"Width:",-1),L1={class:"col"},U1=["onUpdate:modelValue"],F1={class:"col"},O1={class:"row"},N1=c("div",{class:"col-auto pt-1"},"Height:",-1),z1={class:"col"},k1=["onUpdate:modelValue"],B1={class:"card mt-1"},V1=c("div",{class:"card-header"},"Resolution",-1),H1={class:"card-body"},$1={class:"mb-3"},G1=c("label",{class:"form-label"},"Resolution (pixels per millimeter)",-1),W1=["onClick"],X1=["onUpdate:modelValue","onChange"],j1=c("div",{class:"form-text"},[Ie("Please print "),c("a",{href:"images/calibration.svg",target:"_blank"},"this"),Ie(" picture, put it under center of cams focus then change the resolution until the marker matches the image of square.")],-1),Y1={class:"card mt-1"},q1=c("div",{class:"card-header"},"Light",-1),Z1={class:"card-body"},K1={class:"mb-3"},J1=c("label",{class:"form-label"},"Light on command",-1),Q1=["onUpdate:modelValue"],eM={class:"mb-3"},tM=c("label",{class:"form-label"},"Light off command",-1),nM=["onUpdate:modelValue"],iM={class:"row mt-2"},sM={class:"col"},oM=["disabled"];function rM(t,e,n,i,s,o){return W(),ee("div",Ex,[wx,c("div",Tx,[c("div",Cx,[(W(!0),ee(rt,null,wt(n.cams,(r,a)=>(W(),ee("div",{class:"col",key:a},[c("div",Ax,[c("div",Px,"Camera "+ze(r.name),1),c("div",Rx,[c("div",Dx,[c("div",Ix,[c("div",Lx,[Ux,c("button",{class:je("btn btn-sm btn-outline-secondary float-end p-0 ps-1 pe-1 m-0 me-1"+(n.showWindow[a]==!0?" active":"")),onClick:l=>o.toggleCamParamRaw(a)},"Raw view",10,Fx),se(c("input",{"onUpdate:modelValue":l=>r.id=l,type:"text",class:"form-control form-control-sm"},null,8,Ox),[[_e,r.id]]),Nx,zx]),c("div",kx,[Bx,c("div",Vx,[c("div",Hx,[c("div",$x,[Gx,c("div",Wx,[se(c("input",{"onUpdate:modelValue":l=>r.size.width=l,type:"number",step:"1",class:"form-control form-control-sm"},null,8,Xx),[[_e,r.size.width]])])])]),c("div",jx,[c("div",Yx,[qx,c("div",Zx,[se(c("input",{"onUpdate:modelValue":l=>r.size.height=l,type:"number",step:"1",class:"form-control form-control-sm"},null,8,Kx),[[_e,r.size.height]])])])])])]),c("div",Jx,[Qx,c("div",eS,[c("div",tS,[se(c("select",{"onUpdate:modelValue":l=>r.undistort.type=l,class:"form-control form-control-sm"},oS,8,nS),[[Kn,r.undistort.type]])])])]),r.undistort.type==0?(W(),ee("div",rS,[aS,c("div",lS,[c("div",cS,[se(c("input",{"onUpdate:modelValue":l=>r.undistort.distortion_f=l,type:"number",step:"0.001",class:"form-control form-control-sm"},null,8,dS),[[_e,r.undistort.distortion_f]])])]),uS])):st("",!0),r.undistort.type==1?(W(),ee("div",hS,[fS,t.calibrationShow[a]==!0?(W(),ee("div",pS,[mS,c("div",_S,ze(r.calibration.matrix),1),gS,c("div",vS,ze(r.calibration.distortion),1),c("div",bS,[c("button",{class:"btn btn-sm btn-link p-0 ps-1 pe-1",onClick:l=>t.calibrationShow[a]=!1},"Hide",8,yS)])])):(W(),ee("div",xS,[c("div",SS,[MS,c("button",{class:"btn btn-sm btn-link p-0 ps-1 pe-1",onClick:l=>t.calibrationShow[a]=!0},"Show",8,ES)])])),wS,c("button",{class:"btn btn-sm btn-outline-secondary",onClick:l=>o.calibrate(a)},"Calibrate",8,TS)])):st("",!0),a==0?(W(),ee("div",CS,[AS,c("div",PS,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary p-0 ps-1 pe-1 m-0",onClick:e[0]||(e[0]=l=>o.rememberPos())},"Remember Current Position ("+ze(t.currentPos)+")",9,RS),DS,c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary p-0 ps-1 pe-1 m-0",onClick:l=>o.calculateOffset(a)},"Calculate Offset",8,IS)]),c("div",LS,[c("div",US,[c("div",FS,[OS,c("div",NS,[se(c("input",{"onUpdate:modelValue":l=>r.offset.x=l,type:"number",step:"0.01",class:"form-control form-control-sm"},null,8,zS),[[_e,r.offset.x]])])])]),c("div",kS,[c("div",BS,[VS,c("div",HS,[se(c("input",{"onUpdate:modelValue":l=>r.offset.y=l,type:"number",step:"0.01",class:"form-control form-control-sm"},null,8,$S),[[_e,r.offset.y]])])])]),GS]),WS])):st("",!0),a==1?(W(),ee("div",XS,[jS,c("div",YS,[c("div",qS,[c("div",ZS,[KS,c("div",JS,[se(c("input",{"onUpdate:modelValue":l=>r.pos.x=l,type:"number",step:"0.01",class:"form-control form-control-sm"},null,8,QS),[[_e,r.pos.x]])])])]),c("div",e1,[c("div",t1,[n1,c("div",i1,[se(c("input",{"onUpdate:modelValue":l=>r.pos.y=l,type:"number",step:"0.01",class:"form-control form-control-sm"},null,8,s1),[[_e,r.pos.y]])])])]),c("div",o1,[c("div",r1,[a1,c("div",l1,[se(c("input",{"onUpdate:modelValue":l=>r.pos.z=l,type:"number",step:"0.01",class:"form-control form-control-sm"},null,8,c1),[[_e,r.pos.z]])])])]),c("div",d1,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary",onClick:l=>o.setPosition(a)},"Set current controller position",8,u1)])]),h1,c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary p-0 ps-1 pe-1 m-0",onClick:e[1]||(e[1]=l=>o.jogBottomCamPos())},"Jog to Bottom Camera",8,f1)])):st("",!0)])])])]),c("div",p1,[m1,c("div",_1,[c("div",g1,[v1,c("div",b1,[c("div",y1,[se(c("select",{"onUpdate:modelValue":l=>r.image_transform.rotation=l,class:"form-control form-control-sm"},T1,8,x1),[[Kn,r.image_transform.rotation]])])])]),c("div",C1,[A1,c("div",P1,[c("div",R1,[c("div",D1,[I1,c("div",L1,[se(c("input",{"onUpdate:modelValue":l=>r.image_transform.scale_x=l,type:"number",step:"0.01",class:"form-control form-control-sm"},null,8,U1),[[_e,r.image_transform.scale_x]])])])]),c("div",F1,[c("div",O1,[N1,c("div",z1,[se(c("input",{"onUpdate:modelValue":l=>r.image_transform.scale_y=l,type:"number",step:"0.01",class:"form-control form-control-sm"},null,8,k1),[[_e,r.image_transform.scale_y]])])])])])])])]),c("div",B1,[V1,c("div",H1,[c("div",$1,[G1,c("button",{class:je("btn btn-sm btn-outline-secondary float-end p-0 ps-1 pe-1 m-0 me-0"+(n.showWindow[a]==!0?" active":"")),onClick:l=>o.toggleCamParam(a)},"View",10,W1),se(c("input",{"onUpdate:modelValue":l=>r.ppmm=l,onChange:l=>o.changeCamParam(a),type:"number",step:"0.1",class:"form-control form-control-sm"},null,40,X1),[[_e,r.ppmm]]),j1])])]),c("div",Y1,[q1,c("div",Z1,[c("div",K1,[J1,se(c("input",{"onUpdate:modelValue":l=>r.lightOn=l,type:"text",class:"form-control form-control-sm"},null,8,Q1),[[_e,r.lightOn]])]),c("div",eM,[tM,se(c("input",{"onUpdate:modelValue":l=>r.lightOff=l,type:"text",class:"form-control form-control-sm"},null,8,nM),[[_e,r.lightOff]])])])])]))),128))]),c("div",iM,[c("div",sM,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary",onClick:e[2]||(e[2]=r=>o.applaySettings())},"Applay settings",8,oM)])])])])}var aM=ct(Mx,[["render",rM]]);const lM={props:{cvSettings:Object,showWindow:Object,loading:Boolean},methods:{applaySettings(){this.$emit("applaySettings")},toggleCV(t){this.$emit("toggleCV",t)}}},cM={class:"card"},dM=c("div",{class:"card-header"},"Computer Vision Settings",-1),uM={class:"card-body"},hM={class:"row"},fM={class:"card"},pM={class:"card-header"},mM={class:"card-body"},_M={class:"row"},gM={class:"col"},vM={class:"mb-3"},bM=c("label",{class:"form-label"},"Contrast",-1),yM=["onUpdate:modelValue"],xM=c("div",{class:"form-text"},"The default value is 1, meaning no scaling is applied. This parameter controls the contrast of the image.",-1),SM={class:"mb-3"},MM=c("label",{class:"form-label"},"Brightness",-1),EM=["onUpdate:modelValue"],wM=c("div",{class:"form-text"},"The default value is 0, meaning no shift is applied. This parameter controls the brightness of the image.",-1),TM={class:"mb-3"},CM=c("label",{class:"form-label"},"Blur",-1),AM={class:"row"},PM={class:"col-auto"},RM=["onUpdate:modelValue"],DM=c("div",{class:"col-auto mt-1"},"x",-1),IM={class:"col-auto"},LM=["onUpdate:modelValue"],UM=c("div",{class:"form-text"},"This parameter defines the size of the blurring kernel. It's a tuple representing the width and height of the kernel (e.g., (5, 5) for a 5x5 kernel). The kernel size determines the area over which the blurring is applied.",-1),FM={class:"mb-3"},OM=c("label",{class:"form-label"},"Adaptive Threshold block size",-1),NM=["onUpdate:modelValue"],zM=c("div",{class:"form-text"},"The size of the pixel neighborhood used to calculate the threshold, it must be an odd number.",-1),kM={class:"mb-3"},BM=c("label",{class:"form-label"},"Adaptive Threshold C",-1),VM=["onUpdate:modelValue"],HM=c("div",{class:"form-text"},"A constant value subtracted from the calculated mean or weighted sum to fine-tune the threshold. It can be positive, negative, or zero.",-1),$M=["onClick"],GM={class:"card mt-2"},WM=c("div",{class:"card-header"},"Objects parameters (default)",-1),XM={class:"card-body"},jM={class:"mb-3"},YM={class:"form-label capitalize"},qM=["onUpdate:modelValue"],ZM={class:"card mt-2"},KM=c("div",{class:"card-header"},"Misc Settings",-1),JM={class:"card-body"},QM={class:"mb-3"},eE=c("label",{class:"form-label capitalize"},"Delay before image processing:",-1),tE=["onUpdate:modelValue"],nE={class:"row mt-2"},iE={class:"col"},sE=["disabled"];function oE(t,e,n,i,s,o){return W(),ee("div",cM,[dM,c("div",uM,[c("div",hM,[(W(!0),ee(rt,null,wt(n.cvSettings,(r,a)=>(W(),ee("div",{class:"col",key:a},[c("div",fM,[c("div",pM,"Camera "+ze(r.name)+" image transform",1),c("div",mM,[c("div",_M,[c("div",gM,[c("div",vM,[bM,se(c("input",{"onUpdate:modelValue":l=>r.contrast=l,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,yM),[[_e,r.contrast]]),xM]),c("div",SM,[MM,se(c("input",{"onUpdate:modelValue":l=>r.brightness=l,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,EM),[[_e,r.brightness]]),wM]),c("div",TM,[CM,c("div",AM,[c("div",PM,[se(c("input",{"onUpdate:modelValue":l=>r.blur[0]=l,type:"number",step:"1",class:"form-control form-control-sm"},null,8,RM),[[_e,r.blur[0]]])]),DM,c("div",IM,[se(c("input",{"onUpdate:modelValue":l=>r.blur[1]=l,type:"number",step:"1",class:"form-control form-control-sm"},null,8,LM),[[_e,r.blur[1]]])])]),UM]),c("div",FM,[OM,se(c("input",{"onUpdate:modelValue":l=>r.adaptiveThreshold_blockSize=l,type:"number",step:"1",class:"form-control form-control-sm"},null,8,NM),[[_e,r.adaptiveThreshold_blockSize]]),zM]),c("div",kM,[BM,se(c("input",{"onUpdate:modelValue":l=>r.adaptiveThreshold_C=l,type:"number",step:"1",class:"form-control form-control-sm"},null,8,VM),[[_e,r.adaptiveThreshold_C]]),HM]),c("button",{class:je("btn btn-sm btn-outline-secondary float-end p-0 ps-1 pe-1 m-0 me-0"+(n.showWindow[a]==!0?" active":"")),onClick:l=>o.toggleCV(a)},"CV View",10,$M)])])])]),c("div",GM,[WM,c("div",XM,[(W(!0),ee(rt,null,wt(r.objects,(l,d)=>(W(),ee("div",jM,[c("label",YM,ze(d),1),c("div",null,[(W(!0),ee(rt,null,wt(l,(u,f)=>(W(),ee("span",null,[Ie(ze(f)+": ",1),se(c("input",{"onUpdate:modelValue":h=>r.objects[d][f]=h,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,qM),[[_e,r.objects[d][f]]])]))),256))])]))),256))])]),c("div",ZM,[KM,c("div",JM,[c("div",QM,[eE,se(c("input",{"onUpdate:modelValue":l=>r.pauseBefore=l,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,tE),[[_e,r.pauseBefore]])])])])]))),128))]),c("div",nE,[c("div",iE,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary",onClick:e[0]||(e[0]=r=>o.applaySettings())},"Applay settings",8,sE)])])])])}var rE=ct(lM,[["render",oE]]);const aE={props:{heads:Object,nozzles:Object,loading:Boolean},methods:{applaySettings(){this.$emit("applaySettings")}}},lE={class:"card"},cE=c("div",{class:"card-header"},"Heads Settings",-1),dE={class:"card-body"},uE={class:"row"},hE={class:"card"},fE={class:"card-header"},pE={class:"card-body"},mE={class:"mb-3"},_E=c("label",{class:"form-label"},"Safety Z position",-1),gE=["onUpdate:modelValue"],vE=c("div",{class:"form-text"},"Position Z to safety moving head over the table",-1),bE={class:"mb-3"},yE=c("label",{class:"form-label"},"Valve On command",-1),xE=["onUpdate:modelValue"],SE={class:"mb-3"},ME={class:"row"},EE={class:"col"},wE=Ie(" Pause Before On: "),TE=["onUpdate:modelValue"],CE={class:"col"},AE=Ie(" Pause After On: "),PE=["onUpdate:modelValue"],RE={class:"mb-3"},DE=c("label",{class:"form-label"},"Valve Off command",-1),IE=["onUpdate:modelValue"],LE={class:"mb-3"},UE={class:"row"},FE={class:"col"},OE=Ie(" Pause Before Off: "),NE=["onUpdate:modelValue"],zE={class:"col"},kE=Ie(" Pause After Off: "),BE=["onUpdate:modelValue"],VE={class:"mb-3"},HE=c("label",{class:"form-label"},"Output name in GC",-1),$E=["onUpdate:modelValue"],GE={class:"mb-3"},WE=c("label",{class:"form-label"},"Nozzle default",-1),XE=["onUpdate:modelValue"],jE=c("option",{value:-1},"Empty",-1),YE=["value"],qE={class:"row mt-2"},ZE={class:"col"},KE=["disabled"];function JE(t,e,n,i,s,o){return W(),ee("div",lE,[cE,c("div",dE,[c("div",uE,[(W(!0),ee(rt,null,wt(n.heads,(r,a)=>(W(),ee("div",{class:"col",key:a},[c("div",hE,[c("div",fE,"Head "+ze(r.name),1),c("div",pE,[c("div",mE,[_E,se(c("input",{"onUpdate:modelValue":l=>r.safePosZ=l,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,gE),[[_e,r.safePosZ]]),vE]),c("div",bE,[yE,se(c("input",{"onUpdate:modelValue":l=>r.valveOn=l,type:"text",class:"form-control form-control-sm"},null,8,xE),[[_e,r.valveOn]])]),c("div",SE,[c("div",ME,[c("div",EE,[wE,se(c("input",{"onUpdate:modelValue":l=>r.pauseBeforeOn=l,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,TE),[[_e,r.pauseBeforeOn]])]),c("div",CE,[AE,se(c("input",{"onUpdate:modelValue":l=>r.pauseAfterOn=l,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,PE),[[_e,r.pauseAfterOn]])])])]),c("div",RE,[DE,se(c("input",{"onUpdate:modelValue":l=>r.valveOff=l,type:"text",class:"form-control form-control-sm"},null,8,IE),[[_e,r.valveOff]])]),c("div",LE,[c("div",UE,[c("div",FE,[OE,se(c("input",{"onUpdate:modelValue":l=>r.pauseBeforeOff=l,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,NE),[[_e,r.pauseBeforeOff]])]),c("div",zE,[kE,se(c("input",{"onUpdate:modelValue":l=>r.pauseAfterOff=l,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,BE),[[_e,r.pauseAfterOff]])])])]),c("div",VE,[HE,se(c("input",{"onUpdate:modelValue":l=>r.inGC=l,type:"text",class:"form-control form-control-sm"},null,8,$E),[[_e,r.inGC]])]),c("div",GE,[WE,se(c("select",{"onUpdate:modelValue":l=>r.nozzle=l,class:"form-control form-control-sm"},[jE,(W(!0),ee(rt,null,wt(n.nozzles,l=>(W(),ee("option",{value:l.id},ze(l.name),9,YE))),256))],8,XE),[[Kn,r.nozzle]])])])])]))),128))]),c("div",qE,[c("div",ZE,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary",onClick:e[0]||(e[0]=r=>o.applaySettings())},"Applay settings",8,KE)])])])])}var QE=ct(aE,[["render",JE]]);const ew={mixins:[Hn],props:{pump:Object,loading:Boolean},methods:{applaySettings(){this.$emit("applaySettings")}}},tw={class:"card"},nw=c("div",{class:"card-header"},"Pump Settings",-1),iw={class:"card-body"},sw={class:"mb-3"},ow=c("label",{class:"form-label"},"Pump On command",-1),rw={class:"mb-3"},aw=c("label",{class:"form-label"},"Pump Off command",-1),lw={class:"mb-3"},cw=c("label",{class:"form-label"},"Output name in GC",-1),dw={class:"row mt-2"},uw={class:"col"},hw=["disabled"];function fw(t,e,n,i,s,o){return W(),ee("div",tw,[nw,c("div",iw,[c("div",sw,[ow,se(c("input",{"onUpdate:modelValue":e[0]||(e[0]=r=>n.pump.On=r),type:"text",class:"form-control form-control-sm"},null,512),[[_e,n.pump.On]])]),c("div",rw,[aw,se(c("input",{"onUpdate:modelValue":e[1]||(e[1]=r=>n.pump.Off=r),type:"text",class:"form-control form-control-sm"},null,512),[[_e,n.pump.Off]])]),c("div",lw,[cw,se(c("input",{"onUpdate:modelValue":e[2]||(e[2]=r=>n.pump.inGC=r),type:"text",class:"form-control form-control-sm"},null,512),[[_e,n.pump.inGC]])]),c("div",dw,[c("div",uw,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary",onClick:e[3]||(e[3]=r=>o.applaySettings())},"Applay settings",8,hw)])])])])}var pw=ct(ew,[["render",fw]]),Ia={methods:{array_move:function(t,e,n){if(n>=t.length)for(var i=n-t.length+1;i--;)t.push(void 0);t.splice(n,0,t.splice(e,1)[0])},rowUp(t,e){let n=t.indexOf(e);n>0&&this.array_move(t,n,n-1)},rowDown(t,e){let n=t.indexOf(e);n{if(n==!0){let i=t.indexOf(e);t.splice(i,1)}})}}},ys={props:["rows","currentRow"],mounted:function(){window.addEventListener("keydown",this.onkey)},destroyed:function(){window.removeEventListener("keydown",this.onkey)},methods:{onkey:function(t){if(this.$refs.table&&this.$refs.table.contains(document.activeElement)&&(t.keyCode==38||t.keyCode==40)){if(document.activeElement.localName=="select")return;if(this.currentRow){let e=this.rows.indexOf(this.currentRow);t.keyCode==38&&e>0&&(e=e-1),t.keyCode==40&&e-1&&this.$refs[this.currentField]&&typeof this.$refs[this.currentField][t]!="undefined"&&this.$refs[this.currentField][t].focus()}},intValidate:function(t,e){typeof t[e]=="string"&&(t[e]=t[e].replace(/[^0-9\-]/g,""))},floatValidate:function(t,e){typeof t[e]=="string"&&(t[e]=t[e].replace(",","."),t[e]=t[e].replace("..","."),t[e]=t[e].replace(/[^0-9\.\-]/g,""))},array_move:function(t,e,n){if(n>=t.length)for(var i=n-t.length+1;i--;)t.push(void 0);t.splice(n,0,t.splice(e,1)[0])},rowUp(t,e){let n=t.indexOf(e);n>0&&this.array_move(t,n,n-1)},rowDown(t,e){let n=t.indexOf(e);n{if(n==!0){let i=t.indexOf(e);t.splice(i,1)}})}},watch:{currentRow(){this.setFocus()}}};const mw={props:{machinePos:Object},mixins:[ys],data:function(){return{currentField:"dx"}}},_w={class:"scroll"},gw={class:"table",ref:"table"},vw=c("thead",null,[c("tr",null,[c("th"),c("th",null,"a"),c("th",null,"dx"),c("th",null,"dy")])],-1),bw=["onMousedown"],yw={key:0},xw={key:1},Sw=["onUpdate:modelValue"],Mw=["onUpdate:modelValue"],Ew={nowrap:""},ww=["onClick","hidden"];function Tw(t,e,n,i,s,o){return W(),ee("div",_w,[c("table",gw,[vw,c("tbody",null,[(W(!0),ee(rt,null,wt(t.rows,(r,a)=>(W(),ee("tr",{onMousedown:l=>t.setCurrentRow(r),class:je(r==t.currentRow?"active-row":"")},[c("td",null,[r==t.currentRow?(W(),ee("span",yw,"\u2BC8")):(W(),ee("span",xw,"\xA0\xA0"))]),c("td",null,[c("span",{class:je(r.a==n.machinePos.a?"text-success fw-bold":"")},ze(r.a),3)]),c("td",null,[se(c("input",{"onUpdate:modelValue":l=>r.dx=l,ref_for:!0,ref:"dx",onFocus:e[0]||(e[0]=l=>t.currentField="dx"),class:"form-control form-control-sm"},null,40,Sw),[[_e,r.dx]])]),c("td",null,[se(c("input",{"onUpdate:modelValue":l=>r.dy=l,ref_for:!0,ref:"dy",onFocus:e[1]||(e[1]=l=>t.currentField="dy"),class:"form-control form-control-sm"},null,40,Mw),[[_e,r.dy]])]),c("th",Ew,[c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1",onClick:l=>t.$emit("setPos",r),title:"Set nozzle deviation",hidden:r.a==0},"\u{1F78A}",8,ww)])],42,bw))),256))])],512)])}var Cw=ct(mw,[["render",Tw]]);const Aw={data:function(){return{showMenu:this.showMenu}}},Pw={class:"dropdown show"};function Rw(t,e,n,i,s,o){return W(),ee("div",Pw,[c("a",{onClick:e[0]||(e[0]=r=>t.showMenu=!t.showMenu)},[Qs(t.$slots,"menubutton")]),c("div",{class:je("dropdown-menu"+(t.showMenu==!0?" show":"")),onClick:e[1]||(e[1]=r=>t.showMenu=!1)},[Qs(t.$slots,"menuitems")],2)])}var cp=ct(Aw,[["render",Rw]]);const Dw={props:{disabled:Boolean}},Iw=["disabled"];function Lw(t,e,n,i,s,o){return W(),ee("button",{class:"dropdown-item",disabled:n.disabled,type:"button"},[Qs(t.$slots,"default")],8,Iw)}var dp=ct(Dw,[["render",Lw]]);const Uw={components:{PopupMenu:cp,PopupMenuItem:dp},props:{row:Object,clipboard:Object}},Fw=Ie("Copy"),Ow=Ie("Paste");function Nw(t,e,n,i,s,o){const r=et("PopupMenuItem"),a=et("PopupMenu");return W(),Jt(a,null,{menubutton:Ct(()=>[Qs(t.$slots,"default")]),menuitems:Ct(()=>[ke(r,{onClick:e[0]||(e[0]=l=>t.$emit("copy",n.row))},{default:Ct(()=>[Fw]),_:1}),ke(r,{disabled:!n.clipboard,onClick:e[1]||(e[1]=l=>t.$emit("paste",n.row))},{default:Ct(()=>[Ow]),_:1},8,["disabled"])]),_:3})}var go=ct(Uw,[["render",Nw]]),xs={methods:{deepMerge(t,e){const n=Object.assign(t);for(const i in e)e.hasOwnProperty(i)&&(t[i]&&typeof t[i]=="object"&&typeof e[i]=="object"?n[i]=this.deepMerge(t[i],e[i]):n[i]=e[i]);return n}}};const zw={mixins:[ys,xs],props:{settings:Object,machineState:Object,machinePos:Object,disabled:Boolean},components:{NozzlesCalibrateTable:Cw,CopyPasteMenu:go},computed:{isCurrent(){return this.currentRow&&this.rows.indexOf(this.currentRow)>-1}},data:function(){return{currentField:"name",currentCalibrateRow:this.currentCalibrateRow,clipboard:this.clipboard}},methods:{doAction(t,e){t=="copy"&&(this.clipboard=Object.assign({},e)),t=="paste"&&(this.clipboard.id=e.id,e=this.deepMerge(e,this.clipboard))}}},kw={class:"row"},Bw={class:"col"},Vw={class:"scroll"},Hw={class:"table mb-5",ref:"table"},$w=c("thead",null,[c("tr",null,[c("th"),c("th",null,"Name"),c("th",null,"Caption"),c("th")])],-1),Gw=["onMousedown"],Ww={key:0},Xw=Ie("\u2BC8"),jw={key:1},Yw=["onUpdate:modelValue"],qw=["onUpdate:modelValue"],Zw={nowrap:""},Kw=["onClick"],Jw=["onClick"],Qw=["onClick"],eT={class:"text-end"},tT={key:0,class:"col"},nT={class:"card"},iT={class:"card-header"},sT={class:"card-body"},oT={class:"mb-3"},rT=c("label",{class:"form-label"},"Name",-1),aT={class:"row mb-2"},lT={class:"col"},cT={class:"mb-3"},dT=c("label",{class:"form-label"},"Caption",-1),uT={class:"row mb-2"},hT={class:"col"},fT={class:"card mt-1"},pT=c("div",{class:"card-header"},"Nozzle calibration table",-1),mT={class:"card-body"},_T=["disabled"];function gT(t,e,n,i,s,o){const r=et("CopyPasteMenu"),a=et("NozzlesCalibrateTable");return W(),ee("div",kw,[c("div",Bw,[c("div",Vw,[c("table",Hw,[$w,c("tbody",null,[(W(!0),ee(rt,null,wt(t.rows,(l,d)=>(W(),ee("tr",{onMousedown:u=>t.setCurrentRow(l),class:je(l==t.currentRow?"active-row":"")},[c("td",null,[l==t.currentRow?(W(),ee("span",Ww,[ke(r,{row:l,clipboard:t.clipboard,onCopy:e[0]||(e[0]=u=>o.doAction("copy",u)),onPaste:e[1]||(e[1]=u=>o.doAction("paste",u))},{default:Ct(()=>[Xw]),_:2},1032,["row","clipboard"])])):(W(),ee("span",jw,"\xA0\xA0"))]),c("td",null,[se(c("input",{"onUpdate:modelValue":u=>l.name=u,ref_for:!0,ref:"name",onFocus:e[2]||(e[2]=u=>t.currentField="name"),class:"form-control form-control-sm"},null,40,Yw),[[_e,l.name]])]),c("td",null,[se(c("input",{"onUpdate:modelValue":u=>l.caption=u,ref_for:!0,ref:"caption",onFocus:e[3]||(e[3]=u=>t.currentField="caption"),class:"form-control form-control-sm"},null,40,qw),[[_e,l.caption]])]),c("th",Zw,[c("button",{class:"btn btn-sm btn-outline-secondary me-1",onClick:u=>t.$emit("up",l)},"\u2BC5",8,Kw),c("button",{class:"btn btn-sm btn-outline-secondary me-1",onClick:u=>t.$emit("down",l)},"\u2BC6",8,Jw),c("button",{class:"btn btn-sm btn-outline-secondary btn-danger",onClick:u=>t.$emit("delete",l)},"\u2BBF",8,Qw)])],42,Gw))),256))])],512),c("div",eT,[c("button",{onClick:e[4]||(e[4]=l=>t.$emit("add")),class:"btn btn-sm btn-outline-secondary"},"Add nozzle")])])]),o.isCurrent?(W(),ee("div",tT,[c("div",nT,[c("div",iT,"Nozzle "+ze(t.currentRow.name)+" (#"+ze(t.currentRow.id)+")",1),c("div",sT,[c("div",oT,[rT,c("div",aT,[c("div",lT,[se(c("input",{"onUpdate:modelValue":e[5]||(e[5]=l=>t.currentRow.name=l),type:"text",class:"form-control form-control-sm"},null,512),[[_e,t.currentRow.name]])])])]),c("div",cT,[dT,c("div",uT,[c("div",hT,[se(c("input",{"onUpdate:modelValue":e[6]||(e[6]=l=>t.currentRow.caption=l),type:"text",class:"form-control form-control-sm"},null,512),[[_e,t.currentRow.caption]])])])])])]),c("div",fT,[pT,c("div",mT,[ke(a,{rows:t.currentRow.calibrationData,currentRow:t.currentCalibrateRow,machinePos:n.machinePos,onSet:e[7]||(e[7]=l=>t.currentCalibrateRow=l),onSetPos:e[8]||(e[8]=l=>t.$emit("setPos",l))},null,8,["rows","currentRow","machinePos"]),c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[9]||(e[9]=l=>t.$emit("autocalibrate",t.currentRow))},"Autocalibrate",8,_T)])])])):st("",!0)])}var vT=ct(zw,[["render",gT]]);const bT={mixins:[Ia,Hn],props:{nozzles:Object,machineState:Object,machinePos:Object,settings:Object,disabled:Boolean,loading:Boolean},components:{NozzlesTable:vT},data:function(){return{currentNozzle:this.currentNozzle}},mounted(){this.nozzles.length>0&&(this.currentNozzle=this.nozzles[0])},methods:{applaySettings(){this.$emit("applaySettings")},addNozzle(){let t=1;for(let e of this.nozzles)e.id>=t&&(t=e.id+1);this.nozzles.push({id:t,name:"Nozzle "+t.toString(),caption:"",calibrationData:[{a:0,dx:0,dy:0},{a:.125,dx:0,dy:0},{a:.25,dx:0,dy:0},{a:.375,dx:0,dy:0},{a:.5,dx:0,dy:0},{a:.625,dx:0,dy:0},{a:.75,dx:0,dy:0},{a:.875,dx:0,dy:0}]}),this.currentNozzle=this.nozzles[this.nozzles.length-1]},setXYOffset(t){if(this.machineStateIsOK()==!0){let e=this.settings.cams[1].pos.x,n=this.settings.cams[1].pos.y;t.dx=Math.round((this.machinePos.x-e)*1e3)/1e3,t.dy=Math.round((this.machinePos.y-n)*1e3)/1e3}},autocalibrate(t){Un("Do You want to start Autocalibration of Nozzle?","Confirm").then(e=>{e==!0&&this.$emit("autocalibrate",t)})}}},yT={class:"card"},xT=c("div",{class:"card-header"},"Nozzles Settings",-1),ST={class:"card-body"},MT={class:"row mt-2"},ET={class:"col"},wT=["disabled"];function TT(t,e,n,i,s,o){const r=et("NozzlesTable");return W(),ee("div",yT,[xT,c("div",ST,[ke(r,{rows:n.nozzles,currentRow:t.currentNozzle,machineState:n.machineState,machinePos:n.machinePos,disabled:n.disabled,onAdd:e[0]||(e[0]=a=>o.addNozzle()),onSet:e[1]||(e[1]=a=>t.currentNozzle=a),onUp:e[2]||(e[2]=a=>t.rowUp(n.nozzles,a)),onDown:e[3]||(e[3]=a=>t.rowDown(n.nozzles,a)),onDelete:e[4]||(e[4]=a=>t.rowDelete(n.nozzles,a)),onSetPos:e[5]||(e[5]=a=>o.setXYOffset(a)),onAutocalibrate:e[6]||(e[6]=a=>o.autocalibrate(a))},null,8,["rows","currentRow","machineState","machinePos","disabled"]),c("div",MT,[c("div",ET,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary",onClick:e[7]||(e[7]=a=>o.applaySettings())},"Applay settings",8,wT)])])])])}var CT=ct(bT,[["render",TT]]);const AT={mixins:[ys,xs],components:{CopyPasteMenu:go},data:function(){return{currentField:"x",clipboard:this.clipboard}},methods:{doAction(t,e){t=="copy"&&(this.clipboard=Object.assign({},e)),t=="paste"&&(e=this.deepMerge(e,this.clipboard))}}},PT={class:"scroll"},RT={class:"table mb-5",ref:"table"},DT=c("thead",null,[c("tr",null,[c("th"),c("th",null,"x"),c("th",null,"y"),c("th",null,"z")])],-1),IT=["onMousedown"],LT={key:0},UT=Ie("\u2BC8"),FT={key:1},OT=["onUpdate:modelValue"],NT=["onUpdate:modelValue"],zT=["onUpdate:modelValue"],kT={nowrap:""},BT=["onClick"],VT=["onClick"],HT={class:"text-end"};function $T(t,e,n,i,s,o){const r=et("CopyPasteMenu");return W(),ee("div",PT,[c("table",RT,[DT,c("tbody",null,[(W(!0),ee(rt,null,wt(t.rows,(a,l)=>(W(),ee("tr",{onMousedown:d=>t.setCurrentRow(a),class:je(a==t.currentRow?"active-row":"")},[c("td",null,[a==t.currentRow?(W(),ee("span",LT,[ke(r,{row:a,clipboard:t.clipboard,onCopy:e[0]||(e[0]=d=>o.doAction("copy",d)),onPaste:e[1]||(e[1]=d=>o.doAction("paste",d))},{default:Ct(()=>[UT]),_:2},1032,["row","clipboard"])])):(W(),ee("span",FT,"\xA0\xA0"))]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.x=d,ref_for:!0,ref:"x",onFocus:e[2]||(e[2]=d=>t.currentField="x"),class:"form-control form-control-sm"},null,40,OT),[[_e,a.x]])]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.y=d,ref_for:!0,ref:"y",onFocus:e[3]||(e[3]=d=>t.currentField="y"),class:"form-control form-control-sm"},null,40,NT),[[_e,a.y]])]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.z=d,ref_for:!0,ref:"z",onFocus:e[4]||(e[4]=d=>t.currentField="z"),class:"form-control form-control-sm"},null,40,zT),[[_e,a.z]])]),c("th",kT,[c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1",onClick:d=>t.$emit("setPos",a),title:"Set current position of nozzle"},"\u{1F78A}",8,BT),c("button",{class:"btn btn-sm btn-outline-secondary btn-danger",onClick:d=>t.$emit("delete",a)},"\u2BBF",8,VT)])],42,IT))),256))])],512),c("div",HT,[c("button",{onClick:e[5]||(e[5]=a=>t.$emit("add")),class:"btn btn-sm btn-outline-secondary"},"Add point")])])}var GT=ct(AT,[["render",$T]]);const WT={mixins:[ys,Hn,xs],props:{settings:Object,machineState:Object,machinePos:Object,disabled:Boolean},components:{NozzlesHolderPlacePointsTable:GT,CopyPasteMenu:go},data:function(){return{currentField:"name",currentPointRow:this.currentPointRow,clipboard:this.clipboard}},computed:{isCurrent(){return this.currentRow&&this.rows.indexOf(this.currentRow)>-1}},methods:{addPoint(){this.currentRow.points.push({x:0,y:0,z:0}),this.currentPointRow=this.currentRow.points[this.currentRow.points.length-1]},setPointPos(t){this.machineStateIsOK()==!0&&(t.x=parseFloat(this.machinePos.x),t.y=parseFloat(this.machinePos.y),t.z=parseFloat(this.machinePos.z))},doAction(t,e){t=="copy"&&(this.clipboard=Object.assign({},e)),t=="paste"&&(this.clipboard.id=e.id,e=this.deepMerge(e,this.clipboard))}}},XT={class:"row"},jT={class:"col"},YT={class:"scroll"},qT={class:"table mb-5",ref:"table"},ZT=c("thead",null,[c("tr",null,[c("th"),c("th",null,"Name"),c("th",null,"Nozzle"),c("th")])],-1),KT=["onMousedown"],JT={key:0},QT=Ie("\u2BC8"),eC={key:1},tC=["onUpdate:modelValue"],nC=["onUpdate:modelValue"],iC=c("option",{value:-1},"Empty",-1),sC=["value"],oC={nowrap:""},rC=["onClick"],aC=["onClick"],lC=["onClick"],cC={class:"text-end"},dC={key:0,class:"col"},uC={class:"card"},hC={class:"card-header"},fC={class:"card-body"},pC={class:"mb-3"},mC=c("label",{class:"form-label"},"Name",-1),_C={class:"row mb-2"},gC={class:"col"},vC={class:"mb-3"},bC=c("label",{class:"form-label"},"Nozzle",-1),yC={class:"row mb-2"},xC={class:"col"},SC=c("option",{value:-1},"Empty",-1),MC=["value"],EC={class:"mb-3"},wC=c("label",{class:"form-label"},"Feed",-1),TC={class:"row mb-2"},CC={class:"col"},AC={class:"card mt-1"},PC=c("div",{class:"card-header"},"Path to take nozzle",-1),RC={class:"card-body"},DC={class:"card mt-1"},IC=c("div",{class:"card-header"},"Actions",-1),LC={class:"card-body"},UC=["disabled"];function FC(t,e,n,i,s,o){const r=et("CopyPasteMenu"),a=et("NozzlesHolderPlacePointsTable");return W(),ee("div",XT,[c("div",jT,[c("div",YT,[c("table",qT,[ZT,c("tbody",null,[(W(!0),ee(rt,null,wt(t.rows,l=>(W(),ee("tr",{onMousedown:d=>t.setCurrentRow(l),class:je(l==t.currentRow?"active-row":"")},[c("td",null,[l==t.currentRow?(W(),ee("span",JT,[ke(r,{row:l,clipboard:t.clipboard,onCopy:e[0]||(e[0]=d=>o.doAction("copy",d)),onPaste:e[1]||(e[1]=d=>o.doAction("paste",d))},{default:Ct(()=>[QT]),_:2},1032,["row","clipboard"])])):(W(),ee("span",eC,"\xA0\xA0"))]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>l.name=d,ref_for:!0,ref:"name",onFocus:e[2]||(e[2]=d=>t.currentField="name"),class:"form-control form-control-sm"},null,40,tC),[[_e,l.name]])]),c("td",null,[se(c("select",{"onUpdate:modelValue":d=>l.nozzleId=d,class:"form-control form-control-sm"},[iC,(W(!0),ee(rt,null,wt(n.settings.nozzles,d=>(W(),ee("option",{value:d.id},ze(d.name),9,sC))),256))],8,nC),[[Kn,l.nozzleId]])]),c("th",oC,[c("button",{class:"btn btn-sm btn-outline-secondary me-1",onClick:d=>t.$emit("up",l)},"\u2BC5",8,rC),c("button",{class:"btn btn-sm btn-outline-secondary me-1",onClick:d=>t.$emit("down",l)},"\u2BC6",8,aC),c("button",{class:"btn btn-sm btn-outline-secondary btn-danger",onClick:d=>t.$emit("delete",l)},"\u2BBF",8,lC)])],42,KT))),256))])],512),c("div",cC,[c("button",{onClick:e[3]||(e[3]=l=>t.$emit("add")),class:"btn btn-sm btn-outline-secondary"},"Add place")])])]),o.isCurrent?(W(),ee("div",dC,[c("div",uC,[c("div",hC,"Nozzle "+ze(t.currentRow.name)+" (#"+ze(t.currentRow.id)+")",1),c("div",fC,[c("div",pC,[mC,c("div",_C,[c("div",gC,[se(c("input",{"onUpdate:modelValue":e[4]||(e[4]=l=>t.currentRow.name=l),type:"text",class:"form-control form-control-sm"},null,512),[[_e,t.currentRow.name]])])])]),c("div",vC,[bC,c("div",yC,[c("div",xC,[se(c("select",{"onUpdate:modelValue":e[5]||(e[5]=l=>t.currentRow.nozzleId=l),class:"form-control form-control-sm"},[SC,(W(!0),ee(rt,null,wt(n.settings.nozzles,l=>(W(),ee("option",{value:l.id},ze(l.name),9,MC))),256))],512),[[Kn,t.currentRow.nozzleId]])])])]),c("div",EC,[wC,c("div",TC,[c("div",CC,[se(c("input",{"onUpdate:modelValue":e[6]||(e[6]=l=>t.currentRow.feed=l),type:"number",step:"1",class:"form-control form-control-sm"},null,512),[[_e,t.currentRow.feed]])])])])])]),c("div",AC,[PC,c("div",RC,[ke(a,{rows:t.currentRow.points,currentRow:t.currentPointRow,machinePos:n.machinePos,onSet:e[7]||(e[7]=l=>t.currentPointRow=l),onSetPos:e[8]||(e[8]=l=>o.setPointPos(l)),onAdd:e[9]||(e[9]=l=>o.addPoint()),onDelete:e[10]||(e[10]=l=>t.rowDelete(t.currentRow.points,l))},null,8,["rows","currentRow","machinePos"])])]),c("div",DC,[IC,c("div",LC,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[11]||(e[11]=l=>t.$emit("putOnNozzle",t.currentRow))},"Put on Nozzle",8,UC)])])])):st("",!0)])}var OC=ct(WT,[["render",FC]]);const NC={mixins:[Ia,Hn],props:{nozzlesHolder:Object,machineState:Object,machinePos:Object,settings:Object,disabled:Boolean,loading:Boolean},components:{NozzlesHolderPlaceTable:OC},data:function(){return{currentPlace:this.currentPlace}},mounted(){this.nozzlesHolder.places.length>0&&(this.currentPlace=this.nozzlesHolder.places[0])},methods:{applaySettings(){let t=!1;for(let e of this.nozzlesHolder.places)if(e.nozzleId==-1){t=!0;break}t?this.$emit("applaySettings"):lt("There is no anyone empty place. There need one empty space.","Warning","warning")},addPlace(){let t=1;for(let e of this.nozzlesHolder.places)e.id>=t&&(t=e.id+1);this.nozzlesHolder.places.push({id:t,name:"Place "+t,nozzleId:-1,points:[{x:0,y:0,z:0},{x:0,y:0,z:0},{x:0,y:0,z:0}],feed:100}),this.currentPlace=this.nozzlesHolder.places[this.nozzlesHolder.places.length-1]}}},zC={class:"card"},kC=c("div",{class:"card-header"},"Nozzles Holder Settings",-1),BC={class:"card-body"},VC={class:"row mt-2"},HC={class:"col"},$C=["disabled"];function GC(t,e,n,i,s,o){const r=et("NozzlesHolderPlaceTable");return W(),ee("div",zC,[kC,c("div",BC,[ke(r,{rows:n.nozzlesHolder.places,currentRow:t.currentPlace,machineState:n.machineState,machinePos:n.machinePos,settings:n.settings,disabled:n.disabled,onPutOnNozzle:e[0]||(e[0]=a=>t.$emit("putOnNozzle",a)),onAdd:e[1]||(e[1]=a=>o.addPlace()),onSet:e[2]||(e[2]=a=>t.currentPlace=a),onUp:e[3]||(e[3]=a=>t.rowUp(n.nozzlesHolder.places,a)),onDown:e[4]||(e[4]=a=>t.rowDown(n.nozzlesHolder.places,a)),onDelete:e[5]||(e[5]=a=>t.rowDelete(n.nozzlesHolder.places,a))},null,8,["rows","currentRow","machineState","machinePos","settings","disabled"]),c("div",VC,[c("div",HC,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary",onClick:e[6]||(e[6]=a=>o.applaySettings())},"Applay settings",8,$C)])])])])}var WC=ct(NC,[["render",GC]]);const XC={mixins:[Hn],props:{basket:Object,machineState:Object,machinePos:Object,loading:Boolean},methods:{applaySettings(){this.$emit("applaySettings")},setPosition(t){this.machineStateIsOK()==!0&&(this.basket.pos.x=parseFloat(this.machinePos.x),this.basket.pos.y=parseFloat(this.machinePos.y),this.basket.pos.z=parseFloat(this.machinePos.z))}}},jC={class:"card"},YC=c("div",{class:"card-header"},"Basket Settings",-1),qC={class:"card-body"},ZC={class:"mb-3"},KC=c("label",{class:"form-label"},"Position",-1),JC={class:"row mb-2"},QC={class:"col"},eA={class:"row"},tA=c("div",{class:"col-auto pt-1"},"X:",-1),nA={class:"col"},iA={class:"col"},sA={class:"row"},oA=c("div",{class:"col-auto pt-1"},"Y:",-1),rA={class:"col"},aA={class:"col"},lA={class:"row"},cA=c("div",{class:"col-auto pt-1"},"Z:",-1),dA={class:"col"},uA={class:"col-auto"},hA={class:"row mt-2"},fA={class:"col"},pA=["disabled"];function mA(t,e,n,i,s,o){return W(),ee("div",jC,[YC,c("div",qC,[c("div",ZC,[KC,c("div",JC,[c("div",QC,[c("div",eA,[tA,c("div",nA,[se(c("input",{"onUpdate:modelValue":e[0]||(e[0]=r=>n.basket.pos.x=r),type:"number",step:"0.01",class:"form-control form-control-sm"},null,512),[[_e,n.basket.pos.x]])])])]),c("div",iA,[c("div",sA,[oA,c("div",rA,[se(c("input",{"onUpdate:modelValue":e[1]||(e[1]=r=>n.basket.pos.y=r),type:"number",step:"0.01",class:"form-control form-control-sm"},null,512),[[_e,n.basket.pos.y]])])])]),c("div",aA,[c("div",lA,[cA,c("div",dA,[se(c("input",{"onUpdate:modelValue":e[2]||(e[2]=r=>n.basket.pos.z=r),type:"number",step:"0.01",class:"form-control form-control-sm"},null,512),[[_e,n.basket.pos.z]])])])]),c("div",uA,[c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1",onClick:e[3]||(e[3]=r=>o.setPosition(t.n)),title:"Set current position of nozzle"},"\u{1F78A}")])])]),c("div",hA,[c("div",fA,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary",onClick:e[4]||(e[4]=r=>o.applaySettings())},"Applay settings",8,pA)])])])])}var _A=ct(XC,[["render",mA]]);const gA={mixins:[Hn],props:{parking:Object,machineState:Object,machinePos:Object,loading:Boolean},methods:{applaySettings(){this.$emit("applaySettings")},setPosition(t){this.machineStateIsOK()==!0&&(this.parking.pos.x=parseFloat(this.machinePos.x),this.parking.pos.y=parseFloat(this.machinePos.y),this.parking.pos.z=parseFloat(this.machinePos.z))}}},vA={class:"card"},bA=c("div",{class:"card-header"},"Parking Settings",-1),yA={class:"card-body"},xA={class:"mb-3"},SA=c("label",{class:"form-label"},"Position",-1),MA={class:"row mb-2"},EA={class:"col"},wA={class:"row"},TA=c("div",{class:"col-auto pt-1"},"X:",-1),CA={class:"col"},AA={class:"col"},PA={class:"row"},RA=c("div",{class:"col-auto pt-1"},"Y:",-1),DA={class:"col"},IA={class:"col"},LA={class:"row"},UA=c("div",{class:"col-auto pt-1"},"Z:",-1),FA={class:"col"},OA={class:"col-auto"},NA={class:"row mt-2"},zA={class:"col"},kA=["disabled"];function BA(t,e,n,i,s,o){return W(),ee("div",vA,[bA,c("div",yA,[c("div",xA,[SA,c("div",MA,[c("div",EA,[c("div",wA,[TA,c("div",CA,[se(c("input",{"onUpdate:modelValue":e[0]||(e[0]=r=>n.parking.pos.x=r),type:"number",step:"0.01",class:"form-control form-control-sm"},null,512),[[_e,n.parking.pos.x]])])])]),c("div",AA,[c("div",PA,[RA,c("div",DA,[se(c("input",{"onUpdate:modelValue":e[1]||(e[1]=r=>n.parking.pos.y=r),type:"number",step:"0.01",class:"form-control form-control-sm"},null,512),[[_e,n.parking.pos.y]])])])]),c("div",IA,[c("div",LA,[UA,c("div",FA,[se(c("input",{"onUpdate:modelValue":e[2]||(e[2]=r=>n.parking.pos.z=r),type:"number",step:"0.01",class:"form-control form-control-sm"},null,512),[[_e,n.parking.pos.z]])])])]),c("div",OA,[c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1",onClick:e[3]||(e[3]=r=>o.setPosition(t.n)),title:"Set current position of nozzle"},"\u{1F78A}")])])]),c("div",NA,[c("div",zA,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary",onClick:e[4]||(e[4]=r=>o.applaySettings())},"Applay settings",8,kA)])])])])}var VA=ct(gA,[["render",BA]]);const HA={mixins:[ys,xs],components:{CopyPasteMenu:go},data:function(){return{currentField:"x",clipboard:this.clipboard}},methods:{doAction(t,e){t=="copy"&&(this.clipboard=Object.assign({},e)),t=="paste"&&(e=this.deepMerge(e,this.clipboard))}}},$A={class:"scroll"},GA={class:"table mb-5",ref:"table"},WA=c("thead",null,[c("tr",null,[c("th"),c("th",null,"x"),c("th",null,"y"),c("th",null,"z"),c("th",null,"pick")])],-1),XA=["onMousedown"],jA={key:0},YA=Ie("\u2BC8"),qA={key:1},ZA=["onUpdate:modelValue"],KA=["onUpdate:modelValue"],JA=["onUpdate:modelValue"],QA=["onUpdate:modelValue"],eP={nowrap:""},tP=["onClick"],nP=["onClick"],iP={class:"text-end"};function sP(t,e,n,i,s,o){const r=et("CopyPasteMenu");return W(),ee("div",$A,[c("table",GA,[WA,c("tbody",null,[(W(!0),ee(rt,null,wt(t.rows,(a,l)=>(W(),ee("tr",{onMousedown:d=>t.setCurrentRow(a),class:je(a==t.currentRow?"active-row":"")},[c("td",null,[a==t.currentRow?(W(),ee("span",jA,[ke(r,{row:a,clipboard:t.clipboard,onCopy:e[0]||(e[0]=d=>o.doAction("copy",d)),onPaste:e[1]||(e[1]=d=>o.doAction("paste",d))},{default:Ct(()=>[YA]),_:2},1032,["row","clipboard"])])):(W(),ee("span",qA,"\xA0\xA0"))]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.x=d,ref_for:!0,ref:"x",onFocus:e[2]||(e[2]=d=>t.currentField="x"),class:"form-control form-control-sm"},null,40,ZA),[[_e,a.x]])]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.y=d,ref_for:!0,ref:"y",onFocus:e[3]||(e[3]=d=>t.currentField="y"),class:"form-control form-control-sm"},null,40,KA),[[_e,a.y]])]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.z=d,ref_for:!0,ref:"z",onFocus:e[4]||(e[4]=d=>t.currentField="z"),class:"form-control form-control-sm"},null,40,JA),[[_e,a.z]])]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.pick=d,type:"checkbox",class:"form-check-input"},null,8,QA),[[Zn,a.pick]])]),c("th",eP,[c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1",onClick:d=>t.$emit("setPos",a),title:"Set current position of nozzle"},"\u{1F78A}",8,tP),c("button",{class:"btn btn-sm btn-outline-secondary btn-danger",onClick:d=>t.$emit("delete",a)},"\u2BBF",8,nP)])],42,XA))),256))])],512),c("div",iP,[c("button",{onClick:e[5]||(e[5]=a=>t.$emit("add")),class:"btn btn-sm btn-outline-secondary"},"Add point")])])}var oP=ct(HA,[["render",sP]]);const rP={mixins:[ys,Hn,xs],props:{settings:Object,cases:Object,feederTypes:Object,machineState:Object,machinePos:Object,disabled:Boolean},components:{FeedersPathPointsTable:oP,CopyPasteMenu:go,PopupMenu:cp,PopupMenuItem:dp},data:function(){return{currentField:"name",currentPoint:this.currentPoint,clipboard:this.clipboard}},computed:{isCurrent(){return this.currentRow&&this.rows.indexOf(this.currentRow)>-1}},methods:{addPathPoint(t){this.currentRow.pathPoints.push({x:0,y:0,z:0,pick:!1})},setFeederPos(t){this.machineStateIsOK()==!0&&(t.pos.x=this.machinePos.x,t.pos.y=this.machinePos.y,t.pos.z=this.machinePos.z)},setFeederPosCAM(t){this.machineStateIsOK()==!0&&(t.pos.x=parseFloat(this.machinePos.x)+parseFloat(this.settings.cams[0].offset.x),t.pos.y=parseFloat(this.machinePos.y)+parseFloat(this.settings.cams[0].offset.y))},setPointPos(t){this.machineStateIsOK()==!0&&(t.x=this.machinePos.x,t.y=this.machinePos.y,t.z=this.machinePos.z)},fixFiderPosByCamPos(t,e){if(this.machineStateIsOK()==!0&&(t.type==0&&((e=="x"||e=="xy")&&(t.pos.x=parseFloat(this.machinePos.x)+parseFloat(this.settings.cams[0].offset.x)),(e=="y"||e=="xy")&&(t.pos.y=parseFloat(this.machinePos.y)+parseFloat(this.settings.cams[0].offset.y))),t.type==1)){let n;for(let i of t.pathPoints)i.pick==!0&&(n=i);if(n){let i=parseFloat(this.machinePos.x)+parseFloat(this.settings.cams[0].offset.x),s=parseFloat(this.machinePos.y)+parseFloat(this.settings.cams[0].offset.y),o=i-n.x,r=s-n.y;for(let a of t.pathPoints)(e=="x"||e=="xy")&&(a.x=(parseFloat(a.x)+parseFloat(o)).toFixed(3)),(e=="y"||e=="xy")&&(a.y=(parseFloat(a.y)+parseFloat(r)).toFixed(3))}}},drawSMDCase(){let t=this.$refs.smdCase,e=t.getContext("2d"),n=t.width,i=t.height;if(e.clearRect(0,0,n,i),this.$refs.smdCase){let s=this.currentRow.case;for(let o of this.cases)if(o.name==s){const r=new Image;r.src=o.src,r.onload=()=>{let a=n/2,l=i/2,d=n*.7,u=r.height*(d/r.width),f=a-d/2,h=l-u/2,m=2*Math.PI*this.currentRow.caseRotate;e.translate(a,l),e.rotate(-m),e.translate(-a,-l),e.drawImage(r,f,h,d,u),e.translate(a,l),e.rotate(m),e.translate(-a,-l),e.stroke()}}}},doAction(t,e){t=="copy"&&(this.clipboard=Object.assign({},e)),t=="paste"&&(this.clipboard.id=e.id,e=this.deepMerge(e,this.clipboard))}},watch:{currentRow(){clearTimeout(this.timerId),this.timerId=setTimeout(()=>{this.drawSMDCase()},200)}}},aP={class:"row"},lP={class:"col"},cP={class:"scroll"},dP={class:"table mb-5",ref:"table"},uP=c("thead",null,[c("tr",null,[c("th"),c("th",null,"Name"),c("th",null,"Caption"),c("th",null,"Type"),c("th")])],-1),hP=["onMousedown"],fP={key:0},pP=Ie("\u2BC8"),mP={key:1},_P=["onUpdate:modelValue"],gP=["onUpdate:modelValue"],vP=["onUpdate:modelValue"],bP={nowrap:""},yP=["onClick"],xP=["onClick"],SP=["onClick"],MP={class:"text-end"},EP={class:"col"},wP={key:0,class:"card"},TP={class:"card-header"},CP={class:"card-body"},AP={class:"mb-3"},PP=c("label",{class:"form-label"},"Name",-1),RP={class:"row mb-2"},DP={class:"col"},IP={class:"mb-3"},LP=c("label",{class:"form-label"},"Caption",-1),UP={class:"row mb-2"},FP={class:"col"},OP={class:"mb-3"},NP=c("label",{class:"form-label"},"Type",-1),zP={class:"row mb-2"},kP={class:"col"},BP=["value"],VP={key:0},HP={class:"mb-3"},$P=c("label",{class:"form-label"},"Position",-1),GP={class:"row mb-2"},WP={class:"col"},XP=Ie(" X: "),jP={class:"col"},YP=Ie(" Y: "),qP={class:"col"},ZP=Ie(" Z: "),KP={class:"col-auto"},JP={class:"mb-3"},QP=c("label",{class:"form-label"},"Step",-1),eR={class:"row mb-2"},tR={class:"col"},nR=Ie(" X: "),iR={class:"col"},sR=Ie(" Y: "),oR={class:"col"},rR=Ie(" Z: "),aR={class:"mb-3"},lR={class:"row mb-2"},cR={class:"col"},dR=Ie(" Capacity "),uR={class:"col"},hR=Ie(" Current "),fR={class:"col"},pR={key:1},mR={class:"mb-3"},_R=c("label",{class:"form-label"},"Path points",-1),gR={class:"row mb-2"},vR={class:"col"},bR={class:"mb-3"},yR=c("label",{class:"form-label"},"Elements height",-1),xR={class:"row mb-2"},SR={class:"col"},MR={class:"mb-3"},ER=c("label",{class:"form-label"},"Nozzle",-1),wR={class:"row mb-2"},TR={class:"col"},CR=["value"],AR=c("div",{class:"form-text"},"Specify Nozzle to pick up element",-1),PR={class:"mb-3"},RR=c("label",{class:"form-label"},"Case",-1),DR={class:"row mb-2"},IR={class:"col"},LR=["value"],UR={ref:"smdCase",width:"64",height:"64",style:{border:"silver solid 1px"}},FR={class:"mb-3"},OR=c("label",{class:"form-label"},"Orientation in the feeder",-1),NR={class:"row mb-2"},zR={class:"col"},kR=c("div",{class:"form-text"},"Sets elements orientation in the feeder",-1),BR={class:"mb-3"},VR=c("label",{class:"form-label",for:"posCorrection"},"Correct the element's position after pick",-1),HR={class:"row mb-2"},$R={class:"col"},GR={class:"form-check form-switch"},WR=c("div",{class:"form-text"},"Uses bottom camera to correct position of element after pick",-1),XR={class:"mb-3"},jR=c("label",{class:"form-label"},"Active",-1),YR={class:"row mb-2"},qR={class:"col"},ZR={class:"form-check form-switch"},KR={key:1,class:"card mt-1"},JR=c("div",{class:"card-header"},"Actions",-1),QR={class:"card-body"},e2=["disabled"],t2=["disabled"],n2=["disabled"],i2=["disabled"],s2=["disabled"],o2=["disabled"],r2=Ie("X"),a2=Ie("Y"),l2=Ie("Both");function c2(t,e,n,i,s,o){const r=et("CopyPasteMenu"),a=et("FeedersPathPointsTable"),l=et("PopupMenuItem"),d=et("PopupMenu");return W(),ee("div",aP,[c("div",lP,[c("div",cP,[c("table",dP,[uP,c("tbody",null,[(W(!0),ee(rt,null,wt(t.rows,(u,f)=>(W(),ee("tr",{onMousedown:h=>t.setCurrentRow(u),class:je(u==t.currentRow?"active-row":"")},[c("td",null,[u==t.currentRow?(W(),ee("span",fP,[ke(r,{row:u,clipboard:t.clipboard,onCopy:e[0]||(e[0]=h=>o.doAction("copy",h)),onPaste:e[1]||(e[1]=h=>o.doAction("paste",h))},{default:Ct(()=>[pP]),_:2},1032,["row","clipboard"])])):(W(),ee("span",mP,"\xA0\xA0"))]),c("td",null,[se(c("input",{"onUpdate:modelValue":h=>u.name=h,ref_for:!0,ref:"name",onFocus:e[2]||(e[2]=h=>t.currentField="name"),class:"form-control form-control-sm"},null,40,_P),[[_e,u.name]])]),c("td",null,[se(c("input",{"onUpdate:modelValue":h=>u.caption=h,ref_for:!0,ref:"caption",onFocus:e[3]||(e[3]=h=>t.currentField="caption"),class:"form-control form-control-sm"},null,40,gP),[[_e,u.caption]])]),c("td",null,ze(n.feederTypes[u.type].name),1),c("td",null,[se(c("input",{"onUpdate:modelValue":h=>u.active=h,ref_for:!0,ref:"active",onFocus:e[4]||(e[4]=h=>t.currentField="active"),type:"checkbox",class:"form-control form-control-sm",title:"Active"},null,40,vP),[[Zn,u.active]])]),c("th",bP,[c("button",{class:"btn btn-sm btn-outline-secondary me-1",onClick:h=>t.$emit("up",u)},"\u2BC5",8,yP),c("button",{class:"btn btn-sm btn-outline-secondary me-1",onClick:h=>t.$emit("down",u)},"\u2BC6",8,xP),c("button",{class:"btn btn-sm btn-outline-secondary btn-danger",onClick:h=>t.$emit("delete",u)},"\u2BBF",8,SP)])],42,hP))),256))])],512),c("div",MP,[c("button",{onClick:e[5]||(e[5]=u=>t.$emit("add")),class:"btn btn-sm btn-outline-secondary"},"Add feeder")])])]),c("div",EP,[o.isCurrent?(W(),ee("div",wP,[c("div",TP,"Feeder "+ze(t.currentRow.name)+" (#"+ze(t.currentRow.id)+")",1),c("div",CP,[c("div",AP,[PP,c("div",RP,[c("div",DP,[se(c("input",{"onUpdate:modelValue":e[6]||(e[6]=u=>t.currentRow.name=u),type:"text",class:"form-control form-control-sm"},null,512),[[_e,t.currentRow.name]])])])]),c("div",IP,[LP,c("div",UP,[c("div",FP,[se(c("input",{"onUpdate:modelValue":e[7]||(e[7]=u=>t.currentRow.caption=u),type:"text",class:"form-control form-control-sm"},null,512),[[_e,t.currentRow.caption]])])])]),c("div",OP,[NP,c("div",zP,[c("div",kP,[se(c("select",{"onUpdate:modelValue":e[8]||(e[8]=u=>t.currentRow.type=u),class:"form-control form-control-sm"},[(W(!0),ee(rt,null,wt(n.feederTypes,u=>(W(),ee("option",{value:u.id},ze(u.name),9,BP))),256))],512),[[Kn,t.currentRow.type]])])])]),t.currentRow.type==0?(W(),ee("span",VP,[c("div",HP,[$P,c("div",GP,[c("div",WP,[XP,se(c("input",{"onUpdate:modelValue":e[9]||(e[9]=u=>t.currentRow.pos.x=u),type:"text",class:"form-control form-control-sm"},null,512),[[_e,t.currentRow.pos.x]])]),c("div",jP,[YP,se(c("input",{"onUpdate:modelValue":e[10]||(e[10]=u=>t.currentRow.pos.y=u),type:"text",class:"form-control form-control-sm"},null,512),[[_e,t.currentRow.pos.y]])]),c("div",qP,[ZP,se(c("input",{"onUpdate:modelValue":e[11]||(e[11]=u=>t.currentRow.pos.z=u),type:"text",class:"form-control form-control-sm"},null,512),[[_e,t.currentRow.pos.z]])]),c("div",KP,[c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1 mt-3",onClick:e[12]||(e[12]=u=>o.setFeederPosCAM(t.currentRow)),title:"Set current position of camera (x, y)"},"\u26F6"),c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1 mt-3",onClick:e[13]||(e[13]=u=>o.setFeederPos(t.currentRow)),title:"Set current position of nozzle (x, y, z)"},"\u{1F78A}")])])]),c("div",JP,[QP,c("div",eR,[c("div",tR,[nR,se(c("input",{"onUpdate:modelValue":e[14]||(e[14]=u=>t.currentRow.step.x=u),type:"text",class:"form-control form-control-sm"},null,512),[[_e,t.currentRow.step.x]])]),c("div",iR,[sR,se(c("input",{"onUpdate:modelValue":e[15]||(e[15]=u=>t.currentRow.step.y=u),type:"text",class:"form-control form-control-sm"},null,512),[[_e,t.currentRow.step.y]])]),c("div",oR,[rR,se(c("input",{"onUpdate:modelValue":e[16]||(e[16]=u=>t.currentRow.step.z=u),type:"text",class:"form-control form-control-sm"},null,512),[[_e,t.currentRow.step.z]])])])]),c("div",aR,[c("div",lR,[c("div",cR,[dR,se(c("input",{"onUpdate:modelValue":e[17]||(e[17]=u=>t.currentRow.capacity=u),type:"text",class:"form-control form-control-sm"},null,512),[[_e,t.currentRow.capacity]])]),c("div",uR,[hR,se(c("input",{"onUpdate:modelValue":e[18]||(e[18]=u=>t.currentRow.current=u),type:"text",class:"form-control form-control-sm"},null,512),[[_e,t.currentRow.current]])]),c("div",fR,[c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1 mt-3",onClick:e[19]||(e[19]=u=>t.currentRow.current=0)},"Reset")])])])])):st("",!0),t.currentRow.type==1?(W(),ee("span",pR,[c("div",mR,[_R,c("div",gR,[c("div",vR,[ke(a,{rows:t.currentRow.pathPoints,currentRow:t.currentPoint,onAdd:e[20]||(e[20]=u=>o.addPathPoint(u)),onSet:e[21]||(e[21]=u=>t.currentPoint=u),onSetPos:e[22]||(e[22]=u=>o.setPointPos(u)),onDelete:e[23]||(e[23]=u=>t.rowDelete(t.currentRow.pathPoints,u))},null,8,["rows","currentRow"])])])])])):st("",!0),c("div",bR,[yR,c("div",xR,[c("div",SR,[se(c("input",{"onUpdate:modelValue":e[24]||(e[24]=u=>t.currentRow.elementHeight=u),type:"number",step:"0.01",class:"form-control form-control-sm"},null,512),[[_e,t.currentRow.elementHeight]])])])]),c("div",MR,[ER,c("div",wR,[c("div",TR,[se(c("select",{"onUpdate:modelValue":e[25]||(e[25]=u=>t.currentRow.nozzle=u),class:"form-control form-control-sm"},[(W(!0),ee(rt,null,wt(n.settings.nozzles,u=>(W(),ee("option",{value:u.id},ze(u.name),9,CR))),256))],512),[[Kn,t.currentRow.nozzle]]),AR])])]),c("div",PR,[RR,c("div",DR,[c("div",IR,[se(c("select",{"onUpdate:modelValue":e[26]||(e[26]=u=>t.currentRow.case=u),class:"form-control form-control-sm",onChange:e[27]||(e[27]=u=>o.drawSMDCase())},[(W(!0),ee(rt,null,wt(n.cases,u=>(W(),ee("option",{value:u.name},ze(u.name),9,LR))),256))],544),[[Kn,t.currentRow.case]]),c("canvas",UR,null,512)])])]),c("div",FR,[OR,c("div",NR,[c("div",zR,[se(c("input",{"onUpdate:modelValue":e[28]||(e[28]=u=>t.currentRow.caseRotate=u),type:"number",step:"0.125",class:"form-control form-control-sm",onChange:e[29]||(e[29]=u=>o.drawSMDCase())},null,544),[[_e,t.currentRow.caseRotate]])]),kR])]),c("div",BR,[VR,c("div",HR,[c("div",$R,[c("div",GR,[se(c("input",{"onUpdate:modelValue":e[30]||(e[30]=u=>t.currentRow.posCorrection=u),class:"form-check-input",type:"checkbox",role:"switch",id:"posCorrection"},null,512),[[Zn,t.currentRow.posCorrection]])])]),WR])]),c("div",XR,[jR,c("div",YR,[c("div",qR,[c("div",ZR,[se(c("input",{"onUpdate:modelValue":e[31]||(e[31]=u=>t.currentRow.active=u),class:"form-check-input",type:"checkbox",role:"switch",id:"posCorrection"},null,512),[[Zn,t.currentRow.active]])])])])])])])):st("",!0),o.isCurrent?(W(),ee("div",KR,[JR,c("div",QR,[c("div",null,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[32]||(e[32]=u=>t.$emit("pickFromFeeder",t.currentRow))},"Pick element from Feeder",8,e2),c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[33]||(e[33]=u=>t.$emit("fixPosition"))},"Fix position of Picked element",8,t2),c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[34]||(e[34]=u=>t.$emit("dropIntoBasket"))},"Drop Picked element into Basket",8,n2)]),c("div",null,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[35]||(e[35]=u=>t.$emit("goToFeeder",t.currentRow))},"Jog Nozzle to to Feeder position",8,i2),c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[36]||(e[36]=u=>t.$emit("goToFeederCam",t.currentRow))},"Jog Camera to to Feeder position",8,s2)]),c("div",null,[ke(d,null,{menubutton:Ct(()=>[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1 dropdown-toggle"},"Fix feeder's position by top Camera ",8,o2)]),menuitems:Ct(()=>[ke(l,{disabled:n.disabled,onClick:e[37]||(e[37]=u=>o.fixFiderPosByCamPos(t.currentRow,"x"))},{default:Ct(()=>[r2]),_:1},8,["disabled"]),ke(l,{disabled:n.disabled,onClick:e[38]||(e[38]=u=>o.fixFiderPosByCamPos(t.currentRow,"y"))},{default:Ct(()=>[a2]),_:1},8,["disabled"]),ke(l,{disabled:n.disabled,onClick:e[39]||(e[39]=u=>o.fixFiderPosByCamPos(t.currentRow,"xy"))},{default:Ct(()=>[l2]),_:1},8,["disabled"])]),_:1})])])])):st("",!0)])])}var d2=ct(rP,[["render",c2]]);const u2={mixins:[Ia],props:{feeders:Object,settings:Object,cases:Object,machineState:Object,machinePos:Object,disabled:Boolean,loading:Boolean},components:{FeedersTable:d2},data:function(){return{feederTypes:[{id:0,name:"Liner"},{id:1,name:"Push-pull"}],currentFeeder:this.currentFeeder}},mounted(){this.setCurrentFirst()},methods:{setCurrentFirst(){this.feeders.length>0&&(this.currentFeeder=this.feeders[0])},addFeeder(){let t=1;for(let e of this.feeders)e.id>=t&&(t=e.id+1);this.feeders.push({id:t,name:"Feeder "+t.toString(),caption:"",type:0,pos:{x:0,y:0,z:0},step:{x:0,y:0,z:0},pathPoints:[],capacity:0,current:0,elementHeight:.4,nozzle:0,case:"",caseRotate:0,posCorrection:!0,active:!0}),this.currentFeeder=this.feeders[this.feeders.length-1]},saveFeeders(){this.$emit("saveFeeders")}},watch:{feeders(){this.setCurrentFirst()}}},h2={class:"card"},f2=c("div",{class:"card-header"},"Feeders Settings",-1),p2={class:"card-body"},m2={class:"mt-1"},_2=["disabled"];function g2(t,e,n,i,s,o){const r=et("FeedersTable");return W(),ee("div",h2,[f2,c("div",p2,[ke(r,{rows:n.feeders,currentRow:t.currentFeeder,settings:n.settings,cases:n.cases,feederTypes:t.feederTypes,machineState:n.machineState,machinePos:n.machinePos,disabled:n.disabled,onGoToFeeder:e[0]||(e[0]=a=>t.$emit("goToFeeder",a)),onGoToFeederCam:e[1]||(e[1]=a=>t.$emit("goToFeederCam",a)),onPickFromFeeder:e[2]||(e[2]=a=>t.$emit("pickFromFeeder",a)),onFixPosition:e[3]||(e[3]=a=>t.$emit("fixPosition",a)),onDropIntoBasket:e[4]||(e[4]=a=>t.$emit("dropIntoBasket",a)),onAdd:e[5]||(e[5]=a=>o.addFeeder()),onSet:e[6]||(e[6]=a=>t.currentFeeder=a),onUp:e[7]||(e[7]=a=>t.rowUp(n.feeders,a)),onDown:e[8]||(e[8]=a=>t.rowDown(n.feeders,a)),onDelete:e[9]||(e[9]=a=>t.rowDelete(n.feeders,a))},null,8,["rows","currentRow","settings","cases","feederTypes","machineState","machinePos","disabled"]),c("div",m2,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary me-1",onClick:e[10]||(e[10]=a=>o.saveFeeders())},"Save feeders",8,_2)])])])}var up=ct(u2,[["render",g2]]);const v2={mixins:[Hn],props:{pcbtable:Object,machineState:Object,machinePos:Object,loading:Boolean},methods:{applaySettings(){this.$emit("applaySettings")},setPosition(t){this.machineStateIsOK()==!0&&(this.pcbtable.z=parseFloat(this.machinePos.z))}}},b2={class:"card"},y2=c("div",{class:"card-header"},"PCB Table Settings",-1),x2={class:"card-body"},S2={class:"mb-3"},M2=c("label",{class:"form-label"},"PCB Table position",-1),E2={class:"row mb-2"},w2={class:"col"},T2={class:"row"},C2=c("div",{class:"col-auto pt-1"},"X:",-1),A2={class:"col"},P2={class:"col"},R2={class:"row"},D2=c("div",{class:"col-auto pt-1"},"Y:",-1),I2={class:"col"},L2={class:"col"},U2={class:"row"},F2=c("div",{class:"col-auto pt-1"},"Z:",-1),O2={class:"col"},N2={class:"col-auto"},z2=c("div",{class:"form-text"},"Left bottom PCB table position",-1),k2={class:"row mt-2"},B2={class:"col"},V2=["disabled"];function H2(t,e,n,i,s,o){return W(),ee("div",b2,[y2,c("div",x2,[c("div",S2,[M2,c("div",E2,[c("div",w2,[c("div",T2,[C2,c("div",A2,[se(c("input",{"onUpdate:modelValue":e[0]||(e[0]=r=>n.pcbtable.x=r),type:"number",step:"0.01",class:"form-control form-control-sm"},null,512),[[_e,n.pcbtable.x]])])])]),c("div",P2,[c("div",R2,[D2,c("div",I2,[se(c("input",{"onUpdate:modelValue":e[1]||(e[1]=r=>n.pcbtable.y=r),type:"number",step:"0.01",class:"form-control form-control-sm"},null,512),[[_e,n.pcbtable.y]])])])]),c("div",L2,[c("div",U2,[F2,c("div",O2,[se(c("input",{"onUpdate:modelValue":e[2]||(e[2]=r=>n.pcbtable.z=r),type:"number",step:"0.01",class:"form-control form-control-sm"},null,512),[[_e,n.pcbtable.z]])])])]),c("div",N2,[c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1",onClick:e[3]||(e[3]=r=>o.setPosition(t.n)),title:"Set current position of nozzle"},"\u{1F78A}")])]),z2]),c("div",k2,[c("div",B2,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary",onClick:e[4]||(e[4]=r=>o.applaySettings())},"Applay settings",8,V2)])])])])}var $2=ct(v2,[["render",H2]]);const G2={mixins:[ys,Hn,xs],props:{settings:Object,machineState:Object,machinePos:Object,feeders:Object,disabled:Boolean},components:{CopyPasteMenu:go},data:function(){return{currentField:"name",clipboard:this.clipboard}},computed:{elements(){if(this.rows){let t=this.rows;for(let e of t){let n=this.getFeederById(e.feeder);if(n!==null){let i=this.getNozzleById(n.nozzle);e.nozzleId=n.nozzle,e.nozzleName=i.name}}return t}},isCurrent(){return this.currentRow&&this.rows.indexOf(this.currentRow)>-1}},methods:{setElementPos(t){this.machineStateIsOK()==!0&&(t.pos.x=this.machinePos.x,t.pos.y=this.machinePos.y)},setElementPosCam(t){if(this.machineStateIsOK()==!0){let e=this.settings.cams[0].offset;t.pos.x=(parseFloat(this.machinePos.x)+parseFloat(e.x)).toFixed(3),t.pos.y=(parseFloat(this.machinePos.y)+parseFloat(e.y)).toFixed(3)}},refreshCurrentElement(t){this.$emit("set",t)},goToElement(t){this.$emit("goToElement",t)},goToElementCam(t){this.$emit("goToElementCam",t)},placeElement(t){this.$emit("placeElement",t)},getFeederById(t){for(let e of this.feeders)if(e.id==t)return e;return null},getNozzleById(t){for(let e of this.settings.nozzles)if(e.id==t)return e;return null},goToFeeder(t){this.$emit("goToFeeder",this.getFeederById(t))},goToFeederCam(t){this.$emit("goToFeederCam",this.getFeederById(t))},runFrom(t){this.$emit("runFrom",t)},doAction(t,e){t=="copy"&&(this.clipboard=Object.assign({},e)),t=="paste"&&(this.clipboard.id=e.id,e=this.deepMerge(e,this.clipboard))}}},W2={class:"row"},X2={class:"col mh-100"},j2={class:"scroll"},Y2={class:"table mb-5",ref:"table"},q2=c("th",null,null,-1),Z2=c("th",null,"Name",-1),K2=c("th",null,"Caption",-1),J2={nowrap:""},Q2=Ie("Feeder "),e3=Ie(),t3={nowrap:""},n3=Ie("Nozzle "),i3=Ie(),s3={nowrap:""},o3=Ie("X "),r3=Ie(),a3={nowrap:""},l3=Ie("Y "),c3=Ie(),d3=c("th",null,"A",-1),u3=c("th",null,null,-1),h3=c("th",null,null,-1),f3=["onMousedown"],p3={key:0},m3=Ie("\u2BC8"),_3={key:1},g3=["onUpdate:modelValue"],v3=["onUpdate:modelValue"],b3=["onUpdate:modelValue"],y3=["value"],x3={nowrap:""},S3=["onUpdate:modelValue"],M3=["onUpdate:modelValue"],E3=["onUpdate:modelValue"],w3=["onUpdate:modelValue"],T3={nowrap:""},C3=["onClick"],A3=["onClick"],P3=["onClick"],R3={class:"text-end"},D3={class:"col"},I3={key:0,class:"card"},L3={class:"card-header"},U3={class:"card-body"},F3={class:"mb-3"},O3=c("label",{class:"form-label"},"Name",-1),N3={class:"row mb-2"},z3={class:"col"},k3={class:"mb-3"},B3=c("label",{class:"form-label"},"Caption",-1),V3={class:"row mb-2"},H3={class:"col"},$3={class:"mb-3"},G3=c("label",{class:"form-label"},"Feeder",-1),W3={class:"row mb-2"},X3={class:"col"},j3=["value"],Y3={class:"mb-3"},q3=c("label",{class:"form-label"},"Position",-1),Z3={class:"row mb-2"},K3={class:"col"},J3=Ie(" X: "),Q3={class:"col"},eD=Ie(" Y: "),tD={class:"col"},nD=Ie(" A: "),iD={class:"col-auto"},sD={class:"mb-3"},oD=c("label",{class:"form-label"},"Active",-1),rD={class:"row mb-2"},aD={class:"col"},lD={class:"form-check form-switch"},cD={key:1,class:"card mt-1"},dD=c("div",{class:"card-header"},"Actions",-1),uD={class:"card-body"},hD=["disabled"],fD=["disabled"],pD=["disabled"],mD=Ie("Jog Nozzle to "),_D=c("b",null,"Element",-1),gD=Ie(" position"),vD=[mD,_D,gD],bD=["disabled"],yD=Ie("Jog Nozzle to to "),xD=c("b",null,"Feeder",-1),SD=Ie(" position"),MD=[yD,xD,SD],ED=["disabled"],wD=Ie("Jog Camera to "),TD=c("b",null,"Element",-1),CD=Ie(" position"),AD=[wD,TD,CD],PD=["disabled"],RD=Ie("Jog Camera to to "),DD=c("b",null,"Feeder",-1),ID=Ie(" position"),LD=[RD,DD,ID];function UD(t,e,n,i,s,o){const r=et("CopyPasteMenu");return W(),ee("div",W2,[c("div",X2,[c("div",j2,[c("table",Y2,[c("thead",null,[c("tr",null,[q2,Z2,K2,c("th",J2,[Q2,c("a",{onClick:e[0]||(e[0]=a=>t.$emit("sortElements",{field:"feeder",order:"up"})),title:"Sort by Feeder"},"\u2BC5"),e3,c("a",{onClick:e[1]||(e[1]=a=>t.$emit("sortElements",{field:"feeder",order:"down"})),title:"Sort by Feeder"},"\u2BC6")]),c("th",t3,[n3,c("a",{onClick:e[2]||(e[2]=a=>t.$emit("sortElements",{field:"nozzle",order:"up"})),title:"Sort by Nozzle"},"\u2BC5"),i3,c("a",{onClick:e[3]||(e[3]=a=>t.$emit("sortElements",{field:"nozzle",order:"down"})),title:"Sort by Nozzle"},"\u2BC6")]),c("th",s3,[o3,c("a",{onClick:e[4]||(e[4]=a=>t.$emit("sortElements",{field:"x",order:"up"})),title:"Sort by X"},"\u2BC5"),r3,c("a",{onClick:e[5]||(e[5]=a=>t.$emit("sortElements",{field:"x",order:"down"})),title:"Sort by X"},"\u2BC6")]),c("th",a3,[l3,c("a",{onClick:e[6]||(e[6]=a=>t.$emit("sortElements",{field:"y",order:"up"})),title:"Sort by Y"},"\u2BC5"),c3,c("a",{onClick:e[7]||(e[7]=a=>t.$emit("sortElements",{field:"y",order:"down"})),title:"Sort by Y"},"\u2BC6")]),d3,u3,h3])]),c("tbody",null,[(W(!0),ee(rt,null,wt(o.elements,(a,l)=>(W(),ee("tr",{onMousedown:d=>t.setCurrentRow(a),class:je(a==t.currentRow?"active-row":"")},[c("td",null,[a==t.currentRow?(W(),ee("span",p3,[ke(r,{row:a,clipboard:t.clipboard,onCopy:e[8]||(e[8]=d=>o.doAction("copy",d)),onPaste:e[9]||(e[9]=d=>o.doAction("paste",d))},{default:Ct(()=>[m3]),_:2},1032,["row","clipboard"])])):(W(),ee("span",_3,"\xA0\xA0"))]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.name=d,ref_for:!0,ref:"name",onFocus:e[10]||(e[10]=d=>t.currentField="name"),class:"form-control form-control-sm",size:"10"},null,40,g3),[[_e,a.name]])]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.caption=d,ref_for:!0,ref:"caption",onFocus:e[11]||(e[11]=d=>t.currentField="caption"),class:"form-control form-control-sm",size:"10"},null,40,v3),[[_e,a.caption]])]),c("td",null,[se(c("select",{"onUpdate:modelValue":d=>a.feeder=d,class:"form-control form-control-sm"},[(W(!0),ee(rt,null,wt(n.feeders,d=>(W(),ee("option",{value:d.id},ze(d.name)+" ( "+ze(d.caption)+" )",9,y3))),256))],8,b3),[[Kn,a.feeder]])]),c("td",x3,ze(a.nozzleName),1),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.pos.x=d,ref_for:!0,ref:"X",onFocus:e[12]||(e[12]=d=>t.currentField="X"),class:"form-control form-control-sm",size:"3"},null,40,S3),[[_e,a.pos.x]])]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.pos.y=d,ref_for:!0,ref:"Y",onFocus:e[13]||(e[13]=d=>t.currentField="Y"),class:"form-control form-control-sm",size:"3"},null,40,M3),[[_e,a.pos.y]])]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.pos.a=d,ref_for:!0,ref:"A",onFocus:e[14]||(e[14]=d=>t.currentField="A"),onChange:e[15]||(e[15]=d=>o.refreshCurrentElement(t.currentRow)),class:"form-control form-control-sm",size:"3"},null,40,E3),[[_e,a.pos.a]])]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.active=d,ref_for:!0,ref:"active",onFocus:e[16]||(e[16]=d=>t.currentField="active"),type:"checkbox",class:"form-control form-control-sm",title:"Active"},null,40,w3),[[Zn,a.active]])]),c("th",T3,[c("button",{class:"btn btn-sm btn-outline-secondary me-1",onClick:d=>t.$emit("up",a)},"\u2BC5",8,C3),c("button",{class:"btn btn-sm btn-outline-secondary me-1",onClick:d=>t.$emit("down",a)},"\u2BC6",8,A3),c("button",{class:"btn btn-sm btn-outline-secondary btn-danger",onClick:d=>t.$emit("delete",a)},"\u2BBF",8,P3)])],42,f3))),256))])],512),c("div",R3,[c("button",{onClick:e[17]||(e[17]=a=>t.$emit("add")),class:"btn btn-sm btn-outline-secondary me-1"},"Add element"),c("button",{onClick:e[18]||(e[18]=a=>t.$emit("import")),class:"btn btn-sm btn-outline-secondary"},"Import elements...")])])]),c("div",D3,[o.isCurrent?(W(),ee("div",I3,[c("div",L3,"Element "+ze(t.currentRow.name)+" (# "+ze(t.currentRow.id)+")",1),c("div",U3,[c("div",F3,[O3,c("div",N3,[c("div",z3,[se(c("input",{"onUpdate:modelValue":e[19]||(e[19]=a=>t.currentRow.name=a),type:"text",class:"form-control form-control-sm"},null,512),[[_e,t.currentRow.name]])])])]),c("div",k3,[B3,c("div",V3,[c("div",H3,[se(c("input",{"onUpdate:modelValue":e[20]||(e[20]=a=>t.currentRow.caption=a),type:"text",class:"form-control form-control-sm"},null,512),[[_e,t.currentRow.caption]])])])]),c("div",$3,[G3,c("div",W3,[c("div",X3,[se(c("select",{"onUpdate:modelValue":e[21]||(e[21]=a=>t.currentRow.feeder=a),class:"form-control form-control-sm"},[(W(!0),ee(rt,null,wt(n.feeders,a=>(W(),ee("option",{value:a.id},ze(a.name)+" ( "+ze(a.caption)+" )",9,j3))),256))],512),[[Kn,t.currentRow.feeder]])])])]),c("div",Y3,[q3,c("div",Z3,[c("div",K3,[J3,se(c("input",{"onUpdate:modelValue":e[22]||(e[22]=a=>t.currentRow.pos.x=a),type:"number",class:"form-control form-control-sm",step:"0.01"},null,512),[[_e,t.currentRow.pos.x]])]),c("div",Q3,[eD,se(c("input",{"onUpdate:modelValue":e[23]||(e[23]=a=>t.currentRow.pos.y=a),type:"number",class:"form-control form-control-sm",step:"0.01"},null,512),[[_e,t.currentRow.pos.y]])]),c("div",tD,[nD,se(c("input",{"onUpdate:modelValue":e[24]||(e[24]=a=>t.currentRow.pos.a=a),onChange:e[25]||(e[25]=a=>o.refreshCurrentElement(t.currentRow)),type:"number",class:"form-control form-control-sm",step:"0.01"},null,544),[[_e,t.currentRow.pos.a]])]),c("div",iD,[c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1 mt-3",onClick:e[26]||(e[26]=a=>o.setElementPosCam(t.currentRow)),title:"Set current position of camera (x, y, a)"},"\u26F6"),c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1 mt-3",onClick:e[27]||(e[27]=a=>o.setElementPos(t.currentRow)),title:"Set current position of nozzle (x, y, a)"},"\u{1F78A}")])])]),c("div",sD,[oD,c("div",rD,[c("div",aD,[c("div",lD,[se(c("input",{"onUpdate:modelValue":e[28]||(e[28]=a=>t.currentRow.active=a),class:"form-check-input",type:"checkbox",role:"switch",id:"posCorrection"},null,512),[[Zn,t.currentRow.active]])])])])])])])):st("",!0),o.isCurrent?(W(),ee("div",cD,[dD,c("div",uD,[c("div",null,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[29]||(e[29]=a=>o.placeElement(t.currentRow))},"Place element",8,hD),c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[30]||(e[30]=a=>o.runFrom(t.currentRow))},"Start Job from this element",8,fD)]),c("div",null,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[31]||(e[31]=a=>o.goToElement(t.currentRow))},vD,8,pD),c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[32]||(e[32]=a=>o.goToFeeder(t.currentRow.feeder))},MD,8,bD)]),c("div",null,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[33]||(e[33]=a=>o.goToElementCam(t.currentRow))},AD,8,ED),c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[34]||(e[34]=a=>o.goToFeederCam(t.currentRow.feeder))},LD,8,PD)])])])):st("",!0)])])}var FD=ct(G2,[["render",UD]]);const OD={props:["title","number","width","height"],data:function(){return{drag:!1,dragObject:this.dragObject,shiftX:this.shiftX,shiftY:this.shiftY,downX:this.downX,downY:this.downY}},methods:{close(){this.$emit("close")},setSize:function(){typeof this.width!="undefined"&&(this.dragObject.style.width=this.width+"px"),typeof this.height!="undefined"&&(this.dragObject.style.height=this.height+"px")},onkey(t){t.keyCode==27&&this.close()}},mounted:function(){this.dragObject=this.$refs["win"+this.number],this.setSize(),window.addEventListener("keydown",this.onkey)},beforeUnmount:function(){window.removeEventListener("keydown",this.onkey)},watch:{width(){this.setSize()},height(){this.setSize()}}},ND=t=>(Xm("data-v-c19ddb68"),t=t(),jm(),t),zD=ND(()=>c("div",{class:"dialog-overlay"},null,-1)),kD={class:"dialogtitle"},BD={class:"title"},VD={class:"content"};function HD(t,e,n,i,s,o){return W(),ee("div",null,[zD,c("div",{class:"dialog",ref:"win"+n.number},[c("div",kD,[c("div",BD,ze(n.title),1),c("div",{class:"btn imgClose",onClick:e[0]||(e[0]=r=>o.close()),title:"Close"})]),c("div",VD,[Qs(t.$slots,"default",{},void 0,!0)])],512)])}var $D=ct(OD,[["render",HD],["__scopeId","data-v-c19ddb68"]]);const GD={mixins:[Ia,Hn],components:{FeedersSettings:up,ElementsTable:FD,DialogWindow:$D},data(){return{tab:0,currentElement:this.currentElement,showWindow:[!1,!1],inpuValue:""}},props:{project:Object,projects_list:Object,settings:Object,cases:Object,machineState:Object,machinePos:Object,pnpProcessing:Object,default_feeders:Object,disabled:Boolean,loading:Boolean},computed:{projectsList(){if(this.projects_list){let t=[];for(let e of this.projects_list)t.push(e.split(".").slice(0,-1).join("."));return t}},dialogIsOpened(){return this.showWindow.indexOf(!0)>-1}},methods:{importFeeder(){Un("The Feeders of this project will be replaced by Default Feeders settings. Do you want import default Feeders?","Confirm").then(t=>{t==!0&&(this.project.feeders=JSON.parse(JSON.stringify(this.default_feeders)))})},setCurrentElement(t){this.currentElement=t;for(let e of this.project.feeders)if(e.id==t.feeder){let n=parseFloat(e.caseRotate)+parseFloat(t.pos.a);this.$emit("setSMDCase",{case:e.case,rotate:n})}},pnpGoToFeeder(t){this.$emit("goToFeeder",t)},pnpGoToFeederCam(t){this.$emit("goToFeederCam",t)},pnpPickFromFeeder(t){this.$emit("pickFromFeeder",t)},pnpFixPosition(t){this.$emit("fixPosition",t)},pnpDropIntoBasket(t){this.$emit("dropIntoBasket",t)},runFrom(t){this.$emit("runFrom",t),this.tab=3},saveFeeders(){Un("Attention! This feeders set will saved when You Save Project! You can set this feeders set as default. Do You want to set this Feeders set as default?","Warning").then(t=>{t==!0&&Un("Do You want to set this Feeders set as default? Are You sure?","Confirm").then(e=>{e==!0&&this.$emit("setFeeders")})})},openDialogOpenProject(){this.showWindow[0]=!0},closeDialogOpenProject(){this.showWindow[0]=!1},openDialogSaveAs(){this.inpuValue=this.project.name,this.showWindow[1]=!0},closeDialogSaveAs(){this.showWindow[1]=!1},openDialogProjectsManager(){this.showWindow[2]=!0},closeDialogProjectsManager(){this.showWindow[2]=!1},newProject(){Un("Attention! All changes of current project will lost. Do You want to create new Project?","Confirm").then(t=>{t==!0&&this.$emit("newProject")})},loadProject(){this.projectsList.indexOf(this.project.name)!=-1?this.$emit("loadProject"):lt(`Can't load project "`+this.project.name+'". The project is missing.',"Warning","warning")},saveProject(){this.project.name!="New Project"?this.$emit("saveProject"):this.openDialogSaveAs()},async renameProject(t){let e=await jy("Please enter new project name:","Rename",t);e!==null&&e!=!1&&(this.projectsList.indexOf(e)==-1?this.$emit("renameProject",{name:t,newName:e}):lt("Can't rename the Project. A project with the specified name already exists!","Warning","warning"))},deleteProject(t){Un('Do You want to delete project "'+t+'"?',"Confirm").then(e=>{e==!0&&this.$emit("deleteProject",t)})},goToElement(t){this.$emit("goToElement",t)},goToElementCam(t){this.$emit("goToElementCam",t)},placeElement(t){this.$emit("placeElement",t)},getNextElementId(){let t=1;for(let e of this.project.elements)e.id>=t&&(t=e.id+1);return t},addElement(){let t=this.getNextElementId();this.project.elements.push({id:t,name:"SMD "+t.toString(),caption:"",feeder:0,pos:{x:0,y:0,a:0},active:!0}),this.currentElement=this.project.elements[this.project.elements.length-1]},getFeederById(t){for(let e of this.project.feeders)if(e.id==t)return e;return null},sortElements(t){let e=this.project.elements.slice();e=e.sort((n,i)=>{let s,o;if(t.field=="feeder"&&(s=parseFloat(n.feeder),o=parseFloat(i.feeder)),t.field=="nozzle"){let r=this.getFeederById(n.feeder),a=this.getFeederById(i.feeder);r!=null&&(s=parseFloat(r.nozzle)),a!=null&&(o=parseFloat(a.nozzle))}return t.field=="x"&&(s=parseFloat(n.pos.x),o=parseFloat(i.pos.x)),t.field=="y"&&(s=parseFloat(n.pos.y),o=parseFloat(i.pos.y)),t.order=="up"?so?1:0:os?1:0}),this.project.elements=e},importElements(){this.$refs.openFile.click()},importFile(){function t(i){return i=i.replace(/[\"]/g,""),i}function e(i){return i=parseFloat(i.replace(/[^0-9,\.]/g,"")),i}let n=this.$refs.openFile.files[0];if(n){let i=new FileReader;i.readAsText(n,"UTF-8"),i.onload=s=>{let o=s.target.result.split(` `);if(o.length>0){let r=o[0].split(" "),a={},l=0;for(let f of r)a[f]=l,l++;let d=parseFloat(this.settings.table.pos.x),u=parseFloat(this.settings.table.pos.y);l=0;for(let f of o)if(l>0){let h=f.split(" ");if(h.length>1){let m=t(h[a.Comment]),b=0;for(let y of this.project.feeders)y.caption.toUpperCase()==m.toUpperCase()&&(b=y.id);this.project.elements.push({id:this.getNextElementId(),name:t(h[a.Designator])+" ("+h[a.Layer]+")",caption:m,feeder:b,pos:{x:d+e(h[a["Mid X"]]),y:u+e(h[a["Mid Y"]]),a:e(h[a.Rotation])/360},active:!0})}}else l++}},i.onerror=s=>{console.log(s),lt("Can't read file '"+n.name+"'","Error","error")},this.$refs.openFile.value=""}},jogFirstElement(){this.project.elements.length>0?this.$emit("goToElementCam",this.project.elements[0]):lt("There is not a elements in the project","Warning","warning")},setPCBPosCam(){this.machineStateIsOK()==!0&&(this.project.pcb.pos.x=(parseFloat(this.machinePos.x)-parseFloat(this.project.elements[0].pos.x)+parseFloat(this.settings.cams[0].offset.x)).toFixed(3),this.project.pcb.pos.y=(parseFloat(this.machinePos.y)-parseFloat(this.project.elements[0].pos.y)+parseFloat(this.settings.cams[0].offset.y)).toFixed(3))},setPCBPos(){this.machineStateIsOK()==!0&&(this.project.pcb.pos.x=(parseFloat(this.machinePos.x)-parseFloat(this.project.elements[0].pos.x)).toFixed(3),this.project.pcb.pos.y=(parseFloat(this.machinePos.y)-parseFloat(this.project.elements[0].pos.y)).toFixed(3))},findElement(){this.setCurrentElement(this.pnpProcessing.element),this.tab=1},run(){this.$emit("run")},pause(){this.$emit("pause")},stop(){this.$emit("stop")}}},WD={style:{"max-height":"400px","overflow-y":"auto"}},XD={class:"table",ref:"table"},jD=c("thead",null,[c("tr",null,[c("th"),c("th",null,"Projects")])],-1),YD=["onClick","onDblclick"],qD={width:"2"},ZD={key:0},KD={key:1},JD={class:"float-end",style:{position:"absolute",bottom:"0px"}},QD=["disabled"],eI=["disabled"],tI={size:"20",disabled:"",class:"form-control"},nI={class:"float-end",style:{position:"absolute",bottom:"0px"}},iI=["disabled"],sI=["disabled"],oI={style:{"max-height":"400px","overflow-y":"auto"}},rI={class:"table",ref:"table"},aI=c("thead",null,[c("tr",null,[c("th"),c("th",null,"Project"),c("th")])],-1),lI=["onClick"],cI={width:"2"},dI={key:0},uI={key:1},hI={width:"220"},fI=["disabled","onClick"],pI=["disabled","onClick"],mI=["disabled","onClick"],_I={class:"float-end",style:{position:"absolute",bottom:"0px"}},gI=["disabled"],vI={class:"project-name"},bI={class:"row"},yI={class:"col"},xI=Ie(" Project: "),SI={class:"col-auto"},MI=["disabled"],EI=["disabled"],wI=["disabled"],TI=["disabled"],CI=["disabled"],AI={class:"nav nav-tabs"},PI={class:"nav-item"},RI={class:"nav-item"},DI={class:"nav-item"},II={class:"nav-item"},LI={class:"row mt-2"},UI={class:"col"},FI={class:"row mt-2"},OI={class:"col"},NI={class:"row mt-2"},zI={class:"col"},kI={class:"card"},BI=c("div",{class:"card-header"},"PCB manual position correction",-1),VI={class:"card-body"},HI=["disabled"],$I={class:"mb-3"},GI=c("label",{class:"form-label"},"Offset of first element (manual correction)",-1),WI={class:"row mb-2"},XI={class:"col"},jI=Ie(" X: "),YI={class:"col"},qI=Ie(" Y: "),ZI={class:"col-auto"},KI={class:"mb-3"},JI=c("label",{class:"form-label"},"PCB thickness",-1),QI={class:"row mt-2"},eL={class:"col"},tL={class:"card"},nL=c("div",{class:"card-header"},"Run",-1),iL={class:"card-body"},sL=["disabled"],oL=["disabled"],rL={key:0},aL={key:1},lL=["disabled"],cL={key:0,class:"alert alert-success",role:"alert"},dL={key:0};function uL(t,e,n,i,s,o){const r=et("DialogWindow"),a=et("FeedersSettings"),l=et("ElementsTable");return W(),ee("div",null,[c("input",{type:"file",ref:"openFile",accept:".csv",style:{display:"none"},onChange:e[0]||(e[0]=d=>o.importFile())},null,544),se(ke(r,{title:"Open",width:"800",height:"520",number:0,onClose:e[3]||(e[3]=d=>o.closeDialogOpenProject())},{default:Ct(()=>[c("div",WD,[c("table",XD,[jD,c("tbody",null,[(W(!0),ee(rt,null,wt(o.projectsList,d=>(W(),ee("tr",{onClick:u=>s.inpuValue=d,onDblclick:u=>{n.project.name=d,o.closeDialogOpenProject(),o.loadProject()},class:je(s.inpuValue==d?"active-row":"")},[c("td",qD,[s.inpuValue==d?(W(),ee("span",ZD,"\u2BC8")):(W(),ee("span",KD,"\xA0\xA0"))]),c("td",null,ze(d),1)],42,YD))),256))])],512)]),c("div",JD,[c("button",{disabled:n.loading||o.projectsList.indexOf(s.inpuValue)==-1,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[1]||(e[1]=d=>{n.project.name=s.inpuValue,o.closeDialogOpenProject(),o.loadProject()})},"Open",8,QD),c("button",{disabled:n.loading,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[2]||(e[2]=d=>o.closeDialogOpenProject())},"Cancel",8,eI)])]),_:1},512),[[an,s.showWindow[0]]]),se(ke(r,{title:"Save as...",width:"800",height:"520",number:1,onClose:e[8]||(e[8]=d=>o.closeDialogSaveAs())},{default:Ct(()=>[se(c("input",{"onUpdate:modelValue":e[4]||(e[4]=d=>s.inpuValue=d),class:"form-control form-control-sm",type:"text",onKeyup:e[5]||(e[5]=Zf(d=>{n.project.name=s.inpuValue,o.closeDialogSaveAs(),o.saveProject()},["enter"]))},null,544),[[_e,s.inpuValue]]),c("div",null,[c("select",tI,[(W(!0),ee(rt,null,wt(o.projectsList,d=>(W(),ee("option",null,ze(d),1))),256))])]),c("div",nI,[c("button",{disabled:n.loading||o.projectsList.indexOf(s.inpuValue)>-1,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[6]||(e[6]=d=>{n.project.name=s.inpuValue,o.closeDialogSaveAs(),o.saveProject()})},"Save",8,iI),c("button",{disabled:n.loading,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[7]||(e[7]=d=>o.closeDialogSaveAs())},"Cancel",8,sI)])]),_:1},512),[[an,s.showWindow[1]]]),se(ke(r,{title:"Projects manager",width:"800",height:"520",number:2,onClose:e[10]||(e[10]=d=>o.closeDialogProjectsManager())},{default:Ct(()=>[c("div",oI,[c("table",rI,[aI,c("tbody",null,[(W(!0),ee(rt,null,wt(o.projectsList,d=>(W(),ee("tr",{onClick:u=>s.inpuValue=d,class:je(s.inpuValue==d?"active-row":"")},[c("td",cI,[s.inpuValue==d?(W(),ee("span",dI,"\u2BC8")):(W(),ee("span",uI,"\xA0\xA0"))]),c("td",null,ze(d),1),c("td",hI,[c("button",{disabled:n.loading,type:"button",class:"btn btn-sm btn-outline-secondary me-1",onClick:u=>{n.project.name=d,o.closeDialogProjectsManager(),o.loadProject()}},"Open",8,fI),c("button",{disabled:n.loading,type:"button",class:"btn btn-sm btn-outline-secondary me-1",onClick:u=>o.renameProject(d)},"Rename",8,pI),c("button",{disabled:n.loading,type:"button",class:"btn btn-sm btn-outline-secondary me-1",onClick:u=>o.deleteProject(d)},"Delete",8,mI)])],10,lI))),256))])],512)]),c("div",_I,[c("button",{disabled:n.loading,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[9]||(e[9]=d=>o.closeDialogProjectsManager())},"Cancel",8,gI)])]),_:1},512),[[an,s.showWindow[2]]]),c("div",vI,[c("div",bI,[c("div",yI,[xI,c("b",null,ze(n.project.name),1)]),c("div",SI,[c("button",{disabled:n.loading||o.dialogIsOpened,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[11]||(e[11]=d=>o.newProject())},"New...",8,MI),c("button",{disabled:n.loading||o.dialogIsOpened,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[12]||(e[12]=d=>o.openDialogOpenProject())},"Open...",8,EI),c("button",{disabled:n.loading||o.dialogIsOpened,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[13]||(e[13]=d=>o.saveProject())},"Save Project",8,wI),c("button",{disabled:n.loading||o.dialogIsOpened,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[14]||(e[14]=d=>o.openDialogSaveAs())},"Save as...",8,TI),c("button",{disabled:n.loading||o.dialogIsOpened,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[15]||(e[15]=d=>o.openDialogProjectsManager())},"Projects manager...",8,CI)])])]),c("ul",AI,[c("li",PI,[c("a",{class:je("nav-link"+(s.tab==0?" active":"")),onClick:e[16]||(e[16]=d=>s.tab=0)},"Feeders",2)]),c("li",RI,[c("a",{class:je("nav-link"+(s.tab==1?" active":"")),onClick:e[17]||(e[17]=d=>s.tab=1)},"Elements",2)]),c("li",DI,[c("a",{class:je("nav-link"+(s.tab==2?" active":"")),onClick:e[18]||(e[18]=d=>s.tab=2)},"PCB",2)]),c("li",II,[c("a",{class:je("nav-link"+(s.tab==3?" active":"")),onClick:e[19]||(e[19]=d=>s.tab=3)},"Job",2)])]),se(c("div",LI,[c("div",UI,[ke(a,{settings:n.settings,cases:n.cases,machineState:n.machineState,machinePos:n.machinePos,feeders:n.project.feeders,disabled:n.disabled,loading:n.loading,onGoToFeeder:e[20]||(e[20]=d=>o.pnpGoToFeeder(d)),onGoToFeederCam:e[21]||(e[21]=d=>o.pnpGoToFeederCam(d)),onPickFromFeeder:e[22]||(e[22]=d=>o.pnpPickFromFeeder(d)),onFixPosition:e[23]||(e[23]=d=>o.pnpFixPosition(d)),onDropIntoBasket:e[24]||(e[24]=d=>o.pnpDropIntoBasket(d)),onSaveFeeders:e[25]||(e[25]=d=>o.saveFeeders())},null,8,["settings","cases","machineState","machinePos","feeders","disabled","loading"]),c("button",{type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[26]||(e[26]=d=>o.importFeeder())},"Import from settings")])],512),[[an,s.tab==0]]),se(c("div",FI,[c("div",OI,[ke(l,{rows:n.project.elements,currentRow:s.currentElement,feeders:n.project.feeders,settings:n.settings,machineState:n.machineState,machinePos:n.machinePos,disabled:n.disabled,onGoToFeeder:e[27]||(e[27]=d=>o.pnpGoToFeeder(d)),onGoToFeederCam:e[28]||(e[28]=d=>o.pnpGoToFeederCam(d)),onGoToElement:e[29]||(e[29]=d=>o.goToElement(d)),onGoToElementCam:e[30]||(e[30]=d=>o.goToElementCam(d)),onPlaceElement:e[31]||(e[31]=d=>o.placeElement(d)),onSortElements:e[32]||(e[32]=d=>o.sortElements(d)),onRunFrom:e[33]||(e[33]=d=>o.runFrom(d)),onAdd:e[34]||(e[34]=d=>o.addElement()),onImport:e[35]||(e[35]=d=>o.importElements()),onSet:e[36]||(e[36]=d=>o.setCurrentElement(d)),onUp:e[37]||(e[37]=d=>t.rowUp(n.project.elements,d)),onDown:e[38]||(e[38]=d=>t.rowDown(n.project.elements,d)),onDelete:e[39]||(e[39]=d=>t.rowDelete(n.project.elements,d))},null,8,["rows","currentRow","feeders","settings","machineState","machinePos","disabled"])])],512),[[an,s.tab==1]]),se(c("div",NI,[c("div",zI,[c("div",kI,[BI,c("div",VI,[c("div",null,[c("button",{disabled:n.disabled,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[40]||(e[40]=d=>o.jogFirstElement())},"Jog Camera to first elment",8,HI)]),c("div",$I,[GI,c("div",WI,[c("div",XI,[jI,se(c("input",{"onUpdate:modelValue":e[41]||(e[41]=d=>n.project.pcb.pos.x=d),type:"number",class:"form-control form-control-sm",step:"0.01"},null,512),[[_e,n.project.pcb.pos.x]])]),c("div",YI,[qI,se(c("input",{"onUpdate:modelValue":e[42]||(e[42]=d=>n.project.pcb.pos.y=d),type:"number",class:"form-control form-control-sm",step:"0.01"},null,512),[[_e,n.project.pcb.pos.y]])]),c("div",ZI,[c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1 mt-3",onClick:e[43]||(e[43]=d=>o.setPCBPosCam()),title:"Set current position of camera"},"\u26F6"),c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1 mt-3",onClick:e[44]||(e[44]=d=>o.setPCBPos()),title:"Set current position of nozzle"},"\u{1F78A}")])])]),c("div",KI,[JI,se(c("input",{"onUpdate:modelValue":e[45]||(e[45]=d=>n.project.pcb.pos.z=d),type:"number",class:"form-control form-control-sm",step:"0.01"},null,512),[[_e,n.project.pcb.pos.z]])])])])])],512),[[an,s.tab==2]]),se(c("div",QI,[c("div",eL,[c("div",tL,[nL,c("div",iL,[c("button",{disabled:n.disabled,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[46]||(e[46]=d=>o.run())},"Start",8,sL),c("button",{disabled:n.pnpProcessing.runFlag==!1,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[47]||(e[47]=d=>o.pause())},[n.pnpProcessing.pauseFlag==!1?(W(),ee("span",rL,"Pause")):(W(),ee("span",aL,"Resume"))],8,oL),c("button",{disabled:n.pnpProcessing.runFlag==!1,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[48]||(e[48]=d=>o.stop())},"Stop",8,lL),n.pnpProcessing.message!=""?(W(),ee("div",cL,[Ie(ze(n.pnpProcessing.message)+" ",1),this.pnpProcessing.runFlag==!1?(W(),ee("span",dL,[c("button",{type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[49]||(e[49]=d=>o.findElement())},"Find Element in elements list"),c("button",{type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[50]||(e[50]=d=>o.runFrom(this.pnpProcessing.element))},"Resume Job from this element")])):st("",!0)])):st("",!0)])])])],512),[[an,s.tab==3]])])}var hL=ct(GD,[["render",uL]]);const fL={props:{loading:Boolean}},pL={key:0,class:"loader-bg"},mL=c("div",{class:"loader-track"},[c("div",{class:"loader-fill"},"\xA0")],-1),_L=[mL];function gL(t,e,n,i,s,o){return n.loading?(W(),ee("div",pL,_L)):st("",!0)}var vL=ct(fL,[["render",gL]]);/** * @license * Copyright 2010-2025 Three.js Authors * SPDX-License-Identifier: MIT */const nd="176",Zs={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Gs={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},bL=0,Cu=1,yL=2,hp=1,xL=2,li=3,Vi=0,un=1,Fn=2,Ni=0,Ks=1,Au=2,Pu=3,Ru=4,SL=5,ls=100,ML=101,EL=102,wL=103,TL=104,CL=200,AL=201,PL=202,RL=203,jl=204,Yl=205,DL=206,IL=207,LL=208,UL=209,FL=210,OL=211,NL=212,zL=213,kL=214,ql=0,Zl=1,Kl=2,so=3,Jl=4,Ql=5,ec=6,tc=7,id=0,BL=1,VL=2,zi=0,HL=1,$L=2,GL=3,WL=4,XL=5,jL=6,YL=7,fp=300,oo=301,ro=302,nc=303,ic=304,La=306,sc=1e3,hs=1001,oc=1002,Bn=1003,qL=1004,xr=1005,qn=1006,qa=1007,fs=1008,ei=1009,pp=1010,mp=1011,sr=1012,sd=1013,gs=1014,ui=1015,ur=1016,od=1017,rd=1018,or=1020,_p=35902,gp=1021,vp=1022,zn=1023,rr=1026,ar=1027,bp=1028,ad=1029,yp=1030,ld=1031,cd=1033,Jr=33776,Qr=33777,ea=33778,ta=33779,rc=35840,ac=35841,lc=35842,cc=35843,dc=36196,uc=37492,hc=37496,fc=37808,pc=37809,mc=37810,_c=37811,gc=37812,vc=37813,bc=37814,yc=37815,xc=37816,Sc=37817,Mc=37818,Ec=37819,wc=37820,Tc=37821,na=36492,Cc=36494,Ac=36495,xp=36283,Pc=36284,Rc=36285,Dc=36286,ZL=3200,KL=3201,Sp=0,JL=1,Li="",En="srgb",ao="srgb-linear",fa="linear",bt="srgb",Ts=7680,Du=519,QL=512,eU=513,tU=514,Mp=515,nU=516,iU=517,sU=518,oU=519,Iu=35044,Lu="300 es",hi=2e3,pa=2001;class Ss{addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(n)===-1&&i[e].push(n)}hasEventListener(e,n){const i=this._listeners;return i===void 0?!1:i[e]!==void 0&&i[e].indexOf(n)!==-1}removeEventListener(e,n){const i=this._listeners;if(i===void 0)return;const s=i[e];if(s!==void 0){const o=s.indexOf(n);o!==-1&&s.splice(o,1)}}dispatchEvent(e){const n=this._listeners;if(n===void 0)return;const i=n[e.type];if(i!==void 0){e.target=this;const s=i.slice(0);for(let o=0,r=s.length;o>8&255]+qt[t>>16&255]+qt[t>>24&255]+"-"+qt[e&255]+qt[e>>8&255]+"-"+qt[e>>16&15|64]+qt[e>>24&255]+"-"+qt[n&63|128]+qt[n>>8&255]+"-"+qt[n>>16&255]+qt[n>>24&255]+qt[i&255]+qt[i>>8&255]+qt[i>>16&255]+qt[i>>24&255]).toLowerCase()}function ot(t,e,n){return Math.max(e,Math.min(n,t))}function dd(t,e){return(t%e+e)%e}function rU(t,e,n,i,s){return i+(t-e)*(s-i)/(n-e)}function aU(t,e,n){return t!==e?(n-t)/(e-t):0}function jo(t,e,n){return(1-n)*t+n*e}function lU(t,e,n,i){return jo(t,e,1-Math.exp(-n*i))}function cU(t,e=1){return e-Math.abs(dd(t,e*2)-e)}function dU(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function uU(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(t*6-15)+10))}function hU(t,e){return t+Math.floor(Math.random()*(e-t+1))}function fU(t,e){return t+Math.random()*(e-t)}function pU(t){return t*(.5-Math.random())}function mU(t){t!==void 0&&(Uu=t);let e=Uu+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function _U(t){return t*Xo}function gU(t){return t*lo}function vU(t){return(t&t-1)===0&&t!==0}function bU(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function yU(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function xU(t,e,n,i,s){const o=Math.cos,r=Math.sin,a=o(n/2),l=r(n/2),d=o((e+i)/2),u=r((e+i)/2),f=o((e-i)/2),h=r((e-i)/2),m=o((i-e)/2),b=r((i-e)/2);switch(s){case"XYX":t.set(a*u,l*f,l*h,a*d);break;case"YZY":t.set(l*h,a*u,l*f,a*d);break;case"ZXZ":t.set(l*f,l*h,a*u,a*d);break;case"XZX":t.set(a*u,l*b,l*m,a*d);break;case"YXY":t.set(l*m,a*u,l*b,a*d);break;case"ZYZ":t.set(l*b,l*m,a*u,a*d);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function $s(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function on(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(t*4294967295);case Uint16Array:return Math.round(t*65535);case Uint8Array:return Math.round(t*255);case Int32Array:return Math.round(t*2147483647);case Int16Array:return Math.round(t*32767);case Int8Array:return Math.round(t*127);default:throw new Error("Invalid component type.")}}const SU={DEG2RAD:Xo,RAD2DEG:lo,generateUUID:vo,clamp:ot,euclideanModulo:dd,mapLinear:rU,inverseLerp:aU,lerp:jo,damp:lU,pingpong:cU,smoothstep:dU,smootherstep:uU,randInt:hU,randFloat:fU,randFloatSpread:pU,seededRandom:mU,degToRad:_U,radToDeg:gU,isPowerOfTwo:vU,ceilPowerOfTwo:bU,floorPowerOfTwo:yU,setQuaternionFromProperEuler:xU,normalize:on,denormalize:$s};class Ke{constructor(e=0,n=0){Ke.prototype.isVector2=!0,this.x=e,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,n){return this.x=e,this.y=n,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const n=this.x,i=this.y,s=e.elements;return this.x=s[0]*n+s[3]*i+s[6],this.y=s[1]*n+s[4]*i+s[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,n){return this.x=ot(this.x,e.x,n.x),this.y=ot(this.y,e.y,n.y),this}clampScalar(e,n){return this.x=ot(this.x,e,n),this.y=ot(this.y,e,n),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(ot(i,e,n))}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=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.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(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const i=this.dot(e)/n;return Math.acos(ot(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,i=this.y-e.y;return n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this}rotateAround(e,n){const i=Math.cos(n),s=Math.sin(n),o=this.x-e.x,r=this.y-e.y;return this.x=o*i-r*s+e.x,this.y=o*s+r*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class tt{constructor(e,n,i,s,o,r,a,l,d){tt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,i,s,o,r,a,l,d)}set(e,n,i,s,o,r,a,l,d){const u=this.elements;return u[0]=e,u[1]=s,u[2]=a,u[3]=n,u[4]=o,u[5]=l,u[6]=i,u[7]=r,u[8]=d,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,i=e.elements;return n[0]=i[0],n[1]=i[1],n[2]=i[2],n[3]=i[3],n[4]=i[4],n[5]=i[5],n[6]=i[6],n[7]=i[7],n[8]=i[8],this}extractBasis(e,n,i){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const n=e.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const i=e.elements,s=n.elements,o=this.elements,r=i[0],a=i[3],l=i[6],d=i[1],u=i[4],f=i[7],h=i[2],m=i[5],b=i[8],y=s[0],_=s[3],p=s[6],T=s[1],w=s[4],S=s[7],I=s[2],P=s[5],D=s[8];return o[0]=r*y+a*T+l*I,o[3]=r*_+a*w+l*P,o[6]=r*p+a*S+l*D,o[1]=d*y+u*T+f*I,o[4]=d*_+u*w+f*P,o[7]=d*p+u*S+f*D,o[2]=h*y+m*T+b*I,o[5]=h*_+m*w+b*P,o[8]=h*p+m*S+b*D,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=e,n[4]*=e,n[7]*=e,n[2]*=e,n[5]*=e,n[8]*=e,this}determinant(){const e=this.elements,n=e[0],i=e[1],s=e[2],o=e[3],r=e[4],a=e[5],l=e[6],d=e[7],u=e[8];return n*r*u-n*a*d-i*o*u+i*a*l+s*o*d-s*r*l}invert(){const e=this.elements,n=e[0],i=e[1],s=e[2],o=e[3],r=e[4],a=e[5],l=e[6],d=e[7],u=e[8],f=u*r-a*d,h=a*l-u*o,m=d*o-r*l,b=n*f+i*h+s*m;if(b===0)return this.set(0,0,0,0,0,0,0,0,0);const y=1/b;return e[0]=f*y,e[1]=(s*d-u*i)*y,e[2]=(a*i-s*r)*y,e[3]=h*y,e[4]=(u*n-s*l)*y,e[5]=(s*o-a*n)*y,e[6]=m*y,e[7]=(i*l-d*n)*y,e[8]=(r*n-i*o)*y,this}transpose(){let e;const n=this.elements;return e=n[1],n[1]=n[3],n[3]=e,e=n[2],n[2]=n[6],n[6]=e,e=n[5],n[5]=n[7],n[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const n=this.elements;return e[0]=n[0],e[1]=n[3],e[2]=n[6],e[3]=n[1],e[4]=n[4],e[5]=n[7],e[6]=n[2],e[7]=n[5],e[8]=n[8],this}setUvTransform(e,n,i,s,o,r,a){const l=Math.cos(o),d=Math.sin(o);return this.set(i*l,i*d,-i*(l*r+d*a)+r+e,-s*d,s*l,-s*(-d*r+l*a)+a+n,0,0,1),this}scale(e,n){return this.premultiply(Za.makeScale(e,n)),this}rotate(e){return this.premultiply(Za.makeRotation(-e)),this}translate(e,n){return this.premultiply(Za.makeTranslation(e,n)),this}makeTranslation(e,n){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,n,0,0,1),this}makeRotation(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,-i,0,i,n,0,0,0,1),this}makeScale(e,n){return this.set(e,0,0,0,n,0,0,0,1),this}equals(e){const n=this.elements,i=e.elements;for(let s=0;s<9;s++)if(n[s]!==i[s])return!1;return!0}fromArray(e,n=0){for(let i=0;i<9;i++)this.elements[i]=e[i+n];return this}toArray(e=[],n=0){const i=this.elements;return e[n]=i[0],e[n+1]=i[1],e[n+2]=i[2],e[n+3]=i[3],e[n+4]=i[4],e[n+5]=i[5],e[n+6]=i[6],e[n+7]=i[7],e[n+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Za=new tt;function Ep(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}function ma(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function MU(){const t=ma("canvas");return t.style.display="block",t}const Fu={};function ia(t){t in Fu||(Fu[t]=!0,console.warn(t))}function EU(t,e,n){return new Promise(function(i,s){function o(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:s();break;case t.TIMEOUT_EXPIRED:setTimeout(o,n);break;default:i()}}setTimeout(o,n)})}function wU(t){const e=t.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function TU(t){const e=t.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const Ou=new tt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Nu=new tt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function CU(){const t={enabled:!0,workingColorSpace:ao,spaces:{},convert:function(s,o,r){return this.enabled===!1||o===r||!o||!r||(this.spaces[o].transfer===bt&&(s.r=fi(s.r),s.g=fi(s.g),s.b=fi(s.b)),this.spaces[o].primaries!==this.spaces[r].primaries&&(s.applyMatrix3(this.spaces[o].toXYZ),s.applyMatrix3(this.spaces[r].fromXYZ)),this.spaces[r].transfer===bt&&(s.r=Js(s.r),s.g=Js(s.g),s.b=Js(s.b))),s},fromWorkingColorSpace:function(s,o){return this.convert(s,this.workingColorSpace,o)},toWorkingColorSpace:function(s,o){return this.convert(s,o,this.workingColorSpace)},getPrimaries:function(s){return this.spaces[s].primaries},getTransfer:function(s){return s===Li?fa:this.spaces[s].transfer},getLuminanceCoefficients:function(s,o=this.workingColorSpace){return s.fromArray(this.spaces[o].luminanceCoefficients)},define:function(s){Object.assign(this.spaces,s)},_getMatrix:function(s,o,r){return s.copy(this.spaces[o].toXYZ).multiply(this.spaces[r].fromXYZ)},_getDrawingBufferColorSpace:function(s){return this.spaces[s].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(s=this.workingColorSpace){return this.spaces[s].workingColorSpaceConfig.unpackColorSpace}},e=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],i=[.3127,.329];return t.define({[ao]:{primaries:e,whitePoint:i,transfer:fa,toXYZ:Ou,fromXYZ:Nu,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:En},outputColorSpaceConfig:{drawingBufferColorSpace:En}},[En]:{primaries:e,whitePoint:i,transfer:bt,toXYZ:Ou,fromXYZ:Nu,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:En}}}),t}const ft=CU();function fi(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function Js(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let Cs;class AU{static getDataURL(e,n="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement=="undefined")return e.src;let i;if(e instanceof HTMLCanvasElement)i=e;else{Cs===void 0&&(Cs=ma("canvas")),Cs.width=e.width,Cs.height=e.height;const s=Cs.getContext("2d");e instanceof ImageData?s.putImageData(e,0,0):s.drawImage(e,0,0,e.width,e.height),i=Cs}return i.toDataURL(n)}static sRGBToLinear(e){if(typeof HTMLImageElement!="undefined"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&e instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&e instanceof ImageBitmap){const n=ma("canvas");n.width=e.width,n.height=e.height;const i=n.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const s=i.getImageData(0,0,e.width,e.height),o=s.data;for(let r=0;r0&&(i.userData=this.userData),n||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==fp)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case sc:e.x=e.x-Math.floor(e.x);break;case hs:e.x=e.x<0?0:1;break;case oc:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case sc:e.y=e.y-Math.floor(e.y);break;case hs:e.y=e.y<0?0:1;break;case oc:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}hn.DEFAULT_IMAGE=null;hn.DEFAULT_MAPPING=fp;hn.DEFAULT_ANISOTROPY=1;class It{constructor(e=0,n=0,i=0,s=1){It.prototype.isVector4=!0,this.x=e,this.y=n,this.z=i,this.w=s}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,n,i,s){return this.x=e,this.y=n,this.z=i,this.w=s,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;case 3:this.w=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this.w=e.w+n.w,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this.w+=e.w*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this.w=e.w-n.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const n=this.x,i=this.y,s=this.z,o=this.w,r=e.elements;return this.x=r[0]*n+r[4]*i+r[8]*s+r[12]*o,this.y=r[1]*n+r[5]*i+r[9]*s+r[13]*o,this.z=r[2]*n+r[6]*i+r[10]*s+r[14]*o,this.w=r[3]*n+r[7]*i+r[11]*s+r[15]*o,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const n=Math.sqrt(1-e.w*e.w);return n<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/n,this.y=e.y/n,this.z=e.z/n),this}setAxisAngleFromRotationMatrix(e){let n,i,s,o;const l=e.elements,d=l[0],u=l[4],f=l[8],h=l[1],m=l[5],b=l[9],y=l[2],_=l[6],p=l[10];if(Math.abs(u-h)<.01&&Math.abs(f-y)<.01&&Math.abs(b-_)<.01){if(Math.abs(u+h)<.1&&Math.abs(f+y)<.1&&Math.abs(b+_)<.1&&Math.abs(d+m+p-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const w=(d+1)/2,S=(m+1)/2,I=(p+1)/2,P=(u+h)/4,D=(f+y)/4,R=(b+_)/4;return w>S&&w>I?w<.01?(i=0,s=.707106781,o=.707106781):(i=Math.sqrt(w),s=P/i,o=D/i):S>I?S<.01?(i=.707106781,s=0,o=.707106781):(s=Math.sqrt(S),i=P/s,o=R/s):I<.01?(i=.707106781,s=.707106781,o=0):(o=Math.sqrt(I),i=D/o,s=R/o),this.set(i,s,o,n),this}let T=Math.sqrt((_-b)*(_-b)+(f-y)*(f-y)+(h-u)*(h-u));return Math.abs(T)<.001&&(T=1),this.x=(_-b)/T,this.y=(f-y)/T,this.z=(h-u)/T,this.w=Math.acos((d+m+p-1)/2),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this.w=n[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,n){return this.x=ot(this.x,e.x,n.x),this.y=ot(this.y,e.y,n.y),this.z=ot(this.z,e.z,n.z),this.w=ot(this.w,e.w,n.w),this}clampScalar(e,n){return this.x=ot(this.x,e,n),this.y=ot(this.y,e,n),this.z=ot(this.z,e,n),this.w=ot(this.w,e,n),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(ot(i,e,n))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.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)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this.w+=(e.w-this.w)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this.z=e.z+(n.z-e.z)*i,this.w=e.w+(n.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this.w=e[n+3],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e[n+3]=this.w,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this.w=e.getW(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class DU extends Ss{constructor(e=1,n=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=i.depth?i.depth:1,this.scissor=new It(0,0,e,n),this.scissorTest=!1,this.viewport=new It(0,0,e,n);const s={width:e,height:n,depth:this.depth};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:qn,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,multiview:!1},i);const o=new hn(s,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);o.flipY=!1,o.generateMipmaps=i.generateMipmaps,o.internalFormat=i.internalFormat,this.textures=[];const r=i.count;for(let a=0;a=0?1:-1,w=1-p*p;if(w>Number.EPSILON){const I=Math.sqrt(w),P=Math.atan2(I,p*T);_=Math.sin(_*P)/I,a=Math.sin(a*P)/I}const S=a*T;if(l=l*_+h*S,d=d*_+m*S,u=u*_+b*S,f=f*_+y*S,_===1-a){const I=1/Math.sqrt(l*l+d*d+u*u+f*f);l*=I,d*=I,u*=I,f*=I}}e[n]=l,e[n+1]=d,e[n+2]=u,e[n+3]=f}static multiplyQuaternionsFlat(e,n,i,s,o,r){const a=i[s],l=i[s+1],d=i[s+2],u=i[s+3],f=o[r],h=o[r+1],m=o[r+2],b=o[r+3];return e[n]=a*b+u*f+l*m-d*h,e[n+1]=l*b+u*h+d*f-a*m,e[n+2]=d*b+u*m+a*h-l*f,e[n+3]=u*b-a*f-l*h-d*m,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,n,i,s){return this._x=e,this._y=n,this._z=i,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,n=!0){const i=e._x,s=e._y,o=e._z,r=e._order,a=Math.cos,l=Math.sin,d=a(i/2),u=a(s/2),f=a(o/2),h=l(i/2),m=l(s/2),b=l(o/2);switch(r){case"XYZ":this._x=h*u*f+d*m*b,this._y=d*m*f-h*u*b,this._z=d*u*b+h*m*f,this._w=d*u*f-h*m*b;break;case"YXZ":this._x=h*u*f+d*m*b,this._y=d*m*f-h*u*b,this._z=d*u*b-h*m*f,this._w=d*u*f+h*m*b;break;case"ZXY":this._x=h*u*f-d*m*b,this._y=d*m*f+h*u*b,this._z=d*u*b+h*m*f,this._w=d*u*f-h*m*b;break;case"ZYX":this._x=h*u*f-d*m*b,this._y=d*m*f+h*u*b,this._z=d*u*b-h*m*f,this._w=d*u*f+h*m*b;break;case"YZX":this._x=h*u*f+d*m*b,this._y=d*m*f+h*u*b,this._z=d*u*b-h*m*f,this._w=d*u*f-h*m*b;break;case"XZY":this._x=h*u*f-d*m*b,this._y=d*m*f-h*u*b,this._z=d*u*b+h*m*f,this._w=d*u*f+h*m*b;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+r)}return n===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,n){const i=n/2,s=Math.sin(i);return this._x=e.x*s,this._y=e.y*s,this._z=e.z*s,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const n=e.elements,i=n[0],s=n[4],o=n[8],r=n[1],a=n[5],l=n[9],d=n[2],u=n[6],f=n[10],h=i+a+f;if(h>0){const m=.5/Math.sqrt(h+1);this._w=.25/m,this._x=(u-l)*m,this._y=(o-d)*m,this._z=(r-s)*m}else if(i>a&&i>f){const m=2*Math.sqrt(1+i-a-f);this._w=(u-l)/m,this._x=.25*m,this._y=(s+r)/m,this._z=(o+d)/m}else if(a>f){const m=2*Math.sqrt(1+a-i-f);this._w=(o-d)/m,this._x=(s+r)/m,this._y=.25*m,this._z=(l+u)/m}else{const m=2*Math.sqrt(1+f-i-a);this._w=(r-s)/m,this._x=(o+d)/m,this._y=(l+u)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let i=e.dot(n)+1;return iMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*n.z-e.z*n.y,this._y=e.z*n.x-e.x*n.z,this._z=e.x*n.y-e.y*n.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(ot(this.dot(e),-1,1)))}rotateTowards(e,n){const i=this.angleTo(e);if(i===0)return this;const s=Math.min(1,n/i);return this.slerp(e,s),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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._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 e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,n){const i=e._x,s=e._y,o=e._z,r=e._w,a=n._x,l=n._y,d=n._z,u=n._w;return this._x=i*u+r*a+s*d-o*l,this._y=s*u+r*l+o*a-i*d,this._z=o*u+r*d+i*l-s*a,this._w=r*u-i*a-s*l-o*d,this._onChangeCallback(),this}slerp(e,n){if(n===0)return this;if(n===1)return this.copy(e);const i=this._x,s=this._y,o=this._z,r=this._w;let a=r*e._w+i*e._x+s*e._y+o*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=r,this._x=i,this._y=s,this._z=o,this;const l=1-a*a;if(l<=Number.EPSILON){const m=1-n;return this._w=m*r+n*this._w,this._x=m*i+n*this._x,this._y=m*s+n*this._y,this._z=m*o+n*this._z,this.normalize(),this}const d=Math.sqrt(l),u=Math.atan2(d,a),f=Math.sin((1-n)*u)/d,h=Math.sin(n*u)/d;return this._w=r*f+this._w*h,this._x=i*f+this._x*h,this._y=s*f+this._y*h,this._z=o*f+this._z*h,this._onChangeCallback(),this}slerpQuaternions(e,n,i){return this.copy(e).slerp(n,i)}random(){const e=2*Math.PI*Math.random(),n=2*Math.PI*Math.random(),i=Math.random(),s=Math.sqrt(1-i),o=Math.sqrt(i);return this.set(s*Math.sin(e),s*Math.cos(e),o*Math.sin(n),o*Math.cos(n))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,n=0){return this._x=e[n],this._y=e[n+1],this._z=e[n+2],this._w=e[n+3],this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._w,e}fromBufferAttribute(e,n){return this._x=e.getX(n),this._y=e.getY(n),this._z=e.getZ(n),this._w=e.getW(n),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class U{constructor(e=0,n=0,i=0){U.prototype.isVector3=!0,this.x=e,this.y=n,this.z=i}set(e,n,i){return i===void 0&&(i=this.z),this.x=e,this.y=n,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,n){return this.x=e.x*n.x,this.y=e.y*n.y,this.z=e.z*n.z,this}applyEuler(e){return this.applyQuaternion(zu.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(zu.setFromAxisAngle(e,n))}applyMatrix3(e){const n=this.x,i=this.y,s=this.z,o=e.elements;return this.x=o[0]*n+o[3]*i+o[6]*s,this.y=o[1]*n+o[4]*i+o[7]*s,this.z=o[2]*n+o[5]*i+o[8]*s,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const n=this.x,i=this.y,s=this.z,o=e.elements,r=1/(o[3]*n+o[7]*i+o[11]*s+o[15]);return this.x=(o[0]*n+o[4]*i+o[8]*s+o[12])*r,this.y=(o[1]*n+o[5]*i+o[9]*s+o[13])*r,this.z=(o[2]*n+o[6]*i+o[10]*s+o[14])*r,this}applyQuaternion(e){const n=this.x,i=this.y,s=this.z,o=e.x,r=e.y,a=e.z,l=e.w,d=2*(r*s-a*i),u=2*(a*n-o*s),f=2*(o*i-r*n);return this.x=n+l*d+r*f-a*u,this.y=i+l*u+a*d-o*f,this.z=s+l*f+o*u-r*d,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const n=this.x,i=this.y,s=this.z,o=e.elements;return this.x=o[0]*n+o[4]*i+o[8]*s,this.y=o[1]*n+o[5]*i+o[9]*s,this.z=o[2]*n+o[6]*i+o[10]*s,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,n){return this.x=ot(this.x,e.x,n.x),this.y=ot(this.y,e.y,n.y),this.z=ot(this.z,e.z,n.z),this}clampScalar(e,n){return this.x=ot(this.x,e,n),this.y=ot(this.y,e,n),this.z=ot(this.z,e,n),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(ot(i,e,n))}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=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this.z=e.z+(n.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,n){const i=e.x,s=e.y,o=e.z,r=n.x,a=n.y,l=n.z;return this.x=s*l-o*a,this.y=o*r-i*l,this.z=i*a-s*r,this}projectOnVector(e){const n=e.lengthSq();if(n===0)return this.set(0,0,0);const i=e.dot(this)/n;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Ja.copy(this).projectOnVector(e),this.sub(Ja)}reflect(e){return this.sub(Ja.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const i=this.dot(e)/n;return Math.acos(ot(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,i=this.y-e.y,s=this.z-e.z;return n*n+i*i+s*s}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,n,i){const s=Math.sin(n)*e;return this.x=s*Math.sin(i),this.y=Math.cos(n)*e,this.z=s*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,n,i){return this.x=e*Math.sin(n),this.y=i,this.z=e*Math.cos(n),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this}setFromMatrixScale(e){const n=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),s=this.setFromMatrixColumn(e,2).length();return this.x=n,this.y=i,this.z=s,this}setFromMatrixColumn(e,n){return this.fromArray(e.elements,n*4)}setFromMatrix3Column(e,n){return this.fromArray(e.elements,n*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,n=Math.random()*2-1,i=Math.sqrt(1-n*n);return this.x=i*Math.cos(e),this.y=n,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Ja=new U,zu=new Xt;class hr{constructor(e=new U(1/0,1/0,1/0),n=new U(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=n}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromArray(e){this.makeEmpty();for(let n=0,i=e.length;n=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,n){return n.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Pn),Pn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let n,i;return e.normal.x>0?(n=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(n=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(n+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(n+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(n+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(n+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),n<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(wo),Mr.subVectors(this.max,wo),As.subVectors(e.a,wo),Ps.subVectors(e.b,wo),Rs.subVectors(e.c,wo),xi.subVectors(Ps,As),Si.subVectors(Rs,Ps),qi.subVectors(As,Rs);let n=[0,-xi.z,xi.y,0,-Si.z,Si.y,0,-qi.z,qi.y,xi.z,0,-xi.x,Si.z,0,-Si.x,qi.z,0,-qi.x,-xi.y,xi.x,0,-Si.y,Si.x,0,-qi.y,qi.x,0];return!Qa(n,As,Ps,Rs,Mr)||(n=[1,0,0,0,1,0,0,0,1],!Qa(n,As,Ps,Rs,Mr))?!1:(Er.crossVectors(xi,Si),n=[Er.x,Er.y,Er.z],Qa(n,As,Ps,Rs,Mr))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Pn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Pn).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(ni[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),ni[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),ni[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),ni[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),ni[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),ni[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),ni[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),ni[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(ni),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const ni=[new U,new U,new U,new U,new U,new U,new U,new U],Pn=new U,Sr=new hr,As=new U,Ps=new U,Rs=new U,xi=new U,Si=new U,qi=new U,wo=new U,Mr=new U,Er=new U,Zi=new U;function Qa(t,e,n,i,s){for(let o=0,r=t.length-3;o<=r;o+=3){Zi.fromArray(t,o);const a=s.x*Math.abs(Zi.x)+s.y*Math.abs(Zi.y)+s.z*Math.abs(Zi.z),l=e.dot(Zi),d=n.dot(Zi),u=i.dot(Zi);if(Math.max(-Math.max(l,d,u),Math.min(l,d,u))>a)return!1}return!0}const LU=new hr,To=new U,el=new U;class Ua{constructor(e=new U,n=-1){this.isSphere=!0,this.center=e,this.radius=n}set(e,n){return this.center.copy(e),this.radius=n,this}setFromPoints(e,n){const i=this.center;n!==void 0?i.copy(n):LU.setFromPoints(e).getCenter(i);let s=0;for(let o=0,r=e.length;othis.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;To.subVectors(e,this.center);const n=To.lengthSq();if(n>this.radius*this.radius){const i=Math.sqrt(n),s=(i-this.radius)*.5;this.center.addScaledVector(To,s/i),this.radius+=s}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(el.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(To.copy(e.center).add(el)),this.expandByPoint(To.copy(e.center).sub(el))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const ii=new U,tl=new U,wr=new U,Mi=new U,nl=new U,Tr=new U,il=new U;class Fa{constructor(e=new U,n=new U(0,0,-1)){this.origin=e,this.direction=n}set(e,n){return this.origin.copy(e),this.direction.copy(n),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,n){return n.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,ii)),this}closestPointToPoint(e,n){n.subVectors(e,this.origin);const i=n.dot(this.direction);return i<0?n.copy(this.origin):n.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const n=ii.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(ii.copy(this.origin).addScaledVector(this.direction,n),ii.distanceToSquared(e))}distanceSqToSegment(e,n,i,s){tl.copy(e).add(n).multiplyScalar(.5),wr.copy(n).sub(e).normalize(),Mi.copy(this.origin).sub(tl);const o=e.distanceTo(n)*.5,r=-this.direction.dot(wr),a=Mi.dot(this.direction),l=-Mi.dot(wr),d=Mi.lengthSq(),u=Math.abs(1-r*r);let f,h,m,b;if(u>0)if(f=r*l-a,h=r*a-l,b=o*u,f>=0)if(h>=-b)if(h<=b){const y=1/u;f*=y,h*=y,m=f*(f+r*h+2*a)+h*(r*f+h+2*l)+d}else h=o,f=Math.max(0,-(r*h+a)),m=-f*f+h*(h+2*l)+d;else h=-o,f=Math.max(0,-(r*h+a)),m=-f*f+h*(h+2*l)+d;else h<=-b?(f=Math.max(0,-(-r*o+a)),h=f>0?-o:Math.min(Math.max(-o,-l),o),m=-f*f+h*(h+2*l)+d):h<=b?(f=0,h=Math.min(Math.max(-o,-l),o),m=h*(h+2*l)+d):(f=Math.max(0,-(r*o+a)),h=f>0?o:Math.min(Math.max(-o,-l),o),m=-f*f+h*(h+2*l)+d);else h=r>0?-o:o,f=Math.max(0,-(r*h+a)),m=-f*f+h*(h+2*l)+d;return i&&i.copy(this.origin).addScaledVector(this.direction,f),s&&s.copy(tl).addScaledVector(wr,h),m}intersectSphere(e,n){ii.subVectors(e.center,this.origin);const i=ii.dot(this.direction),s=ii.dot(ii)-i*i,o=e.radius*e.radius;if(s>o)return null;const r=Math.sqrt(o-s),a=i-r,l=i+r;return l<0?null:a<0?this.at(l,n):this.at(a,n)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const n=e.normal.dot(this.direction);if(n===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/n;return i>=0?i:null}intersectPlane(e,n){const i=this.distanceToPlane(e);return i===null?null:this.at(i,n)}intersectsPlane(e){const n=e.distanceToPoint(this.origin);return n===0||e.normal.dot(this.direction)*n<0}intersectBox(e,n){let i,s,o,r,a,l;const d=1/this.direction.x,u=1/this.direction.y,f=1/this.direction.z,h=this.origin;return d>=0?(i=(e.min.x-h.x)*d,s=(e.max.x-h.x)*d):(i=(e.max.x-h.x)*d,s=(e.min.x-h.x)*d),u>=0?(o=(e.min.y-h.y)*u,r=(e.max.y-h.y)*u):(o=(e.max.y-h.y)*u,r=(e.min.y-h.y)*u),i>r||o>s||((o>i||isNaN(i))&&(i=o),(r=0?(a=(e.min.z-h.z)*f,l=(e.max.z-h.z)*f):(a=(e.max.z-h.z)*f,l=(e.min.z-h.z)*f),i>l||a>s)||((a>i||i!==i)&&(i=a),(l=0?i:s,n)}intersectsBox(e){return this.intersectBox(e,ii)!==null}intersectTriangle(e,n,i,s,o){nl.subVectors(n,e),Tr.subVectors(i,e),il.crossVectors(nl,Tr);let r=this.direction.dot(il),a;if(r>0){if(s)return null;a=1}else if(r<0)a=-1,r=-r;else return null;Mi.subVectors(this.origin,e);const l=a*this.direction.dot(Tr.crossVectors(Mi,Tr));if(l<0)return null;const d=a*this.direction.dot(nl.cross(Mi));if(d<0||l+d>r)return null;const u=-a*Mi.dot(il);return u<0?null:this.at(u/r,o)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Tt{constructor(e,n,i,s,o,r,a,l,d,u,f,h,m,b,y,_){Tt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,n,i,s,o,r,a,l,d,u,f,h,m,b,y,_)}set(e,n,i,s,o,r,a,l,d,u,f,h,m,b,y,_){const p=this.elements;return p[0]=e,p[4]=n,p[8]=i,p[12]=s,p[1]=o,p[5]=r,p[9]=a,p[13]=l,p[2]=d,p[6]=u,p[10]=f,p[14]=h,p[3]=m,p[7]=b,p[11]=y,p[15]=_,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Tt().fromArray(this.elements)}copy(e){const n=this.elements,i=e.elements;return n[0]=i[0],n[1]=i[1],n[2]=i[2],n[3]=i[3],n[4]=i[4],n[5]=i[5],n[6]=i[6],n[7]=i[7],n[8]=i[8],n[9]=i[9],n[10]=i[10],n[11]=i[11],n[12]=i[12],n[13]=i[13],n[14]=i[14],n[15]=i[15],this}copyPosition(e){const n=this.elements,i=e.elements;return n[12]=i[12],n[13]=i[13],n[14]=i[14],this}setFromMatrix3(e){const n=e.elements;return this.set(n[0],n[3],n[6],0,n[1],n[4],n[7],0,n[2],n[5],n[8],0,0,0,0,1),this}extractBasis(e,n,i){return e.setFromMatrixColumn(this,0),n.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,n,i){return this.set(e.x,n.x,i.x,0,e.y,n.y,i.y,0,e.z,n.z,i.z,0,0,0,0,1),this}extractRotation(e){const n=this.elements,i=e.elements,s=1/Ds.setFromMatrixColumn(e,0).length(),o=1/Ds.setFromMatrixColumn(e,1).length(),r=1/Ds.setFromMatrixColumn(e,2).length();return n[0]=i[0]*s,n[1]=i[1]*s,n[2]=i[2]*s,n[3]=0,n[4]=i[4]*o,n[5]=i[5]*o,n[6]=i[6]*o,n[7]=0,n[8]=i[8]*r,n[9]=i[9]*r,n[10]=i[10]*r,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromEuler(e){const n=this.elements,i=e.x,s=e.y,o=e.z,r=Math.cos(i),a=Math.sin(i),l=Math.cos(s),d=Math.sin(s),u=Math.cos(o),f=Math.sin(o);if(e.order==="XYZ"){const h=r*u,m=r*f,b=a*u,y=a*f;n[0]=l*u,n[4]=-l*f,n[8]=d,n[1]=m+b*d,n[5]=h-y*d,n[9]=-a*l,n[2]=y-h*d,n[6]=b+m*d,n[10]=r*l}else if(e.order==="YXZ"){const h=l*u,m=l*f,b=d*u,y=d*f;n[0]=h+y*a,n[4]=b*a-m,n[8]=r*d,n[1]=r*f,n[5]=r*u,n[9]=-a,n[2]=m*a-b,n[6]=y+h*a,n[10]=r*l}else if(e.order==="ZXY"){const h=l*u,m=l*f,b=d*u,y=d*f;n[0]=h-y*a,n[4]=-r*f,n[8]=b+m*a,n[1]=m+b*a,n[5]=r*u,n[9]=y-h*a,n[2]=-r*d,n[6]=a,n[10]=r*l}else if(e.order==="ZYX"){const h=r*u,m=r*f,b=a*u,y=a*f;n[0]=l*u,n[4]=b*d-m,n[8]=h*d+y,n[1]=l*f,n[5]=y*d+h,n[9]=m*d-b,n[2]=-d,n[6]=a*l,n[10]=r*l}else if(e.order==="YZX"){const h=r*l,m=r*d,b=a*l,y=a*d;n[0]=l*u,n[4]=y-h*f,n[8]=b*f+m,n[1]=f,n[5]=r*u,n[9]=-a*u,n[2]=-d*u,n[6]=m*f+b,n[10]=h-y*f}else if(e.order==="XZY"){const h=r*l,m=r*d,b=a*l,y=a*d;n[0]=l*u,n[4]=-f,n[8]=d*u,n[1]=h*f+y,n[5]=r*u,n[9]=m*f-b,n[2]=b*f-m,n[6]=a*u,n[10]=y*f+h}return n[3]=0,n[7]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromQuaternion(e){return this.compose(UU,e,FU)}lookAt(e,n,i){const s=this.elements;return pn.subVectors(e,n),pn.lengthSq()===0&&(pn.z=1),pn.normalize(),Ei.crossVectors(i,pn),Ei.lengthSq()===0&&(Math.abs(i.z)===1?pn.x+=1e-4:pn.z+=1e-4,pn.normalize(),Ei.crossVectors(i,pn)),Ei.normalize(),Cr.crossVectors(pn,Ei),s[0]=Ei.x,s[4]=Cr.x,s[8]=pn.x,s[1]=Ei.y,s[5]=Cr.y,s[9]=pn.y,s[2]=Ei.z,s[6]=Cr.z,s[10]=pn.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const i=e.elements,s=n.elements,o=this.elements,r=i[0],a=i[4],l=i[8],d=i[12],u=i[1],f=i[5],h=i[9],m=i[13],b=i[2],y=i[6],_=i[10],p=i[14],T=i[3],w=i[7],S=i[11],I=i[15],P=s[0],D=s[4],R=s[8],E=s[12],g=s[1],L=s[5],O=s[9],H=s[13],j=s[2],re=s[6],q=s[10],ae=s[14],G=s[3],fe=s[7],ye=s[11],Re=s[15];return o[0]=r*P+a*g+l*j+d*G,o[4]=r*D+a*L+l*re+d*fe,o[8]=r*R+a*O+l*q+d*ye,o[12]=r*E+a*H+l*ae+d*Re,o[1]=u*P+f*g+h*j+m*G,o[5]=u*D+f*L+h*re+m*fe,o[9]=u*R+f*O+h*q+m*ye,o[13]=u*E+f*H+h*ae+m*Re,o[2]=b*P+y*g+_*j+p*G,o[6]=b*D+y*L+_*re+p*fe,o[10]=b*R+y*O+_*q+p*ye,o[14]=b*E+y*H+_*ae+p*Re,o[3]=T*P+w*g+S*j+I*G,o[7]=T*D+w*L+S*re+I*fe,o[11]=T*R+w*O+S*q+I*ye,o[15]=T*E+w*H+S*ae+I*Re,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[4]*=e,n[8]*=e,n[12]*=e,n[1]*=e,n[5]*=e,n[9]*=e,n[13]*=e,n[2]*=e,n[6]*=e,n[10]*=e,n[14]*=e,n[3]*=e,n[7]*=e,n[11]*=e,n[15]*=e,this}determinant(){const e=this.elements,n=e[0],i=e[4],s=e[8],o=e[12],r=e[1],a=e[5],l=e[9],d=e[13],u=e[2],f=e[6],h=e[10],m=e[14],b=e[3],y=e[7],_=e[11],p=e[15];return b*(+o*l*f-s*d*f-o*a*h+i*d*h+s*a*m-i*l*m)+y*(+n*l*m-n*d*h+o*r*h-s*r*m+s*d*u-o*l*u)+_*(+n*d*f-n*a*m-o*r*f+i*r*m+o*a*u-i*d*u)+p*(-s*a*u-n*l*f+n*a*h+s*r*f-i*r*h+i*l*u)}transpose(){const e=this.elements;let n;return n=e[1],e[1]=e[4],e[4]=n,n=e[2],e[2]=e[8],e[8]=n,n=e[6],e[6]=e[9],e[9]=n,n=e[3],e[3]=e[12],e[12]=n,n=e[7],e[7]=e[13],e[13]=n,n=e[11],e[11]=e[14],e[14]=n,this}setPosition(e,n,i){const s=this.elements;return e.isVector3?(s[12]=e.x,s[13]=e.y,s[14]=e.z):(s[12]=e,s[13]=n,s[14]=i),this}invert(){const e=this.elements,n=e[0],i=e[1],s=e[2],o=e[3],r=e[4],a=e[5],l=e[6],d=e[7],u=e[8],f=e[9],h=e[10],m=e[11],b=e[12],y=e[13],_=e[14],p=e[15],T=f*_*d-y*h*d+y*l*m-a*_*m-f*l*p+a*h*p,w=b*h*d-u*_*d-b*l*m+r*_*m+u*l*p-r*h*p,S=u*y*d-b*f*d+b*a*m-r*y*m-u*a*p+r*f*p,I=b*f*l-u*y*l-b*a*h+r*y*h+u*a*_-r*f*_,P=n*T+i*w+s*S+o*I;if(P===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const D=1/P;return e[0]=T*D,e[1]=(y*h*o-f*_*o-y*s*m+i*_*m+f*s*p-i*h*p)*D,e[2]=(a*_*o-y*l*o+y*s*d-i*_*d-a*s*p+i*l*p)*D,e[3]=(f*l*o-a*h*o-f*s*d+i*h*d+a*s*m-i*l*m)*D,e[4]=w*D,e[5]=(u*_*o-b*h*o+b*s*m-n*_*m-u*s*p+n*h*p)*D,e[6]=(b*l*o-r*_*o-b*s*d+n*_*d+r*s*p-n*l*p)*D,e[7]=(r*h*o-u*l*o+u*s*d-n*h*d-r*s*m+n*l*m)*D,e[8]=S*D,e[9]=(b*f*o-u*y*o-b*i*m+n*y*m+u*i*p-n*f*p)*D,e[10]=(r*y*o-b*a*o+b*i*d-n*y*d-r*i*p+n*a*p)*D,e[11]=(u*a*o-r*f*o-u*i*d+n*f*d+r*i*m-n*a*m)*D,e[12]=I*D,e[13]=(u*y*s-b*f*s+b*i*h-n*y*h-u*i*_+n*f*_)*D,e[14]=(b*a*s-r*y*s-b*i*l+n*y*l+r*i*_-n*a*_)*D,e[15]=(r*f*s-u*a*s+u*i*l-n*f*l-r*i*h+n*a*h)*D,this}scale(e){const n=this.elements,i=e.x,s=e.y,o=e.z;return n[0]*=i,n[4]*=s,n[8]*=o,n[1]*=i,n[5]*=s,n[9]*=o,n[2]*=i,n[6]*=s,n[10]*=o,n[3]*=i,n[7]*=s,n[11]*=o,this}getMaxScaleOnAxis(){const e=this.elements,n=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],s=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(n,i,s))}makeTranslation(e,n,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,n,0,0,1,i,0,0,0,1),this}makeRotationX(e){const n=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,n,-i,0,0,i,n,0,0,0,0,1),this}makeRotationY(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,0,i,0,0,1,0,0,-i,0,n,0,0,0,0,1),this}makeRotationZ(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,-i,0,0,i,n,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,n){const i=Math.cos(n),s=Math.sin(n),o=1-i,r=e.x,a=e.y,l=e.z,d=o*r,u=o*a;return this.set(d*r+i,d*a-s*l,d*l+s*a,0,d*a+s*l,u*a+i,u*l-s*r,0,d*l-s*a,u*l+s*r,o*l*l+i,0,0,0,0,1),this}makeScale(e,n,i){return this.set(e,0,0,0,0,n,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,n,i,s,o,r){return this.set(1,i,o,0,e,1,r,0,n,s,1,0,0,0,0,1),this}compose(e,n,i){const s=this.elements,o=n._x,r=n._y,a=n._z,l=n._w,d=o+o,u=r+r,f=a+a,h=o*d,m=o*u,b=o*f,y=r*u,_=r*f,p=a*f,T=l*d,w=l*u,S=l*f,I=i.x,P=i.y,D=i.z;return s[0]=(1-(y+p))*I,s[1]=(m+S)*I,s[2]=(b-w)*I,s[3]=0,s[4]=(m-S)*P,s[5]=(1-(h+p))*P,s[6]=(_+T)*P,s[7]=0,s[8]=(b+w)*D,s[9]=(_-T)*D,s[10]=(1-(h+y))*D,s[11]=0,s[12]=e.x,s[13]=e.y,s[14]=e.z,s[15]=1,this}decompose(e,n,i){const s=this.elements;let o=Ds.set(s[0],s[1],s[2]).length();const r=Ds.set(s[4],s[5],s[6]).length(),a=Ds.set(s[8],s[9],s[10]).length();this.determinant()<0&&(o=-o),e.x=s[12],e.y=s[13],e.z=s[14],Rn.copy(this);const d=1/o,u=1/r,f=1/a;return Rn.elements[0]*=d,Rn.elements[1]*=d,Rn.elements[2]*=d,Rn.elements[4]*=u,Rn.elements[5]*=u,Rn.elements[6]*=u,Rn.elements[8]*=f,Rn.elements[9]*=f,Rn.elements[10]*=f,n.setFromRotationMatrix(Rn),i.x=o,i.y=r,i.z=a,this}makePerspective(e,n,i,s,o,r,a=hi){const l=this.elements,d=2*o/(n-e),u=2*o/(i-s),f=(n+e)/(n-e),h=(i+s)/(i-s);let m,b;if(a===hi)m=-(r+o)/(r-o),b=-2*r*o/(r-o);else if(a===pa)m=-r/(r-o),b=-r*o/(r-o);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=d,l[4]=0,l[8]=f,l[12]=0,l[1]=0,l[5]=u,l[9]=h,l[13]=0,l[2]=0,l[6]=0,l[10]=m,l[14]=b,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,n,i,s,o,r,a=hi){const l=this.elements,d=1/(n-e),u=1/(i-s),f=1/(r-o),h=(n+e)*d,m=(i+s)*u;let b,y;if(a===hi)b=(r+o)*f,y=-2*f;else if(a===pa)b=o*f,y=-1*f;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*d,l[4]=0,l[8]=0,l[12]=-h,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-m,l[2]=0,l[6]=0,l[10]=y,l[14]=-b,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const n=this.elements,i=e.elements;for(let s=0;s<16;s++)if(n[s]!==i[s])return!1;return!0}fromArray(e,n=0){for(let i=0;i<16;i++)this.elements[i]=e[i+n];return this}toArray(e=[],n=0){const i=this.elements;return e[n]=i[0],e[n+1]=i[1],e[n+2]=i[2],e[n+3]=i[3],e[n+4]=i[4],e[n+5]=i[5],e[n+6]=i[6],e[n+7]=i[7],e[n+8]=i[8],e[n+9]=i[9],e[n+10]=i[10],e[n+11]=i[11],e[n+12]=i[12],e[n+13]=i[13],e[n+14]=i[14],e[n+15]=i[15],e}}const Ds=new U,Rn=new Tt,UU=new U(0,0,0),FU=new U(1,1,1),Ei=new U,Cr=new U,pn=new U,ku=new Tt,Bu=new Xt;class Vn{constructor(e=0,n=0,i=0,s=Vn.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=n,this._z=i,this._order=s}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,n,i,s=this._order){return this._x=e,this._y=n,this._z=i,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,n=this._order,i=!0){const s=e.elements,o=s[0],r=s[4],a=s[8],l=s[1],d=s[5],u=s[9],f=s[2],h=s[6],m=s[10];switch(n){case"XYZ":this._y=Math.asin(ot(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,m),this._z=Math.atan2(-r,o)):(this._x=Math.atan2(h,d),this._z=0);break;case"YXZ":this._x=Math.asin(-ot(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,m),this._z=Math.atan2(l,d)):(this._y=Math.atan2(-f,o),this._z=0);break;case"ZXY":this._x=Math.asin(ot(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-f,m),this._z=Math.atan2(-r,d)):(this._y=0,this._z=Math.atan2(l,o));break;case"ZYX":this._y=Math.asin(-ot(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(h,m),this._z=Math.atan2(l,o)):(this._x=0,this._z=Math.atan2(-r,d));break;case"YZX":this._z=Math.asin(ot(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,d),this._y=Math.atan2(-f,o)):(this._x=0,this._y=Math.atan2(a,m));break;case"XZY":this._z=Math.asin(-ot(r,-1,1)),Math.abs(r)<.9999999?(this._x=Math.atan2(h,d),this._y=Math.atan2(a,o)):(this._x=Math.atan2(-u,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,i){return ku.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ku,n,i)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return Bu.setFromEuler(this),this.setFromQuaternion(Bu,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Vn.DEFAULT_ORDER="XYZ";class hd{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let n=0;n1){for(let i=0;i0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(s.matrixAutoUpdate=!1),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.geometryInfo=this._geometryInfo.map(a=>({...a,boundingBox:a.boundingBox?{min:a.boundingBox.min.toArray(),max:a.boundingBox.max.toArray()}:void 0,boundingSphere:a.boundingSphere?{radius:a.boundingSphere.radius,center:a.boundingSphere.center.toArray()}:void 0})),s.instanceInfo=this._instanceInfo.map(a=>({...a})),s.availableInstanceIds=this._availableInstanceIds.slice(),s.availableGeometryIds=this._availableGeometryIds.slice(),s.nextIndexStart=this._nextIndexStart,s.nextVertexStart=this._nextVertexStart,s.geometryCount=this._geometryCount,s.maxInstanceCount=this._maxInstanceCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.matricesTexture=this._matricesTexture.toJSON(e),s.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(s.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(s.boundingSphere={center:this.boundingSphere.center.toArray(),radius:this.boundingSphere.radius}),this.boundingBox!==null&&(s.boundingBox={min:this.boundingBox.min.toArray(),max:this.boundingBox.max.toArray()}));function o(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=o(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let d=0,u=l.length;d0){s.children=[];for(let a=0;a0){s.animations=[];for(let a=0;a0&&(i.geometries=a),l.length>0&&(i.materials=l),d.length>0&&(i.textures=d),u.length>0&&(i.images=u),f.length>0&&(i.shapes=f),h.length>0&&(i.skeletons=h),m.length>0&&(i.animations=m),b.length>0&&(i.nodes=b)}return i.object=s,i;function r(a){const l=[];for(const d in a){const u=a[d];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,n=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),n===!0)for(let i=0;i0?s.multiplyScalar(1/Math.sqrt(o)):s.set(0,0,0)}static getBarycoord(e,n,i,s,o){Dn.subVectors(s,n),oi.subVectors(i,n),ol.subVectors(e,n);const r=Dn.dot(Dn),a=Dn.dot(oi),l=Dn.dot(ol),d=oi.dot(oi),u=oi.dot(ol),f=r*d-a*a;if(f===0)return o.set(0,0,0),null;const h=1/f,m=(d*l-a*u)*h,b=(r*u-a*l)*h;return o.set(1-m-b,b,m)}static containsPoint(e,n,i,s){return this.getBarycoord(e,n,i,s,ri)===null?!1:ri.x>=0&&ri.y>=0&&ri.x+ri.y<=1}static getInterpolation(e,n,i,s,o,r,a,l){return this.getBarycoord(e,n,i,s,ri)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(o,ri.x),l.addScaledVector(r,ri.y),l.addScaledVector(a,ri.z),l)}static getInterpolatedAttribute(e,n,i,s,o,r){return cl.setScalar(0),dl.setScalar(0),ul.setScalar(0),cl.fromBufferAttribute(e,n),dl.fromBufferAttribute(e,i),ul.fromBufferAttribute(e,s),r.setScalar(0),r.addScaledVector(cl,o.x),r.addScaledVector(dl,o.y),r.addScaledVector(ul,o.z),r}static isFrontFacing(e,n,i,s){return Dn.subVectors(i,n),oi.subVectors(e,n),Dn.cross(oi).dot(s)<0}set(e,n,i){return this.a.copy(e),this.b.copy(n),this.c.copy(i),this}setFromPointsAndIndices(e,n,i,s){return this.a.copy(e[n]),this.b.copy(e[i]),this.c.copy(e[s]),this}setFromAttributeAndIndices(e,n,i,s){return this.a.fromBufferAttribute(e,n),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,s),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Dn.subVectors(this.c,this.b),oi.subVectors(this.a,this.b),Dn.cross(oi).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return On.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return On.getBarycoord(e,this.a,this.b,this.c,n)}getInterpolation(e,n,i,s,o){return On.getInterpolation(e,this.a,this.b,this.c,n,i,s,o)}containsPoint(e){return On.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return On.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,n){const i=this.a,s=this.b,o=this.c;let r,a;Us.subVectors(s,i),Fs.subVectors(o,i),rl.subVectors(e,i);const l=Us.dot(rl),d=Fs.dot(rl);if(l<=0&&d<=0)return n.copy(i);al.subVectors(e,s);const u=Us.dot(al),f=Fs.dot(al);if(u>=0&&f<=u)return n.copy(s);const h=l*f-u*d;if(h<=0&&l>=0&&u<=0)return r=l/(l-u),n.copy(i).addScaledVector(Us,r);ll.subVectors(e,o);const m=Us.dot(ll),b=Fs.dot(ll);if(b>=0&&m<=b)return n.copy(o);const y=m*d-l*b;if(y<=0&&d>=0&&b<=0)return a=d/(d-b),n.copy(i).addScaledVector(Fs,a);const _=u*b-m*f;if(_<=0&&f-u>=0&&m-b>=0)return Xu.subVectors(o,s),a=(f-u)/(f-u+(m-b)),n.copy(s).addScaledVector(Xu,a);const p=1/(_+y+h);return r=y*p,a=h*p,n.copy(i).addScaledVector(Us,r).addScaledVector(Fs,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Tp={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},wi={h:0,s:0,l:0},Pr={h:0,s:0,l:0};function hl(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*6*(2/3-n):t}class at{constructor(e,n,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,i)}set(e,n,i){if(n===void 0&&i===void 0){const s=e;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(e,n,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=En){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ft.toWorkingColorSpace(this,n),this}setRGB(e,n,i,s=ft.workingColorSpace){return this.r=e,this.g=n,this.b=i,ft.toWorkingColorSpace(this,s),this}setHSL(e,n,i,s=ft.workingColorSpace){if(e=dd(e,1),n=ot(n,0,1),i=ot(i,0,1),n===0)this.r=this.g=this.b=i;else{const o=i<=.5?i*(1+n):i+n-i*n,r=2*i-o;this.r=hl(r,o,e+1/3),this.g=hl(r,o,e),this.b=hl(r,o,e-1/3)}return ft.toWorkingColorSpace(this,s),this}setStyle(e,n=En){function i(o){o!==void 0&&parseFloat(o)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(e)){let o;const r=s[1],a=s[2];switch(r){case"rgb":case"rgba":if(o=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(o[4]),this.setRGB(Math.min(255,parseInt(o[1],10))/255,Math.min(255,parseInt(o[2],10))/255,Math.min(255,parseInt(o[3],10))/255,n);if(o=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(o[4]),this.setRGB(Math.min(100,parseInt(o[1],10))/100,Math.min(100,parseInt(o[2],10))/100,Math.min(100,parseInt(o[3],10))/100,n);break;case"hsl":case"hsla":if(o=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(o[4]),this.setHSL(parseFloat(o[1])/360,parseFloat(o[2])/100,parseFloat(o[3])/100,n);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(e)){const o=s[1],r=o.length;if(r===3)return this.setRGB(parseInt(o.charAt(0),16)/15,parseInt(o.charAt(1),16)/15,parseInt(o.charAt(2),16)/15,n);if(r===6)return this.setHex(parseInt(o,16),n);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=En){const i=Tp[e.toLowerCase()];return i!==void 0?this.setHex(i,n):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=fi(e.r),this.g=fi(e.g),this.b=fi(e.b),this}copyLinearToSRGB(e){return this.r=Js(e.r),this.g=Js(e.g),this.b=Js(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=En){return ft.fromWorkingColorSpace(Zt.copy(this),e),Math.round(ot(Zt.r*255,0,255))*65536+Math.round(ot(Zt.g*255,0,255))*256+Math.round(ot(Zt.b*255,0,255))}getHexString(e=En){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=ft.workingColorSpace){ft.fromWorkingColorSpace(Zt.copy(this),n);const i=Zt.r,s=Zt.g,o=Zt.b,r=Math.max(i,s,o),a=Math.min(i,s,o);let l,d;const u=(a+r)/2;if(a===r)l=0,d=0;else{const f=r-a;switch(d=u<=.5?f/(r+a):f/(2-r-a),r){case i:l=(s-o)/f+(s0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const n in e){const i=e[n];if(i===void 0){console.warn(`THREE.Material: parameter '${n}' has value of undefined.`);continue}const s=this[n];if(s===void 0){console.warn(`THREE.Material: '${n}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(i):s&&s.isVector3&&i&&i.isVector3?s.copy(i):this[n]=i}}toJSON(e){const n=e===void 0||typeof e=="string";n&&(e={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==Ks&&(i.blending=this.blending),this.side!==Vi&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==jl&&(i.blendSrc=this.blendSrc),this.blendDst!==Yl&&(i.blendDst=this.blendDst),this.blendEquation!==ls&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==so&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Du&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Ts&&(i.stencilFail=this.stencilFail),this.stencilZFail!==Ts&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==Ts&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function s(o){const r=[];for(const a in o){const l=o[a];delete l.metadata,r.push(l)}return r}if(n){const o=s(e.textures),r=s(e.images);o.length>0&&(i.textures=o),r.length>0&&(i.images=r)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const n=e.clippingPlanes;let i=null;if(n!==null){const s=n.length;i=new Array(s);for(let o=0;o!==s;++o)i[o]=n[o].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Oa extends Ms{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new at(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Vn,this.combine=id,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Ft=new U,Rr=new Ke;let VU=0;class Jn{constructor(e,n,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:VU++}),this.name="",this.array=e,this.itemSize=n,this.count=e!==void 0?e.length/n:0,this.normalized=i,this.usage=Iu,this.updateRanges=[],this.gpuType=ui,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,n,i){e*=this.itemSize,i*=n.itemSize;for(let s=0,o=this.itemSize;sn.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),n.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new hr);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new U(-1/0,-1/0,-1/0),new U(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),n)for(let i=0,s=n.length;i0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const d in l)l[d]!==void 0&&(e[d]=l[d]);return e}e.data={attributes:{}};const n=this.index;n!==null&&(e.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});const i=this.attributes;for(const l in i){const d=i[l];e.data.attributes[l]=d.toJSON(e.data)}const s={};let o=!1;for(const l in this.morphAttributes){const d=this.morphAttributes[l],u=[];for(let f=0,h=d.length;f0&&(s[l]=u,o=!0)}o&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);const r=this.groups;r.length>0&&(e.data.groups=JSON.parse(JSON.stringify(r)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const n={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone());const s=e.attributes;for(const d in s){const u=s[d];this.setAttribute(d,u.clone(n))}const o=e.morphAttributes;for(const d in o){const u=[],f=o[d];for(let h=0,m=f.length;h0){const s=n[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,r=s.length;o(e.far-e.near)**2))&&(ju.copy(o).invert(),Ki.copy(e.ray).applyMatrix4(ju),!(i.boundingBox!==null&&Ki.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,n,Ki)))}_computeIntersections(e,n,i){let s;const o=this.geometry,r=this.material,a=o.index,l=o.attributes.position,d=o.attributes.uv,u=o.attributes.uv1,f=o.attributes.normal,h=o.groups,m=o.drawRange;if(a!==null)if(Array.isArray(r))for(let b=0,y=h.length;bn.far?null:{distance:d,point:Or.clone(),object:t}}function Nr(t,e,n,i,s,o,r,a,l,d){t.getVertexPosition(a,Ir),t.getVertexPosition(l,Lr),t.getVertexPosition(d,Ur);const u=$U(t,e,n,i,Ir,Lr,Ur,qu);if(u){const f=new U;On.getBarycoord(qu,Ir,Lr,Ur,f),s&&(u.uv=On.getInterpolatedAttribute(s,a,l,d,f,new Ke)),o&&(u.uv1=On.getInterpolatedAttribute(o,a,l,d,f,new Ke)),r&&(u.normal=On.getInterpolatedAttribute(r,a,l,d,f,new U),u.normal.dot(i.direction)>0&&u.normal.multiplyScalar(-1));const h={a,b:l,c:d,normal:new U,materialIndex:0};On.getNormal(Ir,Lr,Ur,h.normal),u.face=h,u.barycoord=f}return u}class Ot extends tn{constructor(e=1,n=1,i=1,s=1,o=1,r=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:i,widthSegments:s,heightSegments:o,depthSegments:r};const a=this;s=Math.floor(s),o=Math.floor(o),r=Math.floor(r);const l=[],d=[],u=[],f=[];let h=0,m=0;b("z","y","x",-1,-1,i,n,e,r,o,0),b("z","y","x",1,-1,i,n,-e,r,o,1),b("x","z","y",1,1,e,i,n,s,r,2),b("x","z","y",1,-1,e,i,-n,s,r,3),b("x","y","z",1,-1,e,n,i,s,o,4),b("x","y","z",-1,-1,e,n,-i,s,o,5),this.setIndex(l),this.setAttribute("position",new Et(d,3)),this.setAttribute("normal",new Et(u,3)),this.setAttribute("uv",new Et(f,2));function b(y,_,p,T,w,S,I,P,D,R,E){const g=S/D,L=I/R,O=S/2,H=I/2,j=P/2,re=D+1,q=R+1;let ae=0,G=0;const fe=new U;for(let ye=0;ye0?1:-1,u.push(fe.x,fe.y,fe.z),f.push(Be/D),f.push(1-ye/R),ae+=1}}for(let ye=0;ye0&&(n.defines=this.defines),n.vertexShader=this.vertexShader,n.fragmentShader=this.fragmentShader,n.lights=this.lights,n.clipping=this.clipping;const i={};for(const s in this.extensions)this.extensions[s]===!0&&(i[s]=!0);return Object.keys(i).length>0&&(n.extensions=i),n}}class Rp extends Nt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Tt,this.projectionMatrix=new Tt,this.projectionMatrixInverse=new Tt,this.coordinateSystem=hi}copy(e,n){return super.copy(e,n),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,n){super.updateWorldMatrix(e,n),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const Ti=new U,Zu=new Ke,Ku=new Ke;class _n extends Rp{constructor(e=50,n=1,i=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=s,this.focus=10,this.aspect=n,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const n=.5*this.getFilmHeight()/e;this.fov=lo*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Xo*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return lo*2*Math.atan(Math.tan(Xo*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,n,i){Ti.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Ti.x,Ti.y).multiplyScalar(-e/Ti.z),Ti.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(Ti.x,Ti.y).multiplyScalar(-e/Ti.z)}getViewSize(e,n){return this.getViewBounds(e,Zu,Ku),n.subVectors(Ku,Zu)}setViewOffset(e,n,i,s,o,r){this.aspect=e/n,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=i,this.view.offsetY=s,this.view.width=o,this.view.height=r,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let n=e*Math.tan(Xo*.5*this.fov)/this.zoom,i=2*n,s=this.aspect*i,o=-.5*s;const r=this.view;if(this.view!==null&&this.view.enabled){const l=r.fullWidth,d=r.fullHeight;o+=r.offsetX*s/l,n-=r.offsetY*i/d,s*=r.width/l,i*=r.height/d}const a=this.filmOffset;a!==0&&(o+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(o,o+s,n,n-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.fov=this.fov,n.object.zoom=this.zoom,n.object.near=this.near,n.object.far=this.far,n.object.focus=this.focus,n.object.aspect=this.aspect,this.view!==null&&(n.object.view=Object.assign({},this.view)),n.object.filmGauge=this.filmGauge,n.object.filmOffset=this.filmOffset,n}}const Ns=-90,zs=1;class YU extends Nt{constructor(e,n,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const s=new _n(Ns,zs,e,n);s.layers=this.layers,this.add(s);const o=new _n(Ns,zs,e,n);o.layers=this.layers,this.add(o);const r=new _n(Ns,zs,e,n);r.layers=this.layers,this.add(r);const a=new _n(Ns,zs,e,n);a.layers=this.layers,this.add(a);const l=new _n(Ns,zs,e,n);l.layers=this.layers,this.add(l);const d=new _n(Ns,zs,e,n);d.layers=this.layers,this.add(d)}updateCoordinateSystem(){const e=this.coordinateSystem,n=this.children.concat(),[i,s,o,r,a,l]=n;for(const d of n)this.remove(d);if(e===hi)i.up.set(0,1,0),i.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),o.up.set(0,0,-1),o.lookAt(0,1,0),r.up.set(0,0,1),r.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===pa)i.up.set(0,-1,0),i.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),o.up.set(0,0,1),o.lookAt(0,1,0),r.up.set(0,0,-1),r.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const d of n)this.add(d),d.updateMatrixWorld()}update(e,n){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:s}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[o,r,a,l,d,u]=this.children,f=e.getRenderTarget(),h=e.getActiveCubeFace(),m=e.getActiveMipmapLevel(),b=e.xr.enabled;e.xr.enabled=!1;const y=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,s),e.render(n,o),e.setRenderTarget(i,1,s),e.render(n,r),e.setRenderTarget(i,2,s),e.render(n,a),e.setRenderTarget(i,3,s),e.render(n,l),e.setRenderTarget(i,4,s),e.render(n,d),i.texture.generateMipmaps=y,e.setRenderTarget(i,5,s),e.render(n,u),e.setRenderTarget(f,h,m),e.xr.enabled=b,i.texture.needsPMREMUpdate=!0}}class Dp extends hn{constructor(e=[],n=oo,i,s,o,r,a,l,d,u){super(e,n,i,s,o,r,a,l,d,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class qU extends vs{constructor(e=1,n={}){super(e,e,n),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},s=[i,i,i,i,i,i];this.texture=new Dp(s,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:qn}fromEquirectangularTexture(e,n){this.texture.type=n.type,this.texture.colorSpace=n.colorSpace,this.texture.generateMipmaps=n.generateMipmaps,this.texture.minFilter=n.minFilter,this.texture.magFilter=n.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:` varying vec3 vWorldDirection; vec3 transformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); } void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include } `,fragmentShader:` uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { vec3 direction = normalize( vWorldDirection ); vec2 sampleUV = equirectUv( direction ); gl_FragColor = texture2D( tEquirect, sampleUV ); } `},s=new Ot(5,5,5),o=new Hi({name:"CubemapFromEquirect",uniforms:co(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:un,blending:Ni});o.uniforms.tEquirect.value=n;const r=new Ae(s,o),a=n.minFilter;return n.minFilter===fs&&(n.minFilter=qn),new YU(1,10,this).update(e,r),n.minFilter=a,r.geometry.dispose(),r.material.dispose(),this}clear(e,n=!0,i=!0,s=!0){const o=e.getRenderTarget();for(let r=0;r<6;r++)e.setRenderTarget(this,r),e.clear(n,i,s);e.setRenderTarget(o)}}class Uo extends Nt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const ZU={type:"move"};class ml{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Uo,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Uo,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new U,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new U),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Uo,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new U,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new U),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const n=this._hand;if(n)for(const i of e.hand.values())this._getHandJoint(n,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,n,i){let s=null,o=null,r=null;const a=this._targetRay,l=this._grip,d=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(d&&e.hand){r=!0;for(const y of e.hand.values()){const _=n.getJointPose(y,i),p=this._getHandJoint(d,y);_!==null&&(p.matrix.fromArray(_.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=_.radius),p.visible=_!==null}const u=d.joints["index-finger-tip"],f=d.joints["thumb-tip"],h=u.position.distanceTo(f.position),m=.02,b=.005;d.inputState.pinching&&h>m+b?(d.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!d.inputState.pinching&&h<=m-b&&(d.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(o=n.getPose(e.gripSpace,i),o!==null&&(l.matrix.fromArray(o.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,o.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(o.linearVelocity)):l.hasLinearVelocity=!1,o.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(o.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(s=n.getPose(e.targetRaySpace,i),s===null&&o!==null&&(s=o),s!==null&&(a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,s.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(s.linearVelocity)):a.hasLinearVelocity=!1,s.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(s.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(ZU)))}return a!==null&&(a.visible=s!==null),l!==null&&(l.visible=o!==null),d!==null&&(d.visible=r!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const i=new Uo;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[n.jointName]=i,e.add(i)}return e.joints[n.jointName]}}class KU extends Nt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Vn,this.environmentIntensity=1,this.environmentRotation=new Vn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,n){return super.copy(e,n),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const n=super.toJSON(e);return this.fog!==null&&(n.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(n.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(n.object.backgroundIntensity=this.backgroundIntensity),n.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(n.object.environmentIntensity=this.environmentIntensity),n.object.environmentRotation=this.environmentRotation.toArray(),n}}const _l=new U,JU=new U,QU=new tt;class Di{constructor(e=new U(1,0,0),n=0){this.isPlane=!0,this.normal=e,this.constant=n}set(e,n){return this.normal.copy(e),this.constant=n,this}setComponents(e,n,i,s){return this.normal.set(e,n,i),this.constant=s,this}setFromNormalAndCoplanarPoint(e,n){return this.normal.copy(e),this.constant=-n.dot(this.normal),this}setFromCoplanarPoints(e,n,i){const s=_l.subVectors(i,n).cross(JU.subVectors(e,n)).normalize();return this.setFromNormalAndCoplanarPoint(s,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,n){return n.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,n){const i=e.delta(_l),s=this.normal.dot(i);if(s===0)return this.distanceToPoint(e.start)===0?n.copy(e.start):null;const o=-(e.start.dot(this.normal)+this.constant)/s;return o<0||o>1?null:n.copy(e.start).addScaledVector(i,o)}intersectsLine(e){const n=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return n<0&&i>0||i<0&&n>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,n){const i=n||QU.getNormalMatrix(e),s=this.coplanarPoint(_l).applyMatrix4(e),o=this.normal.applyMatrix3(i).normalize();return this.constant=-s.dot(o),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Ji=new Ua,zr=new U;class fd{constructor(e=new Di,n=new Di,i=new Di,s=new Di,o=new Di,r=new Di){this.planes=[e,n,i,s,o,r]}set(e,n,i,s,o,r){const a=this.planes;return a[0].copy(e),a[1].copy(n),a[2].copy(i),a[3].copy(s),a[4].copy(o),a[5].copy(r),this}copy(e){const n=this.planes;for(let i=0;i<6;i++)n[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,n=hi){const i=this.planes,s=e.elements,o=s[0],r=s[1],a=s[2],l=s[3],d=s[4],u=s[5],f=s[6],h=s[7],m=s[8],b=s[9],y=s[10],_=s[11],p=s[12],T=s[13],w=s[14],S=s[15];if(i[0].setComponents(l-o,h-d,_-m,S-p).normalize(),i[1].setComponents(l+o,h+d,_+m,S+p).normalize(),i[2].setComponents(l+r,h+u,_+b,S+T).normalize(),i[3].setComponents(l-r,h-u,_-b,S-T).normalize(),i[4].setComponents(l-a,h-f,_-y,S-w).normalize(),n===hi)i[5].setComponents(l+a,h+f,_+y,S+w).normalize();else if(n===pa)i[5].setComponents(a,f,y,w).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+n);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Ji.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),Ji.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Ji)}intersectsSprite(e){return Ji.center.set(0,0,0),Ji.radius=.7071067811865476,Ji.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ji)}intersectsSphere(e){const n=this.planes,i=e.center,s=-e.radius;for(let o=0;o<6;o++)if(n[o].distanceToPoint(i)0?e.max.x:e.min.x,zr.y=s.normal.y>0?e.max.y:e.min.y,zr.z=s.normal.z>0?e.max.z:e.min.z,s.distanceToPoint(zr)<0)return!1}return!0}containsPoint(e){const n=this.planes;for(let i=0;i<6;i++)if(n[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class fr extends Ms{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new at(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const _a=new U,ga=new U,Ju=new Tt,Po=new Fa,kr=new Ua,gl=new U,Qu=new U;class ci extends Nt{constructor(e=new tn,n=new fr){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=n,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,i=[0];for(let s=1,o=n.count;s0){const s=n[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,r=s.length;oi)return;gl.applyMatrix4(t.matrixWorld);const d=e.ray.origin.distanceTo(gl);if(!(de.far))return{distance:d,point:Qu.clone().applyMatrix4(t.matrixWorld),index:r,face:null,faceIndex:null,barycoord:null,object:t}}const eh=new U,th=new U;class pd extends ci{constructor(e,n){super(e,n),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,i=[];for(let s=0,o=n.count;s0&&w(!0),n>0&&w(!1)),this.setIndex(u),this.setAttribute("position",new Et(f,3)),this.setAttribute("normal",new Et(h,3)),this.setAttribute("uv",new Et(m,2));function T(){const S=new U,I=new U;let P=0;const D=(n-e)/i;for(let R=0;R<=o;R++){const E=[],g=R/o,L=g*(n-e)+e;for(let O=0;O<=s;O++){const H=O/s,j=H*l+a,re=Math.sin(j),q=Math.cos(j);I.x=L*re,I.y=-g*i+_,I.z=L*q,f.push(I.x,I.y,I.z),S.set(re,D,q).normalize(),h.push(S.x,S.y,S.z),m.push(H,1-g),E.push(b++)}y.push(E)}for(let R=0;R0||E!==0)&&(u.push(g,L,H),P+=3),(n>0||E!==o-1)&&(u.push(L,O,H),P+=3)}d.addGroup(p,P,0),p+=P}function w(S){const I=b,P=new Ke,D=new U;let R=0;const E=S===!0?e:n,g=S===!0?1:-1;for(let O=1;O<=s;O++)f.push(0,_*g,0),h.push(0,g,0),m.push(.5,.5),b++;const L=b;for(let O=0;O<=s;O++){const j=O/s*l+a,re=Math.cos(j),q=Math.sin(j);D.x=E*q,D.y=_*g,D.z=E*re,f.push(D.x,D.y,D.z),h.push(0,g,0),P.x=re*.5+.5,P.y=q*.5*g+.5,m.push(P.x,P.y),b++}for(let O=0;O.9&&D<.1&&(w<.2&&(r[T+0]+=1),S<.2&&(r[T+2]+=1),I<.2&&(r[T+4]+=1))}}function h(T){o.push(T.x,T.y,T.z)}function m(T,w){const S=T*3;w.x=e[S+0],w.y=e[S+1],w.z=e[S+2]}function b(){const T=new U,w=new U,S=new U,I=new U,P=new Ke,D=new Ke,R=new Ke;for(let E=0,g=0;E0)&&m.push(w,S,P),(p!==i-1||lm.start-b.start);let h=0;for(let m=1;m 0 vec4 plane; #ifdef ALPHA_TO_COVERAGE float distanceToPlane, distanceGradient; float clipOpacity = 1.0; #pragma unroll_loop_start for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; distanceGradient = fwidth( distanceToPlane ) / 2.0; clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); if ( clipOpacity == 0.0 ) discard; } #pragma unroll_loop_end #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES float unionClipOpacity = 1.0; #pragma unroll_loop_start for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; distanceGradient = fwidth( distanceToPlane ) / 2.0; unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); } #pragma unroll_loop_end clipOpacity *= 1.0 - unionClipOpacity; #endif diffuseColor.a *= clipOpacity; if ( diffuseColor.a == 0.0 ) discard; #else #pragma unroll_loop_start for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; } #pragma unroll_loop_end #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES bool clipped = true; #pragma unroll_loop_start for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; } #pragma unroll_loop_end if ( clipped ) discard; #endif #endif #endif`,DF=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; #endif`,IF=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; #endif`,LF=`#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; #endif`,UF=`#if defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; #elif defined( USE_COLOR ) diffuseColor.rgb *= vColor; #endif`,FF=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) varying vec3 vColor; #endif`,OF=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) varying vec3 vColor; #endif`,NF=`#if defined( USE_COLOR_ALPHA ) vColor = vec4( 1.0 ); #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) vColor = vec3( 1.0 ); #endif #ifdef USE_COLOR vColor *= color; #endif #ifdef USE_INSTANCING_COLOR vColor.xyz *= instanceColor.xyz; #endif #ifdef USE_BATCHING_COLOR vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); vColor.xyz *= batchingColor.xyz; #endif`,zF=`#define PI 3.141592653589793 #define PI2 6.283185307179586 #define PI_HALF 1.5707963267948966 #define RECIPROCAL_PI 0.3183098861837907 #define RECIPROCAL_PI2 0.15915494309189535 #define EPSILON 1e-6 #ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif #define whiteComplement( a ) ( 1.0 - saturate( a ) ) float pow2( const in float x ) { return x*x; } vec3 pow2( const in vec3 x ) { return x*x; } float pow3( const in float x ) { return x*x*x; } float pow4( const in float x ) { float x2 = x*x; return x2*x2; } float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } highp float rand( const in vec2 uv ) { const highp float a = 12.9898, b = 78.233, c = 43758.5453; highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); return fract( sin( sn ) * c ); } #ifdef HIGH_PRECISION float precisionSafeLength( vec3 v ) { return length( v ); } #else float precisionSafeLength( vec3 v ) { float maxComponent = max3( abs( v ) ); return length( v / maxComponent ) * maxComponent; } #endif struct IncidentLight { vec3 color; vec3 direction; bool visible; }; struct ReflectedLight { vec3 directDiffuse; vec3 directSpecular; vec3 indirectDiffuse; vec3 indirectSpecular; }; #ifdef USE_ALPHAHASH varying vec3 vPosition; #endif vec3 transformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); } vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); } mat3 transposeMat3( const in mat3 m ) { mat3 tmp; tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); return tmp; } bool isPerspectiveMatrix( mat4 m ) { return m[ 2 ][ 3 ] == - 1.0; } vec2 equirectUv( in vec3 dir ) { float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; return vec2( u, v ); } vec3 BRDF_Lambert( const in vec3 diffuseColor ) { return RECIPROCAL_PI * diffuseColor; } vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); } float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); } // validated`,kF=`#ifdef ENVMAP_TYPE_CUBE_UV #define cubeUV_minMipLevel 4.0 #define cubeUV_minTileSize 16.0 float getFace( vec3 direction ) { vec3 absDirection = abs( direction ); float face = - 1.0; if ( absDirection.x > absDirection.z ) { if ( absDirection.x > absDirection.y ) face = direction.x > 0.0 ? 0.0 : 3.0; else face = direction.y > 0.0 ? 1.0 : 4.0; } else { if ( absDirection.z > absDirection.y ) face = direction.z > 0.0 ? 2.0 : 5.0; else face = direction.y > 0.0 ? 1.0 : 4.0; } return face; } vec2 getUV( vec3 direction, float face ) { vec2 uv; if ( face == 0.0 ) { uv = vec2( direction.z, direction.y ) / abs( direction.x ); } else if ( face == 1.0 ) { uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); } else if ( face == 2.0 ) { uv = vec2( - direction.x, direction.y ) / abs( direction.z ); } else if ( face == 3.0 ) { uv = vec2( - direction.z, direction.y ) / abs( direction.x ); } else if ( face == 4.0 ) { uv = vec2( - direction.x, direction.z ) / abs( direction.y ); } else { uv = vec2( direction.x, direction.y ) / abs( direction.z ); } return 0.5 * ( uv + 1.0 ); } vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { float face = getFace( direction ); float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); mipInt = max( mipInt, cubeUV_minMipLevel ); float faceSize = exp2( mipInt ); highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; if ( face > 2.0 ) { uv.y += faceSize; face -= 3.0; } uv.x += face * faceSize; uv.x += filterInt * 3.0 * cubeUV_minTileSize; uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); uv.x *= CUBEUV_TEXEL_WIDTH; uv.y *= CUBEUV_TEXEL_HEIGHT; #ifdef texture2DGradEXT return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; #else return texture2D( envMap, uv ).rgb; #endif } #define cubeUV_r0 1.0 #define cubeUV_m0 - 2.0 #define cubeUV_r1 0.8 #define cubeUV_m1 - 1.0 #define cubeUV_r4 0.4 #define cubeUV_m4 2.0 #define cubeUV_r5 0.305 #define cubeUV_m5 3.0 #define cubeUV_r6 0.21 #define cubeUV_m6 4.0 float roughnessToMip( float roughness ) { float mip = 0.0; if ( roughness >= cubeUV_r1 ) { mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; } else if ( roughness >= cubeUV_r4 ) { mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; } else if ( roughness >= cubeUV_r5 ) { mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; } else if ( roughness >= cubeUV_r6 ) { mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; } else { mip = - 2.0 * log2( 1.16 * roughness ); } return mip; } vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); float mipF = fract( mip ); float mipInt = floor( mip ); vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); if ( mipF == 0.0 ) { return vec4( color0, 1.0 ); } else { vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); return vec4( mix( color0, color1, mipF ), 1.0 ); } } #endif`,BF=`vec3 transformedNormal = objectNormal; #ifdef USE_TANGENT vec3 transformedTangent = objectTangent; #endif #ifdef USE_BATCHING mat3 bm = mat3( batchingMatrix ); transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); transformedNormal = bm * transformedNormal; #ifdef USE_TANGENT transformedTangent = bm * transformedTangent; #endif #endif #ifdef USE_INSTANCING mat3 im = mat3( instanceMatrix ); transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); transformedNormal = im * transformedNormal; #ifdef USE_TANGENT transformedTangent = im * transformedTangent; #endif #endif transformedNormal = normalMatrix * transformedNormal; #ifdef FLIP_SIDED transformedNormal = - transformedNormal; #endif #ifdef USE_TANGENT transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; #ifdef FLIP_SIDED transformedTangent = - transformedTangent; #endif #endif`,VF=`#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; #endif`,HF=`#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); #endif`,$F=`#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE emissiveColor = sRGBTransferEOTF( emissiveColor ); #endif totalEmissiveRadiance *= emissiveColor.rgb; #endif`,GF=`#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; #endif`,WF="gl_FragColor = linearToOutputTexel( gl_FragColor );",XF=`vec4 LinearTransferOETF( in vec4 value ) { return value; } vec4 sRGBTransferEOTF( in vec4 value ) { return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); } vec4 sRGBTransferOETF( in vec4 value ) { return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); }`,jF=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vec3 cameraToFrag; if ( isOrthographic ) { cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); } else { cameraToFrag = normalize( vWorldPosition - cameraPosition ); } vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); #ifdef ENVMAP_MODE_REFLECTION vec3 reflectVec = reflect( cameraToFrag, worldNormal ); #else vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); #endif #else vec3 reflectVec = vReflect; #endif #ifdef ENVMAP_TYPE_CUBE vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); #else vec4 envColor = vec4( 0.0 ); #endif #ifdef ENVMAP_BLENDING_MULTIPLY outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); #elif defined( ENVMAP_BLENDING_MIX ) outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); #elif defined( ENVMAP_BLENDING_ADD ) outgoingLight += envColor.xyz * specularStrength * reflectivity; #endif #endif`,YF=`#ifdef USE_ENVMAP uniform float envMapIntensity; uniform float flipEnvMap; uniform mat3 envMapRotation; #ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #else uniform sampler2D envMap; #endif #endif`,qF=`#ifdef USE_ENVMAP uniform float reflectivity; #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS #endif #ifdef ENV_WORLDPOS varying vec3 vWorldPosition; uniform float refractionRatio; #else varying vec3 vReflect; #endif #endif`,ZF=`#ifdef USE_ENVMAP #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS #endif #ifdef ENV_WORLDPOS varying vec3 vWorldPosition; #else varying vec3 vReflect; uniform float refractionRatio; #endif #endif`,KF=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vWorldPosition = worldPosition.xyz; #else vec3 cameraToVertex; if ( isOrthographic ) { cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); } else { cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); } vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); #ifdef ENVMAP_MODE_REFLECTION vReflect = reflect( cameraToVertex, worldNormal ); #else vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); #endif #endif #endif`,JF=`#ifdef USE_FOG vFogDepth = - mvPosition.z; #endif`,QF=`#ifdef USE_FOG varying float vFogDepth; #endif`,eO=`#ifdef USE_FOG #ifdef FOG_EXP2 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); #else float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); #endif gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); #endif`,tO=`#ifdef USE_FOG uniform vec3 fogColor; varying float vFogDepth; #ifdef FOG_EXP2 uniform float fogDensity; #else uniform float fogNear; uniform float fogFar; #endif #endif`,nO=`#ifdef USE_GRADIENTMAP uniform sampler2D gradientMap; #endif vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { float dotNL = dot( normal, lightDirection ); vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); #ifdef USE_GRADIENTMAP return vec3( texture2D( gradientMap, coord ).r ); #else vec2 fw = fwidth( coord ) * 0.5; return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); #endif }`,iO=`#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; #endif`,sO=`LambertMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularStrength = specularStrength;`,oO=`varying vec3 vViewPosition; struct LambertMaterial { vec3 diffuseColor; float specularStrength; }; void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Lambert #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,rO=`uniform bool receiveShadow; uniform vec3 ambientLightColor; #if defined( USE_LIGHT_PROBES ) uniform vec3 lightProbe[ 9 ]; #endif vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { float x = normal.x, y = normal.y, z = normal.z; vec3 result = shCoefficients[ 0 ] * 0.886227; result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); return result; } vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); return irradiance; } vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { vec3 irradiance = ambientLightColor; return irradiance; } float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); if ( cutoffDistance > 0.0 ) { distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); } return distanceFalloff; } float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { return smoothstep( coneCosine, penumbraCosine, angleCosine ); } #if NUM_DIR_LIGHTS > 0 struct DirectionalLight { vec3 direction; vec3 color; }; uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { light.color = directionalLight.color; light.direction = directionalLight.direction; light.visible = true; } #endif #if NUM_POINT_LIGHTS > 0 struct PointLight { vec3 position; vec3 color; float distance; float decay; }; uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { vec3 lVector = pointLight.position - geometryPosition; light.direction = normalize( lVector ); float lightDistance = length( lVector ); light.color = pointLight.color; light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); light.visible = ( light.color != vec3( 0.0 ) ); } #endif #if NUM_SPOT_LIGHTS > 0 struct SpotLight { vec3 position; vec3 direction; vec3 color; float distance; float decay; float coneCos; float penumbraCos; }; uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { vec3 lVector = spotLight.position - geometryPosition; light.direction = normalize( lVector ); float angleCos = dot( light.direction, spotLight.direction ); float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); if ( spotAttenuation > 0.0 ) { float lightDistance = length( lVector ); light.color = spotLight.color * spotAttenuation; light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); light.visible = ( light.color != vec3( 0.0 ) ); } else { light.color = vec3( 0.0 ); light.visible = false; } } #endif #if NUM_RECT_AREA_LIGHTS > 0 struct RectAreaLight { vec3 color; vec3 position; vec3 halfWidth; vec3 halfHeight; }; uniform sampler2D ltc_1; uniform sampler2D ltc_2; uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; #endif #if NUM_HEMI_LIGHTS > 0 struct HemisphereLight { vec3 direction; vec3 skyColor; vec3 groundColor; }; uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { float dotNL = dot( normal, hemiLight.direction ); float hemiDiffuseWeight = 0.5 * dotNL + 0.5; vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); return irradiance; } #endif`,aO=`#ifdef USE_ENVMAP vec3 getIBLIrradiance( const in vec3 normal ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); return PI * envMapColor.rgb * envMapIntensity; #else return vec3( 0.0 ); #endif } vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 reflectVec = reflect( - viewDir, normal ); reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); return envMapColor.rgb * envMapIntensity; #else return vec3( 0.0 ); #endif } #ifdef USE_ANISOTROPY vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 bentNormal = cross( bitangent, viewDir ); bentNormal = normalize( cross( bentNormal, bitangent ) ); bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); return getIBLRadiance( viewDir, bentNormal, roughness ); #else return vec3( 0.0 ); #endif } #endif #endif`,lO=`ToonMaterial material; material.diffuseColor = diffuseColor.rgb;`,cO=`varying vec3 vViewPosition; struct ToonMaterial { vec3 diffuseColor; }; void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Toon #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,dO=`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; material.specularStrength = specularStrength;`,uO=`varying vec3 vViewPosition; struct BlinnPhongMaterial { vec3 diffuseColor; vec3 specularColor; float specularShininess; float specularStrength; }; void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; } void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_BlinnPhong #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,hO=`PhysicalMaterial material; material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; material.roughness = min( material.roughness, 1.0 ); #ifdef IOR material.ior = ior; #ifdef USE_SPECULAR float specularIntensityFactor = specularIntensity; vec3 specularColorFactor = specularColor; #ifdef USE_SPECULAR_COLORMAP specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; #endif #ifdef USE_SPECULAR_INTENSITYMAP specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; #endif material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); #else float specularIntensityFactor = 1.0; vec3 specularColorFactor = vec3( 1.0 ); material.specularF90 = 1.0; #endif material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); #else material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); material.specularF90 = 1.0; #endif #ifdef USE_CLEARCOAT material.clearcoat = clearcoat; material.clearcoatRoughness = clearcoatRoughness; material.clearcoatF0 = vec3( 0.04 ); material.clearcoatF90 = 1.0; #ifdef USE_CLEARCOATMAP material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; #endif material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); material.clearcoatRoughness += geometryRoughness; material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); #endif #ifdef USE_DISPERSION material.dispersion = dispersion; #endif #ifdef USE_IRIDESCENCE material.iridescence = iridescence; material.iridescenceIOR = iridescenceIOR; #ifdef USE_IRIDESCENCEMAP material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; #else material.iridescenceThickness = iridescenceThicknessMaximum; #endif #endif #ifdef USE_SHEEN material.sheenColor = sheenColor; #ifdef USE_SHEEN_COLORMAP material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; #endif material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); #ifdef USE_SHEEN_ROUGHNESSMAP material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; #endif #endif #ifdef USE_ANISOTROPY #ifdef USE_ANISOTROPYMAP mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; #else vec2 anisotropyV = anisotropyVector; #endif material.anisotropy = length( anisotropyV ); if( material.anisotropy == 0.0 ) { anisotropyV = vec2( 1.0, 0.0 ); } else { anisotropyV /= material.anisotropy; material.anisotropy = saturate( material.anisotropy ); } material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; #endif`,fO=`struct PhysicalMaterial { vec3 diffuseColor; float roughness; vec3 specularColor; float specularF90; float dispersion; #ifdef USE_CLEARCOAT float clearcoat; float clearcoatRoughness; vec3 clearcoatF0; float clearcoatF90; #endif #ifdef USE_IRIDESCENCE float iridescence; float iridescenceIOR; float iridescenceThickness; vec3 iridescenceFresnel; vec3 iridescenceF0; #endif #ifdef USE_SHEEN vec3 sheenColor; float sheenRoughness; #endif #ifdef IOR float ior; #endif #ifdef USE_TRANSMISSION float transmission; float transmissionAlpha; float thickness; float attenuationDistance; vec3 attenuationColor; #endif #ifdef USE_ANISOTROPY float anisotropy; float alphaT; vec3 anisotropyT; vec3 anisotropyB; #endif }; vec3 clearcoatSpecularDirect = vec3( 0.0 ); vec3 clearcoatSpecularIndirect = vec3( 0.0 ); vec3 sheenSpecularDirect = vec3( 0.0 ); vec3 sheenSpecularIndirect = vec3(0.0 ); vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); float x2 = x * x; float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); } float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { float a2 = pow2( alpha ); float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); return 0.5 / max( gv + gl, EPSILON ); } float D_GGX( const in float alpha, const in float dotNH ) { float a2 = pow2( alpha ); float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; return RECIPROCAL_PI * a2 / pow2( denom ); } #ifdef USE_ANISOTROPY float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); float v = 0.5 / ( gv + gl ); return saturate(v); } float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { float a2 = alphaT * alphaB; highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); highp float v2 = dot( v, v ); float w2 = a2 / v2; return RECIPROCAL_PI * a2 * pow2 ( w2 ); } #endif #ifdef USE_CLEARCOAT vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { vec3 f0 = material.clearcoatF0; float f90 = material.clearcoatF90; float roughness = material.clearcoatRoughness; float alpha = pow2( roughness ); vec3 halfDir = normalize( lightDir + viewDir ); float dotNL = saturate( dot( normal, lightDir ) ); float dotNV = saturate( dot( normal, viewDir ) ); float dotNH = saturate( dot( normal, halfDir ) ); float dotVH = saturate( dot( viewDir, halfDir ) ); vec3 F = F_Schlick( f0, f90, dotVH ); float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); float D = D_GGX( alpha, dotNH ); return F * ( V * D ); } #endif vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { vec3 f0 = material.specularColor; float f90 = material.specularF90; float roughness = material.roughness; float alpha = pow2( roughness ); vec3 halfDir = normalize( lightDir + viewDir ); float dotNL = saturate( dot( normal, lightDir ) ); float dotNV = saturate( dot( normal, viewDir ) ); float dotNH = saturate( dot( normal, halfDir ) ); float dotVH = saturate( dot( viewDir, halfDir ) ); vec3 F = F_Schlick( f0, f90, dotVH ); #ifdef USE_IRIDESCENCE F = mix( F, material.iridescenceFresnel, material.iridescence ); #endif #ifdef USE_ANISOTROPY float dotTL = dot( material.anisotropyT, lightDir ); float dotTV = dot( material.anisotropyT, viewDir ); float dotTH = dot( material.anisotropyT, halfDir ); float dotBL = dot( material.anisotropyB, lightDir ); float dotBV = dot( material.anisotropyB, viewDir ); float dotBH = dot( material.anisotropyB, halfDir ); float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); #else float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); float D = D_GGX( alpha, dotNH ); #endif return F * ( V * D ); } vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { const float LUT_SIZE = 64.0; const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; const float LUT_BIAS = 0.5 / LUT_SIZE; float dotNV = saturate( dot( N, V ) ); vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); uv = uv * LUT_SCALE + LUT_BIAS; return uv; } float LTC_ClippedSphereFormFactor( const in vec3 f ) { float l = length( f ); return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); } vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { float x = dot( v1, v2 ); float y = abs( x ); float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; float b = 3.4175940 + ( 4.1616724 + y ) * y; float v = a / b; float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; return cross( v1, v2 ) * theta_sintheta; } vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; vec3 lightNormal = cross( v1, v2 ); if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); vec3 T1, T2; T1 = normalize( V - N * dot( V, N ) ); T2 = - cross( N, T1 ); mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); vec3 coords[ 4 ]; coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); coords[ 0 ] = normalize( coords[ 0 ] ); coords[ 1 ] = normalize( coords[ 1 ] ); coords[ 2 ] = normalize( coords[ 2 ] ); coords[ 3 ] = normalize( coords[ 3 ] ); vec3 vectorFormFactor = vec3( 0.0 ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); return vec3( result ); } #if defined( USE_SHEEN ) float D_Charlie( float roughness, float dotNH ) { float alpha = pow2( roughness ); float invAlpha = 1.0 / alpha; float cos2h = dotNH * dotNH; float sin2h = max( 1.0 - cos2h, 0.0078125 ); return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); } float V_Neubelt( float dotNV, float dotNL ) { return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); } vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { vec3 halfDir = normalize( lightDir + viewDir ); float dotNL = saturate( dot( normal, lightDir ) ); float dotNV = saturate( dot( normal, viewDir ) ); float dotNH = saturate( dot( normal, halfDir ) ); float D = D_Charlie( sheenRoughness, dotNH ); float V = V_Neubelt( dotNV, dotNL ); return sheenColor * ( D * V ); } #endif float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { float dotNV = saturate( dot( normal, viewDir ) ); float r2 = roughness * roughness; float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); return saturate( DG * RECIPROCAL_PI ); } vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { float dotNV = saturate( dot( normal, viewDir ) ); const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); vec4 r = roughness * c0 + c1; float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; return fab; } vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { vec2 fab = DFGApprox( normal, viewDir, roughness ); return specularColor * fab.x + specularF90 * fab.y; } #ifdef USE_IRIDESCENCE void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { #else void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { #endif vec2 fab = DFGApprox( normal, viewDir, roughness ); #ifdef USE_IRIDESCENCE vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); #else vec3 Fr = specularColor; #endif vec3 FssEss = Fr * fab.x + specularF90 * fab.y; float Ess = fab.x + fab.y; float Ems = 1.0 - Ess; vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); singleScatter += FssEss; multiScatter += Fms * Ems; } #if NUM_RECT_AREA_LIGHTS > 0 void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { vec3 normal = geometryNormal; vec3 viewDir = geometryViewDir; vec3 position = geometryPosition; vec3 lightPos = rectAreaLight.position; vec3 halfWidth = rectAreaLight.halfWidth; vec3 halfHeight = rectAreaLight.halfHeight; vec3 lightColor = rectAreaLight.color; float roughness = material.roughness; vec3 rectCoords[ 4 ]; rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; vec2 uv = LTC_Uv( normal, viewDir, roughness ); vec4 t1 = texture2D( ltc_1, uv ); vec4 t2 = texture2D( ltc_2, uv ); mat3 mInv = mat3( vec3( t1.x, 0, t1.y ), vec3( 0, 1, 0 ), vec3( t1.z, 0, t1.w ) ); vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); } #endif void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; #ifdef USE_CLEARCOAT float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); vec3 ccIrradiance = dotNLcc * directLight.color; clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); #endif #ifdef USE_SHEEN sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); #endif reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { #ifdef USE_CLEARCOAT clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); #endif #ifdef USE_SHEEN sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); #endif vec3 singleScattering = vec3( 0.0 ); vec3 multiScattering = vec3( 0.0 ); vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; #ifdef USE_IRIDESCENCE computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); #else computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); #endif vec3 totalScattering = singleScattering + multiScattering; vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); reflectedLight.indirectSpecular += radiance * singleScattering; reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; } #define RE_Direct RE_Direct_Physical #define RE_Direct_RectArea RE_Direct_RectArea_Physical #define RE_IndirectDiffuse RE_IndirectDiffuse_Physical #define RE_IndirectSpecular RE_IndirectSpecular_Physical float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); }`,pO=` vec3 geometryPosition = - vViewPosition; vec3 geometryNormal = normal; vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); vec3 geometryClearcoatNormal = vec3( 0.0 ); #ifdef USE_CLEARCOAT geometryClearcoatNormal = clearcoatNormal; #endif #ifdef USE_IRIDESCENCE float dotNVi = saturate( dot( normal, geometryViewDir ) ); if ( material.iridescenceThickness == 0.0 ) { material.iridescence = 0.0; } else { material.iridescence = saturate( material.iridescence ); } if ( material.iridescence > 0.0 ) { material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); } #endif IncidentLight directLight; #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) PointLight pointLight; #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 PointLightShadow pointLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { pointLight = pointLights[ i ]; getPointLightInfo( pointLight, geometryPosition, directLight ); #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) pointLightShadow = pointLightShadows[ i ]; directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; #endif RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) SpotLight spotLight; vec4 spotColor; vec3 spotLightCoord; bool inSpotLightMap; #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 SpotLightShadow spotLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { spotLight = spotLights[ i ]; getSpotLightInfo( spotLight, geometryPosition, directLight ); #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS #else #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) #endif #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; #endif #undef SPOT_LIGHT_MAP_INDEX #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) spotLightShadow = spotLightShadows[ i ]; directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; #endif RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) DirectionalLight directionalLight; #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 DirectionalLightShadow directionalLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { directionalLight = directionalLights[ i ]; getDirectionalLightInfo( directionalLight, directLight ); #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) directionalLightShadow = directionalLightShadows[ i ]; directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; #endif RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) RectAreaLight rectAreaLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { rectAreaLight = rectAreaLights[ i ]; RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if defined( RE_IndirectDiffuse ) vec3 iblIrradiance = vec3( 0.0 ); vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); #if defined( USE_LIGHT_PROBES ) irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); #endif #if ( NUM_HEMI_LIGHTS > 0 ) #pragma unroll_loop_start for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); } #pragma unroll_loop_end #endif #endif #if defined( RE_IndirectSpecular ) vec3 radiance = vec3( 0.0 ); vec3 clearcoatRadiance = vec3( 0.0 ); #endif`,mO=`#if defined( RE_IndirectDiffuse ) #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; irradiance += lightMapIrradiance; #endif #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) iblIrradiance += getIBLIrradiance( geometryNormal ); #endif #endif #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) #ifdef USE_ANISOTROPY radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); #else radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); #endif #ifdef USE_CLEARCOAT clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); #endif #endif`,_O=`#if defined( RE_IndirectDiffuse ) RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); #endif #if defined( RE_IndirectSpecular ) RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); #endif`,gO=`#if defined( USE_LOGDEPTHBUF ) gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; #endif`,vO=`#if defined( USE_LOGDEPTHBUF ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; #endif`,bO=`#ifdef USE_LOGDEPTHBUF varying float vFragDepth; varying float vIsPerspective; #endif`,yO=`#ifdef USE_LOGDEPTHBUF vFragDepth = 1.0 + gl_Position.w; vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); #endif`,xO=`#ifdef USE_MAP vec4 sampledDiffuseColor = texture2D( map, vMapUv ); #ifdef DECODE_VIDEO_TEXTURE sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); #endif diffuseColor *= sampledDiffuseColor; #endif`,SO=`#ifdef USE_MAP uniform sampler2D map; #endif`,MO=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) #if defined( USE_POINTS_UV ) vec2 uv = vUv; #else vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; #endif #endif #ifdef USE_MAP diffuseColor *= texture2D( map, uv ); #endif #ifdef USE_ALPHAMAP diffuseColor.a *= texture2D( alphaMap, uv ).g; #endif`,EO=`#if defined( USE_POINTS_UV ) varying vec2 vUv; #else #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) uniform mat3 uvTransform; #endif #endif #ifdef USE_MAP uniform sampler2D map; #endif #ifdef USE_ALPHAMAP uniform sampler2D alphaMap; #endif`,wO=`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); metalnessFactor *= texelMetalness.b; #endif`,TO=`#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; #endif`,CO=`#ifdef USE_INSTANCING_MORPH float morphTargetInfluences[ MORPHTARGETS_COUNT ]; float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; } #endif`,AO=`#if defined( USE_MORPHCOLORS ) vColor *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { #if defined( USE_COLOR_ALPHA ) if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; #elif defined( USE_COLOR ) if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; #endif } #endif`,PO=`#ifdef USE_MORPHNORMALS objectNormal *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; } #endif`,RO=`#ifdef USE_MORPHTARGETS #ifndef USE_INSTANCING_MORPH uniform float morphTargetBaseInfluence; uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; #endif uniform sampler2DArray morphTargetsTexture; uniform ivec2 morphTargetsTextureSize; vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; int y = texelIndex / morphTargetsTextureSize.x; int x = texelIndex - y * morphTargetsTextureSize.x; ivec3 morphUV = ivec3( x, y, morphTargetIndex ); return texelFetch( morphTargetsTexture, morphUV, 0 ); } #endif`,DO=`#ifdef USE_MORPHTARGETS transformed *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; } #endif`,IO=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; #ifdef FLAT_SHADED vec3 fdx = dFdx( vViewPosition ); vec3 fdy = dFdy( vViewPosition ); vec3 normal = normalize( cross( fdx, fdy ) ); #else vec3 normal = normalize( vNormal ); #ifdef DOUBLE_SIDED normal *= faceDirection; #endif #endif #if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) #ifdef USE_TANGENT mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); #else mat3 tbn = getTangentFrame( - vViewPosition, normal, #if defined( USE_NORMALMAP ) vNormalMapUv #elif defined( USE_CLEARCOAT_NORMALMAP ) vClearcoatNormalMapUv #else vUv #endif ); #endif #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) tbn[0] *= faceDirection; tbn[1] *= faceDirection; #endif #endif #ifdef USE_CLEARCOAT_NORMALMAP #ifdef USE_TANGENT mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); #else mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); #endif #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) tbn2[0] *= faceDirection; tbn2[1] *= faceDirection; #endif #endif vec3 nonPerturbedNormal = normal;`,LO=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; #ifdef FLIP_SIDED normal = - normal; #endif #ifdef DOUBLE_SIDED normal = normal * faceDirection; #endif normal = normalize( normalMatrix * normal ); #elif defined( USE_NORMALMAP_TANGENTSPACE ) vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; mapN.xy *= normalScale; normal = normalize( tbn * mapN ); #elif defined( USE_BUMPMAP ) normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); #endif`,UO=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif`,FO=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif`,OO=`#ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif #endif`,NO=`#ifdef USE_NORMALMAP uniform sampler2D normalMap; uniform vec2 normalScale; #endif #ifdef USE_NORMALMAP_OBJECTSPACE uniform mat3 normalMatrix; #endif #if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { vec3 q0 = dFdx( eye_pos.xyz ); vec3 q1 = dFdy( eye_pos.xyz ); vec2 st0 = dFdx( uv.st ); vec2 st1 = dFdy( uv.st ); vec3 N = surf_norm; vec3 q1perp = cross( q1, N ); vec3 q0perp = cross( N, q0 ); vec3 T = q1perp * st0.x + q0perp * st1.x; vec3 B = q1perp * st0.y + q0perp * st1.y; float det = max( dot( T, T ), dot( B, B ) ); float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); return mat3( T * scale, B * scale, N ); } #endif`,zO=`#ifdef USE_CLEARCOAT vec3 clearcoatNormal = nonPerturbedNormal; #endif`,kO=`#ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; clearcoatNormal = normalize( tbn2 * clearcoatMapN ); #endif`,BO=`#ifdef USE_CLEARCOATMAP uniform sampler2D clearcoatMap; #endif #ifdef USE_CLEARCOAT_NORMALMAP uniform sampler2D clearcoatNormalMap; uniform vec2 clearcoatNormalScale; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform sampler2D clearcoatRoughnessMap; #endif`,VO=`#ifdef USE_IRIDESCENCEMAP uniform sampler2D iridescenceMap; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform sampler2D iridescenceThicknessMap; #endif`,HO=`#ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= material.transmissionAlpha; #endif gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,$O=`vec3 packNormalToRGB( const in vec3 normal ) { return normalize( normal ) * 0.5 + 0.5; } vec3 unpackRGBToNormal( const in vec3 rgb ) { return 2.0 * rgb.xyz - 1.0; } const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; const float Inv255 = 1. / 255.; const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); vec4 packDepthToRGBA( const in float v ) { if( v <= 0.0 ) return vec4( 0., 0., 0., 0. ); if( v >= 1.0 ) return vec4( 1., 1., 1., 1. ); float vuf; float af = modf( v * PackFactors.a, vuf ); float bf = modf( vuf * ShiftRight8, vuf ); float gf = modf( vuf * ShiftRight8, vuf ); return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); } vec3 packDepthToRGB( const in float v ) { if( v <= 0.0 ) return vec3( 0., 0., 0. ); if( v >= 1.0 ) return vec3( 1., 1., 1. ); float vuf; float bf = modf( v * PackFactors.b, vuf ); float gf = modf( vuf * ShiftRight8, vuf ); return vec3( vuf * Inv255, gf * PackUpscale, bf ); } vec2 packDepthToRG( const in float v ) { if( v <= 0.0 ) return vec2( 0., 0. ); if( v >= 1.0 ) return vec2( 1., 1. ); float vuf; float gf = modf( v * 256., vuf ); return vec2( vuf * Inv255, gf ); } float unpackRGBAToDepth( const in vec4 v ) { return dot( v, UnpackFactors4 ); } float unpackRGBToDepth( const in vec3 v ) { return dot( v, UnpackFactors3 ); } float unpackRGToDepth( const in vec2 v ) { return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; } vec4 pack2HalfToRGBA( const in vec2 v ) { vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); } vec2 unpackRGBATo2Half( const in vec4 v ) { return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); } float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { return ( viewZ + near ) / ( near - far ); } float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { return depth * ( near - far ) - near; } float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); } float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { return ( near * far ) / ( ( far - near ) * depth - far ); }`,GO=`#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; #endif`,WO=`vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING mvPosition = batchingMatrix * mvPosition; #endif #ifdef USE_INSTANCING mvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; gl_Position = projectionMatrix * mvPosition;`,XO=`#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); #endif`,jO=`#ifdef DITHERING vec3 dithering( vec3 color ) { float grid_position = rand( gl_FragCoord.xy ); vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); return color + dither_shift_RGB; } #endif`,YO=`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); roughnessFactor *= texelRoughness.g; #endif`,qO=`#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; #endif`,ZO=`#if NUM_SPOT_LIGHT_COORDS > 0 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif #if NUM_SPOT_LIGHT_MAPS > 0 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; #endif #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; struct DirectionalLightShadow { float shadowIntensity; float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; struct SpotLightShadow { float shadowIntensity; float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; #endif #if NUM_POINT_LIGHT_SHADOWS > 0 uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; struct PointLightShadow { float shadowIntensity; float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; float shadowCameraNear; float shadowCameraFar; }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); } vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { return unpackRGBATo2Half( texture2D( shadow, uv ) ); } float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ float occlusion = 1.0; vec2 distribution = texture2DDistribution( shadow, uv ); float hard_shadow = step( compare , distribution.x ); if (hard_shadow != 1.0 ) { float distance = compare - distribution.x ; float variance = max( 0.00000, distribution.y * distribution.y ); float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); } return occlusion; } float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { float shadow = 1.0; shadowCoord.xyz /= shadowCoord.w; shadowCoord.z += shadowBias; bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; bool frustumTest = inFrustum && shadowCoord.z <= 1.0; if ( frustumTest ) { #if defined( SHADOWMAP_TYPE_PCF ) vec2 texelSize = vec2( 1.0 ) / shadowMapSize; float dx0 = - texelSize.x * shadowRadius; float dy0 = - texelSize.y * shadowRadius; float dx1 = + texelSize.x * shadowRadius; float dy1 = + texelSize.y * shadowRadius; float dx2 = dx0 / 2.0; float dy2 = dy0 / 2.0; float dx3 = dx1 / 2.0; float dy3 = dy1 / 2.0; shadow = ( texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) ) * ( 1.0 / 17.0 ); #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) vec2 texelSize = vec2( 1.0 ) / shadowMapSize; float dx = texelSize.x; float dy = texelSize.y; vec2 uv = shadowCoord.xy; vec2 f = fract( uv * shadowMapSize + 0.5 ); uv -= f * texelSize; shadow = ( texture2DCompare( shadowMap, uv, shadowCoord.z ) + texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), f.x ) + mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), f.x ) + mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), f.y ) + mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), f.y ) + mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), f.x ), mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), f.x ), f.y ) ) * ( 1.0 / 9.0 ); #elif defined( SHADOWMAP_TYPE_VSM ) shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); #else shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); #endif } return mix( 1.0, shadow, shadowIntensity ); } vec2 cubeToUV( vec3 v, float texelSizeY ) { vec3 absV = abs( v ); float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); absV *= scaleToCube; v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); vec2 planar = v.xy; float almostATexel = 1.5 * texelSizeY; float almostOne = 1.0 - almostATexel; if ( absV.z >= almostOne ) { if ( v.z > 0.0 ) planar.x = 4.0 - v.x; } else if ( absV.x >= almostOne ) { float signX = sign( v.x ); planar.x = v.z * signX + 2.0 * signX; } else if ( absV.y >= almostOne ) { float signY = sign( v.y ); planar.x = v.x + 2.0 * signY + 2.0; planar.y = v.z * signY - 2.0; } return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); } float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { float shadow = 1.0; vec3 lightToPosition = shadowCoord.xyz; float lightToPositionLength = length( lightToPosition ); if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) { float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; vec3 bd3D = normalize( lightToPosition ); vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; shadow = ( texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) ) * ( 1.0 / 9.0 ); #else shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); #endif } return mix( 1.0, shadow, shadowIntensity ); } #endif`,KO=`#if NUM_SPOT_LIGHT_COORDS > 0 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; struct DirectionalLightShadow { float shadowIntensity; float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 struct SpotLightShadow { float shadowIntensity; float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; #endif #if NUM_POINT_LIGHT_SHADOWS > 0 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; struct PointLightShadow { float shadowIntensity; float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; float shadowCameraNear; float shadowCameraFar; }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif #endif`,JO=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); vec4 shadowWorldPosition; #endif #if defined( USE_SHADOWMAP ) #if NUM_DIR_LIGHT_SHADOWS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end #endif #if NUM_POINT_LIGHT_SHADOWS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end #endif #endif #if NUM_SPOT_LIGHT_COORDS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { shadowWorldPosition = worldPosition; #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; #endif vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end #endif`,QO=`float getShadowMask() { float shadow = 1.0; #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 DirectionalLightShadow directionalLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { directionalLight = directionalLightShadows[ i ]; shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; } #pragma unroll_loop_end #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 SpotLightShadow spotLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { spotLight = spotLightShadows[ i ]; shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; } #pragma unroll_loop_end #endif #if NUM_POINT_LIGHT_SHADOWS > 0 PointLightShadow pointLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { pointLight = pointLightShadows[ i ]; shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; } #pragma unroll_loop_end #endif #endif return shadow; }`,eN=`#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); #endif`,tN=`#ifdef USE_SKINNING uniform mat4 bindMatrix; uniform mat4 bindMatrixInverse; uniform highp sampler2D boneTexture; mat4 getBoneMatrix( const in float i ) { int size = textureSize( boneTexture, 0 ).x; int j = int( i ) * 4; int x = j % size; int y = j / size; vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); return mat4( v1, v2, v3, v4 ); } #endif`,nN=`#ifdef USE_SKINNING vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); vec4 skinned = vec4( 0.0 ); skinned += boneMatX * skinVertex * skinWeight.x; skinned += boneMatY * skinVertex * skinWeight.y; skinned += boneMatZ * skinVertex * skinWeight.z; skinned += boneMatW * skinVertex * skinWeight.w; transformed = ( bindMatrixInverse * skinned ).xyz; #endif`,iN=`#ifdef USE_SKINNING mat4 skinMatrix = mat4( 0.0 ); skinMatrix += skinWeight.x * boneMatX; skinMatrix += skinWeight.y * boneMatY; skinMatrix += skinWeight.z * boneMatZ; skinMatrix += skinWeight.w * boneMatW; skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; #ifdef USE_TANGENT objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; #endif #endif`,sN=`float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; #endif`,oN=`#ifdef USE_SPECULARMAP uniform sampler2D specularMap; #endif`,rN=`#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); #endif`,aN=`#ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif uniform float toneMappingExposure; vec3 LinearToneMapping( vec3 color ) { return saturate( toneMappingExposure * color ); } vec3 ReinhardToneMapping( vec3 color ) { color *= toneMappingExposure; return saturate( color / ( vec3( 1.0 ) + color ) ); } vec3 CineonToneMapping( vec3 color ) { color *= toneMappingExposure; color = max( vec3( 0.0 ), color - 0.004 ); return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); } vec3 RRTAndODTFit( vec3 v ) { vec3 a = v * ( v + 0.0245786 ) - 0.000090537; vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; return a / b; } vec3 ACESFilmicToneMapping( vec3 color ) { const mat3 ACESInputMat = mat3( vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), vec3( 0.04823, 0.01566, 0.83777 ) ); const mat3 ACESOutputMat = mat3( vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), vec3( -0.07367, -0.00605, 1.07602 ) ); color *= toneMappingExposure / 0.6; color = ACESInputMat * color; color = RRTAndODTFit( color ); color = ACESOutputMat * color; return saturate( color ); } const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( vec3( 1.6605, - 0.1246, - 0.0182 ), vec3( - 0.5876, 1.1329, - 0.1006 ), vec3( - 0.0728, - 0.0083, 1.1187 ) ); const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( vec3( 0.6274, 0.0691, 0.0164 ), vec3( 0.3293, 0.9195, 0.0880 ), vec3( 0.0433, 0.0113, 0.8956 ) ); vec3 agxDefaultContrastApprox( vec3 x ) { vec3 x2 = x * x; vec3 x4 = x2 * x2; return + 15.5 * x4 * x2 - 40.14 * x4 * x + 31.96 * x4 - 6.868 * x2 * x + 0.4298 * x2 + 0.1191 * x - 0.00232; } vec3 AgXToneMapping( vec3 color ) { const mat3 AgXInsetMatrix = mat3( vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) ); const mat3 AgXOutsetMatrix = mat3( vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) ); const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; color *= toneMappingExposure; color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; color = AgXInsetMatrix * color; color = max( color, 1e-10 ); color = log2( color ); color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); color = clamp( color, 0.0, 1.0 ); color = agxDefaultContrastApprox( color ); color = AgXOutsetMatrix * color; color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); color = LINEAR_REC2020_TO_LINEAR_SRGB * color; color = clamp( color, 0.0, 1.0 ); return color; } vec3 NeutralToneMapping( vec3 color ) { const float StartCompression = 0.8 - 0.04; const float Desaturation = 0.15; color *= toneMappingExposure; float x = min( color.r, min( color.g, color.b ) ); float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; color -= offset; float peak = max( color.r, max( color.g, color.b ) ); if ( peak < StartCompression ) return color; float d = 1. - StartCompression; float newPeak = 1. - d * d / ( peak + d - StartCompression ); color *= newPeak / peak; float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); return mix( color, vec3( newPeak ), g ); } vec3 CustomToneMapping( vec3 color ) { return color; }`,lN=`#ifdef USE_TRANSMISSION material.transmission = transmission; material.transmissionAlpha = 1.0; material.thickness = thickness; material.attenuationDistance = attenuationDistance; material.attenuationColor = attenuationColor; #ifdef USE_TRANSMISSIONMAP material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; #endif #ifdef USE_THICKNESSMAP material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; #endif vec3 pos = vWorldPosition; vec3 v = normalize( cameraPosition - pos ); vec3 n = inverseTransformDirection( normal, viewMatrix ); vec4 transmitted = getIBLVolumeRefraction( n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, material.attenuationColor, material.attenuationDistance ); material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); #endif`,cN=`#ifdef USE_TRANSMISSION uniform float transmission; uniform float thickness; uniform float attenuationDistance; uniform vec3 attenuationColor; #ifdef USE_TRANSMISSIONMAP uniform sampler2D transmissionMap; #endif #ifdef USE_THICKNESSMAP uniform sampler2D thicknessMap; #endif uniform vec2 transmissionSamplerSize; uniform sampler2D transmissionSamplerMap; uniform mat4 modelMatrix; uniform mat4 projectionMatrix; varying vec3 vWorldPosition; float w0( float a ) { return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); } float w1( float a ) { return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); } float w2( float a ){ return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); } float w3( float a ) { return ( 1.0 / 6.0 ) * ( a * a * a ); } float g0( float a ) { return w0( a ) + w1( a ); } float g1( float a ) { return w2( a ) + w3( a ); } float h0( float a ) { return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); } float h1( float a ) { return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); } vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { uv = uv * texelSize.zw + 0.5; vec2 iuv = floor( uv ); vec2 fuv = fract( uv ); float g0x = g0( fuv.x ); float g1x = g1( fuv.x ); float h0x = h0( fuv.x ); float h1x = h1( fuv.x ); float h0y = h0( fuv.y ); float h1y = h1( fuv.y ); vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); } vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); vec2 fLodSizeInv = 1.0 / fLodSize; vec2 cLodSizeInv = 1.0 / cLodSize; vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); return mix( fSample, cSample, fract( lod ) ); } vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); vec3 modelScale; modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); return normalize( refractionVector ) * thickness * modelScale; } float applyIorToRoughness( const in float roughness, const in float ior ) { return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); } vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); } vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { if ( isinf( attenuationDistance ) ) { return vec3( 1.0 ); } else { vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; } } vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, const in vec3 attenuationColor, const in float attenuationDistance ) { vec4 transmittedLight; vec3 transmittance; #ifdef USE_DISPERSION float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); for ( int i = 0; i < 3; i ++ ) { vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); vec3 refractedRayExit = position + transmissionRay; vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); vec2 refractionCoords = ndcPos.xy / ndcPos.w; refractionCoords += 1.0; refractionCoords /= 2.0; vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); transmittedLight[ i ] = transmissionSample[ i ]; transmittedLight.a += transmissionSample.a; transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; } transmittedLight.a /= 3.0; #else vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); vec3 refractedRayExit = position + transmissionRay; vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); vec2 refractionCoords = ndcPos.xy / ndcPos.w; refractionCoords += 1.0; refractionCoords /= 2.0; transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); #endif vec3 attenuatedColor = transmittance * transmittedLight.rgb; vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); } #endif`,dN=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP varying vec2 vMapUv; #endif #ifdef USE_ALPHAMAP varying vec2 vAlphaMapUv; #endif #ifdef USE_LIGHTMAP varying vec2 vLightMapUv; #endif #ifdef USE_AOMAP varying vec2 vAoMapUv; #endif #ifdef USE_BUMPMAP varying vec2 vBumpMapUv; #endif #ifdef USE_NORMALMAP varying vec2 vNormalMapUv; #endif #ifdef USE_EMISSIVEMAP varying vec2 vEmissiveMapUv; #endif #ifdef USE_METALNESSMAP varying vec2 vMetalnessMapUv; #endif #ifdef USE_ROUGHNESSMAP varying vec2 vRoughnessMapUv; #endif #ifdef USE_ANISOTROPYMAP varying vec2 vAnisotropyMapUv; #endif #ifdef USE_CLEARCOATMAP varying vec2 vClearcoatMapUv; #endif #ifdef USE_CLEARCOAT_NORMALMAP varying vec2 vClearcoatNormalMapUv; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP varying vec2 vClearcoatRoughnessMapUv; #endif #ifdef USE_IRIDESCENCEMAP varying vec2 vIridescenceMapUv; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP varying vec2 vIridescenceThicknessMapUv; #endif #ifdef USE_SHEEN_COLORMAP varying vec2 vSheenColorMapUv; #endif #ifdef USE_SHEEN_ROUGHNESSMAP varying vec2 vSheenRoughnessMapUv; #endif #ifdef USE_SPECULARMAP varying vec2 vSpecularMapUv; #endif #ifdef USE_SPECULAR_COLORMAP varying vec2 vSpecularColorMapUv; #endif #ifdef USE_SPECULAR_INTENSITYMAP varying vec2 vSpecularIntensityMapUv; #endif #ifdef USE_TRANSMISSIONMAP uniform mat3 transmissionMapTransform; varying vec2 vTransmissionMapUv; #endif #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; #endif`,uN=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP uniform mat3 mapTransform; varying vec2 vMapUv; #endif #ifdef USE_ALPHAMAP uniform mat3 alphaMapTransform; varying vec2 vAlphaMapUv; #endif #ifdef USE_LIGHTMAP uniform mat3 lightMapTransform; varying vec2 vLightMapUv; #endif #ifdef USE_AOMAP uniform mat3 aoMapTransform; varying vec2 vAoMapUv; #endif #ifdef USE_BUMPMAP uniform mat3 bumpMapTransform; varying vec2 vBumpMapUv; #endif #ifdef USE_NORMALMAP uniform mat3 normalMapTransform; varying vec2 vNormalMapUv; #endif #ifdef USE_DISPLACEMENTMAP uniform mat3 displacementMapTransform; varying vec2 vDisplacementMapUv; #endif #ifdef USE_EMISSIVEMAP uniform mat3 emissiveMapTransform; varying vec2 vEmissiveMapUv; #endif #ifdef USE_METALNESSMAP uniform mat3 metalnessMapTransform; varying vec2 vMetalnessMapUv; #endif #ifdef USE_ROUGHNESSMAP uniform mat3 roughnessMapTransform; varying vec2 vRoughnessMapUv; #endif #ifdef USE_ANISOTROPYMAP uniform mat3 anisotropyMapTransform; varying vec2 vAnisotropyMapUv; #endif #ifdef USE_CLEARCOATMAP uniform mat3 clearcoatMapTransform; varying vec2 vClearcoatMapUv; #endif #ifdef USE_CLEARCOAT_NORMALMAP uniform mat3 clearcoatNormalMapTransform; varying vec2 vClearcoatNormalMapUv; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform mat3 clearcoatRoughnessMapTransform; varying vec2 vClearcoatRoughnessMapUv; #endif #ifdef USE_SHEEN_COLORMAP uniform mat3 sheenColorMapTransform; varying vec2 vSheenColorMapUv; #endif #ifdef USE_SHEEN_ROUGHNESSMAP uniform mat3 sheenRoughnessMapTransform; varying vec2 vSheenRoughnessMapUv; #endif #ifdef USE_IRIDESCENCEMAP uniform mat3 iridescenceMapTransform; varying vec2 vIridescenceMapUv; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform mat3 iridescenceThicknessMapTransform; varying vec2 vIridescenceThicknessMapUv; #endif #ifdef USE_SPECULARMAP uniform mat3 specularMapTransform; varying vec2 vSpecularMapUv; #endif #ifdef USE_SPECULAR_COLORMAP uniform mat3 specularColorMapTransform; varying vec2 vSpecularColorMapUv; #endif #ifdef USE_SPECULAR_INTENSITYMAP uniform mat3 specularIntensityMapTransform; varying vec2 vSpecularIntensityMapUv; #endif #ifdef USE_TRANSMISSIONMAP uniform mat3 transmissionMapTransform; varying vec2 vTransmissionMapUv; #endif #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; #endif`,hN=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) vUv = vec3( uv, 1 ).xy; #endif #ifdef USE_MAP vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; #endif #ifdef USE_ALPHAMAP vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; #endif #ifdef USE_LIGHTMAP vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; #endif #ifdef USE_AOMAP vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; #endif #ifdef USE_BUMPMAP vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; #endif #ifdef USE_NORMALMAP vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; #endif #ifdef USE_DISPLACEMENTMAP vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; #endif #ifdef USE_EMISSIVEMAP vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; #endif #ifdef USE_METALNESSMAP vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_ROUGHNESSMAP vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_ANISOTROPYMAP vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; #endif #ifdef USE_CLEARCOATMAP vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; #endif #ifdef USE_CLEARCOAT_NORMALMAP vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_IRIDESCENCEMAP vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_SHEEN_COLORMAP vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; #endif #ifdef USE_SHEEN_ROUGHNESSMAP vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_SPECULARMAP vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; #endif #ifdef USE_SPECULAR_COLORMAP vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; #endif #ifdef USE_SPECULAR_INTENSITYMAP vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; #endif #ifdef USE_TRANSMISSIONMAP vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; #endif #ifdef USE_THICKNESSMAP vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; #endif`,fN=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 vec4 worldPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING worldPosition = batchingMatrix * worldPosition; #endif #ifdef USE_INSTANCING worldPosition = instanceMatrix * worldPosition; #endif worldPosition = modelMatrix * worldPosition; #endif`;const pN=`varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); }`,mN=`uniform sampler2D t2D; uniform float backgroundIntensity; varying vec2 vUv; void main() { vec4 texColor = texture2D( t2D, vUv ); #ifdef DECODE_VIDEO_TEXTURE texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); #endif texColor.rgb *= backgroundIntensity; gl_FragColor = texColor; #include #include }`,_N=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; }`,gN=`#ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #elif defined( ENVMAP_TYPE_CUBE_UV ) uniform sampler2D envMap; #endif uniform float flipEnvMap; uniform float backgroundBlurriness; uniform float backgroundIntensity; uniform mat3 backgroundRotation; varying vec3 vWorldDirection; #include void main() { #ifdef ENVMAP_TYPE_CUBE vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); #elif defined( ENVMAP_TYPE_CUBE_UV ) vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); #else vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); #endif texColor.rgb *= backgroundIntensity; gl_FragColor = texColor; #include #include }`,vN=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; }`,bN=`uniform samplerCube tCube; uniform float tFlip; uniform float opacity; varying vec3 vWorldDirection; void main() { vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); gl_FragColor = texColor; gl_FragColor.a *= opacity; #include #include }`,yN=`#include #include #include #include #include #include #include #include varying vec2 vHighPrecisionZW; void main() { #include #include #include #include #ifdef USE_DISPLACEMENTMAP #include #include #include #endif #include #include #include #include #include #include #include vHighPrecisionZW = gl_Position.zw; }`,xN=`#if DEPTH_PACKING == 3200 uniform float opacity; #endif #include #include #include #include #include #include #include #include #include varying vec2 vHighPrecisionZW; void main() { vec4 diffuseColor = vec4( 1.0 ); #include #if DEPTH_PACKING == 3200 diffuseColor.a = opacity; #endif #include #include #include #include #include float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; #if DEPTH_PACKING == 3200 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); #elif DEPTH_PACKING == 3201 gl_FragColor = packDepthToRGBA( fragCoordZ ); #elif DEPTH_PACKING == 3202 gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); #elif DEPTH_PACKING == 3203 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); #endif }`,SN=`#define DISTANCE varying vec3 vWorldPosition; #include #include #include #include #include #include #include void main() { #include #include #include #include #ifdef USE_DISPLACEMENTMAP #include #include #include #endif #include #include #include #include #include #include #include vWorldPosition = worldPosition.xyz; }`,MN=`#define DISTANCE uniform vec3 referencePosition; uniform float nearDistance; uniform float farDistance; varying vec3 vWorldPosition; #include #include #include #include #include #include #include #include void main () { vec4 diffuseColor = vec4( 1.0 ); #include #include #include #include #include float dist = length( vWorldPosition - referencePosition ); dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); dist = saturate( dist ); gl_FragColor = packDepthToRGBA( dist ); }`,EN=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include }`,wN=`uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { vec3 direction = normalize( vWorldDirection ); vec2 sampleUV = equirectUv( direction ); gl_FragColor = texture2D( tEquirect, sampleUV ); #include #include }`,TN=`uniform float scale; attribute float lineDistance; varying float vLineDistance; #include #include #include #include #include #include #include void main() { vLineDistance = scale * lineDistance; #include #include #include #include #include #include #include #include #include #include }`,CN=`uniform vec3 diffuse; uniform float opacity; uniform float dashSize; uniform float totalSize; varying float vLineDistance; #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include if ( mod( vLineDistance, totalSize ) > dashSize ) { discard; } vec3 outgoingLight = vec3( 0.0 ); #include #include #include outgoingLight = diffuseColor.rgb; #include #include #include #include #include }`,AN=`#include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) #include #include #include #include #include #endif #include #include #include #include #include #include #include #include #include }`,PN=`uniform vec3 diffuse; uniform float opacity; #ifndef FLAT_SHADED varying vec3 vNormal; #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include #include #include #include #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; #else reflectedLight.indirectDiffuse += vec3( 1.0 ); #endif #include reflectedLight.indirectDiffuse *= diffuseColor.rgb; vec3 outgoingLight = reflectedLight.indirectDiffuse; #include #include #include #include #include #include #include }`,RN=`#define LAMBERT varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #include }`,DN=`#define LAMBERT uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; #include #include #include #include #include #include #include }`,IN=`#define MATCAP varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; }`,LN=`#define MATCAP uniform vec3 diffuse; uniform float opacity; uniform sampler2D matcap; varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include #include #include #include #include #include vec3 viewDir = normalize( vViewPosition ); vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); vec3 y = cross( viewDir, x ); vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; #ifdef USE_MATCAP vec4 matcapColor = texture2D( matcap, uv ); #else vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); #endif vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; #include #include #include #include #include #include }`,UN=`#define NORMAL #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; #endif #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) vViewPosition = - mvPosition.xyz; #endif }`,FN=`#define NORMAL uniform float opacity; #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; #endif #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); #include #include #include #include gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a ); #ifdef OPAQUE gl_FragColor.a = 1.0; #endif }`,ON=`#define PHONG varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #include }`,NN=`#define PHONG uniform vec3 diffuse; uniform vec3 emissive; uniform vec3 specular; uniform float shininess; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; #include #include #include #include #include #include #include }`,zN=`#define STANDARD varying vec3 vViewPosition; #ifdef USE_TRANSMISSION varying vec3 vWorldPosition; #endif #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #ifdef USE_TRANSMISSION vWorldPosition = worldPosition.xyz; #endif }`,kN=`#define STANDARD #ifdef PHYSICAL #define IOR #define USE_SPECULAR #endif uniform vec3 diffuse; uniform vec3 emissive; uniform float roughness; uniform float metalness; uniform float opacity; #ifdef IOR uniform float ior; #endif #ifdef USE_SPECULAR uniform float specularIntensity; uniform vec3 specularColor; #ifdef USE_SPECULAR_COLORMAP uniform sampler2D specularColorMap; #endif #ifdef USE_SPECULAR_INTENSITYMAP uniform sampler2D specularIntensityMap; #endif #endif #ifdef USE_CLEARCOAT uniform float clearcoat; uniform float clearcoatRoughness; #endif #ifdef USE_DISPERSION uniform float dispersion; #endif #ifdef USE_IRIDESCENCE uniform float iridescence; uniform float iridescenceIOR; uniform float iridescenceThicknessMinimum; uniform float iridescenceThicknessMaximum; #endif #ifdef USE_SHEEN uniform vec3 sheenColor; uniform float sheenRoughness; #ifdef USE_SHEEN_COLORMAP uniform sampler2D sheenColorMap; #endif #ifdef USE_SHEEN_ROUGHNESSMAP uniform sampler2D sheenRoughnessMap; #endif #endif #ifdef USE_ANISOTROPY uniform vec2 anisotropyVector; #ifdef USE_ANISOTROPYMAP uniform sampler2D anisotropyMap; #endif #endif varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; #include vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; #ifdef USE_SHEEN float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; #endif #ifdef USE_CLEARCOAT float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; #endif #include #include #include #include #include #include }`,BN=`#define TOON varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include }`,VN=`#define TOON uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; #include #include #include #include #include #include }`,HN=`uniform float size; uniform float scale; #include #include #include #include #include #include #ifdef USE_POINTS_UV varying vec2 vUv; uniform mat3 uvTransform; #endif void main() { #ifdef USE_POINTS_UV vUv = ( uvTransform * vec3( uv, 1 ) ).xy; #endif #include #include #include #include #include #include gl_PointSize = size; #ifdef USE_SIZEATTENUATION bool isPerspective = isPerspectiveMatrix( projectionMatrix ); if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); #endif #include #include #include #include }`,$N=`uniform vec3 diffuse; uniform float opacity; #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include vec3 outgoingLight = vec3( 0.0 ); #include #include #include #include #include outgoingLight = diffuseColor.rgb; #include #include #include #include #include }`,GN=`#include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include }`,WN=`uniform vec3 color; uniform float opacity; #include #include #include #include #include #include #include #include void main() { #include gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); #include #include #include }`,XN=`uniform float rotation; uniform vec2 center; #include #include #include #include #include void main() { #include vec4 mvPosition = modelViewMatrix[ 3 ]; vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); #ifndef USE_SIZEATTENUATION bool isPerspective = isPerspectiveMatrix( projectionMatrix ); if ( isPerspective ) scale *= - mvPosition.z; #endif vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; vec2 rotatedPosition; rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; mvPosition.xy += rotatedPosition; gl_Position = projectionMatrix * mvPosition; #include #include #include }`,jN=`uniform vec3 diffuse; uniform float opacity; #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include vec3 outgoingLight = vec3( 0.0 ); #include #include #include #include #include outgoingLight = diffuseColor.rgb; #include #include #include #include }`,it={alphahash_fragment:mF,alphahash_pars_fragment:_F,alphamap_fragment:gF,alphamap_pars_fragment:vF,alphatest_fragment:bF,alphatest_pars_fragment:yF,aomap_fragment:xF,aomap_pars_fragment:SF,batching_pars_vertex:MF,batching_vertex:EF,begin_vertex:wF,beginnormal_vertex:TF,bsdfs:CF,iridescence_fragment:AF,bumpmap_pars_fragment:PF,clipping_planes_fragment:RF,clipping_planes_pars_fragment:DF,clipping_planes_pars_vertex:IF,clipping_planes_vertex:LF,color_fragment:UF,color_pars_fragment:FF,color_pars_vertex:OF,color_vertex:NF,common:zF,cube_uv_reflection_fragment:kF,defaultnormal_vertex:BF,displacementmap_pars_vertex:VF,displacementmap_vertex:HF,emissivemap_fragment:$F,emissivemap_pars_fragment:GF,colorspace_fragment:WF,colorspace_pars_fragment:XF,envmap_fragment:jF,envmap_common_pars_fragment:YF,envmap_pars_fragment:qF,envmap_pars_vertex:ZF,envmap_physical_pars_fragment:aO,envmap_vertex:KF,fog_vertex:JF,fog_pars_vertex:QF,fog_fragment:eO,fog_pars_fragment:tO,gradientmap_pars_fragment:nO,lightmap_pars_fragment:iO,lights_lambert_fragment:sO,lights_lambert_pars_fragment:oO,lights_pars_begin:rO,lights_toon_fragment:lO,lights_toon_pars_fragment:cO,lights_phong_fragment:dO,lights_phong_pars_fragment:uO,lights_physical_fragment:hO,lights_physical_pars_fragment:fO,lights_fragment_begin:pO,lights_fragment_maps:mO,lights_fragment_end:_O,logdepthbuf_fragment:gO,logdepthbuf_pars_fragment:vO,logdepthbuf_pars_vertex:bO,logdepthbuf_vertex:yO,map_fragment:xO,map_pars_fragment:SO,map_particle_fragment:MO,map_particle_pars_fragment:EO,metalnessmap_fragment:wO,metalnessmap_pars_fragment:TO,morphinstance_vertex:CO,morphcolor_vertex:AO,morphnormal_vertex:PO,morphtarget_pars_vertex:RO,morphtarget_vertex:DO,normal_fragment_begin:IO,normal_fragment_maps:LO,normal_pars_fragment:UO,normal_pars_vertex:FO,normal_vertex:OO,normalmap_pars_fragment:NO,clearcoat_normal_fragment_begin:zO,clearcoat_normal_fragment_maps:kO,clearcoat_pars_fragment:BO,iridescence_pars_fragment:VO,opaque_fragment:HO,packing:$O,premultiplied_alpha_fragment:GO,project_vertex:WO,dithering_fragment:XO,dithering_pars_fragment:jO,roughnessmap_fragment:YO,roughnessmap_pars_fragment:qO,shadowmap_pars_fragment:ZO,shadowmap_pars_vertex:KO,shadowmap_vertex:JO,shadowmask_pars_fragment:QO,skinbase_vertex:eN,skinning_pars_vertex:tN,skinning_vertex:nN,skinnormal_vertex:iN,specularmap_fragment:sN,specularmap_pars_fragment:oN,tonemapping_fragment:rN,tonemapping_pars_fragment:aN,transmission_fragment:lN,transmission_pars_fragment:cN,uv_pars_fragment:dN,uv_pars_vertex:uN,uv_vertex:hN,worldpos_vertex:fN,background_vert:pN,background_frag:mN,backgroundCube_vert:_N,backgroundCube_frag:gN,cube_vert:vN,cube_frag:bN,depth_vert:yN,depth_frag:xN,distanceRGBA_vert:SN,distanceRGBA_frag:MN,equirect_vert:EN,equirect_frag:wN,linedashed_vert:TN,linedashed_frag:CN,meshbasic_vert:AN,meshbasic_frag:PN,meshlambert_vert:RN,meshlambert_frag:DN,meshmatcap_vert:IN,meshmatcap_frag:LN,meshnormal_vert:UN,meshnormal_frag:FN,meshphong_vert:ON,meshphong_frag:NN,meshphysical_vert:zN,meshphysical_frag:kN,meshtoon_vert:BN,meshtoon_frag:VN,points_vert:HN,points_frag:$N,shadow_vert:GN,shadow_frag:WN,sprite_vert:XN,sprite_frag:jN},xe={common:{diffuse:{value:new at(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new tt},alphaMap:{value:null},alphaMapTransform:{value:new tt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new tt}},envmap:{envMap:{value:null},envMapRotation:{value:new tt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new tt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new tt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new tt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new tt},normalScale:{value:new Ke(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new tt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new tt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new tt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new tt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new at(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new at(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new tt},alphaTest:{value:0},uvTransform:{value:new tt}},sprite:{diffuse:{value:new at(16777215)},opacity:{value:1},center:{value:new Ke(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new tt},alphaMap:{value:null},alphaMapTransform:{value:new tt},alphaTest:{value:0}}},jn={basic:{uniforms:rn([xe.common,xe.specularmap,xe.envmap,xe.aomap,xe.lightmap,xe.fog]),vertexShader:it.meshbasic_vert,fragmentShader:it.meshbasic_frag},lambert:{uniforms:rn([xe.common,xe.specularmap,xe.envmap,xe.aomap,xe.lightmap,xe.emissivemap,xe.bumpmap,xe.normalmap,xe.displacementmap,xe.fog,xe.lights,{emissive:{value:new at(0)}}]),vertexShader:it.meshlambert_vert,fragmentShader:it.meshlambert_frag},phong:{uniforms:rn([xe.common,xe.specularmap,xe.envmap,xe.aomap,xe.lightmap,xe.emissivemap,xe.bumpmap,xe.normalmap,xe.displacementmap,xe.fog,xe.lights,{emissive:{value:new at(0)},specular:{value:new at(1118481)},shininess:{value:30}}]),vertexShader:it.meshphong_vert,fragmentShader:it.meshphong_frag},standard:{uniforms:rn([xe.common,xe.envmap,xe.aomap,xe.lightmap,xe.emissivemap,xe.bumpmap,xe.normalmap,xe.displacementmap,xe.roughnessmap,xe.metalnessmap,xe.fog,xe.lights,{emissive:{value:new at(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:it.meshphysical_vert,fragmentShader:it.meshphysical_frag},toon:{uniforms:rn([xe.common,xe.aomap,xe.lightmap,xe.emissivemap,xe.bumpmap,xe.normalmap,xe.displacementmap,xe.gradientmap,xe.fog,xe.lights,{emissive:{value:new at(0)}}]),vertexShader:it.meshtoon_vert,fragmentShader:it.meshtoon_frag},matcap:{uniforms:rn([xe.common,xe.bumpmap,xe.normalmap,xe.displacementmap,xe.fog,{matcap:{value:null}}]),vertexShader:it.meshmatcap_vert,fragmentShader:it.meshmatcap_frag},points:{uniforms:rn([xe.points,xe.fog]),vertexShader:it.points_vert,fragmentShader:it.points_frag},dashed:{uniforms:rn([xe.common,xe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:it.linedashed_vert,fragmentShader:it.linedashed_frag},depth:{uniforms:rn([xe.common,xe.displacementmap]),vertexShader:it.depth_vert,fragmentShader:it.depth_frag},normal:{uniforms:rn([xe.common,xe.bumpmap,xe.normalmap,xe.displacementmap,{opacity:{value:1}}]),vertexShader:it.meshnormal_vert,fragmentShader:it.meshnormal_frag},sprite:{uniforms:rn([xe.sprite,xe.fog]),vertexShader:it.sprite_vert,fragmentShader:it.sprite_frag},background:{uniforms:{uvTransform:{value:new tt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:it.background_vert,fragmentShader:it.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new tt}},vertexShader:it.backgroundCube_vert,fragmentShader:it.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:it.cube_vert,fragmentShader:it.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:it.equirect_vert,fragmentShader:it.equirect_frag},distanceRGBA:{uniforms:rn([xe.common,xe.displacementmap,{referencePosition:{value:new U},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:it.distanceRGBA_vert,fragmentShader:it.distanceRGBA_frag},shadow:{uniforms:rn([xe.lights,xe.fog,{color:{value:new at(0)},opacity:{value:1}}]),vertexShader:it.shadow_vert,fragmentShader:it.shadow_frag}};jn.physical={uniforms:rn([jn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new tt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new tt},clearcoatNormalScale:{value:new Ke(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new tt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new tt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new tt},sheen:{value:0},sheenColor:{value:new at(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new tt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new tt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new tt},transmissionSamplerSize:{value:new Ke},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new tt},attenuationDistance:{value:0},attenuationColor:{value:new at(0)},specularColor:{value:new at(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new tt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new tt},anisotropyVector:{value:new Ke},anisotropyMap:{value:null},anisotropyMapTransform:{value:new tt}}]),vertexShader:it.meshphysical_vert,fragmentShader:it.meshphysical_frag};const Vr={r:0,b:0,g:0},Qi=new Vn,YN=new Tt;function qN(t,e,n,i,s,o,r){const a=new at(0);let l=o===!0?0:1,d,u,f=null,h=0,m=null;function b(w){let S=w.isScene===!0?w.background:null;return S&&S.isTexture&&(S=(w.backgroundBlurriness>0?n:e).get(S)),S}function y(w){let S=!1;const I=b(w);I===null?p(a,l):I&&I.isColor&&(p(I,1),S=!0);const P=t.xr.getEnvironmentBlendMode();P==="additive"?i.buffers.color.setClear(0,0,0,1,r):P==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,r),(t.autoClear||S)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))}function _(w,S){const I=b(S);I&&(I.isCubeTexture||I.mapping===La)?(u===void 0&&(u=new Ae(new Ot(1,1,1),new Hi({name:"BackgroundCubeMaterial",uniforms:co(jn.backgroundCube.uniforms),vertexShader:jn.backgroundCube.vertexShader,fragmentShader:jn.backgroundCube.fragmentShader,side:un,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(P,D,R){this.matrixWorld.copyPosition(R.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(u)),Qi.copy(S.backgroundRotation),Qi.x*=-1,Qi.y*=-1,Qi.z*=-1,I.isCubeTexture&&I.isRenderTargetTexture===!1&&(Qi.y*=-1,Qi.z*=-1),u.material.uniforms.envMap.value=I,u.material.uniforms.flipEnvMap.value=I.isCubeTexture&&I.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=S.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=S.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(YN.makeRotationFromEuler(Qi)),u.material.toneMapped=ft.getTransfer(I.colorSpace)!==bt,(f!==I||h!==I.version||m!==t.toneMapping)&&(u.material.needsUpdate=!0,f=I,h=I.version,m=t.toneMapping),u.layers.enableAll(),w.unshift(u,u.geometry,u.material,0,0,null)):I&&I.isTexture&&(d===void 0&&(d=new Ae(new bo(2,2),new Hi({name:"BackgroundMaterial",uniforms:co(jn.background.uniforms),vertexShader:jn.background.vertexShader,fragmentShader:jn.background.fragmentShader,side:Vi,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),d.geometry.deleteAttribute("normal"),Object.defineProperty(d.material,"map",{get:function(){return this.uniforms.t2D.value}}),s.update(d)),d.material.uniforms.t2D.value=I,d.material.uniforms.backgroundIntensity.value=S.backgroundIntensity,d.material.toneMapped=ft.getTransfer(I.colorSpace)!==bt,I.matrixAutoUpdate===!0&&I.updateMatrix(),d.material.uniforms.uvTransform.value.copy(I.matrix),(f!==I||h!==I.version||m!==t.toneMapping)&&(d.material.needsUpdate=!0,f=I,h=I.version,m=t.toneMapping),d.layers.enableAll(),w.unshift(d,d.geometry,d.material,0,0,null))}function p(w,S){w.getRGB(Vr,Pp(t)),i.buffers.color.setClear(Vr.r,Vr.g,Vr.b,S,r)}function T(){u!==void 0&&(u.geometry.dispose(),u.material.dispose(),u=void 0),d!==void 0&&(d.geometry.dispose(),d.material.dispose(),d=void 0)}return{getClearColor:function(){return a},setClearColor:function(w,S=1){a.set(w),l=S,p(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(w){l=w,p(a,l)},render:y,addToRenderList:_,dispose:T}}function ZN(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),i={},s=h(null);let o=s,r=!1;function a(g,L,O,H,j){let re=!1;const q=f(H,O,L);o!==q&&(o=q,d(o.object)),re=m(g,H,O,j),re&&b(g,H,O,j),j!==null&&e.update(j,t.ELEMENT_ARRAY_BUFFER),(re||r)&&(r=!1,S(g,L,O,H),j!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(j).buffer))}function l(){return t.createVertexArray()}function d(g){return t.bindVertexArray(g)}function u(g){return t.deleteVertexArray(g)}function f(g,L,O){const H=O.wireframe===!0;let j=i[g.id];j===void 0&&(j={},i[g.id]=j);let re=j[L.id];re===void 0&&(re={},j[L.id]=re);let q=re[H];return q===void 0&&(q=h(l()),re[H]=q),q}function h(g){const L=[],O=[],H=[];for(let j=0;j=0){const ye=j[G];let Re=re[G];if(Re===void 0&&(G==="instanceMatrix"&&g.instanceMatrix&&(Re=g.instanceMatrix),G==="instanceColor"&&g.instanceColor&&(Re=g.instanceColor)),ye===void 0||ye.attribute!==Re||Re&&ye.data!==Re.data)return!0;q++}return o.attributesNum!==q||o.index!==H}function b(g,L,O,H){const j={},re=L.attributes;let q=0;const ae=O.getAttributes();for(const G in ae)if(ae[G].location>=0){let ye=re[G];ye===void 0&&(G==="instanceMatrix"&&g.instanceMatrix&&(ye=g.instanceMatrix),G==="instanceColor"&&g.instanceColor&&(ye=g.instanceColor));const Re={};Re.attribute=ye,ye&&ye.data&&(Re.data=ye.data),j[G]=Re,q++}o.attributes=j,o.attributesNum=q,o.index=H}function y(){const g=o.newAttributes;for(let L=0,O=g.length;L=0){let fe=j[ae];if(fe===void 0&&(ae==="instanceMatrix"&&g.instanceMatrix&&(fe=g.instanceMatrix),ae==="instanceColor"&&g.instanceColor&&(fe=g.instanceColor)),fe!==void 0){const ye=fe.normalized,Re=fe.itemSize,Be=e.get(fe);if(Be===void 0)continue;const Je=Be.buffer,ce=Be.type,N=Be.bytesPerElement,le=ce===t.INT||ce===t.UNSIGNED_INT||fe.gpuType===sd;if(fe.isInterleavedBufferAttribute){const Y=fe.data,ue=Y.stride,Oe=fe.offset;if(Y.isInstancedInterleavedBuffer){for(let Se=0;Se0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";D="mediump"}return D==="mediump"&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let d=n.precision!==void 0?n.precision:"highp";const u=l(d);u!==d&&(console.warn("THREE.WebGLRenderer:",d,"not supported, using",u,"instead."),d=u);const f=n.logarithmicDepthBuffer===!0,h=n.reverseDepthBuffer===!0&&e.has("EXT_clip_control"),m=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),b=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),y=t.getParameter(t.MAX_TEXTURE_SIZE),_=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),p=t.getParameter(t.MAX_VERTEX_ATTRIBS),T=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),w=t.getParameter(t.MAX_VARYING_VECTORS),S=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),I=b>0,P=t.getParameter(t.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:o,getMaxPrecision:l,textureFormatReadable:r,textureTypeReadable:a,precision:d,logarithmicDepthBuffer:f,reverseDepthBuffer:h,maxTextures:m,maxVertexTextures:b,maxTextureSize:y,maxCubemapSize:_,maxAttributes:p,maxVertexUniforms:T,maxVaryings:w,maxFragmentUniforms:S,vertexTextures:I,maxSamples:P}}function QN(t){const e=this;let n=null,i=0,s=!1,o=!1;const r=new Di,a=new tt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,h){const m=f.length!==0||h||i!==0||s;return s=h,i=f.length,m},this.beginShadows=function(){o=!0,u(null)},this.endShadows=function(){o=!1},this.setGlobalState=function(f,h){n=u(f,h,0)},this.setState=function(f,h,m){const b=f.clippingPlanes,y=f.clipIntersection,_=f.clipShadows,p=t.get(f);if(!s||b===null||b.length===0||o&&!_)o?u(null):d();else{const T=o?0:i,w=T*4;let S=p.clippingState||null;l.value=S,S=u(b,h,w,m);for(let I=0;I!==w;++I)S[I]=n[I];p.clippingState=S,this.numIntersection=y?this.numPlanes:0,this.numPlanes+=T}};function d(){l.value!==n&&(l.value=n,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function u(f,h,m,b){const y=f!==null?f.length:0;let _=null;if(y!==0){if(_=l.value,b!==!0||_===null){const p=m+y*4,T=h.matrixWorldInverse;a.getNormalMatrix(T),(_===null||_.length0){const d=new qU(l.height);return d.fromEquirectangularTexture(t,r),e.set(r,d),r.addEventListener("dispose",s),n(d.texture,r.mapping)}else return null}}return r}function s(r){const a=r.target;a.removeEventListener("dispose",s);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function o(){e=new WeakMap}return{get:i,dispose:o}}const Xs=4,lh=[.125,.215,.35,.446,.526,.582],ds=20,bl=new aF,ch=new at;let yl=null,xl=0,Sl=0,Ml=!1;const ss=(1+Math.sqrt(5))/2,ks=1/ss,dh=[new U(-ss,ks,0),new U(ss,ks,0),new U(-ks,0,ss),new U(ks,0,ss),new U(0,ss,-ks),new U(0,ss,ks),new U(-1,1,-1),new U(1,1,-1),new U(-1,1,1),new U(1,1,1)],tz=new U;class uh{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,n=0,i=.1,s=100,o={}){const{size:r=256,position:a=tz}=o;yl=this._renderer.getRenderTarget(),xl=this._renderer.getActiveCubeFace(),Sl=this._renderer.getActiveMipmapLevel(),Ml=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(r);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,i,s,l,a),n>0&&this._blur(l,0,0,n),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=ph(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=fh(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?S:0,S,S),f.setRenderTarget(s),_&&f.render(y,l),f.render(e,l)}y.geometry.dispose(),y.material.dispose(),f.toneMapping=m,f.autoClear=h,e.background=p}_textureToCubeUV(e,n){const i=this._renderer,s=e.mapping===oo||e.mapping===ro;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=ph()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=fh());const o=s?this._cubemapMaterial:this._equirectMaterial,r=new Ae(this._lodPlanes[0],o),a=o.uniforms;a.envMap.value=e;const l=this._cubeSize;Hr(n,0,0,3*l,2*l),i.setRenderTarget(n),i.render(r,bl)}_applyPMREM(e){const n=this._renderer,i=n.autoClear;n.autoClear=!1;const s=this._lodPlanes.length;for(let o=1;ods&&console.warn(`sigmaRadians, ${o}, is too large and will clip, as it requested ${_} samples when the maximum is set to ${ds}`);const p=[];let T=0;for(let D=0;Dw-Xs?s-w+Xs:0),P=4*(this._cubeSize-S);Hr(n,I,P,3*S,2*S),l.setRenderTarget(n),l.render(f,bl)}}function nz(t){const e=[],n=[],i=[];let s=t;const o=t-Xs+1+lh.length;for(let r=0;rt-Xs?l=lh[r-t+Xs-1]:r===0&&(l=0),i.push(l);const d=1/(a-2),u=-d,f=1+d,h=[u,u,f,u,f,f,u,u,f,f,u,f],m=6,b=6,y=3,_=2,p=1,T=new Float32Array(y*b*m),w=new Float32Array(_*b*m),S=new Float32Array(p*b*m);for(let P=0;P2?0:-1,E=[D,R,0,D+2/3,R,0,D+2/3,R+1,0,D,R,0,D+2/3,R+1,0,D,R+1,0];T.set(E,y*b*P),w.set(h,_*b*P);const g=[P,P,P,P,P,P];S.set(g,p*b*P)}const I=new tn;I.setAttribute("position",new Jn(T,y)),I.setAttribute("uv",new Jn(w,_)),I.setAttribute("faceIndex",new Jn(S,p)),e.push(I),s>Xs&&s--}return{lodPlanes:e,sizeLods:n,sigmas:i}}function hh(t,e,n){const i=new vs(t,e,n);return i.texture.mapping=La,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Hr(t,e,n,i,s){t.viewport.set(e,n,i,s),t.scissor.set(e,n,i,s)}function iz(t,e,n){const i=new Float32Array(ds),s=new U(0,1,0);return new Hi({name:"SphericalGaussianBlur",defines:{n:ds,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:s}},vertexShader:vd(),fragmentShader:` precision mediump float; precision mediump int; varying vec3 vOutputDirection; uniform sampler2D envMap; uniform int samples; uniform float weights[ n ]; uniform bool latitudinal; uniform float dTheta; uniform float mipInt; uniform vec3 poleAxis; #define ENVMAP_TYPE_CUBE_UV #include vec3 getSample( float theta, vec3 axis ) { float cosTheta = cos( theta ); // Rodrigues' axis-angle rotation vec3 sampleDirection = vOutputDirection * cosTheta + cross( axis, vOutputDirection ) * sin( theta ) + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); return bilinearCubeUV( envMap, sampleDirection, mipInt ); } void main() { vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); if ( all( equal( axis, vec3( 0.0 ) ) ) ) { axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); } axis = normalize( axis ); gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); for ( int i = 1; i < n; i++ ) { if ( i >= samples ) { break; } float theta = dTheta * float( i ); gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); } } `,blending:Ni,depthTest:!1,depthWrite:!1})}function fh(){return new Hi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:vd(),fragmentShader:` precision mediump float; precision mediump int; varying vec3 vOutputDirection; uniform sampler2D envMap; #include void main() { vec3 outputDirection = normalize( vOutputDirection ); vec2 uv = equirectUv( outputDirection ); gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); } `,blending:Ni,depthTest:!1,depthWrite:!1})}function ph(){return new Hi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:vd(),fragmentShader:` precision mediump float; precision mediump int; uniform float flipEnvMap; varying vec3 vOutputDirection; uniform samplerCube envMap; void main() { gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); } `,blending:Ni,depthTest:!1,depthWrite:!1})}function vd(){return` precision mediump float; precision mediump int; attribute float faceIndex; varying vec3 vOutputDirection; // RH coordinate system; PMREM face-indexing convention vec3 getDirection( vec2 uv, float face ) { uv = 2.0 * uv - 1.0; vec3 direction = vec3( uv, 1.0 ); if ( face == 0.0 ) { direction = direction.zyx; // ( 1, v, u ) pos x } else if ( face == 1.0 ) { direction = direction.xzy; direction.xz *= -1.0; // ( -u, 1, -v ) pos y } else if ( face == 2.0 ) { direction.x *= -1.0; // ( -u, v, 1 ) pos z } else if ( face == 3.0 ) { direction = direction.zyx; direction.xz *= -1.0; // ( -1, v, -u ) neg x } else if ( face == 4.0 ) { direction = direction.xzy; direction.xy *= -1.0; // ( -u, -1, v ) neg y } else if ( face == 5.0 ) { direction.z *= -1.0; // ( u, v, -1 ) neg z } return direction; } void main() { vOutputDirection = getDirection( uv, faceIndex ); gl_Position = vec4( position, 1.0 ); } `}function sz(t){let e=new WeakMap,n=null;function i(a){if(a&&a.isTexture){const l=a.mapping,d=l===nc||l===ic,u=l===oo||l===ro;if(d||u){let f=e.get(a);const h=f!==void 0?f.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==h)return n===null&&(n=new uh(t)),f=d?n.fromEquirectangular(a,f):n.fromCubemap(a,f),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),f.texture;if(f!==void 0)return f.texture;{const m=a.image;return d&&m&&m.height>0||u&&m&&s(m)?(n===null&&(n=new uh(t)),f=d?n.fromEquirectangular(a):n.fromCubemap(a),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),a.addEventListener("dispose",o),f.texture):null}}}return a}function s(a){let l=0;const d=6;for(let u=0;ue.maxTextureSize&&(I=Math.ceil(S/e.maxTextureSize),S=e.maxTextureSize);const P=new Float32Array(S*I*4*f),D=new wp(P,S,I,f);D.type=ui,D.needsUpdate=!0;const R=w*4;for(let g=0;g0)return t;const s=e*n;let o=_h[s];if(o===void 0&&(o=new Float32Array(s),_h[s]=o),e!==0){i.toArray(o,0);for(let r=1,a=0;r!==e;++r)a+=n,t[r].toArray(o,a)}return o}function Bt(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n":" "} ${a}: ${n[r]}`)}return i.join(` `)}const Mh=new tt;function sk(t){ft._getMatrix(Mh,ft.workingColorSpace,t);const e=`mat3( ${Mh.elements.map(n=>n.toFixed(4))} )`;switch(ft.getTransfer(t)){case fa:return[e,"LinearTransferOETF"];case bt:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",t),[e,"LinearTransferOETF"]}}function Eh(t,e,n){const i=t.getShaderParameter(e,t.COMPILE_STATUS),s=t.getShaderInfoLog(e).trim();if(i&&s==="")return"";const o=/ERROR: 0:(\d+)/.exec(s);if(o){const r=parseInt(o[1]);return n.toUpperCase()+` `+s+` `+ik(t.getShaderSource(e),r)}else return s}function ok(t,e){const n=sk(e);return[`vec4 ${t}( vec4 value ) {`,` return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join(` `)}function rk(t,e){let n;switch(e){case HL:n="Linear";break;case $L:n="Reinhard";break;case GL:n="Cineon";break;case WL:n="ACESFilmic";break;case jL:n="AgX";break;case YL:n="Neutral";break;case XL:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const $r=new U;function ak(){ft.getLuminanceCoefficients($r);const t=$r.x.toFixed(4),e=$r.y.toFixed(4),n=$r.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${t}, ${e}, ${n} );`," return dot( weights, rgb );","}"].join(` `)}function lk(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Fo).join(` `)}function ck(t){const e=[];for(const n in t){const i=t[n];i!==!1&&e.push("#define "+n+" "+i)}return e.join(` `)}function dk(t,e){const n={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let s=0;s/gm;function Lc(t){return t.replace(uk,fk)}const hk=new Map;function fk(t,e){let n=it[e];if(n===void 0){const i=hk.get(e);if(i!==void 0)n=it[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return Lc(n)}const pk=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Ch(t){return t.replace(pk,mk)}function mk(t,e,n,i){let s="";for(let o=parseInt(e);o0&&(_+=` `),p=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b].filter(Fo).join(` `),p.length>0&&(p+=` `)):(_=[Ah(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+u:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` `].filter(Fo).join(` `),p=[Ah(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",n.envMap?"#define "+u:"",n.envMap?"#define "+f:"",h?"#define CUBEUV_TEXEL_WIDTH "+h.texelWidth:"",h?"#define CUBEUV_TEXEL_HEIGHT "+h.texelHeight:"",h?"#define CUBEUV_MAX_MIP "+h.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==zi?"#define TONE_MAPPING":"",n.toneMapping!==zi?it.tonemapping_pars_fragment:"",n.toneMapping!==zi?rk("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",it.colorspace_pars_fragment,ok("linearToOutputTexel",n.outputColorSpace),ak(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",` `].filter(Fo).join(` `)),r=Lc(r),r=wh(r,n),r=Th(r,n),a=Lc(a),a=wh(a,n),a=Th(a,n),r=Ch(r),a=Ch(a),n.isRawShaderMaterial!==!0&&(T=`#version 300 es `,_=[m,"#define attribute in","#define varying out","#define texture2D texture"].join(` `)+` `+_,p=["#define varying in",n.glslVersion===Lu?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===Lu?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` `)+` `+p);const w=T+_+r,S=T+p+a,I=Sh(s,s.VERTEX_SHADER,w),P=Sh(s,s.FRAGMENT_SHADER,S);s.attachShader(y,I),s.attachShader(y,P),n.index0AttributeName!==void 0?s.bindAttribLocation(y,0,n.index0AttributeName):n.morphTargets===!0&&s.bindAttribLocation(y,0,"position"),s.linkProgram(y);function D(L){if(t.debug.checkShaderErrors){const O=s.getProgramInfoLog(y).trim(),H=s.getShaderInfoLog(I).trim(),j=s.getShaderInfoLog(P).trim();let re=!0,q=!0;if(s.getProgramParameter(y,s.LINK_STATUS)===!1)if(re=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(s,y,I,P);else{const ae=Eh(s,I,"vertex"),G=Eh(s,P,"fragment");console.error("THREE.WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(y,s.VALIDATE_STATUS)+` Material Name: `+L.name+` Material Type: `+L.type+` Program Info Log: `+O+` `+ae+` `+G)}else O!==""?console.warn("THREE.WebGLProgram: Program Info Log:",O):(H===""||j==="")&&(q=!1);q&&(L.diagnostics={runnable:re,programLog:O,vertexShader:{log:H,prefix:_},fragmentShader:{log:j,prefix:p}})}s.deleteShader(I),s.deleteShader(P),R=new sa(s,y),E=dk(s,y)}let R;this.getUniforms=function(){return R===void 0&&D(this),R};let E;this.getAttributes=function(){return E===void 0&&D(this),E};let g=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return g===!1&&(g=s.getProgramParameter(y,tk)),g},this.destroy=function(){i.releaseStatesOfProgram(this),s.deleteProgram(y),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=nk++,this.cacheKey=e,this.usedTimes=1,this.program=y,this.vertexShader=I,this.fragmentShader=P,this}let Sk=0;class Mk{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,i=e.fragmentShader,s=this._getShaderStage(n),o=this._getShaderStage(i),r=this._getShaderCacheForMaterial(e);return r.has(s)===!1&&(r.add(s),s.usedTimes++),r.has(o)===!1&&(r.add(o),o.usedTimes++),this}remove(e){const n=this.materialCache.get(e);for(const i of n)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const n=this.materialCache;let i=n.get(e);return i===void 0&&(i=new Set,n.set(e,i)),i}_getShaderStage(e){const n=this.shaderCache;let i=n.get(e);return i===void 0&&(i=new Ek(e),n.set(e,i)),i}}class Ek{constructor(e){this.id=Sk++,this.code=e,this.usedTimes=0}}function wk(t,e,n,i,s,o,r){const a=new hd,l=new Mk,d=new Set,u=[],f=s.logarithmicDepthBuffer,h=s.vertexTextures;let m=s.precision;const b={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function y(E){return d.add(E),E===0?"uv":`uv${E}`}function _(E,g,L,O,H){const j=O.fog,re=H.geometry,q=E.isMeshStandardMaterial?O.environment:null,ae=(E.isMeshStandardMaterial?n:e).get(E.envMap||q),G=!!ae&&ae.mapping===La?ae.image.height:null,fe=b[E.type];E.precision!==null&&(m=s.getMaxPrecision(E.precision),m!==E.precision&&console.warn("THREE.WebGLProgram.getParameters:",E.precision,"not supported, using",m,"instead."));const ye=re.morphAttributes.position||re.morphAttributes.normal||re.morphAttributes.color,Re=ye!==void 0?ye.length:0;let Be=0;re.morphAttributes.position!==void 0&&(Be=1),re.morphAttributes.normal!==void 0&&(Be=2),re.morphAttributes.color!==void 0&&(Be=3);let Je,ce,N,le;if(fe){const vt=jn[fe];Je=vt.vertexShader,ce=vt.fragmentShader}else Je=E.vertexShader,ce=E.fragmentShader,l.update(E),N=l.getVertexShaderID(E),le=l.getFragmentShaderID(E);const Y=t.getRenderTarget(),ue=t.state.buffers.depth.getReversed(),Oe=H.isInstancedMesh===!0,Se=H.isBatchedMesh===!0,Ne=!!E.map,Ue=!!E.matcap,A=!!ae,x=!!E.aoMap,Z=!!E.lightMap,ie=!!E.bumpMap,te=!!E.normalMap,ne=!!E.displacementMap,me=!!E.emissiveMap,Q=!!E.metalnessMap,M=!!E.roughnessMap,v=E.anisotropy>0,F=E.clearcoat>0,B=E.dispersion>0,X=E.iridescence>0,$=E.sheen>0,ge=E.transmission>0,pe=v&&!!E.anisotropyMap,be=F&&!!E.clearcoatMap,Me=F&&!!E.clearcoatNormalMap,he=F&&!!E.clearcoatRoughnessMap,Ce=X&&!!E.iridescenceMap,Xe=X&&!!E.iridescenceThicknessMap,$e=$&&!!E.sheenColorMap,De=$&&!!E.sheenRoughnessMap,Ye=!!E.specularMap,Ge=!!E.specularColorMap,gt=!!E.specularIntensityMap,z=ge&&!!E.transmissionMap,we=ge&&!!E.thicknessMap,oe=!!E.gradientMap,de=!!E.alphaMap,Pe=E.alphaTest>0,Te=!!E.alphaHash,Qe=!!E.extensions;let Rt=zi;E.toneMapped&&(Y===null||Y.isXRRenderTarget===!0)&&(Rt=t.toneMapping);const Yt={shaderID:fe,shaderType:E.type,shaderName:E.name,vertexShader:Je,fragmentShader:ce,defines:E.defines,customVertexShaderID:N,customFragmentShaderID:le,isRawShaderMaterial:E.isRawShaderMaterial===!0,glslVersion:E.glslVersion,precision:m,batching:Se,batchingColor:Se&&H._colorsTexture!==null,instancing:Oe,instancingColor:Oe&&H.instanceColor!==null,instancingMorph:Oe&&H.morphTexture!==null,supportsVertexTextures:h,outputColorSpace:Y===null?t.outputColorSpace:Y.isXRRenderTarget===!0?Y.texture.colorSpace:ao,alphaToCoverage:!!E.alphaToCoverage,map:Ne,matcap:Ue,envMap:A,envMapMode:A&&ae.mapping,envMapCubeUVHeight:G,aoMap:x,lightMap:Z,bumpMap:ie,normalMap:te,displacementMap:h&&ne,emissiveMap:me,normalMapObjectSpace:te&&E.normalMapType===JL,normalMapTangentSpace:te&&E.normalMapType===Sp,metalnessMap:Q,roughnessMap:M,anisotropy:v,anisotropyMap:pe,clearcoat:F,clearcoatMap:be,clearcoatNormalMap:Me,clearcoatRoughnessMap:he,dispersion:B,iridescence:X,iridescenceMap:Ce,iridescenceThicknessMap:Xe,sheen:$,sheenColorMap:$e,sheenRoughnessMap:De,specularMap:Ye,specularColorMap:Ge,specularIntensityMap:gt,transmission:ge,transmissionMap:z,thicknessMap:we,gradientMap:oe,opaque:E.transparent===!1&&E.blending===Ks&&E.alphaToCoverage===!1,alphaMap:de,alphaTest:Pe,alphaHash:Te,combine:E.combine,mapUv:Ne&&y(E.map.channel),aoMapUv:x&&y(E.aoMap.channel),lightMapUv:Z&&y(E.lightMap.channel),bumpMapUv:ie&&y(E.bumpMap.channel),normalMapUv:te&&y(E.normalMap.channel),displacementMapUv:ne&&y(E.displacementMap.channel),emissiveMapUv:me&&y(E.emissiveMap.channel),metalnessMapUv:Q&&y(E.metalnessMap.channel),roughnessMapUv:M&&y(E.roughnessMap.channel),anisotropyMapUv:pe&&y(E.anisotropyMap.channel),clearcoatMapUv:be&&y(E.clearcoatMap.channel),clearcoatNormalMapUv:Me&&y(E.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:he&&y(E.clearcoatRoughnessMap.channel),iridescenceMapUv:Ce&&y(E.iridescenceMap.channel),iridescenceThicknessMapUv:Xe&&y(E.iridescenceThicknessMap.channel),sheenColorMapUv:$e&&y(E.sheenColorMap.channel),sheenRoughnessMapUv:De&&y(E.sheenRoughnessMap.channel),specularMapUv:Ye&&y(E.specularMap.channel),specularColorMapUv:Ge&&y(E.specularColorMap.channel),specularIntensityMapUv:gt&&y(E.specularIntensityMap.channel),transmissionMapUv:z&&y(E.transmissionMap.channel),thicknessMapUv:we&&y(E.thicknessMap.channel),alphaMapUv:de&&y(E.alphaMap.channel),vertexTangents:!!re.attributes.tangent&&(te||v),vertexColors:E.vertexColors,vertexAlphas:E.vertexColors===!0&&!!re.attributes.color&&re.attributes.color.itemSize===4,pointsUvs:H.isPoints===!0&&!!re.attributes.uv&&(Ne||de),fog:!!j,useFog:E.fog===!0,fogExp2:!!j&&j.isFogExp2,flatShading:E.flatShading===!0,sizeAttenuation:E.sizeAttenuation===!0,logarithmicDepthBuffer:f,reverseDepthBuffer:ue,skinning:H.isSkinnedMesh===!0,morphTargets:re.morphAttributes.position!==void 0,morphNormals:re.morphAttributes.normal!==void 0,morphColors:re.morphAttributes.color!==void 0,morphTargetsCount:Re,morphTextureStride:Be,numDirLights:g.directional.length,numPointLights:g.point.length,numSpotLights:g.spot.length,numSpotLightMaps:g.spotLightMap.length,numRectAreaLights:g.rectArea.length,numHemiLights:g.hemi.length,numDirLightShadows:g.directionalShadowMap.length,numPointLightShadows:g.pointShadowMap.length,numSpotLightShadows:g.spotShadowMap.length,numSpotLightShadowsWithMaps:g.numSpotLightShadowsWithMaps,numLightProbes:g.numLightProbes,numClippingPlanes:r.numPlanes,numClipIntersection:r.numIntersection,dithering:E.dithering,shadowMapEnabled:t.shadowMap.enabled&&L.length>0,shadowMapType:t.shadowMap.type,toneMapping:Rt,decodeVideoTexture:Ne&&E.map.isVideoTexture===!0&&ft.getTransfer(E.map.colorSpace)===bt,decodeVideoTextureEmissive:me&&E.emissiveMap.isVideoTexture===!0&&ft.getTransfer(E.emissiveMap.colorSpace)===bt,premultipliedAlpha:E.premultipliedAlpha,doubleSided:E.side===Fn,flipSided:E.side===un,useDepthPacking:E.depthPacking>=0,depthPacking:E.depthPacking||0,index0AttributeName:E.index0AttributeName,extensionClipCullDistance:Qe&&E.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Qe&&E.extensions.multiDraw===!0||Se)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:E.customProgramCacheKey()};return Yt.vertexUv1s=d.has(1),Yt.vertexUv2s=d.has(2),Yt.vertexUv3s=d.has(3),d.clear(),Yt}function p(E){const g=[];if(E.shaderID?g.push(E.shaderID):(g.push(E.customVertexShaderID),g.push(E.customFragmentShaderID)),E.defines!==void 0)for(const L in E.defines)g.push(L),g.push(E.defines[L]);return E.isRawShaderMaterial===!1&&(T(g,E),w(g,E),g.push(t.outputColorSpace)),g.push(E.customProgramCacheKey),g.join()}function T(E,g){E.push(g.precision),E.push(g.outputColorSpace),E.push(g.envMapMode),E.push(g.envMapCubeUVHeight),E.push(g.mapUv),E.push(g.alphaMapUv),E.push(g.lightMapUv),E.push(g.aoMapUv),E.push(g.bumpMapUv),E.push(g.normalMapUv),E.push(g.displacementMapUv),E.push(g.emissiveMapUv),E.push(g.metalnessMapUv),E.push(g.roughnessMapUv),E.push(g.anisotropyMapUv),E.push(g.clearcoatMapUv),E.push(g.clearcoatNormalMapUv),E.push(g.clearcoatRoughnessMapUv),E.push(g.iridescenceMapUv),E.push(g.iridescenceThicknessMapUv),E.push(g.sheenColorMapUv),E.push(g.sheenRoughnessMapUv),E.push(g.specularMapUv),E.push(g.specularColorMapUv),E.push(g.specularIntensityMapUv),E.push(g.transmissionMapUv),E.push(g.thicknessMapUv),E.push(g.combine),E.push(g.fogExp2),E.push(g.sizeAttenuation),E.push(g.morphTargetsCount),E.push(g.morphAttributeCount),E.push(g.numDirLights),E.push(g.numPointLights),E.push(g.numSpotLights),E.push(g.numSpotLightMaps),E.push(g.numHemiLights),E.push(g.numRectAreaLights),E.push(g.numDirLightShadows),E.push(g.numPointLightShadows),E.push(g.numSpotLightShadows),E.push(g.numSpotLightShadowsWithMaps),E.push(g.numLightProbes),E.push(g.shadowMapType),E.push(g.toneMapping),E.push(g.numClippingPlanes),E.push(g.numClipIntersection),E.push(g.depthPacking)}function w(E,g){a.disableAll(),g.supportsVertexTextures&&a.enable(0),g.instancing&&a.enable(1),g.instancingColor&&a.enable(2),g.instancingMorph&&a.enable(3),g.matcap&&a.enable(4),g.envMap&&a.enable(5),g.normalMapObjectSpace&&a.enable(6),g.normalMapTangentSpace&&a.enable(7),g.clearcoat&&a.enable(8),g.iridescence&&a.enable(9),g.alphaTest&&a.enable(10),g.vertexColors&&a.enable(11),g.vertexAlphas&&a.enable(12),g.vertexUv1s&&a.enable(13),g.vertexUv2s&&a.enable(14),g.vertexUv3s&&a.enable(15),g.vertexTangents&&a.enable(16),g.anisotropy&&a.enable(17),g.alphaHash&&a.enable(18),g.batching&&a.enable(19),g.dispersion&&a.enable(20),g.batchingColor&&a.enable(21),E.push(a.mask),a.disableAll(),g.fog&&a.enable(0),g.useFog&&a.enable(1),g.flatShading&&a.enable(2),g.logarithmicDepthBuffer&&a.enable(3),g.reverseDepthBuffer&&a.enable(4),g.skinning&&a.enable(5),g.morphTargets&&a.enable(6),g.morphNormals&&a.enable(7),g.morphColors&&a.enable(8),g.premultipliedAlpha&&a.enable(9),g.shadowMapEnabled&&a.enable(10),g.doubleSided&&a.enable(11),g.flipSided&&a.enable(12),g.useDepthPacking&&a.enable(13),g.dithering&&a.enable(14),g.transmission&&a.enable(15),g.sheen&&a.enable(16),g.opaque&&a.enable(17),g.pointsUvs&&a.enable(18),g.decodeVideoTexture&&a.enable(19),g.decodeVideoTextureEmissive&&a.enable(20),g.alphaToCoverage&&a.enable(21),E.push(a.mask)}function S(E){const g=b[E.type];let L;if(g){const O=jn[g];L=WU.clone(O.uniforms)}else L=E.uniforms;return L}function I(E,g){let L;for(let O=0,H=u.length;O0?i.push(p):m.transparent===!0?s.push(p):n.push(p)}function l(f,h,m,b,y,_){const p=r(f,h,m,b,y,_);m.transmission>0?i.unshift(p):m.transparent===!0?s.unshift(p):n.unshift(p)}function d(f,h){n.length>1&&n.sort(f||Ck),i.length>1&&i.sort(h||Ph),s.length>1&&s.sort(h||Ph)}function u(){for(let f=e,h=t.length;f=o.length?(r=new Rh,o.push(r)):r=o[s],r}function n(){t=new WeakMap}return{get:e,dispose:n}}function Pk(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new U,color:new at};break;case"SpotLight":n={position:new U,direction:new U,color:new at,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new U,color:new at,distance:0,decay:0};break;case"HemisphereLight":n={direction:new U,skyColor:new at,groundColor:new at};break;case"RectAreaLight":n={color:new at,position:new U,halfWidth:new U,halfHeight:new U};break}return t[e.id]=n,n}}}function Rk(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ke};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ke};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ke,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let Dk=0;function Ik(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function Lk(t){const e=new Pk,n=Rk(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let d=0;d<9;d++)i.probe.push(new U);const s=new U,o=new Tt,r=new Tt;function a(d){let u=0,f=0,h=0;for(let E=0;E<9;E++)i.probe[E].set(0,0,0);let m=0,b=0,y=0,_=0,p=0,T=0,w=0,S=0,I=0,P=0,D=0;d.sort(Ik);for(let E=0,g=d.length;E0&&(t.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=xe.LTC_FLOAT_1,i.rectAreaLTC2=xe.LTC_FLOAT_2):(i.rectAreaLTC1=xe.LTC_HALF_1,i.rectAreaLTC2=xe.LTC_HALF_2)),i.ambient[0]=u,i.ambient[1]=f,i.ambient[2]=h;const R=i.hash;(R.directionalLength!==m||R.pointLength!==b||R.spotLength!==y||R.rectAreaLength!==_||R.hemiLength!==p||R.numDirectionalShadows!==T||R.numPointShadows!==w||R.numSpotShadows!==S||R.numSpotMaps!==I||R.numLightProbes!==D)&&(i.directional.length=m,i.spot.length=y,i.rectArea.length=_,i.point.length=b,i.hemi.length=p,i.directionalShadow.length=T,i.directionalShadowMap.length=T,i.pointShadow.length=w,i.pointShadowMap.length=w,i.spotShadow.length=S,i.spotShadowMap.length=S,i.directionalShadowMatrix.length=T,i.pointShadowMatrix.length=w,i.spotLightMatrix.length=S+I-P,i.spotLightMap.length=I,i.numSpotLightShadowsWithMaps=P,i.numLightProbes=D,R.directionalLength=m,R.pointLength=b,R.spotLength=y,R.rectAreaLength=_,R.hemiLength=p,R.numDirectionalShadows=T,R.numPointShadows=w,R.numSpotShadows=S,R.numSpotMaps=I,R.numLightProbes=D,i.version=Dk++)}function l(d,u){let f=0,h=0,m=0,b=0,y=0;const _=u.matrixWorldInverse;for(let p=0,T=d.length;p=r.length?(a=new Dh(t),r.push(a)):a=r[o],a}function i(){e=new WeakMap}return{get:n,dispose:i}}const Fk=`void main() { gl_Position = vec4( position, 1.0 ); }`,Ok=`uniform sampler2D shadow_pass; uniform vec2 resolution; uniform float radius; #include void main() { const float samples = float( VSM_SAMPLES ); float mean = 0.0; float squared_mean = 0.0; float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); float uvStart = samples <= 1.0 ? 0.0 : - 1.0; for ( float i = 0.0; i < samples; i ++ ) { float uvOffset = uvStart + i * uvStride; #ifdef HORIZONTAL_PASS vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); mean += distribution.x; squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; #else float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); mean += depth; squared_mean += depth * depth; #endif } mean = mean / samples; squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); }`;function Nk(t,e,n){let i=new fd;const s=new Ke,o=new Ke,r=new It,a=new nF({depthPacking:KL}),l=new iF,d={},u=n.maxTextureSize,f={[Vi]:un,[un]:Vi,[Fn]:Fn},h=new Hi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ke},radius:{value:4}},vertexShader:Fk,fragmentShader:Ok}),m=h.clone();m.defines.HORIZONTAL_PASS=1;const b=new tn;b.setAttribute("position",new Jn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const y=new Ae(b,h),_=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=hp;let p=this.type;this.render=function(P,D,R){if(_.enabled===!1||_.autoUpdate===!1&&_.needsUpdate===!1||P.length===0)return;const E=t.getRenderTarget(),g=t.getActiveCubeFace(),L=t.getActiveMipmapLevel(),O=t.state;O.setBlending(Ni),O.buffers.color.setClear(1,1,1,1),O.buffers.depth.setTest(!0),O.setScissorTest(!1);const H=p!==li&&this.type===li,j=p===li&&this.type!==li;for(let re=0,q=P.length;reu||s.y>u)&&(s.x>u&&(o.x=Math.floor(u/fe.x),s.x=o.x*fe.x,G.mapSize.x=o.x),s.y>u&&(o.y=Math.floor(u/fe.y),s.y=o.y*fe.y,G.mapSize.y=o.y)),G.map===null||H===!0||j===!0){const Re=this.type!==li?{minFilter:Bn,magFilter:Bn}:{};G.map!==null&&G.map.dispose(),G.map=new vs(s.x,s.y,Re),G.map.texture.name=ae.name+".shadowMap",G.camera.updateProjectionMatrix()}t.setRenderTarget(G.map),t.clear();const ye=G.getViewportCount();for(let Re=0;Re0||D.map&&D.alphaTest>0||D.alphaToCoverage===!0){const O=g.uuid,H=D.uuid;let j=d[O];j===void 0&&(j={},d[O]=j);let re=j[H];re===void 0&&(re=g.clone(),j[H]=re,D.addEventListener("dispose",I)),g=re}if(g.visible=D.visible,g.wireframe=D.wireframe,E===li?g.side=D.shadowSide!==null?D.shadowSide:D.side:g.side=D.shadowSide!==null?D.shadowSide:f[D.side],g.alphaMap=D.alphaMap,g.alphaTest=D.alphaToCoverage===!0?.5:D.alphaTest,g.map=D.map,g.clipShadows=D.clipShadows,g.clippingPlanes=D.clippingPlanes,g.clipIntersection=D.clipIntersection,g.displacementMap=D.displacementMap,g.displacementScale=D.displacementScale,g.displacementBias=D.displacementBias,g.wireframeLinewidth=D.wireframeLinewidth,g.linewidth=D.linewidth,R.isPointLight===!0&&g.isMeshDistanceMaterial===!0){const O=t.properties.get(g);O.light=R}return g}function S(P,D,R,E,g){if(P.visible===!1)return;if(P.layers.test(D.layers)&&(P.isMesh||P.isLine||P.isPoints)&&(P.castShadow||P.receiveShadow&&g===li)&&(!P.frustumCulled||i.intersectsObject(P))){P.modelViewMatrix.multiplyMatrices(R.matrixWorldInverse,P.matrixWorld);const H=e.update(P),j=P.material;if(Array.isArray(j)){const re=H.groups;for(let q=0,ae=re.length;q=1):G.indexOf("OpenGL ES")!==-1&&(ae=parseFloat(/^OpenGL ES (\d)/.exec(G)[1]),q=ae>=2);let fe=null,ye={};const Re=t.getParameter(t.SCISSOR_BOX),Be=t.getParameter(t.VIEWPORT),Je=new It().fromArray(Re),ce=new It().fromArray(Be);function N(z,we,oe,de){const Pe=new Uint8Array(4),Te=t.createTexture();t.bindTexture(z,Te),t.texParameteri(z,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(z,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let Qe=0;QeF||X.height>F)&&(B=F/Math.max(X.width,X.height)),B<1)if(typeof HTMLImageElement!="undefined"&&M instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&M instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&M instanceof ImageBitmap||typeof VideoFrame!="undefined"&&M instanceof VideoFrame){const $=Math.floor(B*X.width),ge=Math.floor(B*X.height);f===void 0&&(f=b($,ge));const pe=v?b($,ge):f;return pe.width=$,pe.height=ge,pe.getContext("2d").drawImage(M,0,0,$,ge),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+X.width+"x"+X.height+") to ("+$+"x"+ge+")."),pe}else return"data"in M&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+X.width+"x"+X.height+")."),M;return M}function _(M){return M.generateMipmaps}function p(M){t.generateMipmap(M)}function T(M){return M.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:M.isWebGL3DRenderTarget?t.TEXTURE_3D:M.isWebGLArrayRenderTarget||M.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:t.TEXTURE_2D}function w(M,v,F,B,X=!1){if(M!==null){if(t[M]!==void 0)return t[M];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+M+"'")}let $=v;if(v===t.RED&&(F===t.FLOAT&&($=t.R32F),F===t.HALF_FLOAT&&($=t.R16F),F===t.UNSIGNED_BYTE&&($=t.R8)),v===t.RED_INTEGER&&(F===t.UNSIGNED_BYTE&&($=t.R8UI),F===t.UNSIGNED_SHORT&&($=t.R16UI),F===t.UNSIGNED_INT&&($=t.R32UI),F===t.BYTE&&($=t.R8I),F===t.SHORT&&($=t.R16I),F===t.INT&&($=t.R32I)),v===t.RG&&(F===t.FLOAT&&($=t.RG32F),F===t.HALF_FLOAT&&($=t.RG16F),F===t.UNSIGNED_BYTE&&($=t.RG8)),v===t.RG_INTEGER&&(F===t.UNSIGNED_BYTE&&($=t.RG8UI),F===t.UNSIGNED_SHORT&&($=t.RG16UI),F===t.UNSIGNED_INT&&($=t.RG32UI),F===t.BYTE&&($=t.RG8I),F===t.SHORT&&($=t.RG16I),F===t.INT&&($=t.RG32I)),v===t.RGB_INTEGER&&(F===t.UNSIGNED_BYTE&&($=t.RGB8UI),F===t.UNSIGNED_SHORT&&($=t.RGB16UI),F===t.UNSIGNED_INT&&($=t.RGB32UI),F===t.BYTE&&($=t.RGB8I),F===t.SHORT&&($=t.RGB16I),F===t.INT&&($=t.RGB32I)),v===t.RGBA_INTEGER&&(F===t.UNSIGNED_BYTE&&($=t.RGBA8UI),F===t.UNSIGNED_SHORT&&($=t.RGBA16UI),F===t.UNSIGNED_INT&&($=t.RGBA32UI),F===t.BYTE&&($=t.RGBA8I),F===t.SHORT&&($=t.RGBA16I),F===t.INT&&($=t.RGBA32I)),v===t.RGB&&F===t.UNSIGNED_INT_5_9_9_9_REV&&($=t.RGB9_E5),v===t.RGBA){const ge=X?fa:ft.getTransfer(B);F===t.FLOAT&&($=t.RGBA32F),F===t.HALF_FLOAT&&($=t.RGBA16F),F===t.UNSIGNED_BYTE&&($=ge===bt?t.SRGB8_ALPHA8:t.RGBA8),F===t.UNSIGNED_SHORT_4_4_4_4&&($=t.RGBA4),F===t.UNSIGNED_SHORT_5_5_5_1&&($=t.RGB5_A1)}return($===t.R16F||$===t.R32F||$===t.RG16F||$===t.RG32F||$===t.RGBA16F||$===t.RGBA32F)&&e.get("EXT_color_buffer_float"),$}function S(M,v){let F;return M?v===null||v===gs||v===or?F=t.DEPTH24_STENCIL8:v===ui?F=t.DEPTH32F_STENCIL8:v===sr&&(F=t.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):v===null||v===gs||v===or?F=t.DEPTH_COMPONENT24:v===ui?F=t.DEPTH_COMPONENT32F:v===sr&&(F=t.DEPTH_COMPONENT16),F}function I(M,v){return _(M)===!0||M.isFramebufferTexture&&M.minFilter!==Bn&&M.minFilter!==qn?Math.log2(Math.max(v.width,v.height))+1:M.mipmaps!==void 0&&M.mipmaps.length>0?M.mipmaps.length:M.isCompressedTexture&&Array.isArray(M.image)?v.mipmaps.length:1}function P(M){const v=M.target;v.removeEventListener("dispose",P),R(v),v.isVideoTexture&&u.delete(v)}function D(M){const v=M.target;v.removeEventListener("dispose",D),g(v)}function R(M){const v=i.get(M);if(v.__webglInit===void 0)return;const F=M.source,B=h.get(F);if(B){const X=B[v.__cacheKey];X.usedTimes--,X.usedTimes===0&&E(M),Object.keys(B).length===0&&h.delete(F)}i.remove(M)}function E(M){const v=i.get(M);t.deleteTexture(v.__webglTexture);const F=M.source,B=h.get(F);delete B[v.__cacheKey],r.memory.textures--}function g(M){const v=i.get(M);if(M.depthTexture&&(M.depthTexture.dispose(),i.remove(M.depthTexture)),M.isWebGLCubeRenderTarget)for(let B=0;B<6;B++){if(Array.isArray(v.__webglFramebuffer[B]))for(let X=0;X=s.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+M+" texture units while this GPU supports only "+s.maxTextures),L+=1,M}function j(M){const v=[];return v.push(M.wrapS),v.push(M.wrapT),v.push(M.wrapR||0),v.push(M.magFilter),v.push(M.minFilter),v.push(M.anisotropy),v.push(M.internalFormat),v.push(M.format),v.push(M.type),v.push(M.generateMipmaps),v.push(M.premultiplyAlpha),v.push(M.flipY),v.push(M.unpackAlignment),v.push(M.colorSpace),v.join()}function re(M,v){const F=i.get(M);if(M.isVideoTexture&&ne(M),M.isRenderTargetTexture===!1&&M.version>0&&F.__version!==M.version){const B=M.image;if(B===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(B.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ce(F,M,v);return}}n.bindTexture(t.TEXTURE_2D,F.__webglTexture,t.TEXTURE0+v)}function q(M,v){const F=i.get(M);if(M.version>0&&F.__version!==M.version){ce(F,M,v);return}n.bindTexture(t.TEXTURE_2D_ARRAY,F.__webglTexture,t.TEXTURE0+v)}function ae(M,v){const F=i.get(M);if(M.version>0&&F.__version!==M.version){ce(F,M,v);return}n.bindTexture(t.TEXTURE_3D,F.__webglTexture,t.TEXTURE0+v)}function G(M,v){const F=i.get(M);if(M.version>0&&F.__version!==M.version){N(F,M,v);return}n.bindTexture(t.TEXTURE_CUBE_MAP,F.__webglTexture,t.TEXTURE0+v)}const fe={[sc]:t.REPEAT,[hs]:t.CLAMP_TO_EDGE,[oc]:t.MIRRORED_REPEAT},ye={[Bn]:t.NEAREST,[qL]:t.NEAREST_MIPMAP_NEAREST,[xr]:t.NEAREST_MIPMAP_LINEAR,[qn]:t.LINEAR,[qa]:t.LINEAR_MIPMAP_NEAREST,[fs]:t.LINEAR_MIPMAP_LINEAR},Re={[QL]:t.NEVER,[oU]:t.ALWAYS,[eU]:t.LESS,[Mp]:t.LEQUAL,[tU]:t.EQUAL,[sU]:t.GEQUAL,[nU]:t.GREATER,[iU]:t.NOTEQUAL};function Be(M,v){if(v.type===ui&&e.has("OES_texture_float_linear")===!1&&(v.magFilter===qn||v.magFilter===qa||v.magFilter===xr||v.magFilter===fs||v.minFilter===qn||v.minFilter===qa||v.minFilter===xr||v.minFilter===fs)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(M,t.TEXTURE_WRAP_S,fe[v.wrapS]),t.texParameteri(M,t.TEXTURE_WRAP_T,fe[v.wrapT]),(M===t.TEXTURE_3D||M===t.TEXTURE_2D_ARRAY)&&t.texParameteri(M,t.TEXTURE_WRAP_R,fe[v.wrapR]),t.texParameteri(M,t.TEXTURE_MAG_FILTER,ye[v.magFilter]),t.texParameteri(M,t.TEXTURE_MIN_FILTER,ye[v.minFilter]),v.compareFunction&&(t.texParameteri(M,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(M,t.TEXTURE_COMPARE_FUNC,Re[v.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(v.magFilter===Bn||v.minFilter!==xr&&v.minFilter!==fs||v.type===ui&&e.has("OES_texture_float_linear")===!1)return;if(v.anisotropy>1||i.get(v).__currentAnisotropy){const F=e.get("EXT_texture_filter_anisotropic");t.texParameterf(M,F.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(v.anisotropy,s.getMaxAnisotropy())),i.get(v).__currentAnisotropy=v.anisotropy}}}function Je(M,v){let F=!1;M.__webglInit===void 0&&(M.__webglInit=!0,v.addEventListener("dispose",P));const B=v.source;let X=h.get(B);X===void 0&&(X={},h.set(B,X));const $=j(v);if($!==M.__cacheKey){X[$]===void 0&&(X[$]={texture:t.createTexture(),usedTimes:0},r.memory.textures++,F=!0),X[$].usedTimes++;const ge=X[M.__cacheKey];ge!==void 0&&(X[M.__cacheKey].usedTimes--,ge.usedTimes===0&&E(v)),M.__cacheKey=$,M.__webglTexture=X[$].texture}return F}function ce(M,v,F){let B=t.TEXTURE_2D;(v.isDataArrayTexture||v.isCompressedArrayTexture)&&(B=t.TEXTURE_2D_ARRAY),v.isData3DTexture&&(B=t.TEXTURE_3D);const X=Je(M,v),$=v.source;n.bindTexture(B,M.__webglTexture,t.TEXTURE0+F);const ge=i.get($);if($.version!==ge.__version||X===!0){n.activeTexture(t.TEXTURE0+F);const pe=ft.getPrimaries(ft.workingColorSpace),be=v.colorSpace===Li?null:ft.getPrimaries(v.colorSpace),Me=v.colorSpace===Li||pe===be?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,v.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,v.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,Me);let he=y(v.image,!1,s.maxTextureSize);he=me(v,he);const Ce=o.convert(v.format,v.colorSpace),Xe=o.convert(v.type);let $e=w(v.internalFormat,Ce,Xe,v.colorSpace,v.isVideoTexture);Be(B,v);let De;const Ye=v.mipmaps,Ge=v.isVideoTexture!==!0,gt=ge.__version===void 0||X===!0,z=$.dataReady,we=I(v,he);if(v.isDepthTexture)$e=S(v.format===ar,v.type),gt&&(Ge?n.texStorage2D(t.TEXTURE_2D,1,$e,he.width,he.height):n.texImage2D(t.TEXTURE_2D,0,$e,he.width,he.height,0,Ce,Xe,null));else if(v.isDataTexture)if(Ye.length>0){Ge&>&&n.texStorage2D(t.TEXTURE_2D,we,$e,Ye[0].width,Ye[0].height);for(let oe=0,de=Ye.length;oe0){const Pe=ah(De.width,De.height,v.format,v.type);for(const Te of v.layerUpdates){const Qe=De.data.subarray(Te*Pe/De.data.BYTES_PER_ELEMENT,(Te+1)*Pe/De.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,oe,0,0,Te,De.width,De.height,1,Ce,Qe)}v.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,oe,0,0,0,De.width,De.height,he.depth,Ce,De.data)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,oe,$e,De.width,De.height,he.depth,0,De.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ge?z&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,oe,0,0,0,De.width,De.height,he.depth,Ce,Xe,De.data):n.texImage3D(t.TEXTURE_2D_ARRAY,oe,$e,De.width,De.height,he.depth,0,Ce,Xe,De.data)}else{Ge&>&&n.texStorage2D(t.TEXTURE_2D,we,$e,Ye[0].width,Ye[0].height);for(let oe=0,de=Ye.length;oe0){const oe=ah(he.width,he.height,v.format,v.type);for(const de of v.layerUpdates){const Pe=he.data.subarray(de*oe/he.data.BYTES_PER_ELEMENT,(de+1)*oe/he.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,de,he.width,he.height,1,Ce,Xe,Pe)}v.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,he.width,he.height,he.depth,Ce,Xe,he.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,$e,he.width,he.height,he.depth,0,Ce,Xe,he.data);else if(v.isData3DTexture)Ge?(gt&&n.texStorage3D(t.TEXTURE_3D,we,$e,he.width,he.height,he.depth),z&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,he.width,he.height,he.depth,Ce,Xe,he.data)):n.texImage3D(t.TEXTURE_3D,0,$e,he.width,he.height,he.depth,0,Ce,Xe,he.data);else if(v.isFramebufferTexture){if(gt)if(Ge)n.texStorage2D(t.TEXTURE_2D,we,$e,he.width,he.height);else{let oe=he.width,de=he.height;for(let Pe=0;Pe>=1,de>>=1}}else if(Ye.length>0){if(Ge&>){const oe=Q(Ye[0]);n.texStorage2D(t.TEXTURE_2D,we,$e,oe.width,oe.height)}for(let oe=0,de=Ye.length;oe0&&we++;const de=Q(Ce[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,we,Ye,de.width,de.height)}for(let de=0;de<6;de++)if(he){Ge?z&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,0,0,Ce[de].width,Ce[de].height,$e,De,Ce[de].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,Ye,Ce[de].width,Ce[de].height,0,$e,De,Ce[de].data);for(let Pe=0;Pe>$),Xe=Math.max(1,v.height>>$);X===t.TEXTURE_3D||X===t.TEXTURE_2D_ARRAY?n.texImage3D(X,$,be,Ce,Xe,v.depth,0,ge,pe,null):n.texImage2D(X,$,be,Ce,Xe,0,ge,pe,null)}n.bindFramebuffer(t.FRAMEBUFFER,M),te(v)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,B,X,he.__webglTexture,0,ie(v)):(X===t.TEXTURE_2D||X>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&X<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,B,X,he.__webglTexture,$),n.bindFramebuffer(t.FRAMEBUFFER,null)}function Y(M,v,F){if(t.bindRenderbuffer(t.RENDERBUFFER,M),v.depthBuffer){const B=v.depthTexture,X=B&&B.isDepthTexture?B.type:null,$=S(v.stencilBuffer,X),ge=v.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,pe=ie(v);te(v)?a.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,pe,$,v.width,v.height):F?t.renderbufferStorageMultisample(t.RENDERBUFFER,pe,$,v.width,v.height):t.renderbufferStorage(t.RENDERBUFFER,$,v.width,v.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,ge,t.RENDERBUFFER,M)}else{const B=v.textures;for(let X=0;X{delete v.__boundDepthTexture,delete v.__depthDisposeCallback,B.removeEventListener("dispose",X)};B.addEventListener("dispose",X),v.__depthDisposeCallback=X}v.__boundDepthTexture=B}if(M.depthTexture&&!v.__autoAllocateDepthBuffer){if(F)throw new Error("target.depthTexture not supported in Cube render targets");const B=M.texture.mipmaps;B&&B.length>0?ue(v.__webglFramebuffer[0],M):ue(v.__webglFramebuffer,M)}else if(F){v.__webglDepthbuffer=[];for(let B=0;B<6;B++)if(n.bindFramebuffer(t.FRAMEBUFFER,v.__webglFramebuffer[B]),v.__webglDepthbuffer[B]===void 0)v.__webglDepthbuffer[B]=t.createRenderbuffer(),Y(v.__webglDepthbuffer[B],M,!1);else{const X=M.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,$=v.__webglDepthbuffer[B];t.bindRenderbuffer(t.RENDERBUFFER,$),t.framebufferRenderbuffer(t.FRAMEBUFFER,X,t.RENDERBUFFER,$)}}else{const B=M.texture.mipmaps;if(B&&B.length>0?n.bindFramebuffer(t.FRAMEBUFFER,v.__webglFramebuffer[0]):n.bindFramebuffer(t.FRAMEBUFFER,v.__webglFramebuffer),v.__webglDepthbuffer===void 0)v.__webglDepthbuffer=t.createRenderbuffer(),Y(v.__webglDepthbuffer,M,!1);else{const X=M.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,$=v.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,$),t.framebufferRenderbuffer(t.FRAMEBUFFER,X,t.RENDERBUFFER,$)}}n.bindFramebuffer(t.FRAMEBUFFER,null)}function Se(M,v,F){const B=i.get(M);v!==void 0&&le(B.__webglFramebuffer,M,M.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),F!==void 0&&Oe(M)}function Ne(M){const v=M.texture,F=i.get(M),B=i.get(v);M.addEventListener("dispose",D);const X=M.textures,$=M.isWebGLCubeRenderTarget===!0,ge=X.length>1;if(ge||(B.__webglTexture===void 0&&(B.__webglTexture=t.createTexture()),B.__version=v.version,r.memory.textures++),$){F.__webglFramebuffer=[];for(let pe=0;pe<6;pe++)if(v.mipmaps&&v.mipmaps.length>0){F.__webglFramebuffer[pe]=[];for(let be=0;be0){F.__webglFramebuffer=[];for(let pe=0;pe0&&te(M)===!1){F.__webglMultisampledFramebuffer=t.createFramebuffer(),F.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,F.__webglMultisampledFramebuffer);for(let pe=0;pe0)for(let be=0;be0)for(let be=0;be0){if(te(M)===!1){const v=M.textures,F=M.width,B=M.height;let X=t.COLOR_BUFFER_BIT;const $=M.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,ge=i.get(M),pe=v.length>1;if(pe)for(let Me=0;Me0?n.bindFramebuffer(t.DRAW_FRAMEBUFFER,ge.__webglFramebuffer[0]):n.bindFramebuffer(t.DRAW_FRAMEBUFFER,ge.__webglFramebuffer);for(let Me=0;Me0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&v.__useRenderToTexture!==!1}function ne(M){const v=r.render.frame;u.get(M)!==v&&(u.set(M,v),M.update())}function me(M,v){const F=M.colorSpace,B=M.format,X=M.type;return M.isCompressedTexture===!0||M.isVideoTexture===!0||F!==ao&&F!==Li&&(ft.getTransfer(F)===bt?(B!==zn||X!==ei)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",F)),v}function Q(M){return typeof HTMLImageElement!="undefined"&&M instanceof HTMLImageElement?(d.width=M.naturalWidth||M.width,d.height=M.naturalHeight||M.height):typeof VideoFrame!="undefined"&&M instanceof VideoFrame?(d.width=M.displayWidth,d.height=M.displayHeight):(d.width=M.width,d.height=M.height),d}this.allocateTextureUnit=H,this.resetTextureUnits=O,this.setTexture2D=re,this.setTexture2DArray=q,this.setTexture3D=ae,this.setTextureCube=G,this.rebindTextures=Se,this.setupRenderTarget=Ne,this.updateRenderTargetMipmap=Ue,this.updateMultisampleRenderTarget=Z,this.setupDepthRenderbuffer=Oe,this.setupFrameBufferTexture=le,this.useMultisampledRTT=te}function Vk(t,e){function n(i,s=Li){let o;const r=ft.getTransfer(s);if(i===ei)return t.UNSIGNED_BYTE;if(i===od)return t.UNSIGNED_SHORT_4_4_4_4;if(i===rd)return t.UNSIGNED_SHORT_5_5_5_1;if(i===_p)return t.UNSIGNED_INT_5_9_9_9_REV;if(i===pp)return t.BYTE;if(i===mp)return t.SHORT;if(i===sr)return t.UNSIGNED_SHORT;if(i===sd)return t.INT;if(i===gs)return t.UNSIGNED_INT;if(i===ui)return t.FLOAT;if(i===ur)return t.HALF_FLOAT;if(i===gp)return t.ALPHA;if(i===vp)return t.RGB;if(i===zn)return t.RGBA;if(i===rr)return t.DEPTH_COMPONENT;if(i===ar)return t.DEPTH_STENCIL;if(i===bp)return t.RED;if(i===ad)return t.RED_INTEGER;if(i===yp)return t.RG;if(i===ld)return t.RG_INTEGER;if(i===cd)return t.RGBA_INTEGER;if(i===Jr||i===Qr||i===ea||i===ta)if(r===bt)if(o=e.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(i===Jr)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===Qr)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===ea)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===ta)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(i===Jr)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===Qr)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===ea)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===ta)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===rc||i===ac||i===lc||i===cc)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(i===rc)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===ac)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===lc)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===cc)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===dc||i===uc||i===hc)if(o=e.get("WEBGL_compressed_texture_etc"),o!==null){if(i===dc||i===uc)return r===bt?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(i===hc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===fc||i===pc||i===mc||i===_c||i===gc||i===vc||i===bc||i===yc||i===xc||i===Sc||i===Mc||i===Ec||i===wc||i===Tc)if(o=e.get("WEBGL_compressed_texture_astc"),o!==null){if(i===fc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===pc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===mc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===_c)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===gc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===vc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===bc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===yc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===xc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===Sc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===Mc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===Ec)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===wc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===Tc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===na||i===Cc||i===Ac)if(o=e.get("EXT_texture_compression_bptc"),o!==null){if(i===na)return r===bt?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===Cc)return o.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===Ac)return o.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===xp||i===Pc||i===Rc||i===Dc)if(o=e.get("EXT_texture_compression_rgtc"),o!==null){if(i===na)return o.COMPRESSED_RED_RGTC1_EXT;if(i===Pc)return o.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===Rc)return o.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===Dc)return o.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===or?t.UNSIGNED_INT_24_8:t[i]!==void 0?t[i]:null}return{convert:n}}const Hk=` void main() { gl_Position = vec4( position, 1.0 ); }`,$k=` uniform sampler2DArray depthColor; uniform float depthWidth; uniform float depthHeight; void main() { vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); if ( coord.x >= 1.0 ) { gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; } else { gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; } }`;class Gk{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n,i){if(this.texture===null){const s=new hn,o=e.properties.get(s);o.__webglTexture=n.texture,(n.depthNear!==i.depthNear||n.depthFar!==i.depthFar)&&(this.depthNear=n.depthNear,this.depthFar=n.depthFar),this.texture=s}}getMesh(e){if(this.texture!==null&&this.mesh===null){const n=e.cameras[0].viewport,i=new Hi({vertexShader:Hk,fragmentShader:$k,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new Ae(new bo(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Wk extends Ss{constructor(e,n){super();const i=this;let s=null,o=1,r=null,a="local-floor",l=1,d=null,u=null,f=null,h=null,m=null,b=null;const y=new Gk,_=n.getContextAttributes();let p=null,T=null;const w=[],S=[],I=new Ke;let P=null;const D=new _n;D.viewport=new It;const R=new _n;R.viewport=new It;const E=[D,R],g=new cF;let L=null,O=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ce){let N=w[ce];return N===void 0&&(N=new ml,w[ce]=N),N.getTargetRaySpace()},this.getControllerGrip=function(ce){let N=w[ce];return N===void 0&&(N=new ml,w[ce]=N),N.getGripSpace()},this.getHand=function(ce){let N=w[ce];return N===void 0&&(N=new ml,w[ce]=N),N.getHandSpace()};function H(ce){const N=S.indexOf(ce.inputSource);if(N===-1)return;const le=w[N];le!==void 0&&(le.update(ce.inputSource,ce.frame,d||r),le.dispatchEvent({type:ce.type,data:ce.inputSource}))}function j(){s.removeEventListener("select",H),s.removeEventListener("selectstart",H),s.removeEventListener("selectend",H),s.removeEventListener("squeeze",H),s.removeEventListener("squeezestart",H),s.removeEventListener("squeezeend",H),s.removeEventListener("end",j),s.removeEventListener("inputsourceschange",re);for(let ce=0;ce=0&&(S[Y]=null,w[Y].disconnect(le))}for(let N=0;N=S.length){S.push(le),Y=Oe;break}else if(S[Oe]===null){S[Oe]=le,Y=Oe;break}if(Y===-1)break}const ue=w[Y];ue&&ue.connect(le)}}const q=new U,ae=new U;function G(ce,N,le){q.setFromMatrixPosition(N.matrixWorld),ae.setFromMatrixPosition(le.matrixWorld);const Y=q.distanceTo(ae),ue=N.projectionMatrix.elements,Oe=le.projectionMatrix.elements,Se=ue[14]/(ue[10]-1),Ne=ue[14]/(ue[10]+1),Ue=(ue[9]+1)/ue[5],A=(ue[9]-1)/ue[5],x=(ue[8]-1)/ue[0],Z=(Oe[8]+1)/Oe[0],ie=Se*x,te=Se*Z,ne=Y/(-x+Z),me=ne*-x;if(N.matrixWorld.decompose(ce.position,ce.quaternion,ce.scale),ce.translateX(me),ce.translateZ(ne),ce.matrixWorld.compose(ce.position,ce.quaternion,ce.scale),ce.matrixWorldInverse.copy(ce.matrixWorld).invert(),ue[10]===-1)ce.projectionMatrix.copy(N.projectionMatrix),ce.projectionMatrixInverse.copy(N.projectionMatrixInverse);else{const Q=Se+ne,M=Ne+ne,v=ie-me,F=te+(Y-me),B=Ue*Ne/M*Q,X=A*Ne/M*Q;ce.projectionMatrix.makePerspective(v,F,B,X,Q,M),ce.projectionMatrixInverse.copy(ce.projectionMatrix).invert()}}function fe(ce,N){N===null?ce.matrixWorld.copy(ce.matrix):ce.matrixWorld.multiplyMatrices(N.matrixWorld,ce.matrix),ce.matrixWorldInverse.copy(ce.matrixWorld).invert()}this.updateCamera=function(ce){if(s===null)return;let N=ce.near,le=ce.far;y.texture!==null&&(y.depthNear>0&&(N=y.depthNear),y.depthFar>0&&(le=y.depthFar)),g.near=R.near=D.near=N,g.far=R.far=D.far=le,(L!==g.near||O!==g.far)&&(s.updateRenderState({depthNear:g.near,depthFar:g.far}),L=g.near,O=g.far),D.layers.mask=ce.layers.mask|2,R.layers.mask=ce.layers.mask|4,g.layers.mask=D.layers.mask|R.layers.mask;const Y=ce.parent,ue=g.cameras;fe(g,Y);for(let Oe=0;Oe0&&(_.alphaTest.value=p.alphaTest);const T=e.get(p),w=T.envMap,S=T.envMapRotation;w&&(_.envMap.value=w,es.copy(S),es.x*=-1,es.y*=-1,es.z*=-1,w.isCubeTexture&&w.isRenderTargetTexture===!1&&(es.y*=-1,es.z*=-1),_.envMapRotation.value.setFromMatrix4(Xk.makeRotationFromEuler(es)),_.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,_.reflectivity.value=p.reflectivity,_.ior.value=p.ior,_.refractionRatio.value=p.refractionRatio),p.lightMap&&(_.lightMap.value=p.lightMap,_.lightMapIntensity.value=p.lightMapIntensity,n(p.lightMap,_.lightMapTransform)),p.aoMap&&(_.aoMap.value=p.aoMap,_.aoMapIntensity.value=p.aoMapIntensity,n(p.aoMap,_.aoMapTransform))}function r(_,p){_.diffuse.value.copy(p.color),_.opacity.value=p.opacity,p.map&&(_.map.value=p.map,n(p.map,_.mapTransform))}function a(_,p){_.dashSize.value=p.dashSize,_.totalSize.value=p.dashSize+p.gapSize,_.scale.value=p.scale}function l(_,p,T,w){_.diffuse.value.copy(p.color),_.opacity.value=p.opacity,_.size.value=p.size*T,_.scale.value=w*.5,p.map&&(_.map.value=p.map,n(p.map,_.uvTransform)),p.alphaMap&&(_.alphaMap.value=p.alphaMap,n(p.alphaMap,_.alphaMapTransform)),p.alphaTest>0&&(_.alphaTest.value=p.alphaTest)}function d(_,p){_.diffuse.value.copy(p.color),_.opacity.value=p.opacity,_.rotation.value=p.rotation,p.map&&(_.map.value=p.map,n(p.map,_.mapTransform)),p.alphaMap&&(_.alphaMap.value=p.alphaMap,n(p.alphaMap,_.alphaMapTransform)),p.alphaTest>0&&(_.alphaTest.value=p.alphaTest)}function u(_,p){_.specular.value.copy(p.specular),_.shininess.value=Math.max(p.shininess,1e-4)}function f(_,p){p.gradientMap&&(_.gradientMap.value=p.gradientMap)}function h(_,p){_.metalness.value=p.metalness,p.metalnessMap&&(_.metalnessMap.value=p.metalnessMap,n(p.metalnessMap,_.metalnessMapTransform)),_.roughness.value=p.roughness,p.roughnessMap&&(_.roughnessMap.value=p.roughnessMap,n(p.roughnessMap,_.roughnessMapTransform)),p.envMap&&(_.envMapIntensity.value=p.envMapIntensity)}function m(_,p,T){_.ior.value=p.ior,p.sheen>0&&(_.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),_.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(_.sheenColorMap.value=p.sheenColorMap,n(p.sheenColorMap,_.sheenColorMapTransform)),p.sheenRoughnessMap&&(_.sheenRoughnessMap.value=p.sheenRoughnessMap,n(p.sheenRoughnessMap,_.sheenRoughnessMapTransform))),p.clearcoat>0&&(_.clearcoat.value=p.clearcoat,_.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(_.clearcoatMap.value=p.clearcoatMap,n(p.clearcoatMap,_.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(_.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,n(p.clearcoatRoughnessMap,_.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(_.clearcoatNormalMap.value=p.clearcoatNormalMap,n(p.clearcoatNormalMap,_.clearcoatNormalMapTransform),_.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===un&&_.clearcoatNormalScale.value.negate())),p.dispersion>0&&(_.dispersion.value=p.dispersion),p.iridescence>0&&(_.iridescence.value=p.iridescence,_.iridescenceIOR.value=p.iridescenceIOR,_.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],_.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(_.iridescenceMap.value=p.iridescenceMap,n(p.iridescenceMap,_.iridescenceMapTransform)),p.iridescenceThicknessMap&&(_.iridescenceThicknessMap.value=p.iridescenceThicknessMap,n(p.iridescenceThicknessMap,_.iridescenceThicknessMapTransform))),p.transmission>0&&(_.transmission.value=p.transmission,_.transmissionSamplerMap.value=T.texture,_.transmissionSamplerSize.value.set(T.width,T.height),p.transmissionMap&&(_.transmissionMap.value=p.transmissionMap,n(p.transmissionMap,_.transmissionMapTransform)),_.thickness.value=p.thickness,p.thicknessMap&&(_.thicknessMap.value=p.thicknessMap,n(p.thicknessMap,_.thicknessMapTransform)),_.attenuationDistance.value=p.attenuationDistance,_.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(_.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(_.anisotropyMap.value=p.anisotropyMap,n(p.anisotropyMap,_.anisotropyMapTransform))),_.specularIntensity.value=p.specularIntensity,_.specularColor.value.copy(p.specularColor),p.specularColorMap&&(_.specularColorMap.value=p.specularColorMap,n(p.specularColorMap,_.specularColorMapTransform)),p.specularIntensityMap&&(_.specularIntensityMap.value=p.specularIntensityMap,n(p.specularIntensityMap,_.specularIntensityMapTransform))}function b(_,p){p.matcap&&(_.matcap.value=p.matcap)}function y(_,p){const T=e.get(p).light;_.referencePosition.value.setFromMatrixPosition(T.matrixWorld),_.nearDistance.value=T.shadow.camera.near,_.farDistance.value=T.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:s}}function Yk(t,e,n,i){let s={},o={},r=[];const a=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function l(T,w){const S=w.program;i.uniformBlockBinding(T,S)}function d(T,w){let S=s[T.id];S===void 0&&(b(T),S=u(T),s[T.id]=S,T.addEventListener("dispose",_));const I=w.program;i.updateUBOMapping(T,I);const P=e.render.frame;o[T.id]!==P&&(h(T),o[T.id]=P)}function u(T){const w=f();T.__bindingPointIndex=w;const S=t.createBuffer(),I=T.__size,P=T.usage;return t.bindBuffer(t.UNIFORM_BUFFER,S),t.bufferData(t.UNIFORM_BUFFER,I,P),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,w,S),S}function f(){for(let T=0;T0&&(S+=I-P),T.__size=S,T.__cache={},this}function y(T){const w={boundary:0,storage:0};return typeof T=="number"||typeof T=="boolean"?(w.boundary=4,w.storage=4):T.isVector2?(w.boundary=8,w.storage=8):T.isVector3||T.isColor?(w.boundary=16,w.storage=12):T.isVector4?(w.boundary=16,w.storage=16):T.isMatrix3?(w.boundary=48,w.storage=48):T.isMatrix4?(w.boundary=64,w.storage=64):T.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",T),w}function _(T){const w=T.target;w.removeEventListener("dispose",_);const S=r.indexOf(w.__bindingPointIndex);r.splice(S,1),t.deleteBuffer(s[w.id]),delete s[w.id],delete o[w.id]}function p(){for(const T in s)t.deleteBuffer(s[T]);r=[],s={},o={}}return{bind:l,update:d,dispose:p}}class qk{constructor(e={}){const{canvas:n=MU(),context:i=null,depth:s=!0,stencil:o=!1,alpha:r=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:d=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:f=!1,reverseDepthBuffer:h=!1}=e;this.isWebGLRenderer=!0;let m;if(i!==null){if(typeof WebGLRenderingContext!="undefined"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");m=i.getContextAttributes().alpha}else m=r;const b=new Uint32Array(4),y=new Int32Array(4);let _=null,p=null;const T=[],w=[];this.domElement=n,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=zi,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const S=this;let I=!1;this._outputColorSpace=En;let P=0,D=0,R=null,E=-1,g=null;const L=new It,O=new It;let H=null;const j=new at(0);let re=0,q=n.width,ae=n.height,G=1,fe=null,ye=null;const Re=new It(0,0,q,ae),Be=new It(0,0,q,ae);let Je=!1;const ce=new fd;let N=!1,le=!1;const Y=new Tt,ue=new Tt,Oe=new U,Se=new It,Ne={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Ue=!1;function A(){return R===null?G:1}let x=i;function Z(C,k){return n.getContext(C,k)}try{const C={alpha:!0,depth:s,stencil:o,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:d,powerPreference:u,failIfMajorPerformanceCaveat:f};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${nd}`),n.addEventListener("webglcontextlost",de,!1),n.addEventListener("webglcontextrestored",Pe,!1),n.addEventListener("webglcontextcreationerror",Te,!1),x===null){const k="webgl2";if(x=Z(k,C),x===null)throw Z(k)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(C){throw console.error("THREE.WebGLRenderer: "+C.message),C}let ie,te,ne,me,Q,M,v,F,B,X,$,ge,pe,be,Me,he,Ce,Xe,$e,De,Ye,Ge,gt,z;function we(){ie=new oz(x),ie.init(),Ge=new Vk(x,ie),te=new JN(x,ie,e,Ge),ne=new kk(x,ie),te.reverseDepthBuffer&&h&&ne.buffers.depth.setReversed(!0),me=new lz(x),Q=new Tk,M=new Bk(x,ie,ne,Q,te,Ge,me),v=new ez(S),F=new sz(S),B=new pF(x),gt=new ZN(x,B),X=new rz(x,B,me,gt),$=new dz(x,X,B,me),$e=new cz(x,te,M),he=new QN(Q),ge=new wk(S,v,F,ie,te,gt,he),pe=new jk(S,Q),be=new Ak,Me=new Uk(ie),Xe=new qN(S,v,F,ne,$,m,l),Ce=new Nk(S,$,te),z=new Yk(x,me,te,ne),De=new KN(x,ie,me),Ye=new az(x,ie,me),me.programs=ge.programs,S.capabilities=te,S.extensions=ie,S.properties=Q,S.renderLists=be,S.shadowMap=Ce,S.state=ne,S.info=me}we();const oe=new Wk(S,x);this.xr=oe,this.getContext=function(){return x},this.getContextAttributes=function(){return x.getContextAttributes()},this.forceContextLoss=function(){const C=ie.get("WEBGL_lose_context");C&&C.loseContext()},this.forceContextRestore=function(){const C=ie.get("WEBGL_lose_context");C&&C.restoreContext()},this.getPixelRatio=function(){return G},this.setPixelRatio=function(C){C!==void 0&&(G=C,this.setSize(q,ae,!1))},this.getSize=function(C){return C.set(q,ae)},this.setSize=function(C,k,K=!0){if(oe.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}q=C,ae=k,n.width=Math.floor(C*G),n.height=Math.floor(k*G),K===!0&&(n.style.width=C+"px",n.style.height=k+"px"),this.setViewport(0,0,C,k)},this.getDrawingBufferSize=function(C){return C.set(q*G,ae*G).floor()},this.setDrawingBufferSize=function(C,k,K){q=C,ae=k,G=K,n.width=Math.floor(C*K),n.height=Math.floor(k*K),this.setViewport(0,0,C,k)},this.getCurrentViewport=function(C){return C.copy(L)},this.getViewport=function(C){return C.copy(Re)},this.setViewport=function(C,k,K,J){C.isVector4?Re.set(C.x,C.y,C.z,C.w):Re.set(C,k,K,J),ne.viewport(L.copy(Re).multiplyScalar(G).round())},this.getScissor=function(C){return C.copy(Be)},this.setScissor=function(C,k,K,J){C.isVector4?Be.set(C.x,C.y,C.z,C.w):Be.set(C,k,K,J),ne.scissor(O.copy(Be).multiplyScalar(G).round())},this.getScissorTest=function(){return Je},this.setScissorTest=function(C){ne.setScissorTest(Je=C)},this.setOpaqueSort=function(C){fe=C},this.setTransparentSort=function(C){ye=C},this.getClearColor=function(C){return C.copy(Xe.getClearColor())},this.setClearColor=function(){Xe.setClearColor(...arguments)},this.getClearAlpha=function(){return Xe.getClearAlpha()},this.setClearAlpha=function(){Xe.setClearAlpha(...arguments)},this.clear=function(C=!0,k=!0,K=!0){let J=0;if(C){let V=!1;if(R!==null){const ve=R.texture.format;V=ve===cd||ve===ld||ve===ad}if(V){const ve=R.texture.type,Ee=ve===ei||ve===gs||ve===sr||ve===or||ve===od||ve===rd,Le=Xe.getClearColor(),Fe=Xe.getClearAlpha(),Ze=Le.r,qe=Le.g,Ve=Le.b;Ee?(b[0]=Ze,b[1]=qe,b[2]=Ve,b[3]=Fe,x.clearBufferuiv(x.COLOR,0,b)):(y[0]=Ze,y[1]=qe,y[2]=Ve,y[3]=Fe,x.clearBufferiv(x.COLOR,0,y))}else J|=x.COLOR_BUFFER_BIT}k&&(J|=x.DEPTH_BUFFER_BIT),K&&(J|=x.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),x.clear(J)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){n.removeEventListener("webglcontextlost",de,!1),n.removeEventListener("webglcontextrestored",Pe,!1),n.removeEventListener("webglcontextcreationerror",Te,!1),Xe.dispose(),be.dispose(),Me.dispose(),Q.dispose(),v.dispose(),F.dispose(),$.dispose(),gt.dispose(),z.dispose(),ge.dispose(),oe.dispose(),oe.removeEventListener("sessionstart",xd),oe.removeEventListener("sessionend",Sd),$i.stop()};function de(C){C.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),I=!0}function Pe(){console.log("THREE.WebGLRenderer: Context Restored."),I=!1;const C=me.autoReset,k=Ce.enabled,K=Ce.autoUpdate,J=Ce.needsUpdate,V=Ce.type;we(),me.autoReset=C,Ce.enabled=k,Ce.autoUpdate=K,Ce.needsUpdate=J,Ce.type=V}function Te(C){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",C.statusMessage)}function Qe(C){const k=C.target;k.removeEventListener("dispose",Qe),Rt(k)}function Rt(C){Yt(C),Q.remove(C)}function Yt(C){const k=Q.get(C).programs;k!==void 0&&(k.forEach(function(K){ge.releaseProgram(K)}),C.isShaderMaterial&&ge.releaseShaderCache(C))}this.renderBufferDirect=function(C,k,K,J,V,ve){k===null&&(k=Ne);const Ee=V.isMesh&&V.matrixWorld.determinant()<0,Le=Vp(C,k,K,J,V);ne.setMaterial(J,Ee);let Fe=K.index,Ze=1;if(J.wireframe===!0){if(Fe=X.getWireframeAttribute(K),Fe===void 0)return;Ze=2}const qe=K.drawRange,Ve=K.attributes.position;let ut=qe.start*Ze,mt=(qe.start+qe.count)*Ze;ve!==null&&(ut=Math.max(ut,ve.start*Ze),mt=Math.min(mt,(ve.start+ve.count)*Ze)),Fe!==null?(ut=Math.max(ut,0),mt=Math.min(mt,Fe.count)):Ve!=null&&(ut=Math.max(ut,0),mt=Math.min(mt,Ve.count));const Ut=mt-ut;if(Ut<0||Ut===1/0)return;gt.setup(V,J,Le,K,Fe);let Dt,ht=De;if(Fe!==null&&(Dt=B.get(Fe),ht=Ye,ht.setIndex(Dt)),V.isMesh)J.wireframe===!0?(ne.setLineWidth(J.wireframeLinewidth*A()),ht.setMode(x.LINES)):ht.setMode(x.TRIANGLES);else if(V.isLine){let We=J.linewidth;We===void 0&&(We=1),ne.setLineWidth(We*A()),V.isLineSegments?ht.setMode(x.LINES):V.isLineLoop?ht.setMode(x.LINE_LOOP):ht.setMode(x.LINE_STRIP)}else V.isPoints?ht.setMode(x.POINTS):V.isSprite&&ht.setMode(x.TRIANGLES);if(V.isBatchedMesh)if(V._multiDrawInstances!==null)ia("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),ht.renderMultiDrawInstances(V._multiDrawStarts,V._multiDrawCounts,V._multiDrawCount,V._multiDrawInstances);else if(ie.get("WEBGL_multi_draw"))ht.renderMultiDraw(V._multiDrawStarts,V._multiDrawCounts,V._multiDrawCount);else{const We=V._multiDrawStarts,Gt=V._multiDrawCounts,_t=V._multiDrawCount,An=Fe?B.get(Fe).bytesPerElement:1,Es=Q.get(J).currentProgram.getUniforms();for(let fn=0;fn<_t;fn++)Es.setValue(x,"_gl_DrawID",fn),ht.render(We[fn]/An,Gt[fn])}else if(V.isInstancedMesh)ht.renderInstances(ut,Ut,V.count);else if(K.isInstancedBufferGeometry){const We=K._maxInstanceCount!==void 0?K._maxInstanceCount:1/0,Gt=Math.min(K.instanceCount,We);ht.renderInstances(ut,Ut,Gt)}else ht.render(ut,Ut)};function vt(C,k,K){C.transparent===!0&&C.side===Fn&&C.forceSinglePass===!1?(C.side=un,C.needsUpdate=!0,mr(C,k,K),C.side=Vi,C.needsUpdate=!0,mr(C,k,K),C.side=Fn):mr(C,k,K)}this.compile=function(C,k,K=null){K===null&&(K=C),p=Me.get(K),p.init(k),w.push(p),K.traverseVisible(function(V){V.isLight&&V.layers.test(k.layers)&&(p.pushLight(V),V.castShadow&&p.pushShadow(V))}),C!==K&&C.traverseVisible(function(V){V.isLight&&V.layers.test(k.layers)&&(p.pushLight(V),V.castShadow&&p.pushShadow(V))}),p.setupLights();const J=new Set;return C.traverse(function(V){if(!(V.isMesh||V.isPoints||V.isLine||V.isSprite))return;const ve=V.material;if(ve)if(Array.isArray(ve))for(let Ee=0;Ee{function ve(){if(J.forEach(function(Ee){Q.get(Ee).currentProgram.isReady()&&J.delete(Ee)}),J.size===0){V(C);return}setTimeout(ve,10)}ie.get("KHR_parallel_shader_compile")!==null?ve():setTimeout(ve,10)})};let Cn=null;function ti(C){Cn&&Cn(C)}function xd(){$i.stop()}function Sd(){$i.start()}const $i=new Fp;$i.setAnimationLoop(ti),typeof self!="undefined"&&$i.setContext(self),this.setAnimationLoop=function(C){Cn=C,oe.setAnimationLoop(C),C===null?$i.stop():$i.start()},oe.addEventListener("sessionstart",xd),oe.addEventListener("sessionend",Sd),this.render=function(C,k){if(k!==void 0&&k.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(I===!0)return;if(C.matrixWorldAutoUpdate===!0&&C.updateMatrixWorld(),k.parent===null&&k.matrixWorldAutoUpdate===!0&&k.updateMatrixWorld(),oe.enabled===!0&&oe.isPresenting===!0&&(oe.cameraAutoUpdate===!0&&oe.updateCamera(k),k=oe.getCamera()),C.isScene===!0&&C.onBeforeRender(S,C,k,R),p=Me.get(C,w.length),p.init(k),w.push(p),ue.multiplyMatrices(k.projectionMatrix,k.matrixWorldInverse),ce.setFromProjectionMatrix(ue),le=this.localClippingEnabled,N=he.init(this.clippingPlanes,le),_=be.get(C,T.length),_.init(),T.push(_),oe.enabled===!0&&oe.isPresenting===!0){const ve=S.xr.getDepthSensingMesh();ve!==null&&za(ve,k,-1/0,S.sortObjects)}za(C,k,0,S.sortObjects),_.finish(),S.sortObjects===!0&&_.sort(fe,ye),Ue=oe.enabled===!1||oe.isPresenting===!1||oe.hasDepthSensing()===!1,Ue&&Xe.addToRenderList(_,C),this.info.render.frame++,N===!0&&he.beginShadows();const K=p.state.shadowsArray;Ce.render(K,C,k),N===!0&&he.endShadows(),this.info.autoReset===!0&&this.info.reset();const J=_.opaque,V=_.transmissive;if(p.setupLights(),k.isArrayCamera){const ve=k.cameras;if(V.length>0)for(let Ee=0,Le=ve.length;Ee0&&Ed(J,V,C,k),Ue&&Xe.render(C),Md(_,C,k);R!==null&&D===0&&(M.updateMultisampleRenderTarget(R),M.updateRenderTargetMipmap(R)),C.isScene===!0&&C.onAfterRender(S,C,k),gt.resetDefaultState(),E=-1,g=null,w.pop(),w.length>0?(p=w[w.length-1],N===!0&&he.setGlobalState(S.clippingPlanes,p.state.camera)):p=null,T.pop(),T.length>0?_=T[T.length-1]:_=null};function za(C,k,K,J){if(C.visible===!1)return;if(C.layers.test(k.layers)){if(C.isGroup)K=C.renderOrder;else if(C.isLOD)C.autoUpdate===!0&&C.update(k);else if(C.isLight)p.pushLight(C),C.castShadow&&p.pushShadow(C);else if(C.isSprite){if(!C.frustumCulled||ce.intersectsSprite(C)){J&&Se.setFromMatrixPosition(C.matrixWorld).applyMatrix4(ue);const Ee=$.update(C),Le=C.material;Le.visible&&_.push(C,Ee,Le,K,Se.z,null)}}else if((C.isMesh||C.isLine||C.isPoints)&&(!C.frustumCulled||ce.intersectsObject(C))){const Ee=$.update(C),Le=C.material;if(J&&(C.boundingSphere!==void 0?(C.boundingSphere===null&&C.computeBoundingSphere(),Se.copy(C.boundingSphere.center)):(Ee.boundingSphere===null&&Ee.computeBoundingSphere(),Se.copy(Ee.boundingSphere.center)),Se.applyMatrix4(C.matrixWorld).applyMatrix4(ue)),Array.isArray(Le)){const Fe=Ee.groups;for(let Ze=0,qe=Fe.length;Ze0&&pr(V,k,K),ve.length>0&&pr(ve,k,K),Ee.length>0&&pr(Ee,k,K),ne.buffers.depth.setTest(!0),ne.buffers.depth.setMask(!0),ne.buffers.color.setMask(!0),ne.setPolygonOffset(!1)}function Ed(C,k,K,J){if((K.isScene===!0?K.overrideMaterial:null)!==null)return;p.state.transmissionRenderTarget[J.id]===void 0&&(p.state.transmissionRenderTarget[J.id]=new vs(1,1,{generateMipmaps:!0,type:ie.has("EXT_color_buffer_half_float")||ie.has("EXT_color_buffer_float")?ur:ei,minFilter:fs,samples:4,stencilBuffer:o,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ft.workingColorSpace}));const ve=p.state.transmissionRenderTarget[J.id],Ee=J.viewport||L;ve.setSize(Ee.z*S.transmissionResolutionScale,Ee.w*S.transmissionResolutionScale);const Le=S.getRenderTarget();S.setRenderTarget(ve),S.getClearColor(j),re=S.getClearAlpha(),re<1&&S.setClearColor(16777215,.5),S.clear(),Ue&&Xe.render(K);const Fe=S.toneMapping;S.toneMapping=zi;const Ze=J.viewport;if(J.viewport!==void 0&&(J.viewport=void 0),p.setupLightsView(J),N===!0&&he.setGlobalState(S.clippingPlanes,J),pr(C,K,J),M.updateMultisampleRenderTarget(ve),M.updateRenderTargetMipmap(ve),ie.has("WEBGL_multisampled_render_to_texture")===!1){let qe=!1;for(let Ve=0,ut=k.length;Ve0),Ve=!!K.morphAttributes.position,ut=!!K.morphAttributes.normal,mt=!!K.morphAttributes.color;let Ut=zi;J.toneMapped&&(R===null||R.isXRRenderTarget===!0)&&(Ut=S.toneMapping);const Dt=K.morphAttributes.position||K.morphAttributes.normal||K.morphAttributes.color,ht=Dt!==void 0?Dt.length:0,We=Q.get(J),Gt=p.state.lights;if(N===!0&&(le===!0||C!==g)){const nn=C===g&&J.id===E;he.setState(J,C,nn)}let _t=!1;J.version===We.__version?(We.needsLights&&We.lightsStateVersion!==Gt.state.version||We.outputColorSpace!==Le||V.isBatchedMesh&&We.batching===!1||!V.isBatchedMesh&&We.batching===!0||V.isBatchedMesh&&We.batchingColor===!0&&V.colorTexture===null||V.isBatchedMesh&&We.batchingColor===!1&&V.colorTexture!==null||V.isInstancedMesh&&We.instancing===!1||!V.isInstancedMesh&&We.instancing===!0||V.isSkinnedMesh&&We.skinning===!1||!V.isSkinnedMesh&&We.skinning===!0||V.isInstancedMesh&&We.instancingColor===!0&&V.instanceColor===null||V.isInstancedMesh&&We.instancingColor===!1&&V.instanceColor!==null||V.isInstancedMesh&&We.instancingMorph===!0&&V.morphTexture===null||V.isInstancedMesh&&We.instancingMorph===!1&&V.morphTexture!==null||We.envMap!==Fe||J.fog===!0&&We.fog!==ve||We.numClippingPlanes!==void 0&&(We.numClippingPlanes!==he.numPlanes||We.numIntersection!==he.numIntersection)||We.vertexAlphas!==Ze||We.vertexTangents!==qe||We.morphTargets!==Ve||We.morphNormals!==ut||We.morphColors!==mt||We.toneMapping!==Ut||We.morphTargetsCount!==ht)&&(_t=!0):(_t=!0,We.__version=J.version);let An=We.currentProgram;_t===!0&&(An=mr(J,k,V));let Es=!1,fn=!1,xo=!1;const At=An.getUniforms(),bn=We.uniforms;if(ne.useProgram(An.program)&&(Es=!0,fn=!0,xo=!0),J.id!==E&&(E=J.id,fn=!0),Es||g!==C){ne.buffers.depth.getReversed()?(Y.copy(C.projectionMatrix),wU(Y),TU(Y),At.setValue(x,"projectionMatrix",Y)):At.setValue(x,"projectionMatrix",C.projectionMatrix),At.setValue(x,"viewMatrix",C.matrixWorldInverse);const ln=At.map.cameraPosition;ln!==void 0&&ln.setValue(x,Oe.setFromMatrixPosition(C.matrixWorld)),te.logarithmicDepthBuffer&&At.setValue(x,"logDepthBufFC",2/(Math.log(C.far+1)/Math.LN2)),(J.isMeshPhongMaterial||J.isMeshToonMaterial||J.isMeshLambertMaterial||J.isMeshBasicMaterial||J.isMeshStandardMaterial||J.isShaderMaterial)&&At.setValue(x,"isOrthographic",C.isOrthographicCamera===!0),g!==C&&(g=C,fn=!0,xo=!0)}if(V.isSkinnedMesh){At.setOptional(x,V,"bindMatrix"),At.setOptional(x,V,"bindMatrixInverse");const nn=V.skeleton;nn&&(nn.boneTexture===null&&nn.computeBoneTexture(),At.setValue(x,"boneTexture",nn.boneTexture,M))}V.isBatchedMesh&&(At.setOptional(x,V,"batchingTexture"),At.setValue(x,"batchingTexture",V._matricesTexture,M),At.setOptional(x,V,"batchingIdTexture"),At.setValue(x,"batchingIdTexture",V._indirectTexture,M),At.setOptional(x,V,"batchingColorTexture"),V._colorsTexture!==null&&At.setValue(x,"batchingColorTexture",V._colorsTexture,M));const yn=K.morphAttributes;if((yn.position!==void 0||yn.normal!==void 0||yn.color!==void 0)&&$e.update(V,K,An),(fn||We.receiveShadow!==V.receiveShadow)&&(We.receiveShadow=V.receiveShadow,At.setValue(x,"receiveShadow",V.receiveShadow)),J.isMeshGouraudMaterial&&J.envMap!==null&&(bn.envMap.value=Fe,bn.flipEnvMap.value=Fe.isCubeTexture&&Fe.isRenderTargetTexture===!1?-1:1),J.isMeshStandardMaterial&&J.envMap===null&&k.environment!==null&&(bn.envMapIntensity.value=k.environmentIntensity),fn&&(At.setValue(x,"toneMappingExposure",S.toneMappingExposure),We.needsLights&&Hp(bn,xo),ve&&J.fog===!0&&pe.refreshFogUniforms(bn,ve),pe.refreshMaterialUniforms(bn,J,G,ae,p.state.transmissionRenderTarget[C.id]),sa.upload(x,Td(We),bn,M)),J.isShaderMaterial&&J.uniformsNeedUpdate===!0&&(sa.upload(x,Td(We),bn,M),J.uniformsNeedUpdate=!1),J.isSpriteMaterial&&At.setValue(x,"center",V.center),At.setValue(x,"modelViewMatrix",V.modelViewMatrix),At.setValue(x,"normalMatrix",V.normalMatrix),At.setValue(x,"modelMatrix",V.matrixWorld),J.isShaderMaterial||J.isRawShaderMaterial){const nn=J.uniformsGroups;for(let ln=0,ka=nn.length;ln0&&M.useMultisampledRTT(C)===!1?V=Q.get(C).__webglMultisampledFramebuffer:Array.isArray(qe)?V=qe[K]:V=qe,L.copy(C.viewport),O.copy(C.scissor),H=C.scissorTest}else L.copy(Re).multiplyScalar(G).floor(),O.copy(Be).multiplyScalar(G).floor(),H=Je;if(K!==0&&(V=Gp),ne.bindFramebuffer(x.FRAMEBUFFER,V)&&J&&ne.drawBuffers(C,V),ne.viewport(L),ne.scissor(O),ne.setScissorTest(H),ve){const Fe=Q.get(C.texture);x.framebufferTexture2D(x.FRAMEBUFFER,x.COLOR_ATTACHMENT0,x.TEXTURE_CUBE_MAP_POSITIVE_X+k,Fe.__webglTexture,K)}else if(Ee){const Fe=Q.get(C.texture),Ze=k;x.framebufferTextureLayer(x.FRAMEBUFFER,x.COLOR_ATTACHMENT0,Fe.__webglTexture,K,Ze)}else if(C!==null&&K!==0){const Fe=Q.get(C.texture);x.framebufferTexture2D(x.FRAMEBUFFER,x.COLOR_ATTACHMENT0,x.TEXTURE_2D,Fe.__webglTexture,K)}E=-1},this.readRenderTargetPixels=function(C,k,K,J,V,ve,Ee){if(!(C&&C.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Le=Q.get(C).__webglFramebuffer;if(C.isWebGLCubeRenderTarget&&Ee!==void 0&&(Le=Le[Ee]),Le){ne.bindFramebuffer(x.FRAMEBUFFER,Le);try{const Fe=C.texture,Ze=Fe.format,qe=Fe.type;if(!te.textureFormatReadable(Ze)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!te.textureTypeReadable(qe)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}k>=0&&k<=C.width-J&&K>=0&&K<=C.height-V&&x.readPixels(k,K,J,V,Ge.convert(Ze),Ge.convert(qe),ve)}finally{const Fe=R!==null?Q.get(R).__webglFramebuffer:null;ne.bindFramebuffer(x.FRAMEBUFFER,Fe)}}},this.readRenderTargetPixelsAsync=async function(C,k,K,J,V,ve,Ee){if(!(C&&C.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Le=Q.get(C).__webglFramebuffer;if(C.isWebGLCubeRenderTarget&&Ee!==void 0&&(Le=Le[Ee]),Le)if(k>=0&&k<=C.width-J&&K>=0&&K<=C.height-V){ne.bindFramebuffer(x.FRAMEBUFFER,Le);const Fe=C.texture,Ze=Fe.format,qe=Fe.type;if(!te.textureFormatReadable(Ze))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!te.textureTypeReadable(qe))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Ve=x.createBuffer();x.bindBuffer(x.PIXEL_PACK_BUFFER,Ve),x.bufferData(x.PIXEL_PACK_BUFFER,ve.byteLength,x.STREAM_READ),x.readPixels(k,K,J,V,Ge.convert(Ze),Ge.convert(qe),0);const ut=R!==null?Q.get(R).__webglFramebuffer:null;ne.bindFramebuffer(x.FRAMEBUFFER,ut);const mt=x.fenceSync(x.SYNC_GPU_COMMANDS_COMPLETE,0);return x.flush(),await EU(x,mt,4),x.bindBuffer(x.PIXEL_PACK_BUFFER,Ve),x.getBufferSubData(x.PIXEL_PACK_BUFFER,0,ve),x.deleteBuffer(Ve),x.deleteSync(mt),ve}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(C,k=null,K=0){const J=Math.pow(2,-K),V=Math.floor(C.image.width*J),ve=Math.floor(C.image.height*J),Ee=k!==null?k.x:0,Le=k!==null?k.y:0;M.setTexture2D(C,0),x.copyTexSubImage2D(x.TEXTURE_2D,K,0,0,Ee,Le,V,ve),ne.unbindTexture()};const Wp=x.createFramebuffer(),Xp=x.createFramebuffer();this.copyTextureToTexture=function(C,k,K=null,J=null,V=0,ve=null){ve===null&&(V!==0?(ia("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),ve=V,V=0):ve=0);let Ee,Le,Fe,Ze,qe,Ve,ut,mt,Ut;const Dt=C.isCompressedTexture?C.mipmaps[ve]:C.image;if(K!==null)Ee=K.max.x-K.min.x,Le=K.max.y-K.min.y,Fe=K.isBox3?K.max.z-K.min.z:1,Ze=K.min.x,qe=K.min.y,Ve=K.isBox3?K.min.z:0;else{const yn=Math.pow(2,-V);Ee=Math.floor(Dt.width*yn),Le=Math.floor(Dt.height*yn),C.isDataArrayTexture?Fe=Dt.depth:C.isData3DTexture?Fe=Math.floor(Dt.depth*yn):Fe=1,Ze=0,qe=0,Ve=0}J!==null?(ut=J.x,mt=J.y,Ut=J.z):(ut=0,mt=0,Ut=0);const ht=Ge.convert(k.format),We=Ge.convert(k.type);let Gt;k.isData3DTexture?(M.setTexture3D(k,0),Gt=x.TEXTURE_3D):k.isDataArrayTexture||k.isCompressedArrayTexture?(M.setTexture2DArray(k,0),Gt=x.TEXTURE_2D_ARRAY):(M.setTexture2D(k,0),Gt=x.TEXTURE_2D),x.pixelStorei(x.UNPACK_FLIP_Y_WEBGL,k.flipY),x.pixelStorei(x.UNPACK_PREMULTIPLY_ALPHA_WEBGL,k.premultiplyAlpha),x.pixelStorei(x.UNPACK_ALIGNMENT,k.unpackAlignment);const _t=x.getParameter(x.UNPACK_ROW_LENGTH),An=x.getParameter(x.UNPACK_IMAGE_HEIGHT),Es=x.getParameter(x.UNPACK_SKIP_PIXELS),fn=x.getParameter(x.UNPACK_SKIP_ROWS),xo=x.getParameter(x.UNPACK_SKIP_IMAGES);x.pixelStorei(x.UNPACK_ROW_LENGTH,Dt.width),x.pixelStorei(x.UNPACK_IMAGE_HEIGHT,Dt.height),x.pixelStorei(x.UNPACK_SKIP_PIXELS,Ze),x.pixelStorei(x.UNPACK_SKIP_ROWS,qe),x.pixelStorei(x.UNPACK_SKIP_IMAGES,Ve);const At=C.isDataArrayTexture||C.isData3DTexture,bn=k.isDataArrayTexture||k.isData3DTexture;if(C.isDepthTexture){const yn=Q.get(C),nn=Q.get(k),ln=Q.get(yn.__renderTarget),ka=Q.get(nn.__renderTarget);ne.bindFramebuffer(x.READ_FRAMEBUFFER,ln.__webglFramebuffer),ne.bindFramebuffer(x.DRAW_FRAMEBUFFER,ka.__webglFramebuffer);for(let Gi=0;GiMath.PI&&(i-=cn),s<-Math.PI?s+=cn:s>Math.PI&&(s-=cn),i<=s?this._spherical.theta=Math.max(i,Math.min(s,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(i+s)/2?Math.max(i,this._spherical.theta):Math.min(s,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let o=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const r=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),o=r!=this._spherical.radius}if(kt.setFromSpherical(this._spherical),kt.applyQuaternion(this._quatInverse),n.copy(this.target).add(kt),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let r=null;if(this.object.isPerspectiveCamera){const a=kt.length();r=this._clampDistance(a*this._scale);const l=a-r;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),o=!!l}else if(this.object.isOrthographicCamera){const a=new U(this._mouse.x,this._mouse.y,0);a.unproject(this.object);const l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),o=l!==this.object.zoom;const d=new U(this._mouse.x,this._mouse.y,0);d.unproject(this.object),this.object.position.sub(d).add(a),this.object.updateMatrixWorld(),r=kt.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;r!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(r).add(this.object.position):(Gr.origin.copy(this.object.position),Gr.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(Gr.direction))wl||8*(1-this._lastQuaternion.dot(this.object.quaternion))>wl||this._lastTargetPosition.distanceToSquared(this.target)>wl?(this.dispatchEvent(Ih),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?cn/60*this.autoRotateSpeed*e:cn/60/60*this.autoRotateSpeed}_getZoomScale(e){const n=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*n)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,n){kt.setFromMatrixColumn(n,0),kt.multiplyScalar(-e),this._panOffset.add(kt)}_panUp(e,n){this.screenSpacePanning===!0?kt.setFromMatrixColumn(n,1):(kt.setFromMatrixColumn(n,0),kt.crossVectors(this.object.up,kt)),kt.multiplyScalar(e),this._panOffset.add(kt)}_pan(e,n){const i=this.domElement;if(this.object.isPerspectiveCamera){const s=this.object.position;kt.copy(s).sub(this.target);let o=kt.length();o*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*o/i.clientHeight,this.object.matrix),this._panUp(2*n*o/i.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/i.clientWidth,this.object.matrix),this._panUp(n*(this.object.top-this.object.bottom)/this.object.zoom/i.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,n){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const i=this.domElement.getBoundingClientRect(),s=e-i.left,o=n-i.top,r=i.width,a=i.height;this._mouse.x=s/r*2-1,this._mouse.y=-(o/a)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const n=this.domElement;this._rotateLeft(cn*this._rotateDelta.x/n.clientHeight),this._rotateUp(cn*this._rotateDelta.y/n.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let n=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(cn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),n=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-cn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),n=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(cn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),n=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-cn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),n=!0;break}n&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),i=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._rotateStart.set(i,s)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),i=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._panStart.set(i,s)}}_handleTouchStartDolly(e){const n=this._getSecondPointerPosition(e),i=e.pageX-n.x,s=e.pageY-n.y,o=Math.sqrt(i*i+s*s);this._dollyStart.set(0,o)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const i=this._getSecondPointerPosition(e),s=.5*(e.pageX+i.x),o=.5*(e.pageY+i.y);this._rotateEnd.set(s,o)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const n=this.domElement;this._rotateLeft(cn*this._rotateDelta.x/n.clientHeight),this._rotateUp(cn*this._rotateDelta.y/n.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),i=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._panEnd.set(i,s)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const n=this._getSecondPointerPosition(e),i=e.pageX-n.x,s=e.pageY-n.y,o=Math.sqrt(i*i+s*s);this._dollyEnd.set(0,o),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const r=(e.pageX+n.x)*.5,a=(e.pageY+n.y)*.5;this._updateZoomParameters(r,a)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let n=0;n.9&&(r.visible=!1)),this.axis==="Y"&&(Pt.setFromEuler(Wr.set(0,0,Math.PI/2)),r.quaternion.copy(i).multiply(Pt),Math.abs(xt.copy(os).applyQuaternion(i).dot(this.eye))>.9&&(r.visible=!1)),this.axis==="Z"&&(Pt.setFromEuler(Wr.set(0,Math.PI/2,0)),r.quaternion.copy(i).multiply(Pt),Math.abs(xt.copy(No).applyQuaternion(i).dot(this.eye))>.9&&(r.visible=!1)),this.axis==="XYZE"&&(Pt.setFromEuler(Wr.set(0,Math.PI/2,0)),xt.copy(this.rotationAxis),r.quaternion.setFromRotationMatrix(kh.lookAt(zh,xt,os)),r.quaternion.multiply(Pt),r.visible=this.dragging),this.axis==="E"&&(r.visible=!1)):r.name==="START"?(r.position.copy(this.worldPositionStart),r.visible=this.dragging):r.name==="END"?(r.position.copy(this.worldPosition),r.visible=this.dragging):r.name==="DELTA"?(r.position.copy(this.worldPositionStart),r.quaternion.copy(this.worldQuaternionStart),Kt.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),Kt.applyQuaternion(this.worldQuaternionStart.clone().invert()),r.scale.copy(Kt),r.visible=this.dragging):(r.quaternion.copy(i),this.dragging?r.position.copy(this.worldPositionStart):r.position.copy(this.worldPosition),this.axis&&(r.visible=this.axis.search(r.name)!==-1));continue}r.quaternion.copy(i),this.mode==="translate"||this.mode==="scale"?(r.name==="X"&&Math.abs(xt.copy(Oo).applyQuaternion(i).dot(this.eye))>.99&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="Y"&&Math.abs(xt.copy(os).applyQuaternion(i).dot(this.eye))>.99&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="Z"&&Math.abs(xt.copy(No).applyQuaternion(i).dot(this.eye))>.99&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="XY"&&Math.abs(xt.copy(No).applyQuaternion(i).dot(this.eye))<.2&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="YZ"&&Math.abs(xt.copy(Oo).applyQuaternion(i).dot(this.eye))<.2&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="XZ"&&Math.abs(xt.copy(os).applyQuaternion(i).dot(this.eye))<.2&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1)):this.mode==="rotate"&&(Xr.copy(i),xt.copy(this.eye).applyQuaternion(Pt.copy(i).invert()),r.name.search("E")!==-1&&r.quaternion.setFromRotationMatrix(kh.lookAt(this.eye,zh,os)),r.name==="X"&&(Pt.setFromAxisAngle(Oo,Math.atan2(-xt.y,xt.z)),Pt.multiplyQuaternions(Xr,Pt),r.quaternion.copy(Pt)),r.name==="Y"&&(Pt.setFromAxisAngle(os,Math.atan2(xt.x,xt.z)),Pt.multiplyQuaternions(Xr,Pt),r.quaternion.copy(Pt)),r.name==="Z"&&(Pt.setFromAxisAngle(No,Math.atan2(xt.y,xt.x)),Pt.multiplyQuaternions(Xr,Pt),r.quaternion.copy(Pt))),r.visible=r.visible&&(r.name.indexOf("X")===-1||this.showX),r.visible=r.visible&&(r.name.indexOf("Y")===-1||this.showY),r.visible=r.visible&&(r.name.indexOf("Z")===-1||this.showZ),r.visible=r.visible&&(r.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),r.material._color=r.material._color||r.material.color.clone(),r.material._opacity=r.material._opacity||r.material.opacity,r.material.color.copy(r.material._color),r.material.opacity=r.material._opacity,this.enabled&&this.axis&&(r.name===this.axis||this.axis.split("").some(function(l){return r.name===l}))&&(r.material.color.setHex(16776960),r.material.opacity=1)}super.updateMatrixWorld(e)}}class v4 extends Ae{constructor(){super(new bo(1e5,1e5,2,2),new Oa({visible:!1,wireframe:!0,side:Fn,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(e){let n=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(n="local"),jr.copy(Oo).applyQuaternion(n==="local"?this.worldQuaternion:oa),Ro.copy(os).applyQuaternion(n==="local"?this.worldQuaternion:oa),Do.copy(No).applyQuaternion(n==="local"?this.worldQuaternion:oa),xt.copy(Ro),this.mode){case"translate":case"scale":switch(this.axis){case"X":xt.copy(this.eye).cross(jr),Gn.copy(jr).cross(xt);break;case"Y":xt.copy(this.eye).cross(Ro),Gn.copy(Ro).cross(xt);break;case"Z":xt.copy(this.eye).cross(Do),Gn.copy(Do).cross(xt);break;case"XY":Gn.copy(Do);break;case"YZ":Gn.copy(jr);break;case"XZ":xt.copy(Do),Gn.copy(Ro);break;case"XYZ":case"E":Gn.set(0,0,0);break}break;case"rotate":default:Gn.set(0,0,0)}Gn.length()===0?this.quaternion.copy(this.cameraQuaternion):(Bh.lookAt(Kt.set(0,0,0),Gn,xt),this.quaternion.setFromRotationMatrix(Bh)),super.updateMatrixWorld(e)}}let ns,In,ai,Mn;const b4={props:{width:Number,height:Number,x:Number,y:Number,z:Number,a:Number,x_max:Number,x_min:Number,y_max:Number,y_min:Number,z_max:Number,z_min:Number},methods:{render(){ai.render(In,ns)},setSize(){ai.setSize(this.width,this.height),this.render()},setPos(){let t={x:this.x,y:this.y,z:this.z,a:this.a};t.x=t.x>this.x_max?this.x_max:t.x,t.x=t.xthis.y_max?this.y_max:t.y,t.y=t.ythis.z_max?this.z_max:t.z,t.z=t.zo.moveOnTop())},[c("div",{class:"wintitle",onDblclick:e[2]||(e[2]=r=>o.dblclickTitle()),onMousedown:e[3]||(e[3]=(...r)=>o.mousedownTitle&&o.mousedownTitle(...r)),onMouseup:e[4]||(e[4]=r=>o.mouseupTitle())},[C4,c("div",A4,ze(n.title),1),c("div",{class:"btn imgClose",onClick:e[0]||(e[0]=r=>o.close()),title:"Close"}),c("div",{class:"btn imgMin",onClick:e[1]||(e[1]=r=>o.toggleMinimize()),title:"Minimize / Restore"})],32),c("div",P4,[Qs(t.$slots,"default")])],6)}var D4=ct(T4,[["render",R4]]),I4={methods:{async controllerMove(t){let e=[];switch(t){case"X-Y+":e=[`$J=G21G91X-${this.movingOptions.stepSize}Y${this.movingOptions.stepSize}F${this.movingOptions.feedRateXYZ}`];break;case"Y+":e=[`$J=G21G91Y${this.movingOptions.stepSize}F${this.movingOptions.feedRateXYZ}`];break;case"X+Y+":e=[`$J=G21G91X${this.movingOptions.stepSize}Y${this.movingOptions.stepSize}F${this.movingOptions.feedRateXYZ}`];break;case"X-":e=[`$J=G21G91X-${this.movingOptions.stepSize}F${this.movingOptions.feedRateXYZ}`];break;case"X+":e=[`$J=G21G91X${this.movingOptions.stepSize}F${this.movingOptions.feedRateXYZ}`];break;case"X-Y-":e=[`$J=G21G91X-${this.movingOptions.stepSize}Y-${this.movingOptions.stepSize}F${this.movingOptions.feedRateXYZ}`];break;case"Y-":e=[`$J=G21G91Y-${this.movingOptions.stepSize}F${this.movingOptions.feedRateXYZ}`];break;case"X+Y-":e=[`$J=G21G91X${this.movingOptions.stepSize}Y-${this.movingOptions.stepSize}F${this.movingOptions.feedRateXYZ}`];break;case"Z+":e=[`$J=G21G91Z${this.movingOptions.stepSize}F${this.movingOptions.feedRateXYZ}`];break;case"Z-":e=[`$J=G21G91Z-${this.movingOptions.stepSize}F${this.movingOptions.feedRateXYZ}`];break;case"RL":e=[`$J=G21G91A${this.movingOptions.rotateStep}F${this.movingOptions.feedRateA}`];break;case"RR":e=[`$J=G21G91A-${this.movingOptions.rotateStep}F${this.movingOptions.feedRateA}`];break;case"Return":e=["G90 G0 X0 Y0"];break;case"ReturnZ":e=["G90 G0 Z0"];break;case"Reset":cmd=String.fromCharCode(24);break;case"State":e=["$G"];break;case"Pos":e=["?"];break;case"Home":e=["$H"];break;case"Unlock":e=["$X"];break;case"ResetZero":e=["G10 P0 L20 X0 Y0 Z0"];break;case"HomeResetZero":e.push("$H"),e.push("G10 P0 L20 X0 Y0 Z0");break;case"Parking":e.push(`G0 Z${this.settings.parking.pos.z}`),e.push(`G0 X${this.settings.parking.pos.x} Y${this.settings.parking.pos.y} A0`);break}for(let n of e)await this.sendCommandUI(n)},controllerTogglePump(){let t=this.pumpState?this.settings.pump.Off:this.settings.pump.On;this.sendCommandUI(t)},controllerToggleValve(t){let e=this.valvesState[t]?this.settings.heads[t].valveOff:this.settings.heads[t].valveOn;this.sendCommandUI(e)},controllerToggleCamNozzlePosition(){let t,e=this.settings.cams[0].offset;this.movingOptions.topCamNozzlePos==0?(this.movingOptions.topCamNozzlePos=1,t=`$J=G21G91X${-e.x}Y${-e.y}F${this.movingOptions.feedRateXYZ}`):(this.movingOptions.topCamNozzlePos=0,t=`$J=G21G91X${e.x}Y${e.y}F${this.movingOptions.feedRateXYZ}`),this.sendCommandUI(t)}}},L4={methods:{async sendCommandUI(t){if(this.consoleLogAppend(">>> "+t),this.portIsOpened)for(await this.sendCommand(t),this.consoleLogAppend(this.request),t[0]=="M"&&await this.sendCommand("$G"),t!=="?"&&await this.sendCommand("?");this.machineState.status!=="Idle"&&this.machineState.status!=="Alarm";)await new Promise(e=>setTimeout(e,100)),await this.sendCommand("?")},async sendCommands(t,e=!1){if(this.pnpProcessing.stopFlag!=!0){this.gCodeProcess.stopFlag=!1,this.gCodeProcess.pauseFlag=!1;for(let n of t){if(console.log(n),await this.sendCommand(n),n!=="?"&&await this.sendCommand("?"),e)for(;this.machineState.status!=="Idle";)await new Promise(i=>setTimeout(i,100)),await this.sendCommand("?");for(;this.gCodeProcess.pauseFlag==!0||this.pnpProcessing.pauseFlag==!0;)await new Promise(i=>setTimeout(i,200));if(this.gCodeProcess.stopFlag==!0||this.pnpProcessing.stopFlag==!0)break}this.gCodeProcess.stopFlag=!1,this.gCodeProcess.pauseFlag=!1}},async sendCommand(t){if(this.portIsOpened){t=="$H"&&(this.machineState.status="Homing");let e=Uint8Array.from(Array.from(t+` `).map(n=>n.charCodeAt(0)));await this.portConnection.write(e),await this.readRequest()}},async readRequest(){let t=await this.portConnection.read();this.parseRequest(t)},parseRequest(t){let n=new TextDecoder().decode(t);this.request=n;let i=/<([a-z,A-Z]*)\|MPos:(.*)>/g,s=n.matchAll(i);if(s=Array.from(s),s.length==1){if(s[0].length==3){this.machineState.status=s[0][1];let o=s[0][2].split(",");this.machineState.pos.x=parseFloat(o[0]),this.machineState.pos.y=parseFloat(o[1]),this.machineState.pos.z=parseFloat(o[2]),this.machineState.pos.a=parseFloat(o[3])}}else{let o=/\[([a-z,A-Z, ]*):(.*)]/g,r=n.matchAll(o);if(r=Array.from(r),r.length>0)for(let a of r)a.length==3&&(this.machineState.info[a[1]]=a[2]);else{let a=/\$([0-9]*)=(.*)/g,l=n.matchAll(a);if(l=Array.from(l),l.length>0)for(let d of l)d.length==3&&(this.machineState.settings[d[1]]=parseFloat(d[2]))}}},async getCVData(t){let e="http://localhost:5000/cv/"+t+"?"+Date.now(),n=this.cvParams[t];return await this.fetch_execute_async(e,{method:"POST",credentials:"same-origin",cache:"no-cache",headers:{"Content-Type":"application/json;charset=utf-8"},body:JSON.stringify(n)})},fetch_execute_async:async function(t,e){this.loading=!0;try{return await(await fetch(t,e)).json()}catch(n){console.log(n)}finally{this.loading=!1}},async pnpGoToZero(){let t=[],e=parseFloat(this.settings.heads[0].safePosZ);t.push(`G0 Z${e}`),t.push("G0 X0 Y0"),t.push("G0 Z0"),await this.sendCommands(t,!0)},async pnpGoToParking(){let t=[];t.push(`G0 Z${this.settings.parking.pos.z}`),t.push(`G0 X${this.settings.parking.pos.x} Y${this.settings.parking.pos.y} A0`),await this.sendCommands(t,!0)},async pnpPumpOn(){let t=[];t.push(this.settings.pump.On),t.push("$G"),await this.sendCommands(t,!0)},async pnpPumpOff(){let t=[];t.push(this.settings.pump.Off),t.push("$G"),await this.sendCommands(t,!0)},async pnpValveOn(t){let e=[];e.push(`G04 P${t.pauseBeforeOn}`),e.push(t.valveOn),e.push(`G04 P${t.pauseAfterOn}`),e.push("$G"),await this.sendCommands(e,!0)},async pnpValveOff(t){let e=[];e.push(`G04 P${t.pauseBeforeOff}`),e.push(t.valveOff),e.push(`G04 P${t.pauseAfterOff}`),e.push("$G"),await this.sendCommands(e,!0)},async pnpLightOn(t){let e=[];e.push(this.settings.cams[t].lightOn),e.push("$G"),await this.sendCommands(e,!0)},async pnpLightOff(t){let e=[];e.push(this.settings.cams[t].lightOff),e.push("$G"),await this.sendCommands(e,!0)},async pnpSafetyUp(t){let n=`G0 Z${parseFloat(this.settings.heads[0].safePosZ)}`;isNaN(t)||(n=n+` A${t}`);let i=[n];await this.sendCommands(i,!0)},async pnpSafetyGoToXYZ(t,e,n){let i=[],s=parseFloat(this.settings.heads[0].safePosZ);i.push(`G0 Z${s}`),i.push(`G0 X${t} Y${e}`),isNaN(n)||i.push(`G0 Z${n}`),await this.sendCommands(i,!0)},async pnpGoToXYZA(t,e,n,i){let s="G0";isNaN(t)||(s=s+` X${t}`),isNaN(e)||(s=s+` Y${e}`),isNaN(n)||(s=s+` Z${n}`),isNaN(i)||(s=s+` A${i}`);let o=[s];await this.sendCommands(o,!0)},async pnpGoToXYZF(t,e,n,i){let s="G1";isNaN(t)||(s=s+` X${t}`),isNaN(e)||(s=s+` Y${e}`),isNaN(n)||(s=s+` Z${n}`),isNaN(i)||(s=s+` F${i}`);let o=[s];await this.sendCommands(o,!0)},async pnpGoToBottomCam(){let t=this.pnpProcessing.runFlag;try{this.pnpProcessing.runFlag=!0;let e=1,n,i,s;n=parseFloat(this.settings.cams[e].pos.x),i=parseFloat(this.settings.cams[e].pos.y),s=parseFloat(this.settings.cams[e].pos.z),await this.pnpSafetyGoToXYZ(n,i,NaN,NaN),await this.pnpLightOn(e),await this.pnpGoToXYZA(NaN,NaN,s,NaN)}finally{this.pnpProcessing.runFlag=t}},getFeederPos(t){let e=0,n=0;if(t.type==0&&(e=t.pos.x,n=t.pos.y),t.type==1)for(let i of t.pathPoints)i.pick==!0&&(e=i.x,n=i.y);return{x:e,y:n}},async pnpGoToFeeder(t){let e=this.pnpProcessing.runFlag;try{this.pnpProcessing.runFlag=!0;let n=this.getFeederPos(t);await this.pnpSafetyGoToXYZ(n.x,n.y,NaN)}finally{this.pnpProcessing.runFlag=e}},async pnpGoToFeederCam(t){let e=this.pnpProcessing.runFlag;try{this.pnpProcessing.runFlag=!0;let n=this.getFeederPos(t);n.x=parseFloat(n.x)-parseFloat(this.settings.cams[0].offset.x),n.y=parseFloat(n.y)-parseFloat(this.settings.cams[0].offset.y),await this.pnpSafetyGoToXYZ(n.x,n.y,NaN)}finally{this.pnpProcessing.runFlag=e}},async pnpPickFromFeeder(t,e=0){let n=this.pnpProcessing.runFlag;try{this.pnpProcessing.runFlag=!0;let i,s,o,r=this.settings.heads[e];if(t.type==0)if(parseInt(t.current)+1setTimeout(h,this.settings.cv[e].pauseBefore*1e3)),r=await this.getCVData(e),typeof r.objects.object!="undefined"){let h=Math.round(r.objects.object.dx*1e3/this.settings.cams[e].ppmm)/1e3,m=Math.round(r.objects.object.dy*1e3/this.settings.cams[e].ppmm)/1e3;n=n-h,i=i-m;let b=r.objects.object.angle_degrees;b<-45&&(b=90+b),b>45&&(b=-90+b),b=b/360,o=o-b,Math.abs(h)<5&&Math.abs(m)<5&&Math.abs(b)<.25&&await this.pnpGoToXYZA(n,i,NaN,o)}await this.pnpLightOff(e);let l=parseFloat(this.machinePos.x)-parseFloat(this.settings.cams[e].pos.x),d=parseFloat(this.machinePos.y)-parseFloat(this.settings.cams[e].pos.y);return{x:l,y:d}}finally{this.pnpProcessing.runFlag=t}},async pnpGoToElement(t){let e=this.pnpProcessing.runFlag;try{this.pnpProcessing.runFlag=!0;let n=this.project.pcb.pos,i=parseFloat(t.pos.x)+parseFloat(n.x),s=parseFloat(t.pos.y)+parseFloat(n.y);await this.pnpSafetyGoToXYZ(i,s,NaN)}finally{this.pnpProcessing.runFlag=e}},async pnpGoToElementCam(t){let e=this.pnpProcessing.runFlag;try{this.pnpProcessing.runFlag=!0;let n=this.project.pcb.pos,i=parseFloat(t.pos.x)+parseFloat(n.x)-parseFloat(this.settings.cams[0].offset.x),s=parseFloat(t.pos.y)+parseFloat(n.y)-parseFloat(this.settings.cams[0].offset.y);await this.pnpSafetyGoToXYZ(i,s,NaN)}finally{this.pnpProcessing.runFlag=e}},getNozzle(t){for(let e of this.settings.nozzles)if(e.id==t)return e},getNozzleOffset(t,e){e<0&&(e=1+e);for(let n of t.calibrationData)if(n.a>=e)return n},async pnpPlaceElement(t){let e=this.pnpProcessing.runFlag;try{this.pnpProcessing.runFlag=!0;let n=this.settings.heads[0],i=parseFloat(this.settings.table.pos.z),s=t.feeder,o={x:0,y:0},r=parseFloat(t.pos.a);for(let a of this.project.feeders)if(a.id==s){if(await this.pnpPickFromFeeder(a)==!1)return!1;if(r!==0&&await this.pnpGoToXYZA(NaN,NaN,NaN,r),a.posCorrection==!0)o=await this.pnpFixPosition();else{let h=this.getNozzle(a.nozzle),m=this.getNozzleOffset(h,r);o.x=m.dx,o.y=m.dy}let l=this.project.pcb.pos,d=parseFloat(t.pos.x)+parseFloat(o.x)+parseFloat(l.x),u=parseFloat(t.pos.y)+parseFloat(o.y)+parseFloat(l.y),f=i+parseFloat(l.z)+parseFloat(a.elementHeight);await this.pnpSafetyGoToXYZ(d,u,f),await this.pnpValveOff(n),await this.pnpSafetyUp(),await this.pnpGoToXYZA(NaN,NaN,NaN,0)}return!0}finally{this.pnpProcessing.runFlag=e}},async pnpAutocalibrateNozzle(t){let e=this.pnpProcessing.runFlag;try{this.pnpProcessing.runFlag=!0;let n=1,i=this.settings.cams[n].ppmm;await this.pnpSafetyUp(0),await this.pnpGoToBottomCam();for(let s of t.calibrationData){await this.pnpGoToXYZA(NaN,NaN,NaN,s.a),await new Promise(r=>setTimeout(r,this.settings.cv[n].pauseBefore*1e3));let o=await this.getCVData(n);if(typeof o.objects.nozzle!="undefined")s.dx=-(o.objects.nozzle.dx/i).toFixed(3),s.dy=-(o.objects.nozzle.dy/i).toFixed(3);else{await lt("Autocalibration is failed! Nozzle not found!","Error","error");return}}await this.pnpLightOff(n),await this.pnpSafetyUp(0),await lt("Calibration has been completed","Completed","success")}finally{this.pnpProcessing.runFlag=e}},getNozzlePlace(t){for(let e of this.settings.nozzlesHolder.places)if(e.nozzleId==t)return e;return null},async pnpPullOffNozzle(t){if(this.settings.heads[0].nozzle==-1)return!0;let e=null;for(let n of this.settings.nozzlesHolder.places)if(n.nozzleId==-1){e=n;break}if(e==null)return lt("Not found the empty place!","Error","error"),!1;console.log(e);for(let n=e.points.length-1;n>=0;n--){let i=e.points[n];console.log(i),n==e.points.length-1?await this.pnpSafetyGoToXYZ(i.x,i.y,i.z):await this.pnpGoToXYZF(i.x,i.y,i.z,t.feed)}return e.nozzleId=this.settings.heads[0].nozzle,this.settings.heads[0].nozzle=-1,!0},async pnpPutOnNozzle(t){if(t.nozzleId==-1){lt("Specified Nozzle place is empty!","Error","error");return}if(t.points.length==0){lt("Not specified the path to take!","Error","error");return}if(await this.pnpPullOffNozzle(t)!=!1){console.log(t);for(let e=0;e{s==!0&&this.pnpJobProcessing(e)})},async pnpJobProcessing(t){let e=this.pnpProcessing.runFlag;try{this.pnpProcessing.runFlag=!0,this.pnpProcessingRun(),await this.pnpPumpOn();let n=this.settings.heads[0].nozzle;for(let i of t)if(this.pnpProcessing.stopFlag==!1&&i.active==!0){if(this.pnpProcessing.element=i,this.pnpProcessing.message=`Element is being placed: ${i.name}`,i.nozzleId!=this.settings.heads[0].nozzle){let s=this.getNozzlePlace(i.nozzleId);console.log("Change Nozzle"),console.log(s),await this.pnpPutOnNozzle(s)}if(await this.pnpPlaceElement(i)==!1)return await lt("Job is braked!","Warning","warning"),!1}if(this.settings.heads[0].nozzle!=n){let i=this.getNozzlePlace(n);await this.pnpPutOnNozzle(i)}await this.pnpPumpOff(),await this.pnpGoToParking(),this.pnpProcessing.stopFlag==!0?(this.pnpProcessing.message=`The Job has been canceled on Element: ${this.pnpProcessing.element.name}`,await lt("The Job has been canceled!","Canceled","warning"),this.pnpProcessingReset()):(this.pnpProcessing.message="Completed",this.pnpProcessing.element=null,await lt('The project "'+this.project.name+'" has been completed',"Completed","success"),this.pnpProcessing.message="")}finally{this.pnpProcessing.runFlag=e}}}};const U4={mixins:[I4,L4,xs],components:{Loading:vL,DialogWrapper:My,Window:D4,Vializer3D:w4,ControllerState:vv,ControllerMovingNew:ay,ControllerConsole:vy,ControllerGCode:lx,ControllerSettings:Sx,CamerasSettings:aM,CVSettings:rE,HeadsSettings:QE,PumpSettings:pw,NozzlesSettings:CT,NozzlesHolderSettings:WC,BasketSettings:_A,ParkingSettings:VA,FeedersSettings:up,PCBTableSettings:$2,Projects:hL},data(){return{tab:0,tabSettings:0,showWindow:[!1,!1,!1,!1],timerId:this.timerId,consoleLog:"",command:this.command,request:this.request,gCodeProcess:{stopFlag:!1,pauseFlag:!1},pnpProcessing:{runFlag:!1,stopFlag:!1,pauseFlag:!1,element:null,message:""},camsViewSMDCase:{case:"",rotate:0},camsViewParams:[{raw:1,cv:0,ppmm:10,grid:1,marker:0},{raw:1,cv:0,ppmm:10,grid:1,marker:0}],CVLikeMachineView:!1,CVResult:[{},{}],machineState:{status:"Not connected",pos:{x:0,y:0,z:0,a:0},settings:{},info:{},gc:[]},loading:!1,movingOptions:{topCamNozzlePos:0,stepSize:10,feedRateXYZ:2e3,rotateStep:.125,feedRateA:500},settings:{machineOffsets:{x:1,y:1,z:1,a:0},cams:[{id:"0",name:"Top",size:{width:800,height:600},undistort:{type:0,distortion_f:0,calibration:{matrix:[[543196.224,0,2499.72745],[0,524402.144,1899.1843],[0,0,1]],distortion:[[-11.527107,.00137230942,-.00112470987,-.0196992455,266238632e-16]]}},image_transform:{rotation:0,scale_x:1,scale_y:1},ppmm:10,pos:{x:0,y:0,z:0},offset:{x:0,y:0},lightOn:"M72",lightOff:"M71"},{id:"1",name:"Bottom",size:{width:800,height:600},undistort:{type:0,distortion_f:0,calibration:{matrix:[[543196.224,0,2499.72745],[0,524402.144,1899.1843],[0,0,1]],distortion:[[-11.527107,.00137230942,-.00112470987,-.0196992455,266238632e-16]]}},image_transform:{rotation:0,scale_x:1,scale_y:1},ppmm:10,pos:{x:0,y:0,z:0},offset:{x:0,y:0},lightOn:"M82",lightOff:"M81"}],cv:[{name:"Top",contrast:1,brightness:0,blur:[1,1],adaptiveThreshold_blockSize:11,adaptiveThreshold_C:2,objects:{circle:{"r-min":1.5,"r-max":2,"dist-min":7},rectangle:{"w-min":2,"w-max":8,"h-min":2,"h-max":8}},pauseBefore:0},{name:"Bottom",contrast:1,brightness:0,blur:[1,1],adaptiveThreshold_blockSize:799,adaptiveThreshold_C:27,objects:{contour:{"w-min":.2,"w-max":20,"h-min":.2,"h-max":20},circle:{"r-min":1.5,"r-max":4,"dist-min":10}},pauseBefore:0}],basket:{pos:{x:0,y:0,z:0}},parking:{pos:{x:0,y:0,z:0}},table:{pos:{x:0,y:0,z:0}},heads:[{id:0,name:"Head 1",safePosZ:20,valveOn:"M32",valveOff:"M31",inGC:"V1",pauseBeforeOn:0,pauseAfterOn:0,pauseBeforeOff:0,pauseAfterOff:0,nozzle:0}],pump:{On:"M42",Off:"M41",inGC:"V2"},nozzles:[{id:0,name:"Nozzle 1",caption:"",calibrationData:[{a:0,dx:0,dy:0},{a:.125,dx:0,dy:0},{a:.25,dx:0,dy:0},{a:.375,dx:0,dy:0},{a:.5,dx:0,dy:0},{a:.625,dx:0,dy:0},{a:.75,dx:0,dy:0},{a:.875,dx:0,dy:0}]}],nozzlesHolder:{places:[{id:1,name:"Place 1",nozzleId:-1,points:[{x:0,y:0,z:0},{x:0,y:0,z:0},{x:0,y:0,z:0}],feed:100},{id:2,name:"Place 2",nozzleId:-1,points:[{x:0,y:0,z:0},{x:0,y:0,z:0},{x:0,y:0,z:0}],feed:100},{id:3,name:"Place 3",nozzleId:-1,points:[{x:0,y:0,z:0},{x:0,y:0,z:0},{x:0,y:0,z:0}],feed:100},{id:4,name:"Place 4",nozzleId:-1,points:[{x:0,y:0,z:0},{x:0,y:0,z:0},{x:0,y:0,z:0}],feed:100},{id:5,name:"Place 5",nozzleId:-1,points:[{x:0,y:0,z:0},{x:0,y:0,z:0},{x:0,y:0,z:0}],feed:100}]}},cases:[{name:"",src:""},{name:"R0402",src:"cases/R0402.svg"},{name:"R0603",src:"cases/R0603.svg"},{name:"R0805",src:"cases/R0805.svg"},{name:"R1206",src:"cases/R1206.svg"},{name:"R1210",src:"cases/R1210.svg"},{name:"R1812",src:"cases/1812.svg"},{name:"R2010",src:"cases/2010.svg"},{name:"R2220",src:"cases/2220.svg"},{name:"R2512",src:"cases/2512.svg"},{name:"C0402",src:"cases/C0402.svg"},{name:"C0603",src:"cases/C0603.svg"},{name:"C0805",src:"cases/C0805.svg"},{name:"C1206",src:"cases/C1206.svg"},{name:"SOD-923",src:"cases/sod923.svg"},{name:"SOD-723",src:"cases/sod723.svg"},{name:"SOD-523",src:"cases/sod523.svg"},{name:"SOD-323",src:"cases/SOD-323.svg"},{name:"SOD-123",src:"cases/sod123.svg"},{name:"SOD-123F",src:"cases/sod123f.svg"},{name:"SOD-123FL",src:"cases/SOD-123FL.svg"},{name:"SOD-123W",src:"cases/sod123w.svg"},{name:"SMA",src:"cases/SMA.svg"},{name:"SMB",src:"cases/SMB.svg"},{name:"SMC",src:"cases/smc.svg"},{name:"LED-0603",src:"cases/LED0603.svg"},{name:"LED-0805",src:"cases/LED0805.svg"},{name:"SOT-23",src:"cases/SOT-23.svg"},{name:"SOT-23-5",src:"cases/SOT-23-5.svg"},{name:"SOT-23-6",src:"cases/SOT-23-6.svg"},{name:"SOT-AMS-1117-2.5",src:"cases/SOT-AMS-1117-2.5.svg"},{name:"TO-263-2",src:"cases/TO-263-2.svg"},{name:"PDFN-8-L5.2W5.9",src:"cases/PDFN-8-L5.2W5.9.svg"},{name:"PDFN-8-L5.5W5.2",src:"cases/PDFN-8-L5.5W5.2.svg"},{name:"SOP-8",src:"cases/SOP-8.svg"},{name:"SOIC-8",src:"cases/SOIC-8.svg"},{name:"SOP-16",src:"cases/SOP-16.svg"},{name:"TSSOP-8",src:"cases/TSSOP-8.svg"},{name:"TSSOP-16",src:"cases/TSSOP-16.svg"},{name:"TSSOP-20",src:"cases/TSSOP-20.svg"},{name:"LQFP-48",src:"cases/LQFP-48.svg"},{name:"LQFP-64",src:"cases/LQFP-64.svg"},{name:"BTS7960B",src:"cases/BTS7960B.svg"},{name:"OSC-SMD-4P3225",src:"cases/OSC-SMD-4P3225.svg"}],feeders:[],project:{name:"New Project",feeders:[],elements:[],pcb:{pos:{x:0,y:0,z:1.6}}},projects_list:[]}},computed:{portConnection(){return this.$root.serialPortHandler},portIsOpened(){if(this.portConnection&&this.portConnection.isOpened==!0)return!0},videoSrc(){let t=[],e=0;for(let n of this.camsViewParams){let i=`http://localhost:5000/video_feed/${e}/${n.raw}/${n.cv}/${n.ppmm}/${n.grid}/${n.marker}?${Date.now()}`;e+=1,t.push(i)}return t},controlsEnabled(){return this.machineState.status=="Idle"&&this.pnpProcessing.runFlag==!1},controlsEnabledUnderAlarm(){return(this.machineState.status=="Idle"||this.machineState.status=="Alarm"||this.machineState.status=="Home")&&this.pnpProcessing.runFlag==!1},pumpState(){let t=!1;return typeof this.machineState.info.GC!="undefined"&&(t=this.machineState.info.GC.indexOf(this.settings.pump.inGC)>-1),t},valvesState(){let t=[!1];if(typeof this.machineState.info.GC!="undefined")for(let e in this.settings.heads)t[e]=this.machineState.info.GC.indexOf(this.settings.heads[e].inGC)>-1;return t},lightsState(){let t=[!1,!1];if(typeof this.machineState.info.GC!="undefined")for(let e=0;e<2;e++)t[e]=this.machineState.info.GC.indexOf("L"+(e+1))>-1;return t},machinePos(){let t=parseFloat(this.machineState.pos.x)+this.settings.machineOffsets.x,e=parseFloat(this.machineState.pos.y)+this.settings.machineOffsets.y,n=parseFloat(this.machineState.pos.z)+this.settings.machineOffsets.z,i=parseFloat(this.machineState.pos.a)+this.settings.machineOffsets.a;return{x:t.toFixed(3),y:e.toFixed(3),z:n.toFixed(3),a:i.toFixed(3)}},cvParams(){let t=[];for(let e in this.settings.cv){let n=structuredClone(pt(this.settings.cv[e].objects));for(let i in n)for(let s in n[i])n[i][s]=Math.round(n[i][s]*this.settings.cams[e].ppmm);n=Object.assign(n,{text:!1,img_type:this.CVLikeMachineView?1:0}),t.push(n)}return t}},methods:{fetch_execute:async function(t,e,n,i){this.loading=!0;try{let o=await(await fetch(t,e)).json();n&&n(o)}catch(s){i&&i(s)}finally{this.loading=!1}},loadMachineState(){this.sendCommands(["$I","$$","$G","?"])},consoleLogAppend(t){this.consoleLog=this.consoleLog+t+` `},changeCamParam(t){this.camsViewParams[t.number]={raw:t.raw,cv:t.cv,ppmm:t.ppmm,grid:t.grid,marker:t.marker}},toggleCamParam(t){this.showWindow[t.number]==!0?this.closeCam(t.number):(this.changeCamParam(t),this.openCam(t.number))},toggleCam(t){this.toggleCamParam({number:t,raw:0,cv:0,ppmm:10,grid:1,marker:0})},openCam(t){this.showWindow[t]=!0},closeCam(t){let e=this.$refs["cam_feed"+t];e.src="",this.showWindow[t]=!1,t==0&&(this.camsViewSMDCase={case:"",rotate:0})},toggleCV(t){this.showWindow[t+2]==!0?this.closeCV(t):this.openCV(t)},lightOn(t){let e=this.settings.cams[t].lightOn;this.sendCommandUI(e)},lightOff(t){let e=this.settings.cams[t].lightOff;this.sendCommandUI(e)},toggleLight(t){this.lightsState[t]==!1?this.lightOn(t):this.lightOff(t)},getCV(t){let e="http://localhost:5000/cv/"+t,n=this.cvParams[t];this.fetch_execute(e,{method:"POST",credentials:"same-origin",cache:"no-cache",headers:{"Content-Type":"application/json;charset=utf-8"},body:JSON.stringify(n)},i=>{this.CVResult[t]=i,console.log(i.objects)},i=>{console.log(i),lt(i,"Error","error")})},openCV(t){this.showWindow[t+2]=!0,this.getCV(t)},closeCV(t){this.showWindow[t+2]=!1},toggleMoviePanel(){this.showWindow[4]==!0?this.closeMoviePanel():this.openMoviePanel()},openMoviePanel(){this.showWindow[4]=!0},closeMoviePanel(){this.showWindow[4]=!1},gCodeRun(t){this.sendCommands(t,!0)},gCodeStop(){this.gCodeProcess.pauseFlag=!1,this.gCodeProcess.stopFlag=!0},gCodePause(){this.gCodeProcess.pauseFlag=!this.gCodeProcess.pauseFlag},pnpProcessingRun(){this.pnpProcessing.pauseFlag=!1,this.pnpProcessing.stopFlag=!1,this.pnpProcessing.runFlag=!0},pnpProcessingPause(){this.pnpProcessing.pauseFlag=!this.pnpProcessing.pauseFlag},pnpProcessingResume(){this.pnpProcessing.pauseFlag=!1},pnpProcessingStop(){this.pnpProcessing.stopFlag=!0},pnpProcessingReset(){this.pnpProcessing.pauseFlag=!1,this.pnpProcessing.stopFlag=!1,this.pnpProcessing.runFlag=!1},moveOnClick(t){if(this.controlsEnabled==!0){let e=t.srcElement.width/2,n=t.srcElement.height/2,i=t.srcElement.id,s,o;i==0?(s=t.offsetX-e,o=n-t.offsetY):(s=t.offsetX-e,o=t.offsetY-n);let r=this.settings.cams[i].ppmm,a=Math.round(s/r*1e3)/1e3,l=Math.round(o/r*1e3)/1e3,d=`$J=G21G91X${a}Y${l}F500`;this.sendCommandUI(d)}},calibrate(t){let e="http://localhost:5000/calibration/"+t+"?"+Date.now();this.fetch_execute(e,{method:"GET",credentials:"same-origin",cache:"no-cache"},n=>{n.result=="OK"?(this.settings.cams[t].calibration=n,lt("Calibration complete successfully. Don't forget to apply settings.","Calibration","success")):lt(n.msg,"Error","error")},n=>{console.log(n),lt(n,"Error","error")})},loadSettings(){let t="http://localhost:5000/settings?"+Date.now();this.fetch_execute(t,{method:"GET",credentials:"same-origin",cache:"no-cache"},e=>{this.settings=this.deepMerge(this.settings,e)},e=>{console.log(e),lt(e,"Error","error")})},applaySettings(){let t="http://localhost:5000/settings",e=this.settings;this.fetch_execute(t,{method:"POST",credentials:"same-origin",cache:"no-cache",headers:{"Content-Type":"application/json;charset=utf-8"},body:JSON.stringify(e)},n=>{n.result=="OK"?lt("Settings applied successfully","Settings","success"):n.error?lt(n.error,"Error","error"):lt("Unexpected Error!","Error","error")},n=>{console.log(n),lt(n,"Error","error")})},setFeedersFromProject(){this.feeders=this.project.feeders,Un("Feeders set from current project applied as default feeder set, but settings is not saved yet. Do You want to save and apply settings?","Confirm").then(t=>{t==!0&&this.applaySettings()})},newProject(){this.project={name:"New Project",feeders:[],elements:[],pcb:{pos:{x:0,y:0,z:0}}}},loadProject(){this.loadJSON("projects",this.project.name,"project")},saveProject(){this.saveJSON("projects",this.project.name,this.project),setTimeout(()=>{this.loadProjectsList()},1e3)},renameProject(t){let e=`http://localhost:5000/json/rename/projects/${t.name}/${t.newName}`;this.fetch_execute(e,{method:"GET",credentials:"same-origin",cache:"no-cache"},n=>{this.loadProjectsList()},n=>{console.log(n),lt(n,"Error","error")})},deleteProject(t){let e=`http://localhost:5000/json/delete/projects/${t}`;this.fetch_execute(e,{method:"GET",credentials:"same-origin",cache:"no-cache"},n=>{this.loadProjectsList()},n=>{console.log(n),lt(n,"Error","error")})},loadProjectsList(){let t="http://localhost:5000/json-list/projects?"+Date.now();this.fetch_execute(t,{method:"GET",credentials:"same-origin",cache:"no-cache"},e=>{this.projects_list=e.result},e=>{console.log(e),lt(e,"Error","error")})},loadJSON(t,e,n){let i="http://localhost:5000/json";t!==""&&(i=i+"/"+t),i=i+"/"+e,this.fetch_execute(i,{method:"GET",credentials:"same-origin",cache:"no-cache"},s=>{this[n]=s.result},s=>{console.log(s),lt(s,"Error","error")})},saveJSON(t,e,n){let i="http://localhost:5000/json";t!==""&&(i=i+"/"+t),i=i+"/"+e,this.fetch_execute(i,{method:"POST",credentials:"same-origin",cache:"no-cache",headers:{"Content-Type":"application/json;charset=utf-8"},body:JSON.stringify(n)},s=>{s.result=="OK"?lt('File "'+e+'" saved successfully',"Settings","success"):s.error?lt(s.error,"Error","error"):lt("Unexpected Error!","Error","error")},s=>{console.log(s),lt(s,"Error","error")})},setSMDCase(t){this.camsViewSMDCase=t,this.drawTopCamCanvas()},drawTopCamCanvas(){if(this.$refs.camCanvas0){let t=this.$refs.camCanvas0,e=t.getContext("2d");if(e){e.globalAlpha=.7;let n=t.width,i=t.height,s=t.width/2,o="#239b56",r=1,a=n/2,l=i/2,d=2*Math.PI*parseFloat(this.camsViewSMDCase.rotate),u=parseFloat(this.settings.cams[0].ppmm),f=this.camsViewSMDCase.case;e.clearRect(0,0,n,i),e.translate(a,l),e.rotate(-d),e.translate(-a,-l),e.beginPath(),e.moveTo(a-s/2,l),e.lineTo(a+s/2,l),e.strokeStyle=o,e.lineWidth=r,e.arc(a,l,.6*u,0,2*Math.PI),e.stroke(),e.translate(a,l),e.rotate(d),e.translate(-a,-l);for(let h of this.cases)if(h.name==f){const m=new Image;m.src=h.src,m.onload=()=>{let b=n/2,y=i/2,p=96/25.4,T=m.width*(u/p),w=m.height*(u/p),S=b-T/2,I=y-w/2;e.translate(b,y),e.rotate(-d),e.translate(-b,-y),e.drawImage(m,S,I,T,w),e.translate(b,y),e.rotate(d),e.translate(-b,-y),e.stroke()}}}}}},mounted(){this.loadSettings(),this.loadJSON("","feeders","feeders"),this.loadProjectsList()},unmounted(){},watch:{async portIsOpened(t){t?(this.loadMachineState(),setTimeout(()=>{parseFloat(this.machineState.pos.x)+parseFloat(this.machineState.pos.y)+parseFloat(this.machineState.pos.z)==0&&Un("Are You wish to dispatch Machine to Home & Reset Zero?","Confirm").then(n=>{n==!0&&this.controllerMove("HomeResetZero")})},300)):this.machineState.status="Not connected"},showWindow:{handler(t,e){this.showWindow[0]==1&&setTimeout(()=>{this.drawTopCamCanvas()},200)},deep:!0},machineState:{handler(t,e){clearTimeout(this.timerId),this.timerId=setTimeout(()=>{this.drawTopCamCanvas()},200)},deep:!0}}},F4={class:"float-end tool-buttons"},O4={class:"row border bg-light machine-pos"},N4={class:"col-3 p-1"},z4={class:"col-3 p-1"},k4={class:"col-3 p-1"},B4={class:"col-3 p-1"},V4=["src"],H4=["width","height"],$4={class:"form-check form-switch"},G4=["checked"],W4=c("label",{class:"form-check-label",for:"topLight"},"Light",-1),X4=["src"],j4={class:"form-check form-switch"},Y4=["checked"],q4=c("label",{class:"form-check-label",for:"bottomLight"},"Light",-1),Z4=["src"],K4={class:"row m-0"},J4={class:"col form-check form-switch"},Q4=["checked"],eB=c("label",{class:"form-check-label",for:"topLight"},"Light",-1),tB={class:"col form-check form-switch"},nB=c("label",{class:"form-check-label",for:"machineView"},"Machine vision",-1),iB=["src"],sB={class:"row m-0"},oB={class:"col form-check form-switch"},rB=["checked"],aB=c("label",{class:"form-check-label",for:"bottomLight"},"Light",-1),lB={class:"col form-check form-switch"},cB=c("label",{class:"form-check-label",for:"machineView"},"Machine vision",-1),dB={class:"nav nav-tabs"},uB={class:"nav-item"},hB={class:"nav-item"},fB={class:"nav-item"},pB={class:"row mt-2"},mB={class:"col-md-auto left-column"},_B={class:"col-md central-column"},gB={class:"row"},vB={class:"col"},bB={class:"row"},yB={class:"col"},xB={class:"col-auto"},SB={class:"row mt-2"},MB={class:"col"},EB={class:"row flex-nowrap"},wB={class:"col-auto"},TB={class:"d-flex flex-column"},CB={class:"nav nav-pills flex-column"},AB={class:"nav-item"},PB={class:"nav-item"},RB={class:"nav-item"},DB={class:"nav-item"},IB={class:"nav-item"},LB={class:"nav-item"},UB={class:"nav-item"},FB={class:"nav-item"},OB={class:"nav-item"},NB={class:"nav-item"},zB={class:"nav-item"},kB={class:"col"},BB={class:"row mt-2"},VB={class:"col"},HB=c("hr",null,null,-1);function $B(t,e,n,i,s,o){const r=et("Loading"),a=et("DialogWrapper"),l=et("window"),d=et("ControllerMovingNew"),u=et("ControllerState"),f=et("ControllerGCode"),h=et("ControllerConsole"),m=et("Vializer3D"),b=et("ControllerSettings"),y=et("CamerasSettings"),_=et("CVSettings"),p=et("NozzlesSettings"),T=et("NozzlesHolderSettings"),w=et("HeadsSettings"),S=et("PumpSettings"),I=et("ParkingSettings"),P=et("BasketSettings"),D=et("FeedersSettings"),R=et("PCBTableSettings"),E=et("Projects");return W(),ee("div",null,[c("div",F4,[c("button",{class:je("btn btn-sm btn-outline-secondary p-0 ps-1 pe-1 m-0 me-1"+(s.showWindow[2]==!0?" active":"")),onClick:e[0]||(e[0]=g=>o.toggleCV(0))},"\u{1F441}\u{1F81F}",2),c("button",{class:je("btn btn-sm btn-outline-secondary p-0 ps-1 pe-1 m-0 me-1"+(s.showWindow[3]==!0?" active":"")),onClick:e[1]||(e[1]=g=>o.toggleCV(1))},"\u{1F441}\u{1F81D}",2),c("button",{class:je("btn btn-sm btn-outline-secondary p-0 ps-1 pe-1 m-0 me-1"+(s.showWindow[0]==!0?" active":"")),onClick:e[2]||(e[2]=g=>o.toggleCam(0))},"\u{1F4F7}\u{1F81F}",2),c("button",{class:je("btn btn-sm btn-outline-secondary p-0 ps-1 pe-1 m-0 me-1"+(s.showWindow[1]==!0?" active":"")),onClick:e[3]||(e[3]=g=>o.toggleCam(1))},"\u{1F4F7}\u{1F81D}",2),c("button",{class:je("btn btn-sm btn-outline-secondary p-0 ps-1 pe-1 m-0 me-1"+(s.showWindow[4]==!0?" active":"")),onClick:e[4]||(e[4]=g=>o.toggleMoviePanel())},"\xA0\u2725\xA0",2)]),c("div",O4,[c("div",N4," X: "+ze(o.machinePos.x),1),c("div",z4," Y: "+ze(o.machinePos.y),1),c("div",k4," Z: "+ze(o.machinePos.z),1),c("div",B4," A: "+ze(o.machinePos.a),1)]),ke(r,{loading:s.loading},null,8,["loading"]),ke(a),se(ke(l,{title:"Cam "+s.settings.cams[0].name,width:s.settings.cams[0].size.width+28,height:s.settings.cams[0].size.height+100,number:1,onClose:e[8]||(e[8]=g=>o.closeCam(0))},{default:Ct(()=>[s.showWindow[0]?(W(),ee("img",{key:0,ref:"cam_feed0",id:0,src:o.videoSrc[0],onClick:e[5]||(e[5]=(...g)=>o.moveOnClick&&o.moveOnClick(...g))},null,8,V4)):st("",!0),s.showWindow[0]?(W(),ee("canvas",{key:1,ref:"camCanvas0",id:0,width:s.settings.cams[0].size.width,height:s.settings.cams[0].size.height,style:uo("position: relative; top: -"+s.settings.cams[0].size.height+"px; margin-bottom: -"+(s.settings.cams[0].size.height-12)+"px;"),onClick:e[6]||(e[6]=(...g)=>o.moveOnClick&&o.moveOnClick(...g))},null,12,H4)):st("",!0),c("div",$4,[c("input",{onChange:e[7]||(e[7]=g=>o.toggleLight(0)),checked:o.lightsState[0],class:"form-check-input",type:"checkbox",role:"switch",id:"topLight"},null,40,G4),W4])]),_:1},8,["title","width","height"]),[[an,s.showWindow[0]]]),se(ke(l,{title:"Cam "+s.settings.cams[1].name,width:s.settings.cams[1].size.width+20,height:s.settings.cams[1].size.height+82,number:2,onClose:e[11]||(e[11]=g=>o.closeCam(1))},{default:Ct(()=>[s.showWindow[1]?(W(),ee("img",{key:0,ref:"cam_feed1",id:1,src:o.videoSrc[1],onClick:e[9]||(e[9]=(...g)=>o.moveOnClick&&o.moveOnClick(...g))},null,8,X4)):st("",!0),c("div",j4,[c("input",{onChange:e[10]||(e[10]=g=>o.toggleLight(1)),checked:o.lightsState[1],class:"form-check-input",type:"checkbox",role:"switch",id:"bottomLight"},null,40,Y4),q4])]),_:1},8,["title","width","height"]),[[an,s.showWindow[1]]]),se(ke(l,{title:"CV Top",width:s.settings.cams[0].size.width+20,height:s.settings.cams[0].size.height+82,number:3,onClose:e[16]||(e[16]=g=>o.closeCV(0))},{default:Ct(()=>[c("img",{ref:"cv0",src:s.CVResult[0].img,onClick:e[12]||(e[12]=g=>o.getCV(0)),title:"Click to Refresh"},null,8,Z4),c("div",K4,[c("div",J4,[c("input",{onChange:e[13]||(e[13]=g=>o.toggleLight(0)),checked:o.lightsState[0],class:"form-check-input",type:"checkbox",role:"switch",id:"topLight"},null,40,Q4),eB]),c("div",tB,[se(c("input",{"onUpdate:modelValue":e[14]||(e[14]=g=>s.CVLikeMachineView=g),onChange:e[15]||(e[15]=g=>o.getCV(0)),class:"form-check-input",type:"checkbox",role:"switch",id:"machineView"},null,544),[[Zn,s.CVLikeMachineView]]),nB])])]),_:1},8,["width","height"]),[[an,s.showWindow[2]]]),se(ke(l,{title:"CV Bottom",width:s.settings.cams[0].size.width+20,height:s.settings.cams[0].size.height+82,number:4,onClose:e[21]||(e[21]=g=>o.closeCV(1))},{default:Ct(()=>[c("img",{ref:"cv1",src:s.CVResult[1].img,onClick:e[17]||(e[17]=g=>o.getCV(1)),title:"Click to Refresh"},null,8,iB),c("div",sB,[c("div",oB,[c("input",{onChange:e[18]||(e[18]=g=>o.toggleLight(1)),checked:o.lightsState[1],class:"form-check-input",type:"checkbox",role:"switch",id:"bottomLight"},null,40,rB),aB]),c("div",lB,[se(c("input",{"onUpdate:modelValue":e[19]||(e[19]=g=>s.CVLikeMachineView=g),onChange:e[20]||(e[20]=g=>o.getCV(1)),class:"form-check-input",type:"checkbox",role:"switch",id:"machineView"},null,544),[[Zn,s.CVLikeMachineView]]),cB])])]),_:1},8,["width","height"]),[[an,s.showWindow[3]]]),se(ke(l,{title:"Move panel",width:350,height:680,number:5,onClose:e[26]||(e[26]=g=>o.closeMoviePanel())},{default:Ct(()=>[ke(d,{onCommand:e[22]||(e[22]=g=>t.controllerMove(g)),onToggleValve:e[23]||(e[23]=g=>t.controllerToggleValve(g)),onTogglePump:e[24]||(e[24]=g=>t.controllerTogglePump()),onToggleCamNozzlePosition:e[25]||(e[25]=g=>t.controllerToggleCamNozzlePosition()),settings:s.settings,movingOptions:s.movingOptions,valvesState:o.valvesState,pumpState:o.pumpState,disabled:!o.controlsEnabled,enabledUnderAlaram:o.controlsEnabledUnderAlarm},null,8,["settings","movingOptions","valvesState","pumpState","disabled","enabledUnderAlaram"])]),_:1},512),[[an,s.showWindow[4]]]),c("ul",dB,[c("li",uB,[c("a",{class:je("nav-link"+(s.tab==0?" active":"")),onClick:e[27]||(e[27]=g=>s.tab=0)},"Manual control",2)]),c("li",hB,[c("a",{class:je("nav-link"+(s.tab==1?" active":"")),onClick:e[28]||(e[28]=g=>s.tab=1)},"Settings",2)]),c("li",fB,[c("a",{class:je("nav-link"+(s.tab==2?" active":"")),onClick:e[29]||(e[29]=g=>s.tab=2)},"Projects",2)])]),se(c("div",pB,[c("div",mB,[ke(u,{state:s.machineState,pnpProcessing:s.pnpProcessing,valvesState:o.valvesState,pumpState:o.pumpState},null,8,["state","pnpProcessing","valvesState","pumpState"]),ke(d,{onCommand:e[30]||(e[30]=g=>t.controllerMove(g)),onToggleValve:e[31]||(e[31]=g=>t.controllerToggleValve(g)),onTogglePump:e[32]||(e[32]=g=>t.controllerTogglePump()),onToggleCamNozzlePosition:e[33]||(e[33]=g=>t.controllerToggleCamNozzlePosition()),settings:s.settings,movingOptions:s.movingOptions,valvesState:o.valvesState,pumpState:o.pumpState,disabled:!o.controlsEnabled,enabledUnderAlaram:o.controlsEnabledUnderAlarm},null,8,["settings","movingOptions","valvesState","pumpState","disabled","enabledUnderAlaram"])]),c("div",_B,[c("div",gB,[c("div",vB,[ke(f,{disabled:!o.controlsEnabled,machineState:s.machineState,gCodeProcess:s.gCodeProcess,onRun:e[34]||(e[34]=g=>o.gCodeRun(g)),onStop:e[35]||(e[35]=g=>o.gCodeStop()),onPause:e[36]||(e[36]=g=>o.gCodePause())},null,8,["disabled","machineState","gCodeProcess"])])]),c("div",bB,[c("div",yB,[ke(h,{consoleLog:s.consoleLog,disabled:!o.controlsEnabledUnderAlarm,onSendCommand:e[37]||(e[37]=g=>t.sendCommandUI([g]))},null,8,["consoleLog","disabled"])])])]),c("div",xB,[ke(m,{width:600,height:300,x:s.machineState.pos.x,y:s.machineState.pos.y,z:s.machineState.pos.z,a:s.machineState.pos.a,x_max:0,x_min:-200,y_max:0,y_min:-200,z_max:55,z_min:-55},null,8,["x","y","z","a"])])],512),[[an,s.tab==0]]),se(c("div",SB,[c("div",MB,[c("div",EB,[c("div",wB,[c("div",TB,[c("ul",CB,[c("li",AB,[c("a",{class:je("nav-link"+(s.tabSettings==0?" active":"")),onClick:e[38]||(e[38]=g=>s.tabSettings=0)},"Controller",2)]),c("li",PB,[c("a",{class:je("nav-link"+(s.tabSettings==1?" active":"")),onClick:e[39]||(e[39]=g=>s.tabSettings=1)},"Cameras",2)]),c("li",RB,[c("a",{class:je("nav-link"+(s.tabSettings==2?" active":"")),onClick:e[40]||(e[40]=g=>s.tabSettings=2)},"Computer Vision",2)]),c("li",DB,[c("a",{class:je("nav-link"+(s.tabSettings==3?" active":"")),onClick:e[41]||(e[41]=g=>s.tabSettings=3)},"Nozzles",2)]),c("li",IB,[c("a",{class:je("nav-link"+(s.tabSettings==4?" active":"")),onClick:e[42]||(e[42]=g=>s.tabSettings=4)},"Nozzles Holder",2)]),c("li",LB,[c("a",{class:je("nav-link"+(s.tabSettings==5?" active":"")),onClick:e[43]||(e[43]=g=>s.tabSettings=5)},"Heads",2)]),c("li",UB,[c("a",{class:je("nav-link"+(s.tabSettings==6?" active":"")),onClick:e[44]||(e[44]=g=>s.tabSettings=6)},"Pump",2)]),c("li",FB,[c("a",{class:je("nav-link"+(s.tabSettings==7?" active":"")),onClick:e[45]||(e[45]=g=>s.tabSettings=7)},"Parking",2)]),c("li",OB,[c("a",{class:je("nav-link"+(s.tabSettings==8?" active":"")),onClick:e[46]||(e[46]=g=>s.tabSettings=8)},"Basket",2)]),c("li",NB,[c("a",{class:je("nav-link"+(s.tabSettings==9?" active":"")),onClick:e[47]||(e[47]=g=>s.tabSettings=9)},"Feeders",2)]),c("li",zB,[c("a",{class:je("nav-link"+(s.tabSettings==10?" active":"")),onClick:e[48]||(e[48]=g=>s.tabSettings=10)},"PCB Table",2)])])])]),c("div",kB,[s.tabSettings==0?(W(),Jt(b,{key:0,settings:s.machineState.settings,disabled:!o.controlsEnabled,onSendCommand:e[49]||(e[49]=g=>t.sendCommands(g))},null,8,["settings","disabled"])):st("",!0),s.tabSettings==1?(W(),Jt(y,{key:1,cams:s.settings.cams,machineState:s.machineState,machinePos:o.machinePos,settings:s.settings,showWindow:s.showWindow,disabled:!o.controlsEnabled,loading:s.loading,onCalibrate:e[50]||(e[50]=g=>o.calibrate(g)),onSendCommands:e[51]||(e[51]=g=>t.sendCommands(g,!0)),onApplaySettings:e[52]||(e[52]=g=>o.applaySettings()),onToggleCam:e[53]||(e[53]=g=>o.toggleCamParam(g)),onChangeCamParam:e[54]||(e[54]=g=>o.changeCamParam(g)),onToggleMoviePanel:e[55]||(e[55]=g=>o.toggleMoviePanel())},null,8,["cams","machineState","machinePos","settings","showWindow","disabled","loading"])):st("",!0),s.tabSettings==2?(W(),Jt(_,{key:2,cvSettings:s.settings.cv,showWindow:s.showWindow,loading:s.loading,onToggleCV:e[56]||(e[56]=g=>o.toggleCV(g)),onApplaySettings:e[57]||(e[57]=g=>o.applaySettings())},null,8,["cvSettings","showWindow","loading"])):st("",!0),s.tabSettings==3?(W(),Jt(p,{key:3,nozzles:s.settings.nozzles,machineState:s.machineState,machinePos:o.machinePos,settings:s.settings,disabled:!o.controlsEnabled,loading:s.loading,onAutocalibrate:e[58]||(e[58]=g=>t.pnpAutocalibrateNozzle(g)),onApplaySettings:e[59]||(e[59]=g=>o.applaySettings())},null,8,["nozzles","machineState","machinePos","settings","disabled","loading"])):st("",!0),s.tabSettings==4?(W(),Jt(T,{key:4,nozzlesHolder:s.settings.nozzlesHolder,machineState:s.machineState,machinePos:o.machinePos,settings:s.settings,disabled:!o.controlsEnabled,loading:s.loading,onPutOnNozzle:e[60]||(e[60]=g=>t.pnpPutOnNozzle(g)),onApplaySettings:e[61]||(e[61]=g=>o.applaySettings())},null,8,["nozzlesHolder","machineState","machinePos","settings","disabled","loading"])):st("",!0),s.tabSettings==5?(W(),Jt(w,{key:5,heads:s.settings.heads,nozzles:s.settings.nozzles,loading:s.loading,onApplaySettings:e[62]||(e[62]=g=>o.applaySettings())},null,8,["heads","nozzles","loading"])):st("",!0),s.tabSettings==6?(W(),Jt(S,{key:6,pump:s.settings.pump,loading:s.loading,onApplaySettings:e[63]||(e[63]=g=>o.applaySettings())},null,8,["pump","loading"])):st("",!0),s.tabSettings==7?(W(),Jt(I,{key:7,parking:s.settings.parking,machineState:s.machineState,machinePos:o.machinePos,loading:s.loading,onApplaySettings:e[64]||(e[64]=g=>o.applaySettings())},null,8,["parking","machineState","machinePos","loading"])):st("",!0),s.tabSettings==8?(W(),Jt(P,{key:8,basket:s.settings.basket,machineState:s.machineState,machinePos:o.machinePos,loading:s.loading,onApplaySettings:e[65]||(e[65]=g=>o.applaySettings())},null,8,["basket","machineState","machinePos","loading"])):st("",!0),s.tabSettings==9?(W(),Jt(D,{key:9,settings:s.settings,cases:s.cases,machineState:s.machineState,machinePos:o.machinePos,feeders:s.feeders,disabled:!o.controlsEnabled,loading:s.loading,onGoToFeeder:e[66]||(e[66]=g=>t.pnpGoToFeeder(g)),onGoToFeederCam:e[67]||(e[67]=g=>t.pnpGoToFeederCam(g)),onPickFromFeeder:e[68]||(e[68]=g=>t.pnpPickFromFeeder(g)),onFixPosition:e[69]||(e[69]=g=>t.pnpFixPosition(g)),onDropIntoBasket:e[70]||(e[70]=g=>t.pnpDropIntoBasket(g)),onSaveFeeders:e[71]||(e[71]=g=>o.saveJSON("","feeders",this.feeders))},null,8,["settings","cases","machineState","machinePos","feeders","disabled","loading"])):st("",!0),s.tabSettings==10?(W(),Jt(R,{key:10,pcbtable:s.settings.table.pos,machineState:s.machineState,machinePos:o.machinePos,loading:s.loading,onApplaySettings:e[72]||(e[72]=g=>o.applaySettings())},null,8,["pcbtable","machineState","machinePos","loading"])):st("",!0)])])])],512),[[an,s.tab==1]]),se(c("div",BB,[c("div",VB,[ke(E,{project:s.project,projects_list:s.projects_list,disabled:!o.controlsEnabled,loading:s.loading,settings:s.settings,cases:s.cases,default_feeders:s.feeders,machineState:s.machineState,machinePos:o.machinePos,pnpProcessing:s.pnpProcessing,onSetSMDCase:e[73]||(e[73]=g=>o.setSMDCase(g)),onGoToFeeder:e[74]||(e[74]=g=>t.pnpGoToFeeder(g)),onGoToFeederCam:e[75]||(e[75]=g=>t.pnpGoToFeederCam(g)),onPickFromFeeder:e[76]||(e[76]=g=>t.pnpPickFromFeeder(g)),onFixPosition:e[77]||(e[77]=g=>t.pnpFixPosition(g)),onDropIntoBasket:e[78]||(e[78]=g=>t.pnpDropIntoBasket(g)),onGoToElement:e[79]||(e[79]=g=>t.pnpGoToElement(g)),onGoToElementCam:e[80]||(e[80]=g=>t.pnpGoToElementCam(g)),onPlaceElement:e[81]||(e[81]=g=>t.pnpPlaceElement(g)),onSetFeeders:e[82]||(e[82]=g=>o.setFeedersFromProject()),onNewProject:e[83]||(e[83]=g=>o.newProject()),onLoadProject:e[84]||(e[84]=g=>o.loadProject()),onSaveProject:e[85]||(e[85]=g=>o.saveProject()),onRenameProject:e[86]||(e[86]=g=>o.renameProject(g)),onDeleteProject:e[87]||(e[87]=g=>o.deleteProject(g)),onRun:e[88]||(e[88]=g=>t.pnpJobStart()),onRunFrom:e[89]||(e[89]=g=>t.pnpJobStart(g)),onPause:e[90]||(e[90]=g=>o.pnpProcessingPause()),onStop:e[91]||(e[91]=g=>o.pnpProcessingStop())},null,8,["project","projects_list","disabled","loading","settings","cases","default_feeders","machineState","machinePos","pnpProcessing"])])],512),[[an,s.tab==2]]),HB])}var GB=ct(U4,[["render",$B]]);const WB=S0({history:zg(),routes:[{path:"/",name:"home",component:GB},{path:"/about",name:"about",component:()=>V0(()=>import("./AboutView.84216d57.js"),[])}]}),yd=gg(z0);yd.use(WB);yd.use(by);yd.mount("#app");export{ct as _,c as a,ee as c,W as o};